@webority/ui-elements 0.169.1 → 0.170.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 (66) hide show
  1. package/dist/{WuiDataTable-D0tGIVtG.js → WuiDataTable-BSMhRQ1i.js} +1 -1
  2. package/dist/WuiDatePicker-u0oZ6fJj.js +34 -0
  3. package/dist/WuiDateRange-CtWUcQ-g.js +25 -0
  4. package/dist/{WuiInlineEdit-C64O31MF.js → WuiInlineEdit-BlsGNQSC.js} +1 -1
  5. package/dist/calendarMath-DIoh4HjR.js +1 -0
  6. package/dist/dataTable-oR_YiFJc.js +1 -0
  7. package/dist/datePicker.g-VdBlhA2G.js +1 -0
  8. package/dist/{drawerDiscard-CIZZuKmY.js → drawerDiscard-CM6a_8-l.js} +1 -1
  9. package/dist/elements/data-table.js +1 -1
  10. package/dist/elements/date-range.js +1 -1
  11. package/dist/elements/datepicker.js +1 -1
  12. package/dist/elements/inline-edit.js +1 -1
  13. package/dist/helpers.js +1 -1
  14. package/dist/{inlineEditText-5FT8SGqR.js → inlineEditText-CGaAKZhR.js} +1 -1
  15. package/dist/server.js +1 -1
  16. package/dist/text/en.json +3 -1
  17. package/dist/text.js +1 -1
  18. package/dist/ui-chart.global.js +2 -2
  19. package/dist/ui-chart.js +2 -2
  20. package/dist/ui-elements/carousel.global.js +1 -1
  21. package/dist/ui-elements/code-block.global.js +1 -1
  22. package/dist/ui-elements/command-palette.global.js +1 -1
  23. package/dist/ui-elements/comment-thread.global.js +1 -1
  24. package/dist/ui-elements/consent-banner.global.js +1 -1
  25. package/dist/ui-elements/context-menu.global.js +1 -1
  26. package/dist/ui-elements/date-range.global.js +1 -1
  27. package/dist/ui-elements/drawer.global.js +1 -1
  28. package/dist/ui-elements/dropdown.global.js +1 -1
  29. package/dist/ui-elements/entry-grid.global.js +1 -1
  30. package/dist/ui-elements/gantt.global.js +1 -1
  31. package/dist/ui-elements/glyphs.global.js +1 -1
  32. package/dist/ui-elements/image-crop.global.js +1 -1
  33. package/dist/ui-elements/inline-edit.global.js +1 -1
  34. package/dist/ui-elements/kanban.global.js +1 -1
  35. package/dist/ui-elements/lead-popup.global.js +1 -1
  36. package/dist/ui-elements/lightbox.global.js +1 -1
  37. package/dist/ui-elements/markdown.global.js +1 -1
  38. package/dist/ui-elements/org-tree.global.js +1 -1
  39. package/dist/ui-elements/phone.global.js +1 -1
  40. package/dist/ui-elements/popover.global.js +1 -1
  41. package/dist/ui-elements/saved-views.global.js +1 -1
  42. package/dist/ui-elements/select-chips.global.js +1 -1
  43. package/dist/ui-elements/select-recents.global.js +1 -1
  44. package/dist/ui-elements/select-search.global.js +1 -1
  45. package/dist/ui-elements/select-window.global.js +1 -1
  46. package/dist/ui-elements/slider.global.js +1 -1
  47. package/dist/ui-elements/sortable.global.js +1 -1
  48. package/dist/ui-elements/status-icon.global.js +1 -1
  49. package/dist/ui-elements/timepicker.global.js +1 -1
  50. package/dist/ui-elements/tour.global.js +1 -1
  51. package/dist/ui-elements/tree-picker.global.js +1 -1
  52. package/dist/ui-elements/tree.global.js +1 -1
  53. package/dist/ui-elements/wizard.global.js +1 -1
  54. package/dist/ui-elements.global.js +11 -8
  55. package/dist/ui-elements.js +1 -1
  56. package/package.json +5 -5
  57. package/types/WuiDatePicker.d.ts +22 -0
  58. package/types/calendarMath.d.ts +24 -0
  59. package/types/chartAdapter.d.ts +2 -0
  60. package/types/chartSpec.d.ts +2 -0
  61. package/types/text/web/datePicker.g.d.ts +2 -0
  62. package/dist/WuiDatePicker-BiZciUAZ.js +0 -31
  63. package/dist/WuiDateRange-DSq6Mj4v.js +0 -25
  64. package/dist/calendarMath-ChZ_s7HH.js +0 -1
  65. package/dist/dataTable-sRTzep19.js +0 -1
  66. package/dist/datePicker.g-CT9FBY21.js +0 -1
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.169.1`)throw Error(`[webority-ui] kanban expects ui-elements 0.169.1 but the page loaded `+s+`.`);var c={ariaLabel:`Board`,busyMessage:`This card is still saving. Try again in a moment.`,cancelledText:`{card} was not moved.`,cardLabel:`Card`,clientMessage:`This card could not be moved. Refresh the board and try again.`,collapseLabel:`Collapse {title}`,columnsLabel:`Board columns`,dropHereText:`Drop here to move {card} to {column}.`,emptyText:`Nothing here`,expandLabel:`Expand {title}`,fewerLabel:`Show fewer`,forbiddenMessage:`You do not have permission to move this card.`,helpText:`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.`,liftedText:`Picked up {card} in {column}. Use the Left and Right arrow keys to choose a column.`,loadFailedMessage:`More cards could not be loaded. Try again.`,loadMoreText:`Show more ({n})`,loadingLabel:`Loading…`,lockedText:`{card} cannot be moved.`,moreText:`Show {count} more`,movedText:`Moved {card} to {column}.`,movingText:`Moving {card} to {column}.`,networkMessage:`Could not reach the server, so the card went back. Check your connection and try again.`,overRefusedText:`{column}. {reason}`,overSourceText:`{column}, where the card started.`,overTextOne:`{column}, 1 card. Drop allowed.`,overTextOther:`{column}, {count} cards. Drop allowed.`,refusedText:`Cards in {from} cannot move to {to}.`,rolledBackText:`{card} went back to {column}.`,serverMessage:`Something went wrong on our side, so the card went back. Try again in a moment.`,swipeHintText:`Swipe sideways or tap a column`},l=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),u=Object.freeze([`number`,`currency`,`compact`]),d=`wui-kanban:`,f=`(max-width: 767.98px)`,p=400,m=6,h=()=>(0,a.readText)(`kanban`,c),g=e=>typeof e==`object`&&!!e,_=e=>{let t=g(e)?e.collapsed:void 0;return g(t)?Object.fromEntries(Object.entries(t).map(([e,t])=>[e,!!t])):{}};function v(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 y(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 b(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||e.getAttribute(`data-wui-card`)||h().cardLabel}function x(e){return e?`${d}${e}`:null}function S(e,t=globalThis.localStorage){let n=x(e);if(!n||!t)return{};try{return _(JSON.parse(t.getItem(n)||`null`))}catch{return{}}}function C(e,t,n,r=globalThis.localStorage){let i=x(e);if(!i||!r)return;let a={...S(e,r),[String(t)]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch(e){if(!(e instanceof DOMException))throw e}}function w(e,t){if(!u.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${u.join(`, `)}.`);if(t!=null&&t!==``&&!(0,i.isMoneyUnit)(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.MONEY_UNITS.join(`, `)}.`);return e===`currency`?{style:`currency`,currency:`INR`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:t||`rupees`}:{style:`number`,decimals:0}}function T(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=()=>(0,a.readText)(`kanban`,c),ee=()=>({forbidden:E().forbiddenMessage,client:E().clientMessage,validation:E().clientMessage,server:E().serverMessage,network:E().networkMessage}),D=`[data-wui-column]`,O=`[data-wui-body]`,k=`[data-wui-card]`,A=`[data-wui-count]`,j=`[data-wui-summary]`,te=`[data-wui-empty]`,M=`[data-wui-drop-note]`,ne=`[data-wui-live]`,re=`[data-wui-help]`,N=`[data-wui-switch]`,ie=`[data-wui-scroller]`,P=`[data-wui-collapse]`,F=`[data-wui-more]`,I=`data-wui-visible-limit`,L=`data-wui-overflow`,R=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,z=`[data-wui-load-more]`,B=`data-wui-more-url`,ae=`data-wui-total`,V=`data-wui-unloaded`,H=48,U=16,oe=160,W=e=>e.getAttribute(`data-wui-column`),G=e=>e.getAttribute(`data-wui-card`),K=e=>e instanceof HTMLElement&&!!e.hidden||e.hasAttribute(`hidden`),se=e=>K(e)||e.hasAttribute(L),q=e=>e instanceof Element?e:null,ce=e=>typeof e==`object`&&e&&`name`in e?e.name:void 0,le=e=>typeof e==`object`&&e&&`message`in e?e.message:void 0,J=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Y=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),X=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},Z=()=>window.WUI??null,Q=(e,t)=>{e&&Z()?.toast(e,{variant:t})},$=class extends r.ElementBase{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)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>{e.target instanceof Element&&this._loadOnScroll(e.target)},!0),this.addEventListener(`dragstart`,e=>{q(e.target)?.closest(k)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,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 instanceof HTMLElement&&e.matches(k)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(O))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=W(t),r=v(t.getAttribute(I)),o=[],s=[];for(let e of this._cardsIn(t))this._filter&&(e.hidden=this._filter(e)===!1),K(e)?e.removeAttribute(L):(o.push(e),s.push(e.getAttribute(`data-wui-value`)));let c=this._expanded.has(n),l=y(o.map(G),r,c,this._revealed);for(let e of o)e.toggleAttribute(L,l.has(G(e)));let u=this._unloadedIn(t),d=String(o.length+u);for(let e of this._countsOf(t))e.textContent!==d&&(e.textContent=d);let f=J(t,te,HTMLElement);if(f&&(f.hidden=o.length>0),e){let n=t.querySelector(j);n&&(n.textContent=(0,i.formatValue)(T(s),e))}let p=J(t,F,HTMLElement);if(p){p.hidden=r==null||(c?o.length<=r:l.size===0),p.setAttribute(`aria-expanded`,c?`true`:`false`);let e=c?E().fewerLabel:(0,a.fillText)(E().moreText,{count:l.size});p.textContent!==e&&(p.textContent=e)}let m=J(t,z,HTMLButtonElement);if(m&&(m.hidden=u<=0,!t.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=(0,a.fillText)(E().loadMoreText,{n:u});m.textContent!==e&&(m.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 Y(this,D,HTMLElement)}_columnByKey(e){return this._columns().find(t=>W(t)===e)||null}_columnOf(e){return X(e,D,HTMLElement)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||W(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return J(e,O,HTMLElement)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e instanceof HTMLElement&&e.matches(k)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!se(e))}_allCards(){return Y(this,`${O} > ${k}`,HTMLElement)}_cardByKey(e){return this._allCards().find(t=>G(t)===e)||null}_countsOf(e){let t=W(e),n=[...this.querySelectorAll(N)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(A),...n.flatMap(e=>[...e.querySelectorAll(A)])]}_scroller(){return J(this,ie,HTMLElement)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?w(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(re);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=J(this,ne,HTMLElement);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=b(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce((0,a.fillText)(E().lockedText,{card:t})),this._fire(`wui:kanban:locked`,{key:G(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(E().busyMessage),Q(E().busyMessage,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),o=(0,a.fillText)(E().refusedText,{from:r?this._titleOf(r):String(t),to:i?this._titleOf(i):String(n)}),s=i?.getAttribute(`data-accept-from`),c=s?.split(/\s+/).filter(Boolean)??[];if(s!=null&&!c.includes(t))return{ok:!1,reason:o};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:o};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=b(e),r=new Map;for(let i of this._columns()){let o=W(i),s=this._check(e,t,o);r.set(o,s),i.setAttribute(`data-wui-drop`,s.source?`source`:s.ok?`ok`:`refused`);let c=J(i,M,HTMLElement);c&&!s.source&&(c.textContent=s.ok?(0,a.fillText)(E().dropHereText,{card:n,column:this._titleOf(i)}):s.reason,c.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=J(e,M,HTMLElement);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e);if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let i=W(r),s=this._columnByKey(t),c=b(e);if(i===t||!this._canLift(e))return!1;let l=this._check(e,i,t);if(!l.ok)return this._announce(l.reason),Q(l.reason,`info`),!1;if(!s)throw Error(`wui-kanban: no column "${String(t)}" on this board.`);let u=this._cardsIn(s),d=Number.isInteger(n)?Math.max(0,Math.min(n??0,u.length)):u.length,f={key:G(e),card:e,from:i,to:t,index:d},p=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,f),this._announce((0,a.fillText)(E().movedText,{card:c,column:this._titleOf(s)})),p&&this._refocusSoon(f.key),!0;if(!this._fire(`wui:kanban:move`,f,!0))return!1;let m=s.hasAttribute(I)&&!this._revealed.has(f.key);m&&this._revealed.add(f.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m},g=this._bodyOf(s);if(!g)throw Error(`wui-kanban: the target column has no body.`);g.insertBefore(e,u[d]||null),p&&this._focusMoved(e),this.refresh();let _=s.getAttribute(`data-wui-step`);if(_)return this._runStep(e,f,h,_,s.getAttribute(`data-wui-step-size`));let v=this.getAttribute(`move-url`);if(!v)return this._announce((0,a.fillText)(E().movedText,{card:c,column:this._titleOf(s)})),this._fire(`wui:kanban:moved`,{...f,result:null}),!0;this._lock(e,!0),this._announce((0,a.fillText)(E().movingText,{card:c,column:this._titleOf(s)}));let y=new URLSearchParams({card:String(f.key),from:String(i),to:String(t),index:String(d)}),x=await(0,o.wuiFetch)(v,{method:`POST`,body:y});if(this._lock(e,!1),x.kind===`session`)return!1;if(x.ok){let t=this._applyFragment(x.html)||e;return Q(x.message,`success`),this._announce((0,a.fillText)(E().movedText,{card:b(t),column:this._titleOf(s)})),this._fire(`wui:kanban:moved`,{...f,card:t,result:x}),!0}return this._rollback(e,h),x.kind!==`aborted`&&Q(x.message||ee()[x.kind]||E().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...f,kind:x.kind,status:x.status,message:x.message}),!1}async _runStep(e,t,n,r,i){let s=b(e),c=this._columnByKey(t.to),l=new URLSearchParams({card:String(t.key),from:String(t.from),to:String(t.to)}).toString(),u=r+(r.includes(`?`)?`&`:`?`)+l;this._lock(e,!0);let d;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);d=await(await t(u,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),ce(r)!==`AbortError`&&Q(E().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:le(r)??null}),!1}if(d?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce((0,a.fillText)(E().cancelledText,{card:s})),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let f=e,p=this.getAttribute(`card-url`);if(p){let n=await(0,o.wuiFetch)(`${p}${p.includes(`?`)?`&`:`?`}${new URLSearchParams({card:String(t.key)})}`);n.ok&&(f=this._applyFragment(n.html)||e)}if(this._lock(f,!1),!c)throw Error(`wui-kanban: no column "${String(t.to)}" on this board.`);return this._announce((0,a.fillText)(E().movedText,{card:b(f),column:this._titleOf(c)})),this._fire(`wui:kanban:moved`,{...t,card:f,result:d}),!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;if(t.revealed&&this._revealed.delete(G(e)),!t.parent)throw Error(`wui-kanban: the card had no parent to go back to.`);t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce((0,a.fillText)(E().rolledBackText,{card:b(e),column:this._titleOf(t.column)}))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))(0,n.devWarn)(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of Y(t.content,k,HTMLElement)){if(e.closest(`template`))continue;let t=this._cardByKey(G(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 Y(t.content,`template[data-wui-kanban-summary]`,HTMLTemplateElement))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(j)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),Z()?.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=q(e.target),n=t?X(t,k,HTMLElement):null;if(!n||!this.contains(n)||t?.closest(R))return;let r={card:n,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=r,e.pointerType===`touch`&&(r.timer=setTimeout(()=>{this._press===r&&this._startDrag(r,r.x,r.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=this._columnOf(r);if(!i)throw Error(`wui-kanban: the card is not inside a column.`);let o=W(i),s=r.getBoundingClientRect(),c=r.cloneNode(!0);if(!(c instanceof HTMLElement))return;let l=c;for(let e of[l,...l.querySelectorAll(`[id]`)])e.removeAttribute(`id`);l.removeAttribute(`data-wui-card`),l.removeAttribute(`tabindex`),l.setAttribute(`aria-hidden`,`true`),l.classList.add(`wui-kanban-ghost`),l.style.width=`${s.width}px`,this.appendChild(l),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:o,ghost:l,dx:t-s.left,dy:n-s.top,x:t,y:n,over:null,verdicts:this._markTargets(r,o)},this._announce((0,a.fillText)(E().liftedText,{card:b(r),column:this._titleOf(i)})),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;if(!n)throw Error(`wui-kanban: no drag in progress.`);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+H?r.scrollBy?.({left:-16}):e>t.right-H&&r.scrollBy?.({left:U}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<H?window.scrollBy?.({top:-16}):t>i-H&&window.scrollBy?.({top:U}))}_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+H&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-H&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:U}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer||void 0),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((0,a.fillText)(E().cancelledText,{card:b(n.card)}));return}let i=W(r),o=n.verdicts.get(i);o?.source?this._announce((0,a.fillText)(E().cancelledText,{card:b(n.card)})):o?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(o?.reason),Q(o?.reason,`info`))}_click(e){let t=q(e.target);if(this._suppressClick&&t?.closest(k)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let n=t?.closest(P);if(n&&this.contains(n)){let e=X(n,D,HTMLElement);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let r=t?.closest(z);if(r&&this.contains(r)){this._controlled()||this._loadMore(X(r,D,HTMLElement));return}let i=t?.closest(F);if(i&&this.contains(i)){this._controlled()||this._toggleMore(X(i,D,HTMLElement));return}let a=t?.closest(N);a&&this.contains(a)&&this._showColumn(a.getAttribute(`data-wui-switch`))}_keyDown(e){let t=this._kbd;if(t){this._liftedKey(e,t);return}let n=e.target instanceof HTMLElement?e.target:null;if(!n?.matches(k)||!this.contains(n))return;let r=this._columnOf(n);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(n))return;if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=W(r),i=this._columns();this._kbd={card:n,from:t,target:i.indexOf(r),verdicts:this._markTargets(n,t)},n.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),r.setAttribute(`data-wui-target`,``),this._announce((0,a.fillText)(E().liftedText,{card:b(n),column:this._titleOf(r)}));return}case`ArrowDown`:case`ArrowUp`:{if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=this._visibleCardsIn(r),i=t[t.indexOf(n)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),n=e.key===`ArrowRight`?1:-1;for(let i=(r?t.indexOf(r):-1)+n;i>=0&&i<t.length;i+=n){let n=t[i],r=n?this._visibleCardsIn(n)[0]:void 0;if(r&&n&&!n.hasAttribute(`data-collapsed`)){e.preventDefault(),r.focus();return}}return}}}_liftedKey(e,t){let 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];if(!i)return;i.setAttribute(`data-wui-target`,``),this._showColumn(W(i),!1);let o=t.verdicts.get(W(i));if(!o)throw Error(`wui-kanban: no verdict for the column.`);let s=this._titleOf(i);this._announce(o.source?(0,a.fillText)(E().overSourceText,{column:s}):o.ok?(0,a.pluralText)(E(),`overText`,this._cardsIn(i).filter(e=>!K(e)).length,{column:s}):(0,a.fillText)(E().overRefusedText,{column:s,reason:o.reason??``}));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target];if(!r)throw Error(`wui-kanban: the lifted card has no target column.`);let i=W(r),o=t.verdicts.get(i);if(!o)throw Error(`wui-kanban: no verdict for the column.`);if(!o.source&&!o.ok){this._announce(o.reason);return}this._endKeyboard(),o.source?this._announce((0,a.fillText)(E().cancelledText,{card:b(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((0,a.fillText)(E().cancelledText,{card:b(t.card)}));return}}_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=S(this.getAttribute(`board-id`));for(let t of this._columns()){let n=W(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,String(n))&&this._setCollapsed(t,e[String(n)],!1)}}_setCollapsed(e,t,n){let r=W(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(P))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?(0,a.fillText)(E().expandLabel,{title:i}):(0,a.fillText)(E().collapseLabel,{title:i}));n&&(C(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=W(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(G(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(B)?(e.hasAttribute(V)||e.setAttribute(V,String(Math.max(0,Number(e.getAttribute(ae))-this._cardsIn(e).length))),Number(e.getAttribute(V))):0}async _loadMore(e){if(!e)throw Error(`wui-kanban: the load-more button is outside a column.`);let t=Number(e.getAttribute(V));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let r=J(e,z,HTMLButtonElement);r&&(r.disabled=!0,r.textContent=E().loadingLabel);let i=new URL(String(e.getAttribute(B)),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let a=0,s=!1;try{let n=await(0,o.wuiFetch)(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])if(e.matches(k)&&!this._cardByKey(G(e))){if(!i)throw Error(`wui-kanban: the column has no body.`);i.append(e),a++}let o=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(V,String(/^\d+$/.test(o)?Number(o):Math.max(0,t-a))),s=!0}}catch(e){(0,n.devError)(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:W(e),added:a}):Q(E().loadFailedMessage,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(O))return;let t=X(e,D,HTMLElement);t?.hasAttribute(B)&&e.scrollTop+e.clientHeight>=e.scrollHeight-oe&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(N))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(N))e.getAttribute(`data-wui-switch`)===W(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};(0,t.defineElement)(`wui-kanban`,$),e.KANBAN_DRAG_THRESHOLD_PX=m,e.KANBAN_LONG_PRESS_MS=p,e.KANBAN_PHONE_QUERY=f,e.KANBAN_STORAGE_PREFIX=d,e.KANBAN_SUMMARY_FORMATS=u,e.KANBAN_TONES=l,e.WuiKanban=$,e.kanbanCardLabel=b,e.kanbanOverflow=y,e.kanbanStorageKey=x,e.kanbanSummaryFormat=w,e.kanbanVisibleLimit=v,e.readKanbanCollapsed=S,e.sumKanbanValues=T,e.writeKanbanCollapsed=C})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.wuiHttp);
1
+ (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.170.0`)throw Error(`[webority-ui] kanban expects ui-elements 0.170.0 but the page loaded `+s+`.`);var c={ariaLabel:`Board`,busyMessage:`This card is still saving. Try again in a moment.`,cancelledText:`{card} was not moved.`,cardLabel:`Card`,clientMessage:`This card could not be moved. Refresh the board and try again.`,collapseLabel:`Collapse {title}`,columnsLabel:`Board columns`,dropHereText:`Drop here to move {card} to {column}.`,emptyText:`Nothing here`,expandLabel:`Expand {title}`,fewerLabel:`Show fewer`,forbiddenMessage:`You do not have permission to move this card.`,helpText:`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.`,liftedText:`Picked up {card} in {column}. Use the Left and Right arrow keys to choose a column.`,loadFailedMessage:`More cards could not be loaded. Try again.`,loadMoreText:`Show more ({n})`,loadingLabel:`Loading…`,lockedText:`{card} cannot be moved.`,moreText:`Show {count} more`,movedText:`Moved {card} to {column}.`,movingText:`Moving {card} to {column}.`,networkMessage:`Could not reach the server, so the card went back. Check your connection and try again.`,overRefusedText:`{column}. {reason}`,overSourceText:`{column}, where the card started.`,overTextOne:`{column}, 1 card. Drop allowed.`,overTextOther:`{column}, {count} cards. Drop allowed.`,refusedText:`Cards in {from} cannot move to {to}.`,rolledBackText:`{card} went back to {column}.`,serverMessage:`Something went wrong on our side, so the card went back. Try again in a moment.`,swipeHintText:`Swipe sideways or tap a column`},l=Object.freeze([`neutral`,`primary`,`info`,`success`,`warning`,`danger`]),u=Object.freeze([`number`,`currency`,`compact`]),d=`wui-kanban:`,f=`(max-width: 767.98px)`,p=400,m=6,h=()=>(0,a.readText)(`kanban`,c),g=e=>typeof e==`object`&&!!e,_=e=>{let t=g(e)?e.collapsed:void 0;return g(t)?Object.fromEntries(Object.entries(t).map(([e,t])=>[e,!!t])):{}};function v(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 y(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 b(e){let t=(e.getAttribute(`aria-label`)||e.textContent||``).replace(/\s+/g,` `).trim();return t.length>80?`${t.slice(0,79)}…`:t||e.getAttribute(`data-wui-card`)||h().cardLabel}function x(e){return e?`${d}${e}`:null}function S(e,t=globalThis.localStorage){let n=x(e);if(!n||!t)return{};try{return _(JSON.parse(t.getItem(n)||`null`))}catch{return{}}}function C(e,t,n,r=globalThis.localStorage){let i=x(e);if(!i||!r)return;let a={...S(e,r),[String(t)]:!!n};try{r.setItem(i,JSON.stringify({collapsed:a}))}catch(e){if(!(e instanceof DOMException))throw e}}function w(e,t){if(!u.includes(e))throw TypeError(`Unsupported kanban summary format "${String(e)}". Use ${u.join(`, `)}.`);if(t!=null&&t!==``&&!(0,i.isMoneyUnit)(t))throw TypeError(`Unsupported kanban summary unit "${String(t)}". Use ${i.MONEY_UNITS.join(`, `)}.`);return e===`currency`?{style:`currency`,currency:`INR`,unit:t||`rupees`}:e===`compact`?{style:`compact`,currency:`INR`,unit:t||`rupees`}:{style:`number`,decimals:0}}function T(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=()=>(0,a.readText)(`kanban`,c),ee=()=>({forbidden:E().forbiddenMessage,client:E().clientMessage,validation:E().clientMessage,server:E().serverMessage,network:E().networkMessage}),D=`[data-wui-column]`,O=`[data-wui-body]`,k=`[data-wui-card]`,A=`[data-wui-count]`,j=`[data-wui-summary]`,te=`[data-wui-empty]`,M=`[data-wui-drop-note]`,ne=`[data-wui-live]`,re=`[data-wui-help]`,N=`[data-wui-switch]`,ie=`[data-wui-scroller]`,P=`[data-wui-collapse]`,F=`[data-wui-more]`,I=`data-wui-visible-limit`,L=`data-wui-overflow`,R=`input, select, textarea, [contenteditable=""], [contenteditable="true"], [data-wui-no-drag]`,z=`[data-wui-load-more]`,B=`data-wui-more-url`,ae=`data-wui-total`,V=`data-wui-unloaded`,H=48,U=16,oe=160,W=e=>e.getAttribute(`data-wui-column`),G=e=>e.getAttribute(`data-wui-card`),K=e=>e instanceof HTMLElement&&!!e.hidden||e.hasAttribute(`hidden`),se=e=>K(e)||e.hasAttribute(L),q=e=>e instanceof Element?e:null,ce=e=>typeof e==`object`&&e&&`name`in e?e.name:void 0,le=e=>typeof e==`object`&&e&&`message`in e?e.message:void 0,J=(e,t,n)=>{let r=e.querySelector(t);return r instanceof n?r:null},Y=(e,t,n)=>[...e.querySelectorAll(t)].filter(e=>e instanceof n),X=(e,t,n)=>{let r=e.closest(t);return r instanceof n?r:null},Z=()=>window.WUI??null,Q=(e,t)=>{e&&Z()?.toast(e,{variant:t})},$=class extends r.ElementBase{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)},this.addEventListener(`pointerdown`,e=>this._pointerDown(e)),this.addEventListener(`keydown`,e=>this._keyDown(e)),this.addEventListener(`click`,e=>this._click(e),!0),this.addEventListener(`scroll`,e=>{e.target instanceof Element&&this._loadOnScroll(e.target)},!0),this.addEventListener(`dragstart`,e=>{q(e.target)?.closest(k)&&e.preventDefault()}),this.addEventListener(`touchmove`,e=>{this._drag&&e.preventDefault()},{passive:!1})}_controlled(){return this.hasAttribute(`controlled`)}connectedCallback(){if(!this._wired){this._wired=!0,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 instanceof HTMLElement&&e.matches(k)&&this._prepareCard(e);this._queueRefresh()});for(let e of this.querySelectorAll(O))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=W(t),r=v(t.getAttribute(I)),o=[],s=[];for(let e of this._cardsIn(t))this._filter&&(e.hidden=this._filter(e)===!1),K(e)?e.removeAttribute(L):(o.push(e),s.push(e.getAttribute(`data-wui-value`)));let c=this._expanded.has(n),l=y(o.map(G),r,c,this._revealed);for(let e of o)e.toggleAttribute(L,l.has(G(e)));let u=this._unloadedIn(t),d=String(o.length+u);for(let e of this._countsOf(t))e.textContent!==d&&(e.textContent=d);let f=J(t,te,HTMLElement);if(f&&(f.hidden=o.length>0),e){let n=t.querySelector(j);n&&(n.textContent=(0,i.formatValue)(T(s),e))}let p=J(t,F,HTMLElement);if(p){p.hidden=r==null||(c?o.length<=r:l.size===0),p.setAttribute(`aria-expanded`,c?`true`:`false`);let e=c?E().fewerLabel:(0,a.fillText)(E().moreText,{count:l.size});p.textContent!==e&&(p.textContent=e)}let m=J(t,z,HTMLButtonElement);if(m&&(m.hidden=u<=0,!t.hasAttribute(`data-wui-loading`))){m.disabled=!1;let e=(0,a.fillText)(E().loadMoreText,{n:u});m.textContent!==e&&(m.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 Y(this,D,HTMLElement)}_columnByKey(e){return this._columns().find(t=>W(t)===e)||null}_columnOf(e){return X(e,D,HTMLElement)}_titleOf(e){return(e.querySelector(`.wui-kanban-title`)?.textContent||W(e)||``).replace(/\s+/g,` `).trim()}_bodyOf(e){return J(e,O,HTMLElement)}_cardsIn(e){let t=this._bodyOf(e);return t?[...t.children].filter(e=>e instanceof HTMLElement&&e.matches(k)):[]}_visibleCardsIn(e){return this._cardsIn(e).filter(e=>!se(e))}_allCards(){return Y(this,`${O} > ${k}`,HTMLElement)}_cardByKey(e){return this._allCards().find(t=>G(t)===e)||null}_countsOf(e){let t=W(e),n=[...this.querySelectorAll(N)].filter(e=>e.getAttribute(`data-wui-switch`)===t);return[...e.querySelectorAll(A),...n.flatMap(e=>[...e.querySelectorAll(A)])]}_scroller(){return J(this,ie,HTMLElement)}_summaryFormat(){let e=this.getAttribute(`summary-format`);return e?w(e,this.getAttribute(`summary-unit`)):null}_queueRefresh(){this._refreshQueued||(this._refreshQueued=!0,queueMicrotask(()=>{this._refreshQueued&&this.refresh()}))}_prepareCard(e){let t=this.querySelector(re);t?.id&&!e.hasAttribute(`aria-describedby`)&&e.setAttribute(`aria-describedby`,t.id),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}_announce(e){let t=J(this,ne,HTMLElement);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=b(e),n=this.hasAttribute(`readonly`);return n||e.hasAttribute(`data-wui-locked`)?(this._announce((0,a.fillText)(E().lockedText,{card:t})),this._fire(`wui:kanban:locked`,{key:G(e),card:e,reason:n?`readonly`:`locked`},!0),!1):e.getAttribute(`aria-busy`)!==`true`||(this._announce(E().busyMessage),Q(E().busyMessage,`info`),!1)}_check(e,t,n){if(t===n)return{ok:!1,source:!0,reason:null};let r=this._columnByKey(t),i=this._columnByKey(n),o=(0,a.fillText)(E().refusedText,{from:r?this._titleOf(r):String(t),to:i?this._titleOf(i):String(n)}),s=i?.getAttribute(`data-accept-from`),c=s?.split(/\s+/).filter(Boolean)??[];if(s!=null&&!c.includes(t))return{ok:!1,reason:o};if(typeof this.accept==`function`){let r=this.accept(e,t,n);if(r===!1)return{ok:!1,reason:o};if(typeof r==`string`&&r)return{ok:!1,reason:r}}return{ok:!0,reason:null}}_markTargets(e,t){let n=b(e),r=new Map;for(let i of this._columns()){let o=W(i),s=this._check(e,t,o);r.set(o,s),i.setAttribute(`data-wui-drop`,s.source?`source`:s.ok?`ok`:`refused`);let c=J(i,M,HTMLElement);c&&!s.source&&(c.textContent=s.ok?(0,a.fillText)(E().dropHereText,{card:n,column:this._titleOf(i)}):s.reason,c.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=J(e,M,HTMLElement);t&&(t.hidden=!0,t.textContent=``)}}async _commit(e,t,n){let r=this._columnOf(e);if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let i=W(r),s=this._columnByKey(t),c=b(e);if(i===t||!this._canLift(e))return!1;let l=this._check(e,i,t);if(!l.ok)return this._announce(l.reason),Q(l.reason,`info`),!1;if(!s)throw Error(`wui-kanban: no column "${String(t)}" on this board.`);let u=this._cardsIn(s),d=Number.isInteger(n)?Math.max(0,Math.min(n??0,u.length)):u.length,f={key:G(e),card:e,from:i,to:t,index:d},p=e.contains(document.activeElement);if(this._controlled())return this._fire(`wui:kanban:move`,f),this._announce((0,a.fillText)(E().movedText,{card:c,column:this._titleOf(s)})),p&&this._refocusSoon(f.key),!0;if(!this._fire(`wui:kanban:move`,f,!0))return!1;let m=s.hasAttribute(I)&&!this._revealed.has(f.key);m&&this._revealed.add(f.key);let h={parent:e.parentNode,next:e.nextSibling,column:r,revealed:m},g=this._bodyOf(s);if(!g)throw Error(`wui-kanban: the target column has no body.`);g.insertBefore(e,u[d]||null),p&&this._focusMoved(e),this.refresh();let _=s.getAttribute(`data-wui-step`);if(_)return this._runStep(e,f,h,_,s.getAttribute(`data-wui-step-size`));let v=this.getAttribute(`move-url`);if(!v)return this._announce((0,a.fillText)(E().movedText,{card:c,column:this._titleOf(s)})),this._fire(`wui:kanban:moved`,{...f,result:null}),!0;this._lock(e,!0),this._announce((0,a.fillText)(E().movingText,{card:c,column:this._titleOf(s)}));let y=new URLSearchParams({card:String(f.key),from:String(i),to:String(t),index:String(d)}),x=await(0,o.wuiFetch)(v,{method:`POST`,body:y});if(this._lock(e,!1),x.kind===`session`)return!1;if(x.ok){let t=this._applyFragment(x.html)||e;return Q(x.message,`success`),this._announce((0,a.fillText)(E().movedText,{card:b(t),column:this._titleOf(s)})),this._fire(`wui:kanban:moved`,{...f,card:t,result:x}),!0}return this._rollback(e,h),x.kind!==`aborted`&&Q(x.message||ee()[x.kind]||E().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...f,kind:x.kind,status:x.status,message:x.message}),!1}async _runStep(e,t,n,r,i){let s=b(e),c=this._columnByKey(t.to),l=new URLSearchParams({card:String(t.key),from:String(t.from),to:String(t.to)}).toString(),u=r+(r.includes(`?`)?`&`:`?`)+l;this._lock(e,!0);let d;try{let t=window.WUI?.modal?.load;if(typeof t!=`function`)throw Error(`<wui-kanban> data-wui-step needs the Razor script webority-ui.js (WUI.modal.load).`);d=await(await t(u,{trigger:e,size:i||void 0})).closed}catch(r){return this._lock(e,!1),this._rollback(e,n),ce(r)!==`AbortError`&&Q(E().serverMessage,`danger`),this._fire(`wui:kanban:failed`,{...t,kind:`step`,status:0,message:le(r)??null}),!1}if(d?.status!==`success`)return this._lock(e,!1),this._rollback(e,n),this._announce((0,a.fillText)(E().cancelledText,{card:s})),this._fire(`wui:kanban:failed`,{...t,kind:`dismissed`,status:0,message:null}),!1;let f=e,p=this.getAttribute(`card-url`);if(p){let n=await(0,o.wuiFetch)(`${p}${p.includes(`?`)?`&`:`?`}${new URLSearchParams({card:String(t.key)})}`);n.ok&&(f=this._applyFragment(n.html)||e)}if(this._lock(f,!1),!c)throw Error(`wui-kanban: no column "${String(t.to)}" on this board.`);return this._announce((0,a.fillText)(E().movedText,{card:b(f),column:this._titleOf(c)})),this._fire(`wui:kanban:moved`,{...t,card:f,result:d}),!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;if(t.revealed&&this._revealed.delete(G(e)),!t.parent)throw Error(`wui-kanban: the card had no parent to go back to.`);t.parent.insertBefore(e,r),n&&e.focus(),this.refresh(),this._announce((0,a.fillText)(E().rolledBackText,{card:b(e),column:this._titleOf(t.column)}))}_applyFragment(e){if(!e)return null;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`script`))(0,n.devWarn)(`[@webority/ui-elements] A kanban fragment carried a script tag; it was removed, not run.`),e.remove();let r=null;for(let e of Y(t.content,k,HTMLElement)){if(e.closest(`template`))continue;let t=this._cardByKey(G(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 Y(t.content,`template[data-wui-kanban-summary]`,HTMLTemplateElement))this._columnByKey(e.getAttribute(`data-wui-kanban-summary`))?.querySelector(j)?.replaceChildren(e.content.cloneNode(!0));return this.refresh(),Z()?.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=q(e.target),n=t?X(t,k,HTMLElement):null;if(!n||!this.contains(n)||t?.closest(R))return;let r={card:n,id:e.pointerId,x:e.clientX,y:e.clientY,type:e.pointerType,timer:0};this._press=r,e.pointerType===`touch`&&(r.timer=setTimeout(()=>{this._press===r&&this._startDrag(r,r.x,r.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=this._columnOf(r);if(!i)throw Error(`wui-kanban: the card is not inside a column.`);let o=W(i),s=r.getBoundingClientRect(),c=r.cloneNode(!0);if(!(c instanceof HTMLElement))return;let l=c;for(let e of[l,...l.querySelectorAll(`[id]`)])e.removeAttribute(`id`);l.removeAttribute(`data-wui-card`),l.removeAttribute(`tabindex`),l.setAttribute(`aria-hidden`,`true`),l.classList.add(`wui-kanban-ghost`),l.style.width=`${s.width}px`,this.appendChild(l),r.setAttribute(`data-wui-dragging`,``),this.setAttribute(`data-wui-dragging`,``),this._drag={card:r,from:o,ghost:l,dx:t-s.left,dy:n-s.top,x:t,y:n,over:null,verdicts:this._markTargets(r,o)},this._announce((0,a.fillText)(E().liftedText,{card:b(r),column:this._titleOf(i)})),document.addEventListener(`keydown`,this._onDocKeyDown),this._dragTo(t,n)}_dragTo(e,t){let n=this._drag;if(!n)throw Error(`wui-kanban: no drag in progress.`);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+H?r.scrollBy?.({left:-16}):e>t.right-H&&r.scrollBy?.({left:U}))}if(n&&this._scrollColumn(n,t))return;let i=window.innerHeight||0;i>0&&(t<H?window.scrollBy?.({top:-16}):t>i-H&&window.scrollBy?.({top:U}))}_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+H&&n.scrollTop>0?(n.scrollBy?.({top:-16}),!0):t>r.bottom-H&&n.scrollTop+n.clientHeight<n.scrollHeight-1&&(n.scrollBy?.({top:U}),!0)}_endPointer(e){let t=this._press,n=this._drag;if(t&&clearTimeout(t.timer||void 0),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((0,a.fillText)(E().cancelledText,{card:b(n.card)}));return}let i=W(r),o=n.verdicts.get(i);o?.source?this._announce((0,a.fillText)(E().cancelledText,{card:b(n.card)})):o?.ok?this._commit(n.card,i,this._indexAt(r,n.y)):(this._announce(o?.reason),Q(o?.reason,`info`))}_click(e){let t=q(e.target);if(this._suppressClick&&t?.closest(k)){e.preventDefault(),e.stopPropagation(),this._suppressClick=!1;return}let n=t?.closest(P);if(n&&this.contains(n)){let e=X(n,D,HTMLElement);e&&this._setCollapsed(e,!e.hasAttribute(`data-collapsed`),!0);return}let r=t?.closest(z);if(r&&this.contains(r)){this._controlled()||this._loadMore(X(r,D,HTMLElement));return}let i=t?.closest(F);if(i&&this.contains(i)){this._controlled()||this._toggleMore(X(i,D,HTMLElement));return}let a=t?.closest(N);a&&this.contains(a)&&this._showColumn(a.getAttribute(`data-wui-switch`))}_keyDown(e){let t=this._kbd;if(t){this._liftedKey(e,t);return}let n=e.target instanceof HTMLElement?e.target:null;if(!n?.matches(k)||!this.contains(n))return;let r=this._columnOf(n);switch(e.key){case` `:case`Spacebar`:{if(e.preventDefault(),!this._canLift(n))return;if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=W(r),i=this._columns();this._kbd={card:n,from:t,target:i.indexOf(r),verdicts:this._markTargets(n,t)},n.setAttribute(`data-wui-lifted`,``),this.setAttribute(`data-wui-dragging`,``),r.setAttribute(`data-wui-target`,``),this._announce((0,a.fillText)(E().liftedText,{card:b(n),column:this._titleOf(r)}));return}case`ArrowDown`:case`ArrowUp`:{if(!r)throw Error(`wui-kanban: the card is not inside a column.`);let t=this._visibleCardsIn(r),i=t[t.indexOf(n)+(e.key===`ArrowDown`?1:-1)];i&&(e.preventDefault(),i.focus());return}case`ArrowLeft`:case`ArrowRight`:{let t=this._columns(),n=e.key===`ArrowRight`?1:-1;for(let i=(r?t.indexOf(r):-1)+n;i>=0&&i<t.length;i+=n){let n=t[i],r=n?this._visibleCardsIn(n)[0]:void 0;if(r&&n&&!n.hasAttribute(`data-collapsed`)){e.preventDefault(),r.focus();return}}return}}}_liftedKey(e,t){let 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];if(!i)return;i.setAttribute(`data-wui-target`,``),this._showColumn(W(i),!1);let o=t.verdicts.get(W(i));if(!o)throw Error(`wui-kanban: no verdict for the column.`);let s=this._titleOf(i);this._announce(o.source?(0,a.fillText)(E().overSourceText,{column:s}):o.ok?(0,a.pluralText)(E(),`overText`,this._cardsIn(i).filter(e=>!K(e)).length,{column:s}):(0,a.fillText)(E().overRefusedText,{column:s,reason:o.reason??``}));return}case` `:case`Spacebar`:case`Enter`:{e.preventDefault();let r=n[t.target];if(!r)throw Error(`wui-kanban: the lifted card has no target column.`);let i=W(r),o=t.verdicts.get(i);if(!o)throw Error(`wui-kanban: no verdict for the column.`);if(!o.source&&!o.ok){this._announce(o.reason);return}this._endKeyboard(),o.source?this._announce((0,a.fillText)(E().cancelledText,{card:b(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((0,a.fillText)(E().cancelledText,{card:b(t.card)}));return}}_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=S(this.getAttribute(`board-id`));for(let t of this._columns()){let n=W(t);t.hasAttribute(`data-collapsible`)&&Object.hasOwn(e,String(n))&&this._setCollapsed(t,e[String(n)],!1)}}_setCollapsed(e,t,n){let r=W(e);e.toggleAttribute(`data-collapsed`,t);let i=this._titleOf(e);for(let n of e.querySelectorAll(P))n.setAttribute(`aria-expanded`,t?`false`:`true`),n.setAttribute(`aria-label`,t?(0,a.fillText)(E().expandLabel,{title:i}):(0,a.fillText)(E().collapseLabel,{title:i}));n&&(C(this.getAttribute(`board-id`),r,t),this._fire(`wui:kanban:collapse`,{column:r,collapsed:t}))}_toggleMore(e){if(!e)return;let t=W(e);if(this._expanded.delete(t))for(let t of this._cardsIn(e))this._revealed.delete(G(t));else this._expanded.add(t);this.refresh()}_unloadedIn(e){return e.hasAttribute(B)?(e.hasAttribute(V)||e.setAttribute(V,String(Math.max(0,Number(e.getAttribute(ae))-this._cardsIn(e).length))),Number(e.getAttribute(V))):0}async _loadMore(e){if(!e)throw Error(`wui-kanban: the load-more button is outside a column.`);let t=Number(e.getAttribute(V));if(e.hasAttribute(`data-wui-loading`)||!(t>0))return;e.setAttribute(`data-wui-loading`,``);let r=J(e,z,HTMLButtonElement);r&&(r.disabled=!0,r.textContent=E().loadingLabel);let i=new URL(String(e.getAttribute(B)),document.baseURI);i.searchParams.set(`skip`,String(this._cardsIn(e).length));let a=0,s=!1;try{let n=await(0,o.wuiFetch)(i.toString());if(n.ok){let r=document.createElement(`template`);r.innerHTML=n.html;let i=this._bodyOf(e);for(let e of[...r.content.children])if(e.matches(k)&&!this._cardByKey(G(e))){if(!i)throw Error(`wui-kanban: the column has no body.`);i.append(e),a++}let o=n.response?.headers.get(`Wui-Kanban-Remaining`)??``;e.setAttribute(V,String(/^\d+$/.test(o)?Number(o):Math.max(0,t-a))),s=!0}}catch(e){(0,n.devError)(`[@webority/ui-elements] A kanban column could not load its next cards.`,e)}e.removeAttribute(`data-wui-loading`),this.refresh(),s?this._fire(`wui:kanban:loaded`,{key:W(e),added:a}):Q(E().loadFailedMessage,`danger`)}_loadOnScroll(e){if(this._controlled()||!e.matches(O))return;let t=X(e,D,HTMLElement);t?.hasAttribute(B)&&e.scrollTop+e.clientHeight>=e.scrollHeight-oe&&this._loadMore(t)}_isPhone(){return typeof matchMedia==`function`&&matchMedia(`(max-width: 767.98px)`).matches}_showColumn(e,t=!0){for(let t of this.querySelectorAll(N))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(N))e.getAttribute(`data-wui-switch`)===W(n)?e.setAttribute(`aria-current`,`true`):e.removeAttribute(`aria-current`)}};(0,t.defineElement)(`wui-kanban`,$),e.KANBAN_DRAG_THRESHOLD_PX=m,e.KANBAN_LONG_PRESS_MS=p,e.KANBAN_PHONE_QUERY=f,e.KANBAN_STORAGE_PREFIX=d,e.KANBAN_SUMMARY_FORMATS=u,e.KANBAN_TONES=l,e.WuiKanban=$,e.kanbanCardLabel=b,e.kanbanOverflow=y,e.kanbanStorageKey=x,e.kanbanSummaryFormat=w,e.kanbanVisibleLimit=v,e.readKanbanCollapsed=S,e.sumKanbanValues=T,e.writeKanbanCollapsed=C})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.wuiHttp);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.169.1`)throw Error(`[webority-ui] lead-popup expects ui-elements 0.169.1 but the page loaded `+a+`.`);var o={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-soft":`#E0E7FF`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-border-strong":`#C4CADA`,"--color-surface":`#FFFFFF`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-modal":`1505`},s=e=>`var(${e}, ${o[e]})`,c=`
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.170.0`)throw Error(`[webority-ui] lead-popup expects ui-elements 0.170.0 but the page loaded `+a+`.`);var o={"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-soft":`#E0E7FF`,"--color-primary-text":`#4F46E5`,"--color-on-primary":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-border-strong":`#C4CADA`,"--color-surface":`#FFFFFF`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-modal":`0px 24px 60px -16px rgba(7, 20, 55, 0.28)`,"--wui-z-modal":`1505`},s=e=>`var(${e}, ${o[e]})`,c=`
2
2
  :host {
3
3
  all: initial;
4
4
  display: contents;
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.169.1`)throw Error(`[webority-ui] lightbox expects ui-elements 0.169.1 but the page loaded `+s+`.`);var c={closeLabel:`Close`,countText:`{position} of {total}`,downloadLabel:`Download`,imageFailedMessage:`This image can't be shown.`,label:`Image viewer`,nextImageLabel:`Next image`,previousImageLabel:`Previous image`,zoomInLabel:`Zoom in`,zoomOutLabel:`Zoom out`},l=`a.wui-lightbox-item`,u=1,d=4,f=.5,p=2,m=50,h=6,g=300,_=300;function v(e){return Number.isFinite(e)?Math.min(d,Math.max(u,e)):u}function y(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function b(e,t){return Math.abs(e)<m||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function x(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function S(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}var C=()=>(0,o.readText)(`lightbox`,c);function w(e,t,n){let r=S(`button`,`u-action wui-lightbox-btn ${n}`,{type:`button`,"aria-label":t,title:t});return r.style.setProperty(`--wui-action-size`,`40px`),r.innerHTML=(0,i.glyphSvg)(e,{size:20}),r}var T=class extends n.ElementBase{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=u,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(l):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||C().label}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(l)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||x(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let e=S(`dialog`,`wui-lightbox-overlay`,{role:`dialog`,"aria-label":this.label,tabindex:`-1`}),t=S(`div`,`wui-lightbox-bar`),n=S(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),r=S(`div`,`wui-lightbox-tools`),o=w(`zoom-out`,C().zoomOutLabel,`wui-lightbox-zoom-out`),s=w(`zoom-in`,C().zoomInLabel,`wui-lightbox-zoom-in`),c=S(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":C().downloadLabel,title:C().downloadLabel});c.style.setProperty(`--wui-action-size`,`40px`),c.innerHTML=(0,i.glyphSvg)(`download`,{size:20}),c.hidden=!this.download;let l=w(`x`,C().closeLabel,`wui-lightbox-close`);r.append(o,s,c,l),t.append(n,r);let u=S(`div`,`wui-lightbox-stage`),d=w(`chevron-left`,C().previousImageLabel,`wui-lightbox-nav wui-lightbox-prev`),p=w(`chevron-right`,C().nextImageLabel,`wui-lightbox-nav wui-lightbox-next`),m=S(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),h=S(`p`,`wui-lightbox-status`,{role:`status`});u.append(m,h,d,p);let g=S(`p`,`wui-lightbox-caption`);e.append(t,u,g);let _={root:e,count:n,zoomOut:o,zoomIn:s,download:c,close:l,stage:u,prev:d,next:p,image:m,status:h,caption:g};this._ui=_,l.addEventListener(`click`,()=>this.close()),d.addEventListener(`click`,()=>this.step(-1)),p.addEventListener(`click`,()=>this.step(1)),o.addEventListener(`click`,()=>this._setZoom(this._zoom-f)),s.addEventListener(`click`,()=>this._setZoom(this._zoom+f)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),u.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),u.addEventListener(`pointermove`,e=>this._onPointerMove(e)),u.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),u.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),u.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),m.addEventListener(`load`,()=>{this._ui===_&&(h.textContent=``,u.removeAttribute(`aria-busy`),m.hidden=!1,this._applyTransform())}),m.addEventListener(`error`,()=>{this._ui===_&&(u.removeAttribute(`aria-busy`),m.hidden=!0,h.textContent=C().imageFailedMessage)}),this.append(e),this._release=(0,a.openModalDialog)(e,{escape:!0,backdrop:!1,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,i=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),a=t[i];if(!a)throw Error(`<wui-lightbox> image missing.`);let s=i!==this._index||!n.image.getAttribute(`src`);if(this._index=i,this._zoom=u,this._pan={x:0,y:0},n.count.textContent=(0,o.fillText)(C().countText,{position:(0,r.formatNumber)(i+1,{decimals:0}),total:(0,r.formatNumber)(t.length,{decimals:0})}),n.caption.textContent=a.caption,n.caption.hidden=!a.caption,n.download.href=a.src,n.download.setAttribute(`download`,a.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=a.alt||a.caption,n.image.src=a.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(i+1)%t.length],n=t[(i-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}s&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=u,e.zoomIn.disabled=this._zoom>=d;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=v(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return y(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>u)}_onKeyDown(e){if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+f)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-f)):e.key===`0`&&(e.preventDefault(),this._setZoom(u))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>h&&(t.moved=!0),this._zoom>u&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===u&&this.step(b(r,i)):e.timeStamp-n.startTime>g||(n.onImage?e.timeStamp-this._lastTap<_?(this._lastTap=-1/0,this._setZoom(this._zoom>u?u:p)):this._lastTap=e.timeStamp:this.close())}};(0,t.defineElement)(`wui-lightbox`,T),e.WuiLightbox=T})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.textStore);
1
+ (function(e,t,n,r,i,a,o){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var s=globalThis.WeborityUiElementsInternal?.version;if(s!==`0.170.0`)throw Error(`[webority-ui] lightbox expects ui-elements 0.170.0 but the page loaded `+s+`.`);var c={closeLabel:`Close`,countText:`{position} of {total}`,downloadLabel:`Download`,imageFailedMessage:`This image can't be shown.`,label:`Image viewer`,nextImageLabel:`Next image`,previousImageLabel:`Previous image`,zoomInLabel:`Zoom in`,zoomOutLabel:`Zoom out`},l=`a.wui-lightbox-item`,u=1,d=4,f=.5,p=2,m=50,h=6,g=300,_=300;function v(e){return Number.isFinite(e)?Math.min(d,Math.max(u,e)):u}function y(e,t,n,r){let i=(e,n)=>Math.max(0,(e*t-n)/2),a=i(r.width,n.width),o=i(r.height,n.height);return{x:Math.min(a,Math.max(-a,e.x)),y:Math.min(o,Math.max(-o,e.y))}}function b(e,t){return Math.abs(e)<m||Math.abs(e)<Math.abs(t)*1.5?0:e<0?1:-1}function x(e){let t=(String(e??``).split(/[?#]/)[0]??``).split(`/`).filter(Boolean).pop()??``;try{return decodeURIComponent(t)}catch{return t}}function S(e,t,n={}){let r=document.createElement(e);r.className=t;for(let[e,t]of Object.entries(n))r.setAttribute(e,t);return r}var C=()=>(0,o.readText)(`lightbox`,c);function w(e,t,n){let r=S(`button`,`u-action wui-lightbox-btn ${n}`,{type:`button`,"aria-label":t,title:t});return r.style.setProperty(`--wui-action-size`,`40px`),r.innerHTML=(0,i.glyphSvg)(e,{size:20}),r}var T=class extends n.ElementBase{_ui;_index;_zoom;_pan;_pointers;_gesture;_lastTap;_returnTo;_release;_onClick;static get observedAttributes(){return[`open-index`]}constructor(){super(),this._ui=null,this._index=0,this._zoom=u,this._pan={x:0,y:0},this._pointers=new Map,this._gesture=null,this._lastTap=-1/0,this._returnTo=null,this._release=null,this._onClick=e=>{if(e.defaultPrevented||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let t=e.target,n=t instanceof Element?t.closest(l):null;if(!(n instanceof HTMLAnchorElement)||!this.contains(n))return;let r=this._links().indexOf(n);r<0||(e.preventDefault(),this.open(r))}}get _view(){if(!this._ui)throw Error(`<wui-lightbox> viewer is not open.`);return this._ui}get download(){return this.hasAttribute(`download`)}set download(e){this.toggleAttribute(`download`,e===!0||e===``||e===`true`)}get label(){return this.getAttribute(`label`)||C().label}set label(e){this.setAttribute(`label`,String(e??``))}get layout(){return this.getAttribute(`layout`)===`single`?`single`:`gallery`}set layout(e){if(e===`single`)this.setAttribute(`layout`,`single`);else if(e===`gallery`||e===``)this.removeAttribute(`layout`);else throw Error(`<wui-lightbox> layout must be "gallery" or "single", received "${e}".`)}get isOpen(){return this._ui!==null}connectedCallback(){this.addEventListener(`click`,this._onClick),this._syncOpenIndex()}disconnectedCallback(){this.removeEventListener(`click`,this._onClick),this._teardown()}attributeChangedCallback(){this.isConnected&&this._syncOpenIndex()}_syncOpenIndex(){let e=this.getAttribute(`open-index`);e===null?this.close():this.open(Number(e))}_links(){return[...this.querySelectorAll(l)].filter(e=>e instanceof HTMLAnchorElement)}_items(){return this._links().map(e=>{let t=e.getAttribute(`href`)??``;return{link:e,src:t,alt:e.querySelector(`img`)?.getAttribute(`alt`)??``,caption:e.dataset.caption??``,name:e.dataset.name||x(t)}})}open(e=0){let t=this._items();if(!t.length)return!1;if(!this._ui){let t=document.activeElement;this._returnTo=t instanceof HTMLElement||t instanceof SVGElement?t:null,this._build(),this.dispatchEvent(new CustomEvent(`wui-lightbox:open`,{bubbles:!0,detail:{index:e}}))}return this._show(e,t),!0}close(){if(!this._ui)return;let e=this._index,t=this._links()[e]??this._returnTo;this._teardown(),t?.isConnected&&t.focus(),this._returnTo=null,this.dispatchEvent(new CustomEvent(`wui-lightbox:close`,{bubbles:!0,detail:{index:e}}))}_teardown(){this._ui&&(this._release?.(),this._release=null,this._ui.root.open&&this._ui.root.close(),this._ui.root.remove(),this._ui=null,this._pointers.clear(),this._gesture=null)}_build(){let e=S(`dialog`,`wui-lightbox-overlay`,{role:`dialog`,"aria-label":this.label,tabindex:`-1`}),t=S(`div`,`wui-lightbox-bar`),n=S(`span`,`wui-lightbox-count`,{"aria-live":`polite`}),r=S(`div`,`wui-lightbox-tools`),o=w(`zoom-out`,C().zoomOutLabel,`wui-lightbox-zoom-out`),s=w(`zoom-in`,C().zoomInLabel,`wui-lightbox-zoom-in`),c=S(`a`,`u-action wui-lightbox-btn wui-lightbox-download`,{"aria-label":C().downloadLabel,title:C().downloadLabel});c.style.setProperty(`--wui-action-size`,`40px`),c.innerHTML=(0,i.glyphSvg)(`download`,{size:20}),c.hidden=!this.download;let l=w(`x`,C().closeLabel,`wui-lightbox-close`);r.append(o,s,c,l),t.append(n,r);let u=S(`div`,`wui-lightbox-stage`),d=w(`chevron-left`,C().previousImageLabel,`wui-lightbox-nav wui-lightbox-prev`),p=w(`chevron-right`,C().nextImageLabel,`wui-lightbox-nav wui-lightbox-next`),m=S(`img`,`wui-lightbox-image`,{decoding:`async`,draggable:`false`,alt:``}),h=S(`p`,`wui-lightbox-status`,{role:`status`});u.append(m,h,d,p);let g=S(`p`,`wui-lightbox-caption`);e.append(t,u,g);let _={root:e,count:n,zoomOut:o,zoomIn:s,download:c,close:l,stage:u,prev:d,next:p,image:m,status:h,caption:g};this._ui=_,l.addEventListener(`click`,()=>this.close()),d.addEventListener(`click`,()=>this.step(-1)),p.addEventListener(`click`,()=>this.step(1)),o.addEventListener(`click`,()=>this._setZoom(this._zoom-f)),s.addEventListener(`click`,()=>this._setZoom(this._zoom+f)),e.addEventListener(`keydown`,e=>this._onKeyDown(e)),u.addEventListener(`pointerdown`,e=>this._onPointerDown(e)),u.addEventListener(`pointermove`,e=>this._onPointerMove(e)),u.addEventListener(`pointerup`,e=>this._onPointerEnd(e,!0)),u.addEventListener(`pointercancel`,e=>this._onPointerEnd(e,!1)),u.addEventListener(`wheel`,e=>this._onWheel(e),{passive:!1}),m.addEventListener(`load`,()=>{this._ui===_&&(h.textContent=``,u.removeAttribute(`aria-busy`),m.hidden=!1,this._applyTransform())}),m.addEventListener(`error`,()=>{this._ui===_&&(u.removeAttribute(`aria-busy`),m.hidden=!0,h.textContent=C().imageFailedMessage)}),this.append(e),this._release=(0,a.openModalDialog)(e,{escape:!0,backdrop:!1,focus:`panel`,onRequestClose:()=>this.close()})}step(e){if(!this._ui||!e)return;let t=this._items();t.length<2||this._show((this._index+e+t.length)%t.length,t)}_show(e,t){let n=this._view,i=Math.min(t.length-1,Math.max(0,Math.trunc(Number(e))||0)),a=t[i];if(!a)throw Error(`<wui-lightbox> image missing.`);let s=i!==this._index||!n.image.getAttribute(`src`);if(this._index=i,this._zoom=u,this._pan={x:0,y:0},n.count.textContent=(0,o.fillText)(C().countText,{position:(0,r.formatNumber)(i+1,{decimals:0}),total:(0,r.formatNumber)(t.length,{decimals:0})}),n.caption.textContent=a.caption,n.caption.hidden=!a.caption,n.download.href=a.src,n.download.setAttribute(`download`,a.name),n.prev.hidden=n.next.hidden=t.length<2,n.stage.setAttribute(`aria-busy`,`true`),n.status.textContent=``,n.image.hidden=!1,n.image.alt=a.alt||a.caption,n.image.src=a.src,this._applyTransform(),this._syncZoomButtons(),t.length>1){let e=t[(i+1)%t.length],n=t[(i-1+t.length)%t.length];if(!e||!n)throw Error(`<wui-lightbox> neighbour image missing.`);for(let t of[e,n])new Image().src=t.src}s&&this.dispatchEvent(new CustomEvent(`wui-lightbox:change`,{bubbles:!0,detail:{index:i}}))}_syncZoomButtons(){let e=this._view;e.zoomOut.disabled=this._zoom<=u,e.zoomIn.disabled=this._zoom>=d;let t=document.activeElement;(t===e.zoomOut||t===e.zoomIn)&&t instanceof HTMLButtonElement&&t.disabled&&e.close.focus()}_setZoom(e){this._ui&&(this._zoom=v(e),this._pan=this._clampedPan(this._pan),this._applyTransform(),this._syncZoomButtons())}_clampedPan(e){let{stage:t,image:n}=this._view;return y(e,this._zoom,{width:t.clientWidth,height:t.clientHeight},{width:n.offsetWidth,height:n.offsetHeight})}_applyTransform(){let{image:e,stage:t}=this._view;e.style.transform=`translate(${this._pan.x}px, ${this._pan.y}px) scale(${this._zoom})`,t.classList.toggle(`wui-lightbox-zoomed`,this._zoom>u)}_onKeyDown(e){if(e.key===`ArrowLeft`||e.key===`ArrowRight`)e.preventDefault(),this.step(e.key===`ArrowRight`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=this._items();this._show(e.key===`Home`?0:t.length-1,t)}else e.key===`+`||e.key===`=`?(e.preventDefault(),this._setZoom(this._zoom+f)):e.key===`-`?(e.preventDefault(),this._setZoom(this._zoom-f)):e.key===`0`&&(e.preventDefault(),this._setZoom(u))}_onWheel(e){e.preventDefault(),this._setZoom(this._zoom*(e.deltaY<0?1.15:1/1.15))}_onPointerDown(e){let t=e.target;if(t instanceof Element&&t.closest(`.wui-lightbox-nav`))return;let n=this._view;if(n.stage.setPointerCapture?.(e.pointerId),this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._pointers.size===2){let e=[...this._pointers.values()],t=e[0],n=e[1];if(!t||!n)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._gesture={kind:`pinch`,distance:Math.hypot(t.x-n.x,t.y-n.y)||1,zoom:this._zoom}}else this._pointers.size===1&&(this._gesture={kind:`drag`,startX:e.clientX,startY:e.clientY,startTime:e.timeStamp,pan:{...this._pan},onImage:e.target===n.image,moved:!1})}_onPointerMove(e){let t=this._gesture;if(t&&this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),t.kind===`pinch`&&this._pointers.size===2){let e=[...this._pointers.values()],n=e[0],r=e[1];if(!n||!r)throw Error(`<wui-lightbox> pinch needs two pointers.`);this._setZoom(t.zoom*Math.hypot(n.x-r.x,n.y-r.y)/t.distance)}else if(t.kind===`drag`){let n=e.clientX-t.startX,r=e.clientY-t.startY;Math.hypot(n,r)>h&&(t.moved=!0),this._zoom>u&&(this._pan=this._clampedPan({x:t.pan.x+n,y:t.pan.y+r}),this._view.stage.classList.add(`is-dragging`),this._applyTransform())}}}_onPointerEnd(e,t){let n=this._gesture;if(this._pointers.delete(e.pointerId),this._ui?.stage.classList.remove(`is-dragging`),!n)return;if(n.kind===`pinch`){this._pointers.size<2&&(this._gesture=null);return}if(this._gesture=null,!t)return;let r=e.clientX-n.startX,i=e.clientY-n.startY;n.moved?this._zoom===u&&this.step(b(r,i)):e.timeStamp-n.startTime>g||(n.onImage?e.timeStamp-this._lastTap<_?(this._lastTap=-1/0,this._setZoom(this._zoom>u?u:p)):this._lastTap=e.timeStamp:this.close())}};(0,t.defineElement)(`wui-lightbox`,T),e.WuiLightbox=T})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formatters,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.textStore);
@@ -1,4 +1,4 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.169.1`)throw Error(`[webority-ui] markdown expects ui-elements 0.169.1 but the page loaded `+r+`.`);var i=/\[([^[\]\n]+)\](?!\()/g,a=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),o=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,s=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,c=new RegExp(i.source,`y`),l=e=>/[\p{L}\p{N}]/u.test(e);function u(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function d(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&l(e.charAt(i+n.length));if(a&&!o&&!s&&!u(e,i))return i}return-1}function f(e,t){let n=t?.isCitation,r=[],i=``,u=()=>{i&&=(r.push({type:`text`,text:i}),``)},p=0;for(;p<e.length;){let m=e.charAt(p),h=e.charAt(p+1);if(m===`\\`&&a.has(h)){i+=h,p+=2;continue}if(m==="`"){let t=e.indexOf("`",p+1);if(t>p+1){u(),r.push({type:`code`,text:e.slice(p+1,t)}),p=t+1;continue}}let g=m+h;if(g===`**`||g===`__`||g===`~~`){let n=d(e,p+2,g);if(n!==-1&&!(g===`__`&&l(e.charAt(p-1)))){u();let i=f(e.slice(p+2,n),t);g===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),p=n+2;continue}i+=g,p+=2}else{if(m===`*`||m===`_`){let n=d(e,p+1,m);if(n!==-1&&!(m===`_`&&l(e.charAt(p-1)))){u(),r.push({type:`em`,children:f(e.slice(p+1,n),t)}),p=n+1;continue}}if(m===`[`){o.lastIndex=p;let t=o.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);u(),r.push({type:`link`,href:n,children:f(e)}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){u(),r.push({type:`citation`,text:e}),p+=t[0].length;continue}}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);u(),r.push({type:`image`,children:f(e)}),p+=t[0].length;continue}}i+=m,p+=1}}return u(),r.map((e,t)=>({...e,key:t}))}var p=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,m=/^https?:/i,h=/^(mailto|tel):/i,g=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,ee=/^https:\/\/[^/?#@\\\s]+$/i,_=/^[a-z][a-z0-9+.-]*:/i;function v(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return ee.test(t)?t:null}function te(e,t,n,r,i){if(n&&(t===`page`||p.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:v(i),o=a===null?e:ne(e,a);return o===null?null:g.test(o)?{kind:`page`,href:o}:t===`page`&&!(m.test(o)&&r&&b(o,r))?null:m.test(o)?{kind:r&&b(o,r)?`page`:`web`,href:o}:h.test(o)?{kind:`contact`,href:o}:null}function ne(e,t){if(_.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${y(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function y(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function b(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function x(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var S=/^\s*```/,C=/^\s*```\s*(\S*)/,w=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,T=/^\s*([-*_])(\s*\1){2,}\s*$/,E=/^(\s*)[-*+]\s+(.*)$/,D=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,O=/^\s*>\s?(.*)$/,k=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,A=[1,2,3,4,5,6],j=e=>e.includes(`|`);function M(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 N(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&j(n)&&r.includes(`|`)&&k.test(r)}function P(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return S.test(n)||O.test(n)||E.test(n)||D.test(n)||w.test(n)||T.test(n)||N(e,t)}function F(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function I(e){let t=D.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:F(e),ordered:!0,number:Number(n)}}let n=E.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:F(e),ordered:!1,number:0}}return null}function L(e){let t=(e??``).replace(/\r\n?/g,`
1
+ (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.170.0`)throw Error(`[webority-ui] markdown expects ui-elements 0.170.0 but the page loaded `+r+`.`);var i=/\[([^[\]\n]+)\](?!\()/g,a=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`),o=/\[([^\]\n]+)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,s=/!\[([^\]\n]*)\]\(((?:[^()\s]|\([^()\s]*\))+)\)/y,c=new RegExp(i.source,`y`),l=e=>/[\p{L}\p{N}]/u.test(e);function u(e,t){let n=0;for(let r=t-1;r>=0&&e.charAt(r)===`\\`;--r)n+=1;return n%2==1}function d(e,t,n){let r=n.length===1;for(let i=e.indexOf(n,t);i!==-1;i=e.indexOf(n,i+1)){let a=i>t&&!/\s/.test(e.charAt(t))&&!/\s/.test(e.charAt(i-1)),o=r&&(e.charAt(i+1)===n||e.charAt(i-1)===n),s=n===`_`&&l(e.charAt(i+n.length));if(a&&!o&&!s&&!u(e,i))return i}return-1}function f(e,t){let n=t?.isCitation,r=[],i=``,u=()=>{i&&=(r.push({type:`text`,text:i}),``)},p=0;for(;p<e.length;){let m=e.charAt(p),h=e.charAt(p+1);if(m===`\\`&&a.has(h)){i+=h,p+=2;continue}if(m==="`"){let t=e.indexOf("`",p+1);if(t>p+1){u(),r.push({type:`code`,text:e.slice(p+1,t)}),p=t+1;continue}}let g=m+h;if(g===`**`||g===`__`||g===`~~`){let n=d(e,p+2,g);if(n!==-1&&!(g===`__`&&l(e.charAt(p-1)))){u();let i=f(e.slice(p+2,n),t);g===`~~`?r.push({type:`strike`,children:i}):r.push({type:`strong`,children:i}),p=n+2;continue}i+=g,p+=2}else{if(m===`*`||m===`_`){let n=d(e,p+1,m);if(n!==-1&&!(m===`_`&&l(e.charAt(p-1)))){u(),r.push({type:`em`,children:f(e.slice(p+1,n),t)}),p=n+1;continue}}if(m===`[`){o.lastIndex=p;let t=o.exec(e);if(t){let e=t[1],n=t[2];if(e===void 0||n===void 0)throw Error(`The link pattern always captures its label and href`);u(),r.push({type:`link`,href:n,children:f(e)}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The citation pattern always captures its inner text`);if(n(e)){u(),r.push({type:`citation`,text:e}),p+=t[0].length;continue}}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){let e=t[1];if(e===void 0)throw Error(`The image pattern always captures its alt text`);u(),r.push({type:`image`,children:f(e)}),p+=t[0].length;continue}}i+=m,p+=1}}return u(),r.map((e,t)=>({...e,key:t}))}var p=/^[a-z][a-z0-9+.-]*:[a-z0-9_-]+\/[a-z0-9_.~-]+$/i,m=/^https?:/i,h=/^(mailto|tel):/i,g=/^(?:\/(?![/\\])|#|\?|\.{1,2}\/)/,ee=/^https:\/\/[^/?#@\\\s]+$/i,_=/^[a-z][a-z0-9+.-]*:/i;function v(e){if(typeof e!=`string`)return null;let t=e.endsWith(`/`)?e.slice(0,-1):e;return ee.test(t)?t:null}function te(e,t,n,r,i){if(n&&(t===`page`||p.test(e))){let t=n(e);if(t!=null)return{kind:`app`,target:t}}if(t===`app`)return null;let a=i==null?null:v(i),o=a===null?e:ne(e,a);return o===null?null:g.test(o)?{kind:`page`,href:o}:t===`page`&&!(m.test(o)&&r&&b(o,r))?null:m.test(o)?{kind:r&&b(o,r)?`page`:`web`,href:o}:h.test(o)?{kind:`contact`,href:o}:null}function ne(e,t){if(_.test(e))return e;if(e.startsWith(`//`))return`https:${e}`;if(e===``)return null;let n=e.indexOf(`#`),r=n<0?``:e.slice(n),i=n<0?e:e.slice(0,n),a=i.indexOf(`?`),o=a<0?i:i.slice(0,a),s=a<0?``:i.slice(a);return o===``?`${t}${s}${r}`:`${t}${y(o.startsWith(`/`)?o:`/${o}`)}${s}${r}`}function y(e){let t=e.split(`/`),n=[];return t.forEach((e,r)=>{let i=r===t.length-1;e===`.`?i&&n.push(``):e===`..`?(n.length>1&&n.pop(),i&&n.push(``)):n.push(e)}),n.join(`/`)}function b(e,t){if(e.slice(0,t.length).toLowerCase()!==t.toLowerCase())return!1;let n=e[t.length];return n===void 0||n===`/`||n===`?`||n===`#`}function x(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var S=/^\s*```/,C=/^\s*```\s*(\S*)/,w=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,T=/^\s*([-*_])(\s*\1){2,}\s*$/,E=/^(\s*)[-*+]\s+(.*)$/,D=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,O=/^\s*>\s?(.*)$/,k=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,A=[1,2,3,4,5,6],j=e=>e.includes(`|`);function M(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 N(e,t){let n=e[t];if(n===void 0)throw Error(`startsTable was called past the last source line`);let r=e[t+1];return r!==void 0&&j(n)&&r.includes(`|`)&&k.test(r)}function P(e,t){let n=e[t];if(n===void 0)throw Error(`startsBlock was called past the last source line`);return S.test(n)||O.test(n)||E.test(n)||D.test(n)||w.test(n)||T.test(n)||N(e,t)}function F(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function I(e){let t=D.exec(e);if(t){let e=t[1],n=t[2],r=t[3];if(e===void 0||n===void 0||r===void 0)throw Error(`The ordered list pattern always captures its indent, number and text`);return{text:r,depth:F(e),ordered:!0,number:Number(n)}}let n=E.exec(e);if(n){let e=n[1],t=n[2];if(e===void 0||t===void 0)throw Error(`The bullet list pattern always captures its indent and text`);return{text:t,depth:F(e),ordered:!1,number:0}}return null}function L(e){let t=(e??``).replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),n=[],r=0;for(;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()){r+=1;continue}if(S.test(e)){let i=C.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(S.test(e))break;a.push(e),r+=1}r+=1,n.push({type:`code`,text:a.join(`
4
4
  `),language:i});continue}if(N(t,r)){let i=M(e),a=[];for(r+=2;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||!j(e))break;a.push(M(e)),r+=1}n.push({type:`table`,header:i,rows:a});continue}if(T.test(e)){n.push({type:`rule`}),r+=1;continue}let i=w.exec(e);if(i){let e=i[1],t=i[2];if(e===void 0||t===void 0)throw Error(`The heading pattern always captures its hashes and text`);let a=A[e.length-1];if(a===void 0)throw Error(`The heading pattern always captures one to six hashes`);n.push({type:`heading`,level:a,text:t}),r+=1;continue}if(O.test(e)){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);let i=O.exec(n);if(!i)break;let a=i[1];if(a===void 0)throw Error(`The quote pattern always captures its text`);e.push(a),r+=1}n.push({type:`quote`,lines:e});continue}let a=I(e);if(a){let e=[];for(;r<t.length;){let n=t[r];if(n===void 0)throw Error(`parseMarkdown read past the last source line`);if(!n.trim())break;let i=I(n);if(i){if(i.depth===0&&i.ordered!==a.ordered)break;e.push(i)}else if(P(t,r))break;else{let t=e[e.length-1];if(t===void 0)throw Error(`A list continuation line follows a list with no item`);t.text+=` ${n.trim()}`}r+=1}n.push({type:`list`,ordered:a.ordered,start:a.ordered?a.number:1,items:e});continue}let o=[e];for(r+=1;r<t.length;){let e=t[r];if(e===void 0)throw Error(`parseMarkdown read past the last source line`);if(!e.trim()||P(t,r))break;o.push(e),r+=1}n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var R=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`razor`,`css`],z=[`razor`,`cshtml`],B=[`app`,`web`,`page`],V=e=>e!==void 0&&B.includes(e);function H(e,t,n,r,i=null){let a=U(e.ownerDocument,n,r).map((e,n)=>{let r=t[n],i=r?.sig===e.sig?r.nodes:null;return{sig:e.sig,nodes:i??e.build()}}),o=new Set(a.flatMap(e=>e.nodes));for(let e of t)for(let t of e.nodes)o.has(t)||t.parentNode?.removeChild(t);let s=i;for(let t of a.flatMap(e=>e.nodes))(t.parentNode!==e||t.previousSibling!==s)&&e.insertBefore(t,s?s.nextSibling:e.firstChild),s=t;return a}function U(e,t,n){let r={doc:e,links:V(n.links)?n.links:`web`,headings:n.headings===`text`?`text`:`outline`,resolveLink:n.resolveLink,isCitation:n.isCitation,figureText:typeof n.figureText==`function`?n.figureText:void 0,base:typeof n.base==`string`?n.base:void 0},i=n.resolverGeneration??0;return L(t).map(e=>({sig:`${JSON.stringify(e)}|${r.links}|${r.headings}|${r.base??``}|${i}`,build:()=>K(r,e)}))}var W=class extends n.ElementBase{_drawn;_blocks;_observer;_connected;_resolveLink;_isCitation;_resolverGeneration;_figureText;static get observedAttributes(){return[`links`,`headings`,`base`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=0,this._figureText=void 0}connectedCallback(){this._connected=!0,this._render(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(e=>{e.some(e=>!this._drawn.some(t=>t.contains(e.target)))&&this._render()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0}))}disconnectedCallback(){this._connected=!1,this._observer?.disconnect(),this._observer=null}get resolveLink(){return this._resolveLink}set resolveLink(e){this._resolveLink=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get base(){return this.getAttribute(`base`)??void 0}set base(e){e==null?this.removeAttribute(`base`):this.setAttribute(`base`,String(e))}get isCitation(){return this._isCitation}set isCitation(e){this._isCitation=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}get figureText(){return this._figureText}set figureText(e){this._figureText=typeof e==`function`?e:void 0,this._resolverGeneration+=1,this._connected&&this._render()}attributeChangedCallback(e,t,n){t!==n&&this._connected&&this._render()}_source(){return Array.from(this.children).find(e=>e instanceof HTMLPreElement&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=H(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,base:this.getAttribute(`base`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,figureText:this._figureText,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function G(e,t,n=[]){let r=e.createElement(t);return r.append(...n),r}function K(e,t){switch(t.type){case`paragraph`:return[G(e.doc,`p`,q(e,t.lines))];case`heading`:return[J(e,t)];case`list`:return Y(e,t.items);case`table`:return[re(e,t)];case`code`:return[ae(e.doc,t)];case`quote`:return[G(e.doc,`blockquote`,q(e,t.lines))];case`rule`:return[e.doc.createElement(`hr`)];default:return[]}}function q(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(e.doc.createElement(`br`)),n.push(...Z(e,t))}),n}function J(e,t){let n=Z(e,t.text);if(e.headings===`text`){let t=G(e.doc,`p`,n);return t.className=`fw-semibold`,t}return G(e.doc,`h2`,n)}function Y(e,t){let n=[];for(let r=0;r<t.length;){let i=X(e,t,r);n.push(i.list),r=i.next}return n}function X(e,t,n){let r=t[n];if(!r)throw Error(`List run starts past its items.`);let{depth:i,ordered:a,number:o}=r,s=e.doc.createElement(a?`ol`:`ul`);a&&o!==1&&s.setAttribute(`start`,String(o));let c=null,l=n,u=t[l];for(;u&&u.depth>=i;){if(u.depth===i)c=G(e.doc,`li`,Z(e,u.text)),s.append(c),l+=1;else{let n=X(e,t,l);if(!c)throw Error(`Nested list has no item before it.`);c.append(n.list),l=n.next}u=t[l]}return{list:s,next:l}}function re(e,t){let n=t.header.map(t=>{let n=G(e.doc,`th`,Z(e,t));return n.setAttribute(`scope`,`col`),n}),r=t.rows.map(n=>G(e.doc,`tr`,t.header.map((t,r)=>G(e.doc,`td`,Z(e,n[r]??``))))),i=G(e.doc,`table`,[G(e.doc,`thead`,[G(e.doc,`tr`,n)]),G(e.doc,`tbody`,r)]);i.className=`table`;let a=G(e.doc,`div`,[i]);return a.className=`table-responsive`,a}function ie(e){return e===null?`text`:z.includes(e.toLowerCase())?`razor`:R.includes(e)?e:`text`}function ae(e,t){let n=G(e,`pre`,[G(e,`code`,[e.createTextNode(t.text)])]);n.className=`wui-code-source`;let r=G(e,`wui-code-block`,[n]);return r.className=`wui-code-block`,r.setAttribute(`language`,ie(t.language)),r}function Z(e,t){return Q(e,f(t,{isCitation:e.isCitation}))}function Q(e,t){return t.flatMap(t=>oe(e,t))}function oe(e,t){let{doc:n}=e;switch(t.type){case`code`:return[G(n,`code`,[n.createTextNode(t.text)])];case`strong`:return[G(n,`strong`,Q(e,t.children))];case`em`:return[G(n,`em`,Q(e,t.children))];case`strike`:return[G(n,`del`,Q(e,t.children))];case`image`:return[n.createTextNode(`[`),...Q(e,t.children),n.createTextNode(`]`)];case`link`:return se(e,t);case`citation`:return[le(n,t.text)];case`text`:return e.figureText?ce(e,e.figureText,t.text):[n.createTextNode(t.text)];default:throw Error(`wui-markdown: unknown inline token ${JSON.stringify(t)}`)}}function se(e,t){let n=Q(e,t.children),r=te(t.href,e.links,e.resolveLink,globalThis.location?.origin,e.base);if(!r)return n;if(r.kind===`app`){let t=x(r.target);return t?[$(e.doc,t,n,!1)]:n}return[$(e.doc,r.href,n,r.kind===`web`)]}function ce(e,t,n){return t(n).map(t=>t.kind===`sub`||t.kind===`sup`?G(e.doc,t.kind,[e.doc.createTextNode(t.text)]):e.doc.createTextNode(t.text))}function le(e,t){let n=e.createElement(`span`);n.className=`chip primary chip-outline chip-sm chip-clickable wui-markdown-citation`,n.setAttribute(`data-wui`,`AppChip`);let r=e.createElement(`button`);r.type=`button`,r.className=`chip-body`,r.setAttribute(`aria-label`,t),r.addEventListener(`click`,()=>{r.dispatchEvent(new CustomEvent(`wui-markdown-citation`,{bubbles:!0,detail:{citation:t}}))});let i=e.createElement(`span`);return i.className=`chip-label`,i.textContent=t,r.append(i),n.append(r),n}function $(e,t,n,r){let i=G(e,`span`,n);i.className=`wui-link__label`;let a=G(e,`a`,[i]);return a.className=`wui-link wui-link--static`,a.setAttribute(`data-wui`,`AppLink`),a.setAttribute(`href`,t),r&&(a.setAttribute(`target`,`_blank`),a.setAttribute(`rel`,`noopener noreferrer`)),a}(0,t.defineElement)(`wui-markdown`,W),e.WuiMarkdown=W})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.169.1`)throw Error(`[webority-ui] org-tree expects ui-elements 0.169.1 but the page loaded `+a+`.`);var o={ariaLabel:`Organisation`,collapseLabel:`Hide {name}'s team`,expandLabel:`Show {name}'s team`,helpText:`Arrow Down goes to a person's first report, Arrow Up to their manager, Arrow Left and Right to colleagues. Plus opens a team and minus closes it. Enter chooses a person.`,noResultsText:`No one found`,resultsText:`{count} found`,searchLabel:`Search by name`},s=`li[data-wui-org-node]`,c=`:scope > .wui-org-tree-node`,l=`:scope > .wui-org-tree-node > .wui-org-tree-text > .wui-org-tree-name`,u=`:scope > .wui-org-tree-children`,d=`:scope > .wui-org-tree-node > [data-wui-org-toggle]`,f=`[data-wui-org-toggle]`,p=`a, button, input, select, textarea`,m=`.wui-org-tree-overlay`,h=`[data-wui-org-search]`,g=`[data-wui-org-canvas]`,_=`[data-wui-org-live]`,v=`--wui-org-tree-print-scale`,y=718,b=1e3,x=150,S=()=>(0,i.readText)(`orgTree`,o),C=e=>[...e.querySelectorAll(s)].filter(e=>e instanceof HTMLElement),w=e=>e.querySelector(l)?.textContent?.trim()??``,T=e=>e.getAttribute(`data-wui-org-node`),E=e=>e.getAttribute(`aria-expanded`)===`true`,D=class extends r.ElementBase{static get observedAttributes(){return[`selected`,`selectable`,`expand-label`,`collapse-label`,`search-results-text`,`search-empty-text`]}constructor(){super(),this._query=``,this._snapshot=null,this._observer=null,this._announceTimer=void 0,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onInput=e=>this._handleInput(e),this._onBeforePrint=()=>this._scaleForPrint(),this._onAfterPrint=()=>this.style.removeProperty(v)}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`input`,this._onInput),window.addEventListener(`beforeprint`,this._onBeforePrint),window.addEventListener(`afterprint`,this._onAfterPrint);let e=this.querySelector(g);e?(this._observer=new MutationObserver(()=>{this._query&&this._applySearch(this._query)}),this._observer.observe(e,{childList:!0,subtree:!0})):(0,n.devError)(`[@webority/ui-elements] <wui-org-tree> has no [data-wui-org-canvas]; render the tree markup inside it.`)}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`input`,this._onInput),window.removeEventListener(`beforeprint`,this._onBeforePrint),window.removeEventListener(`afterprint`,this._onAfterPrint),this._observer?.disconnect(),this._observer=null,clearTimeout(this._announceTimer)}attributeChangedCallback(e){e===`selected`||e===`selectable`?this._applySelected():(e===`expand-label`||e===`collapse-label`)&&this._syncToggles()}get selected(){return this.getAttribute(`selected`)}set selected(e){e==null?this.removeAttribute(`selected`):this.setAttribute(`selected`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}_items(){return C(this)}_hasChildren(e){return!!e.querySelector(u)}_isVisible(e){for(let t=e;t&&t!==this;t=t.parentElement)if(t.hasAttribute(`hidden`))return!1;return!0}_visibleItems(){return this._items().filter(e=>this._isVisible(e))}_parentItem(e){let t=e.parentElement?.closest(s);return t instanceof HTMLElement&&this.contains(t)?t:null}_visibleChildren(e){let t=e.querySelector(u);return t?[...t.children].filter(e=>e.matches(s)&&this._isVisible(e)):[]}_isVisibleItem(e){return e instanceof HTMLElement&&e.matches(s)&&this._isVisible(e)}_siblingItem(e,t){let n=e[t];for(;n&&!this._isVisibleItem(n);)n=n[t];return this._isVisibleItem(n)?n:null}_setRoving(e){for(let t of this._items())t.setAttribute(`tabindex`,t===e?`0`:`-1`)}_focusItem(e){e&&(this._setRoving(e),e.focus())}_toggleLabel(e,t){return(t?this.getAttribute(`collapse-label`)??S().collapseLabel:this.getAttribute(`expand-label`)??S().expandLabel).split(`{name}`).join(w(e))}_setExpanded(e,t){let n=e.querySelector(u);n instanceof HTMLElement&&(e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t,e.querySelector(d)?.setAttribute(`aria-label`,this._toggleLabel(e,t)),!t&&n.contains(document.activeElement)&&this._focusItem(e))}_toggle(e){this._setExpanded(e,!E(e))}_syncToggles(){for(let e of this._items())this._hasChildren(e)&&this._setExpanded(e,E(e))}_applySelected(){for(let e of this._items())this.selectable?e.setAttribute(`aria-selected`,String(T(e)===this.selected)):e.removeAttribute(`aria-selected`)}_select(e){this.selectable&&(this.selected=T(e),this.dispatchEvent(new CustomEvent(`wui-org-tree:select`,{detail:{id:this.selected},bubbles:!0,composed:!0})))}_activate(e){this.selectable?this._select(e):this._hasChildren(e)&&this._toggle(e)}_handleFocusIn(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(s);n instanceof HTMLElement&&this.contains(n)&&this._setRoving(n)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(s);n instanceof HTMLElement&&this.contains(n)&&(this._setRoving(n),t.closest(f)?this._hasChildren(n)&&this._toggle(n):n.querySelector(c)?.contains(t)&&(t.closest(p)?.closest(m)||this._select(n)))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement&&t.matches(s)&&this.contains(t))switch(e.key){case`ArrowDown`:if(e.preventDefault(),!this._hasChildren(t))return;E(t)||this._setExpanded(t,!0),this._focusItem(this._visibleChildren(t)[0]);return;case`ArrowUp`:e.preventDefault(),this._focusItem(this._parentItem(t));return;case`ArrowRight`:e.preventDefault(),this._focusItem(this._siblingItem(t,`nextElementSibling`));return;case`ArrowLeft`:e.preventDefault(),this._focusItem(this._siblingItem(t,`previousElementSibling`));return;case`Home`:e.preventDefault(),this._focusItem(this._visibleItems()[0]);return;case`End`:e.preventDefault(),this._focusItem(this._visibleItems().at(-1));return;case`+`:case`=`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!0);return;case`-`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!1);return;case`Enter`:case` `:e.preventDefault(),this._activate(t);return}}_handleInput(e){let t=e.target;t instanceof HTMLInputElement&&t.matches(h)&&this._search(t.value.trim().toLocaleLowerCase())}_search(e){clearTimeout(this._announceTimer),e?(this._snapshot||=this._captureExpanded(),this._query=e,this._applySearch(e),this._announceTimer=window.setTimeout(()=>this._announce(this._resultText()),x)):(this._snapshot&&this._restore(this._snapshot),this._snapshot=null,this._query=``,this._announce(``))}_captureExpanded(){return new Map(this._items().filter(e=>this._hasChildren(e)).map(e=>[T(e),E(e)]))}_restore(e){for(let t of this._items()){t.hidden=!1,t.classList.remove(`wui-org-tree-match`);let n=T(t);e.has(n)&&this._setExpanded(t,e.get(n)??!1)}}_applySearch(e){let t=this._items(),n=new Set(t.filter(t=>w(t).toLocaleLowerCase().includes(e))),r=new Set(n);for(let e of n)for(let t=this._parentItem(e);t;t=this._parentItem(t))r.add(t),E(t)||this._setExpanded(t,!0);for(let e of t)e.classList.toggle(`wui-org-tree-match`,n.has(e)),e.hidden=!r.has(e);let i=t.filter(e=>r.has(e)),a=i[0];a&&!i.some(e=>e.getAttribute(`tabindex`)===`0`)&&this._setRoving(a)}_resultText(){let e=this._items().filter(e=>e.classList.contains(`wui-org-tree-match`)).length;return e===0?this.getAttribute(`search-empty-text`)??S().noResultsText:(this.getAttribute(`search-results-text`)??S().resultsText).split(`{count}`).join(String(e))}_announce(e){let t=this.querySelector(_);t&&(t.textContent=e)}_scaleForPrint(){let e=this.querySelector(g);if(!(e instanceof HTMLElement))return;let t=Math.min(1,y/e.scrollWidth,b/e.scrollHeight);this.style.setProperty(v,String(t))}};(0,t.defineElement)(`wui-org-tree`,D),e.WuiOrgTree=D})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.textStore);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.170.0`)throw Error(`[webority-ui] org-tree expects ui-elements 0.170.0 but the page loaded `+a+`.`);var o={ariaLabel:`Organisation`,collapseLabel:`Hide {name}'s team`,expandLabel:`Show {name}'s team`,helpText:`Arrow Down goes to a person's first report, Arrow Up to their manager, Arrow Left and Right to colleagues. Plus opens a team and minus closes it. Enter chooses a person.`,noResultsText:`No one found`,resultsText:`{count} found`,searchLabel:`Search by name`},s=`li[data-wui-org-node]`,c=`:scope > .wui-org-tree-node`,l=`:scope > .wui-org-tree-node > .wui-org-tree-text > .wui-org-tree-name`,u=`:scope > .wui-org-tree-children`,d=`:scope > .wui-org-tree-node > [data-wui-org-toggle]`,f=`[data-wui-org-toggle]`,p=`a, button, input, select, textarea`,m=`.wui-org-tree-overlay`,h=`[data-wui-org-search]`,g=`[data-wui-org-canvas]`,_=`[data-wui-org-live]`,v=`--wui-org-tree-print-scale`,y=718,b=1e3,x=150,S=()=>(0,i.readText)(`orgTree`,o),C=e=>[...e.querySelectorAll(s)].filter(e=>e instanceof HTMLElement),w=e=>e.querySelector(l)?.textContent?.trim()??``,T=e=>e.getAttribute(`data-wui-org-node`),E=e=>e.getAttribute(`aria-expanded`)===`true`,D=class extends r.ElementBase{static get observedAttributes(){return[`selected`,`selectable`,`expand-label`,`collapse-label`,`search-results-text`,`search-empty-text`]}constructor(){super(),this._query=``,this._snapshot=null,this._observer=null,this._announceTimer=void 0,this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>this._handleFocusIn(e),this._onInput=e=>this._handleInput(e),this._onBeforePrint=()=>this._scaleForPrint(),this._onAfterPrint=()=>this.style.removeProperty(v)}connectedCallback(){this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`input`,this._onInput),window.addEventListener(`beforeprint`,this._onBeforePrint),window.addEventListener(`afterprint`,this._onAfterPrint);let e=this.querySelector(g);e?(this._observer=new MutationObserver(()=>{this._query&&this._applySearch(this._query)}),this._observer.observe(e,{childList:!0,subtree:!0})):(0,n.devError)(`[@webority/ui-elements] <wui-org-tree> has no [data-wui-org-canvas]; render the tree markup inside it.`)}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`input`,this._onInput),window.removeEventListener(`beforeprint`,this._onBeforePrint),window.removeEventListener(`afterprint`,this._onAfterPrint),this._observer?.disconnect(),this._observer=null,clearTimeout(this._announceTimer)}attributeChangedCallback(e){e===`selected`||e===`selectable`?this._applySelected():(e===`expand-label`||e===`collapse-label`)&&this._syncToggles()}get selected(){return this.getAttribute(`selected`)}set selected(e){e==null?this.removeAttribute(`selected`):this.setAttribute(`selected`,String(e))}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,!!e)}_items(){return C(this)}_hasChildren(e){return!!e.querySelector(u)}_isVisible(e){for(let t=e;t&&t!==this;t=t.parentElement)if(t.hasAttribute(`hidden`))return!1;return!0}_visibleItems(){return this._items().filter(e=>this._isVisible(e))}_parentItem(e){let t=e.parentElement?.closest(s);return t instanceof HTMLElement&&this.contains(t)?t:null}_visibleChildren(e){let t=e.querySelector(u);return t?[...t.children].filter(e=>e.matches(s)&&this._isVisible(e)):[]}_isVisibleItem(e){return e instanceof HTMLElement&&e.matches(s)&&this._isVisible(e)}_siblingItem(e,t){let n=e[t];for(;n&&!this._isVisibleItem(n);)n=n[t];return this._isVisibleItem(n)?n:null}_setRoving(e){for(let t of this._items())t.setAttribute(`tabindex`,t===e?`0`:`-1`)}_focusItem(e){e&&(this._setRoving(e),e.focus())}_toggleLabel(e,t){return(t?this.getAttribute(`collapse-label`)??S().collapseLabel:this.getAttribute(`expand-label`)??S().expandLabel).split(`{name}`).join(w(e))}_setExpanded(e,t){let n=e.querySelector(u);n instanceof HTMLElement&&(e.setAttribute(`aria-expanded`,String(t)),n.hidden=!t,e.querySelector(d)?.setAttribute(`aria-label`,this._toggleLabel(e,t)),!t&&n.contains(document.activeElement)&&this._focusItem(e))}_toggle(e){this._setExpanded(e,!E(e))}_syncToggles(){for(let e of this._items())this._hasChildren(e)&&this._setExpanded(e,E(e))}_applySelected(){for(let e of this._items())this.selectable?e.setAttribute(`aria-selected`,String(T(e)===this.selected)):e.removeAttribute(`aria-selected`)}_select(e){this.selectable&&(this.selected=T(e),this.dispatchEvent(new CustomEvent(`wui-org-tree:select`,{detail:{id:this.selected},bubbles:!0,composed:!0})))}_activate(e){this.selectable?this._select(e):this._hasChildren(e)&&this._toggle(e)}_handleFocusIn(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(s);n instanceof HTMLElement&&this.contains(n)&&this._setRoving(n)}_handleClick(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(s);n instanceof HTMLElement&&this.contains(n)&&(this._setRoving(n),t.closest(f)?this._hasChildren(n)&&this._toggle(n):n.querySelector(c)?.contains(t)&&(t.closest(p)?.closest(m)||this._select(n)))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement&&t.matches(s)&&this.contains(t))switch(e.key){case`ArrowDown`:if(e.preventDefault(),!this._hasChildren(t))return;E(t)||this._setExpanded(t,!0),this._focusItem(this._visibleChildren(t)[0]);return;case`ArrowUp`:e.preventDefault(),this._focusItem(this._parentItem(t));return;case`ArrowRight`:e.preventDefault(),this._focusItem(this._siblingItem(t,`nextElementSibling`));return;case`ArrowLeft`:e.preventDefault(),this._focusItem(this._siblingItem(t,`previousElementSibling`));return;case`Home`:e.preventDefault(),this._focusItem(this._visibleItems()[0]);return;case`End`:e.preventDefault(),this._focusItem(this._visibleItems().at(-1));return;case`+`:case`=`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!0);return;case`-`:if(!this._hasChildren(t))return;e.preventDefault(),this._setExpanded(t,!1);return;case`Enter`:case` `:e.preventDefault(),this._activate(t);return}}_handleInput(e){let t=e.target;t instanceof HTMLInputElement&&t.matches(h)&&this._search(t.value.trim().toLocaleLowerCase())}_search(e){clearTimeout(this._announceTimer),e?(this._snapshot||=this._captureExpanded(),this._query=e,this._applySearch(e),this._announceTimer=window.setTimeout(()=>this._announce(this._resultText()),x)):(this._snapshot&&this._restore(this._snapshot),this._snapshot=null,this._query=``,this._announce(``))}_captureExpanded(){return new Map(this._items().filter(e=>this._hasChildren(e)).map(e=>[T(e),E(e)]))}_restore(e){for(let t of this._items()){t.hidden=!1,t.classList.remove(`wui-org-tree-match`);let n=T(t);e.has(n)&&this._setExpanded(t,e.get(n)??!1)}}_applySearch(e){let t=this._items(),n=new Set(t.filter(t=>w(t).toLocaleLowerCase().includes(e))),r=new Set(n);for(let e of n)for(let t=this._parentItem(e);t;t=this._parentItem(t))r.add(t),E(t)||this._setExpanded(t,!0);for(let e of t)e.classList.toggle(`wui-org-tree-match`,n.has(e)),e.hidden=!r.has(e);let i=t.filter(e=>r.has(e)),a=i[0];a&&!i.some(e=>e.getAttribute(`tabindex`)===`0`)&&this._setRoving(a)}_resultText(){let e=this._items().filter(e=>e.classList.contains(`wui-org-tree-match`)).length;return e===0?this.getAttribute(`search-empty-text`)??S().noResultsText:(this.getAttribute(`search-results-text`)??S().resultsText).split(`{count}`).join(String(e))}_announce(e){let t=this.querySelector(_);t&&(t.textContent=e)}_scaleForPrint(){let e=this.querySelector(g);if(!(e instanceof HTMLElement))return;let t=Math.min(1,y/e.scrollWidth,b/e.scrollHeight);this.style.setProperty(v,String(t))}};(0,t.defineElement)(`wui-org-tree`,D),e.WuiOrgTree=D})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.textStore);
@@ -1,4 +1,4 @@
1
- (function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var m=Object.defineProperty,h=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n},g=globalThis.WeborityUiElementsInternal?.version;if(g!==`0.169.1`)throw Error(`[webority-ui] phone expects ui-elements 0.169.1 but the page loaded `+g+`.`);var _=[[`AF`,`Afghanistan`,`93`],[`AX`,`Åland Islands`,`358`],[`AL`,`Albania`,`355`],[`DZ`,`Algeria`,`213`],[`AS`,`American Samoa`,`1`],[`AD`,`Andorra`,`376`],[`AO`,`Angola`,`244`],[`AI`,`Anguilla`,`1`],[`AG`,`Antigua & Barbuda`,`1`],[`AR`,`Argentina`,`54`],[`AM`,`Armenia`,`374`],[`AW`,`Aruba`,`297`],[`AC`,`Ascension Island`,`247`],[`AU`,`Australia`,`61`],[`AT`,`Austria`,`43`],[`AZ`,`Azerbaijan`,`994`],[`BS`,`Bahamas`,`1`],[`BH`,`Bahrain`,`973`],[`BD`,`Bangladesh`,`880`],[`BB`,`Barbados`,`1`],[`BY`,`Belarus`,`375`],[`BE`,`Belgium`,`32`],[`BZ`,`Belize`,`501`],[`BJ`,`Benin`,`229`],[`BM`,`Bermuda`,`1`],[`BT`,`Bhutan`,`975`],[`BO`,`Bolivia`,`591`],[`BA`,`Bosnia & Herzegovina`,`387`],[`BW`,`Botswana`,`267`],[`BR`,`Brazil`,`55`],[`IO`,`British Indian Ocean Territory`,`246`],[`VG`,`British Virgin Islands`,`1`],[`BN`,`Brunei`,`673`],[`BG`,`Bulgaria`,`359`],[`BF`,`Burkina Faso`,`226`],[`BI`,`Burundi`,`257`],[`KH`,`Cambodia`,`855`],[`CM`,`Cameroon`,`237`],[`CA`,`Canada`,`1`],[`CV`,`Cape Verde`,`238`],[`BQ`,`Caribbean Netherlands`,`599`],[`KY`,`Cayman Islands`,`1`],[`CF`,`Central African Republic`,`236`],[`TD`,`Chad`,`235`],[`CL`,`Chile`,`56`],[`CN`,`China`,`86`],[`CX`,`Christmas Island`,`61`],[`CC`,`Cocos (Keeling) Islands`,`61`],[`CO`,`Colombia`,`57`],[`KM`,`Comoros`,`269`],[`CG`,`Congo - Brazzaville`,`242`],[`CD`,`Congo - Kinshasa`,`243`],[`CK`,`Cook Islands`,`682`],[`CR`,`Costa Rica`,`506`],[`CI`,`Côte d’Ivoire`,`225`],[`HR`,`Croatia`,`385`],[`CU`,`Cuba`,`53`],[`CW`,`Curaçao`,`599`],[`CY`,`Cyprus`,`357`],[`CZ`,`Czechia`,`420`],[`DK`,`Denmark`,`45`],[`DJ`,`Djibouti`,`253`],[`DM`,`Dominica`,`1`],[`DO`,`Dominican Republic`,`1`],[`EC`,`Ecuador`,`593`],[`EG`,`Egypt`,`20`],[`SV`,`El Salvador`,`503`],[`GQ`,`Equatorial Guinea`,`240`],[`ER`,`Eritrea`,`291`],[`EE`,`Estonia`,`372`],[`SZ`,`Eswatini`,`268`],[`ET`,`Ethiopia`,`251`],[`FK`,`Falkland Islands`,`500`],[`FO`,`Faroe Islands`,`298`],[`FJ`,`Fiji`,`679`],[`FI`,`Finland`,`358`],[`FR`,`France`,`33`],[`GF`,`French Guiana`,`594`],[`PF`,`French Polynesia`,`689`],[`GA`,`Gabon`,`241`],[`GM`,`Gambia`,`220`],[`GE`,`Georgia`,`995`],[`DE`,`Germany`,`49`],[`GH`,`Ghana`,`233`],[`GI`,`Gibraltar`,`350`],[`GR`,`Greece`,`30`],[`GL`,`Greenland`,`299`],[`GD`,`Grenada`,`1`],[`GP`,`Guadeloupe`,`590`],[`GU`,`Guam`,`1`],[`GT`,`Guatemala`,`502`],[`GG`,`Guernsey`,`44`],[`GN`,`Guinea`,`224`],[`GW`,`Guinea-Bissau`,`245`],[`GY`,`Guyana`,`592`],[`HT`,`Haiti`,`509`],[`HN`,`Honduras`,`504`],[`HK`,`Hong Kong SAR China`,`852`],[`HU`,`Hungary`,`36`],[`IS`,`Iceland`,`354`],[`IN`,`India`,`91`],[`ID`,`Indonesia`,`62`],[`IR`,`Iran`,`98`],[`IQ`,`Iraq`,`964`],[`IE`,`Ireland`,`353`],[`IM`,`Isle of Man`,`44`],[`IL`,`Israel`,`972`],[`IT`,`Italy`,`39`],[`JM`,`Jamaica`,`1`],[`JP`,`Japan`,`81`],[`JE`,`Jersey`,`44`],[`JO`,`Jordan`,`962`],[`KZ`,`Kazakhstan`,`7`],[`KE`,`Kenya`,`254`],[`KI`,`Kiribati`,`686`],[`XK`,`Kosovo`,`383`],[`KW`,`Kuwait`,`965`],[`KG`,`Kyrgyzstan`,`996`],[`LA`,`Laos`,`856`],[`LV`,`Latvia`,`371`],[`LB`,`Lebanon`,`961`],[`LS`,`Lesotho`,`266`],[`LR`,`Liberia`,`231`],[`LY`,`Libya`,`218`],[`LI`,`Liechtenstein`,`423`],[`LT`,`Lithuania`,`370`],[`LU`,`Luxembourg`,`352`],[`MO`,`Macao SAR China`,`853`],[`MG`,`Madagascar`,`261`],[`MW`,`Malawi`,`265`],[`MY`,`Malaysia`,`60`],[`MV`,`Maldives`,`960`],[`ML`,`Mali`,`223`],[`MT`,`Malta`,`356`],[`MH`,`Marshall Islands`,`692`],[`MQ`,`Martinique`,`596`],[`MR`,`Mauritania`,`222`],[`MU`,`Mauritius`,`230`],[`YT`,`Mayotte`,`262`],[`MX`,`Mexico`,`52`],[`FM`,`Micronesia`,`691`],[`MD`,`Moldova`,`373`],[`MC`,`Monaco`,`377`],[`MN`,`Mongolia`,`976`],[`ME`,`Montenegro`,`382`],[`MS`,`Montserrat`,`1`],[`MA`,`Morocco`,`212`],[`MZ`,`Mozambique`,`258`],[`MM`,`Myanmar (Burma)`,`95`],[`NA`,`Namibia`,`264`],[`NR`,`Nauru`,`674`],[`NP`,`Nepal`,`977`],[`NL`,`Netherlands`,`31`],[`NC`,`New Caledonia`,`687`],[`NZ`,`New Zealand`,`64`],[`NI`,`Nicaragua`,`505`],[`NE`,`Niger`,`227`],[`NG`,`Nigeria`,`234`],[`NU`,`Niue`,`683`],[`NF`,`Norfolk Island`,`672`],[`KP`,`North Korea`,`850`],[`MK`,`North Macedonia`,`389`],[`MP`,`Northern Mariana Islands`,`1`],[`NO`,`Norway`,`47`],[`OM`,`Oman`,`968`],[`PK`,`Pakistan`,`92`],[`PW`,`Palau`,`680`],[`PS`,`Palestinian Territories`,`970`],[`PA`,`Panama`,`507`],[`PG`,`Papua New Guinea`,`675`],[`PY`,`Paraguay`,`595`],[`PE`,`Peru`,`51`],[`PH`,`Philippines`,`63`],[`PL`,`Poland`,`48`],[`PT`,`Portugal`,`351`],[`PR`,`Puerto Rico`,`1`],[`QA`,`Qatar`,`974`],[`RE`,`Réunion`,`262`],[`RO`,`Romania`,`40`],[`RU`,`Russia`,`7`],[`RW`,`Rwanda`,`250`],[`WS`,`Samoa`,`685`],[`SM`,`San Marino`,`378`],[`ST`,`São Tomé & Príncipe`,`239`],[`SA`,`Saudi Arabia`,`966`],[`SN`,`Senegal`,`221`],[`RS`,`Serbia`,`381`],[`SC`,`Seychelles`,`248`],[`SL`,`Sierra Leone`,`232`],[`SG`,`Singapore`,`65`],[`SX`,`Sint Maarten`,`1`],[`SK`,`Slovakia`,`421`],[`SI`,`Slovenia`,`386`],[`SB`,`Solomon Islands`,`677`],[`SO`,`Somalia`,`252`],[`ZA`,`South Africa`,`27`],[`KR`,`South Korea`,`82`],[`SS`,`South Sudan`,`211`],[`ES`,`Spain`,`34`],[`LK`,`Sri Lanka`,`94`],[`BL`,`St. Barthélemy`,`590`],[`SH`,`St. Helena, Ascension & Tristan da Cunha`,`290`],[`KN`,`St. Kitts & Nevis`,`1`],[`LC`,`St. Lucia`,`1`],[`MF`,`St. Martin`,`590`],[`PM`,`St. Pierre & Miquelon`,`508`],[`VC`,`St. Vincent & Grenadines`,`1`],[`SD`,`Sudan`,`249`],[`SR`,`Suriname`,`597`],[`SJ`,`Svalbard & Jan Mayen`,`47`],[`SE`,`Sweden`,`46`],[`CH`,`Switzerland`,`41`],[`SY`,`Syria`,`963`],[`TW`,`Taiwan`,`886`],[`TJ`,`Tajikistan`,`992`],[`TZ`,`Tanzania`,`255`],[`TH`,`Thailand`,`66`],[`TL`,`Timor-Leste`,`670`],[`TG`,`Togo`,`228`],[`TK`,`Tokelau`,`690`],[`TO`,`Tonga`,`676`],[`TT`,`Trinidad & Tobago`,`1`],[`TA`,`Tristan da Cunha`,`290`],[`TN`,`Tunisia`,`216`],[`TR`,`Türkiye`,`90`],[`TM`,`Turkmenistan`,`993`],[`TC`,`Turks & Caicos Islands`,`1`],[`TV`,`Tuvalu`,`688`],[`VI`,`U.S. Virgin Islands`,`1`],[`UG`,`Uganda`,`256`],[`UA`,`Ukraine`,`380`],[`AE`,`United Arab Emirates`,`971`],[`GB`,`United Kingdom`,`44`],[`US`,`United States`,`1`],[`UY`,`Uruguay`,`598`],[`UZ`,`Uzbekistan`,`998`],[`VU`,`Vanuatu`,`678`],[`VA`,`Vatican City`,`39`],[`VE`,`Venezuela`,`58`],[`VN`,`Vietnam`,`84`],[`WF`,`Wallis & Futuna`,`681`],[`EH`,`Western Sahara`,`212`],[`YE`,`Yemen`,`967`],[`ZM`,`Zambia`,`260`],[`ZW`,`Zimbabwe`,`263`]],v=e=>_.find(t=>t[0]===e)?.[2]??``,y={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:`America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:`Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:`America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},b=new Set(_.map(([e])=>e)),x=new Map;for(let[e,t]of Object.entries(y))for(let n of t)x.set(n,e);function S(e){let t=e===void 0?void 0:x.get(e);return t&&b.has(t)?t:null}function C(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&b.has(t)?t:null}function w(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return S(e)||C(t)||null}var T=`ui-phone.global.js`;function E(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${T}"]`);if(!n){let e=document.createElement(`script`);try{e.src=(0,u.assetUrl)(T)}catch(e){t(e);return}document.head.append(e),n=e}n.addEventListener(`load`,()=>window.WeborityPhone?e(window.WeborityPhone):t(Error(`The phone metadata script did not load.`))),n.addEventListener(`error`,()=>t(Error(`The phone metadata script failed to load.`)))})}var D={chooseCountryLabel:`Choose country`,chooseCountryMessage:`Choose a country`,examplePlaceholder:`For example {example}`,invalidNumberExampleMessage:`Enter a valid phone number, e.g. {example}`,invalidNumberMessage:`Enter a valid phone number`,noCountriesFoundLabel:`No countries found`,placeholder:`Enter phone number`,searchCountriesLabel:`Search countries`,searchCountryPlaceholder:`Search country or code`},O=()=>(0,d.readText)(`phone`,D);function k(e,t){return e.isSupportedCountry(t)}var A=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,j=e=>e?`+${v(e)}`:``,M=null,N=null;function P(){return M?Promise.resolve(M):(N||=E().then(e=>(M=e,M)).catch(e=>((0,n.devError)(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),N)}function F(e,t){let n=`+${v(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function I(e,t){if(!M||!t||!e||!k(M,e))return t;try{return F(e,new M.AsYouType(e).input(`+${v(e)}${t}`))||t}catch{return t}}function L(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function R(e){if(!M||!e||!k(M,e))return null;try{return F(e,M.getExampleNumber(e,M.examples)?.formatInternational())||null}catch{return null}}function z(e){let t=R(e);return t?(0,d.fillText)(O().examplePlaceholder,{example:t}):null}function B(e){if(!M||!e)return null;try{if(!M.isValidPhoneNumber(e))return!1;let t=M.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function V(e){if(!M||!e||!k(M,e))return null;try{let t=M.getExampleNumber(e,M.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function H(e,t,n){if(!M||!k(M,e))return null;try{let r=M.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function U(e){if(!M||!e?.trim().startsWith(`+`))return null;try{let t=new M.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!Y(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function W(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(v(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var G=class extends r.ElementBase{static formAssociated=!0;static whenFormatted(){return P().then(()=>void 0)}static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=w()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){let e=q(this.querySelector(`.country-dropdown-menu`),HTMLElement);e&&(0,l.closeAnchoredPopover)(e)}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${v(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:U(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(v(this._locked||this.getAttribute(`country`)||this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){(0,a.syncFormMirror)(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||z(this._country)||O().placeholder;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${A(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${j(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
1
+ (function(e,t,n,r,i,a,o,s,c,l,u,d,f,p){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var m=Object.defineProperty,h=(e,t)=>{let n={};for(var r in e)m(n,r,{get:e[r],enumerable:!0});return t||m(n,Symbol.toStringTag,{value:`Module`}),n},g=globalThis.WeborityUiElementsInternal?.version;if(g!==`0.170.0`)throw Error(`[webority-ui] phone expects ui-elements 0.170.0 but the page loaded `+g+`.`);var _=[[`AF`,`Afghanistan`,`93`],[`AX`,`Åland Islands`,`358`],[`AL`,`Albania`,`355`],[`DZ`,`Algeria`,`213`],[`AS`,`American Samoa`,`1`],[`AD`,`Andorra`,`376`],[`AO`,`Angola`,`244`],[`AI`,`Anguilla`,`1`],[`AG`,`Antigua & Barbuda`,`1`],[`AR`,`Argentina`,`54`],[`AM`,`Armenia`,`374`],[`AW`,`Aruba`,`297`],[`AC`,`Ascension Island`,`247`],[`AU`,`Australia`,`61`],[`AT`,`Austria`,`43`],[`AZ`,`Azerbaijan`,`994`],[`BS`,`Bahamas`,`1`],[`BH`,`Bahrain`,`973`],[`BD`,`Bangladesh`,`880`],[`BB`,`Barbados`,`1`],[`BY`,`Belarus`,`375`],[`BE`,`Belgium`,`32`],[`BZ`,`Belize`,`501`],[`BJ`,`Benin`,`229`],[`BM`,`Bermuda`,`1`],[`BT`,`Bhutan`,`975`],[`BO`,`Bolivia`,`591`],[`BA`,`Bosnia & Herzegovina`,`387`],[`BW`,`Botswana`,`267`],[`BR`,`Brazil`,`55`],[`IO`,`British Indian Ocean Territory`,`246`],[`VG`,`British Virgin Islands`,`1`],[`BN`,`Brunei`,`673`],[`BG`,`Bulgaria`,`359`],[`BF`,`Burkina Faso`,`226`],[`BI`,`Burundi`,`257`],[`KH`,`Cambodia`,`855`],[`CM`,`Cameroon`,`237`],[`CA`,`Canada`,`1`],[`CV`,`Cape Verde`,`238`],[`BQ`,`Caribbean Netherlands`,`599`],[`KY`,`Cayman Islands`,`1`],[`CF`,`Central African Republic`,`236`],[`TD`,`Chad`,`235`],[`CL`,`Chile`,`56`],[`CN`,`China`,`86`],[`CX`,`Christmas Island`,`61`],[`CC`,`Cocos (Keeling) Islands`,`61`],[`CO`,`Colombia`,`57`],[`KM`,`Comoros`,`269`],[`CG`,`Congo - Brazzaville`,`242`],[`CD`,`Congo - Kinshasa`,`243`],[`CK`,`Cook Islands`,`682`],[`CR`,`Costa Rica`,`506`],[`CI`,`Côte d’Ivoire`,`225`],[`HR`,`Croatia`,`385`],[`CU`,`Cuba`,`53`],[`CW`,`Curaçao`,`599`],[`CY`,`Cyprus`,`357`],[`CZ`,`Czechia`,`420`],[`DK`,`Denmark`,`45`],[`DJ`,`Djibouti`,`253`],[`DM`,`Dominica`,`1`],[`DO`,`Dominican Republic`,`1`],[`EC`,`Ecuador`,`593`],[`EG`,`Egypt`,`20`],[`SV`,`El Salvador`,`503`],[`GQ`,`Equatorial Guinea`,`240`],[`ER`,`Eritrea`,`291`],[`EE`,`Estonia`,`372`],[`SZ`,`Eswatini`,`268`],[`ET`,`Ethiopia`,`251`],[`FK`,`Falkland Islands`,`500`],[`FO`,`Faroe Islands`,`298`],[`FJ`,`Fiji`,`679`],[`FI`,`Finland`,`358`],[`FR`,`France`,`33`],[`GF`,`French Guiana`,`594`],[`PF`,`French Polynesia`,`689`],[`GA`,`Gabon`,`241`],[`GM`,`Gambia`,`220`],[`GE`,`Georgia`,`995`],[`DE`,`Germany`,`49`],[`GH`,`Ghana`,`233`],[`GI`,`Gibraltar`,`350`],[`GR`,`Greece`,`30`],[`GL`,`Greenland`,`299`],[`GD`,`Grenada`,`1`],[`GP`,`Guadeloupe`,`590`],[`GU`,`Guam`,`1`],[`GT`,`Guatemala`,`502`],[`GG`,`Guernsey`,`44`],[`GN`,`Guinea`,`224`],[`GW`,`Guinea-Bissau`,`245`],[`GY`,`Guyana`,`592`],[`HT`,`Haiti`,`509`],[`HN`,`Honduras`,`504`],[`HK`,`Hong Kong SAR China`,`852`],[`HU`,`Hungary`,`36`],[`IS`,`Iceland`,`354`],[`IN`,`India`,`91`],[`ID`,`Indonesia`,`62`],[`IR`,`Iran`,`98`],[`IQ`,`Iraq`,`964`],[`IE`,`Ireland`,`353`],[`IM`,`Isle of Man`,`44`],[`IL`,`Israel`,`972`],[`IT`,`Italy`,`39`],[`JM`,`Jamaica`,`1`],[`JP`,`Japan`,`81`],[`JE`,`Jersey`,`44`],[`JO`,`Jordan`,`962`],[`KZ`,`Kazakhstan`,`7`],[`KE`,`Kenya`,`254`],[`KI`,`Kiribati`,`686`],[`XK`,`Kosovo`,`383`],[`KW`,`Kuwait`,`965`],[`KG`,`Kyrgyzstan`,`996`],[`LA`,`Laos`,`856`],[`LV`,`Latvia`,`371`],[`LB`,`Lebanon`,`961`],[`LS`,`Lesotho`,`266`],[`LR`,`Liberia`,`231`],[`LY`,`Libya`,`218`],[`LI`,`Liechtenstein`,`423`],[`LT`,`Lithuania`,`370`],[`LU`,`Luxembourg`,`352`],[`MO`,`Macao SAR China`,`853`],[`MG`,`Madagascar`,`261`],[`MW`,`Malawi`,`265`],[`MY`,`Malaysia`,`60`],[`MV`,`Maldives`,`960`],[`ML`,`Mali`,`223`],[`MT`,`Malta`,`356`],[`MH`,`Marshall Islands`,`692`],[`MQ`,`Martinique`,`596`],[`MR`,`Mauritania`,`222`],[`MU`,`Mauritius`,`230`],[`YT`,`Mayotte`,`262`],[`MX`,`Mexico`,`52`],[`FM`,`Micronesia`,`691`],[`MD`,`Moldova`,`373`],[`MC`,`Monaco`,`377`],[`MN`,`Mongolia`,`976`],[`ME`,`Montenegro`,`382`],[`MS`,`Montserrat`,`1`],[`MA`,`Morocco`,`212`],[`MZ`,`Mozambique`,`258`],[`MM`,`Myanmar (Burma)`,`95`],[`NA`,`Namibia`,`264`],[`NR`,`Nauru`,`674`],[`NP`,`Nepal`,`977`],[`NL`,`Netherlands`,`31`],[`NC`,`New Caledonia`,`687`],[`NZ`,`New Zealand`,`64`],[`NI`,`Nicaragua`,`505`],[`NE`,`Niger`,`227`],[`NG`,`Nigeria`,`234`],[`NU`,`Niue`,`683`],[`NF`,`Norfolk Island`,`672`],[`KP`,`North Korea`,`850`],[`MK`,`North Macedonia`,`389`],[`MP`,`Northern Mariana Islands`,`1`],[`NO`,`Norway`,`47`],[`OM`,`Oman`,`968`],[`PK`,`Pakistan`,`92`],[`PW`,`Palau`,`680`],[`PS`,`Palestinian Territories`,`970`],[`PA`,`Panama`,`507`],[`PG`,`Papua New Guinea`,`675`],[`PY`,`Paraguay`,`595`],[`PE`,`Peru`,`51`],[`PH`,`Philippines`,`63`],[`PL`,`Poland`,`48`],[`PT`,`Portugal`,`351`],[`PR`,`Puerto Rico`,`1`],[`QA`,`Qatar`,`974`],[`RE`,`Réunion`,`262`],[`RO`,`Romania`,`40`],[`RU`,`Russia`,`7`],[`RW`,`Rwanda`,`250`],[`WS`,`Samoa`,`685`],[`SM`,`San Marino`,`378`],[`ST`,`São Tomé & Príncipe`,`239`],[`SA`,`Saudi Arabia`,`966`],[`SN`,`Senegal`,`221`],[`RS`,`Serbia`,`381`],[`SC`,`Seychelles`,`248`],[`SL`,`Sierra Leone`,`232`],[`SG`,`Singapore`,`65`],[`SX`,`Sint Maarten`,`1`],[`SK`,`Slovakia`,`421`],[`SI`,`Slovenia`,`386`],[`SB`,`Solomon Islands`,`677`],[`SO`,`Somalia`,`252`],[`ZA`,`South Africa`,`27`],[`KR`,`South Korea`,`82`],[`SS`,`South Sudan`,`211`],[`ES`,`Spain`,`34`],[`LK`,`Sri Lanka`,`94`],[`BL`,`St. Barthélemy`,`590`],[`SH`,`St. Helena, Ascension & Tristan da Cunha`,`290`],[`KN`,`St. Kitts & Nevis`,`1`],[`LC`,`St. Lucia`,`1`],[`MF`,`St. Martin`,`590`],[`PM`,`St. Pierre & Miquelon`,`508`],[`VC`,`St. Vincent & Grenadines`,`1`],[`SD`,`Sudan`,`249`],[`SR`,`Suriname`,`597`],[`SJ`,`Svalbard & Jan Mayen`,`47`],[`SE`,`Sweden`,`46`],[`CH`,`Switzerland`,`41`],[`SY`,`Syria`,`963`],[`TW`,`Taiwan`,`886`],[`TJ`,`Tajikistan`,`992`],[`TZ`,`Tanzania`,`255`],[`TH`,`Thailand`,`66`],[`TL`,`Timor-Leste`,`670`],[`TG`,`Togo`,`228`],[`TK`,`Tokelau`,`690`],[`TO`,`Tonga`,`676`],[`TT`,`Trinidad & Tobago`,`1`],[`TA`,`Tristan da Cunha`,`290`],[`TN`,`Tunisia`,`216`],[`TR`,`Türkiye`,`90`],[`TM`,`Turkmenistan`,`993`],[`TC`,`Turks & Caicos Islands`,`1`],[`TV`,`Tuvalu`,`688`],[`VI`,`U.S. Virgin Islands`,`1`],[`UG`,`Uganda`,`256`],[`UA`,`Ukraine`,`380`],[`AE`,`United Arab Emirates`,`971`],[`GB`,`United Kingdom`,`44`],[`US`,`United States`,`1`],[`UY`,`Uruguay`,`598`],[`UZ`,`Uzbekistan`,`998`],[`VU`,`Vanuatu`,`678`],[`VA`,`Vatican City`,`39`],[`VE`,`Venezuela`,`58`],[`VN`,`Vietnam`,`84`],[`WF`,`Wallis & Futuna`,`681`],[`EH`,`Western Sahara`,`212`],[`YE`,`Yemen`,`967`],[`ZM`,`Zambia`,`260`],[`ZW`,`Zimbabwe`,`263`]],v=e=>_.find(t=>t[0]===e)?.[2]??``,y={AD:[`Europe/Andorra`],AE:[`Asia/Dubai`],AF:[`Asia/Kabul`],AG:[`America/Antigua`],AI:[`America/Anguilla`],AL:[`Europe/Tirane`],AM:[`Asia/Yerevan`],AO:[`Africa/Luanda`],AR:[`America/Argentina/Buenos_Aires`,`America/Argentina/Catamarca`,`America/Argentina/ComodRivadavia`,`America/Argentina/Cordoba`,`America/Argentina/Jujuy`,`America/Argentina/La_Rioja`,`America/Argentina/Mendoza`,`America/Argentina/Rio_Gallegos`,`America/Argentina/Salta`,`America/Argentina/San_Juan`,`America/Argentina/San_Luis`,`America/Argentina/Tucuman`,`America/Argentina/Ushuaia`,`America/Buenos_Aires`,`America/Catamarca`,`America/Cordoba`,`America/Jujuy`,`America/Mendoza`,`America/Rosario`],AS:[`Pacific/Pago_Pago`,`Pacific/Samoa`,`US/Samoa`],AT:[`Europe/Vienna`],AU:[`Antarctica/Macquarie`,`Australia/Adelaide`,`Australia/Brisbane`,`Australia/Broken_Hill`,`Australia/Canberra`,`Australia/Currie`,`Australia/Darwin`,`Australia/Eucla`,`Australia/Hobart`,`Australia/LHI`,`Australia/Lindeman`,`Australia/Lord_Howe`,`Australia/Melbourne`,`Australia/NSW`,`Australia/North`,`Australia/Perth`,`Australia/Queensland`,`Australia/South`,`Australia/Sydney`,`Australia/Tasmania`,`Australia/Victoria`,`Australia/West`,`Australia/Yancowinna`],AW:[`America/Aruba`],AX:[`Europe/Mariehamn`],AZ:[`Asia/Baku`],BA:[`Europe/Sarajevo`],BB:[`America/Barbados`],BD:[`Asia/Dacca`,`Asia/Dhaka`],BE:[`Europe/Brussels`],BF:[`Africa/Ouagadougou`],BG:[`Europe/Sofia`],BH:[`Asia/Bahrain`],BI:[`Africa/Bujumbura`],BJ:[`Africa/Porto-Novo`],BL:[`America/St_Barthelemy`],BM:[`Atlantic/Bermuda`],BN:[`Asia/Brunei`],BO:[`America/La_Paz`],BQ:[`America/Kralendijk`],BR:[`America/Araguaina`,`America/Bahia`,`America/Belem`,`America/Boa_Vista`,`America/Campo_Grande`,`America/Cuiaba`,`America/Eirunepe`,`America/Fortaleza`,`America/Maceio`,`America/Manaus`,`America/Noronha`,`America/Porto_Acre`,`America/Porto_Velho`,`America/Recife`,`America/Rio_Branco`,`America/Santarem`,`America/Sao_Paulo`,`Brazil/DeNoronha`,`Brazil/East`,`Brazil/West`],BS:[`America/Nassau`],BT:[`Asia/Thimbu`,`Asia/Thimphu`],BW:[`Africa/Gaborone`],BY:[`Europe/Minsk`],BZ:[`America/Belize`],CA:`America/Atikokan.America/Blanc-Sablon.America/Cambridge_Bay.America/Coral_Harbour.America/Creston.America/Dawson.America/Dawson_Creek.America/Edmonton.America/Fort_Nelson.America/Glace_Bay.America/Goose_Bay.America/Halifax.America/Inuvik.America/Iqaluit.America/Moncton.America/Montreal.America/Nipigon.America/Pangnirtung.America/Rainy_River.America/Rankin_Inlet.America/Regina.America/Resolute.America/St_Johns.America/Swift_Current.America/Thunder_Bay.America/Toronto.America/Vancouver.America/Whitehorse.America/Winnipeg.America/Yellowknife.Canada/Atlantic.Canada/Central.Canada/Eastern.Canada/Mountain.Canada/Newfoundland.Canada/Pacific.Canada/Saskatchewan.Canada/Yukon`.split(`.`),CC:[`Indian/Cocos`],CD:[`Africa/Kinshasa`,`Africa/Lubumbashi`],CF:[`Africa/Bangui`],CG:[`Africa/Brazzaville`],CH:[`Europe/Zurich`],CI:[`Africa/Abidjan`],CK:[`Pacific/Rarotonga`],CL:[`America/Coyhaique`,`America/Punta_Arenas`,`America/Santiago`,`Chile/Continental`,`Chile/EasterIsland`,`Pacific/Easter`],CM:[`Africa/Douala`],CN:[`Asia/Chongqing`,`Asia/Harbin`,`Asia/Kashgar`,`Asia/Shanghai`,`Asia/Urumqi`],CO:[`America/Bogota`],CR:[`America/Costa_Rica`],CU:[`America/Havana`],CV:[`Atlantic/Cape_Verde`],CW:[`America/Curacao`],CX:[`Indian/Christmas`],CY:[`Asia/Famagusta`,`Asia/Nicosia`,`Europe/Nicosia`],CZ:[`Europe/Prague`],DE:[`Europe/Berlin`,`Europe/Busingen`],DJ:[`Africa/Djibouti`],DK:[`Europe/Copenhagen`],DM:[`America/Dominica`],DO:[`America/Santo_Domingo`],DZ:[`Africa/Algiers`],EC:[`America/Guayaquil`,`Pacific/Galapagos`],EE:[`Europe/Tallinn`],EG:[`Africa/Cairo`],EH:[`Africa/El_Aaiun`],ER:[`Africa/Asmara`,`Africa/Asmera`],ES:[`Africa/Ceuta`,`Atlantic/Canary`,`Europe/Madrid`],ET:[`Africa/Addis_Ababa`],FI:[`Europe/Helsinki`],FJ:[`Pacific/Fiji`],FK:[`Atlantic/Stanley`],FM:[`Pacific/Chuuk`,`Pacific/Kosrae`,`Pacific/Pohnpei`,`Pacific/Ponape`,`Pacific/Truk`,`Pacific/Yap`],FO:[`Atlantic/Faeroe`,`Atlantic/Faroe`],FR:[`Europe/Paris`],GA:[`Africa/Libreville`],GB:[`Europe/Belfast`,`Europe/London`],GD:[`America/Grenada`],GE:[`Asia/Tbilisi`],GF:[`America/Cayenne`],GG:[`Europe/Guernsey`],GH:[`Africa/Accra`],GI:[`Europe/Gibraltar`],GL:[`America/Danmarkshavn`,`America/Godthab`,`America/Nuuk`,`America/Scoresbysund`,`America/Thule`],GM:[`Africa/Banjul`],GN:[`Africa/Conakry`],GP:[`America/Guadeloupe`],GQ:[`Africa/Malabo`],GR:[`Europe/Athens`],GT:[`America/Guatemala`],GU:[`Pacific/Guam`],GW:[`Africa/Bissau`],GY:[`America/Guyana`],HK:[`Asia/Hong_Kong`],HN:[`America/Tegucigalpa`],HR:[`Europe/Zagreb`],HT:[`America/Port-au-Prince`],HU:[`Europe/Budapest`],ID:[`Asia/Jakarta`,`Asia/Jayapura`,`Asia/Makassar`,`Asia/Pontianak`,`Asia/Ujung_Pandang`],IE:[`Europe/Dublin`],IL:[`Asia/Jerusalem`,`Asia/Tel_Aviv`],IM:[`Europe/Isle_of_Man`],IN:[`Asia/Calcutta`,`Asia/Kolkata`],IO:[`Indian/Chagos`],IQ:[`Asia/Baghdad`],IR:[`Asia/Tehran`],IS:[`Atlantic/Reykjavik`],IT:[`Europe/Rome`],JE:[`Europe/Jersey`],JM:[`America/Jamaica`],JO:[`Asia/Amman`],JP:[`Asia/Tokyo`],KE:[`Africa/Nairobi`],KG:[`Asia/Bishkek`],KH:[`Asia/Phnom_Penh`],KI:[`Pacific/Enderbury`,`Pacific/Kanton`,`Pacific/Kiritimati`,`Pacific/Tarawa`],KM:[`Indian/Comoro`],KN:[`America/St_Kitts`],KP:[`Asia/Pyongyang`],KR:[`Asia/Seoul`],KW:[`Asia/Kuwait`],KY:[`America/Cayman`],KZ:[`Asia/Almaty`,`Asia/Aqtau`,`Asia/Aqtobe`,`Asia/Atyrau`,`Asia/Oral`,`Asia/Qostanay`,`Asia/Qyzylorda`],LA:[`Asia/Vientiane`],LB:[`Asia/Beirut`],LC:[`America/St_Lucia`],LI:[`Europe/Vaduz`],LK:[`Asia/Colombo`],LR:[`Africa/Monrovia`],LS:[`Africa/Maseru`],LT:[`Europe/Vilnius`],LU:[`Europe/Luxembourg`],LV:[`Europe/Riga`],LY:[`Africa/Tripoli`],MA:[`Africa/Casablanca`],MC:[`Europe/Monaco`],MD:[`Europe/Chisinau`,`Europe/Tiraspol`],ME:[`Europe/Podgorica`],MF:[`America/Marigot`],MG:[`Indian/Antananarivo`],MH:[`Pacific/Kwajalein`,`Pacific/Majuro`],MK:[`Europe/Skopje`],ML:[`Africa/Bamako`,`Africa/Timbuktu`],MM:[`Asia/Rangoon`,`Asia/Yangon`],MN:[`Asia/Choibalsan`,`Asia/Hovd`,`Asia/Ulaanbaatar`,`Asia/Ulan_Bator`],MO:[`Asia/Macao`,`Asia/Macau`],MP:[`Pacific/Saipan`],MQ:[`America/Martinique`],MR:[`Africa/Nouakchott`],MS:[`America/Montserrat`],MT:[`Europe/Malta`],MU:[`Indian/Mauritius`],MV:[`Indian/Maldives`],MW:[`Africa/Blantyre`],MX:[`America/Bahia_Banderas`,`America/Cancun`,`America/Chihuahua`,`America/Ciudad_Juarez`,`America/Ensenada`,`America/Hermosillo`,`America/Matamoros`,`America/Mazatlan`,`America/Merida`,`America/Mexico_City`,`America/Monterrey`,`America/Ojinaga`,`America/Santa_Isabel`,`America/Tijuana`,`Mexico/BajaNorte`,`Mexico/BajaSur`,`Mexico/General`],MY:[`Asia/Kuala_Lumpur`,`Asia/Kuching`],MZ:[`Africa/Maputo`],NA:[`Africa/Windhoek`],NC:[`Pacific/Noumea`],NE:[`Africa/Niamey`],NF:[`Pacific/Norfolk`],NG:[`Africa/Lagos`],NI:[`America/Managua`],NL:[`Europe/Amsterdam`],NO:[`Europe/Oslo`],NP:[`Asia/Kathmandu`,`Asia/Katmandu`],NR:[`Pacific/Nauru`],NU:[`Pacific/Niue`],NZ:[`Pacific/Auckland`,`Pacific/Chatham`],OM:[`Asia/Muscat`],PA:[`America/Panama`],PE:[`America/Lima`],PF:[`Pacific/Gambier`,`Pacific/Marquesas`,`Pacific/Tahiti`],PG:[`Pacific/Bougainville`,`Pacific/Port_Moresby`],PH:[`Asia/Manila`],PK:[`Asia/Karachi`],PL:[`Europe/Warsaw`],PM:[`America/Miquelon`],PR:[`America/Puerto_Rico`],PS:[`Asia/Gaza`,`Asia/Hebron`],PT:[`Atlantic/Azores`,`Atlantic/Madeira`,`Europe/Lisbon`],PW:[`Pacific/Palau`],PY:[`America/Asuncion`],QA:[`Asia/Qatar`],RE:[`Indian/Reunion`],RO:[`Europe/Bucharest`],RS:[`Europe/Belgrade`],RU:`Asia/Anadyr.Asia/Barnaul.Asia/Chita.Asia/Irkutsk.Asia/Kamchatka.Asia/Khandyga.Asia/Krasnoyarsk.Asia/Magadan.Asia/Novokuznetsk.Asia/Novosibirsk.Asia/Omsk.Asia/Sakhalin.Asia/Srednekolymsk.Asia/Tomsk.Asia/Ust-Nera.Asia/Vladivostok.Asia/Yakutsk.Asia/Yekaterinburg.Europe/Astrakhan.Europe/Kaliningrad.Europe/Kirov.Europe/Moscow.Europe/Samara.Europe/Saratov.Europe/Ulyanovsk.Europe/Volgograd`.split(`.`),RW:[`Africa/Kigali`],SA:[`Asia/Riyadh`],SB:[`Pacific/Guadalcanal`],SC:[`Indian/Mahe`],SD:[`Africa/Khartoum`],SE:[`Europe/Stockholm`],SG:[`Asia/Singapore`],SH:[`Atlantic/St_Helena`],SI:[`Europe/Ljubljana`],SJ:[`Arctic/Longyearbyen`,`Atlantic/Jan_Mayen`],SK:[`Europe/Bratislava`],SL:[`Africa/Freetown`],SM:[`Europe/San_Marino`],SN:[`Africa/Dakar`],SO:[`Africa/Mogadishu`],SR:[`America/Paramaribo`],SS:[`Africa/Juba`],ST:[`Africa/Sao_Tome`],SV:[`America/El_Salvador`],SX:[`America/Lower_Princes`],SY:[`Asia/Damascus`],SZ:[`Africa/Mbabane`],TC:[`America/Grand_Turk`],TD:[`Africa/Ndjamena`],TG:[`Africa/Lome`],TH:[`Asia/Bangkok`],TJ:[`Asia/Dushanbe`],TK:[`Pacific/Fakaofo`],TL:[`Asia/Dili`],TM:[`Asia/Ashgabat`,`Asia/Ashkhabad`],TN:[`Africa/Tunis`],TO:[`Pacific/Tongatapu`],TR:[`Asia/Istanbul`,`Europe/Istanbul`],TT:[`America/Port_of_Spain`],TV:[`Pacific/Funafuti`],TW:[`Asia/Taipei`],TZ:[`Africa/Dar_es_Salaam`],UA:[`Europe/Kiev`,`Europe/Kyiv`,`Europe/Simferopol`,`Europe/Uzhgorod`,`Europe/Zaporozhye`],UG:[`Africa/Kampala`],US:`America/Adak.America/Anchorage.America/Atka.America/Boise.America/Chicago.America/Denver.America/Detroit.America/Fort_Wayne.America/Indiana/Indianapolis.America/Indiana/Knox.America/Indiana/Marengo.America/Indiana/Petersburg.America/Indiana/Tell_City.America/Indiana/Vevay.America/Indiana/Vincennes.America/Indiana/Winamac.America/Indianapolis.America/Juneau.America/Kentucky/Louisville.America/Kentucky/Monticello.America/Knox_IN.America/Los_Angeles.America/Louisville.America/Menominee.America/Metlakatla.America/New_York.America/Nome.America/North_Dakota/Beulah.America/North_Dakota/Center.America/North_Dakota/New_Salem.America/Phoenix.America/Shiprock.America/Sitka.America/Yakutat.Pacific/Honolulu.US/Alaska.US/Aleutian.US/Arizona.US/Central.US/East-Indiana.US/Eastern.US/Hawaii.US/Indiana-Starke.US/Michigan.US/Mountain.US/Pacific`.split(`.`),UY:[`America/Montevideo`],UZ:[`Asia/Samarkand`,`Asia/Tashkent`],VA:[`Europe/Vatican`],VC:[`America/St_Vincent`],VE:[`America/Caracas`],VG:[`America/Tortola`],VI:[`America/St_Thomas`,`America/Virgin`],VN:[`Asia/Ho_Chi_Minh`,`Asia/Saigon`],VU:[`Pacific/Efate`],WF:[`Pacific/Wallis`],WS:[`Pacific/Apia`],YE:[`Asia/Aden`],YT:[`Indian/Mayotte`],ZA:[`Africa/Johannesburg`],ZM:[`Africa/Lusaka`],ZW:[`Africa/Harare`]},b=new Set(_.map(([e])=>e)),x=new Map;for(let[e,t]of Object.entries(y))for(let n of t)x.set(n,e);function S(e){let t=e===void 0?void 0:x.get(e);return t&&b.has(t)?t:null}function C(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&b.has(t)?t:null}function w(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return S(e)||C(t)||null}var T=`ui-phone.global.js`;function E(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${T}"]`);if(!n){let e=document.createElement(`script`);try{e.src=(0,u.assetUrl)(T)}catch(e){t(e);return}document.head.append(e),n=e}n.addEventListener(`load`,()=>window.WeborityPhone?e(window.WeborityPhone):t(Error(`The phone metadata script did not load.`))),n.addEventListener(`error`,()=>t(Error(`The phone metadata script failed to load.`)))})}var D={chooseCountryLabel:`Choose country`,chooseCountryMessage:`Choose a country`,examplePlaceholder:`For example {example}`,invalidNumberExampleMessage:`Enter a valid phone number, e.g. {example}`,invalidNumberMessage:`Enter a valid phone number`,noCountriesFoundLabel:`No countries found`,placeholder:`Enter phone number`,searchCountriesLabel:`Search countries`,searchCountryPlaceholder:`Search country or code`},O=()=>(0,d.readText)(`phone`,D);function k(e,t){return e.isSupportedCountry(t)}var A=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,j=e=>e?`+${v(e)}`:``,M=null,N=null;function P(){return M?Promise.resolve(M):(N||=E().then(e=>(M=e,M)).catch(e=>((0,n.devError)(`[@webority/ui-elements] <wui-phone> could not load its phone number metadata.`,e),null)),N)}function F(e,t){let n=`+${v(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function I(e,t){if(!M||!t||!e||!k(M,e))return t;try{return F(e,new M.AsYouType(e).input(`+${v(e)}${t}`))||t}catch{return t}}function L(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)if(/[0-9]/.test(e[r]??``)&&(n+=1,n===t))return r+1;return e.length}function R(e){if(!M||!e||!k(M,e))return null;try{return F(e,M.getExampleNumber(e,M.examples)?.formatInternational())||null}catch{return null}}function z(e){let t=R(e);return t?(0,d.fillText)(O().examplePlaceholder,{example:t}):null}function B(e){if(!M||!e)return null;try{if(!M.isValidPhoneNumber(e))return!1;let t=M.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function V(e){if(!M||!e||!k(M,e))return null;try{let t=M.getExampleNumber(e,M.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function H(e,t,n){if(!M||!k(M,e))return null;try{let r=M.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function U(e){if(!M||!e?.trim().startsWith(`+`))return null;try{let t=new M.AsYouType;t.input(e.trim());let n=t.getCountry();return!n||!Y(t)?null:{country:n,national:t.getNationalNumber()||``}}catch{return null}}function W(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(v(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var G=class extends r.ElementBase{static formAssociated=!0;static whenFormatted(){return P().then(()=>void 0)}static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`readonly`,`loading`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=w()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered||this.render()}disconnectedCallback(){let e=q(this.querySelector(`.country-dropdown-menu`),HTMLElement);e&&(0,l.closeAnchoredPopover)(e)}attributeChangedCallback(e,t,n){if(e===`value`)this.value=n;else if(this._rendered){if(e===`aria-label`){let t=this.querySelector(`input[type=tel]`);t&&(n==null?t.removeAttribute(e):t.setAttribute(e,n))}else if(e===`aria-describedby`)this._syncDescribedBy();else if(e===`country`){if(this._locked)return;let e=this.value;if(this._country=n||this._defaultCountry,this._suppressCountryRender)return;this.render(),this.value!==e&&(this._emitInput(),this._emitChange())}else this.render()}}formResetCallback(){this._validateOnInput=!1,this.value=this._defaultValue||``}get _locked(){return(this.getAttribute(`locked-country`)||``).toUpperCase()||null}get value(){return this._national&&this._country?`+${v(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:U(t);if(n)this._country=n.country,this._national=n.national.replace(/[^0-9]/g,``);else if(t.startsWith(`+`)){let e=t.replace(/[^0-9]/g,``),n=String(v(this._locked||this.getAttribute(`country`)||this._country));n&&e.startsWith(n)&&(e=e.slice(n.length)),this._national=e}else this._national=t.replace(/[^0-9]/g,``);n&&this.getAttribute(`country`)!==this._country?this.setAttribute(`country`,this._country):this._rendered&&this.render(),this._committedValue=this.value,this._syncMirror()}_syncMirror(){(0,a.syncFormMirror)(this,this.value)}_syncDescribedBy(){let e=this.querySelector(`input[type=tel]`);if(!e)return;let t=[this.getAttribute(`aria-describedby`),this.querySelector(`[data-phone-error]`)?.id].filter(Boolean);t.length?e.setAttribute(`aria-describedby`,t.join(` `)):e.removeAttribute(`aria-describedby`)}_emitInput(){this.dispatchEvent(new Event(`input`,{bubbles:!0}))}_emitChange(){this._committedValue=this.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._country=this._locked||this.getAttribute(`country`)||this._country;let e=this.getAttribute(`placeholder`)||z(this._country)||O().placeholder;this.id||=`wui-phone-${Math.random().toString(36).slice(2,9)}`;let t=`${this.id}-listbox`;this._listboxId=t;let n=this._locked?`<div class="phone-country-adornment"><span class="wui-phone-prefix"><span class="${A(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${j(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
2
2
  <button type="button" class="country-toggle" aria-label="${X(O().chooseCountryLabel)}" aria-haspopup="listbox" aria-expanded="false" aria-controls="${X(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
3
3
  <span class="${A(this._country)}" data-flag aria-hidden="true"></span>
4
4
  ${(0,o.glyphSvg)(`chevron-down`,{className:`phone-chevron`})}
@@ -1 +1 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.169.1`)throw Error(`[webority-ui] popover expects ui-elements 0.169.1 but the page loaded `+i+`.`);var a=80,o=220,s=`:scope > [data-wui-popover-trigger]`,c=`:scope > [data-wui-popover-panel]`,l=`.popover-arrow`,u=`.popover-header`,d=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,f=[`click`,`hover`,`focus`],p=[`top`,`bottom`,`start`,`end`,`auto`],m=0;function h(e,t){let n=e.querySelector(t);return n instanceof HTMLElement?n:null}function g(e){return e.pointerType===`touch`||e.pointerType===`pen`}var _=class extends n.ElementBase{_open;_timer;_pressOpen;_refocusing;_awaitChildren;_onPress;_onClick;_onOver;_onOut;_onFocusIn;_onFocusOut;_onKeyDown;static get observedAttributes(){return[`open`,`trigger`,`placement`,`open-delay`,`close-delay`,`role-dialog`,`auto-focus`,`labelled-by`]}constructor(){super(),this._open=!1,this._timer=null,this._pressOpen=null,this._refocusing=!1,this._awaitChildren=null,this._onPress=e=>{this._pressOpen=this._zone(e.target)===`trigger`?this._open:null},this._onClick=e=>{if(this._zone(e.target)!==`trigger`||!this._kinds().includes(`click`))return;let t=this._pressOpen??this._open;this._pressOpen=null,this._requestOpen(!t)},this._onOver=e=>{if(g(e))return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._kinds().includes(`hover`)&&this._schedule(!0)},this._onOut=e=>{!g(e)&&this._kinds().includes(`hover`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{if(this._refocusing)return;let t=this._zone(e.target);t===`trigger`&&this._kinds().includes(`focus`)?this._requestOpen(!0):t===`panel`&&this._clear()},this._onFocusOut=e=>{this._kinds().includes(`focus`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._requestOpen(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this._open)return;e.preventDefault();let t=this._zone(this.ownerDocument.activeElement)===`panel`;this._clear(),this._requestOpen(!1),t&&!this._open&&this._trigger?.focus()}}get isOpen(){return this._open}show(){this._open||(this._applyOpen(!0),this._notify(!0,!1))}hide(){this._open&&(this._applyOpen(!1),this._notify(!1,!1))}connectedCallback(){this.addEventListener(`pointerdown`,this._onPress),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._stampTrigger(),this._openOrAwaitChildren()}attributeChangedCallback(e){e===`open`&&this._awaitChildren?this.hasAttribute(`open`)||this._disarmAwait():e===`open`&&this.isConnected&&this._openOrAwaitChildren()}disconnectedCallback(){this._disarmAwait(),this._clear(),this.removeEventListener(`pointerdown`,this._onPress),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this._open=!1;let e=this._panel;e&&(0,r.closeAnchoredPopover)(e)}get _panel(){return h(this,c)}get _trigger(){let e=h(this,s);if(e)return e;for(let e of this.children)if(e instanceof HTMLElement&&!e.hasAttribute(`data-wui-popover-panel`))return e;return null}_stampTrigger(){let e=this._trigger;e&&(e.setAttribute(`data-wui-popover-trigger`,``),(this.getAttribute(`trigger`)??`click`).split(/\s+/).includes(`click`)&&!e.hasAttribute(`aria-expanded`)&&e.setAttribute(`aria-expanded`,`false`))}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_kinds(){let e=(this.getAttribute(`trigger`)??`click`).split(/\s+/).filter(Boolean),t=[];for(let n of e){let e=f.find(e=>e===n);if(!e)throw RangeError(`<wui-popover>: trigger="${n}" is not click, hover or focus.`);t.push(e)}if(t.length===0)throw RangeError(`<wui-popover>: trigger is empty; name click, hover or focus.`);return t}_side(){let e=this.getAttribute(`placement`)??`bottom`,t=p.find(t=>t===e);if(!t)throw RangeError(`<wui-popover>: placement="${e}" is not top, bottom, start, end or auto.`);return t}_delay(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e)??``,r=Number(n);if(n.trim()===``||!Number.isFinite(r)||r<0)throw RangeError(`<wui-popover>: ${e}="${n}" is not zero or more milliseconds.`);return r}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this._open===e)return;let t=e?this._delay(`open-delay`,a):this._delay(`close-delay`,o);this._timer=setTimeout(()=>{this._timer=null,this._requestOpen(e)},t)}_requestOpen(e){e!==this._open&&(e&&this._ready(),this._notify(e,!0)&&this._applyOpen(e))}_notify(e,t){return this.dispatchEvent(new CustomEvent(`wui-popover-toggle`,{bubbles:!0,cancelable:t,detail:{open:e}}))}_mode(){return this._kinds().includes(`click`)?`auto`:`manual`}_ready(){let e=this._panel;if(!e)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to open.`);let t=this._trigger;if(!t)throw Error(`<wui-popover> has no trigger: a child element is required to open.`);return{panel:e,trigger:t,side:this._side(),mode:this._mode()}}_applyOpen(e){if(this._stampTrigger(),e===this._open)return;if(e){let{panel:e,trigger:t,side:n,mode:i}=this._ready();this._open=!0,this._name(e);try{(0,r.openAnchoredPopover)(t,e,{mode:i,side:n,align:`center`,clampHeight:!0,arrow:h(e,l),onClosed:()=>this._onNativeClose()})}catch(t){throw this._open=!1,(0,r.closeAnchoredPopover)(e),t}this.setAttribute(`open`,``),i===`manual`&&this.ownerDocument.addEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&queueMicrotask(()=>{this._open&&(0,r.isPopoverOpen)(e)&&h(e,d)?.focus()}),t.hasAttribute(`aria-expanded`)&&t.setAttribute(`aria-expanded`,`true`);return}let t=this._panel;if(!t)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to close.`);let n=this._trigger;if(!n)throw Error(`<wui-popover> has no trigger: a child element is required to close.`);this._open=!1,this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&this._mode()===`manual`&&t.contains(this.ownerDocument.activeElement)&&this._refocus(),(0,r.closeAnchoredPopover)(t),this.removeAttribute(`open`),n.hasAttribute(`aria-expanded`)&&n.setAttribute(`aria-expanded`,`false`)}_openOrAwaitChildren(){if(this.hasAttribute(`open`)&&(this._panel===null||this._trigger===null)){if(this._awaitChildren)return;this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})}else this._applyOpen(this.hasAttribute(`open`))}_finishAwaitedOpen(){this._panel!==null&&this._trigger!==null&&(this._disarmAwait(),this._applyOpen(this.hasAttribute(`open`)))}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_onNativeClose(){let e=this._panel;if(!this._open||!e||(0,r.isPopoverOpen)(e))return;let t=e.contains(this.ownerDocument.activeElement);this._applyOpen(!1),t&&this._refocus(),this._notify(!1,!1)}_refocus(){let e=this._trigger;e&&(this._refocusing=!0,e.focus(),this._refocusing=!1)}_name(e){if(!this.hasAttribute(`role-dialog`))return;e.setAttribute(`role`,`dialog`);let t=this.getAttribute(`labelled-by`);if(t){e.setAttribute(`aria-labelledby`,t);return}let n=h(e,u);n&&(n.id||=`wui-popover-title-${++m}`,e.setAttribute(`aria-labelledby`,n.id))}};(0,t.defineElement)(`wui-popover`,_),e.WuiPopover=_})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay);
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.170.0`)throw Error(`[webority-ui] popover expects ui-elements 0.170.0 but the page loaded `+i+`.`);var a=80,o=220,s=`:scope > [data-wui-popover-trigger]`,c=`:scope > [data-wui-popover-panel]`,l=`.popover-arrow`,u=`.popover-header`,d=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,f=[`click`,`hover`,`focus`],p=[`top`,`bottom`,`start`,`end`,`auto`],m=0;function h(e,t){let n=e.querySelector(t);return n instanceof HTMLElement?n:null}function g(e){return e.pointerType===`touch`||e.pointerType===`pen`}var _=class extends n.ElementBase{_open;_timer;_pressOpen;_refocusing;_awaitChildren;_onPress;_onClick;_onOver;_onOut;_onFocusIn;_onFocusOut;_onKeyDown;static get observedAttributes(){return[`open`,`trigger`,`placement`,`open-delay`,`close-delay`,`role-dialog`,`auto-focus`,`labelled-by`]}constructor(){super(),this._open=!1,this._timer=null,this._pressOpen=null,this._refocusing=!1,this._awaitChildren=null,this._onPress=e=>{this._pressOpen=this._zone(e.target)===`trigger`?this._open:null},this._onClick=e=>{if(this._zone(e.target)!==`trigger`||!this._kinds().includes(`click`))return;let t=this._pressOpen??this._open;this._pressOpen=null,this._requestOpen(!t)},this._onOver=e=>{if(g(e))return;let t=this._zone(e.target);t===`panel`?this._clear():t===`trigger`&&this._kinds().includes(`hover`)&&this._schedule(!0)},this._onOut=e=>{!g(e)&&this._kinds().includes(`hover`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._schedule(!1)},this._onFocusIn=e=>{if(this._refocusing)return;let t=this._zone(e.target);t===`trigger`&&this._kinds().includes(`focus`)?this._requestOpen(!0):t===`panel`&&this._clear()},this._onFocusOut=e=>{this._kinds().includes(`focus`)&&this._zone(e.target)&&!this._zone(e.relatedTarget)&&this._requestOpen(!1)},this._onKeyDown=e=>{if(e.key!==`Escape`||!this._open)return;e.preventDefault();let t=this._zone(this.ownerDocument.activeElement)===`panel`;this._clear(),this._requestOpen(!1),t&&!this._open&&this._trigger?.focus()}}get isOpen(){return this._open}show(){this._open||(this._applyOpen(!0),this._notify(!0,!1))}hide(){this._open&&(this._applyOpen(!1),this._notify(!1,!1))}connectedCallback(){this.addEventListener(`pointerdown`,this._onPress),this.addEventListener(`click`,this._onClick),this.addEventListener(`pointerover`,this._onOver),this.addEventListener(`pointerout`,this._onOut),this.addEventListener(`focusin`,this._onFocusIn),this.addEventListener(`focusout`,this._onFocusOut),this._stampTrigger(),this._openOrAwaitChildren()}attributeChangedCallback(e){e===`open`&&this._awaitChildren?this.hasAttribute(`open`)||this._disarmAwait():e===`open`&&this.isConnected&&this._openOrAwaitChildren()}disconnectedCallback(){this._disarmAwait(),this._clear(),this.removeEventListener(`pointerdown`,this._onPress),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`pointerover`,this._onOver),this.removeEventListener(`pointerout`,this._onOut),this.removeEventListener(`focusin`,this._onFocusIn),this.removeEventListener(`focusout`,this._onFocusOut),this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this._open=!1;let e=this._panel;e&&(0,r.closeAnchoredPopover)(e)}get _panel(){return h(this,c)}get _trigger(){let e=h(this,s);if(e)return e;for(let e of this.children)if(e instanceof HTMLElement&&!e.hasAttribute(`data-wui-popover-panel`))return e;return null}_stampTrigger(){let e=this._trigger;e&&(e.setAttribute(`data-wui-popover-trigger`,``),(this.getAttribute(`trigger`)??`click`).split(/\s+/).includes(`click`)&&!e.hasAttribute(`aria-expanded`)&&e.setAttribute(`aria-expanded`,`false`))}_zone(e){if(!(e instanceof Node)||!this.contains(e))return null;let t=e instanceof Element?e:e.parentElement;return this._panel?.contains(t)?`panel`:this._trigger?.contains(t)?`trigger`:null}_kinds(){let e=(this.getAttribute(`trigger`)??`click`).split(/\s+/).filter(Boolean),t=[];for(let n of e){let e=f.find(e=>e===n);if(!e)throw RangeError(`<wui-popover>: trigger="${n}" is not click, hover or focus.`);t.push(e)}if(t.length===0)throw RangeError(`<wui-popover>: trigger is empty; name click, hover or focus.`);return t}_side(){let e=this.getAttribute(`placement`)??`bottom`,t=p.find(t=>t===e);if(!t)throw RangeError(`<wui-popover>: placement="${e}" is not top, bottom, start, end or auto.`);return t}_delay(e,t){if(!this.hasAttribute(e))return t;let n=this.getAttribute(e)??``,r=Number(n);if(n.trim()===``||!Number.isFinite(r)||r<0)throw RangeError(`<wui-popover>: ${e}="${n}" is not zero or more milliseconds.`);return r}_clear(){this._timer!==null&&clearTimeout(this._timer),this._timer=null}_schedule(e){if(this._clear(),this._open===e)return;let t=e?this._delay(`open-delay`,a):this._delay(`close-delay`,o);this._timer=setTimeout(()=>{this._timer=null,this._requestOpen(e)},t)}_requestOpen(e){e!==this._open&&(e&&this._ready(),this._notify(e,!0)&&this._applyOpen(e))}_notify(e,t){return this.dispatchEvent(new CustomEvent(`wui-popover-toggle`,{bubbles:!0,cancelable:t,detail:{open:e}}))}_mode(){return this._kinds().includes(`click`)?`auto`:`manual`}_ready(){let e=this._panel;if(!e)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to open.`);let t=this._trigger;if(!t)throw Error(`<wui-popover> has no trigger: a child element is required to open.`);return{panel:e,trigger:t,side:this._side(),mode:this._mode()}}_applyOpen(e){if(this._stampTrigger(),e===this._open)return;if(e){let{panel:e,trigger:t,side:n,mode:i}=this._ready();this._open=!0,this._name(e);try{(0,r.openAnchoredPopover)(t,e,{mode:i,side:n,align:`center`,clampHeight:!0,arrow:h(e,l),onClosed:()=>this._onNativeClose()})}catch(t){throw this._open=!1,(0,r.closeAnchoredPopover)(e),t}this.setAttribute(`open`,``),i===`manual`&&this.ownerDocument.addEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&queueMicrotask(()=>{this._open&&(0,r.isPopoverOpen)(e)&&h(e,d)?.focus()}),t.hasAttribute(`aria-expanded`)&&t.setAttribute(`aria-expanded`,`true`);return}let t=this._panel;if(!t)throw Error(`<wui-popover> has no panel: a child with data-wui-popover-panel is required to close.`);let n=this._trigger;if(!n)throw Error(`<wui-popover> has no trigger: a child element is required to close.`);this._open=!1,this.ownerDocument.removeEventListener(`keydown`,this._onKeyDown),this.hasAttribute(`auto-focus`)&&this._mode()===`manual`&&t.contains(this.ownerDocument.activeElement)&&this._refocus(),(0,r.closeAnchoredPopover)(t),this.removeAttribute(`open`),n.hasAttribute(`aria-expanded`)&&n.setAttribute(`aria-expanded`,`false`)}_openOrAwaitChildren(){if(this.hasAttribute(`open`)&&(this._panel===null||this._trigger===null)){if(this._awaitChildren)return;this._awaitChildren=new MutationObserver(()=>this._finishAwaitedOpen()),this._awaitChildren.observe(this,{childList:!0})}else this._applyOpen(this.hasAttribute(`open`))}_finishAwaitedOpen(){this._panel!==null&&this._trigger!==null&&(this._disarmAwait(),this._applyOpen(this.hasAttribute(`open`)))}_disarmAwait(){this._awaitChildren?.disconnect(),this._awaitChildren=null}_onNativeClose(){let e=this._panel;if(!this._open||!e||(0,r.isPopoverOpen)(e))return;let t=e.contains(this.ownerDocument.activeElement);this._applyOpen(!1),t&&this._refocus(),this._notify(!1,!1)}_refocus(){let e=this._trigger;e&&(this._refocusing=!0,e.focus(),this._refocusing=!1)}_name(e){if(!this.hasAttribute(`role-dialog`))return;e.setAttribute(`role`,`dialog`);let t=this.getAttribute(`labelled-by`);if(t){e.setAttribute(`aria-labelledby`,t);return}let n=h(e,u);n&&(n.id||=`wui-popover-title-${++m}`,e.setAttribute(`aria-labelledby`,n.id))}};(0,t.defineElement)(`wui-popover`,_),e.WuiPopover=_})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.nativeOverlay);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.169.1`)throw Error(`[webority-ui] saved-views expects ui-elements 0.169.1 but the page loaded `+o+`.`);var s={cannotShareViewsMessage:`You cannot share views.`,deleteLabel:`Delete`,deleteText:`Delete {name}`,giveViewNameMessage:`Give the view a name.`,listNotFoundMessage:`That list could not be found.`,nameViewPlaceholder:`Name this view`,requestNotSupportedMessage:`That request is not supported.`,saveViewLabel:`Save this view`,shareTeamLabel:`Share with the team`,sharedLabel:`Shared`,viewNameLabel:`View name`,viewNameTooLongMessage:`The view name is too long.`,viewNotFoundMessage:`That view could not be found.`,viewNotSavedMessage:`That view could not be saved.`,viewsLabel:`Views`,viewsNotUpdatedMessage:`The views could not be updated. Try again.`},c=`wui-saved-views:`,l=20,u=0,d=()=>(0,a.readText)(`savedViews`,s),f=e=>typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`query`in e&&typeof e.query==`string`,p=class extends r.ElementBase{static get observedAttributes(){return[`key`,`mode`,`action`,`can-share`]}_doc=null;_dom=null;_views;_open;_busy;_error;_trigger;_onTriggerClick;_onKeyDown;_onPointerDown;_onSubmit;constructor(){super(),this._views=[],this._open=!1,this._busy=!1,this._error=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{this._open&&e.target instanceof Node&&this.contains(e.target)&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._trigger?.focus()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&this._ui.menu.contains(e.target)&&!(e.target instanceof Element&&/input|textarea/i.test(e.target.tagName))&&(e.preventDefault(),e.stopPropagation()))},this._onPointerDown=e=>{this._open&&!e.composedPath().includes(this)&&this._setOpen(!1)},this._onSubmit=async e=>{e.preventDefault();let t=this._ui.input.value.trim();if(!t)return;if(this._server()){if(this._busy)return;let e={name:t,query:this._ownerDoc.location.search};this._canShare()&&(e.shared=String(this._ui.share.checked)),await this._request(`save`,e)&&(this._ui.input.value=``,this._ui.share.checked=!1);return}let n=this._ownerDoc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,l)),this._ui.input.value=``}}get _ownerDoc(){if(!this._doc)throw Error(`wui-saved-views is not connected`);return this._doc}get _ui(){if(!this._dom)throw Error(`wui-saved-views is not built`);return this._dom}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),window.addEventListener(`keydown`,this._onKeyDown,!0),this._reload()}disconnectedCallback(){this._setOpen(!1),window.removeEventListener(`keydown`,this._onKeyDown,!0),this._doc=null}attributeChangedCallback(){this._doc&&this._trigger&&this._reload()}_reload(){this._server()?(this._views=[],this._render(),this._request(`list`)):(this._views=this._load(),this._render())}_server(){return this.getAttribute(`mode`)===`server`&&!!this.getAttribute(`action`)&&!!this.getAttribute(`key`)}_canShare(){return this._server()&&this.getAttribute(`can-share`)===`true`}async _request(e,t={}){let n=this.getAttribute(`action`)??``,r=this.getAttribute(`key`)??``,a=n,o;e===`list`?a+=(n.includes(`?`)?`&`:`?`)+new URLSearchParams({intent:`list`,key:r}):o={method:`POST`,body:new URLSearchParams({intent:e,key:r,...t})},this._busy=!0,this._render();let s=await(0,i.wuiFetch)(a,o);if(this._busy=!1,this._doc===null)return!1;if(s.ok){let e=new DOMParser().parseFromString(s.html,`text/html`);return this._views=[...e.querySelectorAll(`[data-wui-saved-views-items] > li`)].filter(e=>e instanceof HTMLLIElement).map(e=>({name:e.dataset.name,query:e.dataset.query,shared:e.dataset.shared===`true`})).filter(f),this._error=null,this._render(),!0}return this._error=s.message||d().viewsNotUpdatedMessage,this._render(),!1}_build(){let e=this._ownerDoc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`neutral`,`outline`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=d().viewsLabel,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick);let t=e.createElement(`div`);t.className=`dropdown-menu`;let r=e.createElement(`div`);r.className=`dropdown-divider`;let i=e.createElement(`input`);i.type=`text`,i.className=`form-control form-control-sm`,i.setAttribute(`aria-label`,d().viewNameLabel),i.placeholder=d().nameViewPlaceholder;let a=e.createElement(`button`);a.type=`submit`,a.className=(0,n.buttonClass)(`primary`,`solid`,`sm`),a.dataset.wui=n.APP_BUTTON_MARKER,a.textContent=d().saveViewLabel;let o=e.createElement(`form`);o.className=`d-flex gap-2 px-3 py-2`,o.append(i,a),o.addEventListener(`submit`,this._onSubmit);let s=e.createElement(`input`);s.type=`checkbox`,s.className=`form-check-input`,s.setAttribute(`role`,`switch`),s.id=`wui-saved-views-share-${u++}`;let c=e.createElement(`label`);c.className=`form-check-label`,c.htmlFor=s.id,c.textContent=d().shareTeamLabel;let l=e.createElement(`div`);l.className=`form-check form-switch mb-0`,l.append(s,c);let f=e.createElement(`div`);f.className=`px-3 pb-2`,f.hidden=!0,f.append(l),this._dom={menu:t,divider:r,form:o,input:i,save:a,shareRow:f,share:s},this.append(this._trigger,t)}_render(){let e=this._ownerDoc,t=this._ui,n=[];for(let t of this._views){let r=e.createElement(`a`);if(r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+t.query),r.textContent=t.name,t.shared){let t=e.createElement(`span`);t.className=`badge text-bg-secondary ms-2`,t.textContent=d().sharedLabel,r.append(t)}let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=d().deleteLabel,i.setAttribute(`aria-label`,(0,a.fillText)(d().deleteText,{name:t.name})),i.disabled=this._busy,i.addEventListener(`click`,()=>this._server()?this._request(`delete`,{name:t.name}):this._commit(this._views.filter(e=>e.name!==t.name))),n.push(r,i)}if(this._error){let t=e.createElement(`div`);t.className=`dropdown-item-text text-danger small`,t.setAttribute(`role`,`alert`),t.textContent=this._error,n.push(t)}t.save.disabled=this._busy,t.share.disabled=this._busy,t.shareRow.hidden=!this._canShare(),t.menu.replaceChildren(...n,t.divider,t.form,t.shareRow)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._ui.menu.classList.toggle(`show`,e),this._trigger?.setAttribute(`aria-expanded`,String(e)),e?this._ownerDoc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._ownerDoc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{let t=this._ownerDoc.defaultView;return t?{store:t.localStorage,key:c+e}:null}catch{return null}}_load(){let e=this._storage();if(!e)return[];try{let t=JSON.parse(e.store.getItem(e.key)??`[]`);return Array.isArray(t)?t.filter(f).slice(0,l):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}}};(0,t.defineElement)(`wui-saved-views`,p),e.WuiSavedViews=p})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.textStore);
1
+ (function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.170.0`)throw Error(`[webority-ui] saved-views expects ui-elements 0.170.0 but the page loaded `+o+`.`);var s={cannotShareViewsMessage:`You cannot share views.`,deleteLabel:`Delete`,deleteText:`Delete {name}`,giveViewNameMessage:`Give the view a name.`,listNotFoundMessage:`That list could not be found.`,nameViewPlaceholder:`Name this view`,requestNotSupportedMessage:`That request is not supported.`,saveViewLabel:`Save this view`,shareTeamLabel:`Share with the team`,sharedLabel:`Shared`,viewNameLabel:`View name`,viewNameTooLongMessage:`The view name is too long.`,viewNotFoundMessage:`That view could not be found.`,viewNotSavedMessage:`That view could not be saved.`,viewsLabel:`Views`,viewsNotUpdatedMessage:`The views could not be updated. Try again.`},c=`wui-saved-views:`,l=20,u=0,d=()=>(0,a.readText)(`savedViews`,s),f=e=>typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`query`in e&&typeof e.query==`string`,p=class extends r.ElementBase{static get observedAttributes(){return[`key`,`mode`,`action`,`can-share`]}_doc=null;_dom=null;_views;_open;_busy;_error;_trigger;_onTriggerClick;_onKeyDown;_onPointerDown;_onSubmit;constructor(){super(),this._views=[],this._open=!1,this._busy=!1,this._error=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{this._open&&e.target instanceof Node&&this.contains(e.target)&&(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),this._setOpen(!1),this._trigger?.focus()):(e.key===`ArrowDown`||e.key===`ArrowUp`)&&this._ui.menu.contains(e.target)&&!(e.target instanceof Element&&/input|textarea/i.test(e.target.tagName))&&(e.preventDefault(),e.stopPropagation()))},this._onPointerDown=e=>{this._open&&!e.composedPath().includes(this)&&this._setOpen(!1)},this._onSubmit=async e=>{e.preventDefault();let t=this._ui.input.value.trim();if(!t)return;if(this._server()){if(this._busy)return;let e={name:t,query:this._ownerDoc.location.search};this._canShare()&&(e.shared=String(this._ui.share.checked)),await this._request(`save`,e)&&(this._ui.input.value=``,this._ui.share.checked=!1);return}let n=this._ownerDoc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,l)),this._ui.input.value=``}}get _ownerDoc(){if(!this._doc)throw Error(`wui-saved-views is not connected`);return this._doc}get _ui(){if(!this._dom)throw Error(`wui-saved-views is not built`);return this._dom}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),window.addEventListener(`keydown`,this._onKeyDown,!0),this._reload()}disconnectedCallback(){this._setOpen(!1),window.removeEventListener(`keydown`,this._onKeyDown,!0),this._doc=null}attributeChangedCallback(){this._doc&&this._trigger&&this._reload()}_reload(){this._server()?(this._views=[],this._render(),this._request(`list`)):(this._views=this._load(),this._render())}_server(){return this.getAttribute(`mode`)===`server`&&!!this.getAttribute(`action`)&&!!this.getAttribute(`key`)}_canShare(){return this._server()&&this.getAttribute(`can-share`)===`true`}async _request(e,t={}){let n=this.getAttribute(`action`)??``,r=this.getAttribute(`key`)??``,a=n,o;e===`list`?a+=(n.includes(`?`)?`&`:`?`)+new URLSearchParams({intent:`list`,key:r}):o={method:`POST`,body:new URLSearchParams({intent:e,key:r,...t})},this._busy=!0,this._render();let s=await(0,i.wuiFetch)(a,o);if(this._busy=!1,this._doc===null)return!1;if(s.ok){let e=new DOMParser().parseFromString(s.html,`text/html`);return this._views=[...e.querySelectorAll(`[data-wui-saved-views-items] > li`)].filter(e=>e instanceof HTMLLIElement).map(e=>({name:e.dataset.name,query:e.dataset.query,shared:e.dataset.shared===`true`})).filter(f),this._error=null,this._render(),!0}return this._error=s.message||d().viewsNotUpdatedMessage,this._render(),!1}_build(){let e=this._ownerDoc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`neutral`,`outline`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=d().viewsLabel,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick);let t=e.createElement(`div`);t.className=`dropdown-menu`;let r=e.createElement(`div`);r.className=`dropdown-divider`;let i=e.createElement(`input`);i.type=`text`,i.className=`form-control form-control-sm`,i.setAttribute(`aria-label`,d().viewNameLabel),i.placeholder=d().nameViewPlaceholder;let a=e.createElement(`button`);a.type=`submit`,a.className=(0,n.buttonClass)(`primary`,`solid`,`sm`),a.dataset.wui=n.APP_BUTTON_MARKER,a.textContent=d().saveViewLabel;let o=e.createElement(`form`);o.className=`d-flex gap-2 px-3 py-2`,o.append(i,a),o.addEventListener(`submit`,this._onSubmit);let s=e.createElement(`input`);s.type=`checkbox`,s.className=`form-check-input`,s.setAttribute(`role`,`switch`),s.id=`wui-saved-views-share-${u++}`;let c=e.createElement(`label`);c.className=`form-check-label`,c.htmlFor=s.id,c.textContent=d().shareTeamLabel;let l=e.createElement(`div`);l.className=`form-check form-switch mb-0`,l.append(s,c);let f=e.createElement(`div`);f.className=`px-3 pb-2`,f.hidden=!0,f.append(l),this._dom={menu:t,divider:r,form:o,input:i,save:a,shareRow:f,share:s},this.append(this._trigger,t)}_render(){let e=this._ownerDoc,t=this._ui,n=[];for(let t of this._views){let r=e.createElement(`a`);if(r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+t.query),r.textContent=t.name,t.shared){let t=e.createElement(`span`);t.className=`badge text-bg-secondary ms-2`,t.textContent=d().sharedLabel,r.append(t)}let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=d().deleteLabel,i.setAttribute(`aria-label`,(0,a.fillText)(d().deleteText,{name:t.name})),i.disabled=this._busy,i.addEventListener(`click`,()=>this._server()?this._request(`delete`,{name:t.name}):this._commit(this._views.filter(e=>e.name!==t.name))),n.push(r,i)}if(this._error){let t=e.createElement(`div`);t.className=`dropdown-item-text text-danger small`,t.setAttribute(`role`,`alert`),t.textContent=this._error,n.push(t)}t.save.disabled=this._busy,t.share.disabled=this._busy,t.shareRow.hidden=!this._canShare(),t.menu.replaceChildren(...n,t.divider,t.form,t.shareRow)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._ui.menu.classList.toggle(`show`,e),this._trigger?.setAttribute(`aria-expanded`,String(e)),e?this._ownerDoc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._ownerDoc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{let t=this._ownerDoc.defaultView;return t?{store:t.localStorage,key:c+e}:null}catch{return null}}_load(){let e=this._storage();if(!e)return[];try{let t=JSON.parse(e.store.getItem(e.key)??`[]`);return Array.isArray(t)?t.filter(f).slice(0,l):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}}};(0,t.defineElement)(`wui-saved-views`,p),e.WuiSavedViews=p})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp,WeborityUiElementsInternal.modules.textStore);
@@ -1,2 +1,2 @@
1
- (function(e,t,n,r,i,a,o,s,c,l){var u=Object.defineProperty,d=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},f=globalThis.WeborityUiElementsInternal?.version;if(f!==`0.169.1`)throw Error(`[webority-ui] select-chips expects ui-elements 0.169.1 but the page loaded `+f+`.`);var p={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},m={enter:`
1
+ (function(e,t,n,r,i,a,o,s,c,l){var u=Object.defineProperty,d=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},f=globalThis.WeborityUiElementsInternal?.version;if(f!==`0.170.0`)throw Error(`[webority-ui] select-chips expects ui-elements 0.170.0 but the page loaded `+f+`.`);var p={enter:`Enter`,comma:`,`,space:` `,tab:`Tab`},m={enter:`
2
2
  `,comma:`,`,space:` `,tab:` `},ee=e=>p[e],te=e=>m[e];function h(e,t){let n=[String(e??``)];for(let e of t)n=n.flatMap(t=>t.split(e));return n.map(e=>e.trim()).filter(Boolean)}var g=(e,t)=>t.some(t=>String(e??``).includes(t)),_={invalidMessage:`Enter a valid value.`},v=new Map,y=e=>{if(v.has(e))return v.get(e)??null;let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{(0,s.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return v.set(e,t),t},ne=(e,t)=>{let n=e.getAttribute(`invalid-message`)||(0,a.readText)(`customRule`,_).invalidMessage,r=e.getAttribute(`pattern`);if(r){let e=y(r);if(e&&!e.test(t))return n}let i=e.validate;if(typeof i!=`function`)return``;let o=i(t);return o===!0?``:typeof o==`string`&&o?o:n},b=d({default:()=>T}),x=()=>(0,a.readText)(`select`,o.SELECT_TEXT),S=new WeakMap;function C(e,t){if(e===null)throw TypeError(`The chip row needs ${t}, and it is not mounted.`);return e}var w=(e,t)=>{let n=document.createElement(e);return n.className=t,n};function T(){let o,s,l=null,u=null,d=null,f=null,p=null,m=null,_=null,v=!1,y=()=>C(u,`the draft input`),b=()=>o.mode===`tag`,T=()=>Array.isArray(o.value)?o.value.slice():[],E=()=>(o.getAttribute(`separators`)||`enter,comma`).split(`,`).map(e=>e.trim()).filter(Boolean),D=()=>new Set(E().map(ee).filter(Boolean)),O=()=>{let e=parseInt(o.getAttribute(`max-tags`)??``,10)||0;return Math.max(e,0)},k=()=>{let e=O();return e>0&&T().length>=e},A=(e,t)=>!o.hasAttribute(`allow-duplicates`)&&e.some(e=>e.toLowerCase()===t.toLowerCase()),j=()=>{let e=S.get(o);return e||(e=new Map,S.set(o,e)),e},M=e=>(o.options||[]).find(t=>String(t.value)===String(e))??j().get(String(e)),re=e=>{let t=j();for(let n of o.options||[])e.includes(String(n.value))&&t.set(String(n.value),n);for(let n of t.keys())e.includes(n)||t.delete(n)},N=e=>{let t=e.trim().toLowerCase();return(o.options||[]).find(e=>String(e.value??``).toLowerCase()===t||(0,i.optionText)(e).trim().toLowerCase()===t)},P=e=>{for(let t of E()){let n=te(t)??t;if(g(e,[n]))return h(e,[n])}return[e.trim()]},F=()=>u?u.value:o._query||``,ie=()=>b()||o.hasAttribute(`allow-custom`),ae=()=>o.getAttribute(`placeholder`)||(b()?x().tagPlaceholder:x().placeholder),oe=()=>{let e=o.getAttribute(`aria-label`);if(e)return e;let t=o.closest(`label`)?.textContent?.trim();if(t)return t;let n=o.id;return(n?[...document.querySelectorAll(`label[for]`)].find(e=>e instanceof HTMLLabelElement&&e.htmlFor===n):void 0)?.textContent?.trim()||(b()?x().addTagsLabel:x().fallbackName)},I=()=>{u&&(u.setAttribute(`aria-expanded`,String((0,r.isPopoverOpen)(s.menu))),s.list.id&&u.setAttribute(`aria-controls`,s.list.id),u.setAttribute(`aria-label`,oe()))},se=()=>!(0,e.isReadOnly)(o)&&!o.hasAttribute(`loading`),ce=e=>{v=!0,y().setAttribute(`aria-invalid`,`true`),o.setError(e)},L=()=>{v&&(v=!1,y().removeAttribute(`aria-invalid`),o.setError(null))},R=(e,{quiet:t=!1,strip:n=!1}={})=>{let r=T(),i=r.slice(),a=O(),s=[],c=``,l=!1;for(let t of e){let e=(n?t.trim().replace(/,+$/,``):t).trim();if(!e)continue;if(a&&i.length>=a)break;let r=N(e);if(r){if(r.disabled){s.push(e),c||=r.disabledHint||o.getAttribute(`invalid-message`)||x().invalidMessage;continue}A(i,String(r.value))||i.push(String(r.value));continue}let u=ne(o,e);u?(s.push(e),c||=u):A(i,e)||(i.push(e),l=!0)}i.length!==r.length&&(l?o.commit(i,{isCustom:!0}):o.commit(i)),y().value=s.join(`, `),c?t||ce(c):L()},z=t=>{(0,e.isInert)(o)||R([y().value],t)},B=e=>o.commit(T().filter(t=>t!==e)),V=()=>{let e=w(`span`,`wui-select-placeholder`);return e.textContent=o.getAttribute(`placeholder`)||x().placeholder,e},H=e=>{let n=M(e),r=w(`span`,`chip chip-sm`),o=w(`span`,`chip-label`);if(o.innerHTML=n?(0,i.optionLabelHtml)(n):(0,i.escapeHtml)(e),r.append(o),se()){let o=w(`button`,`chip-remove`);o.type=`button`,o.dataset.remove=e;let s=n?(0,i.optionText)(n):(0,i.stripTags)(e);o.setAttribute(`aria-label`,(0,a.fillText)(x().removeText,{text:s})),o.innerHTML=(0,t.glyphSvg)(`x`),r.append(o)}return r};function U(){if(!l)return;l.querySelector(`:scope > .chip-more`)?.remove();let e=[...l.querySelectorAll(`:scope > .chip`)].map(e=>{if(!(e instanceof HTMLElement))throw Error(`The chip row holds a node that is not an element.`);return e});for(let t of e)t.style.display=``;let t=e.at(-1);if(!o.hasAttribute(`collapse-chips`)||!t)return;let n=l.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t)<=n)return;let i=w(`span`,`chip chip-sm chip-more`);i.textContent=`+${e.length}`,t.after(i);let a=i.offsetWidth+6,s=0;for(let t of e)if(r(t)<=n-a)s+=1;else break;s<1&&(s=1);for(let t of e.slice(s))t.style.display=`none`;i.textContent=`+${e.length-s}`}function W(){if(!l)return!1;l.parentNode!==s.value&&s.value.append(l);for(let e of l.querySelectorAll(`:scope > .chip, :scope > .wui-select-placeholder`))e.remove();let t=T();re(t);let n=l,r=e=>{u?n.insertBefore(e,u):n.append(e)};b()||u||t.length||r(V());for(let e of t)r(H(e));return u&&(u.placeholder=b()||!t.length?ae():``,u.disabled=o.hasAttribute(`disabled`),u.readOnly=(0,e.isInert)(o),I()),b()||(C(f,`the footer text`).textContent=(()=>{let e=o.getAttribute(`selected-text`);return e?e.replace(`{n}`,()=>String(t.length)):(0,a.fillText)(x().selectedText,{count:t.length})})(),C(p,`the clear-all button`).textContent=o.getAttribute(`clear-all-label`)||x().clearAllLabel),U(),!0}function le(e){if(e.key===`Backspace`){let t=u?!F():!F()&&(0,r.isPopoverOpen)(s.menu),n=T().at(-1);return!t||n===void 0?!1:(e.preventDefault(),B(n),!0)}if(!u)return!1;let t=u.value;if(e.key===`Escape`){if(!b())return!1;let n=(0,r.isPopoverOpen)(s.menu);return!n&&!t?!1:(e.preventDefault(),n&&e.stopPropagation(),u.value=``,L(),o.closeMenu({focusControl:!1}),!0)}let i=!b()&&!t.trim(),a=D();return(0,n.isImeSafeEnter)(e)&&a.has(`Enter`)?i||s.list.querySelector(`.is-active`)?!1:(e.preventDefault(),z(),!0):e.key===`,`&&a.has(`,`)?!i&&(e.preventDefault(),z({strip:!0}),!0):e.key===` `&&a.has(` `)&&t.trim()||e.key===`Tab`&&a.has(`Tab`)&&!i?(e.preventDefault(),z(),!0):!1}function ue(e){let t=String(e.value);if(b()||u&&!M(t))return R([t]),!0;let n=T();return n.includes(t)?o.commit(n.filter(e=>e!==t)):u?R([t]):o.commit([...n,t]),u?.value&&(u.value=``,L()),!0}function G(e){if(!u)return null;let t=String(e??``).trim().replace(/,+$/,``).trim();if(!t||k()||N(t)||A(T(),t))return null;let n=o.getAttribute(`create-label`)||x().createLabel;return{position:b()?`top`:`bottom`,label:n.replace(`{text}`,()=>t),value:t}}function K(t){let n=t.target,r=n instanceof Element?n.closest(`[data-remove]`):null;if(r instanceof HTMLElement){if((0,e.isInert)(o))return;t.stopPropagation(),B(r.dataset.remove??``),u?.focus()}else u&&!(0,e.isInert)(o)&&u.focus()}function q(){L();let e=y().value.trim();b()||!e||(0,r.isPopoverOpen)(s.menu)||(G(e)||(0,c.filterOptions)(o.options||[],e).length)&&o.openMenu()}function J(t){t.preventDefault(),(0,e.isInert)(o)||R(P(t.clipboardData?.getData(`text/plain`)??``))}function Y(){y().value.trim()&&z({quiet:!0,strip:!0}),o.closeMenu({focusControl:!1})}function X(e){e.relatedTarget instanceof Node&&o.contains(e.relatedTarget)||Y()}function de(){return u?(Y(),!0):!1}function Z(){y().value.trim()&&z({strip:!0})}function Q(){(0,e.isInert)(o)||o.commit([])}function $(e){e.target!==u&&e.preventDefault()}function fe(e,t,n={}){o=e,s=t,l=w(`div`,`wui-select-chips`),l.addEventListener(`click`,K),s.value.append(l),ie()&&(u=w(`input`,`wui-select-draft`),u.type=`text`,u.setAttribute(`autocomplete`,`off`),u.setAttribute(`role`,`combobox`),u.setAttribute(`aria-autocomplete`,`list`),o.hasAttribute(`required`)&&u.setAttribute(`aria-required`,`true`),s.menu.addEventListener(`toggle`,I),l.append(u),u.value=n.carry?.draft??``,s.input=u,u.addEventListener(`input`,q),u.addEventListener(`paste`,J),u.addEventListener(`blur`,X),l.addEventListener(`mousedown`,$),m=o.closest(`form`),m?.addEventListener(`submit`,Z,!0)),b()||(d=w(`div`,`wui-select-footer`),f=document.createElement(`span`),p=w(`button`,`wui-select-clear-all`),p.type=`button`,p.addEventListener(`click`,Q),d.append(f,p),s.menu.append(d)),typeof ResizeObserver<`u`&&(_=new ResizeObserver(U),_.observe(l)),W()}function pe(){l?.removeEventListener(`click`,K),l?.removeEventListener(`mousedown`,$),u&&(u.removeEventListener(`input`,q),u.removeEventListener(`paste`,J),u.removeEventListener(`blur`,X),s.input=null),p&&p.removeEventListener(`click`,Q),m?.removeEventListener(`submit`,Z,!0),m=null,_?.disconnect(),_=null,s.menu.removeEventListener(`toggle`,I),d?.remove(),l?.remove(),l=null,u=null,d=null,v=!1}return{mount:fe,onKey:le,onPick:ue,renderValue:W,actionRow:G,onQuery:()=>!1,onBlur:de,teardown:pe}}(0,l.registerSelectPart)(`chips`,b)})(WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.imeSafeEnter,WeborityUiElementsInternal.modules.nativeOverlay,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.selectText,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.selectList,WeborityUiElementsInternal.modules.partRegistry);
@@ -1 +1 @@
1
- (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t||i(n,Symbol.toStringTag,{value:`Module`}),n},o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.169.1`)throw Error(`[webority-ui] select-recents expects ui-elements 0.169.1 but the page loaded `+o+`.`);var s=a({default:()=>d}),c=()=>(0,n.readText)(`select`,r.SELECT_TEXT),l=5,u=20;function d(){let e,n=null,r=()=>e.getAttribute(`recents-key`)??``,i=()=>e.mode!==`tag`&&r()!==``,a=(e,r)=>{e!==n&&(n=e,(0,t.devWarn)(`<wui-select> recents-limit "${e}" ${r}.`))},o=()=>{let t=e.getAttribute(`recents-limit`);if(t===null)return l;let n=Number(t);return!Number.isInteger(n)||n<1?(a(t,`is not a whole number from 1 to 20; 5 is used`),l):n>u?(a(t,`is over 20; 20 is used`),u):n},s=()=>{let e;try{e=JSON.parse(globalThis.localStorage?.getItem(r())??`[]`)}catch{return[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]},d=e=>{try{globalThis.localStorage?.setItem(r(),JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}};return{mount(n){e=n,e.mode===`tag`?(0,t.devWarn)(`<wui-select> recents-key is not used in mode "tag"; it is ignored.`):r()===``&&(0,t.devWarn)(`<wui-select> recents-key is empty; no recents are kept.`)},onPick(t,n){if(!i()||n?.isCustom)return!1;let r=String(t.value);return r===``||Array.isArray(e.value)&&e.value.includes(r)||d([r,...s().filter(e=>e!==r)].slice(0,o())),!1},recents(t){if(!i())return null;let n=o(),r=[];for(let e of s()){let i=t.find(t=>String(t.value)===e);if(i&&!i.disabled&&r.push(i),r.length===n)break}return r.length?{label:e.getAttribute(`recents-label`)||c().recentsLabel,options:r}:null},teardown(){}}}(0,e.registerSelectPart)(`recents`,s)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.selectText);
1
+ (function(e,t,n,r){var i=Object.defineProperty,a=(e,t)=>{let n={};for(var r in e)i(n,r,{get:e[r],enumerable:!0});return t||i(n,Symbol.toStringTag,{value:`Module`}),n},o=globalThis.WeborityUiElementsInternal?.version;if(o!==`0.170.0`)throw Error(`[webority-ui] select-recents expects ui-elements 0.170.0 but the page loaded `+o+`.`);var s=a({default:()=>d}),c=()=>(0,n.readText)(`select`,r.SELECT_TEXT),l=5,u=20;function d(){let e,n=null,r=()=>e.getAttribute(`recents-key`)??``,i=()=>e.mode!==`tag`&&r()!==``,a=(e,r)=>{e!==n&&(n=e,(0,t.devWarn)(`<wui-select> recents-limit "${e}" ${r}.`))},o=()=>{let t=e.getAttribute(`recents-limit`);if(t===null)return l;let n=Number(t);return!Number.isInteger(n)||n<1?(a(t,`is not a whole number from 1 to 20; 5 is used`),l):n>u?(a(t,`is over 20; 20 is used`),u):n},s=()=>{let e;try{e=JSON.parse(globalThis.localStorage?.getItem(r())??`[]`)}catch{return[]}return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]},d=e=>{try{globalThis.localStorage?.setItem(r(),JSON.stringify(e))}catch(e){if(!(e instanceof DOMException))throw e}};return{mount(n){e=n,e.mode===`tag`?(0,t.devWarn)(`<wui-select> recents-key is not used in mode "tag"; it is ignored.`):r()===``&&(0,t.devWarn)(`<wui-select> recents-key is empty; no recents are kept.`)},onPick(t,n){if(!i()||n?.isCustom)return!1;let r=String(t.value);return r===``||Array.isArray(e.value)&&e.value.includes(r)||d([r,...s().filter(e=>e!==r)].slice(0,o())),!1},recents(t){if(!i())return null;let n=o(),r=[];for(let e of s()){let i=t.find(t=>String(t.value)===e);if(i&&!i.disabled&&r.push(i),r.length===n)break}return r.length?{label:e.getAttribute(`recents-label`)||c().recentsLabel,options:r}:null},teardown(){}}}(0,e.registerSelectPart)(`recents`,s)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.selectText);
@@ -1 +1 @@
1
- (function(e,t,n,r,i,a){var o=Object.defineProperty,s=(e,t)=>{let n={};for(var r in e)o(n,r,{get:e[r],enumerable:!0});return t||o(n,Symbol.toStringTag,{value:`Module`}),n},c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.169.1`)throw Error(`[webority-ui] select-search expects ui-elements 0.169.1 but the page loaded `+c+`.`);var l={invalidMessage:`Enter a valid value.`},u=new Map,d=e=>{if(u.has(e))return u.get(e)??null;let n=null;try{n=RegExp(`^(?:${e})$`,`u`)}catch{(0,t.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return u.set(e,n),n},f=(e,t)=>{let n=e.getAttribute(`invalid-message`)||(0,r.readText)(`customRule`,l).invalidMessage,i=e.getAttribute(`pattern`);if(i){let e=d(i);if(e&&!e.test(t))return n}let a=e.validate;if(typeof a!=`function`)return``;let o=a(t);return o===!0?``:typeof o==`string`&&o?o:n},p=s({default:()=>_}),m=()=>(0,r.readText)(`select`,i.SELECT_TEXT),h=(e,t)=>{let r=t.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>(0,n.optionText)(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)},g=e=>{if(e.querySelector(`.wui-select-spacer`))return null;let t=[...e.querySelectorAll(`.wui-select-option`)].filter(e=>e.dataset.custom!==`true`&&e.getAttribute(`aria-disabled`)!==`true`);return t.length===1?t[0]?.dataset.value??null:null};function _(){let e,n,r=0,i,o=null,s=null,c=``,l=null,u=!1,d=()=>(0,a.searchesRemotely)(e),p=()=>typeof e.loadOptions!=`function`&&!e.getAttribute(`source`),_=(t,n,r)=>{let i=e.getAttribute(t);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},v=()=>_(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),y=()=>_(`debounce`,250,e=>Number.isFinite(e)&&e>=0),b=()=>{o?.abort(),o=null};function x(t,n){if(typeof e.loadOptions==`function`)return e.loadOptions(t,{signal:n});let r=e.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function S(n,r,i){r?((0,t.devWarn)(`wui-select: search failed`,i),e.setPartOptions([]),e.setStatus(`empty`)):(e.setPartOptions(n),e.setStatus(n.length?`idle`:`empty`))}async function C(e,t,n){let i=[],a=!1,s=null;try{if(i=await x(e,n),!Array.isArray(i))throw TypeError(`search results must be an array`)}catch(e){a=!0,s=e??Error(`search failed`)}finally{t===r&&(o=null,S(i,a,s))}}function w(t){let n=r;b(),p()?(u=!0,e.setStatus(`loading`)):(o=new AbortController,e.setStatus(`loading`),C(t,n,o.signal))}let T=(t,n)=>e.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t,seq:n}}));function E(t){r+=1,b(),clearTimeout(i),i=void 0,t.trim().length<v()?(e.setPartOptions([]),e.setStatus(`hint`)):(T(t,r),w(t))}return{mount(t,r,i={}){e=t,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&e._onQueryChange(a)},onQuery(t){if(r+=1,b(),clearTimeout(i),i=void 0,c=t,l=null,u=!1,!d())return!1;if(t.trim().length<v())return e.setPartOptions([]),e.setStatus(`hint`),!0;let n=r;return i=setTimeout(()=>{i=void 0,T(t,n),w(t)},y()),!0},onOpen(){if(d()){if(l!==null){let e=l;l=null,E(e)}else v()===0&&e._query.trim()===``&&E(``)}},onOptions(){u&&(u=!1,e.setStatus(e.options.length?`idle`:`empty`))},onBlur(){if(e.mode!==`search`)return!1;let t=(n.search?.value??``).trim();if(!t||t===String(e.value))return!1;if(e.hasAttribute(`allow-custom`)&&!h(e,t)){let n=f(e,t);return n?(e.setError(n),!1):(e.commit(t,{isCustom:!0}),!0)}let r=g(n.list);return r===null||r===String(e.value)?!1:(e.commit(r,{isCustom:!1}),e.closeMenu(),!0)},actionRow(t){if(s=null,e.mode!==`search`||!e.hasAttribute(`allow-custom`))return null;let n=t.trim();return!n||h(e,n)?null:(s={position:`bottom`,label:(e.getAttribute(`add-label`)??m().addLabel).replaceAll(`{query}`,n),value:n},s)},onPick(t){if(!s||t.value!==s.value||t.label!==s.label)return!1;let n=s.value;return s=null,e.commit(n,{isCustom:!0}),!0},renderValue(){let t=e.value;if(e.mode!==`search`||!t||e.options.some(e=>String(e.value)===String(t)))return!1;let r=e.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(i!==void 0||o!==null||u)&&(l=c),u=!1,r+=1,clearTimeout(i),i=void 0,b(),s=null}}}(0,e.registerSelectPart)(`search`,p)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.selectText,WeborityUiElementsInternal.modules.selectRemote);
1
+ (function(e,t,n,r,i,a){var o=Object.defineProperty,s=(e,t)=>{let n={};for(var r in e)o(n,r,{get:e[r],enumerable:!0});return t||o(n,Symbol.toStringTag,{value:`Module`}),n},c=globalThis.WeborityUiElementsInternal?.version;if(c!==`0.170.0`)throw Error(`[webority-ui] select-search expects ui-elements 0.170.0 but the page loaded `+c+`.`);var l={invalidMessage:`Enter a valid value.`},u=new Map,d=e=>{if(u.has(e))return u.get(e)??null;let n=null;try{n=RegExp(`^(?:${e})$`,`u`)}catch{(0,t.devWarn)(`<wui-select> pattern is not a valid regular expression and is ignored: ${e}`)}return u.set(e,n),n},f=(e,t)=>{let n=e.getAttribute(`invalid-message`)||(0,r.readText)(`customRule`,l).invalidMessage,i=e.getAttribute(`pattern`);if(i){let e=d(i);if(e&&!e.test(t))return n}let a=e.validate;if(typeof a!=`function`)return``;let o=a(t);return o===!0?``:typeof o==`string`&&o?o:n},p=s({default:()=>_}),m=()=>(0,r.readText)(`select`,i.SELECT_TEXT),h=(e,t)=>{let r=t.toLowerCase(),i=e.getAttribute(`value-label`);return i&&String(e.value??``)!==``&&i.toLowerCase()===r?!0:e.options.some(e=>(0,n.optionText)(e).toLowerCase()===r||String(e.value??``).toLowerCase()===r)},g=e=>{if(e.querySelector(`.wui-select-spacer`))return null;let t=[...e.querySelectorAll(`.wui-select-option`)].filter(e=>e.dataset.custom!==`true`&&e.getAttribute(`aria-disabled`)!==`true`);return t.length===1?t[0]?.dataset.value??null:null};function _(){let e,n,r=0,i,o=null,s=null,c=``,l=null,u=!1,d=()=>(0,a.searchesRemotely)(e),p=()=>typeof e.loadOptions!=`function`&&!e.getAttribute(`source`),_=(t,n,r)=>{let i=e.getAttribute(t);if(i==null||i.trim()===``)return n;let a=Number(i);return r(a)?a:n},v=()=>_(`min-chars`,1,e=>Number.isInteger(e)&&e>=0),y=()=>_(`debounce`,250,e=>Number.isFinite(e)&&e>=0),b=()=>{o?.abort(),o=null};function x(t,n){if(typeof e.loadOptions==`function`)return e.loadOptions(t,{signal:n});let r=e.getAttribute(`source`);if(r===null)throw Error(`search source attribute missing`);let i=`${r}${r.includes(`?`)?`&`:`?`}q=${encodeURIComponent(t)}`;return fetch(i,{signal:n,credentials:`same-origin`,headers:{Accept:`application/json`}}).then(e=>{if(!e.ok)throw Error(`search request failed with status ${e.status}`);return e.json()})}function S(n,r,i){r?((0,t.devWarn)(`wui-select: search failed`,i),e.setPartOptions([]),e.setStatus(`empty`)):(e.setPartOptions(n),e.setStatus(n.length?`idle`:`empty`))}async function C(e,t,n){let i=[],a=!1,s=null;try{if(i=await x(e,n),!Array.isArray(i))throw TypeError(`search results must be an array`)}catch(e){a=!0,s=e??Error(`search failed`)}finally{t===r&&(o=null,S(i,a,s))}}function w(t){let n=r;b(),p()?(u=!0,e.setStatus(`loading`)):(o=new AbortController,e.setStatus(`loading`),C(t,n,o.signal))}let T=(t,n)=>e.dispatchEvent(new CustomEvent(`search`,{bubbles:!0,detail:{query:t,seq:n}}));function E(t){r+=1,b(),clearTimeout(i),i=void 0,t.trim().length<v()?(e.setPartOptions([]),e.setStatus(`hint`)):(T(t,r),w(t))}return{mount(t,r,i={}){e=t,n=r;let a=n.search?.value??``;n.search&&i.carry?.query&&a===``&&(n.search.value=i.carry.query),a.trim()!==``&&e._onQueryChange(a)},onQuery(t){if(r+=1,b(),clearTimeout(i),i=void 0,c=t,l=null,u=!1,!d())return!1;if(t.trim().length<v())return e.setPartOptions([]),e.setStatus(`hint`),!0;let n=r;return i=setTimeout(()=>{i=void 0,T(t,n),w(t)},y()),!0},onOpen(){if(d()){if(l!==null){let e=l;l=null,E(e)}else v()===0&&e._query.trim()===``&&E(``)}},onOptions(){u&&(u=!1,e.setStatus(e.options.length?`idle`:`empty`))},onBlur(){if(e.mode!==`search`)return!1;let t=(n.search?.value??``).trim();if(!t||t===String(e.value))return!1;if(e.hasAttribute(`allow-custom`)&&!h(e,t)){let n=f(e,t);return n?(e.setError(n),!1):(e.commit(t,{isCustom:!0}),!0)}let r=g(n.list);return r===null||r===String(e.value)?!1:(e.commit(r,{isCustom:!1}),e.closeMenu(),!0)},actionRow(t){if(s=null,e.mode!==`search`||!e.hasAttribute(`allow-custom`))return null;let n=t.trim();return!n||h(e,n)?null:(s={position:`bottom`,label:(e.getAttribute(`add-label`)??m().addLabel).replaceAll(`{query}`,n),value:n},s)},onPick(t){if(!s||t.value!==s.value||t.label!==s.label)return!1;let n=s.value;return s=null,e.commit(n,{isCustom:!0}),!0},renderValue(){let t=e.value;if(e.mode!==`search`||!t||e.options.some(e=>String(e.value)===String(t)))return!1;let r=e.getAttribute(`value-label`);return r?(n.value.classList.remove(`wui-select-placeholder`),n.value.textContent=r,!0):!1},teardown(){(i!==void 0||o!==null||u)&&(l=c),u=!1,r+=1,clearTimeout(i),i=void 0,b(),s=null}}}(0,e.registerSelectPart)(`search`,p)})(WeborityUiElementsInternal.modules.partRegistry,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.textStore,WeborityUiElementsInternal.modules.selectText,WeborityUiElementsInternal.modules.selectRemote);