@webority/ui-elements 0.78.0 → 0.78.1

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 (58) hide show
  1. package/dist/{WuiAutocomplete-Cvoyr30K.js → WuiAutocomplete-le8obmeq.js} +1 -1
  2. package/dist/{WuiCommentThread-z6URiH-n.js → WuiCommentThread-xu56ddmv.js} +1 -1
  3. package/dist/WuiConsentBanner-DjgDtG3M.js +1 -0
  4. package/dist/{WuiContextMenu-BLNKaFsB.js → WuiContextMenu-fGlo4c_Z.js} +1 -1
  5. package/dist/{WuiCountrySelect-Dac15o75.js → WuiCountrySelect-DECdemVk.js} +1 -1
  6. package/dist/{WuiDatePicker-BUtDjbek.js → WuiDatePicker-BCbSGCzN.js} +1 -1
  7. package/dist/{WuiDateRange-DCNf4MSb.js → WuiDateRange-8HLWaXuU.js} +1 -1
  8. package/dist/{WuiHoverCard-Ql6CD3BL.js → WuiHoverCard-mrP_KEhB.js} +1 -1
  9. package/dist/{WuiInlineEdit-hkv-A06z.js → WuiInlineEdit-DJCxIh0J.js} +1 -1
  10. package/dist/{WuiMentionInput-5z-Kcvlg.js → WuiMentionInput-D_pbskyy.js} +1 -1
  11. package/dist/{WuiMenubar-4MOZ51R_.js → WuiMenubar-CduCuK5G.js} +1 -1
  12. package/dist/{WuiMultiSelect-Pm9-F-YU.js → WuiMultiSelect-B2TqrJp2.js} +1 -1
  13. package/dist/{WuiNotificationCenter-f7ZQ42rM.js → WuiNotificationCenter-CYlxiwj9.js} +1 -1
  14. package/dist/{WuiOverflow-Ixc3PRuW.js → WuiOverflow-Cq_g0454.js} +1 -1
  15. package/dist/{WuiPhone-BhmKncvF.js → WuiPhone-CdJTlY2E.js} +1 -1
  16. package/dist/{WuiSelect-DR4PYwAw.js → WuiSelect-BT-kh9TD.js} +2 -2
  17. package/dist/{WuiTimePicker-CaJrTq3m.js → WuiTimePicker-CXLgydrh.js} +1 -1
  18. package/dist/{WuiTour-DOeTJa4V.js → WuiTour-DDY9N8AV.js} +1 -1
  19. package/dist/{WuiTree-BIgBPhZH.js → WuiTree-CB1xoDIj.js} +1 -1
  20. package/dist/{WuiWhatsNew-68sOQOTO.js → WuiWhatsNew-Bhz_kR2O.js} +1 -1
  21. package/dist/{anchorOverlay-HAWsGzlr.js → anchorOverlay-D8di0B-z.js} +1 -1
  22. package/dist/elements/autocomplete.js +1 -1
  23. package/dist/elements/comment-thread.js +1 -1
  24. package/dist/elements/consent-banner.js +1 -1
  25. package/dist/elements/context-menu.js +1 -1
  26. package/dist/elements/country-select.js +1 -1
  27. package/dist/elements/date-range.js +1 -1
  28. package/dist/elements/datepicker.js +1 -1
  29. package/dist/elements/filter-popover.js +1 -1
  30. package/dist/elements/hover-card.js +1 -1
  31. package/dist/elements/inline-edit.js +1 -1
  32. package/dist/elements/kanban.js +1 -1
  33. package/dist/elements/mention-input.js +1 -1
  34. package/dist/elements/menubar.js +1 -1
  35. package/dist/elements/multiselect.js +1 -1
  36. package/dist/elements/notification-center.js +1 -1
  37. package/dist/elements/overflow.js +1 -1
  38. package/dist/elements/phone.js +1 -1
  39. package/dist/elements/select.js +1 -1
  40. package/dist/elements/timepicker.js +1 -1
  41. package/dist/elements/tour.js +1 -1
  42. package/dist/elements/tree.js +1 -1
  43. package/dist/elements/whats-new.js +1 -1
  44. package/dist/{fileViewerImage-BWrW3zAb.js → fileViewerImage-Bcsaoyei.js} +1 -1
  45. package/dist/{fileViewerMedia-CbvjcIc6.js → fileViewerMedia-B2kIU6tb.js} +1 -1
  46. package/dist/{fileViewerPdf-qmMcAn1q.js → fileViewerPdf-DuRqS6OC.js} +1 -1
  47. package/dist/fileViewerUi-CmfISSyD.js +1 -0
  48. package/dist/{filterPopover-wAZS4TuD.js → filterPopover-DuMhrdFk.js} +1 -1
  49. package/dist/{kanban-Drt3TD5C.js → kanban-DvHNWre-.js} +1 -1
  50. package/dist/ui-consent-banner.global.js +1 -1
  51. package/dist/ui-elements.global.js +47 -4
  52. package/dist/ui-elements.js +1 -1
  53. package/dist/ui-file-viewer.global.js +1 -1
  54. package/dist/ui-file-viewer.js +1 -1
  55. package/dist/{wuiHttp-CIJN4Pah.js → wuiHttp-CFSgthqb.js} +1 -1
  56. package/package.json +1 -1
  57. package/dist/WuiConsentBanner-D6YE84__.js +0 -1
  58. package/dist/fileViewerUi-CSOkacnB.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-HAWsGzlr.js";import{t as i}from"./iconGlyphs.g-Bk8AzmSO.js";import{t as a}from"./formMirror-BgY7zkC3.js";import{n as o,t as s}from"./listboxKeyNav-DMIvs9d6.js";import{n as c,r as l,t as u}from"./optionLabel-Bd3vP-XI.js";var d=class extends e{static formAssociated=!0;static get observedAttributes(){return[`value`,`placeholder`,`search-placeholder`,`searchable`,`disabled`,`compact`,`size`,`clearable`,`icon`,`prefix`,`aria-label`,`aria-invalid`]}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e==null?``:String(e),a(this,this._value),this._syncSelected(),this._syncReset()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[u]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._snapshotDeclared();let e=this._readOptions(),t=this.hasAttribute(`searchable`),n=this.hasAttribute(`clearable`),r=this.getAttribute(`size`),o=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``,s=this.getAttribute(`icon`),u=this.getAttribute(`prefix`),d=this.getAttribute(`placeholder`)||`Select...`,p=this.getAttribute(`search-placeholder`)||`Search...`,m=e.find(e=>String(e.value)===String(this._value))||e.find(e=>e.selected);m&&(this._value=String(m.value)),a(this,this._value),this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let h=`${this.id}-listbox`;this._listboxId=h;let g=e.map((e,t)=>{let n=String(e.value)===String(this._value);return`<button type="button" role="option" id="${f(`${h}-opt-${t}`)}" class="search-select-option${n?` selected`:``}" data-value="${f(e.value)}" aria-selected="${n}">${l(e)}</button>`}).join(``);this.innerHTML=`
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-D8di0B-z.js";import{t as i}from"./iconGlyphs.g-Bk8AzmSO.js";import{t as a}from"./formMirror-BgY7zkC3.js";import{n as o,t as s}from"./listboxKeyNav-DMIvs9d6.js";import{n as c,r as l,t as u}from"./optionLabel-Bd3vP-XI.js";var d=class extends e{static formAssociated=!0;static get observedAttributes(){return[`value`,`placeholder`,`search-placeholder`,`searchable`,`disabled`,`compact`,`size`,`clearable`,`icon`,`prefix`,`aria-label`,`aria-invalid`]}_accessibleName(){return this.getAttribute(`aria-label`)||this.getAttribute(`placeholder`)||`Select`}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._optionsProp=null,this._active=-1,this._typeahead=``,this._typeaheadTimer=null}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(e===`value`){this.value=n;return}if(e===`aria-invalid`){this._syncInvalid();return}this._rendered&&this.render()}_syncInvalid(){let e=this.querySelector(`.search-select-control`);e&&(this.hasAttribute(`aria-invalid`)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`))}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e==null?``:String(e),a(this,this._value),this._syncSelected(),this._syncReset()}set options(e){this._optionsProp=Array.isArray(e)?e:null,this.isConnected&&this.render()}get options(){return this._readOptions()}_snapshotDeclared(){if(this._declared)return;let e=[...this.querySelectorAll(`:scope > wui-option`)];e.length&&(this._declared=e.map(e=>({value:e.getAttribute(`value`)??e.textContent.trim(),label:e.innerHTML,icon:e.getAttribute(`icon`)||void 0,[u]:!0,selected:e.hasAttribute(`selected`)})))}_readOptions(){return this._optionsProp?this._optionsProp:(this._snapshotDeclared(),this._declared||[])}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``),this._snapshotDeclared();let e=this._readOptions(),t=this.hasAttribute(`searchable`),n=this.hasAttribute(`clearable`),r=this.getAttribute(`size`),o=r===`sm`?` search-select-sm`:r===`lg`?` search-select-lg`:``,s=this.getAttribute(`icon`),u=this.getAttribute(`prefix`),d=this.getAttribute(`placeholder`)||`Select...`,p=this.getAttribute(`search-placeholder`)||`Search...`,m=e.find(e=>String(e.value)===String(this._value))||e.find(e=>e.selected);m&&(this._value=String(m.value)),a(this,this._value),this.id||=`wui-select-${Math.random().toString(36).slice(2,9)}`;let h=`${this.id}-listbox`;this._listboxId=h;let g=e.map((e,t)=>{let n=String(e.value)===String(this._value);return`<button type="button" role="option" id="${f(`${h}-opt-${t}`)}" class="search-select-option${n?` selected`:``}" data-value="${f(e.value)}" aria-selected="${n}">${l(e)}</button>`}).join(``);this.innerHTML=`
2
2
  <div class="search-select${this.hasAttribute(`compact`)?` search-select-compact`:``}${o}">
3
3
  <button type="button" role="combobox" class="input search-select-control" aria-haspopup="listbox" aria-expanded="false" aria-controls="${f(h)}" aria-label="${f(this._accessibleName())}"${this.hasAttribute(`aria-invalid`)?` aria-invalid="true"`:``}${this.hasAttribute(`disabled`)?` disabled`:``}>
4
4
  ${s?i(s,{className:`search-select-icon`}):``}
@@ -11,4 +11,4 @@ import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from".
11
11
  ${t?`<div class="search-select-search">${i(`search`)}<input class="search-select-input" placeholder="${f(p)}" aria-autocomplete="list" /><button type="button" class="search-select-clear" aria-label="Clear search" hidden>${i(`x`)}</button></div>`:``}
12
12
  <div class="search-select-options">${g}<div class="search-select-empty" hidden>No matches</div></div>
13
13
  </div>
14
- </div>`,this._rendered=!0,a(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?l(t):c(this.getAttribute(`placeholder`)||`Select...`),e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.menu)return;let i=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,r(e.control,e.menu)}else r(e.control,e.menu,{matchWidth:!0})},a=(t,{reveal:n=!0}={})=>{let r=this._visible();this._active=t,o(e.optionsWrap,t>=0&&r[t]||null),t>=0&&r[t]?(n&&r[t].scrollIntoView({block:`nearest`}),e.control.setAttribute(`aria-activedescendant`,r[t].id)):e.control.removeAttribute(`aria-activedescendant`)},c=t=>{let n=t.trim().toLowerCase(),r=0;for(let e of this._optionEls()){let t=!n||e.textContent.toLowerCase().includes(n);e.hidden=!t,t&&(r+=1)}e.empty&&(e.empty.hidden=r>0),e.clear&&(e.clear.hidden=!n),e.menu.hidden||i()},l=()=>!e.menu.hidden,u=()=>{l()&&i()},d=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),i(),t(this,u),e.search&&(e.search.value=``,c(``),e.search.focus()),a(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},f=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),a(-1),n(this)},p=t=>{try{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{f(),e.control.focus()}};this._navHandler=s({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>a(e),onEnter:e=>{e&&p(e)},onEscape:()=>{this._navHandler.clearTypeahead(),f(),e.control.focus()}});let m=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),f(),e.control.focus()}),e.control.addEventListener(`click`,()=>l()?f():d()),e.control.addEventListener(`keydown`,e=>{if(l()){m(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&p(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&a(this._visible().indexOf(t),{reveal:!1})}),e.optionsWrap.addEventListener(`mouseleave`,()=>a(-1)),e.search?.addEventListener(`input`,()=>{c(e.search.value),a(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,c(``),e.search.focus()}),e.menu.addEventListener(`keydown`,m),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{l()&&!this.contains(e.target)&&f()},document.addEventListener(`click`,this._onDocClick),l()&&t(this,u)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),n(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},f=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);export{d as t};
14
+ </div>`,this._rendered=!0,a(this,this._value),this._wire(),this._syncReset()}_refs(){return{control:this.querySelector(`.search-select-control`),menu:this.querySelector(`.search-select-menu`),label:this.querySelector(`[data-label]`),reset:this.querySelector(`.search-select-reset`),search:this.querySelector(`.search-select-input`),clear:this.querySelector(`.search-select-clear`),empty:this.querySelector(`.search-select-empty`),optionsWrap:this.querySelector(`.search-select-options`)}}_optionEls(){return[...this.querySelectorAll(`.search-select-option`)]}_visible(){return this._optionEls().filter(e=>!e.hidden)}_syncSelected(){let{label:e}=this._refs(),t=this._readOptions().find(e=>String(e.value)===String(this._value));for(let e of this._optionEls()){let t=e.dataset.value===String(this._value);e.classList.toggle(`selected`,t),e.setAttribute(`aria-selected`,String(t))}e&&(e.innerHTML=t?l(t):c(this.getAttribute(`placeholder`)||`Select...`),e.classList.toggle(`search-select-placeholder`,!t))}_syncReset(){let{reset:e}=this._refs();e&&(e.hidden=!(this.hasAttribute(`clearable`)&&this._value!==``&&!this.hasAttribute(`disabled`)))}_wire(){this._teardown();let e=this._refs();if(!e.control||!e.menu)return;let i=()=>{if(this.hasAttribute(`compact`)){let t=e.control.getBoundingClientRect();e.menu.style.width=`max-content`,e.menu.style.minWidth=`${t.width}px`,e.menu.style.maxWidth=`280px`,r(e.control,e.menu)}else r(e.control,e.menu,{matchWidth:!0})},a=(t,{reveal:n=!0}={})=>{let r=this._visible();this._active=t,o(e.optionsWrap,t>=0&&r[t]||null),t>=0&&r[t]?(n&&r[t].scrollIntoView({block:`nearest`}),e.control.setAttribute(`aria-activedescendant`,r[t].id)):e.control.removeAttribute(`aria-activedescendant`)},c=t=>{let n=t.trim().toLowerCase(),r=0;for(let e of this._optionEls()){let t=!n||e.textContent.toLowerCase().includes(n);e.hidden=!t,t&&(r+=1)}e.empty&&(e.empty.hidden=r>0),e.clear&&(e.clear.hidden=!n),e.menu.hidden||i()},l=()=>!e.menu.hidden,u=()=>{l()&&i()},d=()=>{e.menu.hidden=!1,e.control.setAttribute(`aria-expanded`,`true`),e.control.classList.add(`open`),i(),t(this,u),e.search&&(e.search.value=``,c(``),e.search.focus()),a(this._optionEls().findIndex(e=>e.classList.contains(`selected`)))},f=()=>{e.menu.hidden=!0,e.control.setAttribute(`aria-expanded`,`false`),e.control.classList.remove(`open`),a(-1),n(this)},p=t=>{try{this.value=t.dataset.value,this.dispatchEvent(new Event(`change`,{bubbles:!0}))}finally{f(),e.control.focus()}};this._navHandler=s({getVisibleOptions:()=>this._visible(),getActive:()=>this._active,setActive:e=>a(e),onEnter:(t,n)=>{t?p(t):e.search&&e.search.value.trim()!==``&&n.length===1&&p(n[0])},onEscape:()=>{this._navHandler.clearTypeahead(),f(),e.control.focus()}});let m=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation()),this._navHandler.handler(e)};e.reset?.addEventListener(`click`,t=>{t.stopPropagation(),this.value=``,this.dispatchEvent(new Event(`change`,{bubbles:!0})),f(),e.control.focus()}),e.control.addEventListener(`click`,()=>l()?f():d()),e.control.addEventListener(`keydown`,e=>{if(l()){m(e);return}(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d())}),e.optionsWrap.addEventListener(`click`,e=>{let t=e.target.closest(`.search-select-option`);t&&p(t)}),e.optionsWrap.addEventListener(`mousemove`,e=>{let t=e.target.closest(`.search-select-option`);t&&!t.classList.contains(`is-active`)&&a(this._visible().indexOf(t),{reveal:!1})}),e.optionsWrap.addEventListener(`mouseleave`,()=>a(-1)),e.search?.addEventListener(`input`,()=>{c(e.search.value),a(-1)}),e.clear?.addEventListener(`click`,()=>{e.search.value=``,c(``),e.search.focus()}),e.menu.addEventListener(`keydown`,m),this._bindGlobal=()=>{this._teardown(),this._onDocClick=e=>{l()&&!this.contains(e.target)&&f()},document.addEventListener(`click`,this._onDocClick),l()&&t(this,u)},this._bindGlobal()}_teardown(){this._onDocClick&&=(document.removeEventListener(`click`,this._onDocClick),null),n(this),this._navHandler?.teardown()}disconnectedCallback(){this._teardown()}},f=e=>String(e??``).replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`);export{d as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-HAWsGzlr.js";import{t as i}from"./iconGlyphs.g-Bk8AzmSO.js";import{t as a}from"./formMirror-BgY7zkC3.js";var o=e=>String(e).padStart(2,`0`),s=(e,t)=>`${o(e)}:${o(t)}`,c=e=>{let t=/^(\d{2}):(\d{2})$/.exec(e||``);return t?{h:+t[1],m:+t[2]}:null},l=(e,t=`24`)=>{if(!e)return``;if(t===`24`)return s(e.h,e.m);let n=e.h%12||12,r=e.h>=12?`PM`:`AM`;return`${n}:${o(e.m)} ${r}`},u=e=>{let t=String(e||``).trim().toLowerCase(),n=/^(\d{1,2})(?:[:.](\d{2})|(\d{2}))?\s*(?:([ap])\.?\s*(?:m\.?)?)?$/.exec(t);if(!n)return null;let r=+n[1],i=+(n[2]??n[3]??`0`);if(i>59)return null;if(n[4]){if(r<1||r>12)return null;r=r%12+(n[4]===`p`?12:0)}else if(r>23)return null;return{h:r,m:i}},d=0,f=class extends e{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`step`,`format`,`placeholder`,`disabled`,`required`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._uid=`wui-tp-${++d}`,this._typedError=``,this._typeahead=``,this._typeaheadTimer=null,this.addEventListener(`focusout`,e=>{this._isOpen?.()&&e.relatedTarget&&!this.contains(e.relatedTarget)&&this._close({commit:!0})})}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(this._rendered)switch(e){case`value`:this._value=n||``,this._typedError=``,this._syncFormValue(),this._syncText(),this._syncInvalid();return;case`aria-invalid`:case`aria-describedby`:this._syncInvalid();return;case`aria-label`:case`placeholder`:case`disabled`:case`required`:this._syncAttrs();return;default:this.render()}}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,this._typedError=``,a(this,this._value),this._syncText(),this._syncInvalid()}_format(){return this.getAttribute(`format`)||`24`}_step(){return Math.max(1,parseInt(this.getAttribute(`step`)||`30`,10)||30)}_bounds(){let e=c(this.getAttribute(`min`))||{h:0,m:0},t=c(this.getAttribute(`max`))||{h:23,m:59};return{min:e.h*60+e.m,max:t.h*60+t.m}}_allowed(e,t){let n=e*60+t,{min:r,max:i}=this._bounds();return n>=r&&n<=i&&n%this._step()===0}_times(){let e=[];for(let t=0;t<1440;t+=this._step()){let n=Math.floor(t/60),r=t%60;this._allowed(n,r)&&e.push({h:n,m:r})}return e}_refusal(e){if(this._allowed(e.h,e.m))return``;let t=this._format(),{min:n,max:r}=this._bounds(),i=e.h*60+e.m,a=e=>l({h:Math.floor(e/60),m:e%60},t);if(i<n||i>r){let e=!!c(this.getAttribute(`min`)),t=!!c(this.getAttribute(`max`));return e&&t?`Enter a time between ${a(n)} and ${a(r)}.`:e?`Enter a time at or after ${a(n)}.`:`Enter a time at or before ${a(r)}.`}return`Enter a time in ${this._step()}-minute steps.`}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value),this._isOpen=null;let e=this.getAttribute(`size`),t=e===`sm`?` input-sm`:e===`lg`?` input-lg`:``,n=this._uid;this.innerHTML=`
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-D8di0B-z.js";import{t as i}from"./iconGlyphs.g-Bk8AzmSO.js";import{t as a}from"./formMirror-BgY7zkC3.js";var o=e=>String(e).padStart(2,`0`),s=(e,t)=>`${o(e)}:${o(t)}`,c=e=>{let t=/^(\d{2}):(\d{2})$/.exec(e||``);return t?{h:+t[1],m:+t[2]}:null},l=(e,t=`24`)=>{if(!e)return``;if(t===`24`)return s(e.h,e.m);let n=e.h%12||12,r=e.h>=12?`PM`:`AM`;return`${n}:${o(e.m)} ${r}`},u=e=>{let t=String(e||``).trim().toLowerCase(),n=/^(\d{1,2})(?:[:.](\d{2})|(\d{2}))?\s*(?:([ap])\.?\s*(?:m\.?)?)?$/.exec(t);if(!n)return null;let r=+n[1],i=+(n[2]??n[3]??`0`);if(i>59)return null;if(n[4]){if(r<1||r>12)return null;r=r%12+(n[4]===`p`?12:0)}else if(r>23)return null;return{h:r,m:i}},d=0,f=class extends e{static formAssociated=!0;static get observedAttributes(){return[`value`,`min`,`max`,`step`,`format`,`placeholder`,`disabled`,`required`,`size`,`aria-label`,`aria-describedby`,`aria-invalid`]}constructor(){super();try{this._internals=this.attachInternals()}catch{this._internals=null}this._value=``,this._uid=`wui-tp-${++d}`,this._typedError=``,this._typeahead=``,this._typeaheadTimer=null,this.addEventListener(`focusout`,e=>{this._isOpen?.()&&e.relatedTarget&&!this.contains(e.relatedTarget)&&this._close({commit:!0})})}connectedCallback(){if(!this._rendered){this.render();return}this._bindGlobal?.()}attributeChangedCallback(e,t,n){if(this._rendered)switch(e){case`value`:this._value=n||``,this._typedError=``,this._syncFormValue(),this._syncText(),this._syncInvalid();return;case`aria-invalid`:case`aria-describedby`:this._syncInvalid();return;case`aria-label`:case`placeholder`:case`disabled`:case`required`:this._syncAttrs();return;default:this.render()}}formResetCallback(){this.value=this._defaultValue||``}get value(){return this._value}set value(e){this._value=e||``,this._typedError=``,a(this,this._value),this._syncText(),this._syncInvalid()}_format(){return this.getAttribute(`format`)||`24`}_step(){return Math.max(1,parseInt(this.getAttribute(`step`)||`30`,10)||30)}_bounds(){let e=c(this.getAttribute(`min`))||{h:0,m:0},t=c(this.getAttribute(`max`))||{h:23,m:59};return{min:e.h*60+e.m,max:t.h*60+t.m}}_allowed(e,t){let n=e*60+t,{min:r,max:i}=this._bounds();return n>=r&&n<=i&&n%this._step()===0}_times(){let e=[];for(let t=0;t<1440;t+=this._step()){let n=Math.floor(t/60),r=t%60;this._allowed(n,r)&&e.push({h:n,m:r})}return e}_refusal(e){if(this._allowed(e.h,e.m))return``;let t=this._format(),{min:n,max:r}=this._bounds(),i=e.h*60+e.m,a=e=>l({h:Math.floor(e/60),m:e%60},t);if(i<n||i>r){let e=!!c(this.getAttribute(`min`)),t=!!c(this.getAttribute(`max`));return e&&t?`Enter a time between ${a(n)} and ${a(r)}.`:e?`Enter a time at or after ${a(n)}.`:`Enter a time at or before ${a(r)}.`}return`Enter a time in ${this._step()}-minute steps.`}render(){this._defaultValue===void 0&&(this._defaultValue=this.getAttribute(`value`)||``,this._value=this._defaultValue||this._value),this._isOpen=null;let e=this.getAttribute(`size`),t=e===`sm`?` input-sm`:e===`lg`?` input-lg`:``,n=this._uid;this.innerHTML=`
2
2
  <div class="timepicker">
3
3
  <div class="wui-timepicker-field">
4
4
  <input type="text" class="input timepicker-trigger${t}" id="${n}-input" role="combobox" aria-haspopup="dialog" aria-expanded="false" aria-controls="${n}-pop" aria-autocomplete="none" autocomplete="off" spellcheck="false">
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n}from"./anchorOverlay-HAWsGzlr.js";import{t as r}from"./tourOpenMark-nPeAJFSo.js";var i=`data-advance`,a=`wui-tour-hint`,o=`Click {actionName} to continue.`,s=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,c=(e,t)=>e?.advanceOn===`click`&&!!t,l=e=>(e??``).replace(/\s+/g,` `).trim();function u(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=l(e);if(t)return t}return``}function d(e){for(let t of[e,...e.querySelectorAll(s)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function f(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function p(e,t){let n=e.querySelector(`.${a}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t){n?.remove(),i&&f(e,i,!1);return}n||(n=e.ownerDocument.createElement(`p`),n.className=a,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&f(e,i,!0)}var m=e=>getComputedStyle(e).animationName;function h(e,{layer:t,spot:n,card:r},a,s){let d=c(a,s);t.toggleAttribute(i,d&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(i)&&(n.removeAttribute(i),d&&m(n)),d&&n.setAttribute(i,``);let f=r.querySelector(`.wui-tour-next`);f.classList.toggle(`btn-primary`,!d),f.classList.toggle(`btn-link`,d);let h=d?l(a.actionLabel)||u(s):``,g=e.getAttribute(`advance-label`)||o,_=h?g.replace(/\{actionName\}/g,()=>h):``;return p(r,_),_}function g(e,t,n){if(!c(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function _(e,t,n,r){return e.contains(r)||c(t,n)&&n.contains(r)}function ee(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=c(r,i)?d(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var te=2/3,ne=1e3,re=new Set([`top`,`left`,`width`,`height`]),v=new WeakMap,y=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],b=e=>e.transitionProperty===`opacity`,ie=e=>re.has(e.transitionProperty),x=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function S(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,ne);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function ae(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?y(t,ie):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*te-r)}return n}function C(e){let t=ae(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};v.set(e,n);let r=()=>{v.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=y(e,x);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function w(e){return e.dataset.state=`leaving`,S(y(e,b))}function oe(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?S(y(t,b)):null;if(!n){e.remove();return}e.setAttribute(`inert`,``),n.then(()=>e.remove())}var T=2,E=12,D=8,O=4,k=20,se=`(max-width: 575.98px)`,ce=[`bottom`,`top`,`right`,`left`],A=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],j,M=(e,t,n)=>Math.max(t,Math.min(e,n)),N=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function le(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=z(e),r=e.offsetHeight+E;if(t.getBoundingClientRect().height+T*2+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+T}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function P(e,t,n){let r=e.style,i=t.style,a=B(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of A)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,F(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=z(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-E,top:o.top-E-l.top,right:l.right-o.right-E,left:o.left-E-l.left},f=window.matchMedia(se).matches,p=ce.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+D)-Math.max(o.top,l.top-D);p?I(t,a,p,o,l,c):m>=Math.min(c.height,u)+O*2?L(t,a,o,l,c):R(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function F(e,t){j??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of A)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),j&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function I(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=N(r.left,r.right,i.left,i.right);s=M(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+E:r.top-E-a.height,l=M(e-s,k,a.width-k)}else{let e=N(r.top,r.bottom,i.top,i.bottom);c=M(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+E:r.left-E-a.width,l=M(e-c,k,a.height-k)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function L(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-O;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${M(n.left+O,r.left,r.right-i.width)}px`}function R(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+E:r.top-E-c}px`;let l=N(r.left,r.right,i.left,i.right);e.style.left=`${M(l-a.width/2,i.left,i.right-a.width)}px`}function z(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+D,bottom:window.innerHeight-r(`paddingBottom`)-D,left:r(`paddingLeft`)+D,right:window.innerWidth-r(`paddingRight`)-D}}function B(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var V=0;function H(e,t,n){let r=`wui-tour-end-${++V}`,i=e.createElement(`div`);return i.className=`wui-tour-card wui-tour-end`,i.dataset.layout=`center`,i.setAttribute(`role`,`dialog`),n&&i.setAttribute(`aria-modal`,`true`),i.tabIndex=-1,i.setAttribute(`aria-labelledby`,`${r}-title`),i.setAttribute(`aria-describedby`,`${r}-message`),i.innerHTML=` <div class="wui-tour-end-mark" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div> <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p> <div class="wui-tour-actions"><button type="button" class="btn btn-sm btn-primary wui-tour-end-button"></button></div>`,i.querySelector(`.wui-tour-end-title`).textContent=t.title,i.querySelector(`.wui-tour-end-message`).textContent=t.message,i.querySelector(`.wui-tour-end-button`).textContent=t.button,i}function U(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=H(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,P(o,a,null),e.append(c),C(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=w(a);h?h.then(m):m()})}var W=` :host { all: initial; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay":`0 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out-quart":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-motion-duration":`200ms`,"--wui-tour-motion-ease":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-spot-duration":`240ms`,"--wui-tour-spot-ease":`cubic-bezier(0.32, 0.72, 0, 1)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-primary-text":`#FFFFFF`,"--color-success-soft":`#E8FAEE`,"--color-success-text":`#0e7531`,"--color-on-scrim":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-bg-muted":`#F5F6FA`}).map(([e,t])=>` ${e}: ${t};`).join(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-text); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-secondary { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-secondary:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-ink); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-card { pointer-events: auto; } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-overlay); } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } @keyframes wui-tour-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes wui-tour-card-enter { from { opacity: 0; scale: 0.96; translate: var(--wui-tour-card-lift, 0 6px); } to { opacity: 1; scale: 1; translate: 0 0; } } .wui-tour-layer[data-state=leaving], .wui-tour-card[data-state=leaving] { opacity: 0; } .wui-tour-layer[data-state=leaving], .wui-tour-layer[data-state=leaving] * { pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-layer { animation: wui-tour-fade-in var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-spot { transition: top var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), left var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), width var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), height var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), border-radius var(--wui-tour-spot-duration) var(--wui-tour-spot-ease); } .wui-tour-spot[data-tracking] { transition: none; } .wui-tour-card { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=top] { --wui-tour-card-lift: 0 -6px; transform-origin: bottom center; } .wui-tour-card[data-placement=bottom] { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=left] { --wui-tour-card-lift: -6px 0; transform-origin: right center; } .wui-tour-card[data-placement=right] { --wui-tour-card-lift: 6px 0; transform-origin: left center; } .wui-tour-card[data-placement=overlap], .wui-tour-card[data-placement=center] { --wui-tour-card-lift: 0 0; transform-origin: center; } .wui-tour-card[data-state=entering] { animation: wui-tour-card-enter var(--wui-tour-motion-duration) var(--wui-tour-motion-ease) var(--wui-tour-card-delay, 0ms) both; } .wui-tour-card[data-state=leaving] { transition: opacity calc(var(--wui-tour-motion-duration) / 2) var(--wui-tour-motion-ease); } } @media (prefers-reduced-motion: reduce) { .wui-tour-layer { animation: wui-tour-fade-in 120ms linear; } .wui-tour-layer[data-state=leaving] { transition: opacity 120ms linear; } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in 120ms linear both; } } .wui-tour-progress-bar { display: flex; gap: 4px; } .wui-tour-progress-segment { flex: 1 1 0; height: 4px; border-radius: 999px; background: var(--color-border); } .wui-tour-progress-segment[data-filled] { background: var(--color-primary); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-layer { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } .wui-tour-card:has(.wui-tour-arrow:not([hidden])) { overflow: visible; } .wui-tour-arrow { position: absolute; width: 8px; height: 8px; background: var(--color-surface); border: 1px solid var(--color-border); rotate: 45deg; pointer-events: none; } .wui-tour-card[data-placement=bottom] .wui-tour-arrow { top: -5px; border-right-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=top] .wui-tour-arrow { bottom: -5px; border-top-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=right] .wui-tour-arrow { left: -5px; border-top-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=left] .wui-tour-arrow { right: -5px; border-bottom-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } @media (max-width: 575.98px) { .wui-tour-card { width: calc(100vw - 16px); } .wui-tour-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } .wui-tour-media { position: relative; order: -1; flex: none; aspect-ratio: 16/9; margin: -16px -16px 4px; overflow: hidden; background: var(--color-border); } .wui-tour-media>img, .wui-tour-media>video { display: block; width: 100%; height: 100%; object-fit: cover; } .wui-tour-card[data-media=welcome] { width: min(420px, 100vw - 16px); } .wui-tour-media-toggle { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--color-scrim-strong); color: var(--color-on-scrim); cursor: pointer; } .wui-tour-media-toggle>svg { width: 20px; height: 20px; fill: currentColor; } .wui-tour-media-toggle:focus-visible { outline: 2px solid var(--color-on-scrim); outline-offset: 2px; } .wui-tour-layer[data-advance] { pointer-events: none; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-card { pointer-events: auto; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-spot::before { content: ""; position: absolute; inset: -100vmax; pointer-events: auto; clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 100vmax 100vmax, calc(100% - 100vmax) 100vmax, calc(100% - 100vmax) calc(100% - 100vmax), 100vmax calc(100% - 100vmax), 100vmax 100vmax); } .wui-tour-hint { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); } @keyframes wui-tour-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 85%, transparent); } to { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-primary) 0%, transparent); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot[data-advance]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; pointer-events: none; animation: wui-tour-pulse 600ms var(--wui-ease-out-quart) var(--wui-tour-spot-duration); } } @keyframes wui-tour-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } } .wui-tour-end[data-layout=center] { --wui-tour-card-lift: 0 0; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; align-items: center; gap: 8px; width: min(420px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 24px; text-align: center; } .wui-tour-end[data-layout=center] .wui-tour-actions { justify-content: center; margin-top: 8px; } .wui-tour-end-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); } .wui-tour-end-mark>svg { width: 26px; height: 26px; } .wui-tour-end-mark path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; } .wui-tour-end-title { font-size: 18px; } .wui-tour-end-message { text-wrap: balance; } .wui-tour-end-button { min-width: 120px; } @media (prefers-reduced-motion: no-preference) { .wui-tour-end-mark path { animation: wui-tour-check 300ms var(--wui-ease-out-quart) calc(var(--wui-tour-card-delay, 0ms) + 120ms) both; } } `,G=`wui-tour-media`,ue=`wui-tour-media-toggle`,K=`http://www.w3.org/2000/svg`,de=`M6 5h4v14H6zM14 5h4v14h-4z`,fe=`M8 5v14l11-7z`,pe={pause:`Pause animation`,play:`Play animation`},me=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function he(e){let t=document.createElementNS(K,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(K,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ge(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function _e(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function ve(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=ue;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(he(r?de:fe))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function ye(e){let t=e.querySelector(`:scope > .${G}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function be(e,t,n=pe){if(ye(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=G,t.mediaType===`video`){let e=_e(t,!me());r.append(e,ve(e,n))}else r.appendChild(ge(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var xe=`Step {current} of {total}`;function Se(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function Ce(e,t,n){return(e.getAttribute(`progress-label`)||xe).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function we(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var Te=`wui-tour-step`,Ee=`wui-tour-host`,De=`wui-tour-seen:`,q=`data-tracking`,Oe={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},ke={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Ae=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],J={index:null,position:null,total:null},je=0;function Y(e=De,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var X=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Z=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Q=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Me(e){$||($=new CSSStyleSheet,$.replaceSync(W)),e.adoptedStyleSheets=[$]}var Ne=class extends e{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e!==`open`||!this.isConnected||(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${Te}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Ae)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Y():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(ke[e])||Oe[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=Se(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!X(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);if(e===this._run){if(!n){this._finish(`noTargets`);return}this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))}}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(X(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++je}`,n=document.createElement(`div`);n.className=`wui-tour-layer`,n.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="btn btn-sm btn-outline-secondary wui-tour-back"></button> <button type="button" class="btn btn-sm btn-primary wui-tour-next"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let i=n;this._shadow=null,this.isolated&&(i=document.createElement(Ee),this._shadow=i.attachShadow({mode:`open`}),Me(this._shadow),this._shadow.appendChild(n)),document.body.appendChild(i),document.documentElement.setAttribute(r,``),this._outer=i,this._layer=n,this._spot=n.querySelector(`.wui-tour-spot`),this._card=n.querySelector(`.wui-tour-card`),this._live=n.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;_(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),t(i,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=Ce(this,a,o);we(i,{text:c,position:a,total:o}),be(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=h(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,le(i,n),this._spot.removeAttribute(q),this._place(),C(i),this._unbindAdvance?.(),this._unbindAdvance=g(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Z(Q()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){!this._current||!this._layer||P(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(q,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=w(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,h(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(q),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),U(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Z(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;ee(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,n(this._outer),oe(this._outer),document.documentElement.removeAttribute(r),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:J,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=J,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}};export{Y as n,Ne as t};
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n}from"./anchorOverlay-D8di0B-z.js";import{t as r}from"./tourOpenMark-nPeAJFSo.js";var i=`data-advance`,a=`wui-tour-hint`,o=`Click {actionName} to continue.`,s=`a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]`,c=(e,t)=>e?.advanceOn===`click`&&!!t,l=e=>(e??``).replace(/\s+/g,` `).trim();function u(e){let t=e.ownerDocument,n=(e.getAttribute(`aria-labelledby`)||``).split(/\s+/).filter(Boolean),r=e.tagName===`INPUT`&&/^(button|submit|reset)$/.test(e.type)?e.value:``,i=[n.map(e=>t.getElementById(e)?.textContent??``).join(` `),e.getAttribute(`aria-label`),Array.from(e.labels??[],e=>e.textContent).join(` `),e.getAttribute(`alt`),r,e.textContent,e.getAttribute(`title`)];for(let e of i){let t=l(e);if(t)return t}return``}function d(e){for(let t of[e,...e.querySelectorAll(s)])if(t.tabIndex>=0&&!t.disabled)return t;return null}function f(e,t,n){let r=(e.getAttribute(`aria-describedby`)||``).split(/\s+/).filter(e=>e&&e!==t);n&&r.push(t),r.length>0?e.setAttribute(`aria-describedby`,r.join(` `)):e.removeAttribute(`aria-describedby`)}function p(e,t){let n=e.querySelector(`.${a}`),r=e.querySelector(`.wui-tour-text`)?.id,i=r?`${r.replace(/-text$/,``)}-hint`:``;if(!t){n?.remove(),i&&f(e,i,!1);return}n||(n=e.ownerDocument.createElement(`p`),n.className=a,i&&(n.id=i),e.querySelector(`.wui-tour-actions`).before(n)),n.textContent=t,i&&f(e,i,!0)}var m=e=>getComputedStyle(e).animationName;function h(e,{layer:t,spot:n,card:r},a,s){let d=c(a,s);t.toggleAttribute(i,d&&!(t.getRootNode()instanceof ShadowRoot)),n.hasAttribute(i)&&(n.removeAttribute(i),d&&m(n)),d&&n.setAttribute(i,``);let f=r.querySelector(`.wui-tour-next`);f.classList.toggle(`btn-primary`,!d),f.classList.toggle(`btn-link`,d);let h=d?l(a.actionLabel)||u(s):``,g=e.getAttribute(`advance-label`)||o,_=h?g.replace(/\{actionName\}/g,()=>h):``;return p(r,_),_}function g(e,t,n){if(!c(e,t))return()=>{};let r=null,i=()=>{r??=setTimeout(n,0)};return t.addEventListener(`click`,i),()=>{t.removeEventListener(`click`,i),clearTimeout(r)}}function _(e,t,n,r){return e.contains(r)||c(t,n)&&n.contains(r)}function ee(e,{card:t,active:n,step:r,target:i}){let a=Array.from(t.querySelectorAll(`button`)).filter(e=>!e.hidden),o=c(r,i)?d(i):null;o&&a.push(o);let s=a.findIndex(e=>e===n||e===o&&i.contains(n));e.preventDefault(),a[s===-1?e.shiftKey?a.length-1:0:(s+(e.shiftKey?-1:1)+a.length)%a.length].focus()}var te=2/3,ne=1e3,re=new Set([`top`,`left`,`width`,`height`]),v=new WeakMap,y=(e,t)=>typeof e.getAnimations==`function`?e.getAnimations().filter(t):[],b=e=>e.transitionProperty===`opacity`,ie=e=>re.has(e.transitionProperty),x=e=>typeof e.animationName==`string`&&e.animationName.startsWith(`wui-tour-`);function S(e){return e.length===0?null:new Promise(t=>{let n=setTimeout(t,ne);Promise.allSettled(e.map(e=>e.finished)).then(()=>{clearTimeout(n),t()})})}function ae(e){let t=e.parentElement?.querySelector(`:scope > .wui-tour-spot`),n=0;for(let e of t?y(t,ie):[]){let t=e.effect?.getComputedTiming?.();if(typeof t?.duration!=`number`)continue;let r=typeof e.currentTime==`number`?e.currentTime:0;n=Math.max(n,(t.delay??0)+t.duration*te-r)}return n}function C(e){let t=ae(e);t>0?e.style.setProperty(`--wui-tour-card-delay`,`${Math.round(t)}ms`):e.style.removeProperty(`--wui-tour-card-delay`),e.dataset.state=`entering`;let n={};v.set(e,n);let r=()=>{v.get(e)===n&&e.dataset.state===`entering`&&(e.dataset.state=`shown`)},i=y(e,x);i.length===0?r():Promise.allSettled(i.map(e=>e.finished)).then(r)}function w(e){return e.dataset.state=`leaving`,S(y(e,b))}function oe(e){let t=e.classList.contains(`wui-tour-layer`)?e:e.shadowRoot?.querySelector(`.wui-tour-layer`);t&&(t.dataset.state=`leaving`);let n=t?S(y(t,b)):null;if(!n){e.remove();return}e.setAttribute(`inert`,``),n.then(()=>e.remove())}var T=2,E=12,D=8,O=4,k=20,se=`(max-width: 575.98px)`,ce=[`bottom`,`top`,`right`,`left`],A=[`top-left`,`top-right`,`bottom-right`,`bottom-left`],j,M=(e,t,n)=>Math.max(t,Math.min(e,n)),N=(e,t,n,r)=>(Math.max(e,n)+Math.min(t,r))/2;function le(e,t){if(!t?.scrollIntoView)return;e.style.maxHeight=``;let n=z(e),r=e.offsetHeight+E;if(t.getBoundingClientRect().height+T*2+r*2<=n.bottom-n.top){t.scrollIntoView({block:`center`,inline:`nearest`});return}let i=t.style.scrollMarginTop;t.style.scrollMarginTop=`${n.top+r+T}px`,t.scrollIntoView({block:`start`,inline:`nearest`}),t.style.scrollMarginTop=i}function P(e,t,n){let r=e.style,i=t.style,a=B(t);if(!n){r.top=`50%`,r.left=`50%`,r.width=`0px`,r.height=`0px`,r.boxShadow=`0 0 0 100vmax var(--color-scrim-strong)`;for(let e of A)r.removeProperty(`border-${e}-radius`),r.removeProperty(`corner-${e}-shape`);t.dataset.placement=`center`,a.hidden=!0,i.position=`fixed`,i.top=`50%`,i.left=`50%`,i.transform=`translate(-50%, -50%)`,i.maxHeight=`calc(100vh - 16px)`;return}r.boxShadow=``,i.transform=``,i.position=`fixed`;let o=n.getBoundingClientRect();r.top=`${o.top}px`,r.left=`${o.left}px`,r.width=`${o.width}px`,r.height=`${o.height}px`,F(r,n);let s=t.scrollTop;i.maxHeight=``;let c={width:t.offsetWidth,height:t.offsetHeight},l=z(t),u=l.bottom-l.top,d={bottom:l.bottom-o.bottom-E,top:o.top-E-l.top,right:l.right-o.right-E,left:o.left-E-l.left},f=window.matchMedia(se).matches,p=ce.find(e=>e===`top`||e===`bottom`?c.height<=d[e]+1:!f&&c.width<=d[e]+1&&c.height<=u+1),m=Math.min(o.bottom,l.bottom+D)-Math.max(o.top,l.top-D);p?I(t,a,p,o,l,c):m>=Math.min(c.height,u)+O*2?L(t,a,o,l,c):R(t,a,d.bottom>=d.top?`bottom`:`top`,o,l,c,d),t.scrollTop=s}function F(e,t){j??=CSS.supports(`corner-top-left-shape`,`squircle`);let n=getComputedStyle(t);for(let t of A)e.setProperty(`border-${t}-radius`,n.getPropertyValue(`border-${t}-radius`)),j&&e.setProperty(`corner-${t}-shape`,n.getPropertyValue(`corner-${t}-shape`))}function I(e,t,n,r,i,a){let o=n===`top`||n===`bottom`,s,c,l;if(o){let e=N(r.left,r.right,i.left,i.right);s=M(e-a.width/2,i.left,i.right-a.width),c=n===`bottom`?r.bottom+E:r.top-E-a.height,l=M(e-s,k,a.width-k)}else{let e=N(r.top,r.bottom,i.top,i.bottom);c=M(e-a.height/2,i.top,i.bottom-a.height),s=n===`right`?r.right+E:r.left-E-a.width,l=M(e-c,k,a.height-k)}e.dataset.placement=n,e.style.top=`${c}px`,e.style.left=`${s}px`,t.hidden=!1,t.style.left=o?`${l-e.clientLeft-t.offsetWidth/2}px`:``,t.style.top=o?``:`${l-e.clientTop-t.offsetHeight/2}px`}function L(e,t,n,r,i){let a=r.bottom-r.top;e.dataset.placement=`overlap`,t.hidden=!0,e.style.maxHeight=i.height>a?`${Math.max(a,0)}px`:``;let o=Math.min(n.bottom,r.bottom)-O;e.style.top=`${Math.max(r.top,o-Math.min(i.height,a))}px`,e.style.left=`${M(n.left+O,r.left,r.right-i.width)}px`}function R(e,t,n,r,i,a,o){let s=Math.max(o[n],0),c=Math.min(a.height,s);e.dataset.placement=n,t.hidden=!0,e.style.maxHeight=a.height>s?`${s}px`:``,e.style.top=`${n===`bottom`?r.bottom+E:r.top-E-c}px`;let l=N(r.left,r.right,i.left,i.right);e.style.left=`${M(l-a.width/2,i.left,i.right-a.width)}px`}function z(e){let t=e.parentElement,n=t?getComputedStyle(t):null,r=e=>Number.parseFloat(n?.[e])||0;return{top:r(`paddingTop`)+D,bottom:window.innerHeight-r(`paddingBottom`)-D,left:r(`paddingLeft`)+D,right:window.innerWidth-r(`paddingRight`)-D}}function B(e){let t=e.querySelector(`:scope > .wui-tour-arrow`);return t||(t=document.createElement(`span`),t.className=`wui-tour-arrow`,t.setAttribute(`aria-hidden`,`true`),t.hidden=!0,e.append(t)),t}var V=0;function H(e,t,n){let r=`wui-tour-end-${++V}`,i=e.createElement(`div`);return i.className=`wui-tour-card wui-tour-end`,i.dataset.layout=`center`,i.setAttribute(`role`,`dialog`),n&&i.setAttribute(`aria-modal`,`true`),i.tabIndex=-1,i.setAttribute(`aria-labelledby`,`${r}-title`),i.setAttribute(`aria-describedby`,`${r}-message`),i.innerHTML=` <div class="wui-tour-end-mark" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></div> <h2 class="wui-tour-title wui-tour-end-title" id="${r}-title"></h2> <p class="wui-tour-text wui-tour-end-message" id="${r}-message"></p> <div class="wui-tour-actions"><button type="button" class="btn btn-sm btn-primary wui-tour-end-button"></button></div>`,i.querySelector(`.wui-tour-end-title`).textContent=t.title,i.querySelector(`.wui-tour-end-message`).textContent=t.message,i.querySelector(`.wui-tour-end-button`).textContent=t.button,i}function U(e,t,n){let r=e.ownerDocument,i=e.getRootNode()===r,a=e.querySelector(`.wui-tour-card:not(.wui-tour-end)`),o=e.querySelector(`.wui-tour-spot`),s=e.querySelector(`[role=status]`),c=H(r,t,i),l=c.querySelector(`.wui-tour-end-button`),u=new AbortController;return new Promise(d=>{let f=()=>{u.abort(),d()};if(n?.aborted){f();return}let p={signal:u.signal};n?.addEventListener(`abort`,f,p),l.addEventListener(`click`,f,p),r.addEventListener(`keydown`,e=>{e.altKey||e.ctrlKey||e.metaKey||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),f()):e.key===`Tab`&&i&&(e.preventDefault(),l.focus()))},{capture:!0,signal:u.signal}),i&&r.addEventListener(`focusin`,e=>{c.contains(e.target)||l.focus()},p);let m=()=>{u.signal.aborted||(a.hidden=!0,P(o,a,null),e.append(c),C(c),s.textContent=[t.title,t.message].filter(Boolean).join(`. `),l.focus())},h=w(a);h?h.then(m):m()})}var W=` :host { all: initial; ${Object.entries({"--wui-z-tour":`1550`,"--wui-radius-sm":`8px`,"--wui-radius-lg":`14px`,"--wui-shadow-overlay":`0 8px 28px -6px rgba(7, 20, 55, 0.14)`,"--wui-ease-out-quart":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-motion-duration":`200ms`,"--wui-tour-motion-ease":`cubic-bezier(0.22, 1, 0.36, 1)`,"--wui-tour-spot-duration":`240ms`,"--wui-tour-spot-ease":`cubic-bezier(0.32, 0.72, 0, 1)`,"--color-primary":`#4F46E5`,"--color-primary-hover":`#4338CA`,"--color-primary-ink":`#4F46E5`,"--color-focus-ring":`#4F46E5`,"--wui-focus-ring-width":`2px`,"--wui-focus-ring-offset":`2px`,"--color-primary-text":`#FFFFFF`,"--color-success-soft":`#E8FAEE`,"--color-success-text":`#0e7531`,"--color-on-scrim":`#FFFFFF`,"--color-scrim-strong":`color-mix(in srgb, #071437 62%, transparent)`,"--color-surface":`#FFFFFF`,"--color-text":`#071437`,"--color-text-muted":`#4B5675`,"--color-border":`#EBEDF3`,"--color-bg-muted":`#F5F6FA`}).map(([e,t])=>` ${e}: ${t};`).join(` `)} } *, *::before, *::after { box-sizing: border-box; } [hidden] { display: none !important; } .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } .btn { display: inline-block; margin: 0; padding: 0.25rem 0.5rem; border: 1px solid transparent; border-radius: 0.375rem; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.5; text-align: center; text-decoration: none; white-space: nowrap; cursor: pointer; } .btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; } .btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-primary-text); } .btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } .btn-outline-secondary { border-color: var(--color-text-muted); color: var(--color-text-muted); } .btn-outline-secondary:hover { background: var(--color-bg-muted); color: var(--color-text); } .btn-link { font-weight: 400; color: var(--color-primary-ink); text-decoration: underline; } .btn-link:hover { color: var(--color-primary-hover); } .wui-tour-layer { pointer-events: none; font-family: "Webority Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-weight: 400; line-height: 1.5; color: var(--color-text); text-align: start; } .wui-tour-card { pointer-events: auto; } .wui-tour-layer { position: fixed; inset: 0; z-index: var(--wui-z-tour); } .wui-tour-spot { position: fixed; box-shadow: 0 0 0 2px var(--color-primary), 0 0 0 100vmax var(--color-scrim-strong); pointer-events: none; } .wui-tour-card { display: flex; flex-direction: column; gap: 8px; width: min(360px, 100vw - 16px); padding: 16px; overflow-y: auto; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: var(--wui-radius-lg); corner-shape: squircle; box-shadow: var(--wui-shadow-overlay); } .wui-tour-card:focus { outline: none; } .wui-tour-card:focus-visible { outline: var(--wui-focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--wui-focus-ring-offset); } .wui-tour-title { margin: 0; font-size: 16px; font-weight: 600; } .wui-tour-text { margin: 0; font-size: 14px; color: var(--color-text-muted); } .wui-tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; } .wui-tour-nav { display: flex; gap: 8px; } .wui-tour-skip { color: var(--color-text-muted); } .wui-tour-back, .wui-tour-next { min-width: 64px; } @keyframes wui-tour-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes wui-tour-card-enter { from { opacity: 0; scale: 0.96; translate: var(--wui-tour-card-lift, 0 6px); } to { opacity: 1; scale: 1; translate: 0 0; } } .wui-tour-layer[data-state=leaving], .wui-tour-card[data-state=leaving] { opacity: 0; } .wui-tour-layer[data-state=leaving], .wui-tour-layer[data-state=leaving] * { pointer-events: none; } @media (prefers-reduced-motion: no-preference) { .wui-tour-layer { animation: wui-tour-fade-in var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-layer[data-state=leaving] { transition: opacity var(--wui-tour-motion-duration) var(--wui-tour-motion-ease); } .wui-tour-spot { transition: top var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), left var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), width var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), height var(--wui-tour-spot-duration) var(--wui-tour-spot-ease), border-radius var(--wui-tour-spot-duration) var(--wui-tour-spot-ease); } .wui-tour-spot[data-tracking] { transition: none; } .wui-tour-card { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=top] { --wui-tour-card-lift: 0 -6px; transform-origin: bottom center; } .wui-tour-card[data-placement=bottom] { --wui-tour-card-lift: 0 6px; transform-origin: top center; } .wui-tour-card[data-placement=left] { --wui-tour-card-lift: -6px 0; transform-origin: right center; } .wui-tour-card[data-placement=right] { --wui-tour-card-lift: 6px 0; transform-origin: left center; } .wui-tour-card[data-placement=overlap], .wui-tour-card[data-placement=center] { --wui-tour-card-lift: 0 0; transform-origin: center; } .wui-tour-card[data-state=entering] { animation: wui-tour-card-enter var(--wui-tour-motion-duration) var(--wui-tour-motion-ease) var(--wui-tour-card-delay, 0ms) both; } .wui-tour-card[data-state=leaving] { transition: opacity calc(var(--wui-tour-motion-duration) / 2) var(--wui-tour-motion-ease); } } @media (prefers-reduced-motion: reduce) { .wui-tour-layer { animation: wui-tour-fade-in 120ms linear; } .wui-tour-layer[data-state=leaving] { transition: opacity 120ms linear; } .wui-tour-card[data-state=entering] { animation: wui-tour-fade-in 120ms linear both; } } .wui-tour-progress-bar { display: flex; gap: 4px; } .wui-tour-progress-segment { flex: 1 1 0; height: 4px; border-radius: 999px; background: var(--color-border); } .wui-tour-progress-segment[data-filled] { background: var(--color-primary); } .wui-tour-position { margin: 0; font-size: 12px; color: var(--color-text-muted); } .wui-tour-layer { padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); } .wui-tour-card:has(.wui-tour-arrow:not([hidden])) { overflow: visible; } .wui-tour-arrow { position: absolute; width: 8px; height: 8px; background: var(--color-surface); border: 1px solid var(--color-border); rotate: 45deg; pointer-events: none; } .wui-tour-card[data-placement=bottom] .wui-tour-arrow { top: -5px; border-right-color: rgba(0, 0, 0, 0); border-bottom-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=top] .wui-tour-arrow { bottom: -5px; border-top-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=right] .wui-tour-arrow { left: -5px; border-top-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0); } .wui-tour-card[data-placement=left] .wui-tour-arrow { right: -5px; border-bottom-color: rgba(0, 0, 0, 0); border-left-color: rgba(0, 0, 0, 0); } @media (max-width: 575.98px) { .wui-tour-card { width: calc(100vw - 16px); } .wui-tour-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; } } .wui-tour-media { position: relative; order: -1; flex: none; aspect-ratio: 16/9; margin: -16px -16px 4px; overflow: hidden; background: var(--color-border); } .wui-tour-media>img, .wui-tour-media>video { display: block; width: 100%; height: 100%; object-fit: cover; } .wui-tour-card[data-media=welcome] { width: min(420px, 100vw - 16px); } .wui-tour-media-toggle { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--color-scrim-strong); color: var(--color-on-scrim); cursor: pointer; } .wui-tour-media-toggle>svg { width: 20px; height: 20px; fill: currentColor; } .wui-tour-media-toggle:focus-visible { outline: 2px solid var(--color-on-scrim); outline-offset: 2px; } .wui-tour-layer[data-advance] { pointer-events: none; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-card { pointer-events: auto; } .wui-tour-layer[data-advance]:not([data-state=leaving]) .wui-tour-spot::before { content: ""; position: absolute; inset: -100vmax; pointer-events: auto; clip-path: polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, 100vmax 100vmax, calc(100% - 100vmax) 100vmax, calc(100% - 100vmax) calc(100% - 100vmax), 100vmax calc(100% - 100vmax), 100vmax 100vmax); } .wui-tour-hint { margin: 0; font-size: 14px; font-weight: 600; color: var(--color-text); } @keyframes wui-tour-pulse { from { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 85%, transparent); } to { box-shadow: 0 0 0 14px color-mix(in srgb, var(--color-primary) 0%, transparent); } } @media (prefers-reduced-motion: no-preference) { .wui-tour-spot[data-advance]::after { content: ""; position: absolute; inset: 0; border-radius: inherit; corner-shape: inherit; pointer-events: none; animation: wui-tour-pulse 600ms var(--wui-ease-out-quart) var(--wui-tour-spot-duration); } } @keyframes wui-tour-check { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } } .wui-tour-end[data-layout=center] { --wui-tour-card-lift: 0 0; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); transform-origin: center; align-items: center; gap: 8px; width: min(420px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 24px; text-align: center; } .wui-tour-end[data-layout=center] .wui-tour-actions { justify-content: center; margin-top: 8px; } .wui-tour-end-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); } .wui-tour-end-mark>svg { width: 26px; height: 26px; } .wui-tour-end-mark path { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; } .wui-tour-end-title { font-size: 18px; } .wui-tour-end-message { text-wrap: balance; } .wui-tour-end-button { min-width: 120px; } @media (prefers-reduced-motion: no-preference) { .wui-tour-end-mark path { animation: wui-tour-check 300ms var(--wui-ease-out-quart) calc(var(--wui-tour-card-delay, 0ms) + 120ms) both; } } `,G=`wui-tour-media`,ue=`wui-tour-media-toggle`,K=`http://www.w3.org/2000/svg`,de=`M6 5h4v14H6zM14 5h4v14h-4z`,fe=`M8 5v14l11-7z`,pe={pause:`Pause animation`,play:`Play animation`},me=()=>globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`)?.matches===!0;function he(e){let t=document.createElementNS(K,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`),t.setAttribute(`aria-hidden`,`true`),t.setAttribute(`focusable`,`false`);let n=document.createElementNS(K,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}function ge(e){let t=document.createElement(`img`);return t.setAttribute(`alt`,e.mediaAlt??``),t.setAttribute(`width`,`1280`),t.setAttribute(`height`,`720`),t.setAttribute(`loading`,`lazy`),t.setAttribute(`decoding`,`async`),t.setAttribute(`src`,e.media),t}function _e(e,t){let n=document.createElement(`video`);return n.muted=!0,n.setAttribute(`muted`,``),n.loop=!0,n.setAttribute(`playsinline`,``),t&&n.setAttribute(`autoplay`,``),n.setAttribute(`preload`,t?`auto`:`metadata`),e.mediaAlt&&n.setAttribute(`aria-label`,e.mediaAlt),e.mediaPoster&&n.setAttribute(`poster`,e.mediaPoster),n.setAttribute(`src`,e.media),n}function ve(e,t){let n=document.createElement(`button`);n.type=`button`,n.className=ue;let r=(r=!e.paused)=>{n.setAttribute(`aria-label`,r?t.pause:t.play),n.replaceChildren(he(r?de:fe))};return e.addEventListener(`play`,()=>r()),e.addEventListener(`pause`,()=>r()),n.addEventListener(`click`,()=>{e.paused?e.play()?.catch(()=>r()):e.pause()}),r(e.hasAttribute(`autoplay`)),n}function ye(e){let t=e.querySelector(`:scope > .${G}`);if(!t)return;let n=t.querySelector(`video`);n&&(n.pause(),n.removeAttribute(`src`),n.load()),t.remove()}function be(e,t,n=pe){if(ye(e),!t.media){e.removeAttribute(`data-media`);return}let r=document.createElement(`div`);if(r.className=G,t.mediaType===`video`){let e=_e(t,!me());r.append(e,ve(e,n))}else r.appendChild(ge(t));e.prepend(r),e.setAttribute(`data-media`,t.target?`step`:`welcome`)}var xe=`Step {current} of {total}`;function Se(e){let t=new Set;return{drop:e=>{t.add(e)},position:e=>{t.delete(e);let n=0;for(let r of t)r<e&&n++;return e+1-n},total:()=>e-t.size}}function Ce(e,t,n){return(e.getAttribute(`progress-label`)||xe).replace(/\{(current|total)\}/g,(e,r)=>String(r===`current`?t:n))}function we(e,{text:t,position:n,total:r}){let i=e.querySelector(`.wui-tour-position`);i.textContent=t;let a=e.querySelector(`.wui-tour-progress-bar`);if(!a){let t=e.ownerDocument,n=t.createElement(`div`);n.className=`wui-tour-progress`,n.setAttribute(`aria-hidden`,`true`),a=t.createElement(`div`),a.className=`wui-tour-progress-bar`,n.append(a),i.before(n)}let o=a.children;for(;o.length<r;){let t=e.ownerDocument.createElement(`span`);t.className=`wui-tour-progress-segment`,a.append(t)}for(;o.length>r;)a.lastElementChild.remove();for(let e=0;e<o.length;e++)o[e].toggleAttribute(`data-filled`,e<n)}var Te=`wui-tour-step`,Ee=`wui-tour-host`,De=`wui-tour-seen:`,q=`data-tracking`,Oe={back:`Back`,next:`Next`,skip:`Skip`,done:`Done`,mediaPause:`Pause animation`,mediaPlay:`Play animation`,endTitle:`You're all set`,endMessage:`You know your way around now. Enjoy exploring.`,endButton:`Done`},ke={back:`back-label`,next:`next-label`,skip:`skip-label`,done:`done-label`,mediaPause:`media-pause-label`,mediaPlay:`media-play-label`,endTitle:`end-title`,endMessage:`end-message`,endButton:`end-button`},Ae=[[`media`,`media`],[`mediaAlt`,`media-alt`],[`mediaPoster`,`media-poster`],[`mediaType`,`media-type`],[`advanceOn`,`advance-on`],[`actionLabel`,`action-label`]],J={index:null,position:null,total:null},je=0;function Y(e=De,t=globalThis.localStorage){return{isSeen:async n=>t.getItem(e+n)===`1`,markSeen:async n=>{t.setItem(e+n,`1`)}}}var X=e=>!e?.isConnected||getComputedStyle(e).visibility===`hidden`?!1:e.getClientRects().length>0,Z=e=>!!e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),Q=()=>{let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e},$=null;function Me(e){$||($=new CSSStyleSheet,$.replaceSync(W)),e.adoptedStyleSheets=[$]}var Ne=class extends e{static get observedAttributes(){return[`open`]}constructor(){super(),this.seenStore=null,this.onBeforeStep=null,this._run=0,this._running=!1,this._layer=null,this._outer=null,this._shadow=null,this._unbindAdvance=null,this._ending=null,this._seenMark=null}connectedCallback(){this.hasAttribute(`open`)&&this.start()}disconnectedCallback(){this.stop()}attributeChangedCallback(e,t,n){e!==`open`||!this.isConnected||(n===null?this.stop():this.start())}get tourId(){return this.getAttribute(`tour-id`)||``}set tourId(e){e==null||e===``?this.removeAttribute(`tour-id`):this.setAttribute(`tour-id`,String(e))}get isolated(){return this.hasAttribute(`isolated`)}set isolated(e){this.toggleAttribute(`isolated`,e===!0||e===``||e===`true`)}_stepList(){return Array.from(this.querySelectorAll(`:scope > ${Te}`),e=>{let t={target:e.getAttribute(`target`)||``,title:e.getAttribute(`title`)||void 0,description:e.textContent.trim()};for(let[n,r]of Ae)e.hasAttribute(r)&&(t[n]=e.getAttribute(r));return t})}_store(){return this.seenStore?this.seenStore:this.getAttribute(`seen-store`)===`local`?Y():globalThis.window?.WUI?.tour?.seenStore||null}_label(e){return this.getAttribute(ke[e])||Oe[e]}_endDialogText(){return this.getAttribute(`end-dialog`)===`false`?null:{title:this._label(`endTitle`),message:this._label(`endMessage`),button:this._label(`endButton`)}}_markSeen(e){let t=this._store();return t?t.markSeen(this.tourId,e):null}async start(){if(this._running)return;this._running=!0;let e=++this._run;this.hasAttribute(`open`)||this.setAttribute(`open`,``);try{await this._start(e)}catch(t){throw e===this._run&&(this._running=!1),t}}async _start(e){this._steps=this._stepList(),this._progress=Se(this._steps.length);let t=this._store();if(t&&!this.tourId)throw Error(`<wui-tour> needs a tour-id to use a seen store.`);if(t&&await t.isSeen(this.tourId)){e===this._run&&this._finish(`alreadySeen`);return}for(let[e,t]of this._steps.entries())t.target&&!X(document.querySelector(t.target))&&this._progress.drop(e);this._returnFocus=document.activeElement;let n=await this._locate(0,1,e);if(e===this._run){if(!n){this._finish(`noTargets`);return}this._firstIndex=n.index,this.dispatchEvent(new CustomEvent(`wui-tour:start`,{bubbles:!0,detail:{total:this._progress.total()}})),e===this._run&&(this._build(),this._show(n))}}next(){return this._move(1)}back(){return!this._current||this._current.index<=this._firstIndex?Promise.resolve():this._move(-1)}async goTo(e){if(this._current){if(!Number.isInteger(e)||e<0||e>=this._steps.length)throw RangeError(`<wui-tour> has no step ${e}; it has ${this._steps.length}.`);await this._go(e,1)}}stop(){this._running&&(this._run++,this._teardown(),this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`))}async _locate(e,t,n){let r=this._steps;for(let i=e;i>=0&&i<r.length;i+=t){let e=r[i];if(await this._beforeStep(e,i),n!==this._run)return null;if(!e.target)return{index:i,target:null};let t=document.querySelector(e.target);if(X(t))return this._progress.position(i),{index:i,target:t};this._progress.drop(i)}return null}async _beforeStep(e,t){let n=[];this.dispatchEvent(new CustomEvent(`wui-tour:beforestep`,{bubbles:!0,detail:{step:e,index:t,wait:e=>n.push(e)}})),await Promise.all(n),typeof this.onBeforeStep==`function`&&await this.onBeforeStep(e,t)}_build(){let e=`wui-tour-${++je}`,n=document.createElement(`div`);n.className=`wui-tour-layer`,n.innerHTML=` <div class="wui-tour-spot" aria-hidden="true"></div> <div class="wui-tour-card" role="dialog" aria-modal="true" tabindex="-1" aria-labelledby="${e}-title" aria-describedby="${e}-text"> <p class="wui-tour-position"></p> <h2 class="wui-tour-title" id="${e}-title"></h2> <p class="wui-tour-text" id="${e}-text"></p> <div class="wui-tour-actions"> <button type="button" class="btn btn-sm btn-link wui-tour-skip"></button> <div class="wui-tour-nav"> <button type="button" class="btn btn-sm btn-outline-secondary wui-tour-back"></button> <button type="button" class="btn btn-sm btn-primary wui-tour-next"></button> </div> </div> </div> <div class="visually-hidden" role="status" aria-live="polite"></div>`;let i=n;this._shadow=null,this.isolated&&(i=document.createElement(Ee),this._shadow=i.attachShadow({mode:`open`}),Me(this._shadow),this._shadow.appendChild(n)),document.body.appendChild(i),document.documentElement.setAttribute(r,``),this._outer=i,this._layer=n,this._spot=n.querySelector(`.wui-tour-spot`),this._card=n.querySelector(`.wui-tour-card`),this._live=n.querySelector(`[role=status]`),this._card.querySelector(`.wui-tour-skip`).addEventListener(`click`,()=>this._close(`skipped`,`button`)),this._card.querySelector(`.wui-tour-back`).addEventListener(`click`,()=>this._move(-1)),this._card.querySelector(`.wui-tour-next`).addEventListener(`click`,()=>this._move(1)),this._shadow&&this._card.removeAttribute(`aria-modal`),this._onKey=e=>this._key(e),this._onFocusIn=e=>{if(!this._layer||this._ending)return;let t=this._current,n=t?this._steps[t.index]:null;_(this._layer,n,t?.target??null,e.target)||this._card.focus()},document.addEventListener(`keydown`,this._onKey,!0),this._shadow||document.addEventListener(`focusin`,this._onFocusIn),t(i,()=>this._follow())}_active(){return this._shadow?this._shadow.activeElement:document.activeElement}_show(e){this._current=e;let{index:t,target:n}=e,r=this._steps[t],i=this._card,a=this._progress.position(t),o=this._progress.total(),s=a===o&&!this._endDialogText(),c=Ce(this,a,o);we(i,{text:c,position:a,total:o}),be(i,r,{pause:this._label(`mediaPause`),play:this._label(`mediaPlay`)});let l=h(this,{layer:this._layer,spot:this._spot,card:i},r,n),u=i.querySelector(`.wui-tour-title`);u.textContent=r.title||``,u.hidden=!r.title,i.querySelector(`.wui-tour-text`).textContent=r.description||``,i.querySelector(`.wui-tour-skip`).textContent=this._label(`skip`),i.querySelector(`.wui-tour-back`).textContent=this._label(`back`),i.querySelector(`.wui-tour-back`).hidden=t<=this._firstIndex,i.querySelector(`.wui-tour-next`).textContent=this._label(s?`done`:`next`);let d=[c,r.title,r.description].filter(Boolean).join(`. `);this._live.textContent=l?[d,l].join(/[.!?]$/.test(d)?` `:`. `):d,le(i,n),this._spot.removeAttribute(q),this._place(),C(i),this._unbindAdvance?.(),this._unbindAdvance=g(r,n,()=>this._move(1));let f=this._active();(i.contains(f)?!f.hidden:this._shadow!==null&&Z(Q()))||i.focus(),this.dispatchEvent(new CustomEvent(`wui-tour:step`,{bubbles:!0,detail:{step:r,index:t,position:a,total:o}}))}_place(){!this._current||!this._layer||P(this._spot,this._card,this._current.target)}_follow(){if(!this._current||!this._layer||this._ending)return;let e=this._spot.style.cssText;this._place(),this._spot.style.cssText!==e&&this._spot.setAttribute(q,``)}async _move(e){this._current&&await this._go(this._current.index+e,e)}async _go(e,t){if(!this._current||this._moving)return;this._moving=!0;let n=this._run;try{let r=await this._locate(e,t,n);if(n!==this._run)return;if(r){let e=w(this._card);if(e&&await e,n!==this._run)return;this._show(r)}else if(t>0){let e=this._endDialogText();if(e&&await this._showEnd(e),n!==this._run)return;await this._close(`finished`)}}finally{this._moving=!1}}_showEnd(e){return this._unbindAdvance?.(),this._unbindAdvance=null,h(this,{layer:this._layer,spot:this._spot,card:this._card},null,null),this._spot.removeAttribute(q),this._ending=new AbortController,this._seenMark=this._markSeen(`finished`),U(this._layer,e,this._ending.signal)}_key(e){if(!(!this._layer||this._ending||e.altKey||e.ctrlKey||e.metaKey)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),this._close(`skipped`,`escape`);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){if(Z(e.composedPath?.()[0]??e.target))return;e.preventDefault(),e.key===`ArrowRight`?this._move(1):this._current.index>this._firstIndex&&this._move(-1)}else if(e.key===`Tab`&&!this._shadow){let{index:t,target:n}=this._current;ee(e,{card:this._card,active:this._active(),step:this._steps[t],target:n})}}}_teardown(){if(!this._layer)return;document.removeEventListener(`keydown`,this._onKey,!0),document.removeEventListener(`focusin`,this._onFocusIn);let e=!this._shadow||this._shadow.activeElement!==null||!document.activeElement||document.activeElement===document.body;this._unbindAdvance?.(),this._unbindAdvance=null,this._ending?.abort(),this._ending=null,this._seenMark=null,n(this._outer),oe(this._outer),document.documentElement.removeAttribute(r),this._outer=null,this._shadow=null,this._layer=null,this._current=null;let t=this._returnFocus;this._returnFocus=null,e&&t?.isConnected&&t.focus?.()}async _close(e,t=null){let n=this._run,r=this._current,i=r?{index:r.index,position:this._progress.position(r.index),total:this._progress.total()}:J,a=this._seenMark;this._teardown();try{n===this._run&&await(a??this._markSeen(e))}finally{this._finish(e,i,t)}}_finish(e,t=J,n=null){this._run++,this._running=!1,this.hasAttribute(`open`)&&this.removeAttribute(`open`),this.dispatchEvent(new CustomEvent(`wui-tour:close`,{bubbles:!0,detail:{reason:e,...t,via:n}}))}};export{Y as n,Ne as t};
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{t}from"./devWarn-DXdRWZs3.js";import{t as n}from"./iconGlyphs.g-Bk8AzmSO.js";import{c as r}from"./wuiHttp-CIJN4Pah.js";import{n as i,t as a}from"./formMirror-BgY7zkC3.js";import{t as o}from"./listboxKeyNav-DMIvs9d6.js";var s=[`none`,`single`,`multiple`],c=`parentId`,l=`Loading`,u=`Could not load. Try again.`,d=`:scope > input[data-wui-mirror]`,f=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],p=0;function m(e,t,n){let r=document.createElement(e);t&&(r.className=t);for(let[e,t]of Object.entries(n??{}))t!=null&&r.setAttribute(e,String(t));return r}var h=class extends e{static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++p}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._nav=o({getVisibleOptions:()=>this._visible().map(e=>this._els.get(e.id)?.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),onEnter:()=>{let e=this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e={};for(let t of f)Object.hasOwn(this,t)&&(e[t]=this[t],delete this[t]);if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=m(`ul`,`wui-tree`),this._list.setAttribute(`role`,`tree`),this._live=m(`div`,`visually-hidden`,{role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of Object.entries(e))this[t]=n;this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return s.includes(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??l}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??u}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return t(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e?.message),null}}_adoptAll(e){let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map(e=>{let r=e?.id==null?``:String(e.id);if(!r)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(r))throw Error(`<wui-tree> node id "${r}" is used twice.`);let i=this._prev?.get(r),a={id:r,raw:e,parent:t,level:n,seq:++this._seq,label:e.label==null?r:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:i?i.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(r,a),this._staged.ids.push(r);let o=e.children??(e.hasChildren?i?.children?.map(e=>e.raw):void 0);return Array.isArray(o)&&(a.children=this._adopt(o,a,n+1)),a.loading=!!i?.loading&&a.children===null&&a.hasChildren,e.checked&&!i&&this._staged.checks.push(r),a})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){let t=e?.closest?.(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0)}_focusNode(e){e&&(this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){e.disabled||!this._isBranch(e)||(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t,n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r){this._announce(``);return}if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n?.message??String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(c,e.id);let i=await r(n.href,{headers:{Accept:`application/json`}});if(!i.ok)throw Error(`Loading children answered ${i.kind}.`);return JSON.parse(i.html)}_handleClick(e){let t=this._nodeFrom(e.target);!t||t.disabled||(this._focusNode(t),e.target.closest(`.wui-tree-toggle`)?this._toggleExpand(t):e.target.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(t)):this._activate(t))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!(!t||e.target!==this._els.get(t.id)?.li))if(e.key===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else e.key===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)i(this,this.values);else if(e===`single`)a(this,this._selected??``);else for(let e of this.querySelectorAll(d))e.remove()}_render(){if(!this._list)return;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null),this._els=new Map;let r=this.getAttribute(`aria-label`);r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),this._list.replaceChildren(...this._buildLevel(this._roots)),t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_buildLevel(e){return e.map((t,n)=>this._buildItem(t,n+1,e.length))}_buildItem(e,t,r){let i=this.selection,a=this._isBranch(e),o=this._state(e),s=m(`li`,`wui-tree-item`,{role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":r,"aria-posinset":t,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});a&&s.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&s.setAttribute(`aria-disabled`,`true`),e.loading&&s.setAttribute(`aria-busy`,`true`),i===`single`&&s.setAttribute(`aria-selected`,String(e.id===this._selected)),i===`multiple`&&s.setAttribute(`aria-checked`,o===`mixed`?`mixed`:String(o===`checked`));let c=m(`div`,`wui-tree-row`,{role:`presentation`});c.style.setProperty(`--wui-tree-level`,String(e.level-1)),i===`single`&&e.id===this._selected&&c.classList.add(`wui-tree-row-selected`),e.failed&&c.classList.add(`wui-tree-row-error`);let l=m(`span`,a?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,{"aria-hidden":`true`});if(a&&(l.innerHTML=n(`chevron-right`,{size:16})),c.append(l),i===`multiple`){let t=m(`input`,`form-check-input wui-tree-check`,{type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=o===`checked`,t.indeterminate=o===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),c.append(t)}if(e.icon){let t=m(`span`,`wui-tree-icon`,{"aria-hidden":`true`});t.innerHTML=n(e.icon,{size:16}),c.append(t)}let u=m(`span`,`wui-tree-label`,{id:`${this._uid}-${e.seq}`});if(u.textContent=e.label,c.append(u),e.badge){let t=m(`span`,`badge wui-tree-badge${e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``}`,{id:`${this._uid}-${e.seq}-badge`});t.textContent=e.badge,c.append(t)}if(e.loading&&c.append(m(`span`,`wui-tree-spinner`,{"aria-hidden":`true`})),s.append(c),e.expanded&&e.children?.length){let t=m(`ul`,`wui-tree-group`,{role:`group`});t.append(...this._buildLevel(e.children)),s.append(t)}return this._els.set(e.id,{li:s,row:c}),s}};export{h as t};
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{t}from"./devWarn-DXdRWZs3.js";import{t as n}from"./iconGlyphs.g-Bk8AzmSO.js";import{c as r}from"./wuiHttp-CFSgthqb.js";import{n as i,t as a}from"./formMirror-BgY7zkC3.js";import{t as o}from"./listboxKeyNav-DMIvs9d6.js";var s=[`none`,`single`,`multiple`],c=`parentId`,l=`Loading`,u=`Could not load. Try again.`,d=`:scope > input[data-wui-mirror]`,f=[`nodes`,`selection`,`selected`,`values`,`loadChildren`,`loadUrl`,`name`],p=0;function m(e,t,n){let r=document.createElement(e);t&&(r.className=t);for(let[e,t]of Object.entries(n??{}))t!=null&&r.setAttribute(e,String(t));return r}var h=class extends e{static get observedAttributes(){return[`selection`,`selected`,`name`,`aria-label`,`loading-text`,`error-text`]}constructor(){super(),this._uid=`wui-tree-${++p}`,this._seq=0,this._roots=[],this._byId=new Map,this._prev=null,this._staged=null,this._els=new Map,this._checked=new Set,this._selected=null,this._focusId=null,this._loader=null,this._list=null,this._live=null,this._ready=!1,this._nav=o({getVisibleOptions:()=>this._visible().map(e=>this._els.get(e.id)?.row),getActive:()=>this._visible().findIndex(e=>e.id===this._focusId),setActive:e=>this._focusNode(this._visible()[e]),onEnter:()=>{let e=this._byId.get(this._focusId);e&&this._activate(e)}}),this._onKeyDown=e=>this._handleKeyDown(e),this._onClick=e=>this._handleClick(e),this._onFocusIn=e=>{let t=this._nodeFrom(e.target);t&&t.id!==this._focusId&&this._setRoving(t)}}connectedCallback(){let e={};for(let t of f)Object.hasOwn(this,t)&&(e[t]=this[t],delete this[t]);if(!this._ready){this._ready=!0;let e=this._readScript();this.replaceChildren(),this._list=m(`ul`,`wui-tree`),this._list.setAttribute(`role`,`tree`),this._live=m(`div`,`visually-hidden`,{role:`status`,"aria-live":`polite`}),this.append(this._list,this._live),e&&this._adoptAll(e)}for(let[t,n]of Object.entries(e))this[t]=n;this.addEventListener(`keydown`,this._onKeyDown),this.addEventListener(`click`,this._onClick),this.addEventListener(`focusin`,this._onFocusIn),this._render(),this._loadOpenNodes()}disconnectedCallback(){this.removeEventListener(`keydown`,this._onKeyDown),this.removeEventListener(`click`,this._onClick),this.removeEventListener(`focusin`,this._onFocusIn),this._nav.teardown()}attributeChangedCallback(e,t,n){e===`selected`&&(this._selected=n),this._ready&&this.isConnected&&this._render()}get nodes(){return this._roots.map(e=>e.raw)}set nodes(e){this._adoptAll(e??[]),this._render(),this._loadOpenNodes()}get selection(){let e=this.getAttribute(`selection`);return s.includes(e)?e:`none`}set selection(e){this.setAttribute(`selection`,String(e))}get selected(){return this._selected}set selected(e){this._selected=e==null?null:String(e),this._render()}get values(){let e=[],t=n=>{for(let r of n)this._state(r)===`checked`&&e.push(r.id),r.children&&t(r.children)};return t(this._roots),[...e,...[...this._checked].filter(e=>!this._byId.has(e))]}set values(e){this._checked.clear();for(let t of e??[]){let e=this._byId.get(String(t));e?this._setChecked(e,!0):this._checked.add(String(t))}this._render()}get loadChildren(){return this._loader}set loadChildren(e){this._loader=typeof e==`function`?e:null}get loadUrl(){return this.getAttribute(`load-url`)}set loadUrl(e){e==null?this.removeAttribute(`load-url`):this.setAttribute(`load-url`,String(e))}get name(){return this.getAttribute(`name`)}set name(e){e==null?this.removeAttribute(`name`):this.setAttribute(`name`,String(e))}get loadingText(){return this.getAttribute(`loading-text`)??l}set loadingText(e){this.setAttribute(`loading-text`,String(e??``))}get errorText(){return this.getAttribute(`error-text`)??u}set errorText(e){this.setAttribute(`error-text`,String(e??``))}_readScript(){let e=this.querySelector(`:scope > script[type='application/json']`);if(!e)return null;try{return JSON.parse(e.textContent)}catch(e){return t(`[@webority/ui-elements] <wui-tree> could not read its JSON nodes:`,e?.message),null}}_adoptAll(e){let t=this._byId;this._prev=t,this._byId=new Map;let n;try{n=this._adoptStaged(e,null,1)}catch(e){throw this._byId=t,e}finally{this._prev=null}this._roots=n;for(let e of t.keys())this._byId.has(e)||this._checked.delete(e);for(let e of this._roots)this._passChecksDown(e);this._focusId&&!this._byId.has(this._focusId)&&(this._focusId=null)}_adoptStaged(e,t,n){let r=[],i=[];this._staged={ids:r,checks:i};try{let r=this._adopt(e,t,n);for(let e of i)this._checked.add(e);return r}catch(e){for(let e of r)this._byId.delete(e);throw e}finally{this._staged=null}}_adopt(e,t,n){if(!Array.isArray(e))throw Error(`<wui-tree> nodes must be an array.`);return e.map(e=>{let r=e?.id==null?``:String(e.id);if(!r)throw Error(`<wui-tree> every node needs an id.`);if(this._byId.has(r))throw Error(`<wui-tree> node id "${r}" is used twice.`);let i=this._prev?.get(r),a={id:r,raw:e,parent:t,level:n,seq:++this._seq,label:e.label==null?r:String(e.label),icon:e.icon||null,badge:e.badge==null||e.badge===``?null:String(e.badge),badgeTone:e.badgeTone||null,disabled:!!e.disabled,hasChildren:!!e.hasChildren,children:null,expanded:i?i.expanded:!!e.expanded,loading:!1,failed:!1};this._byId.set(r,a),this._staged.ids.push(r);let o=e.children??(e.hasChildren?i?.children?.map(e=>e.raw):void 0);return Array.isArray(o)&&(a.children=this._adopt(o,a,n+1)),a.loading=!!i?.loading&&a.children===null&&a.hasChildren,e.checked&&!i&&this._staged.checks.push(r),a})}_passChecksDown(e){e.children?.length&&this._checked.has(e.id)&&(this._checked.delete(e.id),this._setChecked(e,!0));for(let t of e.children??[])this._passChecksDown(t)}_loadOpenNodes(){queueMicrotask(()=>{if(this.isConnected)for(let e of[...this._byId.values()])e.expanded&&e.children===null&&e.hasChildren&&!e.loading&&this._load(e)})}_isBranch(e){return e.children?e.children.length>0:e.hasChildren}_visible(){let e=[],t=n=>{for(let r of n)e.push(r),r.expanded&&r.children&&t(r.children)};return t(this._roots),e}_state(e){if(e.children?.length){let t=0,n=0;for(let r of e.children){let e=this._state(r);e===`checked`?t++:e===`unchecked`&&n++}return t===e.children.length?`checked`:n===e.children.length?`unchecked`:`mixed`}return this._checked.has(e.id)?`checked`:`unchecked`}_setChecked(e,t){if(e.children?.length)for(let n of e.children)n.disabled||this._setChecked(n,t);else t?this._checked.add(e.id):this._checked.delete(e.id)}_nodeFrom(e){let t=e?.closest?.(`li.wui-tree-item`);if(!t)return null;for(let[e,n]of this._els)if(n.li===t)return this._byId.get(e)??null;return null}_emit(e,t){this.dispatchEvent(new CustomEvent(`wui-tree:${e}`,{detail:t,bubbles:!0,composed:!0}))}_announce(e){this._live&&(this._live.textContent=e)}_setRoving(e){let t=this._els.get(this._focusId);t&&(t.li.tabIndex=-1),this._focusId=e.id;let n=this._els.get(e.id);n&&(n.li.tabIndex=0)}_focusNode(e){e&&(this._setRoving(e),this._els.get(e.id)?.li.focus())}_activate(e){e.disabled||(this.selection===`single`&&(this._selected=e.id,this._render(),this._syncForm()),this._emit(`select`,{id:e.id,node:e.raw}))}_enabledLeaves(e){return e.disabled?[]:e.children?.length?e.children.flatMap(e=>this._enabledLeaves(e)):[e]}_toggleCheck(e){let t=this._enabledLeaves(e);if(!t.length)return;let n=!t.every(e=>this._checked.has(e.id));this._setChecked(e,n),this._render(),this._syncForm(),this._emit(`check`,{id:e.id,checked:n,values:this.values})}_toggleExpand(e){e.disabled||!this._isBranch(e)||(e.expanded?(e.expanded=!1,this._render()):this._expand(e))}_expand(e){e.expanded=!0,e.children===null?this._load(e):this._render()}async _load(e){if(e.loading)return;e.loading=!0,e.failed=!1,this._announce(this.loadingText),this._render();let t,n=null;try{t=await this._fetchChildren(e)}catch(e){n=e}let r=this._byId.get(e.id);if(!r){this._announce(``);return}if(r.loading){if(r.loading=!1,!n)try{r.children=this._adoptStaged(t,r,r.level+1),this._passChecksDown(r),this._announce(``)}catch(e){n=e}n&&(r.failed=!0,r.expanded=!1,this._announce(this.errorText),this._emit(`error`,{id:r.id,message:n?.message??String(n)})),this._render(),this._syncForm()}}async _fetchChildren(e){if(this._loader)return this._loader(e.raw);let t=this.getAttribute(`load-url`);if(!t)throw Error(`<wui-tree> has a node with children to load but no loadChildren or load-url.`);let n=new URL(t,window.location.href);n.searchParams.set(c,e.id);let i=await r(n.href,{headers:{Accept:`application/json`}});if(!i.ok)throw Error(`Loading children answered ${i.kind}.`);return JSON.parse(i.html)}_handleClick(e){let t=this._nodeFrom(e.target);!t||t.disabled||(this._focusNode(t),e.target.closest(`.wui-tree-toggle`)?this._toggleExpand(t):e.target.closest(`.wui-tree-check`)?(e.preventDefault(),this._toggleCheck(t)):this._activate(t))}_handleKeyDown(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=this._nodeFrom(e.target);if(!(!t||e.target!==this._els.get(t.id)?.li))if(e.key===`ArrowRight`){if(e.preventDefault(),!this._isBranch(t)||t.disabled)return;t.expanded?t.children?.length&&this._focusNode(t.children[0]):this._expand(t)}else e.key===`ArrowLeft`?(e.preventDefault(),t.expanded&&this._isBranch(t)&&!t.disabled?this._toggleExpand(t):t.parent&&this._focusNode(t.parent)):e.key===` `?(e.preventDefault(),this.selection===`multiple`?this._toggleCheck(t):this.selection===`single`&&this._activate(t)):this._nav.handler(e)}_syncForm(){let e=this.selection;if(e===`multiple`)i(this,this.values);else if(e===`single`)a(this,this._selected??``);else for(let e of this.querySelectorAll(d))e.remove()}_render(){if(!this._list)return;let e=document.activeElement,t=!!e&&this._list.contains(e),n=this._visible();n.some(e=>e.id===this._focusId)||(this._focusId=(n.find(e=>e.id===this._selected)??n[0])?.id??null),this._els=new Map;let r=this.getAttribute(`aria-label`);r?this._list.setAttribute(`aria-label`,r):this._list.removeAttribute(`aria-label`),this._list.replaceChildren(...this._buildLevel(this._roots)),t&&this._focusId&&this._els.get(this._focusId)?.li.focus(),this._syncForm()}_buildLevel(e){return e.map((t,n)=>this._buildItem(t,n+1,e.length))}_buildItem(e,t,r){let i=this.selection,a=this._isBranch(e),o=this._state(e),s=m(`li`,`wui-tree-item`,{role:`treeitem`,tabindex:e.id===this._focusId?0:-1,"aria-level":e.level,"aria-setsize":r,"aria-posinset":t,"aria-labelledby":`${this._uid}-${e.seq}`,"aria-describedby":e.badge?`${this._uid}-${e.seq}-badge`:null});a&&s.setAttribute(`aria-expanded`,String(e.expanded)),e.disabled&&s.setAttribute(`aria-disabled`,`true`),e.loading&&s.setAttribute(`aria-busy`,`true`),i===`single`&&s.setAttribute(`aria-selected`,String(e.id===this._selected)),i===`multiple`&&s.setAttribute(`aria-checked`,o===`mixed`?`mixed`:String(o===`checked`));let c=m(`div`,`wui-tree-row`,{role:`presentation`});c.style.setProperty(`--wui-tree-level`,String(e.level-1)),i===`single`&&e.id===this._selected&&c.classList.add(`wui-tree-row-selected`),e.failed&&c.classList.add(`wui-tree-row-error`);let l=m(`span`,a?`wui-tree-toggle`:`wui-tree-toggle wui-tree-toggle-leaf`,{"aria-hidden":`true`});if(a&&(l.innerHTML=n(`chevron-right`,{size:16})),c.append(l),i===`multiple`){let t=m(`input`,`form-check-input wui-tree-check`,{type:`checkbox`,tabindex:-1,"aria-hidden":`true`});t.checked=o===`checked`,t.indeterminate=o===`mixed`,t.disabled=e.disabled,t.addEventListener(`mousedown`,e=>e.preventDefault()),c.append(t)}if(e.icon){let t=m(`span`,`wui-tree-icon`,{"aria-hidden":`true`});t.innerHTML=n(e.icon,{size:16}),c.append(t)}let u=m(`span`,`wui-tree-label`,{id:`${this._uid}-${e.seq}`});if(u.textContent=e.label,c.append(u),e.badge){let t=m(`span`,`badge wui-tree-badge${e.badgeTone&&e.badgeTone!==`neutral`?` badge-${e.badgeTone}`:``}`,{id:`${this._uid}-${e.seq}-badge`});t.textContent=e.badge,c.append(t)}if(e.loading&&c.append(m(`span`,`wui-tree-spinner`,{"aria-hidden":`true`})),s.append(c),e.expanded&&e.children?.length){let t=m(`ul`,`wui-tree-group`,{role:`group`});t.append(...this._buildLevel(e.children)),s.append(t)}return this._els.set(e.id,{li:s,row:c}),s}};export{h as t};
@@ -1 +1 @@
1
- import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-HAWsGzlr.js";var i=`wui-whats-new-read`,a=`wui-whats-new:`,o=`data-open`,s=`data-wui-unread`,c=0,l=class extends e{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this._doc=null,this._seen=``,this._observer=null,this._onTriggerClick=()=>this.isOpen?this.close(!0):this.open(),this._onKeyDown=e=>{e.key===`Escape`&&this.isOpen&&(e.stopPropagation(),this.close(!0))},this._onPointerDown=e=>{this.isOpen&&!this.contains(e.target)&&this.close(!1)}}get isOpen(){return this.hasAttribute(o)}get _trigger(){return this.querySelector(`.wui-whats-new-trigger`)}get _panel(){return this.querySelector(`.wui-whats-new-panel`)}connectedCallback(){this._doc=this.ownerDocument;let e=this._panel,t=this._trigger;!e||!t||(e.id||=`wui-whats-new-${++c}`,t.setAttribute(`aria-controls`,e.id),t.setAttribute(`aria-expanded`,`false`),t.addEventListener(`click`,this._onTriggerClick),this.addEventListener(`keydown`,this._onKeyDown),this._seen=this._load(),this._refresh(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._refresh()),this._observer.observe(e,{childList:!0,subtree:!0})))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._trigger?.removeEventListener(`click`,this._onTriggerClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this.removeAttribute(o),this._doc=null}attributeChangedCallback(e,t,n){t===n||!this._doc||(this._seen=this._load(),this._refresh())}open(){let e=this._panel;!e||this.isOpen||(this.setAttribute(o,``),this._trigger?.setAttribute(`aria-expanded`,`true`),this._place(),t(this,()=>this._place()),this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0),e.focus({preventScroll:!0}),this._markRead())}close(e){this.isOpen&&(this.removeAttribute(o),this._trigger?.setAttribute(`aria-expanded`,`false`),this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this._refresh(),e&&this._trigger?.focus())}_place(){r(this._trigger,this._panel,{clampHeight:!0})}_entries(){return[...this.querySelectorAll(`.wui-whats-new-entry`)].map(e=>({entry:e,date:e.querySelector(`time[datetime]`)?.getAttribute(`datetime`)??``}))}_newest(){return this._entries().reduce((e,{date:t})=>t>e?t:e,``)}_refresh(){let e=this._entries(),t=0;for(let{entry:n,date:r}of e){let e=r>this._seen;e&&t++,!(this.isOpen&&n.hasAttribute(s))&&n.toggleAttribute(s,e)}this.toggleAttribute(s,t>0)}_markRead(){let e=this._newest();!e||e<=this._seen||(this._seen=e,this._save(e),this.toggleAttribute(s,!1),this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{through:e}})))}_storage(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{return{store:this.ownerDocument.defaultView.localStorage,key:a+e}}catch{return null}}_load(){let e=this._storage();return e?e.store.getItem(e.key)??``:this._seen}_save(e){let t=this._storage();t&&t.store.setItem(t.key,e)}};export{l as n,i as t};
1
+ import{t as e}from"./elementBase-BlsR4tqa.js";import{n as t,r as n,t as r}from"./anchorOverlay-D8di0B-z.js";var i=`wui-whats-new-read`,a=`wui-whats-new:`,o=`data-open`,s=`data-wui-unread`,c=0,l=class extends e{static get observedAttributes(){return[`storage-key`]}constructor(){super(),this._doc=null,this._seen=``,this._observer=null,this._onTriggerClick=()=>this.isOpen?this.close(!0):this.open(),this._onKeyDown=e=>{e.key===`Escape`&&this.isOpen&&(e.stopPropagation(),this.close(!0))},this._onPointerDown=e=>{this.isOpen&&!this.contains(e.target)&&this.close(!1)}}get isOpen(){return this.hasAttribute(o)}get _trigger(){return this.querySelector(`.wui-whats-new-trigger`)}get _panel(){return this.querySelector(`.wui-whats-new-panel`)}connectedCallback(){this._doc=this.ownerDocument;let e=this._panel,t=this._trigger;!e||!t||(e.id||=`wui-whats-new-${++c}`,t.setAttribute(`aria-controls`,e.id),t.setAttribute(`aria-expanded`,`false`),t.addEventListener(`click`,this._onTriggerClick),this.addEventListener(`keydown`,this._onKeyDown),this._seen=this._load(),this._refresh(),typeof MutationObserver<`u`&&(this._observer=new MutationObserver(()=>this._refresh()),this._observer.observe(e,{childList:!0,subtree:!0})))}disconnectedCallback(){this._observer?.disconnect(),this._observer=null,this._trigger?.removeEventListener(`click`,this._onTriggerClick),this.removeEventListener(`keydown`,this._onKeyDown),this._doc?.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this.removeAttribute(o),this._doc=null}attributeChangedCallback(e,t,n){t===n||!this._doc||(this._seen=this._load(),this._refresh())}open(){let e=this._panel;!e||this.isOpen||(this.setAttribute(o,``),this._trigger?.setAttribute(`aria-expanded`,`true`),this._place(),t(this,()=>this._place()),this._doc.addEventListener(`pointerdown`,this._onPointerDown,!0),e.focus({preventScroll:!0}),this._markRead())}close(e){this.isOpen&&(this.removeAttribute(o),this._trigger?.setAttribute(`aria-expanded`,`false`),this._doc.removeEventListener(`pointerdown`,this._onPointerDown,!0),n(this),this._refresh(),e&&this._trigger?.focus())}_place(){r(this._trigger,this._panel,{clampHeight:!0})}_entries(){return[...this.querySelectorAll(`.wui-whats-new-entry`)].map(e=>({entry:e,date:e.querySelector(`time[datetime]`)?.getAttribute(`datetime`)??``}))}_newest(){return this._entries().reduce((e,{date:t})=>t>e?t:e,``)}_refresh(){let e=this._entries(),t=0;for(let{entry:n,date:r}of e){let e=r>this._seen;e&&t++,!(this.isOpen&&n.hasAttribute(s))&&n.toggleAttribute(s,e)}this.toggleAttribute(s,t>0)}_markRead(){let e=this._newest();!e||e<=this._seen||(this._seen=e,this._save(e),this.toggleAttribute(s,!1),this.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{through:e}})))}_storage(){let e=this.getAttribute(`storage-key`);if(!e)return null;try{return{store:this.ownerDocument.defaultView.localStorage,key:a+e}}catch{return null}}_load(){let e=this._storage();return e?e.store.getItem(e.key)??``:this._seen}_save(e){let t=this._storage();t&&t.store.setItem(t.key,e)}};export{l as n,i as t};
@@ -1 +1 @@
1
- function e(e,t,n={}){if(!e||!t)return;let r=e.getBoundingClientRect(),i=n.clampHeight?t.scrollTop:0;n.clampHeight&&(t.style.maxHeight=``);let a=t.offsetHeight,o=window.innerHeight-r.bottom,s=o<a+4&&r.top>o;if(t.classList.toggle(`drop-up`,s),t.style.position=`fixed`,t.style.top=s?`${Math.max(4,r.top-a-4)}px`:`${r.bottom+4}px`,n.clampHeight){let e=s?r.top-8:window.innerHeight-r.bottom-8;e<a&&(t.style.maxHeight=`${Math.max(e,0)}px`),t.scrollTop=i}n.matchWidth&&(r.width>=300?(t.style.minWidth=`${r.width}px`,t.style.width=`${r.width}px`,t.style.maxWidth=`${r.width}px`):(t.style.minWidth=`${r.width}px`,t.style.width=`max-content`,t.style.maxWidth=`${Math.min(400,window.innerWidth-8)}px`));let c=t.offsetWidth;if(n.alignEnd){let e=r.right-c,n=Math.min(e,window.innerWidth-c-8);t.style.left=`${Math.max(8,n)}px`}else{let e=Math.min(r.left,window.innerWidth-c-4);t.style.left=`${Math.max(4,e)}px`}}function t(e,t){n(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function n(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}export{t as n,n as r,e as t};
1
+ function e(e,t,n={}){if(!e||!t)return;let r=e.getBoundingClientRect(),i=n.clampHeight?t.scrollTop:0;n.clampHeight&&(t.style.maxHeight=``);let a=t.offsetHeight,o=window.innerHeight-r.bottom,s=o<a+4&&r.top>o;if(t.classList.toggle(`drop-up`,s),t.style.position=`fixed`,t.style.top=s?`${Math.max(4,r.top-a-4)}px`:`${r.bottom+4}px`,n.clampHeight){let e=s?r.top-8:window.innerHeight-r.bottom-8;e<a&&(t.style.maxHeight=`${Math.max(e,0)}px`),t.scrollTop=i}n.matchWidth&&(r.width>=300?(t.style.minWidth=`${r.width}px`,t.style.width=`${r.width}px`,t.style.maxWidth=`${r.width}px`):(t.style.minWidth=`${r.width}px`,t.style.width=`max-content`,t.style.maxWidth=`${Math.min(400,window.innerWidth-8)}px`));let c=t.offsetWidth;if(n.alignEnd){let e=r.right-c,n=e>=8?e:r.left,i=Math.max(8,Math.min(n,window.innerWidth-c-8));t.style.left=`${i}px`}else{let e=Math.min(r.left,window.innerWidth-c-4);t.style.left=`${Math.max(4,e)}px`}}function t(e,t){n(e),e._reanchor=t,e._reanchorScroll=n=>{n.target instanceof Node&&typeof e.contains==`function`&&e.contains(n.target)||t()},window.addEventListener(`resize`,e._reanchor),window.addEventListener(`scroll`,e._reanchorScroll,!0)}function n(e){e?._reanchor&&(window.removeEventListener(`resize`,e._reanchor),window.removeEventListener(`scroll`,e._reanchorScroll,!0),e._reanchor=null,e._reanchorScroll=null)}export{t as n,n as r,e as t};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiAutocomplete-Cvoyr30K.js";e(`wui-autocomplete`,t);export{t as WuiAutocomplete};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiAutocomplete-le8obmeq.js";e(`wui-autocomplete`,t);export{t as WuiAutocomplete};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{i as t,n,r,t as i}from"../WuiCommentThread-z6URiH-n.js";import"./mention-input.js";e(`wui-comment-thread`,t);export{i as COMMENT_INTENTS,n as COMMENT_REACTIONS,r as COMMENT_TEXT,t as WuiCommentThread};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{i as t,n,r,t as i}from"../WuiCommentThread-xu56ddmv.js";import"./mention-input.js";e(`wui-comment-thread`,t);export{i as COMMENT_INTENTS,n as COMMENT_REACTIONS,r as COMMENT_TEXT,t as WuiCommentThread};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiConsentBanner-D6YE84__.js";e(`wui-consent-banner`,t);export{t as WuiConsentBanner};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiConsentBanner-DjgDtG3M.js";e(`wui-consent-banner`,t);export{t as WuiConsentBanner};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiContextMenu-BLNKaFsB.js";e(`wui-context-menu`,t);export{t as WuiContextMenu};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiContextMenu-fGlo4c_Z.js";e(`wui-context-menu`,t);export{t as WuiContextMenu};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCountrySelect-Dac15o75.js";e(`wui-country-select`,t);export{t as WuiCountrySelect};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiCountrySelect-DECdemVk.js";e(`wui-country-select`,t);export{t as WuiCountrySelect};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDateRange-DCNf4MSb.js";e(`wui-date-range`,t);export{t as WuiDateRange};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDateRange-8HLWaXuU.js";e(`wui-date-range`,t);export{t as WuiDateRange};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDatePicker-BUtDjbek.js";e(`wui-datepicker`,t);export{t as WuiDatePicker};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiDatePicker-BCbSGCzN.js";e(`wui-datepicker`,t);export{t as WuiDatePicker};
@@ -1 +1 @@
1
- import{n as e,t}from"../filterPopover-wAZS4TuD.js";e();export{t as FILTER_POPOVER_MAX_CHIPS};
1
+ import{n as e,t}from"../filterPopover-DuMhrdFk.js";e();export{t as FILTER_POPOVER_MAX_CHIPS};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiHoverCard-Ql6CD3BL.js";e(`wui-hover-card`,t);export{t as WuiHoverCard};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiHoverCard-mrP_KEhB.js";e(`wui-hover-card`,t);export{t as WuiHoverCard};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,i as n,n as r,r as i,t as a}from"../WuiInlineEdit-hkv-A06z.js";e(`wui-inline-edit`,n);export{a as INLINE_EDIT_SAVED_MS,r as INLINE_EDIT_TEXT,i as INLINE_EDIT_TYPES,n as WuiInlineEdit,t as inlineEditText};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,i as n,n as r,r as i,t as a}from"../WuiInlineEdit-DJCxIh0J.js";e(`wui-inline-edit`,n);export{a as INLINE_EDIT_SAVED_MS,r as INLINE_EDIT_TEXT,i as INLINE_EDIT_TYPES,n as WuiInlineEdit,t as inlineEditText};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../kanban-Drt3TD5C.js";e(`wui-kanban`,n);export{h as KANBAN_DRAG_THRESHOLD_PX,u as KANBAN_LONG_PRESS_MS,p as KANBAN_PHONE_QUERY,s as KANBAN_STORAGE_PREFIX,t as KANBAN_SUMMARY_FORMATS,d as KANBAN_TEXT,m as KANBAN_TONES,n as WuiKanban,c as kanbanCardLabel,g as kanbanOverflow,r as kanbanStorageKey,i as kanbanSummaryFormat,f as kanbanVisibleLimit,l as readKanbanCollapsed,o as sumKanbanValues,a as writeKanbanCollapsed};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../kanban-DvHNWre-.js";e(`wui-kanban`,n);export{h as KANBAN_DRAG_THRESHOLD_PX,u as KANBAN_LONG_PRESS_MS,p as KANBAN_PHONE_QUERY,s as KANBAN_STORAGE_PREFIX,t as KANBAN_SUMMARY_FORMATS,d as KANBAN_TEXT,m as KANBAN_TONES,n as WuiKanban,c as kanbanCardLabel,g as kanbanOverflow,r as kanbanStorageKey,i as kanbanSummaryFormat,f as kanbanVisibleLimit,l as readKanbanCollapsed,o as sumKanbanValues,a as writeKanbanCollapsed};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../WuiMentionInput-5z-Kcvlg.js";e(`wui-mention-input`,r);export{t as MENTION_ID_PATTERN,l as MENTION_MAX_QUERY,a as MENTION_MAX_RESULTS,s as MENTION_TEXT,r as WuiMentionInput,o as mentionLabel,c as mentionTextFromValue,n as mentionValueFromText,i as mentionedIds,u as parseMentionValue};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{a as t,c as n,i as r,l as i,n as a,o,r as s,s as c,t as l,u}from"../WuiMentionInput-D_pbskyy.js";e(`wui-mention-input`,r);export{t as MENTION_ID_PATTERN,l as MENTION_MAX_QUERY,a as MENTION_MAX_RESULTS,s as MENTION_TEXT,r as WuiMentionInput,o as mentionLabel,c as mentionTextFromValue,n as mentionValueFromText,i as mentionedIds,u as parseMentionValue};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiMenubar-4MOZ51R_.js";e(`wui-menubar`,t);export{t as WuiMenubar};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiMenubar-CduCuK5G.js";e(`wui-menubar`,t);export{t as WuiMenubar};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiMultiSelect-Pm9-F-YU.js";e(`wui-multiselect`,t);export{t as WuiMultiSelect};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiMultiSelect-B2TqrJp2.js";e(`wui-multiselect`,t);export{t as WuiMultiSelect};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiNotificationCenter-f7ZQ42rM.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiNotificationCenter-CYlxiwj9.js";e(`wui-notification-center`,t);export{t as WuiNotificationCenter};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiOverflow-Ixc3PRuW.js";e(`wui-overflow`,t);export{t as WuiOverflow};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiOverflow-Cq_g0454.js";e(`wui-overflow`,t);export{t as WuiOverflow};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiPhone-BhmKncvF.js";e(`wui-phone`,t);export{t as WuiPhone};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiPhone-CdJTlY2E.js";e(`wui-phone`,t);export{t as WuiPhone};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiSelect-DR4PYwAw.js";e(`wui-select`,t);export{t as WuiSelect};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiSelect-BT-kh9TD.js";e(`wui-select`,t);export{t as WuiSelect};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiTimePicker-CaJrTq3m.js";e(`wui-timepicker`,t);export{t as WuiTimePicker};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiTimePicker-CXLgydrh.js";e(`wui-timepicker`,t);export{t as WuiTimePicker};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{n as t,t as n}from"../WuiTour-DOeTJa4V.js";e(`wui-tour`,n);export{n as WuiTour,t as createLocalSeenStore};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{n as t,t as n}from"../WuiTour-DDY9N8AV.js";e(`wui-tour`,n);export{n as WuiTour,t as createLocalSeenStore};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiTree-BIgBPhZH.js";e(`wui-tree`,t);export{t as WuiTree};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{t}from"../WuiTree-CB1xoDIj.js";e(`wui-tree`,t);export{t as WuiTree};
@@ -1 +1 @@
1
- import{n as e}from"../elementBase-BlsR4tqa.js";import{n as t,t as n}from"../WuiWhatsNew-68sOQOTO.js";e(`wui-whats-new`,t);export{n as WHATS_NEW_READ_EVENT,t as WuiWhatsNew};
1
+ import{n as e}from"../elementBase-BlsR4tqa.js";import{n as t,t as n}from"../WuiWhatsNew-Bhz_kR2O.js";e(`wui-whats-new`,t);export{n as WHATS_NEW_READ_EVENT,t as WuiWhatsNew};
@@ -1,3 +1,3 @@
1
- import{a as e,n as t,o as n,t as r}from"./fileViewerUi-CSOkacnB.js";var i=[.1,.25,.5,.75,1,1.5,2,3,4],a=[.25,.5,1,2,4],o=16,s=5,c=class{constructor(e,t){this.shell=e,this.source=t,this.zoom=`fit`,this.rotation=0,this.area={width:0,height:0},this.destroyed=!1}load(){let e=document.createElement(`img`);e.className=`wui-file-viewer-image`,e.alt=this.shell.name(),e.decoding=`async`,e.draggable=!1,e.addEventListener(`load`,()=>{this.destroyed||(this.natural={width:e.naturalWidth||300,height:e.naturalHeight||150},this._build(e),this.shell.loaded({kind:`image`,pages:1}))}),e.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The image could not be decoded.`))}),e.src=this.source.src,this.img=e}destroy(){this.destroyed=!0,this._resizeObserver?.disconnect(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this._printFrame?.remove(),this.img?.removeAttribute(`src`)}_build(e){let{center:n,end:i,body:o,host:s}=this.shell;this.zoomOutButton=r(`zoom-out`,`Zoom out`),this.zoomOutButton.addEventListener(`click`,()=>this._stepZoom(-1)),this.zoomButton=document.createElement(`button`),this.zoomButton.type=`button`,this.zoomButton.className=`wui-file-viewer-zoom`,t(this.zoomButton,{label:`Zoom`,items:()=>[...a.map(e=>({key:String(e),label:`${Math.round(e*100)}%`,checked:this.zoom===e})),{key:`fit-divider`,divider:!0},{key:`fit`,label:`Fit`,checked:this.zoom===`fit`}],onPick:e=>this._setZoom(e===`fit`?`fit`:Number(e))}),this.zoomInButton=r(`zoom-in`,`Zoom in`),this.zoomInButton.addEventListener(`click`,()=>this._stepZoom(1));let c=r(`rotate-ccw`,`Rotate left`);c.addEventListener(`click`,()=>this._rotate(-90));let l=r(`rotate-cw`,`Rotate right`);l.addEventListener(`click`,()=>this._rotate(90));let u=document.createElement(`span`);u.className=`wui-file-viewer-divider wui-file-viewer-print`;let d=r(`printer`,`Print`,{className:`wui-file-viewer-print`});d.addEventListener(`click`,()=>this.print()),u.hidden=d.hidden=!this.shell.print(),n.append(this.zoomOutButton,this.zoomButton,this.zoomInButton),i.prepend(c,l,u,d),this.scroller=document.createElement(`div`),this.scroller.className=`wui-file-viewer-scroll wui-file-viewer-image-scroll wui-scroll`,this.scroller.tabIndex=0,this.scroller.setAttribute(`role`,`region`),this.scroller.setAttribute(`aria-label`,`Image`),this.stage=document.createElement(`div`),this.stage.className=`wui-file-viewer-image-stage`,this.stage.append(e),this.scroller.append(this.stage),o.replaceChildren(this.scroller),this.scroller.addEventListener(`pointerdown`,e=>this._panStart(e)),this.scroller.addEventListener(`pointermove`,e=>this._panMove(e));for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.scroller.addEventListener(e,()=>this._panEnd());this.scroller.addEventListener(`wheel`,e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let t=performance.now();t-(this._lastWheelZoom??0)<120||(this._lastWheelZoom=t,this._stepZoom(e.deltaY<0?1:-1))},{passive:!1}),this._onKeyDown=e=>this._keyDown(e),s.addEventListener(`keydown`,this._onKeyDown),this._resizeObserver=new ResizeObserver(()=>{let e=this.scroller.clientWidth,t=this.scroller.clientHeight;e===this.area.width&&t===this.area.height||(this.area={width:e,height:t},this._layout())}),this._resizeObserver.observe(this.scroller),this.area={width:this.scroller.clientWidth,height:this.scroller.clientHeight},this._layout()}_turned(){let{width:e,height:t}=this.natural;return this.rotation%180==0?{width:e,height:t}:{width:t,height:e}}scale(){if(typeof this.zoom==`number`)return this.zoom;let{width:e,height:t}=this._turned(),n=Math.min((this.area.width-2*o)/e,(this.area.height-2*o)/t);return Math.max(n,.01)}_layout(){if(!this.stage)return;let t=this.scale(),n=this._turned();this.stage.style.width=`${Math.round(n.width*t)}px`,this.stage.style.height=`${Math.round(n.height*t)}px`,this.img.style.width=`${Math.round(this.natural.width*t)}px`,this.img.style.height=`${Math.round(this.natural.height*t)}px`,this.img.style.transform=`translate(-50%, -50%) rotate(${this.rotation}deg)`;let r=Math.round(t*100);this.zoomButton.innerHTML=`${r}%${e(`chevron-down`,{size:12})}`,this.zoomButton.setAttribute(`aria-label`,`Zoom, ${r}%`),this.zoomOutButton.disabled=this._zoomStep(-1)==null,this.zoomInButton.disabled=this._zoomStep(1)==null}_zoomStep(e){let t=this.scale();return e>0?i.find(e=>e>t+.001)??null:[...i].reverse().find(e=>e<t-.001)??null}_stepZoom(e){let t=this._zoomStep(e);t!=null&&this._setZoom(t)}_setZoom(e){let t=this.scroller,n=(t.scrollLeft+t.clientWidth/2)/Math.max(t.scrollWidth,1),r=(t.scrollTop+t.clientHeight/2)/Math.max(t.scrollHeight,1);this.zoom=e,this._layout(),t.scrollLeft=n*t.scrollWidth-t.clientWidth/2,t.scrollTop=r*t.scrollHeight-t.clientHeight/2}_rotate(e){this.rotation=(this.rotation+e+360)%360,this._setZoom(this.zoom)}_keyDown(e){if(!(e.defaultPrevented||e.altKey||!(e.ctrlKey||e.metaKey))){if(e.key===`+`||e.key===`=`)this._stepZoom(1);else if(e.key===`-`||e.key===`_`)this._stepZoom(-1);else if(e.key===`0`)this._setZoom(`fit`);else return;e.preventDefault()}}_panStart(e){let t=this.scroller;e.button!==0||t.scrollWidth<=t.clientWidth&&t.scrollHeight<=t.clientHeight||(this._pan={id:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop,active:!1})}_panMove(e){let t=this._pan;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.active){if(Math.abs(n)<s&&Math.abs(r)<s)return;t.active=!0,this.scroller.setPointerCapture(t.id),this.scroller.classList.add(`wui-file-viewer-panning`)}this.scroller.scrollLeft=t.left-n,this.scroller.scrollTop=t.top-r}_panEnd(){let e=this._pan;e?.active&&(this.scroller.hasPointerCapture(e.id)&&this.scroller.releasePointerCapture(e.id),this.scroller.classList.remove(`wui-file-viewer-panning`)),this._pan=null}print(){this._printFrame?.remove();let e=document.createElement(`iframe`);e.className=`wui-file-viewer-print-frame`,e.title=`Image for printing`,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`);let t=this.rotation%180!=0,r=new URL(this.source.src,document.baseURI).href;e.srcdoc=`<!doctype html><html><head><title>${l(this.shell.name())}</title></head><body></body></html>`,e.addEventListener(`load`,async()=>{try{let n=e.contentDocument,i=new e.contentWindow.CSSStyleSheet;i.replaceSync(`@page { margin: 10mm; }
1
+ import{a as e,n as t,o as n,t as r}from"./fileViewerUi-CmfISSyD.js";var i=[.1,.25,.5,.75,1,1.5,2,3,4],a=[.25,.5,1,2,4],o=16,s=5,c=class{constructor(e,t){this.shell=e,this.source=t,this.zoom=`fit`,this.rotation=0,this.area={width:0,height:0},this.destroyed=!1}load(){let e=document.createElement(`img`);e.className=`wui-file-viewer-image`,e.alt=this.shell.name(),e.decoding=`async`,e.draggable=!1,e.addEventListener(`load`,()=>{this.destroyed||(this.natural={width:e.naturalWidth||300,height:e.naturalHeight||150},this._build(e),this.shell.loaded({kind:`image`,pages:1}))}),e.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The image could not be decoded.`))}),e.src=this.source.src,this.img=e}destroy(){this.destroyed=!0,this._resizeObserver?.disconnect(),this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this._printFrame?.remove(),this.img?.removeAttribute(`src`)}_build(e){let{center:n,end:i,body:o,host:s}=this.shell;this.zoomOutButton=r(`zoom-out`,`Zoom out`),this.zoomOutButton.addEventListener(`click`,()=>this._stepZoom(-1)),this.zoomButton=document.createElement(`button`),this.zoomButton.type=`button`,this.zoomButton.className=`wui-file-viewer-zoom`,t(this.zoomButton,{label:`Zoom`,items:()=>[...a.map(e=>({key:String(e),label:`${Math.round(e*100)}%`,checked:this.zoom===e})),{key:`fit-divider`,divider:!0},{key:`fit`,label:`Fit`,checked:this.zoom===`fit`}],onPick:e=>this._setZoom(e===`fit`?`fit`:Number(e))}),this.zoomInButton=r(`zoom-in`,`Zoom in`),this.zoomInButton.addEventListener(`click`,()=>this._stepZoom(1));let c=r(`rotate-ccw`,`Rotate left`);c.addEventListener(`click`,()=>this._rotate(-90));let l=r(`rotate-cw`,`Rotate right`);l.addEventListener(`click`,()=>this._rotate(90));let u=document.createElement(`span`);u.className=`wui-file-viewer-divider wui-file-viewer-print`;let d=r(`printer`,`Print`,{className:`wui-file-viewer-print`});d.addEventListener(`click`,()=>this.print()),u.hidden=d.hidden=!this.shell.print(),n.append(this.zoomOutButton,this.zoomButton,this.zoomInButton),i.prepend(c,l,u,d),this.scroller=document.createElement(`div`),this.scroller.className=`wui-file-viewer-scroll wui-file-viewer-image-scroll wui-scroll`,this.scroller.tabIndex=0,this.scroller.setAttribute(`role`,`region`),this.scroller.setAttribute(`aria-label`,`Image`),this.stage=document.createElement(`div`),this.stage.className=`wui-file-viewer-image-stage`,this.stage.append(e),this.scroller.append(this.stage),o.replaceChildren(this.scroller),this.scroller.addEventListener(`pointerdown`,e=>this._panStart(e)),this.scroller.addEventListener(`pointermove`,e=>this._panMove(e));for(let e of[`pointerup`,`pointercancel`,`lostpointercapture`])this.scroller.addEventListener(e,()=>this._panEnd());this.scroller.addEventListener(`wheel`,e=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let t=performance.now();t-(this._lastWheelZoom??0)<120||(this._lastWheelZoom=t,this._stepZoom(e.deltaY<0?1:-1))},{passive:!1}),this._onKeyDown=e=>this._keyDown(e),s.addEventListener(`keydown`,this._onKeyDown),this._resizeObserver=new ResizeObserver(()=>{let e=this.scroller.clientWidth,t=this.scroller.clientHeight;e===this.area.width&&t===this.area.height||(this.area={width:e,height:t},this._layout())}),this._resizeObserver.observe(this.scroller),this.area={width:this.scroller.clientWidth,height:this.scroller.clientHeight},this._layout()}_turned(){let{width:e,height:t}=this.natural;return this.rotation%180==0?{width:e,height:t}:{width:t,height:e}}scale(){if(typeof this.zoom==`number`)return this.zoom;let{width:e,height:t}=this._turned(),n=Math.min((this.area.width-2*o)/e,(this.area.height-2*o)/t);return Math.max(n,.01)}_layout(){if(!this.stage)return;let t=this.scale(),n=this._turned();this.stage.style.width=`${Math.round(n.width*t)}px`,this.stage.style.height=`${Math.round(n.height*t)}px`,this.img.style.width=`${Math.round(this.natural.width*t)}px`,this.img.style.height=`${Math.round(this.natural.height*t)}px`,this.img.style.transform=`translate(-50%, -50%) rotate(${this.rotation}deg)`;let r=Math.round(t*100);this.zoomButton.innerHTML=`${r}%${e(`chevron-down`,{size:12})}`,this.zoomButton.setAttribute(`aria-label`,`Zoom, ${r}%`),this.zoomOutButton.disabled=this._zoomStep(-1)==null,this.zoomInButton.disabled=this._zoomStep(1)==null}_zoomStep(e){let t=this.scale();return e>0?i.find(e=>e>t+.001)??null:[...i].reverse().find(e=>e<t-.001)??null}_stepZoom(e){let t=this._zoomStep(e);t!=null&&this._setZoom(t)}_setZoom(e){let t=this.scroller,n=(t.scrollLeft+t.clientWidth/2)/Math.max(t.scrollWidth,1),r=(t.scrollTop+t.clientHeight/2)/Math.max(t.scrollHeight,1);this.zoom=e,this._layout(),t.scrollLeft=n*t.scrollWidth-t.clientWidth/2,t.scrollTop=r*t.scrollHeight-t.clientHeight/2}_rotate(e){this.rotation=(this.rotation+e+360)%360,this._setZoom(this.zoom)}_keyDown(e){if(!(e.defaultPrevented||e.altKey||!(e.ctrlKey||e.metaKey))){if(e.key===`+`||e.key===`=`)this._stepZoom(1);else if(e.key===`-`||e.key===`_`)this._stepZoom(-1);else if(e.key===`0`)this._setZoom(`fit`);else return;e.preventDefault()}}_panStart(e){let t=this.scroller;e.button!==0||t.scrollWidth<=t.clientWidth&&t.scrollHeight<=t.clientHeight||(this._pan={id:e.pointerId,x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop,active:!1})}_panMove(e){let t=this._pan;if(!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;if(!t.active){if(Math.abs(n)<s&&Math.abs(r)<s)return;t.active=!0,this.scroller.setPointerCapture(t.id),this.scroller.classList.add(`wui-file-viewer-panning`)}this.scroller.scrollLeft=t.left-n,this.scroller.scrollTop=t.top-r}_panEnd(){let e=this._pan;e?.active&&(this.scroller.hasPointerCapture(e.id)&&this.scroller.releasePointerCapture(e.id),this.scroller.classList.remove(`wui-file-viewer-panning`)),this._pan=null}print(){this._printFrame?.remove();let e=document.createElement(`iframe`);e.className=`wui-file-viewer-print-frame`,e.title=`Image for printing`,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`);let t=this.rotation%180!=0,r=new URL(this.source.src,document.baseURI).href;e.srcdoc=`<!doctype html><html><head><title>${l(this.shell.name())}</title></head><body></body></html>`,e.addEventListener(`load`,async()=>{try{let n=e.contentDocument,i=new e.contentWindow.CSSStyleSheet;i.replaceSync(`@page { margin: 10mm; }
2
2
  html, body { margin: 0; height: 100%; }
3
3
  body { display: flex; align-items: center; justify-content: center; }`),n.adoptedStyleSheets=[i];let a=n.createElement(`img`);a.src=r,a.alt=``,a.style.setProperty(`max-width`,t?`100vh`:`100vw`),a.style.setProperty(`max-height`,t?`100vw`:`100vh`),a.style.setProperty(`transform`,`rotate(${this.rotation}deg)`),n.body.append(a),a.complete||await new Promise(e=>{a.addEventListener(`load`,e,{once:!0}),a.addEventListener(`error`,e,{once:!0})}),e.contentWindow.focus(),e.contentWindow.print()}catch(e){n(`[wui-file-viewer] print failed:`,e?.message),window.open(this.source.src,`_blank`,`noopener`)}},{once:!0}),this._printFrame=e,document.body.append(e)}},l=e=>String(e??``).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`);export{c as ImageView};
@@ -1 +1 @@
1
- import{a as e,i as t,n,o as r,r as i,t as a}from"./fileViewerUi-CSOkacnB.js";var o=[.5,.75,1,1.25,1.5,2],s=5,c=.1;function l(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var u=e=>e instanceof Element&&e.closest(`input, textarea, select, button, a, .dropdown-menu`),d=class{constructor(e,t){this.shell=e,this.source=t,this.destroyed=!1}load(){let{kind:e,src:t,captions:n}=this.source,r=document.createElement(e);if(r.className=`wui-file-viewer-${e}`,r.preload=`metadata`,r.playsInline=!0,e===`video`&&n){let e=document.createElement(`track`);e.kind=`captions`,e.label=`Captions`,e.srclang=`en`,e.src=n,r.append(e)}let i=this.shell.prefs;typeof i.volume==`number`&&(r.volume=Math.min(Math.max(i.volume,0),1)),r.muted=i.muted===!0,r.addEventListener(`loadedmetadata`,()=>{this.destroyed||(r.playbackRate=o.includes(i.speed)?i.speed:1,this._build(),this.shell.loaded({kind:e,pages:1}))},{once:!0}),r.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The file could not be played.`))}),r.src=t,this.media=r}destroy(){this.destroyed=!0,this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this.media&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load())}_build(){let{body:t,host:r}=this.shell,i=this.media,s=this.source.kind,c=document.createElement(`div`);c.className=`wui-file-viewer-player wui-file-viewer-player-${s}`;let l=document.createElement(`div`);if(l.className=`wui-file-viewer-stage`,l.tabIndex=0,l.setAttribute(`role`,`group`),l.setAttribute(`aria-label`,s===`video`?`Video`:`Audio`),s===`audio`){let t=document.createElement(`div`);t.className=`wui-file-viewer-audio-art`,t.innerHTML=e(`music`,{size:40}),l.append(t,i)}else l.append(i),i.addEventListener(`click`,()=>this.togglePlay());let u=document.createElement(`div`);u.className=`wui-file-viewer-controls`,this.playButton=a(`play`,`Play`,{size:18}),this.playButton.addEventListener(`click`,()=>this.togglePlay()),this.timeNow=document.createElement(`span`),this.timeNow.className=`wui-file-viewer-time`,this.seek=document.createElement(`input`),this.seek.type=`range`,this.seek.className=`form-range wui-file-viewer-seek`,this.seek.min=`0`,this.seek.step=`any`,this.seek.setAttribute(`aria-label`,`Seek`),this.seek.addEventListener(`input`,()=>{i.currentTime=Number(this.seek.value)}),this.timeTotal=document.createElement(`span`),this.timeTotal.className=`wui-file-viewer-time`,this.muteButton=a(`volume-high`,`Mute`,{size:18}),this.muteButton.addEventListener(`click`,()=>this._setMuted(!i.muted)),this.volume=document.createElement(`input`),this.volume.type=`range`,this.volume.className=`form-range wui-file-viewer-volume`,this.volume.min=`0`,this.volume.max=`1`,this.volume.step=`0.05`,this.volume.setAttribute(`aria-label`,`Volume`),this.volume.addEventListener(`input`,()=>this._setVolume(Number(this.volume.value))),this.speedButton=document.createElement(`button`),this.speedButton.type=`button`,this.speedButton.className=`wui-file-viewer-zoom wui-file-viewer-speed`,n(this.speedButton,{label:`Playback speed`,items:()=>o.map(e=>({key:String(e),label:`${e}x`,checked:i.playbackRate===e})),onPick:e=>this._setSpeed(Number(e))}),u.append(this.playButton,this.timeNow,this.seek,this.timeTotal,this.muteButton,this.volume,this.speedButton),s===`video`&&this.source.captions&&(this.captionsButton=a(`subtitle`,`Show captions`,{size:18}),this.captionsButton.addEventListener(`click`,()=>this._setCaptions(!this._captionsOn())),u.append(this.captionsButton)),c.append(l,u),t.replaceChildren(c);for(let e of[`play`,`pause`,`ended`])i.addEventListener(e,()=>this._syncPlay());i.addEventListener(`timeupdate`,()=>this._syncTime()),i.addEventListener(`durationchange`,()=>this._syncTime()),i.addEventListener(`volumechange`,()=>this._syncVolume()),i.addEventListener(`ratechange`,()=>this._syncSpeed()),this._onKeyDown=e=>this._keyDown(e),r.addEventListener(`keydown`,this._onKeyDown),this._syncPlay(),this._syncTime(),this._syncVolume(),this._syncSpeed(),this._syncCaptions()}seekTo(e){let t=this.media.duration;this.media.currentTime=Math.min(Math.max(e,0),Number.isFinite(t)?t:1/0)}togglePlay(){this.media.paused||this.media.ended?this.media.play().catch(e=>{r(`[wui-file-viewer] play refused:`,e?.message)}):this.media.pause()}_setMuted(e){this.media.muted=e,!e&&this.media.volume===0&&(this.media.volume=.5),this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setVolume(e){this.media.volume=Math.min(Math.max(e,0),1),this.media.muted=this.media.volume===0,this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setSpeed(e){this.media.playbackRate=e,this.shell.savePrefs({speed:e})}_captionsOn(){return this.media.textTracks?.[0]?.mode===`showing`}_setCaptions(e){let t=this.media.textTracks?.[0];t&&(t.mode=e?`showing`:`hidden`),this._syncCaptions()}_syncPlay(){let e=!this.media.paused&&!this.media.ended;i(this.playButton,e?`pause`:`play`,18),t(this.playButton,e?`Pause`:`Play`),this.shell.host.classList.toggle(`wui-file-viewer-playing`,e)}_syncTime(){let e=this.media.currentTime,t=this.media.duration;this.timeNow.textContent=l(e),this.timeTotal.textContent=l(t),this.seek.max=String(Number.isFinite(t)?t:0),this.seek.value=String(e),this.seek.setAttribute(`aria-valuetext`,`${l(e)} of ${l(t)}`)}_syncVolume(){let e=this.media.muted||this.media.volume===0;i(this.muteButton,e?`volume-mute`:`volume-high`,18),t(this.muteButton,e?`Unmute`:`Mute`),this.volume.value=String(this.media.muted?0:this.media.volume)}_syncSpeed(){let e=`${this.media.playbackRate}x`;this.speedButton.textContent=e,this.speedButton.setAttribute(`aria-label`,`Playback speed, ${e}`)}_syncCaptions(){if(!this.captionsButton)return;let e=this._captionsOn();this.captionsButton.setAttribute(`aria-pressed`,String(e)),t(this.captionsButton,e?`Hide captions`:`Show captions`)}_keyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||u(e.target))return;let t=this.media,n=e.key.toLowerCase();if(n===` `||n===`k`)this.togglePlay();else if(n===`arrowleft`)t.currentTime=Math.max(0,t.currentTime-s);else if(n===`arrowright`)t.currentTime=Math.min(t.duration||0,t.currentTime+s);else if(n===`arrowup`)this._setVolume(t.volume+c);else if(n===`arrowdown`)this._setVolume(t.volume-c);else if(n===`m`)this._setMuted(!t.muted);else if(n===`c`&&this.captionsButton)this._setCaptions(!this._captionsOn());else return;e.preventDefault()}};export{d as MediaView};
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./fileViewerUi-CmfISSyD.js";var o=[.5,.75,1,1.25,1.5,2],s=5,c=.1;function l(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var u=e=>e instanceof Element&&e.closest(`input, textarea, select, button, a, .dropdown-menu`),d=class{constructor(e,t){this.shell=e,this.source=t,this.destroyed=!1}load(){let{kind:e,src:t,captions:n}=this.source,r=document.createElement(e);if(r.className=`wui-file-viewer-${e}`,r.preload=`metadata`,r.playsInline=!0,e===`video`&&n){let e=document.createElement(`track`);e.kind=`captions`,e.label=`Captions`,e.srclang=`en`,e.src=n,r.append(e)}let i=this.shell.prefs;typeof i.volume==`number`&&(r.volume=Math.min(Math.max(i.volume,0),1)),r.muted=i.muted===!0,r.addEventListener(`loadedmetadata`,()=>{this.destroyed||(r.playbackRate=o.includes(i.speed)?i.speed:1,this._build(),this.shell.loaded({kind:e,pages:1}))},{once:!0}),r.addEventListener(`error`,()=>{this.destroyed||this.shell.fail(Error(`The file could not be played.`))}),r.src=t,this.media=r}destroy(){this.destroyed=!0,this._onKeyDown&&this.shell.host.removeEventListener(`keydown`,this._onKeyDown),this.media&&(this.media.pause(),this.media.removeAttribute(`src`),this.media.load())}_build(){let{body:t,host:r}=this.shell,i=this.media,s=this.source.kind,c=document.createElement(`div`);c.className=`wui-file-viewer-player wui-file-viewer-player-${s}`;let l=document.createElement(`div`);if(l.className=`wui-file-viewer-stage`,l.tabIndex=0,l.setAttribute(`role`,`group`),l.setAttribute(`aria-label`,s===`video`?`Video`:`Audio`),s===`audio`){let t=document.createElement(`div`);t.className=`wui-file-viewer-audio-art`,t.innerHTML=e(`music`,{size:40}),l.append(t,i)}else l.append(i),i.addEventListener(`click`,()=>this.togglePlay());let u=document.createElement(`div`);u.className=`wui-file-viewer-controls`,this.playButton=a(`play`,`Play`,{size:18}),this.playButton.addEventListener(`click`,()=>this.togglePlay()),this.timeNow=document.createElement(`span`),this.timeNow.className=`wui-file-viewer-time`,this.seek=document.createElement(`input`),this.seek.type=`range`,this.seek.className=`form-range wui-file-viewer-seek`,this.seek.min=`0`,this.seek.step=`any`,this.seek.setAttribute(`aria-label`,`Seek`),this.seek.addEventListener(`input`,()=>{i.currentTime=Number(this.seek.value)}),this.timeTotal=document.createElement(`span`),this.timeTotal.className=`wui-file-viewer-time`,this.muteButton=a(`volume-high`,`Mute`,{size:18}),this.muteButton.addEventListener(`click`,()=>this._setMuted(!i.muted)),this.volume=document.createElement(`input`),this.volume.type=`range`,this.volume.className=`form-range wui-file-viewer-volume`,this.volume.min=`0`,this.volume.max=`1`,this.volume.step=`0.05`,this.volume.setAttribute(`aria-label`,`Volume`),this.volume.addEventListener(`input`,()=>this._setVolume(Number(this.volume.value))),this.speedButton=document.createElement(`button`),this.speedButton.type=`button`,this.speedButton.className=`wui-file-viewer-zoom wui-file-viewer-speed`,n(this.speedButton,{label:`Playback speed`,items:()=>o.map(e=>({key:String(e),label:`${e}x`,checked:i.playbackRate===e})),onPick:e=>this._setSpeed(Number(e))}),u.append(this.playButton,this.timeNow,this.seek,this.timeTotal,this.muteButton,this.volume,this.speedButton),s===`video`&&this.source.captions&&(this.captionsButton=a(`subtitle`,`Show captions`,{size:18}),this.captionsButton.addEventListener(`click`,()=>this._setCaptions(!this._captionsOn())),u.append(this.captionsButton)),c.append(l,u),t.replaceChildren(c);for(let e of[`play`,`pause`,`ended`])i.addEventListener(e,()=>this._syncPlay());i.addEventListener(`timeupdate`,()=>this._syncTime()),i.addEventListener(`durationchange`,()=>this._syncTime()),i.addEventListener(`volumechange`,()=>this._syncVolume()),i.addEventListener(`ratechange`,()=>this._syncSpeed()),this._onKeyDown=e=>this._keyDown(e),r.addEventListener(`keydown`,this._onKeyDown),this._syncPlay(),this._syncTime(),this._syncVolume(),this._syncSpeed(),this._syncCaptions()}seekTo(e){let t=this.media.duration;this.media.currentTime=Math.min(Math.max(e,0),Number.isFinite(t)?t:1/0)}togglePlay(){this.media.paused||this.media.ended?this.media.play().catch(e=>{r(`[wui-file-viewer] play refused:`,e?.message)}):this.media.pause()}_setMuted(e){this.media.muted=e,!e&&this.media.volume===0&&(this.media.volume=.5),this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setVolume(e){this.media.volume=Math.min(Math.max(e,0),1),this.media.muted=this.media.volume===0,this.shell.savePrefs({muted:this.media.muted,volume:this.media.volume})}_setSpeed(e){this.media.playbackRate=e,this.shell.savePrefs({speed:e})}_captionsOn(){return this.media.textTracks?.[0]?.mode===`showing`}_setCaptions(e){let t=this.media.textTracks?.[0];t&&(t.mode=e?`showing`:`hidden`),this._syncCaptions()}_syncPlay(){let e=!this.media.paused&&!this.media.ended;i(this.playButton,e?`pause`:`play`,18),t(this.playButton,e?`Pause`:`Play`),this.shell.host.classList.toggle(`wui-file-viewer-playing`,e)}_syncTime(){let e=this.media.currentTime,t=this.media.duration;this.timeNow.textContent=l(e),this.timeTotal.textContent=l(t),this.seek.max=String(Number.isFinite(t)?t:0),this.seek.value=String(e),this.seek.setAttribute(`aria-valuetext`,`${l(e)} of ${l(t)}`)}_syncVolume(){let e=this.media.muted||this.media.volume===0;i(this.muteButton,e?`volume-mute`:`volume-high`,18),t(this.muteButton,e?`Unmute`:`Mute`),this.volume.value=String(this.media.muted?0:this.media.volume)}_syncSpeed(){let e=`${this.media.playbackRate}x`;this.speedButton.textContent=e,this.speedButton.setAttribute(`aria-label`,`Playback speed, ${e}`)}_syncCaptions(){if(!this.captionsButton)return;let e=this._captionsOn();this.captionsButton.setAttribute(`aria-pressed`,String(e)),t(this.captionsButton,e?`Hide captions`:`Show captions`)}_keyDown(e){if(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||u(e.target))return;let t=this.media,n=e.key.toLowerCase();if(n===` `||n===`k`)this.togglePlay();else if(n===`arrowleft`)t.currentTime=Math.max(0,t.currentTime-s);else if(n===`arrowright`)t.currentTime=Math.min(t.duration||0,t.currentTime+s);else if(n===`arrowup`)this._setVolume(t.volume+c);else if(n===`arrowdown`)this._setVolume(t.volume-c);else if(n===`m`)this._setMuted(!t.muted);else if(n===`c`&&this.captionsButton)this._setCaptions(!this._captionsOn());else return;e.preventDefault()}};export{d as MediaView};