@webority/ui-elements 0.128.0 → 0.129.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 (131) hide show
  1. package/README.md +4 -0
  2. package/dist/WuiAutocomplete-Q6lFj3yx.js +13 -0
  3. package/dist/{WuiCodeBlock-DafK2Kgc.js → WuiCodeBlock-Cdz6meSs.js} +1 -1
  4. package/dist/{WuiCommandPalette-CiEj7qnn.js → WuiCommandPalette-DS7VtDSy.js} +1 -1
  5. package/dist/{WuiCommentThread-2U3rwoH1.js → WuiCommentThread-0GshmzBj.js} +1 -1
  6. package/dist/{WuiCountrySelect-kgShmlip.js → WuiCountrySelect-RBhlw3vb.js} +1 -1
  7. package/dist/{WuiDataTable-BICQ8DT7.js → WuiDataTable-BVagEWAU.js} +1 -1
  8. package/dist/WuiDatePicker-DR6ZIW_8.js +31 -0
  9. package/dist/WuiDateRange-BgI9zi3w.js +25 -0
  10. package/dist/{WuiInlineEdit-DtSFAmEv.js → WuiInlineEdit-C6E6bGpU.js} +1 -1
  11. package/dist/WuiLeadPopup-CWv93qlo.js +306 -0
  12. package/dist/{WuiLightbox-D_7mpvkt.js → WuiLightbox-zFBcRDsq.js} +1 -1
  13. package/dist/WuiMarkdown-DNVK_5BI.js +4 -0
  14. package/dist/WuiMentionInput-DhJ180iU.js +1 -0
  15. package/dist/WuiMultiSelect-DwOzpXFZ.js +25 -0
  16. package/dist/{WuiNotificationCenter-BWL56BPm.js → WuiNotificationCenter-Br_cd0C_.js} +1 -1
  17. package/dist/WuiOtp-BqWijfNj.js +14 -0
  18. package/dist/WuiPhone-Bb9OF7-U.js +16 -0
  19. package/dist/{WuiRelativeTime-9u8XG-nr.js → WuiRelativeTime-CcbKgVjE.js} +1 -1
  20. package/dist/{WuiRollingNumber-C72xBgyG.js → WuiRollingNumber-D7uHyeQB.js} +1 -1
  21. package/dist/WuiSavedViews-B5DNBGpt.js +1 -0
  22. package/dist/WuiSelect-Czp_9FoM.js +15 -0
  23. package/dist/WuiSlider-2kB__6zU.js +51 -0
  24. package/dist/WuiTagInput-Dpfz3DQQ.js +6 -0
  25. package/dist/WuiTimePicker-Cp4MfJlU.js +9 -0
  26. package/dist/{WuiTree-BNNk1CQ5.js → WuiTree-Dh5Tc_Ex.js} +1 -1
  27. package/dist/WuiWizardStep-DK2qWwP9.js +1 -0
  28. package/dist/{dataTable-4RjZ1c5V.js → dataTable-CUILMcga.js} +1 -1
  29. package/dist/elements/autocomplete.js +1 -1
  30. package/dist/elements/code-block.js +1 -1
  31. package/dist/elements/command-palette.js +1 -1
  32. package/dist/elements/comment-thread.js +1 -1
  33. package/dist/elements/country-select.js +1 -1
  34. package/dist/elements/data-table.js +1 -1
  35. package/dist/elements/date-range.js +1 -1
  36. package/dist/elements/datepicker.js +1 -1
  37. package/dist/elements/inline-edit.js +1 -1
  38. package/dist/elements/kanban.js +1 -1
  39. package/dist/elements/lead-popup.js +1 -0
  40. package/dist/elements/lightbox.js +1 -1
  41. package/dist/elements/markdown.js +1 -1
  42. package/dist/elements/mention-input.js +1 -1
  43. package/dist/elements/multiselect.js +1 -1
  44. package/dist/elements/notification-center.js +1 -1
  45. package/dist/elements/otp.js +1 -1
  46. package/dist/elements/phone.js +1 -1
  47. package/dist/elements/relative-time.js +1 -1
  48. package/dist/elements/rolling-number.js +1 -1
  49. package/dist/elements/saved-views.js +1 -1
  50. package/dist/elements/select.js +1 -1
  51. package/dist/elements/slider.js +1 -1
  52. package/dist/elements/taginput.js +1 -1
  53. package/dist/elements/timepicker.js +1 -1
  54. package/dist/elements/tree.js +1 -1
  55. package/dist/elements/wizard.js +1 -1
  56. package/dist/fieldState-D-zQcXUS.js +1 -0
  57. package/dist/{fileViewerImage-Bn5HCF30.js → fileViewerImage-DQYAoEzn.js} +1 -1
  58. package/dist/{fileViewerMedia-zSDnvCSa.js → fileViewerMedia-DwkIYzmY.js} +1 -1
  59. package/dist/{fileViewerPdf-C1QZnzCq.js → fileViewerPdf-CvY7afCX.js} +1 -1
  60. package/dist/fileViewerUi-D9R6-gZt.js +1 -0
  61. package/dist/{focusOrigin-BPTN3GY3.js → focusOrigin-0sYG-5El.js} +1 -1
  62. package/dist/formatters-D1zbsEJJ.js +1 -0
  63. package/dist/helpers.js +1 -1
  64. package/dist/iconGlyphs.g-DaOONrBK.js +1 -0
  65. package/dist/kanban-DqdYQ6sC.js +1 -0
  66. package/dist/{notificationDays-CZNthz7L.js → notificationDays-CMjhBP1Z.js} +1 -1
  67. package/dist/{optionLabel-BaLjjB-0.js → optionLabel-BkmbyLNL.js} +1 -1
  68. package/dist/server-XVcnIJ_Y.js +1 -0
  69. package/dist/server.js +1 -0
  70. package/dist/ui-calendar.global.js +1 -1
  71. package/dist/ui-calendar.js +1 -1
  72. package/dist/ui-chart.global.js +2 -2
  73. package/dist/ui-chart.js +2 -2
  74. package/dist/ui-elements/autocomplete.global.js +6 -6
  75. package/dist/ui-elements/carousel.global.js +1 -1
  76. package/dist/ui-elements/code-block.global.js +1 -1
  77. package/dist/ui-elements/command-palette.global.js +1 -1
  78. package/dist/ui-elements/comment-thread.global.js +1 -1
  79. package/dist/ui-elements/consent-banner.global.js +1 -1
  80. package/dist/ui-elements/context-menu.global.js +1 -1
  81. package/dist/ui-elements/date-range.global.js +9 -9
  82. package/dist/ui-elements/drawer.global.js +1 -1
  83. package/dist/ui-elements/image-crop.global.js +1 -1
  84. package/dist/ui-elements/inline-edit.global.js +1 -1
  85. package/dist/ui-elements/kanban.global.js +1 -1
  86. package/dist/ui-elements/lead-popup.global.js +306 -0
  87. package/dist/ui-elements/lightbox.global.js +1 -1
  88. package/dist/ui-elements/markdown.global.js +3 -3
  89. package/dist/ui-elements/multiselect.global.js +14 -14
  90. package/dist/ui-elements/phone.global.js +9 -9
  91. package/dist/ui-elements/resizable.global.js +1 -1
  92. package/dist/ui-elements/saved-views.global.js +1 -1
  93. package/dist/ui-elements/slider.global.js +10 -7
  94. package/dist/ui-elements/sortable.global.js +1 -1
  95. package/dist/ui-elements/status-icon.global.js +1 -1
  96. package/dist/ui-elements/taginput.global.js +4 -4
  97. package/dist/ui-elements/timepicker.global.js +3 -3
  98. package/dist/ui-elements/tour.global.js +1 -1
  99. package/dist/ui-elements/tree.global.js +1 -1
  100. package/dist/ui-elements/wizard.global.js +1 -1
  101. package/dist/ui-elements.global.js +30 -30
  102. package/dist/ui-elements.js +1 -1
  103. package/dist/ui-file-viewer.global.js +1 -1
  104. package/dist/ui-file-viewer.js +1 -1
  105. package/dist/ui-lead-popup.global.js +1 -0
  106. package/dist/ui-rich-text.global.js +57 -57
  107. package/dist/ui-rich-text.js +55 -55
  108. package/dist/wuiHttp-DgnM7K2Q.js +1 -0
  109. package/dist/zone-D82f-GU_.js +1 -0
  110. package/package.json +8 -5
  111. package/dist/WuiAutocomplete-DE9q2G-l.js +0 -13
  112. package/dist/WuiDatePicker-CkBUk76L.js +0 -31
  113. package/dist/WuiDateRange-3NYNJiIa.js +0 -25
  114. package/dist/WuiMarkdown-BxmKHb3T.js +0 -4
  115. package/dist/WuiMentionInput-DIRekJlq.js +0 -1
  116. package/dist/WuiMultiSelect-Brdm5tAI.js +0 -25
  117. package/dist/WuiOtp-Hw6srogj.js +0 -14
  118. package/dist/WuiPhone-D0ixbxGE.js +0 -16
  119. package/dist/WuiSavedViews-DrJWvWuf.js +0 -1
  120. package/dist/WuiSelect-Bma_H42p.js +0 -15
  121. package/dist/WuiSlider-DXJGSJHP.js +0 -48
  122. package/dist/WuiTagInput-C38b3LfS.js +0 -6
  123. package/dist/WuiTimePicker-Bw5BKBCD.js +0 -9
  124. package/dist/WuiWizardStep-DkEdAXc8.js +0 -1
  125. package/dist/fileViewerUi-CHY-0j9d.js +0 -1
  126. package/dist/formatters-7rx97Lnm.js +0 -1
  127. package/dist/iconGlyphs.g-CQcMoS6_.js +0 -1
  128. package/dist/kanban-CTIFNgJE.js +0 -1
  129. package/dist/ui-chat.global.js +0 -11
  130. package/dist/ui-chat.js +0 -11
  131. package/dist/wuiHttp-CYxlXwsy.js +0 -1
@@ -1,4 +1,4 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.128.0`)throw Error(`[webority-ui] markdown expects ui-elements 0.128.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){u(),r.push({type:`link`,href:t[2],children:f(t[1])}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t&&n(t[1])){u(),r.push({type:`citation`,text:t[1]}),p+=t[0].length;continue}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){u(),r.push({type:`image`,children:f(t[1])}),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;function g(e,t,n){if(n&&p.test(e)){let t=n(e);if(t!=null)return{kind:`app`,target:t}}return t===`app`?null:m.test(e)?{kind:`web`,href:e}:h.test(e)?{kind:`contact`,href:e}:null}function _(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var v=/^\s*```/,y=/^\s*```\s*(\S*)/,b=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,x=/^\s*([-*_])(\s*\1){2,}\s*$/,S=/^(\s*)[-*+]\s+(.*)$/,C=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,w=/^\s*>\s?(.*)$/,T=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,E=e=>e.includes(`|`);function D(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 O(e,t){return E(e[t])&&t+1<e.length&&e[t+1].includes(`|`)&&T.test(e[t+1])}function k(e,t){let n=e[t];return v.test(n)||w.test(n)||S.test(n)||C.test(n)||b.test(n)||x.test(n)||O(e,t)}function A(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function j(e){let t=C.exec(e);if(t)return{text:t[3],depth:A(t[1]),ordered:!0,number:Number(t[2])};let n=S.exec(e);return n?{text:n[2],depth:A(n[1]),ordered:!1,number:0}:null}function M(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.129.0`)throw Error(`[webority-ui] markdown expects ui-elements 0.129.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){u(),r.push({type:`link`,href:t[2],children:f(t[1])}),p+=t[0].length;continue}if(n){c.lastIndex=p;let t=c.exec(e);if(t&&n(t[1])){u(),r.push({type:`citation`,text:t[1]}),p+=t[0].length;continue}}}if(m===`!`){s.lastIndex=p;let t=s.exec(e);if(t){u(),r.push({type:`image`,children:f(t[1])}),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}\/)/;function _(e,t,n,r){if(n&&p.test(e)){let t=n(e);if(t!=null)return{kind:`app`,target:t}}return t===`app`?null:g.test(e)?{kind:`page`,href:e}:m.test(e)?{kind:r&&v(e,r)?`page`:`web`,href:e}:h.test(e)?{kind:`contact`,href:e}:null}function v(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 y(e){return typeof e!=`string`||!e.startsWith(`/`)||e[1]===`/`||e[1]===`\\`?null:e}var b=/^\s*```/,x=/^\s*```\s*(\S*)/,S=/^\s{0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*$/,C=/^\s*([-*_])(\s*\1){2,}\s*$/,w=/^(\s*)[-*+]\s+(.*)$/,T=/^(\s*)(\d{1,9})[.)]\s+(.*)$/,E=/^\s*>\s?(.*)$/,D=/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)*\|?\s*$/,O=e=>e.includes(`|`);function k(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 A(e,t){return O(e[t])&&t+1<e.length&&e[t+1].includes(`|`)&&D.test(e[t+1])}function j(e,t){let n=e[t];return b.test(n)||E.test(n)||w.test(n)||T.test(n)||S.test(n)||C.test(n)||A(e,t)}function M(e){let t=e.replace(/\t/g,` `).length;return Math.min(Math.floor(t/2),4)}function N(e){let t=T.exec(e);if(t)return{text:t[3],depth:M(t[1]),ordered:!0,number:Number(t[2])};let n=w.exec(e);return n?{text:n[2],depth:M(n[1]),ordered:!1,number:0}:null}function P(e){let t=(e??``).replace(/\r\n?/g,`
2
2
  `).split(`
3
- `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(v.test(e)){let i=y.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length&&!v.test(t[r]);)a.push(t[r]),r+=1;r+=1,n.push({type:`code`,text:a.join(`
4
- `),language:i});continue}if(O(t,r)){let i=D(e),a=[];for(r+=2;r<t.length&&t[r].trim()&&E(t[r]);)a.push(D(t[r])),r+=1;n.push({type:`table`,header:i,rows:a});continue}if(x.test(e)){n.push({type:`rule`}),r+=1;continue}let i=b.exec(e);if(i){n.push({type:`heading`,level:i[1].length,text:i[2]}),r+=1;continue}if(w.test(e)){let e=[];for(;r<t.length;){let n=w.exec(t[r]);if(!n)break;e.push(n[1]),r+=1}n.push({type:`quote`,lines:e});continue}let a=j(e);if(a){let e=[];for(;r<t.length&&t[r].trim();){let n=j(t[r]);if(n){if(n.depth===0&&n.ordered!==a.ordered)break;e.push(n)}else if(k(t,r))break;else e[e.length-1].text+=` ${t[r].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&&t[r].trim()&&!k(t,r);)o.push(t[r]),r+=1;n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var N=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`];function P(e,t,n,r,i=null){let a=F(e.ownerDocument,n,r).map((e,n)=>{let r=t[n]?.sig===e.sig?t[n].nodes:null;return{sig:e.sig,nodes:r??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.remove();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 F(e,t,n){let r={doc:e,links:n.links===`app`?`app`:`web`,headings:n.headings===`text`?`text`:`outline`,resolveLink:n.resolveLink,isCitation:n.isCitation},i=n.resolverGeneration??0;return M(t).map(e=>({sig:`${JSON.stringify(e)}|${r.links}|${r.headings}|${i}`,build:()=>R(r,e)}))}var I=class extends n.ElementBase{static get observedAttributes(){return[`links`,`headings`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=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 isCitation(){return this._isCitation}set isCitation(e){this._isCitation=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.tagName===`PRE`&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=P(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function L(e,t,n=[]){let r=e.createElement(t);return r.append(...n),r}function R(e,t){switch(t.type){case`paragraph`:return[L(e.doc,`p`,z(e,t.lines))];case`heading`:return[B(e,t)];case`list`:return V(e,t.items);case`table`:return[U(e,t)];case`code`:return[W(e.doc,t)];case`quote`:return[L(e.doc,`blockquote`,z(e,t.lines))];case`rule`:return[e.doc.createElement(`hr`)];default:return[]}}function z(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(e.doc.createElement(`br`)),n.push(...G(e,t))}),n}function B(e,t){let n=G(e,t.text);if(e.headings===`text`){let t=L(e.doc,`p`,n);return t.className=`fw-semibold`,t}return L(e.doc,`h2`,n)}function V(e,t){let n=[];for(let r=0;r<t.length;){let i=H(e,t,r);n.push(i.list),r=i.next}return n}function H(e,t,n){let{depth:r,ordered:i,number:a}=t[n],o=e.doc.createElement(i?`ol`:`ul`);i&&a!==1&&o.setAttribute(`start`,String(a));let s=null,c=n;for(;c<t.length&&t[c].depth>=r;)if(t[c].depth===r)s=L(e.doc,`li`,G(e,t[c].text)),o.append(s),c+=1;else{let n=H(e,t,c);s.append(n.list),c=n.next}return{list:o,next:c}}function U(e,t){let n=t.header.map(t=>{let n=L(e.doc,`th`,G(e,t));return n.setAttribute(`scope`,`col`),n}),r=t.rows.map(n=>L(e.doc,`tr`,t.header.map((t,r)=>L(e.doc,`td`,G(e,n[r]??``))))),i=L(e.doc,`table`,[L(e.doc,`thead`,[L(e.doc,`tr`,n)]),L(e.doc,`tbody`,r)]);i.className=`table`;let a=L(e.doc,`div`,[i]);return a.className=`table-responsive`,a}function W(e,t){let n=L(e,`pre`,[L(e,`code`,[e.createTextNode(t.text)])]);n.className=`wui-code-source`;let r=L(e,`wui-code-block`,[n]);return r.className=`wui-code-block`,r.setAttribute(`language`,N.includes(t.language)?t.language:`text`),r}function G(e,t){return K(e,f(t,{isCitation:e.isCitation}))}function K(e,t){return t.flatMap(t=>q(e,t))}function q(e,t){let{doc:n}=e;switch(t.type){case`code`:return[L(n,`code`,[n.createTextNode(t.text)])];case`strong`:return[L(n,`strong`,K(e,t.children))];case`em`:return[L(n,`em`,K(e,t.children))];case`strike`:return[L(n,`del`,K(e,t.children))];case`image`:return[n.createTextNode(`[`),...K(e,t.children),n.createTextNode(`]`)];case`link`:return J(e,t);case`citation`:return[Y(n,t.text)];default:return[n.createTextNode(t.text)]}}function J(e,t){let n=K(e,t.children),r=g(t.href,e.links,e.resolveLink);if(!r)return n;if(r.kind===`app`){let t=_(r.target);return t?[X(e.doc,t,n,!1)]:n}return[X(e.doc,r.href,n,r.kind===`web`)]}function Y(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 X(e,t,n,r){let i=L(e,`span`,n);i.className=`wui-link__label`;let a=L(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`,I),e.WuiMarkdown=I})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
3
+ `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r+=1;continue}if(b.test(e)){let i=x.exec(e)?.[1]||null,a=[];for(r+=1;r<t.length&&!b.test(t[r]);)a.push(t[r]),r+=1;r+=1,n.push({type:`code`,text:a.join(`
4
+ `),language:i});continue}if(A(t,r)){let i=k(e),a=[];for(r+=2;r<t.length&&t[r].trim()&&O(t[r]);)a.push(k(t[r])),r+=1;n.push({type:`table`,header:i,rows:a});continue}if(C.test(e)){n.push({type:`rule`}),r+=1;continue}let i=S.exec(e);if(i){n.push({type:`heading`,level:i[1].length,text:i[2]}),r+=1;continue}if(E.test(e)){let e=[];for(;r<t.length;){let n=E.exec(t[r]);if(!n)break;e.push(n[1]),r+=1}n.push({type:`quote`,lines:e});continue}let a=N(e);if(a){let e=[];for(;r<t.length&&t[r].trim();){let n=N(t[r]);if(n){if(n.depth===0&&n.ordered!==a.ordered)break;e.push(n)}else if(j(t,r))break;else e[e.length-1].text+=` ${t[r].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&&t[r].trim()&&!j(t,r);)o.push(t[r]),r+=1;n.push({type:`paragraph`,lines:o})}return n.map((e,t)=>({...e,key:t}))}var F=[`text`,`json`,`js`,`cs`,`sql`,`bash`,`http`,`html`,`css`];function I(e,t,n,r,i=null){let a=L(e.ownerDocument,n,r).map((e,n)=>{let r=t[n]?.sig===e.sig?t[n].nodes:null;return{sig:e.sig,nodes:r??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.remove();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 L(e,t,n){let r={doc:e,links:n.links===`app`?`app`:`web`,headings:n.headings===`text`?`text`:`outline`,resolveLink:n.resolveLink,isCitation:n.isCitation},i=n.resolverGeneration??0;return P(t).map(e=>({sig:`${JSON.stringify(e)}|${r.links}|${r.headings}|${i}`,build:()=>B(r,e)}))}var R=class extends n.ElementBase{static get observedAttributes(){return[`links`,`headings`]}constructor(){super(),this._drawn=[],this._blocks=[],this._observer=null,this._connected=!1,this._resolveLink=void 0,this._isCitation=void 0,this._resolverGeneration=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 isCitation(){return this._isCitation}set isCitation(e){this._isCitation=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.tagName===`PRE`&&e.classList.contains(`wui-markdown-source`))}_render(){let e=this._source();e&&(this._blocks=I(this,this._blocks,e.textContent??``,{links:this.getAttribute(`links`)??void 0,headings:this.getAttribute(`headings`)??void 0,resolveLink:this._resolveLink,isCitation:this._isCitation,resolverGeneration:this._resolverGeneration},e),this._drawn=this._blocks.flatMap(e=>e.nodes),e.hidden=!0,this._observer?.takeRecords())}};function z(e,t,n=[]){let r=e.createElement(t);return r.append(...n),r}function B(e,t){switch(t.type){case`paragraph`:return[z(e.doc,`p`,V(e,t.lines))];case`heading`:return[H(e,t)];case`list`:return U(e,t.items);case`table`:return[G(e,t)];case`code`:return[K(e.doc,t)];case`quote`:return[z(e.doc,`blockquote`,V(e,t.lines))];case`rule`:return[e.doc.createElement(`hr`)];default:return[]}}function V(e,t){let n=[];return t.forEach((t,r)=>{r>0&&n.push(e.doc.createElement(`br`)),n.push(...q(e,t))}),n}function H(e,t){let n=q(e,t.text);if(e.headings===`text`){let t=z(e.doc,`p`,n);return t.className=`fw-semibold`,t}return z(e.doc,`h2`,n)}function U(e,t){let n=[];for(let r=0;r<t.length;){let i=W(e,t,r);n.push(i.list),r=i.next}return n}function W(e,t,n){let{depth:r,ordered:i,number:a}=t[n],o=e.doc.createElement(i?`ol`:`ul`);i&&a!==1&&o.setAttribute(`start`,String(a));let s=null,c=n;for(;c<t.length&&t[c].depth>=r;)if(t[c].depth===r)s=z(e.doc,`li`,q(e,t[c].text)),o.append(s),c+=1;else{let n=W(e,t,c);s.append(n.list),c=n.next}return{list:o,next:c}}function G(e,t){let n=t.header.map(t=>{let n=z(e.doc,`th`,q(e,t));return n.setAttribute(`scope`,`col`),n}),r=t.rows.map(n=>z(e.doc,`tr`,t.header.map((t,r)=>z(e.doc,`td`,q(e,n[r]??``))))),i=z(e.doc,`table`,[z(e.doc,`thead`,[z(e.doc,`tr`,n)]),z(e.doc,`tbody`,r)]);i.className=`table`;let a=z(e.doc,`div`,[i]);return a.className=`table-responsive`,a}function K(e,t){let n=z(e,`pre`,[z(e,`code`,[e.createTextNode(t.text)])]);n.className=`wui-code-source`;let r=z(e,`wui-code-block`,[n]);return r.className=`wui-code-block`,r.setAttribute(`language`,F.includes(t.language)?t.language:`text`),r}function q(e,t){return J(e,f(t,{isCitation:e.isCitation}))}function J(e,t){return t.flatMap(t=>Y(e,t))}function Y(e,t){let{doc:n}=e;switch(t.type){case`code`:return[z(n,`code`,[n.createTextNode(t.text)])];case`strong`:return[z(n,`strong`,J(e,t.children))];case`em`:return[z(n,`em`,J(e,t.children))];case`strike`:return[z(n,`del`,J(e,t.children))];case`image`:return[n.createTextNode(`[`),...J(e,t.children),n.createTextNode(`]`)];case`link`:return X(e,t);case`citation`:return[Z(n,t.text)];default:return[n.createTextNode(t.text)]}}function X(e,t){let n=J(e,t.children),r=_(t.href,e.links,e.resolveLink,e.doc.location?.origin);if(!r)return n;if(r.kind===`app`){let t=y(r.target);return t?[Q(e.doc,t,n,!1)]:n}return[Q(e.doc,r.href,n,r.kind===`web`)]}function Z(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 Q(e,t,n,r){let i=z(e,`span`,n);i.className=`wui-link__label`;let a=z(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`,R),e.WuiMarkdown=R})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1,25 +1,25 @@
1
- (function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=globalThis.WeborityUiElementsInternal?.version;if(l!==`0.128.0`)throw Error(`[webority-ui] multiselect expects ui-elements 0.128.0 but the page loaded `+l+`.`);var u=e=>{let t=String(e??``).trim();return/^(https?:)?\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t)?t:``},d=(e,t=`wui-opt-avatar`)=>{let n=u(e.avatar);return!n&&!e.initials?``:`<span class="avatar ${t}" aria-hidden="true"><span class="avatar-face">${(0,r.escapeHtml)(e.initials??``)}</span>${n?`<img class="avatar-img" src="${f(n)}" alt="" />`:``}</span>`},f=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),p=!1,m=!1;function h(){m||typeof document>`u`||(m=!0,document.addEventListener(`keydown`,e=>{p=e.key===`Tab`},!0),document.addEventListener(`keyup`,()=>{p=!1},!0))}function g(){return p}function _(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 v=(e,t)=>t.some(t=>String(e??``).includes(t)),y=class extends a.ElementBase{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`icon`,`size`,`collapse-chips`,`aria-label`,`aria-invalid`,`allow-custom`,`custom-pattern`,`custom-invalid-message`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null,this._customError=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(this._rendered)this._bindGlobal?.();else{if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render()}}formResetCallback(){this.values=(this._defaultValues||[]).slice();let e=this.querySelector(`[data-input]`);e&&(e.value=``),this._setCustomError(``)}attributeChangedCallback(e){e===`aria-invalid`?this._syncInvalid():e!==`custom-pattern`&&e!==`custom-invalid-message`&&this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._customError?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],(0,o.syncFormMirrors)(this,this._values),this._rendered&&(this._renderControl(),this._renderOptions(this._query()))}set options(e){this._optionsProp=Array.isArray(e)?e:null,this._rendered&&this._allowCustom?(this._renderControl(),this._renderOptions(this._query())):this.isConnected&&this.render()}get options(){return this._readOptions()}get validateCustom(){return this._validateCustom??null}set validateCustom(e){this._validateCustom=typeof e==`function`?e:null}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_query(){let e=this.querySelector(this._allowCustom?`[data-input]`:`.search-select-input`);return e?e.value:``}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[r.TRUSTED_HTML]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of x){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?(0,r.optionText)(t):(0,r.stripTags)(e)}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?(0,r.optionLabelHtml)(t):(0,r.escapeHtml)(e)}render(){this._snapshotDeclared();let e=this._allowCustom,t=this.hasAttribute(`searchable`)&&!e,n=this.getAttribute(`search-placeholder`)||`Search…`,r=this.getAttribute(`icon`),i=this.getAttribute(`size`),a=i===`sm`?` search-select-sm`:i===`lg`?` search-select-lg`:``;(0,o.syncFormMirrors)(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let c=`${this.id}-listbox`;this._listboxId=c;let l=this.hasAttribute(`disabled`);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
1
+ (function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=globalThis.WeborityUiElementsInternal?.version;if(u!==`0.129.0`)throw Error(`[webority-ui] multiselect expects ui-elements 0.129.0 but the page loaded `+u+`.`);var d=e=>{let t=String(e??``).trim();return/^(https?:)?\/\//i.test(t)||/^\/(?!\/)/.test(t)||/^data:image\/(png|jpe?g|gif|webp|avif);/i.test(t)?t:``},f=(e,t=`wui-opt-avatar`)=>{let n=d(e.avatar);return!n&&!e.initials?``:`<span class="avatar ${t}" aria-hidden="true"><span class="avatar-face">${(0,r.escapeHtml)(e.initials??``)}</span>${n?`<img class="avatar-img" src="${p(n)}" alt="" />`:``}</span>`},p=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`),m=!1,h=!1;function g(){h||typeof document>`u`||(h=!0,document.addEventListener(`keydown`,e=>{m=e.key===`Tab`},!0),document.addEventListener(`keyup`,()=>{m=!1},!0))}function _(){return m}function v(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 y=(e,t)=>t.some(t=>String(e??``).includes(t)),b=class extends a.ElementBase{static formAssociated=!0;_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}static get observedAttributes(){return[`placeholder`,`search-placeholder`,`searchable`,`disabled`,`readonly`,`loading`,`icon`,`size`,`collapse-chips`,`aria-label`,`aria-invalid`,`allow-custom`,`custom-pattern`,`custom-invalid-message`]}constructor(){super(),this._values=[],this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null,this._customError=``;try{this._internals=this.attachInternals()}catch{this._internals=null}}connectedCallback(){if(this._rendered)this._bindGlobal?.();else{if(!this._valuesInit&&!this._optionsProp&&!this._values.length){let e=this.getAttribute(`value`);if(e!=null&&e!==``)this._values=e.split(`,`).map(e=>e.trim()).filter(Boolean);else{let e=[...this.querySelectorAll(`:scope > wui-option[selected]`)].map(e=>e.getAttribute(`value`)??e.textContent.trim());e.length&&(this._values=e.map(String))}}this._valuesInit=!0,this._defaultCaptured||=(this._defaultValues=this._values.slice(),!0),this.render()}}formResetCallback(){this.values=(this._defaultValues||[]).slice();let e=this.querySelector(`[data-input]`);e&&(e.value=``),this._setCustomError(``)}attributeChangedCallback(e){e===`aria-invalid`?this._syncInvalid():e!==`custom-pattern`&&e!==`custom-invalid-message`&&this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)||this._customError?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}get values(){return this._values.slice()}set values(e){this._values=Array.isArray(e)?e.map(String):[],(0,s.syncFormMirrors)(this,this._values),this._rendered&&(this._renderControl(),this._renderOptions(this._query()))}set options(e){this._optionsProp=Array.isArray(e)?e:null,this._rendered&&this._allowCustom?(this._renderControl(),this._renderOptions(this._query())):this.isConnected&&this.render()}get options(){return this._readOptions()}get validateCustom(){return this._validateCustom??null}set validateCustom(e){this._validateCustom=typeof e==`function`?e:null}get _allowCustom(){return this.hasAttribute(`allow-custom`)}_query(){let e=this.querySelector(this._allowCustom?`[data-input]`:`.search-select-input`);return e?e.value:``}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>{let t={value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[r.TRUSTED_HTML]:!0,selected:e.hasAttribute(`selected`)};for(let[n,r]of S){let i=e.getAttribute(n);i&&(t[r]=i)}return e.hasAttribute(`disabled`)&&(t.disabled=!0),t}))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}_labelFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?(0,r.optionText)(t):(0,r.stripTags)(e)}_labelHtmlFor(e){let t=this._readOptions().find(t=>String(t.value)===String(e));return t?(0,r.optionLabelHtml)(t):(0,r.escapeHtml)(e)}render(){this._snapshotDeclared();let e=this._allowCustom,t=this.hasAttribute(`searchable`)&&!e,n=this.getAttribute(`search-placeholder`)||`Search…`,r=this.getAttribute(`icon`),i=this.getAttribute(`size`),a=i===`sm`?` search-select-sm`:i===`lg`?` search-select-lg`:``;(0,s.syncFormMirrors)(this,this._values),this.id||=`wui-multiselect-${Math.random().toString(36).slice(2,9)}`;let l=`${this.id}-listbox`;this._listboxId=l;let u=this.hasAttribute(`disabled`),d=(0,o.isInert)(this);if(e){let e=`${this.id}-custom-error`;this.innerHTML=`
2
2
  <div class="search-select${a}">
3
- <div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${l?` aria-disabled="true"`:``}>
4
- ${r?(0,s.glyphSvg)(r,{className:`search-select-icon`}):``}
5
- <div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${E(c)}" aria-label="${E(this._accessibleName())}" aria-describedby="${E(e)}" autocomplete="off"${l?` disabled`:``} /></div>
6
- ${(0,s.glyphSvg)(`chevron-down`,{className:`search-select-caret`})}
3
+ <div class="input search-select-control search-select-multi"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${u?` aria-disabled="true"`:``}>
4
+ ${r?(0,c.glyphSvg)(r,{className:`search-select-icon`}):``}
5
+ <div class="ms-chips" data-chips><input type="text" class="ms-input" data-input role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false" aria-controls="${D(l)}" aria-label="${D(this._accessibleName())}" aria-describedby="${D(e)}" autocomplete="off"${u?` disabled`:d?` readonly`:``} /></div>
6
+ ${(0,c.glyphSvg)(`chevron-down`,{className:`search-select-caret`})}
7
7
  </div>
8
8
  <div class="search-select-menu search-select-menu-fixed" hidden>
9
- <div class="search-select-options" role="listbox" id="${E(c)}" aria-multiselectable="true" tabindex="-1"></div>
9
+ <div class="search-select-options" role="listbox" id="${D(l)}" aria-multiselectable="true" tabindex="-1"></div>
10
10
  </div>
11
11
  </div>
12
- <div class="field-error wui-ms-custom-error" id="${E(e)}" aria-live="polite" hidden></div>`}else this.innerHTML=`
12
+ <div class="field-error wui-ms-custom-error" id="${D(e)}" aria-live="polite" hidden></div>`}else this.innerHTML=`
13
13
  <div class="search-select${a}">
14
- <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${E(c)}" aria-label="${E(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${l?` aria-disabled="true"`:` tabindex="0"`}>
15
- ${r?(0,s.glyphSvg)(r,{className:`search-select-icon`}):``}
14
+ <div class="input search-select-control search-select-multi" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="${D(l)}" aria-label="${D(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${u?` aria-disabled="true"`:` tabindex="0"`}>
15
+ ${r?(0,c.glyphSvg)(r,{className:`search-select-icon`}):``}
16
16
  <div class="ms-chips" data-chips></div>
17
- ${(0,s.glyphSvg)(`chevron-down`,{className:`search-select-caret`})}
17
+ ${(0,c.glyphSvg)(`chevron-down`,{className:`search-select-caret`})}
18
18
  </div>
19
19
  <div class="search-select-menu search-select-menu-fixed" hidden>
20
- ${t?`<div class="search-select-search">${(0,s.glyphSvg)(`search`)}<input class="search-select-input" placeholder="${E(n)}" aria-label="${E(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${(0,s.glyphSvg)(`x`)}</button></div>`:``}
21
- <div class="search-select-options" role="listbox" id="${E(c)}" aria-multiselectable="true" tabindex="-1"></div>
20
+ ${t?`<div class="search-select-search">${(0,c.glyphSvg)(`search`)}<input class="search-select-input" placeholder="${D(n)}" aria-label="${D(n)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${(0,c.glyphSvg)(`x`)}</button></div>`:``}
21
+ <div class="search-select-options" role="listbox" id="${D(l)}" aria-multiselectable="true" tabindex="-1"></div>
22
22
  <div class="search-select-empty" hidden>No matches</div>
23
23
  </div>
24
- </div>`;this._rendered=!0,this._customError=``,(0,o.syncFormMirrors)(this,this._values),this._renderControl(),this._renderOptions(),this._wire()}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`,n=this._allowCustom?e.querySelector(`[data-input]`):null,i=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span><button type="button" class="chip-remove" data-remove="${E(e)}" aria-label="Remove ${E(this._labelFor(e))}">${(0,s.glyphSvg)(`x`)}</button></span>`).join(``);if(n){for(let t of[...e.querySelectorAll(`:scope > .chip`)])t.remove();n.insertAdjacentHTML(`beforebegin`,i),n.placeholder=this._values.length?``:t,this._collapseChips()}else this._values.length?(e.innerHTML=i,this._collapseChips()):e.innerHTML=`<span class="search-select-placeholder">${(0,r.escapeHtml)(t)}</span>`}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,t[t.length-1].after(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_matches(e,t){return(0,r.optionText)(e).toLowerCase().includes(t)||String(e.description??``).toLowerCase().includes(t)}_optionNamed(e){let t=e.trim().toLowerCase();return this._readOptions().find(e=>String(e.value??``).toLowerCase()===t||(0,r.optionText)(e).trim().toLowerCase()===t)}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let i=(e||``).trim(),a=i.toLowerCase(),o=this._readOptions();a&&(o=o.filter(e=>this._matches(e,a)));let c=this._listboxId||`${this.id||`wui-multiselect`}-listbox`,l=this._allowCustom&&i&&!this._optionNamed(i),u=o.map((e,t)=>{let n=this._values.includes(String(e.value)),i=`${c}-opt-${t}`;return S(e)?C(e,i,n):`<button type="button" role="option" id="${E(i)}" class="search-select-option${n?` selected`:``}" data-value="${E(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${(0,r.optionLabelHtml)(e)}</span><span class="ms-check">${(0,s.glyphSvg)(`check`)}</span></button>`});l&&u.push(`<button type="button" role="option" id="${E(`${c}-opt-${o.length}`)}" class="search-select-option search-select-option-custom" data-value="${E(i)}" data-custom="true" aria-selected="false">Add “${(0,r.escapeHtml)(i)}”</button>`),t.innerHTML=u.join(``),n&&(n.hidden=o.length>0),this._active=-1,this._combobox()?.removeAttribute(`aria-activedescendant`),this._allowCustom&&this._syncCustomMenu?.(),this._reanchor?.()}_combobox(){return this._allowCustom?this.querySelector(`[data-input]`):this.querySelector(`.search-select-control`)}_setCustomError(e){this._customError=e||``;let t=this.querySelector(`.wui-ms-custom-error`),n=this.querySelector(`[data-input]`);t&&(t.textContent=this._customError,t.hidden=!this._customError),n&&(this._customError?n.setAttribute(`aria-invalid`,`true`):n.removeAttribute(`aria-invalid`)),this._syncInvalid()}_customRefusal(e){let t=this.getAttribute(`custom-invalid-message`)||`Enter a valid value.`,n=this.getAttribute(`custom-pattern`);if(n){let r=T(n);if(r&&!r.test(e))return t}let r=this._validateCustom;if(r){let n=r(e);return n===!0?``:typeof n==`string`&&n?n:t}return``}_commitTyped(e){let t=e.trim().replace(/,+$/,``).trim();if(!t)return``;let n=this._optionNamed(t),r;if(n){if(n.disabled)return n.disabledHint||this.getAttribute(`custom-invalid-message`)||`That option is not available.`;r=String(n.value)}else{let e=this._customRefusal(t);if(e)return e;r=t}let i=r.toLowerCase();return this._values.some(e=>e.toLowerCase()===i)||(this._values=[...this._values,r]),``}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),r=this.querySelector(`.search-select-input`),i=this.querySelector(`.search-select-clear`),a=this.querySelector(`.search-select-options`),s=this._allowCustom,l=s?this.querySelector(`[data-input]`):null,u=l||e;if(!e||!t)return;let d=()=>this.hasAttribute(`disabled`),f=()=>(0,n.anchorOverlay)(e,t,{matchWidth:!0}),p=()=>[...this.querySelectorAll(`.search-select-option`)],m=()=>p().filter(e=>!e.hidden),y=(e,{reveal:t=!0}={})=>{let n=m();this._active=e,(0,c.moveActiveRow)(a,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),u.setAttribute(`aria-activedescendant`,n[e].id)):u.removeAttribute(`aria-activedescendant`)},x=!1,S=()=>s?x:!t.hidden,C=()=>{let n=x&&p().length>0,r=t.hidden;t.hidden=!n,u.setAttribute(`aria-expanded`,String(n)),e.classList.toggle(`open`,n),n&&r&&f()};this._syncCustomMenu=s?C:null;let w=()=>{S()&&f()},T=()=>{d()||((0,n.bindReanchor)(this,w),s?(x=!0,C()):(t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),f(),r&&(r.value=``,this._renderOptions(``),r.focus())))},E=()=>{let r=s?x:e.getAttribute(`aria-expanded`)===`true`;s?(x=!1,C()):(t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`)),y(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,(0,n.unbindReanchor)(this),r&&this.dispatchEvent(new Event(`wui-multiselect:close`,{bubbles:!0}))},D=()=>{(0,o.syncFormMirrors)(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},O=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(s&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),D()},k=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),D()},A=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=v(e,b)?_(e,b):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(l.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),D()),this._renderOptions(l.value))},j=e=>{e&&e.getAttribute(`aria-disabled`)!==`true`&&(e.dataset.custom===`true`?A(e.dataset.value):(O(e.dataset.value),l?.value&&(l.value=``,this._setCustomError(``),this._renderOptions(``))))};e.addEventListener(`click`,e=>{if(d())return;let t=e.target.closest(`[data-remove]`);if(t)e.stopPropagation(),k(t.dataset.remove),l?.focus();else if(l){let t=S();e.target!==l&&l.focus(),e.target===l||!t?T():E()}else S()?E():T()}),a.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(j(t),(l||r)?.focus())}),a.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&y(m().indexOf(t),{reveal:!1})}),a.addEventListener(`mouseleave`,()=>y(-1)),a.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),r?.addEventListener(`input`,()=>{this._renderOptions(r.value),i&&(i.hidden=!r.value),y(-1)}),this._navHandler=(0,c.createListboxKeyNav)({getVisibleOptions:m,getActive:()=>this._active,setActive:e=>y(e),onEnter:e=>{e?j(e):l?.value.trim()&&A(l.value)},onEscape:()=>{this._navHandler.clearTypeahead(),E(),l||e.focus()}});let M=e=>{let t=l||r;e.key===`Backspace`&&!t?.value&&this._values.length?k(this._values[this._values.length-1]):(e.key===`Escape`&&S()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e))};if(r?.addEventListener(`keydown`,M),i?.addEventListener(`click`,()=>{r.value=``,this._renderOptions(``),i.hidden=!0,r.focus()}),l){let t=e=>{e.target!==l&&e.preventDefault()};a.addEventListener(`mousedown`,t),e.addEventListener(`mousedown`,t),h(),l.addEventListener(`focus`,()=>{g()&&T()}),l.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(l.value),T()}),l.addEventListener(`keydown`,e=>{if(e.key===`,`&&l.value.trim())e.preventDefault(),A(l.value);else if(e.key===`Enter`){if(this._active<0&&!l.value.trim())return;this._navHandler.handler(e)}else e.key!==`ArrowDown`&&e.key!==`ArrowUp`||S()||T(),M(e)}),l.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text/plain`)??``;v(t,b)&&(e.preventDefault(),A(`${l.value}${t}`))}),l.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(l.value.trim()&&A(l.value,{quiet:!0}),E())})}else e.addEventListener(`keydown`,e=>{S()?M(e):(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),T())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{S()&&!this.contains(e.target)&&E()},document.addEventListener(`click`,this._onDocClick),S()&&(0,n.bindReanchor)(this,w)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),(0,n.unbindReanchor)(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},b=[`,`,`;`,`
25
- `,` `],x=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],S=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),C=(e,t,n)=>{let i=!!e.disabled,a=e.description?`<span class="wui-opt-desc">${(0,r.escapeHtml)(e.description)}</span>`:``,o=e.disabledHint&&i?`<span class="wui-opt-hint">${(0,r.escapeHtml)(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${E(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${E(e.value)}" aria-selected="${n}"${i?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${(0,r.optionLabelHtml)(e)}</span>${a}</span>${o}${d(e)}<span class="ms-check">${(0,s.glyphSvg)(`check`)}</span></button>`},w=new Map,T=e=>{if(w.has(e))return w.get(e);let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{(0,i.devWarn)(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`)}return w.set(e,t),t},E=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-multiselect`,y),e.WuiMultiSelect=y})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav);
24
+ </div>`;this._rendered=!0,this._customError=``,(0,s.syncFormMirrors)(this,this._values),this._renderControl(),this._renderOptions(),this._wire(),(0,o.syncFieldState)(this,this.querySelector(`.search-select-control`))}_renderControl(){let e=this.querySelector(`[data-chips]`);if(!e)return;let t=this.getAttribute(`placeholder`)||`Select…`,n=this._allowCustom?e.querySelector(`[data-input]`):null,i=!(0,o.isReadOnly)(this)&&!this.hasAttribute(`loading`),a=this._values.map(e=>`<span class="chip chip-sm"><span class="chip-label">${this._labelHtmlFor(e)}</span>${i?`<button type="button" class="chip-remove" data-remove="${D(e)}" aria-label="Remove ${D(this._labelFor(e))}">${(0,c.glyphSvg)(`x`)}</button>`:``}</span>`).join(``);if(n){for(let t of[...e.querySelectorAll(`:scope > .chip`)])t.remove();n.insertAdjacentHTML(`beforebegin`,a),n.placeholder=this._values.length?``:t,this._collapseChips()}else this._values.length?(e.innerHTML=a,this._collapseChips()):e.innerHTML=`<span class="search-select-placeholder">${(0,r.escapeHtml)(t)}</span>`}_collapseChips(){let e=this.querySelector(`[data-chips]`);if(!e||!this.hasAttribute(`collapse-chips`)||!this._values.length)return;e.querySelector(`.chip-more`)?.remove();let t=[...e.querySelectorAll(`:scope > .chip:not(.chip-more)`)];for(let e of t)e.style.display=``;if(!t.length)return;let n=e.clientWidth,r=e=>e.offsetLeft+e.offsetWidth;if(r(t[t.length-1])<=n)return;let i=document.createElement(`span`);i.className=`chip chip-sm chip-more`,i.textContent=`+${t.length}`,t[t.length-1].after(i);let a=i.offsetWidth+6,o=0;for(let e of t)if(r(e)<=n-a)o+=1;else break;o<1&&(o=1);for(let e=o;e<t.length;e+=1)t[e].style.display=`none`;i.textContent=`+${t.length-o}`}_matches(e,t){return(0,r.optionText)(e).toLowerCase().includes(t)||String(e.description??``).toLowerCase().includes(t)}_optionNamed(e){let t=e.trim().toLowerCase();return this._readOptions().find(e=>String(e.value??``).toLowerCase()===t||(0,r.optionText)(e).trim().toLowerCase()===t)}_renderOptions(e){let t=this.querySelector(`.search-select-options`),n=this.querySelector(`.search-select-empty`);if(!t)return;let i=(e||``).trim(),a=i.toLowerCase(),o=this._readOptions();a&&(o=o.filter(e=>this._matches(e,a)));let s=this._listboxId||`${this.id||`wui-multiselect`}-listbox`,l=this._allowCustom&&i&&!this._optionNamed(i),u=o.map((e,t)=>{let n=this._values.includes(String(e.value)),i=`${s}-opt-${t}`;return C(e)?w(e,i,n):`<button type="button" role="option" id="${D(i)}" class="search-select-option${n?` selected`:``}" data-value="${D(e.value)}" aria-selected="${n}"><span class="ms-opt-label">${(0,r.optionLabelHtml)(e)}</span><span class="ms-check">${(0,c.glyphSvg)(`check`)}</span></button>`});l&&u.push(`<button type="button" role="option" id="${D(`${s}-opt-${o.length}`)}" class="search-select-option search-select-option-custom" data-value="${D(i)}" data-custom="true" aria-selected="false">Add “${(0,r.escapeHtml)(i)}”</button>`),t.innerHTML=u.join(``),n&&(n.hidden=o.length>0),this._active=-1,this._combobox()?.removeAttribute(`aria-activedescendant`),this._allowCustom&&this._syncCustomMenu?.(),this._reanchor?.()}_combobox(){return this._allowCustom?this.querySelector(`[data-input]`):this.querySelector(`.search-select-control`)}_setCustomError(e){this._customError=e||``;let t=this.querySelector(`.wui-ms-custom-error`),n=this.querySelector(`[data-input]`);t&&(t.textContent=this._customError,t.hidden=!this._customError),n&&(this._customError?n.setAttribute(`aria-invalid`,`true`):n.removeAttribute(`aria-invalid`)),this._syncInvalid()}_customRefusal(e){let t=this.getAttribute(`custom-invalid-message`)||`Enter a valid value.`,n=this.getAttribute(`custom-pattern`);if(n){let r=E(n);if(r&&!r.test(e))return t}let r=this._validateCustom;if(r){let n=r(e);return n===!0?``:typeof n==`string`&&n?n:t}return``}_commitTyped(e){let t=e.trim().replace(/,+$/,``).trim();if(!t)return``;let n=this._optionNamed(t),r;if(n){if(n.disabled)return n.disabledHint||this.getAttribute(`custom-invalid-message`)||`That option is not available.`;r=String(n.value)}else{let e=this._customRefusal(t);if(e)return e;r=t}let i=r.toLowerCase();return this._values.some(e=>e.toLowerCase()===i)||(this._values=[...this._values,r]),``}_wire(){this._teardown();let e=this.querySelector(`.search-select-control`),t=this.querySelector(`.search-select-menu`),r=this.querySelector(`.search-select-input`),i=this.querySelector(`.search-select-clear`),a=this.querySelector(`.search-select-options`),c=this._allowCustom,u=c?this.querySelector(`[data-input]`):null,d=u||e;if(!e||!t)return;let f=()=>(0,o.isInert)(this),p=()=>(0,n.anchorOverlay)(e,t,{matchWidth:!0}),m=()=>[...this.querySelectorAll(`.search-select-option`)],h=()=>m().filter(e=>!e.hidden),b=(e,{reveal:t=!0}={})=>{let n=h();this._active=e,(0,l.moveActiveRow)(a,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),d.setAttribute(`aria-activedescendant`,n[e].id)):d.removeAttribute(`aria-activedescendant`)},S=!1,C=()=>c?S:!t.hidden,w=()=>{let n=S&&m().length>0,r=t.hidden;t.hidden=!n,d.setAttribute(`aria-expanded`,String(n)),e.classList.toggle(`open`,n),n&&r&&p()};this._syncCustomMenu=c?w:null;let T=()=>{C()&&p()},E=()=>{f()||((0,n.bindReanchor)(this,T),c?(S=!0,w()):(t.hidden=!1,e.setAttribute(`aria-expanded`,`true`),e.classList.add(`open`),p(),r&&(r.value=``,this._renderOptions(``),r.focus())))},D=()=>{let r=c?S:e.getAttribute(`aria-expanded`)===`true`;c?(S=!1,w()):(t.hidden=!0,e.setAttribute(`aria-expanded`,`false`),e.classList.remove(`open`)),b(-1),clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null,this._typeahead=``,(0,n.unbindReanchor)(this),r&&this.dispatchEvent(new Event(`wui-multiselect:close`,{bubbles:!0}))},O=()=>{(0,s.syncFormMirrors)(this,this._values),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},k=e=>{let t=String(e);if(this._values.includes(t))this._values=this._values.filter(e=>e!==t);else if(c&&this._values.some(e=>e.toLowerCase()===t.toLowerCase()))return;else this._values=[...this._values,t];this._renderControl(),this._renderOptions(this._query()),O()},A=e=>{this._values=this._values.filter(t=>t!==String(e)),this._renderControl(),this._renderOptions(this._query()),O()},j=(e,{quiet:t=!1}={})=>{let n=this._values.length,r=y(e,x)?v(e,x):[e],i=[],a=``;for(let e of r){let t=this._commitTyped(e);t&&(i.push(e.trim()),a||=t)}t&&i.length||(u.value=i.join(`, `),this._setCustomError(a),this._values.length!==n&&(this._renderControl(),O()),this._renderOptions(u.value))},M=e=>{e&&e.getAttribute(`aria-disabled`)!==`true`&&(e.dataset.custom===`true`?j(e.dataset.value):(k(e.dataset.value),u?.value&&(u.value=``,this._setCustomError(``),this._renderOptions(``))))};e.addEventListener(`click`,e=>{if(f())return;let t=e.target.closest(`[data-remove]`);if(t)e.stopPropagation(),A(t.dataset.remove),u?.focus();else if(u){let t=C();e.target!==u&&u.focus(),e.target===u||!t?E():D()}else C()?D():E()}),a.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&(M(t),(u||r)?.focus())}),a.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&b(h().indexOf(t),{reveal:!1})}),a.addEventListener(`mouseleave`,()=>b(-1)),a.addEventListener(`error`,e=>{e.target?.classList?.contains(`avatar-img`)&&e.target.remove()},!0),r?.addEventListener(`input`,()=>{this._renderOptions(r.value),i&&(i.hidden=!r.value),b(-1)}),this._navHandler=(0,l.createListboxKeyNav)({getVisibleOptions:h,getActive:()=>this._active,setActive:e=>b(e),onEnter:e=>{e?M(e):u?.value.trim()&&j(u.value)},onEscape:()=>{this._navHandler.clearTypeahead(),D(),u||e.focus()}});let N=e=>{if(f())return;let t=u||r;e.key===`Backspace`&&!t?.value&&this._values.length?A(this._values[this._values.length-1]):(e.key===`Escape`&&C()&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e))};if(r?.addEventListener(`keydown`,N),i?.addEventListener(`click`,()=>{r.value=``,this._renderOptions(``),i.hidden=!0,r.focus()}),u){let t=e=>{e.target!==u&&e.preventDefault()};a.addEventListener(`mousedown`,t),e.addEventListener(`mousedown`,t),g(),u.addEventListener(`focus`,()=>{_()&&E()}),u.addEventListener(`input`,()=>{this._customError&&this._setCustomError(``),this._renderOptions(u.value),E()}),u.addEventListener(`keydown`,e=>{if(!f()){if(e.key===`,`&&u.value.trim())e.preventDefault(),j(u.value);else if(e.key===`Enter`){if(this._active<0&&!u.value.trim())return;this._navHandler.handler(e)}else e.key!==`ArrowDown`&&e.key!==`ArrowUp`||C()||E(),N(e)}}),u.addEventListener(`paste`,e=>{if(f())return;let t=e.clipboardData?.getData(`text/plain`)??``;y(t,x)&&(e.preventDefault(),j(`${u.value}${t}`))}),u.addEventListener(`blur`,e=>{e.relatedTarget&&this.contains(e.relatedTarget)||(u.value.trim()&&j(u.value,{quiet:!0}),D())})}else e.addEventListener(`keydown`,e=>{C()?N(e):f()||(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),E())});this._bindGlobal=()=>{this._teardown(),!this._ro&&typeof ResizeObserver<`u`&&(this._ro=new ResizeObserver(()=>this._collapseChips()),this._ro.observe(this)),this._onDocClick=e=>{C()&&!this.contains(e.target)&&D()},document.addEventListener(`click`,this._onDocClick),C()&&(0,n.bindReanchor)(this,T)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),(0,n.unbindReanchor)(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown(),this._ro?.disconnect(),this._ro=null}},x=[`,`,`;`,`
25
+ `,` `],S=[[`description`,`description`],[`avatar`,`avatar`],[`initials`,`initials`],[`disabled-hint`,`disabledHint`]],C=e=>!!(e.description||e.avatar||e.initials||e.disabled||e.disabledHint),w=(e,t,n)=>{let i=!!e.disabled,a=e.description?`<span class="wui-opt-desc">${(0,r.escapeHtml)(e.description)}</span>`:``,o=e.disabledHint&&i?`<span class="wui-opt-hint">${(0,r.escapeHtml)(e.disabledHint)}</span>`:``;return`<button type="button" role="option" id="${D(t)}" class="search-select-option wui-opt-rich${n?` selected`:``}" data-value="${D(e.value)}" aria-selected="${n}"${i?` aria-disabled="true"`:``}><span class="ms-opt-label"><span class="wui-opt-name">${(0,r.optionLabelHtml)(e)}</span>${a}</span>${o}${f(e)}<span class="ms-check">${(0,c.glyphSvg)(`check`)}</span></button>`},T=new Map,E=e=>{if(T.has(e))return T.get(e);let t=null;try{t=RegExp(`^(?:${e})$`,`u`)}catch{(0,i.devWarn)(`<wui-multiselect> custom-pattern is not a valid regular expression and is ignored: ${e}`)}return T.set(e,t),t},D=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-multiselect`,b),e.WuiMultiSelect=b})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.optionLabel,WeborityUiElementsInternal.modules.devWarn,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav);
@@ -1,16 +1,16 @@
1
- (function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=globalThis.WeborityUiElementsInternal?.version;if(l!==`0.128.0`)throw Error(`[webority-ui] phone expects ui-elements 0.128.0 but the page loaded `+l+`.`);var u=[[`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`,`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`]],d=e=>(u.find(t=>t[0]===e)||[``,``,``])[2],f={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`]},p=new Set(u.map(([e])=>e)),m=new Map;for(let[e,t]of Object.entries(f))for(let n of t)m.set(n,e);function h(e){let t=m.get(e);return t&&p.has(t)?t:null}function g(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&p.has(t)?t:null}function _(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return h(e)||g(t)||null}var v=`ui-phone.global.js`;function y(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${v}"]`);if(!n){n=document.createElement(`script`);try{n.src=(0,s.assetUrl)(v)}catch(e){t(e);return}document.head.append(n)}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 b=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,x=e=>e?`+${d(e)}`:``,S=null,C=null;function w(){return S?Promise.resolve(S):(C||=y().then(e=>(S=e,S)).catch(()=>null),C)}function T(e,t){let n=`+${d(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function E(e,t){if(!S||!t||!e)return t;try{return T(e,new S.AsYouType(e).input(`+${d(e)}${t}`))||t}catch{return t}}function D(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 O(e){if(!S||!e)return null;try{return T(e,S.getExampleNumber(e,S.examples)?.formatInternational())||null}catch{return null}}function k(e){let t=O(e);return t?`For example ${t}`:null}function A(e){if(!S||!e)return null;try{if(!S.isValidPhoneNumber(e))return!1;let t=S.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function j(e){if(!S||!e)return null;try{let t=S.getExampleNumber(e,S.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function M(e,t,n){try{let r=S.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function N(e){if(!S||!e?.trim().startsWith(`+`))return null;try{let t=new S.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}function P(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(d(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var F=class extends r.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`value`,`country`,`locked-country`,`placeholder`,`disabled`,`required`,`aria-label`,`aria-describedby`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._defaultCountry=_()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}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?`+${d(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:N(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(d(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,i.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`)||k(this._country)||`Enter phone number`;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="${b(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${x(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
2
- <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${I(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
3
- <span class="${b(this._country)}" data-flag aria-hidden="true"></span>
4
- ${(0,a.glyphSvg)(`chevron-down`,{className:`phone-chevron`})}
5
- <span class="phone-dial" data-dial>${x(this._country)}</span>
1
+ (function(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var u=globalThis.WeborityUiElementsInternal?.version;if(u!==`0.129.0`)throw Error(`[webority-ui] phone expects ui-elements 0.129.0 but the page loaded `+u+`.`);var d=[[`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`,`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`]],f=e=>(d.find(t=>t[0]===e)||[``,``,``])[2],p={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`]},m=new Set(d.map(([e])=>e)),h=new Map;for(let[e,t]of Object.entries(p))for(let n of t)h.set(n,e);function g(e){let t=h.get(e);return t&&m.has(t)?t:null}function _(e){if(!e)return null;let t;try{t=new Intl.Locale(e).region}catch{return null}return t&&m.has(t)?t:null}function v(){let e;try{e=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{e=void 0}let t=typeof navigator>`u`?void 0:navigator.language;return g(e)||_(t)||null}var y=`ui-phone.global.js`;function b(){return window.WeborityPhone?Promise.resolve(window.WeborityPhone):new Promise((e,t)=>{let n=document.querySelector(`script[src*="${y}"]`);if(!n){n=document.createElement(`script`);try{n.src=(0,c.assetUrl)(y)}catch(e){t(e);return}document.head.append(n)}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 x=e=>e?`wui-flag wui-flag-${String(e).toLowerCase()}`:`wui-flag`,S=e=>e?`+${f(e)}`:``,C=null,w=null;function T(){return C?Promise.resolve(C):(w||=b().then(e=>(C=e,C)).catch(()=>null),w)}function E(e,t){let n=`+${f(e)}`;return t?.startsWith(n)?t.slice(n.length).trimStart():null}function D(e,t){if(!C||!t||!e)return t;try{return E(e,new C.AsYouType(e).input(`+${f(e)}${t}`))||t}catch{return t}}function O(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 k(e){if(!C||!e)return null;try{return E(e,C.getExampleNumber(e,C.examples)?.formatInternational())||null}catch{return null}}function A(e){let t=k(e);return t?`For example ${t}`:null}function j(e){if(!C||!e)return null;try{if(!C.isValidPhoneNumber(e))return!1;let t=C.parsePhoneNumber(e)?.getType?.();return t===void 0||t===`MOBILE`||t===`FIXED_LINE_OR_MOBILE`}catch{return null}}function M(e){if(!C||!e)return null;try{let t=C.getExampleNumber(e,C.examples);return t?.nationalNumber?t.nationalNumber.length:null}catch{return null}}function N(e,t,n){try{let r=C.parsePhoneNumber(t,e),i=r?.nationalNumber;return!i||r.country!==e||i.length>n||!t.endsWith(i)?null:i}catch{return null}}function P(e){if(!C||!e?.trim().startsWith(`+`))return null;try{let t=new C.AsYouType;t.input(e.trim());let n=t.getCountry();return n?{country:n,national:t.getNationalNumber()||``}:null}catch{return null}}function F(e,t){let n=String(t??``).trim();if(!n.startsWith(`+`))return null;let r=n.replace(/[^0-9]/g,``),i=String(f(e));return{country:e,national:r.startsWith(i)?r.slice(i.length):r}}var I=class extends r.ElementBase{static formAssociated=!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=v()||``,this._country=this._defaultCountry,this._national=``,this._active=-1,this._committedValue=``,this._validateOnInput=!1}connectedCallback(){this._rendered?this._bindGlobal?.():this.render()}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?`+${f(this._country)}${this._national}`:``}set value(e){let t=String(e??``).trim();this._locked&&(this._country=this._locked);let n=this._locked?null:P(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(f(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`)||A(this._country)||`Enter phone number`;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="${x(this._country)}" data-flag aria-hidden="true"></span><span class="phone-dial" data-dial>${S(this._country)}</span></span></div>`:`<div class="phone-country-adornment">
2
+ <button type="button" class="country-toggle" aria-label="Choose country" aria-haspopup="listbox" aria-expanded="false" aria-controls="${L(t)}"${this.hasAttribute(`disabled`)?` disabled`:``}>
3
+ <span class="${x(this._country)}" data-flag aria-hidden="true"></span>
4
+ ${(0,o.glyphSvg)(`chevron-down`,{className:`phone-chevron`})}
5
+ <span class="phone-dial" data-dial>${S(this._country)}</span>
6
6
  </button>
7
7
  <div class="country-dropdown-menu" hidden>
8
- <div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${(0,a.glyphSvg)(`search`)}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${I(t)}" aria-autocomplete="list" /></div>
9
- <div class="country-list-scroll" role="listbox" id="${I(t)}" tabindex="-1"></div>
8
+ <div class="dropdown-search-wrapper"><span class="dropdown-search-icon">${(0,o.glyphSvg)(`search`)}</span><input type="text" class="dropdown-search-input" placeholder="Search country or code" aria-label="Search countries" aria-controls="${L(t)}" aria-autocomplete="list" /></div>
9
+ <div class="country-list-scroll" role="listbox" id="${L(t)}" tabindex="-1"></div>
10
10
  <div class="country-empty" hidden>No countries found</div>
11
11
  </div>
12
12
  </div>`;this.innerHTML=`
13
13
  <div class="phone-input-wrap">
14
14
  ${n}
15
- <input type="tel" class="input" placeholder="${I(e)}" value="${I(E(this._country,this._national))}"${this.getAttribute(`aria-label`)?` aria-label="${I(this.getAttribute(`aria-label`))}"`:``}${this.getAttribute(`aria-describedby`)?` aria-describedby="${I(this.getAttribute(`aria-describedby`))}"`:``}${this.hasAttribute(`required`)?` required aria-required="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``} />
16
- </div>`,this._rendered=!0,(0,i.syncFormMirror)(this,this.value),this._wire()}_ensureItems(){let e=this.querySelector(`.country-list-scroll`);if(!e||e.querySelector(`.country-dropdown-item`))return;let t=this._listboxId,n=u.map(([e,n,r],i)=>`<button type="button" role="option" id="${I(`${t}-opt-${i}`)}" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}" aria-selected="${e===this._country}"><span class="${b(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join(``);e.insertAdjacentHTML(`afterbegin`,n)}_itemEls(){return[...this.querySelectorAll(`.country-dropdown-item`)]}_visibleItems(){return this._itemEls().filter(e=>!e.hidden)}_wire(){this._teardown();let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),r=this.querySelector(`.country-dropdown-menu`),i=this.querySelector(`.dropdown-search-input`),a=this.querySelector(`.country-list-scroll`),s=this.querySelector(`.country-empty`),c=this.querySelector(`input[type=tel]`),l=this.querySelector(`[data-flag]`),u=this.querySelector(`[data-dial]`),f=()=>!!r&&!r.hidden,p=()=>(0,n.anchorOverlay)(t||e,r),m=(e,{reveal:t=!0}={})=>{let n=this._visibleItems();this._active=e,(0,o.moveActiveRow)(a,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),i?.setAttribute(`aria-activedescendant`,n[e].id)):i?.removeAttribute(`aria-activedescendant`)},h=()=>{f()&&p()},g=()=>{this._ensureItems(),r.hidden=!1,e.setAttribute(`aria-expanded`,`true`),i.value=``,v(``),p(),(0,n.bindReanchor)(this,h),i.focus(),m(this._visibleItems().findIndex(e=>e.classList.contains(`selected`)))},_=()=>{r.hidden=!0,e.setAttribute(`aria-expanded`,`false`),m(-1),(0,n.unbindReanchor)(this)},v=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of this._itemEls()){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}s&&(s.hidden=n>0)},y=e=>{this._country=e,this.getAttribute(`country`)!==e&&(this._suppressCountryRender=!0,this.setAttribute(`country`,e),this._suppressCountryRender=!1),l&&(l.className=b(e)),u&&(u.textContent=`+${d(e)}`);for(let t of this._itemEls()){let n=t.dataset.iso===e;t.classList.toggle(`selected`,n),t.setAttribute(`aria-selected`,String(n))}!this.getAttribute(`placeholder`)&&c&&(c.placeholder=k(e)||`Enter phone number`),c&&this._national&&(c.value=E(e,this._national)),_(),this._syncMirror(),this._emitChange(),this._validateOnInput&&S(C()),c?.focus()},x=t=>{let n=this._visibleItems();if(t.key===`ArrowDown`){if(t.preventDefault(),!f()){g();return}m(Math.min(this._active+1,n.length-1))}else if(t.key===`ArrowUp`){if(t.preventDefault(),!f())return;m(Math.max(this._active-1,0))}else t.key===`Enter`?(t.preventDefault(),f()&&n[this._active]&&y(n[this._active].dataset.iso)):t.key===`Escape`&&f()&&(t.preventDefault(),t.stopPropagation(),_(),e.focus())};e?.addEventListener(`click`,()=>f()?_():g()),e?.addEventListener(`keydown`,e=>{f()?x(e):(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),g())}),i?.addEventListener(`input`,()=>{v(i.value);let e=this._visibleItems();m(e.length?0:-1)}),a?.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&y(t.dataset.iso)}),a?.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&!t.classList.contains(`is-active`)&&m(this._visibleItems().indexOf(t),{reveal:!1})}),a?.addEventListener(`mouseleave`,()=>m(-1)),r?.addEventListener(`keydown`,x);let S=e=>{c.classList.toggle(`is-invalid`,e),e?c.setAttribute(`aria-invalid`,`true`):c.removeAttribute(`aria-invalid`);let n=this.querySelector(`[data-phone-error]`);if(e&&!this.hasAttribute(`external-error`)){n||(n=document.createElement(`div`),n.className=`field-error`,n.id=`${this.id}-phone-error`,n.setAttribute(`data-phone-error`,``),t.after(n));let e=O(this._country);n.textContent=this._country?e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`:`Choose a country`}else n?.remove();this._syncDescribedBy()},C=()=>this._national.length>0&&(!this._country||A(this.value)===!1);c.addEventListener(`input`,e=>{e.stopPropagation();let t=c.selectionStart??c.value.length,n=c.value.slice(0,t).replace(/[^0-9]/g,``).length,r=c.value.replace(/[^0-9]/g,``),i=j(this._country);if(i&&r.length>i){let e=M(this._country,r,i);e?(n=Math.max(0,n-(r.length-e.length)),r=e):r=r.slice(0,i)}this._national=r;let a=E(this._country,this._national);if(c.value!==a){c.value=a;let e=D(a,Math.min(n,r.length));c.setSelectionRange(e,e)}this._syncMirror(),this._emitInput(),this._validateOnInput&&S(C())}),c.addEventListener(`change`,e=>e.stopPropagation()),c.addEventListener(`blur`,()=>{let e=C();S(e),e&&(this._validateOnInput=!0),this.value!==this._committedValue&&this._emitChange()}),c.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text`),n=this._locked?P(this._locked,t):N(t);n&&(e.preventDefault(),this._national=n.national.replace(/[^0-9]/g,``),n.country===this._country?c.value=E(this._country,this._national):(this._country=n.country,this.setAttribute(`country`,n.country)),this._syncMirror(),this._emitInput(),this._emitChange(),this._validateOnInput&&c.isConnected&&S(C()),this.querySelector(`input[type=tel]`)?.focus())}),this._bindGlobal=()=>{this._teardownGlobals?.(),this._onDocClick=e=>{f()&&!this.contains(e.target)&&_()},document.addEventListener(`click`,this._onDocClick),f()&&(0,n.bindReanchor)(this,h)},this._teardownGlobals=()=>{this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),(0,n.unbindReanchor)(this)},this._bindGlobal(),this._validateOnInput&&S(C()),w().then(e=>{if(e&&c.isConnected&&(this._national&&(c.value=E(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=k(this._country);e&&(c.placeholder=e)}}),this._syncMirror()}_teardown(){this._teardownGlobals?.()}disconnectedCallback(){this._teardown()}},I=e=>String(e??``).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-phone`,F);var L=e=>{if(e==null)return null;let t=String(e).split(`,`).map(e=>e.trim().toUpperCase()).filter(Boolean);return t.length?new Set(t):null},R=e=>{let t=L(e);return u.filter(([e])=>!t||t.has(e)).map(([e,t])=>({value:e,label:t,flag:e}))},z=class extends c.WuiSelect{static get observedAttributes(){return[...c.WuiSelect.observedAttributes,`countries`]}_readOptions(){let e=this.getAttribute(`countries`);return this._countryCache?.attr!==e&&(this._countryCache={attr:e,options:R(e)}),this._countryCache.options}};(0,t.defineElement)(`wui-country-select`,z),e.WuiCountrySelect=z,e.WuiPhone=F})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.loader,WeborityUiElementsInternal.modules.WuiSelect);
15
+ <input type="tel" class="input" placeholder="${L(e)}" value="${L(D(this._country,this._national))}"${this.getAttribute(`aria-label`)?` aria-label="${L(this.getAttribute(`aria-label`))}"`:``}${this.getAttribute(`aria-describedby`)?` aria-describedby="${L(this.getAttribute(`aria-describedby`))}"`:``}${this.hasAttribute(`required`)?` required aria-required="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}${(0,i.isInert)(this)?` readonly`:``} />
16
+ </div>`,this._rendered=!0,(0,i.syncFieldState)(this,this.querySelector(`input.input`)),(0,a.syncFormMirror)(this,this.value),this._wire()}_ensureItems(){let e=this.querySelector(`.country-list-scroll`);if(!e||e.querySelector(`.country-dropdown-item`))return;let t=this._listboxId,n=d.map(([e,n,r],i)=>`<button type="button" role="option" id="${L(`${t}-opt-${i}`)}" class="country-dropdown-item${e===this._country?` selected`:``}" data-iso="${e}" aria-selected="${e===this._country}"><span class="${x(e)}" aria-hidden="true"></span><span class="country-name-text">${n}<span class="country-code-text">+${r}</span></span></button>`).join(``);e.insertAdjacentHTML(`afterbegin`,n)}_itemEls(){return[...this.querySelectorAll(`.country-dropdown-item`)]}_visibleItems(){return this._itemEls().filter(e=>!e.hidden)}_wire(){this._teardown();let e=this.querySelector(`.country-toggle`),t=this.querySelector(`.phone-input-wrap`),r=this.querySelector(`.country-dropdown-menu`),a=this.querySelector(`.dropdown-search-input`),o=this.querySelector(`.country-list-scroll`),c=this.querySelector(`.country-empty`),l=this.querySelector(`input[type=tel]`),u=this.querySelector(`[data-flag]`),d=this.querySelector(`[data-dial]`),p=()=>!!r&&!r.hidden,m=()=>(0,n.anchorOverlay)(t||e,r),h=(e,{reveal:t=!0}={})=>{let n=this._visibleItems();this._active=e,(0,s.moveActiveRow)(o,e>=0&&n[e]||null),e>=0&&n[e]?(t&&n[e].scrollIntoView({block:`nearest`}),a?.setAttribute(`aria-activedescendant`,n[e].id)):a?.removeAttribute(`aria-activedescendant`)},g=()=>{p()&&m()},_=()=>{(0,i.isInert)(this)||(this._ensureItems(),r.hidden=!1,e.setAttribute(`aria-expanded`,`true`),a.value=``,y(``),m(),(0,n.bindReanchor)(this,g),a.focus(),h(this._visibleItems().findIndex(e=>e.classList.contains(`selected`))))},v=()=>{r.hidden=!0,e.setAttribute(`aria-expanded`,`false`),h(-1),(0,n.unbindReanchor)(this)},y=e=>{let t=e.trim().toLowerCase(),n=0;for(let e of this._itemEls()){let r=!t||e.textContent.toLowerCase().includes(t);e.hidden=!r,r&&(n+=1)}c&&(c.hidden=n>0)},b=e=>{this._country=e,this.getAttribute(`country`)!==e&&(this._suppressCountryRender=!0,this.setAttribute(`country`,e),this._suppressCountryRender=!1),u&&(u.className=x(e)),d&&(d.textContent=`+${f(e)}`);for(let t of this._itemEls()){let n=t.dataset.iso===e;t.classList.toggle(`selected`,n),t.setAttribute(`aria-selected`,String(n))}!this.getAttribute(`placeholder`)&&l&&(l.placeholder=A(e)||`Enter phone number`),l&&this._national&&(l.value=D(e,this._national)),v(),this._syncMirror(),this._emitChange(),this._validateOnInput&&C(w()),l?.focus()},S=t=>{let n=this._visibleItems();if(t.key===`ArrowDown`){if(t.preventDefault(),!p()){_();return}h(Math.min(this._active+1,n.length-1))}else if(t.key===`ArrowUp`){if(t.preventDefault(),!p())return;h(Math.max(this._active-1,0))}else t.key===`Enter`?(t.preventDefault(),p()&&n[this._active]&&b(n[this._active].dataset.iso)):t.key===`Escape`&&p()&&(t.preventDefault(),t.stopPropagation(),v(),e.focus())};e?.addEventListener(`click`,()=>p()?v():_()),e?.addEventListener(`keydown`,e=>{p()?S(e):(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_())}),a?.addEventListener(`input`,()=>{y(a.value);let e=this._visibleItems();h(e.length?0:-1)}),o?.addEventListener(`click`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&b(t.dataset.iso)}),o?.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.country-dropdown-item`);t&&!t.classList.contains(`is-active`)&&h(this._visibleItems().indexOf(t),{reveal:!1})}),o?.addEventListener(`mouseleave`,()=>h(-1)),r?.addEventListener(`keydown`,S);let C=e=>{l.classList.toggle(`is-invalid`,e),e?l.setAttribute(`aria-invalid`,`true`):l.removeAttribute(`aria-invalid`);let n=this.querySelector(`[data-phone-error]`);if(e&&!this.hasAttribute(`external-error`)){n||(n=document.createElement(`div`),n.className=`field-error`,n.id=`${this.id}-phone-error`,n.setAttribute(`data-phone-error`,``),t.after(n));let e=k(this._country);n.textContent=this._country?e?`Enter a valid phone number, e.g. ${e}`:`Enter a valid phone number`:`Choose a country`}else n?.remove();this._syncDescribedBy()},w=()=>this._national.length>0&&(!this._country||j(this.value)===!1);l.addEventListener(`input`,e=>{e.stopPropagation();let t=l.selectionStart??l.value.length,n=l.value.slice(0,t).replace(/[^0-9]/g,``).length,r=l.value.replace(/[^0-9]/g,``),i=M(this._country);if(i&&r.length>i){let e=N(this._country,r,i);e?(n=Math.max(0,n-(r.length-e.length)),r=e):r=r.slice(0,i)}this._national=r;let a=D(this._country,this._national);if(l.value!==a){l.value=a;let e=O(a,Math.min(n,r.length));l.setSelectionRange(e,e)}this._syncMirror(),this._emitInput(),this._validateOnInput&&C(w())}),l.addEventListener(`change`,e=>e.stopPropagation()),l.addEventListener(`blur`,()=>{let e=w();C(e),e&&(this._validateOnInput=!0),this.value!==this._committedValue&&this._emitChange()}),l.addEventListener(`paste`,e=>{let t=e.clipboardData?.getData(`text`),n=this._locked?F(this._locked,t):P(t);n&&(e.preventDefault(),this._national=n.national.replace(/[^0-9]/g,``),n.country===this._country?l.value=D(this._country,this._national):(this._country=n.country,this.setAttribute(`country`,n.country)),this._syncMirror(),this._emitInput(),this._emitChange(),this._validateOnInput&&l.isConnected&&C(w()),this.querySelector(`input[type=tel]`)?.focus())}),this._bindGlobal=()=>{this._teardownGlobals?.(),this._onDocClick=e=>{p()&&!this.contains(e.target)&&v()},document.addEventListener(`click`,this._onDocClick),p()&&(0,n.bindReanchor)(this,g)},this._teardownGlobals=()=>{this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),(0,n.unbindReanchor)(this)},this._bindGlobal(),this._validateOnInput&&C(w()),T().then(e=>{if(e&&l.isConnected&&(this._national&&(l.value=D(this._country,this._national)),!this.getAttribute(`placeholder`))){let e=A(this._country);e&&(l.placeholder=e)}}),this._syncMirror()}_teardown(){this._teardownGlobals?.()}disconnectedCallback(){this._teardown()}},L=e=>String(e??``).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-phone`,I);var R=e=>{if(e==null)return null;let t=String(e).split(`,`).map(e=>e.trim().toUpperCase()).filter(Boolean);return t.length?new Set(t):null},z=e=>{let t=R(e);return d.filter(([e])=>!t||t.has(e)).map(([e,t])=>({value:e,label:t,flag:e}))},B=class extends l.WuiSelect{static get observedAttributes(){return[...l.WuiSelect.observedAttributes,`countries`]}_readOptions(){let e=this.getAttribute(`countries`);return this._countryCache?.attr!==e&&(this._countryCache={attr:e,options:z(e)}),this._countryCache.options}};(0,t.defineElement)(`wui-country-select`,B),e.WuiCountrySelect=B,e.WuiPhone=I})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.anchorOverlay,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.formMirror,WeborityUiElementsInternal.modules.iconGlyphs,WeborityUiElementsInternal.modules.listboxKeyNav,WeborityUiElementsInternal.modules.loader,WeborityUiElementsInternal.modules.WuiSelect);
@@ -1 +1 @@
1
- (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.128.0`)throw Error(`[webority-ui] resizable expects ui-elements 0.128.0 but the page loaded `+r+`.`);var i=`wui-resizable-panel`,a=`wui-resizable-handle`,o=5,s=20,c=10,l=`wui-resizable:`,u=.001,d=0,f=e=>e.reduce((e,t)=>e+t,0),p=(e,t,n)=>Math.min(Math.max(e,t),n),m=e=>Math.round(e*10)/10,h=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<u);function g(e,t,n){let r=e.map((e,r)=>p(e,t[r],n[r]));for(let e=0;e<r.length;e++){let e=100-f(r);if(Math.abs(e)<u)break;let i=r.map((r,i)=>e>0?n[i]-r:r-t[i]),a=f(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*i[n]/a)}return r}function _(e,t,n,r){let i=e[t]+e[t+1];return[Math.max(n[t],i-r[t+1]),Math.min(r[t],i-n[t+1])]}function v(e,t,n,r,i){let[a,o]=_(e,t,r,i);if(a>o)return e;let s=e[t]+e[t+1],c=p(e[t]+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function y(e){let t=e.filter(e=>e===null).length,n=f(e.filter(e=>e!==null));if(t>0&&n<100)return e.map(e=>e??(100-n)/t);let r=e.map(e=>e??1),i=f(r);return r.map(e=>e*100/i)}var b=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t));return Number.isFinite(n)&&n>0?n:null},x=class extends n.ElementBase{constructor(){super(),this._panels=[],this._handles=[],this._mins=[],this._maxs=[],this._defaults=[],this._sizes=null,this._drag=null,this._observer=null,this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e,!1),this._onPointerCancel=e=>this._pointerUp(e,!0),this._onKeyDown=e=>this._keyDown(e),this._onDoubleClick=e=>this._reset(e)}connectedCallback(){this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`pointercancel`,this._onPointerCancel),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`dblclick`,this._onDoubleClick),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0})),this._sync()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`pointercancel`,this._onPointerCancel),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`dblclick`,this._onDoubleClick),this._observer?.disconnect(),this._observer=null,this._drag=null}get sizes(){return this._sizes?[...this._sizes]:[]}get _vertical(){return this.getAttribute(`direction`)===`vertical`}_sync(){let e=[...this.children];this._panels=e.filter(e=>e.classList.contains(i)),this._handles=e.filter(e=>e.classList.contains(a));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>b(e,`data-min-size`)??c),this._maxs=this._panels.map(e=>b(e,`data-max-size`)??100),this._defaults=g(y(this._panels.map(e=>b(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=g(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++d}`;this._render()}_render(){this._panels.forEach((e,t)=>{e.style.flex=`${m(this._sizes[t])} 1 0px`});for(let e of this._handles){let t=this._indexOf(e);if(t<0)continue;let[n,r]=_(this._sizes,t,this._mins,this._maxs);e.setAttribute(`aria-controls`,this._panels[t].id),e.setAttribute(`aria-valuenow`,String(Math.round(this._sizes[t]))),e.setAttribute(`aria-valuemin`,String(Math.ceil(n-u))),e.setAttribute(`aria-valuemax`,String(Math.floor(r+u)))}}_indexOf(e){let t=this._panels.indexOf(e.previousElementSibling);return t>=0&&e.nextElementSibling===this._panels[t+1]?t:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${a}`):null;if(!t||t.parentElement!==this)return null;let n=this._indexOf(t);return n<0?null:{handle:t,index:n}}_storageKey(){let e=this.getAttribute(`storage-key`);return e?l+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return Array.isArray(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=this._mins[t]-u&&e<=this._maxs[t]+u)&&Math.abs(f(n)-100)<.5?n:null}catch{return null}}_save(){let e=this._storageKey();if(e)try{globalThis.localStorage?.setItem(e,JSON.stringify(this._sizes.map(m)))}catch{}}_commit(e){h(e,this._sizes)||(this._save(),this.dispatchEvent(new CustomEvent(`wui-resizable:change`,{bubbles:!0,detail:{sizes:this.sizes}})))}_pointerDown(e){let t=this._handleFor(e);if(!t||e.pointerType===`mouse`&&e.button!==0)return;let n=this._panels.reduce((e,t)=>{let n=t.getBoundingClientRect();return e+(this._vertical?n.height:n.width)},0);n<=0||(e.preventDefault(),t.handle.setPointerCapture?.(e.pointerId),t.handle.focus?.({preventScroll:!0}),this._drag={...t,pointerId:e.pointerId,start:this._vertical?e.clientY:e.clientX,before:[...this._sizes],room:n,flip:!this._vertical&&getComputedStyle(this).direction===`rtl`},this.classList.add(`is-dragging`),t.handle.classList.add(`is-active`))}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.pointerId)return;let n=(this._vertical?e.clientY:e.clientX)-t.start,r=(t.flip?-n:n)*100/t.room;this._sizes=v(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;n&&e.pointerId===n.pointerId&&(this._drag=null,this.classList.remove(`is-dragging`),n.handle.classList.remove(`is-active`),n.handle.releasePointerCapture?.(e.pointerId),t?(this._sizes=n.before,this._render()):this._commit(n.before))}_keyDown(e){let t=this._handleFor(e);if(!t||e.altKey||e.ctrlKey||e.metaKey)return;let[n,r]=this._vertical?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`],i=!this._vertical&&getComputedStyle(this).direction===`rtl`,a=e.shiftKey?s:o,c;if(e.key===n)c=i?a:-a;else if(e.key===r)c=i?-a:a;else if(e.key===`Home`)c=-1/0;else if(e.key===`End`)c=1/0;else return;e.preventDefault();let l=[...this._sizes];this._sizes=v(l,t.index,c,this._mins,this._maxs),this._render(),this._commit(l)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes];this._sizes=[...this._defaults],this._render(),this._commit(t)}};(0,t.defineElement)(`wui-resizable`,x),e.WuiResizable=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=globalThis.WeborityUiElementsInternal?.version;if(r!==`0.129.0`)throw Error(`[webority-ui] resizable expects ui-elements 0.129.0 but the page loaded `+r+`.`);var i=`wui-resizable-panel`,a=`wui-resizable-handle`,o=5,s=20,c=10,l=`wui-resizable:`,u=.001,d=0,f=e=>e.reduce((e,t)=>e+t,0),p=(e,t,n)=>Math.min(Math.max(e,t),n),m=e=>Math.round(e*10)/10,h=(e,t)=>e.length===t.length&&e.every((e,n)=>Math.abs(e-t[n])<u);function g(e,t,n){let r=e.map((e,r)=>p(e,t[r],n[r]));for(let e=0;e<r.length;e++){let e=100-f(r);if(Math.abs(e)<u)break;let i=r.map((r,i)=>e>0?n[i]-r:r-t[i]),a=f(i);if(a<=0)break;let o=Math.min(Math.abs(e),a);r=r.map((t,n)=>t+Math.sign(e)*o*i[n]/a)}return r}function _(e,t,n,r){let i=e[t]+e[t+1];return[Math.max(n[t],i-r[t+1]),Math.min(r[t],i-n[t+1])]}function v(e,t,n,r,i){let[a,o]=_(e,t,r,i);if(a>o)return e;let s=e[t]+e[t+1],c=p(e[t]+n,a,o),l=[...e];return l[t]=c,l[t+1]=s-c,l}function y(e){let t=e.filter(e=>e===null).length,n=f(e.filter(e=>e!==null));if(t>0&&n<100)return e.map(e=>e??(100-n)/t);let r=e.map(e=>e??1),i=f(r);return r.map(e=>e*100/i)}var b=(e,t)=>{let n=Number.parseFloat(e.getAttribute(t));return Number.isFinite(n)&&n>0?n:null},x=class extends n.ElementBase{constructor(){super(),this._panels=[],this._handles=[],this._mins=[],this._maxs=[],this._defaults=[],this._sizes=null,this._drag=null,this._observer=null,this._onPointerDown=e=>this._pointerDown(e),this._onPointerMove=e=>this._pointerMove(e),this._onPointerUp=e=>this._pointerUp(e,!1),this._onPointerCancel=e=>this._pointerUp(e,!0),this._onKeyDown=e=>this._keyDown(e),this._onDoubleClick=e=>this._reset(e)}connectedCallback(){this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`pointermove`,this._onPointerMove),this.addEventListener(`pointerup`,this._onPointerUp),this.addEventListener(`pointercancel`,this._onPointerCancel),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`dblclick`,this._onDoubleClick),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._sync()),this._observer.observe(this,{childList:!0})),this._sync()}disconnectedCallback(){this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`pointermove`,this._onPointerMove),this.removeEventListener(`pointerup`,this._onPointerUp),this.removeEventListener(`pointercancel`,this._onPointerCancel),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`dblclick`,this._onDoubleClick),this._observer?.disconnect(),this._observer=null,this._drag=null}get sizes(){return this._sizes?[...this._sizes]:[]}get _vertical(){return this.getAttribute(`direction`)===`vertical`}_sync(){let e=[...this.children];this._panels=e.filter(e=>e.classList.contains(i)),this._handles=e.filter(e=>e.classList.contains(a));let t=this._panels.length;if(t===0)return;this._mins=this._panels.map(e=>b(e,`data-min-size`)??c),this._maxs=this._panels.map(e=>b(e,`data-max-size`)??100),this._defaults=g(y(this._panels.map(e=>b(e,`data-default-size`))),this._mins,this._maxs);let n=this._sizes&&this._sizes.length===t?this._sizes:null;this._sizes=g(n??this._load(t)??this._defaults,this._mins,this._maxs);for(let e of this._panels)e.id||=`wui-resizable-panel-${++d}`;this._render()}_render(){this._panels.forEach((e,t)=>{e.style.flex=`${m(this._sizes[t])} 1 0px`});for(let e of this._handles){let t=this._indexOf(e);if(t<0)continue;let[n,r]=_(this._sizes,t,this._mins,this._maxs);e.setAttribute(`aria-controls`,this._panels[t].id),e.setAttribute(`aria-valuenow`,String(Math.round(this._sizes[t]))),e.setAttribute(`aria-valuemin`,String(Math.ceil(n-u))),e.setAttribute(`aria-valuemax`,String(Math.floor(r+u)))}}_indexOf(e){let t=this._panels.indexOf(e.previousElementSibling);return t>=0&&e.nextElementSibling===this._panels[t+1]?t:-1}_handleFor(e){let t=e.target instanceof Element?e.target.closest(`.${a}`):null;if(!t||t.parentElement!==this)return null;let n=this._indexOf(t);return n<0?null:{handle:t,index:n}}_storageKey(){let e=this.getAttribute(`storage-key`);return e?l+e:null}_load(e){let t=this._storageKey();if(!t)return null;try{let n=JSON.parse(globalThis.localStorage?.getItem(t)??`null`);return Array.isArray(n)&&n.length===e&&n.every((e,t)=>Number.isFinite(e)&&e>=this._mins[t]-u&&e<=this._maxs[t]+u)&&Math.abs(f(n)-100)<.5?n:null}catch{return null}}_save(){let e=this._storageKey();if(e)try{globalThis.localStorage?.setItem(e,JSON.stringify(this._sizes.map(m)))}catch{}}_commit(e){h(e,this._sizes)||(this._save(),this.dispatchEvent(new CustomEvent(`wui-resizable:change`,{bubbles:!0,detail:{sizes:this.sizes}})))}_pointerDown(e){let t=this._handleFor(e);if(!t||e.pointerType===`mouse`&&e.button!==0)return;let n=this._panels.reduce((e,t)=>{let n=t.getBoundingClientRect();return e+(this._vertical?n.height:n.width)},0);n<=0||(e.preventDefault(),t.handle.setPointerCapture?.(e.pointerId),t.handle.focus?.({preventScroll:!0}),this._drag={...t,pointerId:e.pointerId,start:this._vertical?e.clientY:e.clientX,before:[...this._sizes],room:n,flip:!this._vertical&&getComputedStyle(this).direction===`rtl`},this.classList.add(`is-dragging`),t.handle.classList.add(`is-active`))}_pointerMove(e){let t=this._drag;if(!t||e.pointerId!==t.pointerId)return;let n=(this._vertical?e.clientY:e.clientX)-t.start,r=(t.flip?-n:n)*100/t.room;this._sizes=v(t.before,t.index,r,this._mins,this._maxs),this._render()}_pointerUp(e,t){let n=this._drag;n&&e.pointerId===n.pointerId&&(this._drag=null,this.classList.remove(`is-dragging`),n.handle.classList.remove(`is-active`),n.handle.releasePointerCapture?.(e.pointerId),t?(this._sizes=n.before,this._render()):this._commit(n.before))}_keyDown(e){let t=this._handleFor(e);if(!t||e.altKey||e.ctrlKey||e.metaKey)return;let[n,r]=this._vertical?[`ArrowUp`,`ArrowDown`]:[`ArrowLeft`,`ArrowRight`],i=!this._vertical&&getComputedStyle(this).direction===`rtl`,a=e.shiftKey?s:o,c;if(e.key===n)c=i?a:-a;else if(e.key===r)c=i?-a:a;else if(e.key===`Home`)c=-1/0;else if(e.key===`End`)c=1/0;else return;e.preventDefault();let l=[...this._sizes];this._sizes=v(l,t.index,c,this._mins,this._maxs),this._render(),this._commit(l)}_reset(e){if(!this._handleFor(e))return;let t=[...this._sizes];this._sizes=[...this._defaults],this._render(),this._commit(t)}};(0,t.defineElement)(`wui-resizable`,x),e.WuiResizable=x})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase);
@@ -1 +1 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.128.0`)throw Error(`[webority-ui] saved-views expects ui-elements 0.128.0 but the page loaded `+i+`.`);var a=`wui-saved-views:`,o=20,s=e=>typeof e?.name==`string`&&typeof e?.query==`string`,c=class extends r.ElementBase{static get observedAttributes(){return[`key`]}constructor(){super(),this._doc=null,this._views=[],this._open=!1,this._trigger=null,this._menu=null,this._divider=null,this._form=null,this._input=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{e.key===`Escape`&&this._open&&(e.stopPropagation(),this._setOpen(!1),this._trigger.focus())},this._onPointerDown=e=>{this._open&&!this.contains(e.target)&&this._setOpen(!1)},this._onSubmit=e=>{e.preventDefault();let t=this._input.value.trim();if(!t)return;let n=this._doc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,o)),this._input.value=``}}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),this._views=this._load(),this._render()}disconnectedCallback(){this._setOpen(!1),this._doc=null}attributeChangedCallback(){this._doc&&this._trigger&&(this._views=this._load(),this._render())}_build(){let e=this._doc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`outline-secondary`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=`Views`,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick),this._menu=e.createElement(`div`),this._menu.className=`dropdown-menu`,this._divider=e.createElement(`div`),this._divider.className=`dropdown-divider`,this._input=e.createElement(`input`),this._input.type=`text`,this._input.className=`form-control form-control-sm`,this._input.setAttribute(`aria-label`,`View name`),this._input.placeholder=`Name this view`;let t=e.createElement(`button`);t.type=`submit`,t.className=(0,n.buttonClass)(`primary`,`sm`),t.dataset.wui=n.APP_BUTTON_MARKER,t.textContent=`Save this view`,this._form=e.createElement(`form`),this._form.className=`d-flex gap-2 px-3 py-2`,this._form.append(this._input,t),this._form.addEventListener(`submit`,this._onSubmit),this.append(this._trigger,this._menu),this.addEventListener(`keydown`,this._onKeyDown)}_render(){let e=this._doc,t=[];for(let n of this._views){let r=e.createElement(`a`);r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+n.query),r.textContent=n.name;let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=`Delete`,i.setAttribute(`aria-label`,`Delete ${n.name}`),i.addEventListener(`click`,()=>this._commit(this._views.filter(e=>e.name!==n.name))),t.push(r,i)}this._menu.replaceChildren(...t,this._divider,this._form)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._menu.classList.toggle(`show`,e),this._trigger.setAttribute(`aria-expanded`,String(e)),e?this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{return{store:this._doc.defaultView.localStorage,key:a+e}}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(s).slice(0,o):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch{}}};(0,t.defineElement)(`wui-saved-views`,c),e.WuiSavedViews=c})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase);
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.129.0`)throw Error(`[webority-ui] saved-views expects ui-elements 0.129.0 but the page loaded `+a+`.`);var o=`wui-saved-views:`,s=20,c=e=>typeof e?.name==`string`&&typeof e?.query==`string`,l=class extends r.ElementBase{static get observedAttributes(){return[`key`,`mode`,`action`]}constructor(){super(),this._doc=null,this._views=[],this._open=!1,this._busy=!1,this._error=null,this._trigger=null,this._menu=null,this._divider=null,this._form=null,this._input=null,this._save=null,this._onTriggerClick=()=>this._setOpen(!this._open),this._onKeyDown=e=>{e.key===`Escape`&&this._open&&(e.stopPropagation(),this._setOpen(!1),this._trigger.focus())},this._onPointerDown=e=>{this._open&&!this.contains(e.target)&&this._setOpen(!1)},this._onSubmit=async e=>{e.preventDefault();let t=this._input.value.trim();if(!t)return;if(this._server()){if(this._busy)return;await this._request(`save`,{name:t,query:this._doc.location.search})&&(this._input.value=``);return}let n=this._doc.location.search;this._commit([{name:t,query:n},...this._views.filter(e=>e.name!==t)].slice(0,s)),this._input.value=``}}connectedCallback(){this._doc=this.ownerDocument,this._trigger||this._build(),this._reload()}disconnectedCallback(){this._setOpen(!1),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`)}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 l=await(0,i.wuiFetch)(a,o);if(this._busy=!1,this._doc===null)return!1;if(l.ok){let e=new DOMParser().parseFromString(l.html,`text/html`);return this._views=[...e.querySelectorAll(`[data-wui-saved-views-items] > li`)].map(e=>({name:e.dataset.name,query:e.dataset.query})).filter(c).slice(0,s),this._error=null,this._render(),!0}return this._error=l.message||`The views could not be updated. Try again.`,this._render(),!1}_build(){let e=this._doc;this.classList.add(`dropdown`),this._trigger=e.createElement(`button`),this._trigger.type=`button`,this._trigger.className=(0,n.buttonClass)(`outline-secondary`,`sm`),this._trigger.dataset.wui=n.APP_BUTTON_MARKER,this._trigger.textContent=`Views`,this._trigger.setAttribute(`aria-haspopup`,`true`),this._trigger.setAttribute(`aria-expanded`,`false`),this._trigger.addEventListener(`click`,this._onTriggerClick),this._menu=e.createElement(`div`),this._menu.className=`dropdown-menu`,this._divider=e.createElement(`div`),this._divider.className=`dropdown-divider`,this._input=e.createElement(`input`),this._input.type=`text`,this._input.className=`form-control form-control-sm`,this._input.setAttribute(`aria-label`,`View name`),this._input.placeholder=`Name this view`;let t=e.createElement(`button`);t.type=`submit`,t.className=(0,n.buttonClass)(`primary`,`sm`),t.dataset.wui=n.APP_BUTTON_MARKER,t.textContent=`Save this view`,this._save=t,this._form=e.createElement(`form`),this._form.className=`d-flex gap-2 px-3 py-2`,this._form.append(this._input,t),this._form.addEventListener(`submit`,this._onSubmit),this.append(this._trigger,this._menu),this.addEventListener(`keydown`,this._onKeyDown)}_render(){let e=this._doc,t=[];for(let n of this._views){let r=e.createElement(`a`);r.className=`dropdown-item`,r.setAttribute(`href`,e.location.pathname+n.query),r.textContent=n.name;let i=e.createElement(`button`);i.type=`button`,i.className=`btn btn-link btn-sm`,i.textContent=`Delete`,i.setAttribute(`aria-label`,`Delete ${n.name}`),i.disabled=this._busy,i.addEventListener(`click`,()=>this._server()?this._request(`delete`,{name:n.name}):this._commit(this._views.filter(e=>e.name!==n.name))),t.push(r,i)}if(this._error){let n=e.createElement(`div`);n.className=`dropdown-item-text text-danger small`,n.setAttribute(`role`,`alert`),n.textContent=this._error,t.push(n)}this._save.disabled=this._busy,this._menu.replaceChildren(...t,this._divider,this._form)}_commit(e){this._views=e,this._write(e),this._render()}_setOpen(e){e!==this._open&&(this._open=e,this._menu.classList.toggle(`show`,e),this._trigger.setAttribute(`aria-expanded`,String(e)),e?this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0):this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0))}_storage(){let e=this.getAttribute(`key`);if(!e)return null;try{return{store:this._doc.defaultView.localStorage,key:o+e}}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(c).slice(0,s):[]}catch{return[]}}_write(e){let t=this._storage();if(t)try{t.store.setItem(t.key,JSON.stringify(e))}catch{}}};(0,t.defineElement)(`wui-saved-views`,l),e.WuiSavedViews=l})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.buttonClass,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.wuiHttp);
@@ -1,5 +1,5 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.128.0`)throw Error(`[webority-ui] slider expects ui-elements 0.128.0 but the page loaded `+i+`.`);var a=class extends n.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){this._rendered?this._wire():this.render()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(o(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(o(e,this._start))),this._end),this._syncValue(),this._syncMirrors()}get end(){return this._end}set end(e){this._end=Math.max(this._snapToStep(this._clamp(o(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`?(this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors())):this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(o(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(o(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(o(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return o(this.getAttribute(`min`),0)}_max(){return o(this.getAttribute(`max`),100)}_step(){return o(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),r=this.getAttribute(`size`),i=r===`sm`?` slider-sm`:r===`lg`?` slider-lg`:``,a=this.hasAttribute(`disabled`);n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value),this.innerHTML=`
2
- <div class="slider${i}">
1
+ (function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=globalThis.WeborityUiElementsInternal?.version;if(a!==`0.129.0`)throw Error(`[webority-ui] slider expects ui-elements 0.129.0 but the page loaded `+a+`.`);var o=class extends n.ElementBase{static formAssociated=!0;static get observedAttributes(){return[`min`,`max`,`step`,`value`,`start`,`end`,`name`,`start-name`,`end-name`,`disabled`,`readonly`,`loading`,`size`,`show-value`,`unit`,`aria-label`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=50,this._start=25,this._end=75,this._isDragging=!1,this._dragThumb=null,this._pointerDownListener=null,this._pointerMoveListener=null,this._pointerUpListener=null,this._thumbKeyListener=null,this._trackClickListener=null}connectedCallback(){this._rendered?this._wire():this.render()}get value(){return this._value}set value(e){this._value=this._snapToStep(this._clamp(s(e,this._value))),this._syncValue(),this._syncMirrors()}get start(){return this._start}set start(e){this._start=Math.min(this._snapToStep(this._clamp(s(e,this._start))),this._end),this._syncValue(),this._syncMirrors()}get end(){return this._end}set end(e){this._end=Math.max(this._snapToStep(this._clamp(s(e,this._end))),this._start),this._syncValue(),this._syncMirrors()}attributeChangedCallback(e,t,n){e===`value`||e===`start`||e===`end`||e===`min`||e===`max`||e===`step`?(this._updateFromAttribute(e),this._rendered&&(this._syncValue(),this._syncMirrors())):this._rendered&&this.render()}formResetCallback(){this._isRange()?this._resetRange():this._resetSingle()}_updateFromAttribute(e){e===`value`?this._value=this._snapToStep(this._clamp(s(this.getAttribute(`value`),this._value))):e===`start`?this._start=this._snapToStep(this._clamp(s(this.getAttribute(`start`),this._start))):e===`end`&&(this._end=this._snapToStep(this._clamp(s(this.getAttribute(`end`),this._end))))}_isRange(){return this.hasAttribute(`range`)}_min(){return s(this.getAttribute(`min`),0)}_max(){return s(this.getAttribute(`max`),100)}_step(){return s(this.getAttribute(`step`),1)}_clamp(e){return Math.max(this._min(),Math.min(e,this._max()))}_snapToStep(e){let t=this._step();if(t<=0)return e;let n=this._min();return this._clamp(n+Math.round((e-n)/t)*t)}_captureDefaults(){this._defaultsCaptured||=(this._isRange()?(this._defaultStart=this._start,this._defaultEnd=this._end):this._defaultValue=this._value,!0)}_resetSingle(){this._value=this._defaultValue??50,this._syncValue(),this._syncMirrors()}_resetRange(){this._start=this._defaultStart??25,this._end=this._defaultEnd??75,this._syncValue(),this._syncMirrors()}render(){this._captureDefaults();let e=this._min(),t=this._max(),n=this._isRange(),i=this.getAttribute(`size`),a=i===`sm`?` slider-sm`:i===`lg`?` slider-lg`:``,o=this.hasAttribute(`disabled`),s=this.hasAttribute(`readonly`)?` aria-readonly="true"`:``;n?(this._start=this._clamp(this._start),this._end=this._clamp(this._end),this._start>this._end&&([this._start,this._end]=[this._end,this._start])):this._value=this._clamp(this._value),this.innerHTML=`
2
+ <div class="slider${a}">
3
3
  <div class="wui-slider-rail">
4
4
  <div class="slider-track" role="presentation"></div>
5
5
  <div class="slider-fill" role="presentation"></div>
@@ -14,7 +14,8 @@
14
14
  aria-valuemax="${t}"
15
15
  aria-valuenow="${this._start}"
16
16
  aria-valuetext="${this._formatValue(this._start)}"
17
- ${a?`disabled`:``}
17
+ ${s}
18
+ ${o?`disabled`:``}
18
19
  ></button>
19
20
  <button
20
21
  type="button"
@@ -26,7 +27,8 @@
26
27
  aria-valuemax="${t}"
27
28
  aria-valuenow="${this._end}"
28
29
  aria-valuetext="${this._formatValue(this._end)}"
29
- ${a?`disabled`:``}
30
+ ${s}
31
+ ${o?`disabled`:``}
30
32
  ></button>
31
33
  `:`
32
34
  <button
@@ -38,11 +40,12 @@
38
40
  aria-valuemax="${t}"
39
41
  aria-valuenow="${this._value}"
40
42
  aria-valuetext="${this._formatValue(this._value)}"
41
- ${a?`disabled`:``}
42
- aria-label="${s(this.getAttribute(`aria-label`)||`Value`)}"
43
+ ${s}
44
+ ${o?`disabled`:``}
45
+ aria-label="${c(this.getAttribute(`aria-label`)||`Value`)}"
43
46
  ></button>
44
47
  `}
45
48
  </div>
46
49
  ${this.hasAttribute(`show-value`)?n?`<span class="slider-value">${this._formatValue(this._start)} to ${this._formatValue(this._end)}</span>`:`<span class="slider-value">${this._formatValue(this._value)}</span>`:``}
47
50
  </div>
48
- `,this._rendered=!0,this._placeParts(),this._syncMirrors(),this._wire()}_formatValue(e){return`${e}${this.getAttribute(`unit`)||``}`}_placeParts(){let e=this._min(),t=this._max(),n=n=>t===e?0:(n-e)/(t-e),r=this._isRange(),i=r?n(this._start):0,a=n(r?this._end:this._value),o=this.querySelector(`.slider-fill`);o&&(o.style.left=`${i*100}%`,o.style.right=`${100-a*100}%`,r&&o.style.setProperty(`--wui-fill-start`,String(i)),o.style.setProperty(`--wui-fill-end`,String(a)));let s=(e,t)=>{e&&(e.style.left=`${t*100}%`,e.style.setProperty(`--wui-t`,String(t)))};r?(s(this.querySelector(`[data-thumb="start"]`),i),s(this.querySelector(`[data-thumb="end"]`),a)):s(this.querySelector(`.slider-thumb`),a)}_syncValue(){if(this._rendered){if(this._placeParts(),this._isRange()){let e=this.querySelector(`[data-thumb="start"]`),t=this.querySelector(`[data-thumb="end"]`);e&&(e.setAttribute(`aria-valuenow`,String(this._start)),e.setAttribute(`aria-valuetext`,this._formatValue(this._start))),t&&(t.setAttribute(`aria-valuenow`,String(this._end)),t.setAttribute(`aria-valuetext`,this._formatValue(this._end)));let n=this.querySelector(`.slider-value`);n&&(n.textContent=`${this._formatValue(this._start)} to ${this._formatValue(this._end)}`)}else{let e=this.querySelector(`.slider-thumb`);e&&(e.setAttribute(`aria-valuenow`,String(this._value)),e.setAttribute(`aria-valuetext`,this._formatValue(this._value)));let t=this.querySelector(`.slider-value`);t&&(t.textContent=this._formatValue(this._value))}}}_syncMirrors(){this._isRange()?this._syncRangeMirrors():this._syncSingleMirror()}_syncSingleMirror(){this.getAttribute(`name`)&&(0,r.syncFormMirror)(this,String(this._value))}_syncRangeMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirrorRange(`start`,e,this._start),this._mirrorRange(`end`,t,this._end)}_mirrorRange(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-slider-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-slider-mirror`,e),this.appendChild(r)),r.name=t,r.value=String(n),r.disabled=this.hasAttribute(`disabled`)}_valueAtPosition(e){let t=this.querySelector(`.slider-track`);if(!t)return this._min();let n=t.getBoundingClientRect(),r=this.querySelector(`.slider-thumb`),i=r?r.offsetWidth/2:0,a=n.width-i*2,o=a>0?Math.max(0,Math.min(1,(e-n.left-i)/a)):0,s=this._min()+o*(this._max()-this._min());return this._snapToStep(s)}_nearestThumb(e){return Math.abs(e-this._start)<=Math.abs(e-this._end)?`start`:`end`}_wire(){if(this._teardown(),this.hasAttribute(`disabled`))return;let e=this.querySelectorAll(`.slider-thumb`),t=this.querySelector(`.slider-track`),n=this._isRange();this._pointerDownListener=e=>{if(this.hasAttribute(`disabled`))return;let t=e.target.closest(`.slider-thumb`);t&&(e.preventDefault(),this._isDragging=!0,this._dragThumb=t.getAttribute(`data-thumb`),document.addEventListener(`pointermove`,this._pointerMoveListener),document.addEventListener(`pointerup`,this._pointerUpListener),document.addEventListener(`pointercancel`,this._pointerUpListener))},this._pointerMoveListener=e=>{if(!this._isDragging)return;e.preventDefault();let t=this._valueAtPosition(e.clientX);if(this._dragThumb===`single`)this._value=this._clamp(t),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{value:this._value}}));else if(this._dragThumb===`start`){let e=Math.min(t,this._end);this._start=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}else if(this._dragThumb===`end`){let e=Math.max(t,this._start);this._end=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}},this._pointerUpListener=()=>{this._isDragging&&(this._isDragging=!1,this._dragThumb=null,document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._thumbKeyListener=e=>{let t=e.currentTarget;if(this.hasAttribute(`disabled`))return;let n=this._step(),r=n*10,i=null,a=t.getAttribute(`data-thumb`),o=a===`end`?this._end:a===`start`?this._start:this._value;e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),i=o-n):e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),i=o+n):e.key===`PageDown`?(e.preventDefault(),i=o-r):e.key===`PageUp`?(e.preventDefault(),i=o+r):e.key===`Home`?(e.preventDefault(),i=this._min()):e.key===`End`&&(e.preventDefault(),i=this._max()),i!=null&&(i=this._clamp(i),a===`single`?this._value=i:a===`start`?this._start=Math.min(i,this._end):a===`end`&&(this._end=Math.max(i,this._start)),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._trackClickListener=e=>{if(this.hasAttribute(`disabled`))return;let t=this._valueAtPosition(e.clientX);n?this._nearestThumb(t)===`start`?this._start=Math.min(this._clamp(t),this._end):this._end=Math.max(this._clamp(t),this._start):this._value=this._clamp(t),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},e.forEach(e=>{e.addEventListener(`pointerdown`,this._pointerDownListener),e.addEventListener(`keydown`,this._thumbKeyListener)}),t?.addEventListener(`click`,this._trackClickListener)}_teardown(){for(let e of this.querySelectorAll(`.slider-thumb`))e.removeEventListener(`pointerdown`,this._pointerDownListener),e.removeEventListener(`keydown`,this._thumbKeyListener);document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._isDragging=!1,this._dragThumb=null,this.querySelector(`.slider-track`)?.removeEventListener(`click`,this._trackClickListener)}disconnectedCallback(){this._teardown()}},o=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},s=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-slider`,a),e.WuiSlider=a})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror);
51
+ `,this._rendered=!0,this._placeParts(),this._syncMirrors(),(0,r.syncFieldState)(this,this.querySelector(`.slider`)),this._wire()}_formatValue(e){return`${e}${this.getAttribute(`unit`)||``}`}_placeParts(){let e=this._min(),t=this._max(),n=n=>t===e?0:(n-e)/(t-e),r=this._isRange(),i=r?n(this._start):0,a=n(r?this._end:this._value),o=this.querySelector(`.slider-fill`);o&&(o.style.left=`${i*100}%`,o.style.right=`${100-a*100}%`,r&&o.style.setProperty(`--wui-fill-start`,String(i)),o.style.setProperty(`--wui-fill-end`,String(a)));let s=(e,t)=>{e&&(e.style.left=`${t*100}%`,e.style.setProperty(`--wui-t`,String(t)))};r?(s(this.querySelector(`[data-thumb="start"]`),i),s(this.querySelector(`[data-thumb="end"]`),a)):s(this.querySelector(`.slider-thumb`),a)}_syncValue(){if(this._rendered){if(this._placeParts(),this._isRange()){let e=this.querySelector(`[data-thumb="start"]`),t=this.querySelector(`[data-thumb="end"]`);e&&(e.setAttribute(`aria-valuenow`,String(this._start)),e.setAttribute(`aria-valuetext`,this._formatValue(this._start))),t&&(t.setAttribute(`aria-valuenow`,String(this._end)),t.setAttribute(`aria-valuetext`,this._formatValue(this._end)));let n=this.querySelector(`.slider-value`);n&&(n.textContent=`${this._formatValue(this._start)} to ${this._formatValue(this._end)}`)}else{let e=this.querySelector(`.slider-thumb`);e&&(e.setAttribute(`aria-valuenow`,String(this._value)),e.setAttribute(`aria-valuetext`,this._formatValue(this._value)));let t=this.querySelector(`.slider-value`);t&&(t.textContent=this._formatValue(this._value))}}}_syncMirrors(){this._isRange()?this._syncRangeMirrors():this._syncSingleMirror()}_syncSingleMirror(){this.getAttribute(`name`)&&(0,i.syncFormMirror)(this,String(this._value))}_syncRangeMirrors(){let e=this.getAttribute(`start-name`)||this.getAttribute(`name`),t=this.getAttribute(`end-name`);this._mirrorRange(`start`,e,this._start),this._mirrorRange(`end`,t,this._end)}_mirrorRange(e,t,n){if(!t)return;let r=this.querySelector(`input[type="hidden"][data-slider-mirror="${e}"]`);r||(r=document.createElement(`input`),r.type=`hidden`,r.setAttribute(`data-slider-mirror`,e),this.appendChild(r)),r.name=t,r.value=String(n),r.disabled=this.hasAttribute(`disabled`)}_valueAtPosition(e){let t=this.querySelector(`.slider-track`);if(!t)return this._min();let n=t.getBoundingClientRect(),r=this.querySelector(`.slider-thumb`),i=r?r.offsetWidth/2:0,a=n.width-i*2,o=a>0?Math.max(0,Math.min(1,(e-n.left-i)/a)):0,s=this._min()+o*(this._max()-this._min());return this._snapToStep(s)}_nearestThumb(e){return Math.abs(e-this._start)<=Math.abs(e-this._end)?`start`:`end`}_wire(){if(this._teardown(),(0,r.isInert)(this))return;let e=this.querySelectorAll(`.slider-thumb`),t=this.querySelector(`.slider-track`),n=this._isRange();this._pointerDownListener=e=>{if((0,r.isInert)(this))return;let t=e.target.closest(`.slider-thumb`);t&&(e.preventDefault(),this._isDragging=!0,this._dragThumb=t.getAttribute(`data-thumb`),document.addEventListener(`pointermove`,this._pointerMoveListener),document.addEventListener(`pointerup`,this._pointerUpListener),document.addEventListener(`pointercancel`,this._pointerUpListener))},this._pointerMoveListener=e=>{if(!this._isDragging)return;e.preventDefault();let t=this._valueAtPosition(e.clientX);if(this._dragThumb===`single`)this._value=this._clamp(t),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{value:this._value}}));else if(this._dragThumb===`start`){let e=Math.min(t,this._end);this._start=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}else if(this._dragThumb===`end`){let e=Math.max(t,this._start);this._end=this._clamp(e),this._syncValue(),this.dispatchEvent(new CustomEvent(`slide`,{detail:{start:this._start,end:this._end}}))}},this._pointerUpListener=()=>{this._isDragging&&(this._isDragging=!1,this._dragThumb=null,document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._thumbKeyListener=e=>{let t=e.currentTarget;if((0,r.isInert)(this))return;let n=this._step(),i=n*10,a=null,o=t.getAttribute(`data-thumb`),s=o===`end`?this._end:o===`start`?this._start:this._value;e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),a=s-n):e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),a=s+n):e.key===`PageDown`?(e.preventDefault(),a=s-i):e.key===`PageUp`?(e.preventDefault(),a=s+i):e.key===`Home`?(e.preventDefault(),a=this._min()):e.key===`End`&&(e.preventDefault(),a=this._max()),a!=null&&(a=this._clamp(a),o===`single`?this._value=a:o===`start`?this._start=Math.min(a,this._end):o===`end`&&(this._end=Math.max(a,this._start)),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0})))},this._trackClickListener=e=>{if((0,r.isInert)(this))return;let t=this._valueAtPosition(e.clientX);n?this._nearestThumb(t)===`start`?this._start=Math.min(this._clamp(t),this._end):this._end=Math.max(this._clamp(t),this._start):this._value=this._clamp(t),this._syncValue(),this._syncMirrors(),this.dispatchEvent(new Event(`change`,{bubbles:!0}))},e.forEach(e=>{e.addEventListener(`pointerdown`,this._pointerDownListener),e.addEventListener(`keydown`,this._thumbKeyListener)}),t?.addEventListener(`click`,this._trackClickListener)}_teardown(){for(let e of this.querySelectorAll(`.slider-thumb`))e.removeEventListener(`pointerdown`,this._pointerDownListener),e.removeEventListener(`keydown`,this._thumbKeyListener);document.removeEventListener(`pointermove`,this._pointerMoveListener),document.removeEventListener(`pointerup`,this._pointerUpListener),document.removeEventListener(`pointercancel`,this._pointerUpListener),this._isDragging=!1,this._dragThumb=null,this.querySelector(`.slider-track`)?.removeEventListener(`click`,this._trackClickListener)}disconnectedCallback(){this._teardown()}},s=(e,t)=>{let n=Number.parseFloat(e);return Number.isFinite(n)?n:t},c=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);(0,t.defineElement)(`wui-slider`,o),e.WuiSlider=o})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.fieldState,WeborityUiElementsInternal.modules.formMirror);
@@ -1 +1 @@
1
- (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.128.0`)throw Error(`[webority-ui] sortable expects ui-elements 0.128.0 but the page loaded `+i+`.`);var a=new Set,o=`.wui-sortable-handle`,s=`a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']`,c=4,l=8,u=250,d=48,f=18,p=class extends n.ElementBase{static get observedAttributes(){return[`name`,`disabled`]}constructor(){super(),this._drag=null,this._kb=null,this._moving=!1,this.controlled=!1,this._observer=null,this._onPointerDown=this._onPointerDown.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onDragStart=e=>e.preventDefault(),this._onDocMove=this._onDocMove.bind(this),this._onDocUp=this._onDocUp.bind(this),this._onDocCancel=this._onDocCancel.bind(this),this._onDocKey=this._onDocKey.bind(this),this._onDocTouchMove=e=>{this._drag?.started&&e.preventDefault()},this._onSelectStart=e=>e.preventDefault(),this._scrollTick=this._scrollTick.bind(this)}connectedCallback(){a.add(this),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`dragstart`,this._onDragStart),this._observer=new MutationObserver(()=>this._syncMirrors()),this._observer.observe(this,{childList:!0}),this._syncMirrors()}disconnectedCallback(){a.delete(this),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`dragstart`,this._onDragStart),this._observer?.disconnect(),this._observer=null,this._abort()}attributeChangedCallback(e){e===`disabled`&&this._abort(),this.isConnected&&this._syncMirrors()}get order(){return this._items().map(e=>e.getAttribute(`data-id`))}set order(e){if(this._drag?.started||this._kb)return;let t=this._items(),n=new Map(t.map(e=>[e.getAttribute(`data-id`),e])),r=[];for(let t of e??[]){let e=n.get(String(t));e&&!r.includes(e)&&r.push(e)}[...r,...t.filter(e=>!r.includes(e))].forEach((e,t)=>{let n=this._items()[t];n!==e&&this.insertBefore(e,n)}),this._syncMirrors()}_items(){return[...this.querySelectorAll(`:scope > [data-id]`)]}_itemFrom(e){let t=e;for(;t&&t.parentElement!==this;)t=t.parentElement;return t?.hasAttribute(`data-id`)?t:null}_itemDisabled(e){return e.hasAttribute(`data-disabled`)}_horizontal(){return this.getAttribute(`orientation`)===`horizontal`}_syncMirrors(){(0,r.syncFormMirrors)(this,this.order)}_insertAt(e,t){let n=this._items();if(n.indexOf(e)===t)return;let r=n.filter(t=>t!==e),i=r[t]??null;i?this.insertBefore(e,i):r.length>0?r[r.length-1].after(e):this.appendChild(e)}_indexFor(e,t,n){let r=this._items().filter(t=>t!==e),i=this._horizontal();for(let e=0;e<r.length;e++){let a=r[e].getBoundingClientRect();if(i?n<a.top||n<=a.bottom&&t<a.left+a.width/2:n<a.top+a.height/2)return e}return r.length}_peers(){let e=this.getAttribute(`group`);return[...a].filter(t=>t===this||e&&t.getAttribute(`group`)===e&&!t.hasAttribute(`disabled`))}_labelOf(e){return e.getAttribute(`data-label`)||e.textContent.replace(/\s+/g,` `).trim()||e.getAttribute(`data-id`)}_announce(e){let t=this.querySelector(`:scope > .wui-sortable-live`);t||(t=document.createElement(`div`),t.className=`wui-sortable-live`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),this.appendChild(t)),t.textContent=e}_position(e){let t=this._items();return`position ${t.indexOf(e)+1} of ${t.length}`}_onPointerDown(e){if(this._drag||this._kb||this.hasAttribute(`disabled`)||e.pointerType===`mouse`&&e.button!==0)return;let t=this._itemFrom(e.target);if(!t||this._itemDisabled(t))return;let n=t.querySelector(`:scope > ${o}`),r=!!n&&n.contains(e.target);if(this.hasAttribute(`handle`)&&!r)return;if(!r){let n=e.target.closest?.(s);if(n&&n!==t&&t.contains(n))return}let i=e.pointerType===`touch`&&!r,a={item:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX,y:e.clientY,slop:e.pointerType===`touch`?l:c,ready:!i,started:!1,timer:null,raf:0,list:this,ghost:null};this._drag=a,i&&(a.timer=setTimeout(()=>{a.timer=null,a.ready=!0,this._begin()},u)),document.addEventListener(`pointermove`,this._onDocMove),document.addEventListener(`pointerup`,this._onDocUp),document.addEventListener(`pointercancel`,this._onDocCancel),document.addEventListener(`keydown`,this._onDocKey,!0),document.addEventListener(`touchmove`,this._onDocTouchMove,{passive:!1})}_onDocMove(e){let t=this._drag;if(t&&e.pointerId===t.pointerId){if(t.x=e.clientX,t.y=e.clientY,!t.started){let e=Math.hypot(t.x-t.startX,t.y-t.startY);if(!t.ready){e>t.slop&&this._finish(!0);return}if(e<t.slop||(this._begin(),!this._drag?.started))return}e.preventDefault?.(),this._moveGhost(),this._update()}}_onDocUp(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!1)}_onDocCancel(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!0)}_onDocKey(e){e.key===`Escape`&&this._drag&&(e.preventDefault(),e.stopPropagation(),this._finish(!0))}_begin(){let e=this._drag;if(!e||e.started)return;e.started=!0;let t=e.item.getBoundingClientRect();e.offsetX=e.startX-t.left,e.offsetY=e.startY-t.top,e.fromIndex=this._items().indexOf(e.item);let n=e.item.cloneNode(!0);for(let e of[n,...n.querySelectorAll(`[id],[data-id]`)])e.removeAttribute(`id`),e.removeAttribute(`data-id`);n.classList.add(`wui-sortable-ghost`),n.setAttribute(`aria-hidden`,`true`),n.inert=!0,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,e.ghost=n,e.item.classList.add(`wui-sortable-dragging`),document.body.appendChild(n),document.documentElement.classList.add(`wui-sortable-active`),document.addEventListener(`selectstart`,this._onSelectStart),this._moveGhost(),e.raf=requestAnimationFrame(this._scrollTick),this._emit(this,`wui-sortable:start`,{id:e.item.getAttribute(`data-id`)})}_moveGhost(){let e=this._drag;e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.offsetX}px, ${e.y-e.offsetY}px)`)}_update(){let e=this._drag;if(!e?.started)return;let t=e.list;for(let n of this._peers()){let r=n.getBoundingClientRect();if(e.x>=r.left&&e.x<=r.right&&e.y>=r.top&&e.y<=r.bottom){t=n;break}}let n=t._indexFor(e.item,e.x,e.y);(t!==e.list||n!==t._items().indexOf(e.item))&&t._insertAt(e.item,n),e.list=t}_scrollTick(){let e=this._drag;if(!e?.started)return;let t=h(e.list),n=t?t.getBoundingClientRect():null,r=Math.max(n?.top??0,0),i=Math.min(n?.bottom??window.innerHeight,window.innerHeight),a=Math.max(n?.left??0,0),o=Math.min(n?.right??window.innerWidth,window.innerWidth),s=m(e.y,r,i),c=m(e.x,a,o);(c||s)&&(t?(t.scrollTop+=s,t.scrollLeft+=c):window.scrollBy(c,s),this._update()),e.raf=requestAnimationFrame(this._scrollTick)}_finish(e){let t=this._drag;if(!t||(this._drag=null,clearTimeout(t.timer),cancelAnimationFrame(t.raf),document.removeEventListener(`pointermove`,this._onDocMove),document.removeEventListener(`pointerup`,this._onDocUp),document.removeEventListener(`pointercancel`,this._onDocCancel),document.removeEventListener(`keydown`,this._onDocKey,!0),document.removeEventListener(`touchmove`,this._onDocTouchMove),document.removeEventListener(`selectstart`,this._onSelectStart),!t.started))return;t.ghost?.remove(),document.documentElement.classList.remove(`wui-sortable-active`),t.item.classList.remove(`wui-sortable-dragging`);let n=t.item.getAttribute(`data-id`);e?(this._insertAt(t.item,t.fromIndex),this._syncMirrors(),t.list!==this&&t.list._syncMirrors()):this._settle(t.item,this,t.fromIndex,t.list),this._emit(this,`wui-sortable:end`,{id:n,cancelled:e})}_settle(e,t,n,r){let i=r._items().indexOf(e);if(r===t&&i===n)return;let a=e.getAttribute(`data-id`),o=r.order,s=r!==t,c=t.order;s&&(t.controlled||r.controlled)&&t._insertAt(e,n),t._syncMirrors(),r._syncMirrors();let l=r._labelOf(e),u=s&&r.getAttribute(`aria-label`)?` to ${r.getAttribute(`aria-label`)}`:``,d={id:a,fromIndex:n,toIndex:i,from:t,to:r};s&&this._emit(t,`wui-sortable:change`,{...d,ids:c}),this._emit(r,`wui-sortable:change`,{...d,ids:o}),r._announce(`${l} moved${u}, position ${i+1} of ${o.length}.`)}_emit(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}_abort(){this._drag&&this._finish(!0),this._kb&&this._dropKeyboard(!0)}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(o),n=t&&t.parentElement?.parentElement===this?t.parentElement:null;if(!n||this._itemDisabled(n)||this._drag)return;let r=e.key;if(!this._kb){if(r!==` `&&r!==`Enter`)return;e.preventDefault(),this._liftKeyboard(n,t)}else if(this._kb.item===n){if(r===` `||r===`Enter`)e.preventDefault(),this._dropKeyboard(!1);else if(r===`Escape`)e.preventDefault(),e.stopPropagation(),this._dropKeyboard(!0);else if([`ArrowUp`,`ArrowLeft`,`ArrowDown`,`ArrowRight`,`Home`,`End`].includes(r)){e.preventDefault();let i=this._items(),a=i.indexOf(n),o=i.length-1,s=r===`Home`?0:r===`End`?o:Math.max(0,Math.min(o,a+(r===`ArrowUp`||r===`ArrowLeft`?-1:1)));if(s===a){this._announce(`${this._labelOf(n)} is already ${a===0?`first`:`last`}, ${this._position(n)}.`);return}this._moveFocused(()=>this._insertAt(n,s),t),this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`)}}}_onFocusOut(e){this._kb&&!this._moving&&(e.relatedTarget&&this._kb.handle.contains(e.relatedTarget)||this._dropKeyboard(!1))}_liftKeyboard(e,t){this._kb={item:e,handle:t,fromIndex:this._items().indexOf(e)},t.setAttribute(`aria-pressed`,`true`),this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`)}_dropKeyboard(e){let t=this._kb;t&&(this._kb=null,t.handle.removeAttribute(`aria-pressed`),e?(this._moveFocused(()=>this._insertAt(t.item,t.fromIndex),t.handle),this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`)):this._items().indexOf(t.item)===t.fromIndex?this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`):this._settle(t.item,this,t.fromIndex,this))}_moveFocused(e,t){this._moving=!0;let n=this.contains(document.activeElement);e(),n&&document.activeElement!==t&&t.focus(),this._moving=!1}};function m(e,t,n){return e<t+d?-Math.ceil(f*Math.min(1,(t+d-e)/d)):e>n-d?Math.ceil(f*Math.min(1,(e-(n-d))/d)):0}function h(e){for(let t=e.parentElement;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement){let e=getComputedStyle(t),n=/(auto|scroll)/.test(e.overflowY)&&t.scrollHeight>t.clientHeight,r=/(auto|scroll)/.test(e.overflowX)&&t.scrollWidth>t.clientWidth;if(n||r)return t}return null}(0,t.defineElement)(`wui-sortable`,p),e.WuiSortable=p})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror);
1
+ (function(e,t,n,r){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var i=globalThis.WeborityUiElementsInternal?.version;if(i!==`0.129.0`)throw Error(`[webority-ui] sortable expects ui-elements 0.129.0 but the page loaded `+i+`.`);var a=new Set,o=`.wui-sortable-handle`,s=`a[href],button,input,select,textarea,label,summary,[contenteditable='true'],[role='button'],[role='link']`,c=4,l=8,u=250,d=48,f=18,p=class extends n.ElementBase{static get observedAttributes(){return[`name`,`disabled`]}constructor(){super(),this._drag=null,this._kb=null,this._moving=!1,this.controlled=!1,this._observer=null,this._onPointerDown=this._onPointerDown.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusOut=this._onFocusOut.bind(this),this._onDragStart=e=>e.preventDefault(),this._onDocMove=this._onDocMove.bind(this),this._onDocUp=this._onDocUp.bind(this),this._onDocCancel=this._onDocCancel.bind(this),this._onDocKey=this._onDocKey.bind(this),this._onDocTouchMove=e=>{this._drag?.started&&e.preventDefault()},this._onSelectStart=e=>e.preventDefault(),this._scrollTick=this._scrollTick.bind(this)}connectedCallback(){a.add(this),this.addEventListener(`pointerdown`,this._onPointerDown),this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`focusout`,this._onFocusOut),this.addEventListener(`dragstart`,this._onDragStart),this._observer=new MutationObserver(()=>this._syncMirrors()),this._observer.observe(this,{childList:!0}),this._syncMirrors()}disconnectedCallback(){a.delete(this),this.removeEventListener(`pointerdown`,this._onPointerDown),this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`focusout`,this._onFocusOut),this.removeEventListener(`dragstart`,this._onDragStart),this._observer?.disconnect(),this._observer=null,this._abort()}attributeChangedCallback(e){e===`disabled`&&this._abort(),this.isConnected&&this._syncMirrors()}get order(){return this._items().map(e=>e.getAttribute(`data-id`))}set order(e){if(this._drag?.started||this._kb)return;let t=this._items(),n=new Map(t.map(e=>[e.getAttribute(`data-id`),e])),r=[];for(let t of e??[]){let e=n.get(String(t));e&&!r.includes(e)&&r.push(e)}[...r,...t.filter(e=>!r.includes(e))].forEach((e,t)=>{let n=this._items()[t];n!==e&&this.insertBefore(e,n)}),this._syncMirrors()}_items(){return[...this.querySelectorAll(`:scope > [data-id]`)]}_itemFrom(e){let t=e;for(;t&&t.parentElement!==this;)t=t.parentElement;return t?.hasAttribute(`data-id`)?t:null}_itemDisabled(e){return e.hasAttribute(`data-disabled`)}_horizontal(){return this.getAttribute(`orientation`)===`horizontal`}_syncMirrors(){(0,r.syncFormMirrors)(this,this.order)}_insertAt(e,t){let n=this._items();if(n.indexOf(e)===t)return;let r=n.filter(t=>t!==e),i=r[t]??null;i?this.insertBefore(e,i):r.length>0?r[r.length-1].after(e):this.appendChild(e)}_indexFor(e,t,n){let r=this._items().filter(t=>t!==e),i=this._horizontal();for(let e=0;e<r.length;e++){let a=r[e].getBoundingClientRect();if(i?n<a.top||n<=a.bottom&&t<a.left+a.width/2:n<a.top+a.height/2)return e}return r.length}_peers(){let e=this.getAttribute(`group`);return[...a].filter(t=>t===this||e&&t.getAttribute(`group`)===e&&!t.hasAttribute(`disabled`))}_labelOf(e){return e.getAttribute(`data-label`)||e.textContent.replace(/\s+/g,` `).trim()||e.getAttribute(`data-id`)}_announce(e){let t=this.querySelector(`:scope > .wui-sortable-live`);t||(t=document.createElement(`div`),t.className=`wui-sortable-live`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),t.setAttribute(`aria-atomic`,`true`),this.appendChild(t)),t.textContent=e}_position(e){let t=this._items();return`position ${t.indexOf(e)+1} of ${t.length}`}_onPointerDown(e){if(this._drag||this._kb||this.hasAttribute(`disabled`)||e.pointerType===`mouse`&&e.button!==0)return;let t=this._itemFrom(e.target);if(!t||this._itemDisabled(t))return;let n=t.querySelector(`:scope > ${o}`),r=!!n&&n.contains(e.target);if(this.hasAttribute(`handle`)&&!r)return;if(!r){let n=e.target.closest?.(s);if(n&&n!==t&&t.contains(n))return}let i=e.pointerType===`touch`&&!r,a={item:t,pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:e.clientX,y:e.clientY,slop:e.pointerType===`touch`?l:c,ready:!i,started:!1,timer:null,raf:0,list:this,ghost:null};this._drag=a,i&&(a.timer=setTimeout(()=>{a.timer=null,a.ready=!0,this._begin()},u)),document.addEventListener(`pointermove`,this._onDocMove),document.addEventListener(`pointerup`,this._onDocUp),document.addEventListener(`pointercancel`,this._onDocCancel),document.addEventListener(`keydown`,this._onDocKey,!0),document.addEventListener(`touchmove`,this._onDocTouchMove,{passive:!1})}_onDocMove(e){let t=this._drag;if(t&&e.pointerId===t.pointerId){if(t.x=e.clientX,t.y=e.clientY,!t.started){let e=Math.hypot(t.x-t.startX,t.y-t.startY);if(!t.ready){e>t.slop&&this._finish(!0);return}if(e<t.slop||(this._begin(),!this._drag?.started))return}e.preventDefault?.(),this._moveGhost(),this._update()}}_onDocUp(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!1)}_onDocCancel(e){this._drag&&e.pointerId===this._drag.pointerId&&this._finish(!0)}_onDocKey(e){e.key===`Escape`&&this._drag&&(e.preventDefault(),e.stopPropagation(),this._finish(!0))}_begin(){let e=this._drag;if(!e||e.started)return;e.started=!0;let t=e.item.getBoundingClientRect();e.offsetX=e.startX-t.left,e.offsetY=e.startY-t.top,e.fromIndex=this._items().indexOf(e.item);let n=e.item.cloneNode(!0);for(let e of[n,...n.querySelectorAll(`[id],[data-id]`)])e.removeAttribute(`id`),e.removeAttribute(`data-id`);n.classList.add(`wui-sortable-ghost`),n.setAttribute(`aria-hidden`,`true`),n.inert=!0,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,e.ghost=n,e.item.classList.add(`wui-sortable-dragging`),document.body.appendChild(n),document.documentElement.classList.add(`wui-sortable-active`),document.addEventListener(`selectstart`,this._onSelectStart),this._moveGhost(),e.raf=requestAnimationFrame(this._scrollTick),this._emit(this,`wui-sortable:start`,{id:e.item.getAttribute(`data-id`)})}_moveGhost(){let e=this._drag;e?.ghost&&(e.ghost.style.transform=`translate(${e.x-e.offsetX}px, ${e.y-e.offsetY}px)`)}_update(){let e=this._drag;if(!e?.started)return;let t=e.list;for(let n of this._peers()){let r=n.getBoundingClientRect();if(e.x>=r.left&&e.x<=r.right&&e.y>=r.top&&e.y<=r.bottom){t=n;break}}let n=t._indexFor(e.item,e.x,e.y);(t!==e.list||n!==t._items().indexOf(e.item))&&t._insertAt(e.item,n),e.list=t}_scrollTick(){let e=this._drag;if(!e?.started)return;let t=h(e.list),n=t?t.getBoundingClientRect():null,r=Math.max(n?.top??0,0),i=Math.min(n?.bottom??window.innerHeight,window.innerHeight),a=Math.max(n?.left??0,0),o=Math.min(n?.right??window.innerWidth,window.innerWidth),s=m(e.y,r,i),c=m(e.x,a,o);(c||s)&&(t?(t.scrollTop+=s,t.scrollLeft+=c):window.scrollBy(c,s),this._update()),e.raf=requestAnimationFrame(this._scrollTick)}_finish(e){let t=this._drag;if(!t||(this._drag=null,clearTimeout(t.timer),cancelAnimationFrame(t.raf),document.removeEventListener(`pointermove`,this._onDocMove),document.removeEventListener(`pointerup`,this._onDocUp),document.removeEventListener(`pointercancel`,this._onDocCancel),document.removeEventListener(`keydown`,this._onDocKey,!0),document.removeEventListener(`touchmove`,this._onDocTouchMove),document.removeEventListener(`selectstart`,this._onSelectStart),!t.started))return;t.ghost?.remove(),document.documentElement.classList.remove(`wui-sortable-active`),t.item.classList.remove(`wui-sortable-dragging`);let n=t.item.getAttribute(`data-id`);e?(this._insertAt(t.item,t.fromIndex),this._syncMirrors(),t.list!==this&&t.list._syncMirrors()):this._settle(t.item,this,t.fromIndex,t.list),this._emit(this,`wui-sortable:end`,{id:n,cancelled:e})}_settle(e,t,n,r){let i=r._items().indexOf(e);if(r===t&&i===n)return;let a=e.getAttribute(`data-id`),o=r.order,s=r!==t,c=t.order;s&&(t.controlled||r.controlled)&&t._insertAt(e,n),t._syncMirrors(),r._syncMirrors();let l=r._labelOf(e),u=s&&r.getAttribute(`aria-label`)?` to ${r.getAttribute(`aria-label`)}`:``,d={id:a,fromIndex:n,toIndex:i,from:t,to:r};s&&this._emit(t,`wui-sortable:change`,{...d,ids:c}),this._emit(r,`wui-sortable:change`,{...d,ids:o}),r._announce(`${l} moved${u}, position ${i+1} of ${o.length}.`)}_emit(e,t,n){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,detail:n}))}_abort(){this._drag&&this._finish(!0),this._kb&&this._dropKeyboard(!0)}_onKeyDown(e){if(this.hasAttribute(`disabled`))return;let t=e.target.closest?.(o),n=t&&t.parentElement?.parentElement===this?t.parentElement:null;if(!n||this._itemDisabled(n)||this._drag)return;let r=e.key;if(!this._kb){if(r!==` `&&r!==`Enter`)return;e.preventDefault(),this._liftKeyboard(n,t)}else if(this._kb.item===n){if(r===` `||r===`Enter`)e.preventDefault(),this._dropKeyboard(!1);else if(r===`Escape`)e.preventDefault(),e.stopPropagation(),this._dropKeyboard(!0);else if([`ArrowUp`,`ArrowLeft`,`ArrowDown`,`ArrowRight`,`Home`,`End`].includes(r)){e.preventDefault();let i=this._items(),a=i.indexOf(n),o=i.length-1,s=r===`Home`?0:r===`End`?o:Math.max(0,Math.min(o,a+(r===`ArrowUp`||r===`ArrowLeft`?-1:1)));if(s===a){this._announce(`${this._labelOf(n)} is already ${a===0?`first`:`last`}, ${this._position(n)}.`);return}this._moveFocused(()=>this._insertAt(n,s),t),this._announce(`${this._labelOf(n)} moved to ${this._position(n)}.`)}}}_onFocusOut(e){this._kb&&!this._moving&&(e.relatedTarget&&this._kb.handle.contains(e.relatedTarget)||this._dropKeyboard(!1))}_liftKeyboard(e,t){this._kb={item:e,handle:t,fromIndex:this._items().indexOf(e)},t.setAttribute(`aria-pressed`,`true`),this._announce(`${this._labelOf(e)} lifted, ${this._position(e)}. Use the arrow keys to move it, Space to drop it, Escape to cancel.`)}_dropKeyboard(e){let t=this._kb;t&&(this._kb=null,t.handle.removeAttribute(`aria-pressed`),e?(this._moveFocused(()=>this._insertAt(t.item,t.fromIndex),t.handle),this._announce(`Reorder cancelled. ${this._labelOf(t.item)} is back at ${this._position(t.item)}.`)):this._items().indexOf(t.item)===t.fromIndex?this._announce(`${this._labelOf(t.item)} dropped, ${this._position(t.item)}.`):this._settle(t.item,this,t.fromIndex,this))}_moveFocused(e,t){this._moving=!0;let n=this.contains(document.activeElement);e(),n&&document.activeElement!==t&&t.focus(),this._moving=!1}};function m(e,t,n){return e<t+d?-Math.ceil(f*Math.min(1,(t+d-e)/d)):e>n-d?Math.ceil(f*Math.min(1,(e-(n-d))/d)):0}function h(e){for(let t=e.parentElement;t&&t!==document.body&&t!==document.documentElement;t=t.parentElement){let e=getComputedStyle(t),n=/(auto|scroll)/.test(e.overflowY)&&t.scrollHeight>t.clientHeight,r=/(auto|scroll)/.test(e.overflowX)&&t.scrollWidth>t.clientWidth;if(n||r)return t}return null}(0,t.defineElement)(`wui-sortable`,p),e.WuiSortable=p})(this.WeborityUiElements=this.WeborityUiElements||{},WeborityUiElementsInternal.modules.defineElement,WeborityUiElementsInternal.modules.elementBase,WeborityUiElementsInternal.modules.formMirror);