fokus-styles 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/css/components.css +561 -83
- package/dist/css/components.css.map +1 -1
- package/dist/css/components.min.css +1 -1
- package/dist/css/components.min.css.map +1 -1
- package/dist/css/fokus-components.css +561 -83
- package/dist/css/fokus-components.css.map +1 -1
- package/dist/css/fokus-components.min.css +1 -1
- package/dist/css/fokus-components.min.css.map +1 -1
- package/dist/css/fokus-rtl.css +697 -83
- package/dist/css/fokus-rtl.css.map +1 -1
- package/dist/css/fokus-rtl.min.css +1 -1
- package/dist/css/fokus-rtl.min.css.map +1 -1
- package/dist/css/fokus-utilities.css +136 -0
- package/dist/css/fokus-utilities.css.map +1 -1
- package/dist/css/fokus-utilities.min.css +1 -1
- package/dist/css/fokus-utilities.min.css.map +1 -1
- package/dist/css/fokus.css +996 -258
- package/dist/css/fokus.css.map +1 -1
- package/dist/css/fokus.min.css +1 -1
- package/dist/css/fokus.min.css.map +1 -1
- package/dist/css/forms.css +300 -176
- package/dist/css/forms.css.map +1 -1
- package/dist/css/forms.min.css +1 -1
- package/dist/css/forms.min.css.map +1 -1
- package/dist/css/helpers.css +136 -0
- package/dist/css/helpers.css.map +1 -1
- package/dist/css/helpers.min.css +1 -1
- package/dist/css/helpers.min.css.map +1 -1
- package/dist/js/fokus.js +270 -25
- package/dist/js/fokus.js.map +2 -2
- package/dist/js/fokus.min.js +18 -18
- package/dist/js/fokus.min.js.map +3 -3
- package/docs/components/alert.md +69 -24
- package/docs/components/badge.md +23 -4
- package/docs/components/checkbox.md +16 -3
- package/docs/components/popover.md +20 -7
- package/docs/components/radio.md +11 -1
- package/docs/components/responsive.md +19 -0
- package/docs/components/switch.md +30 -8
- package/docs/components/tag.md +19 -4
- package/docs/components/toast.md +72 -59
- package/docs/components/tooltip.md +38 -2
- package/docs/guides/accessibility.md +7 -0
- package/docs/prompts/prompt-plan.md +4 -4
- package/docs/reference/accessibility-matrix.md +7 -7
- package/docs/reference/contrast-report.md +4 -0
- package/docs/reference/definitions.md +5 -1
- package/docs/reference/design-tokens.md +14 -0
- package/docs/reference/size-baseline.json +11 -11
- package/mockup/assets/example-theme.css +11 -0
- package/mockup/assets/showcase-contracts.js +6 -6
- package/mockup/examples/alerts.html +105 -31
- package/mockup/examples/badges-alerts.html +91 -59
- package/mockup/examples/check-radio-switch.html +575 -99
- package/mockup/examples/popover.html +81 -0
- package/mockup/examples/tag.html +97 -87
- package/mockup/examples/toast.html +113 -0
- package/mockup/examples/tooltip.html +68 -0
- package/mockup/forms.html +1 -1
- package/mockup/overlays-commands.html +2 -2
- package/package.json +1 -1
- package/packages/fokus-components/scss/components/_alerts.scss +128 -6
- package/packages/fokus-components/scss/components/_badges.scss +26 -10
- package/packages/fokus-components/scss/components/_index.scss +1 -0
- package/packages/fokus-components/scss/components/_popover.scss +131 -21
- package/packages/fokus-components/scss/components/_responsive.scss +23 -0
- package/packages/fokus-components/scss/components/_tag.scss +37 -14
- package/packages/fokus-components/scss/components/_toasts.scss +156 -11
- package/packages/fokus-components/scss/components/_tooltips.scss +70 -18
- package/packages/fokus-components/scss/forms/_check-radio-switch.scss +313 -215
- package/packages/fokus-components/scss/forms/_forms.scss +16 -0
- package/packages/fokus-js/js/carousel.d.ts +4 -0
- package/packages/fokus-js/js/carousel.js +8 -0
- package/packages/fokus-js/js/core/positioning.js +18 -9
- package/packages/fokus-js/js/dropdown.d.ts +4 -0
- package/packages/fokus-js/js/dropdown.js +7 -0
- package/packages/fokus-js/js/popover.js +26 -1
- package/packages/fokus-js/js/tabs.d.ts +3 -0
- package/packages/fokus-js/js/tabs.js +5 -0
- package/packages/fokus-js/js/tag.js +17 -0
- package/packages/fokus-js/js/toast.js +77 -3
- package/packages/fokus-js/js/tooltip.d.ts +8 -1
- package/packages/fokus-js/js/tooltip.js +106 -13
- package/packages/fokus-utilities/scss/utilities/_api.scss +48 -0
package/dist/js/fokus.min.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var FokusStyles=(()=>{var gt=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var xe=Object.prototype.hasOwnProperty;var ee=(r,t)=>{for(var e in t)gt(r,e,{get:t[e],enumerable:!0})},Ae=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ce(t))!xe.call(r,s)&&s!==e&>(r,s,{get:()=>t[s],enumerable:!(i=ke(t,s))||i.enumerable});return r};var Le=r=>Ae(gt({},"__esModule",{value:!0}),r);var Ve={};ee(Ve,{Accordion:()=>B,Breadcrumb:()=>Y,Carousel:()=>W,Collapse:()=>H,Combobox:()=>j,CommandPalette:()=>J,DataTable:()=>X,Datepicker:()=>Q,Dropdown:()=>k,FileDrop:()=>$,FileUploadAdvanced:()=>it,FormValidation:()=>rt,Modal:()=>D,Navbar:()=>st,NestedMenu:()=>G,NotificationCenter:()=>V,Offcanvas:()=>K,Pagination:()=>ot,Popover:()=>F,RangeSlider:()=>tt,Scrollspy:()=>nt,Select:()=>R,Spinner:()=>at,Stepper:()=>U,Tabs:()=>z,Tag:()=>N,Theme:()=>mt,Toast:()=>O,Tooltip:()=>S,TreeView:()=>Z,confirm:()=>ce,core:()=>ct,createFocusTrap:()=>y,getFocusableElements:()=>M,onEscapeKey:()=>f});var ct={};ee(ct,{applyPosition:()=>v,autoInit:()=>d,collapse:()=>L,computePosition:()=>E,createFocusTrap:()=>y,createInstanceRegistry:()=>h,expand:()=>I,getFocusableElements:()=>M,lockScroll:()=>x,onClickOutside:()=>g,onEscapeKey:()=>f,onTransitionEnd:()=>Se,registerOverlay:()=>P,unlockScroll:()=>A,unregisterOverlay:()=>q,watchPosition:()=>w});var ie={top:"bottom",bottom:"top",left:"right",right:"left"};function se(r,t,e,i,s,n){switch(r){case"top":return t.top-e.height-i>=0;case"bottom":return t.bottom+e.height+i<=n;case"left":return t.left-e.width-i>=0;case"right":return t.right+e.width+i<=s;default:return!0}}function ne(r,t,e,i){switch(r){case"start":return t;case"end":return t+e-i;default:return t+(e-i)/2}}function E(r,t,e={}){let{placement:i="bottom",align:s="center",offset:n=8,padding:a=8}=e,o=r.getBoundingClientRect(),l=t.getBoundingClientRect(),c=document.documentElement.clientWidth,p=document.documentElement.clientHeight,u=i;!se(i,o,l,n,c,p)&&se(ie[i],o,l,n,c,p)&&(u=ie[i]);let b,m;u==="top"||u==="bottom"?(b=u==="top"?o.top-l.height-n:o.bottom+n,m=ne(s,o.left,o.width,l.width)):(m=u==="left"?o.left-l.width-n:o.right+n,b=ne(s,o.top,o.height,l.height));let C=Math.max(a,c-l.width-a),_=Math.max(a,p-l.height-a);return m=Math.min(Math.max(m,a),C),b=Math.min(Math.max(b,a),_),{top:b+window.scrollY,left:m+window.scrollX,placement:u}}function w(r,t,e={}){let i=()=>v(t,E(r,t,e)),s=null,n=()=>{s===null&&(s=requestAnimationFrame(()=>{s=null,i()}))};window.addEventListener("resize",n,{passive:!0}),window.addEventListener("scroll",n,{passive:!0,capture:!0});let a=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return a==null||a.observe(r),a==null||a.observe(t),()=>{window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0),s!==null&&cancelAnimationFrame(s),a==null||a.disconnect()}}function v(r,t){r.style.position="absolute",r.style.top=`${t.top}px`,r.style.left=`${t.left}px`}var T=0,bt=!1,re="",ae="",dt=[];function P(r){dt.includes(r)||dt.push(r)}function q(r){let t=dt.lastIndexOf(r);t>=0&&dt.splice(t,1)}function x(){if(T+=1,T>1)return;let r=window.innerWidth-document.documentElement.clientWidth;re=document.body.style.overflow,ae=document.body.style.paddingRight,document.body.style.overflow="hidden",r>0&&(document.body.style.paddingRight=`${r}px`,bt=!0)}function A(){T=Math.max(0,T-1),!(T>0)&&(document.body.style.overflow=re,bt&&(document.body.style.paddingRight=ae,bt=!1))}function g(r,t){let e=i=>{r.contains(i.target)||t(i)};return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}}var Ie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function M(r){return Array.from(r.querySelectorAll(Ie)).filter(t=>t.offsetParent!==null)}function y(r){let t=[],e=s=>{r.parentElement&&[...r.parentElement.children].filter(n=>n!==r).forEach(n=>{if(s)t.push({el:n,value:n.inert,ariaHidden:n.getAttribute("aria-hidden")}),n.inert=!0,n.setAttribute("aria-hidden","true");else{let a=t.find(o=>o.el===n);a&&(n.inert=a.value,a.ariaHidden===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",a.ariaHidden))}})};function i(s){if(s.key!=="Tab")return;let n=M(r);if(n.length===0){s.preventDefault();return}let a=n[0],o=n[n.length-1];s.shiftKey&&document.activeElement===a?(s.preventDefault(),o.focus()):!s.shiftKey&&document.activeElement===o&&(s.preventDefault(),a.focus())}return r.addEventListener("keydown",i),{activate(){e(!0);let s=M(r);s.length>0&&s[0].focus()},deactivate(){r.removeEventListener("keydown",i),e(!1),t.length=0}}}function f(r){let t=e=>{e.key==="Escape"&&r(e)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}function oe(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function le(r){return new Promise(t=>{let e=!1,i=()=>{e||(e=!0,clearTimeout(n),r.removeEventListener("transitionend",s),t())},s=a=>{a.target!==r||a.propertyName!=="height"||i()};r.addEventListener("transitionend",s);let n=window.setTimeout(i,450)})}function L(r,t={}){var s;if(oe())return r.style.display="none",Promise.resolve();let e=(s=t.duration)!=null?s:200;r.style.overflow="hidden",r.style.height=`${r.scrollHeight}px`,r.style.transition=`height ${e}ms ease`;let i=le(r).then(()=>{r.style.display="none",r.style.removeProperty("height"),r.style.removeProperty("overflow"),r.style.removeProperty("transition")});return requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.height="0px"})}),i}function I(r,t={}){var n;if(r.style.display="",oe())return Promise.resolve();let e=(n=t.duration)!=null?n:200,i=`${r.scrollHeight}px`;r.style.overflow="hidden",r.style.height="0px",r.style.transition=`height ${e}ms ease`;let s=le(r).then(()=>{r.style.removeProperty("height"),r.style.removeProperty("overflow"),r.style.removeProperty("transition")});return requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.height=i})}),s}function Se(r,t){return new Promise(e=>{let i=s=>{s.target===r&&(t&&s.propertyName!==t||(r.removeEventListener("transitionend",i),e()))};r.addEventListener("transitionend",i)})}function h(){let r=new WeakMap;return{get(t){return r.get(t)},set(t,e){r.set(t,e)},delete(t){r.delete(t)}}}function d(r,t,e={}){var n;if(typeof document=="undefined")return;let i=(n=e.selector)!=null?n:`[data-fs="${r}"]`,s=()=>{document.querySelectorAll(i).forEach(a=>{t.getInstance(a)||new t(a)})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s):s()}var Et=h(),k=class{constructor(t,e={}){var n,a,o,l;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):t.nextElementSibling;if(!s)throw new Error("FokusStyles.Dropdown: elemento do menu n\xE3o encontrado (data-fs-target).");this.toggleEl=t,this.menuEl=s,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.align=(l=(o=e.align)!=null?o:t.getAttribute("data-align"))!=null?l:"start",this.isOpen=!1,this._outsideClickCleanup=null,this._positionCleanup=null,this._originalParent=this.menuEl.parentNode,this._originalNextSibling=this.menuEl.nextSibling,document.body.appendChild(this.menuEl),this.toggleEl.setAttribute("aria-haspopup","menu"),this.toggleEl.setAttribute("aria-expanded","false"),this.toggleEl.setAttribute("aria-controls",this.menuEl.id||`fs-dropdown-${Math.random().toString(36).slice(2)}`),this.menuEl.id||(this.menuEl.id=this.toggleEl.getAttribute("aria-controls")),this.menuEl.setAttribute("role","menu"),this.menuEl.querySelectorAll(".fs-dropdown-item").forEach(c=>{c.hasAttribute("role")||c.setAttribute("role","menuitem")}),this._handleToggleClick=this._handleToggleClick.bind(this),this._handleMenuKeydown=this._handleMenuKeydown.bind(this),this._handleMenuClick=this._handleMenuClick.bind(this),this.toggleEl.addEventListener("click",this._handleToggleClick),this.menuEl.addEventListener("keydown",this._handleMenuKeydown),this.menuEl.addEventListener("click",this._handleMenuClick),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.toggleEl.focus())}),Et.set(t,this)}static getInstance(t){return Et.get(t)}_handleToggleClick(t){t.preventDefault(),this.toggle()}_handleMenuClick(t){t.target.closest(".fs-dropdown-item")&&(this.hide(),this.toggleEl.focus())}_handleMenuKeydown(t){var s,n,a,o;let e=Array.from(this.menuEl.querySelectorAll(".fs-dropdown-item:not(.is-disabled)")),i=e.indexOf(document.activeElement);t.key==="ArrowDown"?(t.preventDefault(),(s=e[(i+1)%e.length])==null||s.focus()):t.key==="ArrowUp"?(t.preventDefault(),(n=e[(i-1+e.length)%e.length])==null||n.focus()):t.key==="Home"?(t.preventDefault(),(a=e[0])==null||a.focus()):t.key==="End"?(t.preventDefault(),(o=e[e.length-1])==null||o.focus()):t.key==="Escape"&&(t.preventDefault(),this.hide(),this.toggleEl.focus())}show(){var s;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.toggleEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.menuEl.setAttribute("data-theme",t):this.menuEl.removeAttribute("data-theme"),this.menuEl.classList.add("is-open");let e=E(this.toggleEl,this.menuEl,{placement:this.placement,align:this.align,offset:4});v(this.menuEl,e),this._positionCleanup=w(this.toggleEl,this.menuEl,{placement:this.placement,align:this.align,offset:4}),this.toggleEl.setAttribute("aria-expanded","true");let i=this.menuEl.querySelector(".fs-dropdown-item:not(.is-disabled)");i==null||i.focus(),this._outsideClickCleanup=g(this.menuEl,n=>{this.toggleEl.contains(n.target)||this.hide()}),this.toggleEl.dispatchEvent(new CustomEvent("fs:dropdown:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.menuEl.classList.remove("is-open"),this.menuEl.style.removeProperty("position"),this.menuEl.style.removeProperty("top"),this.menuEl.style.removeProperty("left"),this.toggleEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,(e=this._positionCleanup)==null||e.call(this),this._positionCleanup=null,this.toggleEl.dispatchEvent(new CustomEvent("fs:dropdown:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.toggleEl.removeEventListener("click",this._handleToggleClick),this.menuEl.removeEventListener("keydown",this._handleMenuKeydown),this.menuEl.removeEventListener("click",this._handleMenuClick),this._originalParent&&this._originalParent.insertBefore(this.menuEl,this._originalNextSibling),Et.delete(this.toggleEl)}};d("dropdown",k);var vt=h(),he=0,S=class{constructor(t,e={}){var s,n,a,o;let i=(n=(s=t.getAttribute("title"))!=null?s:t.getAttribute("data-title"))!=null?n:e.title;if(!i)throw new Error("FokusStyles.Tooltip: elemento sem texto (atributo title/data-title).");t.removeAttribute("title"),he+=1,this.referenceEl=t,this.title=i,this.placement=(o=(a=e.placement)!=null?a:t.getAttribute("data-placement"))!=null?o:"top",this.isOpen=!1,this.id=`fokus-tooltip-${he}`,this._positionCleanup=null,this._originalDescribedBy=t.getAttribute("aria-describedby"),this.tooltipEl=document.createElement("div"),this.tooltipEl.className="fs-tooltip",this.tooltipEl.id=this.id,this.tooltipEl.setAttribute("role","tooltip"),this.tooltipEl.innerHTML='<div class="fs-tooltip-arrow"></div><div class="fs-tooltip-inner"></div>',this.tooltipEl.querySelector(".fs-tooltip-inner").textContent=this.title,document.body.appendChild(this.tooltipEl),t.setAttribute("aria-describedby",this.id),this._handleShow=this.show.bind(this),this._handleHide=this.hide.bind(this),t.addEventListener("mouseenter",this._handleShow),t.addEventListener("mouseleave",this._handleHide),t.addEventListener("focus",this._handleShow),t.addEventListener("blur",this._handleHide),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),vt.set(t,this)}static getInstance(t){return vt.get(t)}show(){var i;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.referenceEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.tooltipEl.setAttribute("data-theme",t):this.tooltipEl.removeAttribute("data-theme"),this.tooltipEl.classList.add("is-open");let e=E(this.referenceEl,this.tooltipEl,{placement:this.placement,offset:10});v(this.tooltipEl,e),this._positionCleanup=w(this.referenceEl,this.tooltipEl,{placement:this.placement,offset:10}),this.tooltipEl.setAttribute("data-placement",e.placement),this.referenceEl.dispatchEvent(new CustomEvent("fs:tooltip:shown",{bubbles:!0}))}hide(){var t;this.isOpen&&(this.isOpen=!1,this.tooltipEl.classList.remove("is-open"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.referenceEl.dispatchEvent(new CustomEvent("fs:tooltip:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this.referenceEl.removeEventListener("mouseenter",this._handleShow),this.referenceEl.removeEventListener("mouseleave",this._handleHide),this.referenceEl.removeEventListener("focus",this._handleShow),this.referenceEl.removeEventListener("blur",this._handleHide),this._removeEscapeListener(),this._originalDescribedBy===null?this.referenceEl.removeAttribute("aria-describedby"):this.referenceEl.setAttribute("aria-describedby",this._originalDescribedBy),this.tooltipEl.remove(),vt.delete(this.referenceEl)}};d("tooltip",S);var _t=h(),yt=0,De=100,F=class{constructor(t,e={}){var a,o,l,c,p,u;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):null;if(!s)throw new Error("FokusStyles.Popover: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.popoverEl=s,this.placement=(o=(a=e.placement)!=null?a:t.getAttribute("data-placement"))!=null?o:"top",this.align=(c=(l=e.align)!=null?l:t.getAttribute("data-align"))!=null?c:"center",this.trigger=(u=(p=e.trigger)!=null?p:t.getAttribute("data-trigger"))!=null?u:"click",this.isOpen=!1,this._outsideClickCleanup=null,this._removeEscapeListener=null,this._hideTimer=null,this._positionCleanup=null,this._originalParent=s.parentNode,this._originalNextSibling=s.nextSibling,document.body.appendChild(s),s.setAttribute("role","dialog"),s.setAttribute("aria-modal","false"),yt+=1,s.id||(s.id=`fokus-popover-${yt}`);let n=s.querySelector(".fs-popover-header");n&&(n.id||(n.id=`fokus-popover-header-${yt}`),s.setAttribute("aria-labelledby",n.id)),t.setAttribute("aria-controls",s.id),t.setAttribute("aria-expanded","false"),this._handleDismissClick=this._handleDismissClick.bind(this),s.addEventListener("click",this._handleDismissClick),this._bindTrigger(),_t.set(t,this)}static getInstance(t){return _t.get(t)}_bindTrigger(){this.trigger!=="manual"&&(this.trigger==="click"?(this._handleTriggerClick=t=>{t.preventDefault(),this.toggle()},this.triggerEl.addEventListener("click",this._handleTriggerClick)):this.trigger==="hover"?(this._handleMouseEnter=()=>{clearTimeout(this._hideTimer),this.show()},this._handleMouseLeave=()=>{this._hideTimer=setTimeout(()=>this.hide(),De)},this.triggerEl.addEventListener("mouseenter",this._handleMouseEnter),this.triggerEl.addEventListener("mouseleave",this._handleMouseLeave),this.popoverEl.addEventListener("mouseenter",this._handleMouseEnter),this.popoverEl.addEventListener("mouseleave",this._handleMouseLeave)):this.trigger==="focus"&&(this._handleTriggerFocus=()=>this.show(),this._handleTriggerFocusOut=t=>{this.popoverEl.contains(t.relatedTarget)||this.hide()},this._handlePopoverFocusOut=t=>{this.triggerEl.contains(t.relatedTarget)||this.popoverEl.contains(t.relatedTarget)||this.hide()},this.triggerEl.addEventListener("focus",this._handleTriggerFocus),this.triggerEl.addEventListener("focusout",this._handleTriggerFocusOut),this.popoverEl.addEventListener("focusout",this._handlePopoverFocusOut)),this.trigger!=="manual"&&(this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.triggerEl.focus())})))}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="popover"]')&&this.hide()}show(){var i;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.triggerEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.popoverEl.setAttribute("data-theme",t):this.popoverEl.removeAttribute("data-theme"),this.popoverEl.classList.add("is-open");let e=E(this.triggerEl,this.popoverEl,{placement:this.placement,align:this.align,offset:10});v(this.popoverEl,e),this._positionCleanup=w(this.triggerEl,this.popoverEl,{placement:this.placement,align:this.align,offset:10}),this.popoverEl.setAttribute("data-placement",e.placement),this.triggerEl.setAttribute("aria-expanded","true"),this.trigger==="click"&&(this._outsideClickCleanup=g(this.popoverEl,s=>{this.triggerEl.contains(s.target)||this.hide()})),this.triggerEl.dispatchEvent(new CustomEvent("fs:popover:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.popoverEl.classList.remove("is-open"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.triggerEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.dispatchEvent(new CustomEvent("fs:popover:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){var t;this.hide(),clearTimeout(this._hideTimer),(t=this._removeEscapeListener)==null||t.call(this),this.popoverEl.removeEventListener("click",this._handleDismissClick),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.triggerEl.removeEventListener("mouseenter",this._handleMouseEnter),this.triggerEl.removeEventListener("mouseleave",this._handleMouseLeave),this.popoverEl.removeEventListener("mouseenter",this._handleMouseEnter),this.popoverEl.removeEventListener("mouseleave",this._handleMouseLeave),this.triggerEl.removeEventListener("focus",this._handleTriggerFocus),this.triggerEl.removeEventListener("focusout",this._handleTriggerFocusOut),this.popoverEl.removeEventListener("focusout",this._handlePopoverFocusOut),this._originalParent&&this._originalParent.insertBefore(this.popoverEl,this._originalNextSibling),_t.delete(this.triggerEl)}};d("popover",F);var wt=h(),D=class r{constructor(t,e={}){var a,o;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):null;if(!s)throw new Error("FokusStyles.Modal: elemento do modal n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.modalEl=s,this.dialogEl=(a=s.querySelector(".fs-modal-dialog"))!=null?a:s,this.staticBackdrop=((o=e.backdrop)!=null?o:s.getAttribute("data-backdrop"))==="static",this.isOpen=!1,this._focusTrap=null,this._outsideClickCleanup=null,s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-hidden","true");let n=s.querySelector(".fs-modal-title");n&&(n.id||(n.id=`fs-modal-title-${Math.random().toString(36).slice(2)}`),s.setAttribute("aria-labelledby",n.id)),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleDismissClick=this._handleDismissClick.bind(this),t.addEventListener("click",this._handleTriggerClick),s.addEventListener("click",this._handleDismissClick),this._removeEscapeListener=f(()=>{this.isOpen&&!this.staticBackdrop&&this.hide()}),wt.set(t,this)}static getInstance(t){return wt.get(t)}static getOrCreateInstance(t,e={}){var i;return(i=this.getInstance(t))!=null?i:new r(t,e)}static show(t,e={}){return this.getOrCreateInstance(t,e).show()}static hide(t){var e;return(e=this.getInstance(t))==null?void 0:e.hide()}static toggle(t,e={}){return this.getOrCreateInstance(t,e).toggle()}_handleTriggerClick(t){t.preventDefault(),this.show()}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="modal"]')&&this.hide()}show(){this.isOpen||(this.triggerEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,P(this),this.modalEl.classList.add("is-open"),this.modalEl.setAttribute("aria-hidden","false"),x(),this._focusTrap=y(this.dialogEl),this._focusTrap.activate(),this.staticBackdrop||(this._outsideClickCleanup=g(this.dialogEl,()=>this.hide())),this.triggerEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:modal:shown",{bubbles:!0})))}hide(){var t,e;this.isOpen&&(this.triggerEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,q(this),this.modalEl.classList.remove("is-open"),this.modalEl.setAttribute("aria-hidden","true"),A(),(t=this._focusTrap)==null||t.deactivate(),this._focusTrap=null,(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:modal:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.modalEl.removeEventListener("click",this._handleDismissClick),wt.delete(this.triggerEl)}};d("modal",D,{selector:'[data-fs="modal"], [data-fs-toggle="modal"]'});var de=0;function ut(r){let t=document.createElement("div");return t.textContent=r,t.innerHTML}function ce(r={}){let{title:t="Tem certeza?",message:e="",confirmText:i="Confirmar",cancelText:s="Cancelar",variant:n="danger"}=r;return new Promise(a=>{de+=1;let o=`fokus-confirm-${de}`,l=document.activeElement instanceof HTMLElement?document.activeElement:document.body,c=document.createElement("div");c.className="fs-modal fs-alert-dialog",c.id=o,c.innerHTML=`
|
|
1
|
+
var FokusStyles=(()=>{var vt=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var ae=(r,t)=>{for(var e in t)vt(r,e,{get:t[e],enumerable:!0})},Pe=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oe(t))!Te.call(r,i)&&i!==e&&vt(r,i,{get:()=>t[i],enumerable:!(s=De(t,i))||s.enumerable});return r};var Me=r=>Pe(vt({},"__esModule",{value:!0}),r);var ns={};ae(ns,{Accordion:()=>W,Breadcrumb:()=>j,Carousel:()=>V,Collapse:()=>U,Combobox:()=>J,CommandPalette:()=>et,DataTable:()=>tt,Datepicker:()=>Z,Dropdown:()=>A,FileDrop:()=>B,FileUploadAdvanced:()=>rt,FormValidation:()=>lt,Modal:()=>O,Navbar:()=>at,NestedMenu:()=>X,NotificationCenter:()=>Q,Offcanvas:()=>H,Pagination:()=>dt,Popover:()=>K,RangeSlider:()=>it,Scrollspy:()=>ot,Select:()=>z,Spinner:()=>ht,Stepper:()=>G,Tabs:()=>Y,Tag:()=>R,Theme:()=>bt,Toast:()=>T,Tooltip:()=>D,TreeView:()=>st,confirm:()=>fe,core:()=>ut,createFocusTrap:()=>C,getFocusableElements:()=>M,onEscapeKey:()=>f});var ut={};ae(ut,{applyPosition:()=>_,autoInit:()=>d,collapse:()=>I,computePosition:()=>v,createFocusTrap:()=>C,createInstanceRegistry:()=>h,expand:()=>S,getFocusableElements:()=>M,lockScroll:()=>x,onClickOutside:()=>b,onEscapeKey:()=>f,onTransitionEnd:()=>$e,registerOverlay:()=>N,unlockScroll:()=>L,unregisterOverlay:()=>$,watchPosition:()=>k});var Fe={top:"bottom",bottom:"top",left:"right",right:"left"};function qe(r,t,e,s,i,n){switch(r){case"top":return t.top-e.height-s>=0;case"bottom":return t.bottom+e.height+s<=n;case"left":return t.left-e.width-s>=0;case"right":return t.right+e.width+s<=i;default:return!0}}function oe(r,t,e,s){switch(r){case"start":return t;case"end":return t+e-s;default:return t+(e-s)/2}}function v(r,t,e={}){var re;let{placement:s="bottom",align:i="center",offset:n=8,padding:a=8,fallbackPlacements:o}=e,l=r.getBoundingClientRect(),c=t.getBoundingClientRect(),p=document.documentElement.clientWidth,u=document.documentElement.clientHeight,m=(re=[...new Set(o!=null?o:[s,Fe[s],"bottom","top","right","left"])].filter(Boolean).slice(0,2).find(Se=>qe(Se,l,c,n,p,u)))!=null?re:s,y,w;m==="top"||m==="bottom"?(y=m==="top"?l.top-c.height-n:l.bottom+n,w=oe(i,l.left,l.width,c.width)):(w=m==="left"?l.left-c.width-n:l.right+n,y=oe(i,l.top,l.height,c.height));let Et=Math.max(a,p-c.width-a),P=Math.max(a,u-c.height-a);w=Math.min(Math.max(w,a),Et),y=Math.min(Math.max(y,a),P);let Ae=m==="top"||m==="bottom"?c.width:c.height,xe=m==="top"||m==="bottom"?w:y,Le=m==="top"||m==="bottom"?l.left+l.width/2:l.top+l.height/2,Ie=Math.min(Math.max(Le-xe,8),Math.max(8,Ae-8));return{top:y+window.scrollY,left:w+window.scrollX,placement:m,arrowOffset:`${Ie}px`}}function k(r,t,e={}){let s=()=>_(t,v(r,t,e)),i=null,n=()=>{i===null&&(i=requestAnimationFrame(()=>{i=null,s()}))};window.addEventListener("resize",n,{passive:!0}),window.addEventListener("scroll",n,{passive:!0,capture:!0});let a=typeof ResizeObserver=="function"?new ResizeObserver(n):null;return a==null||a.observe(r),a==null||a.observe(t),()=>{window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0),i!==null&&cancelAnimationFrame(i),a==null||a.disconnect()}}function _(r,t){r.style.position="absolute",r.style.top=`${t.top}px`,r.style.left=`${t.left}px`,t.arrowOffset&&(r.style.setProperty("--fs-popover-arrow-offset",t.arrowOffset),r.style.setProperty("--fs-tooltip-arrow-offset",t.arrowOffset))}var q=0,_t=!1,le="",he="",ct=[];function N(r){ct.includes(r)||ct.push(r)}function $(r){let t=ct.lastIndexOf(r);t>=0&&ct.splice(t,1)}function x(){if(q+=1,q>1)return;let r=window.innerWidth-document.documentElement.clientWidth;le=document.body.style.overflow,he=document.body.style.paddingRight,document.body.style.overflow="hidden",r>0&&(document.body.style.paddingRight=`${r}px`,_t=!0)}function L(){q=Math.max(0,q-1),!(q>0)&&(document.body.style.overflow=le,_t&&(document.body.style.paddingRight=he,_t=!1))}function b(r,t){let e=s=>{r.contains(s.target)||t(s)};return document.addEventListener("click",e,!0),()=>{document.removeEventListener("click",e,!0)}}var Ne='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function M(r){return Array.from(r.querySelectorAll(Ne)).filter(t=>t.offsetParent!==null)}function C(r){let t=[],e=i=>{r.parentElement&&[...r.parentElement.children].filter(n=>n!==r).forEach(n=>{if(i)t.push({el:n,value:n.inert,ariaHidden:n.getAttribute("aria-hidden")}),n.inert=!0,n.setAttribute("aria-hidden","true");else{let a=t.find(o=>o.el===n);a&&(n.inert=a.value,a.ariaHidden===null?n.removeAttribute("aria-hidden"):n.setAttribute("aria-hidden",a.ariaHidden))}})};function s(i){if(i.key!=="Tab")return;let n=M(r);if(n.length===0){i.preventDefault();return}let a=n[0],o=n[n.length-1];i.shiftKey&&document.activeElement===a?(i.preventDefault(),o.focus()):!i.shiftKey&&document.activeElement===o&&(i.preventDefault(),a.focus())}return r.addEventListener("keydown",s),{activate(){e(!0);let i=M(r);i.length>0&&i[0].focus()},deactivate(){r.removeEventListener("keydown",s),e(!1),t.length=0}}}function f(r){let t=e=>{e.key==="Escape"&&r(e)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)}function de(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ce(r){return new Promise(t=>{let e=!1,s=()=>{e||(e=!0,clearTimeout(n),r.removeEventListener("transitionend",i),t())},i=a=>{a.target!==r||a.propertyName!=="height"||s()};r.addEventListener("transitionend",i);let n=window.setTimeout(s,450)})}function I(r,t={}){var i;if(de())return r.style.display="none",Promise.resolve();let e=(i=t.duration)!=null?i:200;r.style.overflow="hidden",r.style.height=`${r.scrollHeight}px`,r.style.transition=`height ${e}ms ease`;let s=ce(r).then(()=>{r.style.display="none",r.style.removeProperty("height"),r.style.removeProperty("overflow"),r.style.removeProperty("transition")});return requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.height="0px"})}),s}function S(r,t={}){var n;if(r.style.display="",de())return Promise.resolve();let e=(n=t.duration)!=null?n:200,s=`${r.scrollHeight}px`;r.style.overflow="hidden",r.style.height="0px",r.style.transition=`height ${e}ms ease`;let i=ce(r).then(()=>{r.style.removeProperty("height"),r.style.removeProperty("overflow"),r.style.removeProperty("transition")});return requestAnimationFrame(()=>{requestAnimationFrame(()=>{r.style.height=s})}),i}function $e(r,t){return new Promise(e=>{let s=i=>{i.target===r&&(t&&i.propertyName!==t||(r.removeEventListener("transitionend",s),e()))};r.addEventListener("transitionend",s)})}function h(){let r=new WeakMap;return{get(t){return r.get(t)},set(t,e){r.set(t,e)},delete(t){r.delete(t)}}}function d(r,t,e={}){var n;if(typeof document=="undefined")return;let s=(n=e.selector)!=null?n:`[data-fs="${r}"]`,i=()=>{document.querySelectorAll(s).forEach(a=>{t.getInstance(a)||new t(a)})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i):i()}var yt=h(),A=class r{constructor(t,e={}){var n,a,o,l;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):t.nextElementSibling;if(!i)throw new Error("FokusStyles.Dropdown: elemento do menu n\xE3o encontrado (data-fs-target).");this.toggleEl=t,this.menuEl=i,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.align=(l=(o=e.align)!=null?o:t.getAttribute("data-align"))!=null?l:"start",this.isOpen=!1,this._outsideClickCleanup=null,this._positionCleanup=null,this._originalParent=this.menuEl.parentNode,this._originalNextSibling=this.menuEl.nextSibling,document.body.appendChild(this.menuEl),this.toggleEl.setAttribute("aria-haspopup","menu"),this.toggleEl.setAttribute("aria-expanded","false"),this.toggleEl.setAttribute("aria-controls",this.menuEl.id||`fs-dropdown-${Math.random().toString(36).slice(2)}`),this.menuEl.id||(this.menuEl.id=this.toggleEl.getAttribute("aria-controls")),this.menuEl.setAttribute("role","menu"),this.menuEl.querySelectorAll(".fs-dropdown-item").forEach(c=>{c.hasAttribute("role")||c.setAttribute("role","menuitem")}),this._handleToggleClick=this._handleToggleClick.bind(this),this._handleMenuKeydown=this._handleMenuKeydown.bind(this),this._handleMenuClick=this._handleMenuClick.bind(this),this.toggleEl.addEventListener("click",this._handleToggleClick),this.menuEl.addEventListener("keydown",this._handleMenuKeydown),this.menuEl.addEventListener("click",this._handleMenuClick),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.toggleEl.focus())}),yt.set(t,this)}static getInstance(t){return yt.get(t)}static getOrCreateInstance(t,e={}){var s;return(s=this.getInstance(t))!=null?s:new r(t,e)}static show(t,e={}){return this.getOrCreateInstance(t,e).show()}static hide(t){var e;return(e=this.getInstance(t))==null?void 0:e.hide()}static toggle(t,e={}){return this.getOrCreateInstance(t,e).toggle()}_handleToggleClick(t){t.preventDefault(),this.toggle()}_handleMenuClick(t){t.target.closest(".fs-dropdown-item")&&(this.hide(),this.toggleEl.focus())}_handleMenuKeydown(t){var i,n,a,o;let e=Array.from(this.menuEl.querySelectorAll(".fs-dropdown-item:not(.is-disabled)")),s=e.indexOf(document.activeElement);t.key==="ArrowDown"?(t.preventDefault(),(i=e[(s+1)%e.length])==null||i.focus()):t.key==="ArrowUp"?(t.preventDefault(),(n=e[(s-1+e.length)%e.length])==null||n.focus()):t.key==="Home"?(t.preventDefault(),(a=e[0])==null||a.focus()):t.key==="End"?(t.preventDefault(),(o=e[e.length-1])==null||o.focus()):t.key==="Escape"&&(t.preventDefault(),this.hide(),this.toggleEl.focus())}show(){var i;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.toggleEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.menuEl.setAttribute("data-theme",t):this.menuEl.removeAttribute("data-theme"),this.menuEl.classList.add("is-open");let e=v(this.toggleEl,this.menuEl,{placement:this.placement,align:this.align,offset:4});_(this.menuEl,e),this._positionCleanup=k(this.toggleEl,this.menuEl,{placement:this.placement,align:this.align,offset:4}),this.toggleEl.setAttribute("aria-expanded","true");let s=this.menuEl.querySelector(".fs-dropdown-item:not(.is-disabled)");s==null||s.focus(),this._outsideClickCleanup=b(this.menuEl,n=>{this.toggleEl.contains(n.target)||this.hide()}),this.toggleEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.toggleEl.dispatchEvent(new CustomEvent("fs:dropdown:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.menuEl.classList.remove("is-open"),this.menuEl.style.removeProperty("position"),this.menuEl.style.removeProperty("top"),this.menuEl.style.removeProperty("left"),this.toggleEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,(e=this._positionCleanup)==null||e.call(this),this._positionCleanup=null,this.toggleEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.toggleEl.dispatchEvent(new CustomEvent("fs:dropdown:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.toggleEl.removeEventListener("click",this._handleToggleClick),this.menuEl.removeEventListener("keydown",this._handleMenuKeydown),this.menuEl.removeEventListener("click",this._handleMenuClick),this._originalParent&&this._originalParent.insertBefore(this.menuEl,this._originalNextSibling),yt.delete(this.toggleEl)}};d("dropdown",A);var wt=h(),ue=0,F=null,Ke=8;function Ct(r,t=0){if(r==null||r==="")return t;let e=Number(r);return Number.isFinite(e)&&e>=0?e:t}function Re(r="top"){let[t,e="center"]=r.split("-");return{placement:t,align:["start","center","end"].includes(e)?e:"center"}}var D=class{constructor(t,e={}){var n,a,o,l,c,p,u,E,g;let s=(a=(n=t.getAttribute("title"))!=null?n:t.getAttribute("data-title"))!=null?a:e.title;if(!s)throw new Error("FokusStyles.Tooltip: elemento sem texto (atributo title/data-title).");t.removeAttribute("title"),ue+=1,this.referenceEl=t,this.title=s;let i=Re((l=(o=e.placement)!=null?o:t.getAttribute("data-placement"))!=null?l:"top");this.placement=i.placement,this.align=(p=(c=e.align)!=null?c:t.getAttribute("data-align"))!=null?p:i.align,this.offset=Ct((u=e.offset)!=null?u:t.getAttribute("data-offset"),Ke),this.showDelay=Ct((E=e.showDelay)!=null?E:t.getAttribute("data-show-delay"),0),this.hideDelay=Ct((g=e.hideDelay)!=null?g:t.getAttribute("data-hide-delay")),this.isOpen=!1,this.id=`fokus-tooltip-${ue}`,this._positionCleanup=null,this._showTimer=null,this._hideTimer=null,this._touchOpened=!1,this._originalDescribedBy=t.getAttribute("aria-describedby"),this.tooltipEl=document.createElement("div"),this.tooltipEl.className="fs-tooltip",this.tooltipEl.id=this.id,this.tooltipEl.setAttribute("role","tooltip"),this.tooltipEl.innerHTML='<div class="fs-tooltip-arrow"></div><div class="fs-tooltip-inner"></div>',this.tooltipEl.querySelector(".fs-tooltip-inner").textContent=this.title,document.body.appendChild(this.tooltipEl),this._addDescribedBy(),this._handleShow=()=>this._scheduleShow(!0),this._handleHide=()=>this._scheduleHide(),this._handlePointerEnter=()=>this._scheduleShow(),this._handlePointerLeave=()=>this._scheduleHide(),this._handlePointerDown=m=>{if(m.pointerType==="touch"){if(this._touchOpened&&this.isOpen){this.hideImmediate();return}this._touchOpened=!0,this._scheduleShow(!0)}},t.addEventListener("pointerenter",this._handlePointerEnter),t.addEventListener("pointerleave",this._handlePointerLeave),t.addEventListener("pointerdown",this._handlePointerDown),t.addEventListener("mouseenter",this._handlePointerEnter),t.addEventListener("mouseleave",this._handlePointerLeave),t.addEventListener("focus",this._handleShow),t.addEventListener("blur",this._handleHide),this._handleDocumentPointerDown=m=>{this._touchOpened&&!this.referenceEl.contains(m.target)&&!this.tooltipEl.contains(m.target)&&this.hide()},document.addEventListener("pointerdown",this._handleDocumentPointerDown,!0),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),wt.set(t,this)}static getInstance(t){return wt.get(t)}_clearTimers(){clearTimeout(this._showTimer),clearTimeout(this._hideTimer),this._showTimer=null,this._hideTimer=null}_addDescribedBy(){var e;let t=new Set(((e=this.referenceEl.getAttribute("aria-describedby"))!=null?e:"").split(/\s+/).filter(Boolean));t.add(this.id),this.referenceEl.setAttribute("aria-describedby",[...t].join(" "))}_scheduleShow(t=!1){if(this._clearTimers(),this.isOpen)return;let e=t?0:this.showDelay;if(e===0){this.show();return}this._showTimer=setTimeout(()=>this.show(),e)}_scheduleHide(t=!1){if(this._clearTimers(),!this.isOpen)return;let e=t?0:this.hideDelay;if(e===0){this.hide();return}this._hideTimer=setTimeout(()=>this.hide(),e)}show(){var s;if(this._clearTimers(),this.isOpen)return;F&&F!==this&&F.hide(!0),F=this,this.isOpen=!0;let t=(s=this.referenceEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.tooltipEl.setAttribute("data-theme",t):this.tooltipEl.removeAttribute("data-theme"),this.tooltipEl.classList.add("is-open");let e=v(this.referenceEl,this.tooltipEl,{placement:this.placement,align:this.align,offset:this.offset});_(this.tooltipEl,e),this._positionCleanup=k(this.referenceEl,this.tooltipEl,{placement:this.placement,align:this.align,offset:this.offset}),this.tooltipEl.setAttribute("data-placement",e.placement),this.tooltipEl.setAttribute("data-align",this.align),this.referenceEl.dispatchEvent(new CustomEvent("fs:tooltip:shown",{bubbles:!0}))}hide(){this.hideImmediate()}hideImmediate(){var t;this._clearTimers(),this.isOpen&&(this.isOpen=!1,this._touchOpened=!1,this.tooltipEl.classList.remove("is-open"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.referenceEl.dispatchEvent(new CustomEvent("fs:tooltip:hidden",{bubbles:!0})),F===this&&(F=null))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hideImmediate(),this._clearTimers(),this.referenceEl.removeEventListener("pointerenter",this._handlePointerEnter),this.referenceEl.removeEventListener("pointerleave",this._handlePointerLeave),this.referenceEl.removeEventListener("pointerdown",this._handlePointerDown),this.referenceEl.removeEventListener("mouseenter",this._handlePointerEnter),this.referenceEl.removeEventListener("mouseleave",this._handlePointerLeave),this.referenceEl.removeEventListener("focus",this._handleShow),this.referenceEl.removeEventListener("blur",this._handleHide),document.removeEventListener("pointerdown",this._handleDocumentPointerDown,!0),this._removeEscapeListener(),this._originalDescribedBy===null?this.referenceEl.removeAttribute("aria-describedby"):this.referenceEl.setAttribute("aria-describedby",this._originalDescribedBy),this.tooltipEl.remove(),wt.delete(this.referenceEl)}};d("tooltip",D);var kt=h(),pt=0,Be=100,At=new Set,K=class{constructor(t,e={}){var o,l,c,p,u,E;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):null;if(!i)throw new Error("FokusStyles.Popover: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.popoverEl=i,this.placement=(l=(o=e.placement)!=null?o:t.getAttribute("data-placement"))!=null?l:"top",this.align=(p=(c=e.align)!=null?c:t.getAttribute("data-align"))!=null?p:"center",this.trigger=(E=(u=e.trigger)!=null?u:t.getAttribute("data-trigger"))!=null?E:"click",this.isOpen=!1,this._outsideClickCleanup=null,this._removeEscapeListener=null,this._hideTimer=null,this._suppressNextFocus=!1,this._positionCleanup=null,this._originalParent=i.parentNode,this._originalNextSibling=i.nextSibling,document.body.appendChild(i),i.setAttribute("role","dialog"),i.setAttribute("aria-modal","false"),pt+=1,i.id||(i.id=`fokus-popover-${pt}`);let n=i.querySelector(".fs-popover-header");n&&(n.id||(n.id=`fokus-popover-header-${pt}`),i.setAttribute("aria-labelledby",n.id));let a=i.querySelector(".fs-popover-text");a&&(a.id||(a.id=`fokus-popover-text-${pt}`),i.setAttribute("aria-describedby",a.id)),t.setAttribute("aria-controls",i.id),t.setAttribute("aria-expanded","false"),this._handleDismissClick=this._handleDismissClick.bind(this),i.addEventListener("click",this._handleDismissClick),this._bindTrigger(),kt.set(t,this)}static getInstance(t){return kt.get(t)}_bindTrigger(){this.trigger!=="manual"&&(this.trigger==="click"?(this._handleTriggerClick=t=>{t.preventDefault(),this.toggle()},this.triggerEl.addEventListener("click",this._handleTriggerClick)):this.trigger==="hover"?(this._handleMouseEnter=()=>{clearTimeout(this._hideTimer),this.show()},this._handleMouseLeave=()=>{this._hideTimer=setTimeout(()=>this.hide(),Be)},this.triggerEl.addEventListener("mouseenter",this._handleMouseEnter),this.triggerEl.addEventListener("mouseleave",this._handleMouseLeave),this.popoverEl.addEventListener("mouseenter",this._handleMouseEnter),this.popoverEl.addEventListener("mouseleave",this._handleMouseLeave)):this.trigger==="focus"&&(this._handleTriggerFocus=()=>{if(this._suppressNextFocus){this._suppressNextFocus=!1;return}this.show()},this._handleTriggerFocusOut=t=>{this.popoverEl.contains(t.relatedTarget)||this.hide()},this._handlePopoverFocusOut=t=>{this.triggerEl.contains(t.relatedTarget)||this.popoverEl.contains(t.relatedTarget)||this.hide()},this.triggerEl.addEventListener("focus",this._handleTriggerFocus),this.triggerEl.addEventListener("focusout",this._handleTriggerFocusOut),this.popoverEl.addEventListener("focusout",this._handlePopoverFocusOut)),this.trigger!=="manual"&&(this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.triggerEl.focus())})))}_handleDismissClick(t){if(t.target.closest('[data-fs-dismiss="popover"]')){let e=this.popoverEl.contains(document.activeElement);e&&this.trigger==="focus"&&(this._suppressNextFocus=!0),this.hide(),e&&typeof this.triggerEl.focus=="function"&&this.triggerEl.focus()}}show(){var s;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.triggerEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.popoverEl.setAttribute("data-theme",t):this.popoverEl.removeAttribute("data-theme"),this.popoverEl.classList.add("is-open"),At.forEach(i=>{i!==this&&i.hide()});let e=v(this.triggerEl,this.popoverEl,{placement:this.placement,align:this.align,offset:10});_(this.popoverEl,e),this._positionCleanup=k(this.triggerEl,this.popoverEl,{placement:this.placement,align:this.align,offset:10}),this.popoverEl.setAttribute("data-placement",e.placement),At.add(this),this.triggerEl.setAttribute("aria-expanded","true"),this.trigger==="click"&&(this._outsideClickCleanup=b(this.popoverEl,i=>{this.triggerEl.contains(i.target)||this.hide()})),this.triggerEl.dispatchEvent(new CustomEvent("fs:popover:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,At.delete(this),this.popoverEl.classList.remove("is-open"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.triggerEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.dispatchEvent(new CustomEvent("fs:popover:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){var t;this.hide(),clearTimeout(this._hideTimer),(t=this._removeEscapeListener)==null||t.call(this),this.popoverEl.removeEventListener("click",this._handleDismissClick),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.triggerEl.removeEventListener("mouseenter",this._handleMouseEnter),this.triggerEl.removeEventListener("mouseleave",this._handleMouseLeave),this.popoverEl.removeEventListener("mouseenter",this._handleMouseEnter),this.popoverEl.removeEventListener("mouseleave",this._handleMouseLeave),this.triggerEl.removeEventListener("focus",this._handleTriggerFocus),this.triggerEl.removeEventListener("focusout",this._handleTriggerFocusOut),this.popoverEl.removeEventListener("focusout",this._handlePopoverFocusOut),this._originalParent&&this._originalParent.insertBefore(this.popoverEl,this._originalNextSibling),kt.delete(this.triggerEl)}};d("popover",K);var xt=h(),O=class r{constructor(t,e={}){var a,o;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):null;if(!i)throw new Error("FokusStyles.Modal: elemento do modal n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.modalEl=i,this.dialogEl=(a=i.querySelector(".fs-modal-dialog"))!=null?a:i,this.staticBackdrop=((o=e.backdrop)!=null?o:i.getAttribute("data-backdrop"))==="static",this.isOpen=!1,this._focusTrap=null,this._outsideClickCleanup=null,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-hidden","true");let n=i.querySelector(".fs-modal-title");n&&(n.id||(n.id=`fs-modal-title-${Math.random().toString(36).slice(2)}`),i.setAttribute("aria-labelledby",n.id)),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleDismissClick=this._handleDismissClick.bind(this),t.addEventListener("click",this._handleTriggerClick),i.addEventListener("click",this._handleDismissClick),this._removeEscapeListener=f(()=>{this.isOpen&&!this.staticBackdrop&&this.hide()}),xt.set(t,this)}static getInstance(t){return xt.get(t)}static getOrCreateInstance(t,e={}){var s;return(s=this.getInstance(t))!=null?s:new r(t,e)}static show(t,e={}){return this.getOrCreateInstance(t,e).show()}static hide(t){var e;return(e=this.getInstance(t))==null?void 0:e.hide()}static toggle(t,e={}){return this.getOrCreateInstance(t,e).toggle()}_handleTriggerClick(t){t.preventDefault(),this.show()}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="modal"]')&&this.hide()}show(){this.isOpen||(this.triggerEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,N(this),this.modalEl.classList.add("is-open"),this.modalEl.setAttribute("aria-hidden","false"),x(),this._focusTrap=C(this.dialogEl),this._focusTrap.activate(),this.staticBackdrop||(this._outsideClickCleanup=b(this.dialogEl,()=>this.hide())),this.triggerEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:modal:shown",{bubbles:!0})))}hide(){var t,e;this.isOpen&&(this.triggerEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,$(this),this.modalEl.classList.remove("is-open"),this.modalEl.setAttribute("aria-hidden","true"),L(),(t=this._focusTrap)==null||t.deactivate(),this._focusTrap=null,(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:modal:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.modalEl.removeEventListener("click",this._handleDismissClick),xt.delete(this.triggerEl)}};d("modal",O,{selector:'[data-fs="modal"], [data-fs-toggle="modal"]'});var pe=0;function ft(r){let t=document.createElement("div");return t.textContent=r,t.innerHTML}function fe(r={}){let{title:t="Tem certeza?",message:e="",confirmText:s="Confirmar",cancelText:i="Cancelar",variant:n="danger"}=r;return new Promise(a=>{pe+=1;let o=`fokus-confirm-${pe}`,l=document.activeElement instanceof HTMLElement?document.activeElement:document.body,c=document.createElement("div");c.className="fs-modal fs-alert-dialog",c.id=o,c.innerHTML=`
|
|
2
2
|
<div class="fs-modal-dialog fs-modal-sm">
|
|
3
3
|
<div class="fs-modal-content">
|
|
4
4
|
<div class="fs-modal-body">
|
|
5
|
-
<h3 class="fs-modal-title">${
|
|
6
|
-
${e?`<p class="fs-alert-dialog-message">${
|
|
5
|
+
<h3 class="fs-modal-title">${ft(t)}</h3>
|
|
6
|
+
${e?`<p class="fs-alert-dialog-message">${ft(e)}</p>`:""}
|
|
7
7
|
</div>
|
|
8
8
|
<div class="fs-modal-footer">
|
|
9
|
-
<button type="button" class="fs-btn" data-action="cancel">${
|
|
10
|
-
<button type="button" class="fs-btn fs-btn-${n}" data-action="confirm">${
|
|
9
|
+
<button type="button" class="fs-btn" data-action="cancel">${ft(i)}</button>
|
|
10
|
+
<button type="button" class="fs-btn fs-btn-${n}" data-action="confirm">${ft(s)}</button>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
|
-
`,document.body.appendChild(c);let p=document.createElement("button");p.type="button",p.setAttribute("data-fs-target",`#${o}`),p.style.display="none",document.body.appendChild(p);let u=new D(p),b=!1,m=C=>{var _;b||(b=!0,u.dispose(),c.remove(),p.remove(),(_=l.focus)==null||_.call(l),a(C))};c.addEventListener("click",C=>{var lt;let _=(lt=C.target.closest("[data-action]"))==null?void 0:lt.dataset.action;_==="confirm"?m(!0):_==="cancel"&&m(!1)}),p.addEventListener("fs:modal:hidden",()=>m(!1)),u.show()})}var kt=h(),N=class{constructor(t){this.tagEl=t,this._isLoading=t.classList.contains("is-loading")||t.getAttribute("aria-busy")==="true",this._handleClick=this._handleClick.bind(this),t.addEventListener("click",this._handleClick),this.setLoading(this._isLoading),kt.set(t,this)}static getInstance(t){return kt.get(t)}_handleClick(t){!this._isLoading&&t.target.closest('[data-fs-dismiss="tag"]')&&this.dismiss()}dismiss(){if(this._isLoading)return!1;let t=new CustomEvent("fs:tag:dismissed",{bubbles:!0,cancelable:!0});return this.tagEl.dispatchEvent(t),t.defaultPrevented?!1:(this.tagEl.remove(),!0)}setLoading(t){this._isLoading=!!t,this.tagEl.classList.toggle("is-loading",this._isLoading),this._isLoading?this.tagEl.setAttribute("aria-busy","true"):this.tagEl.removeAttribute("aria-busy");let e=this.tagEl.querySelector('[data-fs-dismiss="tag"]');return e&&(e.disabled=this._isLoading),this}dispose(){this.tagEl.removeEventListener("click",this._handleClick),kt.delete(this.tagEl)}};d("tag",N);var Ct=h(),$=class{constructor(t){let e=document.getElementById(t.getAttribute("for"));if(!e)throw new Error("FokusStyles.FileDrop: input associado (via for=) n\xE3o encontrado.");this.labelEl=t,this.inputEl=e,this._dragDepth=0,this._handleDragEnter=this._handleDragEnter.bind(this),this._handleDragOver=this._handleDragOver.bind(this),this._handleDragLeave=this._handleDragLeave.bind(this),this._handleDrop=this._handleDrop.bind(this),t.addEventListener("dragenter",this._handleDragEnter),t.addEventListener("dragover",this._handleDragOver),t.addEventListener("dragleave",this._handleDragLeave),t.addEventListener("drop",this._handleDrop),Ct.set(t,this)}static getInstance(t){return Ct.get(t)}_handleDragEnter(t){t.preventDefault(),this._dragDepth+=1,this.labelEl.classList.add("is-dragover")}_handleDragOver(t){t.preventDefault()}_handleDragLeave(t){t.preventDefault(),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth===0&&this.labelEl.classList.remove("is-dragover")}_handleDrop(t){var i;if(t.preventDefault(),this._dragDepth=0,this.labelEl.classList.remove("is-dragover"),this.inputEl.disabled)return;let e=(i=t.dataTransfer)==null?void 0:i.files;!e||e.length===0||(this.inputEl.files=e,this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})))}dispose(){this.labelEl.removeEventListener("dragenter",this._handleDragEnter),this.labelEl.removeEventListener("dragover",this._handleDragOver),this.labelEl.removeEventListener("dragleave",this._handleDragLeave),this.labelEl.removeEventListener("drop",this._handleDrop),Ct.delete(this.labelEl)}};d("file-drop",$);var xt=h(),K=class r{constructor(t,e={}){var a,o;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):null;if(!s)throw new Error("FokusStyles.Offcanvas: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.offcanvasEl=s,this.hasBackdrop=((a=e.backdrop)!=null?a:s.getAttribute("data-backdrop"))!=="false",this.staticBackdrop=((o=e.backdrop)!=null?o:s.getAttribute("data-backdrop"))==="static",this.isOpen=!1,this._focusTrap=null,this._outsideClickCleanup=null,this._backdropEl=null,s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-hidden","true");let n=s.querySelector(".fs-offcanvas-title");n&&(n.id||(n.id=`fs-offcanvas-title-${Math.random().toString(36).slice(2)}`),s.setAttribute("aria-labelledby",n.id)),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleDismissClick=this._handleDismissClick.bind(this),t.addEventListener("click",this._handleTriggerClick),s.addEventListener("click",this._handleDismissClick),this._removeEscapeListener=f(()=>{this.isOpen&&!this.staticBackdrop&&this.hide()}),xt.set(t,this)}static getInstance(t){return xt.get(t)}static getOrCreateInstance(t,e={}){var i;return(i=this.getInstance(t))!=null?i:new r(t,e)}static show(t,e={}){return this.getOrCreateInstance(t,e).show()}static hide(t){var e;return(e=this.getInstance(t))==null?void 0:e.hide()}static toggle(t,e={}){return this.getOrCreateInstance(t,e).toggle()}_handleTriggerClick(t){t.preventDefault(),this.show()}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="offcanvas"]')&&this.hide()}show(){this.isOpen||(this.triggerEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,P(this),this.hasBackdrop&&(this._backdropEl=document.createElement("div"),this._backdropEl.className="fs-offcanvas-backdrop",document.body.appendChild(this._backdropEl),this._backdropEl.offsetHeight,this._backdropEl.classList.add("is-open")),this.offcanvasEl.classList.add("is-open"),this.offcanvasEl.setAttribute("aria-hidden","false"),x(),this._focusTrap=y(this.offcanvasEl),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isOpen&&this._focusTrap.activate()})}),this.staticBackdrop||(this._outsideClickCleanup=g(this.offcanvasEl,t=>{this.triggerEl.contains(t.target)||this.hide()})),this.triggerEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:offcanvas:shown",{bubbles:!0})))}hide(){var t,e,i;this.isOpen&&(this.triggerEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,q(this),this.offcanvasEl.classList.remove("is-open"),this.offcanvasEl.setAttribute("aria-hidden","true"),A(),(t=this._backdropEl)==null||t.remove(),this._backdropEl=null,(e=this._focusTrap)==null||e.deactivate(),this._focusTrap=null,(i=this._outsideClickCleanup)==null||i.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:offcanvas:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.offcanvasEl.removeEventListener("click",this._handleDismissClick),xt.delete(this.triggerEl)}};d("offcanvas",K,{selector:'[data-fs="offcanvas"], [data-fs-toggle="offcanvas"]'});var At=h(),R=class{constructor(t){if(t.tagName!=="SELECT")throw new Error("FokusStyles.Select: elemento precisa ser um <select> nativo.");this.selectEl=t,this.size=t.getAttribute("data-size"),this._originalDisplay=t.style.display,this._buildMarkup(),this._syncFromNativeSelect(),this.dropdown=new k(this.toggleEl),this.toggleEl.setAttribute("aria-haspopup","listbox"),this.menuEl.setAttribute("role","listbox"),this.toggleEl.addEventListener("fs:dropdown:shown",()=>{this.menuEl.style.width=`${this.toggleEl.offsetWidth}px`}),this._handleItemClick=this._handleItemClick.bind(this),this._handleNativeChange=this._handleNativeChange.bind(this),this.menuEl.addEventListener("click",this._handleItemClick),this.selectEl.addEventListener("change",this._handleNativeChange),At.set(t,this)}static getInstance(t){return At.get(t)}_buildMarkup(){let t=document.createElement("div");t.className="fs-dropdown fs-form-select-dropdown";let e=document.createElement("button");e.type="button",e.className="fs-form-select",(this.size==="sm"||this.size==="lg")&&e.classList.add(`fs-form-select-${this.size}`),e.disabled=this.selectEl.disabled;let i=document.createElement("div");i.className="fs-dropdown-menu",Array.from(this.selectEl.options).forEach(s=>{let n=document.createElement("button");n.type="button",n.className="fs-dropdown-item",n.setAttribute("role","option"),n.textContent=s.textContent,s.disabled&&n.classList.add("is-disabled"),i.appendChild(n)}),this.selectEl.insertAdjacentElement("afterend",t),t.appendChild(e),t.appendChild(i),this.selectEl.style.display="none",this.wrapperEl=t,this.toggleEl=e,this.menuEl=i}_syncFromNativeSelect(){let t=this.selectEl.options[this.selectEl.selectedIndex];this.toggleEl.textContent=t?t.textContent:"",Array.from(this.menuEl.children).forEach((e,i)=>{let s=i===this.selectEl.selectedIndex;e.classList.toggle("is-active",s),e.setAttribute("aria-selected",String(s))})}_handleItemClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");if(!e)return;let i=Array.from(this.menuEl.children).indexOf(e);this.selectEl.selectedIndex=i,this._syncFromNativeSelect(),this.selectEl.dispatchEvent(new Event("change",{bubbles:!0})),this.selectEl.dispatchEvent(new CustomEvent("fs:select:changed",{bubbles:!0,detail:{value:this.selectEl.value}}))}_handleNativeChange(){this._syncFromNativeSelect()}show(){this.dropdown.show()}hide(){this.dropdown.hide()}toggle(){this.dropdown.toggle()}dispose(){this.dropdown.dispose(),this.menuEl.removeEventListener("click",this._handleItemClick),this.selectEl.removeEventListener("change",this._handleNativeChange),this.wrapperEl.remove(),this.selectEl.style.display=this._originalDisplay,At.delete(this.selectEl)}};d("select",R);var Lt=h(),It=0,B=class{constructor(t){this.accordionEl=t,this.exclusive=t.getAttribute("data-multiple")!=="true"&&t.getAttribute("data-fs-always-open")!=="true",this.alwaysOpen=t.getAttribute("data-fs-always-open")==="true",this.items=[],Array.from(t.querySelectorAll(".fs-accordion-button")).forEach(i=>{let s=i.closest(".fs-accordion-item").querySelector(".fs-accordion-collapse");It+=1,s.id||(s.id=`fokus-accordion-panel-${It}`),i.id||(i.id=`fokus-accordion-button-${It}`),i.setAttribute("aria-controls",s.id),s.setAttribute("role","region"),s.setAttribute("aria-labelledby",i.id);let n=i.getAttribute("aria-expanded")==="true";i.setAttribute("aria-expanded",String(n)),n||(s.style.display="none"),s.hidden=!n;let a={button:i,panel:s,handleClick:()=>this._toggle(a)};this.items.push(a),i.addEventListener("click",a.handleClick)}),Lt.set(t,this)}static getInstance(t){return Lt.get(t)}_toggle(t){if(t.button.getAttribute("aria-expanded")==="true"){if(this.alwaysOpen)return;this._close(t);return}this.exclusive&&this.items.filter(i=>i!==t&&i.button.getAttribute("aria-expanded")==="true").forEach(i=>this._close(i)),this._open(t)}_open(t){t.button.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),t.button.setAttribute("aria-expanded","true"),t.panel.hidden=!1,I(t.panel).then(()=>{t.button.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),t.button.dispatchEvent(new CustomEvent("fs:accordion:shown",{bubbles:!0}))})}_close(t){t.button.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),t.button.setAttribute("aria-expanded","false"),L(t.panel).then(()=>{t.panel.hidden=!0,t.button.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),t.button.dispatchEvent(new CustomEvent("fs:accordion:hidden",{bubbles:!0}))})}dispose(){this.items.forEach(t=>t.button.removeEventListener("click",t.handleClick)),Lt.delete(this.accordionEl)}};d("accordion",B);var St=h(),ue=0,H=class{constructor(t){let e=t.getAttribute("data-fs-target"),i=e?document.querySelector(e):null;if(!i)throw new Error("FokusStyles.Collapse: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.collapseEl=i,this.isOpen=t.getAttribute("aria-expanded")==="true",ue+=1,i.id||(i.id=`fokus-collapse-${ue}`),t.setAttribute("aria-controls",i.id),t.setAttribute("aria-expanded",String(this.isOpen)),this.isOpen||(i.style.display="none"),this._handleClick=()=>this.toggle(),t.addEventListener("click",this._handleClick),St.set(t,this)}static getInstance(t){return St.get(t)}show(){this.isOpen||(this.isOpen=!0,this.triggerEl.setAttribute("aria-expanded","true"),I(this.collapseEl).then(()=>{this.triggerEl.dispatchEvent(new CustomEvent("fs:collapse:shown",{bubbles:!0}))}))}hide(){this.isOpen&&(this.isOpen=!1,this.triggerEl.setAttribute("aria-expanded","false"),L(this.collapseEl).then(()=>{this.triggerEl.dispatchEvent(new CustomEvent("fs:collapse:hidden",{bubbles:!0}))}))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.triggerEl.removeEventListener("click",this._handleClick),St.delete(this.triggerEl)}};d("collapse",H);var Dt=h(),pe=0,z=class{constructor(t){this.tablistEl=t,this.tabs=Array.from(t.querySelectorAll(".fs-nav-link")),this.manualActivation=t.getAttribute("data-tabs-activation")==="manual",t.setAttribute("role","tablist"),this.tabs.forEach(e=>{let i=e.classList.contains("is-active");pe+=1,e.id||(e.id=`fokus-tab-${pe}`),e.setAttribute("role","tab"),e.setAttribute("aria-selected",String(i)),e.setAttribute("tabindex",i?"0":"-1");let s=e.getAttribute("data-fs-target"),n=s?document.querySelector(s):null;n&&(n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",e.id),n.setAttribute("tabindex","0"),n.hidden=!i)}),this._handleClick=this._handleClick.bind(this),this._handleKeydown=this._handleKeydown.bind(this),t.addEventListener("click",this._handleClick),t.addEventListener("keydown",this._handleKeydown),Dt.set(t,this)}static getInstance(t){return Dt.get(t)}_handleClick(t){let e=t.target.closest(".fs-nav-link:not(.is-disabled)");!e||!this.tabs.includes(e)||this.show(e)}_handleKeydown(t){let e=this.tabs.filter(a=>!a.classList.contains("is-disabled")),i=e.indexOf(document.activeElement);if(i===-1)return;let s=null;if(t.key==="ArrowRight"?s=(i+1)%e.length:t.key==="ArrowLeft"?s=(i-1+e.length)%e.length:t.key==="Home"?s=0:t.key==="End"&&(s=e.length-1),s===null)return;t.preventDefault();let n=e[s];n.focus(),this.manualActivation||this.show(n)}show(t){t.classList.contains("is-active")||(this.tabs.forEach(e=>{let i=e===t;e.classList.toggle("is-active",i),e.setAttribute("aria-selected",String(i)),e.setAttribute("tabindex",i?"0":"-1");let s=e.getAttribute("data-fs-target"),n=s?document.querySelector(s):null;n==null||n.classList.toggle("is-active",i),n&&(n.hidden=!i)}),t.dispatchEvent(new CustomEvent("fs:tab:changed",{bubbles:!0,detail:{target:t.getAttribute("data-fs-target")}})))}dispose(){this.tablistEl.removeEventListener("click",this._handleClick),this.tablistEl.removeEventListener("keydown",this._handleKeydown),Dt.delete(this.tablistEl)}};d("tabs",z);var Ot=h(),O=class{constructor(t){this.toastEl=t,this.delay=Number(t.getAttribute("data-delay"))||4e3,this.autohide=t.getAttribute("data-autohide")!=="false",this.isOpen=!1,this._hideTimer=null,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.style.display="none",this._handleDismissClick=this._handleDismissClick.bind(this),t.addEventListener("click",this._handleDismissClick),Ot.set(t,this)}static getInstance(t){return Ot.get(t)}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="toast"]')&&this.hide()}show(){this.isOpen||(this.toastEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,I(this.toastEl).then(()=>{this.toastEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.toastEl.dispatchEvent(new CustomEvent("fs:toast:shown",{bubbles:!0}))}),this.autohide&&(this._hideTimer=setTimeout(()=>this.hide(),this.delay)))}hide(){this.isOpen&&(this.toastEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,clearTimeout(this._hideTimer),this._hideTimer=null,L(this.toastEl).then(()=>{this.toastEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.toastEl.dispatchEvent(new CustomEvent("fs:toast:hidden",{bubbles:!0}))}))}toggle(){this.isOpen?this.hide():this.show()}dispose(){clearTimeout(this._hideTimer),this.toastEl.removeEventListener("click",this._handleDismissClick),Ot.delete(this.toastEl)}};d("toast",O);var Mt=h(),Oe="a, button, input, select, textarea, label, [contenteditable='true']",W=class{constructor(t){var e,i,s;this.carouselEl=t,this.inner=t.querySelector(".fs-carousel-inner"),this.items=Array.from(t.querySelectorAll(".fs-carousel-item")),this.indicators=Array.from(t.querySelectorAll(".fs-carousel-indicators button")),this.prevBtn=t.querySelector(".fs-carousel-control-prev"),this.nextBtn=t.querySelector(".fs-carousel-control-next"),this.toggleBtn=t.querySelector("[data-fs-carousel-toggle]"),this.counterEl=t.querySelector("[data-fs-carousel-counter]"),this.progressEl=t.querySelector("[data-fs-carousel-progress]"),this.interval=Number(t.getAttribute("data-interval"))||5e3,this.autoplay=t.getAttribute("data-autoplay")==="true",this.dragEnabled=t.getAttribute("data-drag")!=="false",this.timer=null,this.userPaused=!1,this.isHovering=!1,this.isFocusWithin=!1,this.drag=null,this.isStatic=this.items.length<2,this.index=Math.max(this.items.findIndex(n=>n.classList.contains("is-active")),0),t.setAttribute("role","group"),t.setAttribute("aria-roledescription","carousel"),t.classList.toggle("is-static",this.isStatic),t.classList.toggle("is-two-slides",this.items.length===2),!this.isStatic&&!t.hasAttribute("tabindex")&&(t.setAttribute("tabindex","0"),this.managesTabindex=!0),this._render(),this._handlePrev=()=>this.prev(),this._handleNext=()=>this.next(),this._handleToggle=()=>this.userPaused?this.play():this.pause(),this._handleIndicator=n=>{let a=this.indicators.indexOf(n.currentTarget);a!==-1&&this.goTo(a)},this._handleKeydown=this._handleKeydown.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerEnd=this._handlePointerEnd.bind(this),this._handleVisibilityChange=this._handleVisibilityChange.bind(this),this._handleMouseEnter=()=>{this.isHovering=!0,this._syncAutoplay()},this._handleMouseLeave=()=>{this.isHovering=!1,this._syncAutoplay()},this._handleFocusIn=()=>{this.isFocusWithin=!0,this._syncAutoplay()},this._handleFocusOut=()=>{queueMicrotask(()=>{this.isFocusWithin=t.contains(document.activeElement),this._syncAutoplay()})},(e=this.prevBtn)==null||e.addEventListener("click",this._handlePrev),(i=this.nextBtn)==null||i.addEventListener("click",this._handleNext),(s=this.toggleBtn)==null||s.addEventListener("click",this._handleToggle),this.indicators.forEach(n=>n.addEventListener("click",this._handleIndicator)),t.addEventListener("keydown",this._handleKeydown),t.addEventListener("pointerdown",this._handlePointerDown),t.addEventListener("pointermove",this._handlePointerMove),t.addEventListener("pointerup",this._handlePointerEnd),t.addEventListener("pointercancel",this._handlePointerEnd),t.addEventListener("mouseenter",this._handleMouseEnter),t.addEventListener("mouseleave",this._handleMouseLeave),t.addEventListener("focusin",this._handleFocusIn),t.addEventListener("focusout",this._handleFocusOut),document.addEventListener("visibilitychange",this._handleVisibilityChange),Mt.set(t,this),this._syncAutoplay()}static getInstance(t){return Mt.get(t)}_isDocumentVisible(){return document.visibilityState!=="hidden"}_isTemporarilyPaused(){return this.isHovering||this.isFocusWithin||!this._isDocumentVisible()||!!this.drag}_isAutoplayEnabled(){return this.autoplay&&!this.isStatic&&!this.userPaused&&!this._isTemporarilyPaused()}_syncAutoplay(){this.timer&&(clearInterval(this.timer),this.timer=null),this._isAutoplayEnabled()&&(this.timer=setInterval(()=>this.next(),this.interval)),this._syncAutoplayA11y()}_syncAutoplayA11y(){if(this.inner&&this.inner.setAttribute("aria-live",this.timer?"off":"polite"),this.carouselEl.classList.toggle("is-autoplay-paused",this.autoplay&&!this.isStatic&&!this.timer),this.progressEl&&(this.progressEl.style.setProperty("--fs-carousel-progress-duration",`${this.interval}ms`),this.progressEl.classList.remove("is-running"),this.timer&&(this.progressEl.offsetWidth,this.progressEl.classList.add("is-running"))),!this.toggleBtn)return;let t=this.autoplay&&!this.userPaused&&!this.isStatic;this.toggleBtn.disabled=!this.autoplay||this.isStatic,this.toggleBtn.setAttribute("aria-pressed",String(t)),this.toggleBtn.setAttribute("aria-label",t?"Pausar reprodu\xE7\xE3o autom\xE1tica":"Reproduzir reprodu\xE7\xE3o autom\xE1tica")}_render(){this.inner&&!this.carouselEl.classList.contains("fs-carousel-fade")&&(this.inner.style.transform=`translate3d(-${this.index*100}%, 0, 0)`),this.items.forEach((t,e)=>{t.classList.toggle("is-active",e===this.index),t.setAttribute("aria-hidden",String(e!==this.index)),t.toggleAttribute("inert",e!==this.index)}),this.indicators.forEach((t,e)=>{t.classList.toggle("is-active",e===this.index),t.setAttribute("aria-current",String(e===this.index))}),this.counterEl&&(this.counterEl.textContent=`${this.index+1} de ${this.items.length}`),this._syncAutoplayA11y()}_goToIndex(t){let e=this.items.length;if(e<2)return;let i=this.index,s=(t%e+e)%e;s!==i&&(this.index=s,this._render(),this.carouselEl.dispatchEvent(new CustomEvent("fs:carousel:slid",{bubbles:!0,detail:{from:i,to:s}})))}next(){this._goToIndex(this.index+1)}prev(){this._goToIndex(this.index-1)}goTo(t){this._goToIndex(t)}pause(){this.autoplay&&(this.userPaused=!0,this._syncAutoplay())}play(){!this.autoplay||this.isStatic||(this.userPaused=!1,this._syncAutoplay())}_handleKeydown(t){t.target===this.carouselEl&&(t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"?(t.preventDefault(),this.prev()):t.key==="Home"?(t.preventDefault(),this.goTo(0)):t.key==="End"&&(t.preventDefault(),this.goTo(this.items.length-1)))}_handlePointerDown(t){var e,i,s,n;if(!(!this.dragEnabled||this.isStatic||this.carouselEl.classList.contains("fs-carousel-fade"))&&!(t.isPrimary===!1||t.pointerType==="mouse"&&t.button!==0)&&!((i=(e=t.target).closest)!=null&&i.call(e,Oe))){this.drag={id:t.pointerId,startX:t.clientX,startY:t.clientY,deltaX:0,horizontal:!1};try{(n=(s=this.carouselEl).setPointerCapture)==null||n.call(s,t.pointerId)}catch(a){}this._syncAutoplay()}}_handlePointerMove(t){if(!this.drag||t.pointerId!==this.drag.id)return;let e=t.clientX-this.drag.startX,i=t.clientY-this.drag.startY;if(!this.drag.horizontal){if(Math.abs(i)>8&&Math.abs(i)>=Math.abs(e)){this._clearDrag();return}if(Math.abs(e)<=8||Math.abs(e)<Math.abs(i))return;this.drag.horizontal=!0,this.carouselEl.classList.add("is-dragging")}this.drag.deltaX=e,this.inner.style.transform=`translate3d(calc(-${this.index*100}% + ${e}px), 0, 0)`,t.preventDefault()}_handlePointerEnd(t){if(!this.drag||t.pointerId!==this.drag.id)return;let{deltaX:e,horizontal:i}=this.drag;if(this._clearDrag(),this._render(),t.type==="pointercancel"||!i)return;let s=this.carouselEl.getBoundingClientRect().width,n=Math.min(80,Math.max(40,s*.12));Math.abs(e)<n||(e<0?this.next():this.prev())}_clearDrag(){var t,e;if(this.drag){try{(e=(t=this.carouselEl).hasPointerCapture)!=null&&e.call(t,this.drag.id)&&this.carouselEl.releasePointerCapture(this.drag.id)}catch(i){}this.drag=null,this.carouselEl.classList.remove("is-dragging"),this._syncAutoplay()}}_handleVisibilityChange(){this._syncAutoplay()}dispose(){var t,e,i;this.userPaused=!0,this._clearDrag(),this._syncAutoplay(),(t=this.prevBtn)==null||t.removeEventListener("click",this._handlePrev),(e=this.nextBtn)==null||e.removeEventListener("click",this._handleNext),(i=this.toggleBtn)==null||i.removeEventListener("click",this._handleToggle),this.indicators.forEach(s=>s.removeEventListener("click",this._handleIndicator)),this.carouselEl.removeEventListener("keydown",this._handleKeydown),this.carouselEl.removeEventListener("pointerdown",this._handlePointerDown),this.carouselEl.removeEventListener("pointermove",this._handlePointerMove),this.carouselEl.removeEventListener("pointerup",this._handlePointerEnd),this.carouselEl.removeEventListener("pointercancel",this._handlePointerEnd),this.carouselEl.removeEventListener("mouseenter",this._handleMouseEnter),this.carouselEl.removeEventListener("mouseleave",this._handleMouseLeave),this.carouselEl.removeEventListener("focusin",this._handleFocusIn),this.carouselEl.removeEventListener("focusout",this._handleFocusOut),document.removeEventListener("visibilitychange",this._handleVisibilityChange),this.managesTabindex&&this.carouselEl.removeAttribute("tabindex"),Mt.delete(this.carouselEl)}};d("carousel",W);var Tt=h(),U=class{constructor(t){var i,s;this.stepperEl=t,this.steps=Array.from(t.querySelectorAll(".fs-step")),this.linear=t.getAttribute("data-linear")!=="false";let e=Array.from(t.querySelectorAll(".fs-step-panel"));this.panels=this.steps.map((n,a)=>n.dataset.fsTarget?t.querySelector(n.dataset.fsTarget):e[a]),this.prevBtn=t.querySelector('[data-stepper="prev"]'),this.nextBtn=t.querySelector('[data-stepper="next"]'),this.finished=!1,this.current=Math.max(this.steps.findIndex(n=>n.classList.contains("fs-step-active")),0),this.steps.forEach((n,a)=>{n.setAttribute("role","listitem"),n.handleClick=()=>this._onStepClick(a),n.addEventListener("click",n.handleClick),n.handleKeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._onStepClick(a))},n.addEventListener("keydown",n.handleKeydown)}),this._handlePrev=()=>this.prev(),this._handleNext=()=>this.next(),(i=this.prevBtn)==null||i.addEventListener("click",this._handlePrev),(s=this.nextBtn)==null||s.addEventListener("click",this._handleNext),this._render(),Tt.set(t,this)}static getInstance(t){return Tt.get(t)}_onStepClick(t){this.linear&&t>this.current||this.goTo(t)}_render(){this.steps.forEach((t,e)=>{let i=e===this.current&&!this.finished,s=e<this.current||this.finished;t.classList.toggle("fs-step-active",i),t.classList.toggle("fs-step-completed",s),t.setAttribute("aria-current",i?"step":"false");let n=this.linear?s:!0;t.classList.toggle("fs-step-clickable",n),t.setAttribute("tabindex",n?"0":"-1");let a=this.panels[e];a&&a.classList.toggle("is-active",e===this.current)}),this.prevBtn&&(this.prevBtn.disabled=this.current===0&&!this.finished)}_change(t){let e=this.current,i=Math.max(0,Math.min(t,this.steps.length-1));if(i===e&&!this.finished)return!1;let s=new CustomEvent("fs:stepper:beforechange",{bubbles:!0,cancelable:!0,detail:{from:e,to:i}});return this.stepperEl.dispatchEvent(s),s.defaultPrevented?!1:(this.finished=!1,this.current=i,this._render(),this.stepperEl.dispatchEvent(new CustomEvent("fs:stepper:changed",{bubbles:!0,detail:{from:e,to:i}})),!0)}next(){return this.current<this.steps.length-1?this._change(this.current+1):this.complete()}prev(){return this._change(this.current-1)}goTo(t){return this._change(t)}setError(t,e=!0){let i=this.steps[t];i&&i.classList.toggle("fs-step-error",e)}complete(){let t=new CustomEvent("fs:stepper:beforechange",{bubbles:!0,cancelable:!0,detail:{from:this.current,to:this.current,completing:!0}});return this.stepperEl.dispatchEvent(t),t.defaultPrevented?!1:(this.finished=!0,this._render(),this.stepperEl.dispatchEvent(new CustomEvent("fs:stepper:completed",{bubbles:!0})),!0)}dispose(){var t,e;this.steps.forEach(i=>{i.removeEventListener("click",i.handleClick),i.removeEventListener("keydown",i.handleKeydown)}),(t=this.prevBtn)==null||t.removeEventListener("click",this._handlePrev),(e=this.nextBtn)==null||e.removeEventListener("click",this._handleNext),Tt.delete(this.stepperEl)}};d("stepper",U);var Pt=h(),Y=class{constructor(t,e={}){var i,s;this.listEl=t,this.maxItems=Number((s=(i=e.maxItems)!=null?i:t.getAttribute("data-max-items"))!=null?s:4),this.items=Array.from(t.children).filter(n=>n.classList.contains("fs-breadcrumb-item")),this.isCollapsed=!1,this._moreItem=null,this._dropdown=null,this._collapseQuery=window.matchMedia("(max-width: 639.98px)"),this._setupTruncation(),this._handleMediaChange=()=>this._render(),this._collapseQuery.addEventListener("change",this._handleMediaChange),this._render(),Pt.set(t,this)}static getInstance(t){return Pt.get(t)}_setupTruncation(){var i;let t=this.items.map(s=>{var n;return(n=s.querySelector("a"))!=null?n:s});t.forEach(s=>s.classList.add("fs-breadcrumb-item-truncate"));let e=()=>{t.forEach(s=>{s.scrollWidth>s.clientWidth&&(s.setAttribute("data-title",s.textContent.trim()),new S(s))})};(i=document.fonts)!=null&&i.ready?document.fonts.ready.then(e):requestAnimationFrame(e)}_render(){let t=this._collapseQuery.matches&&this.items.length>this.maxItems;t!==this.isCollapsed&&(this.isCollapsed=t,t?this._collapse():this._expand())}_collapse(){let t=this.items.slice(1,-1);t.forEach(n=>{n.style.display="none"});let e=document.createElement("li");e.className="fs-breadcrumb-item";let i=document.createElement("button");i.type="button",i.className="fs-breadcrumb-more",i.setAttribute("aria-label","Mostrar n\xEDveis ocultos"),i.textContent="\u2026";let s=document.createElement("div");s.className="fs-dropdown-menu",t.forEach(n=>{var c;let a=(c=n.querySelector("a"))!=null?c:n,o=a.tagName==="A",l=document.createElement(o?"a":"span");l.className="fs-dropdown-item",l.textContent=a.textContent.trim(),o&&(l.href=a.getAttribute("href")),s.appendChild(l)}),e.appendChild(i),e.appendChild(s),this.items[0].insertAdjacentElement("afterend",e),this._moreItem=e,this._dropdown=new k(i)}_expand(){var t,e;this.items.slice(1,-1).forEach(i=>{i.style.removeProperty("display")}),(t=this._dropdown)==null||t.dispose(),this._dropdown=null,(e=this._moreItem)==null||e.remove(),this._moreItem=null}dispose(){this._collapseQuery.removeEventListener("change",this._handleMediaChange),this._expand(),Pt.delete(this.listEl)}};d("breadcrumb",Y);var qt=h(),fe=0;function pt(r){let t=document.createElement("div");return t.textContent=r==null?"":String(r),t.innerHTML}function Me(r){let t=new Date(r),e=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`${e}:${i}`}var V=class{constructor(t,e={}){var a,o,l,c,p,u;let i=(a=e.target)!=null?a:t.getAttribute("data-fs-target"),s=i?document.querySelector(i):null;if(!s)throw new Error("FokusStyles.NotificationCenter: painel n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.panelEl=s,this.storage=(l=(o=e.storage)!=null?o:t.getAttribute("data-storage"))!=null?l:"memory",this.storageKey=(p=(c=e.storageKey)!=null?c:t.getAttribute("data-storage-key"))!=null?p:"fokus-notifications";let n=(u=e.toastContainer)!=null?u:t.getAttribute("data-toast-container");this.toastContainer=n?document.querySelector(n):this._ensureToastContainer(),this.isOpen=!1,this._outsideClickCleanup=null,this.history=this._load(),this.badgeEl=t.querySelector(".fs-notification-badge"),this.listEl=s.querySelector(".fs-notification-list"),this.emptyEl=s.querySelector(".fs-notification-empty"),document.body.appendChild(this.panelEl),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),s.id&&t.setAttribute("aria-controls",s.id),s.getAttribute("role")||s.setAttribute("role","region"),s.getAttribute("aria-label")||s.setAttribute("aria-label","Notifica\xE7\xF5es"),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handlePanelClick=this._handlePanelClick.bind(this),t.addEventListener("click",this._handleTriggerClick),s.addEventListener("click",this._handlePanelClick),this._removeEscapeListener=f(()=>{this.isOpen&&(this.close(),this.triggerEl.focus())}),this._render(),qt.set(t,this)}static getInstance(t){return qt.get(t)}_ensureToastContainer(){let t=document.querySelector(".fs-toast-container");return t||(t=document.createElement("div"),t.className="fs-toast-container",document.body.appendChild(t)),t}_load(){if(this.storage!=="local")return[];try{return JSON.parse(localStorage.getItem(this.storageKey))||[]}catch(t){return[]}}_persist(){if(this.storage==="local")try{localStorage.setItem(this.storageKey,JSON.stringify(this.history))}catch(t){}}get unreadCount(){return this.history.filter(t=>!t.read).length}push(t={}){let{title:e="",body:i="",variant:s="primary",autohide:n=!0,delay:a}=t;fe+=1;let o={id:`n-${fe}`,title:e,body:i,variant:s,time:Date.now(),read:this.isOpen};return this.history.unshift(o),this._persist(),this._render(),this._showToast({title:e,body:i,variant:s,autohide:n,delay:a}),this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:pushed",{bubbles:!0,detail:{record:o}})),o.id}_showToast({title:t,body:e,variant:i,autohide:s,delay:n}){let a=document.createElement("div");a.className=`fs-toast fs-toast-${i}`,n!=null&&a.setAttribute("data-delay",String(n)),s||a.setAttribute("data-autohide","false"),a.innerHTML=`
|
|
14
|
+
`,document.body.appendChild(c);let p=document.createElement("button");p.type="button",p.setAttribute("data-fs-target",`#${o}`),p.style.display="none",document.body.appendChild(p);let u=new O(p),E=!1,g=m=>{var y;E||(E=!0,u.dispose(),c.remove(),p.remove(),(y=l.focus)==null||y.call(l),a(m))};c.addEventListener("click",m=>{var w;let y=(w=m.target.closest("[data-action]"))==null?void 0:w.dataset.action;y==="confirm"?g(!0):y==="cancel"&&g(!1)}),p.addEventListener("fs:modal:hidden",()=>g(!1)),u.show()})}var Lt=h(),R=class{constructor(t){this.tagEl=t,this._isLoading=t.classList.contains("is-loading")||t.getAttribute("aria-busy")==="true",this._handleClick=this._handleClick.bind(this),t.addEventListener("click",this._handleClick),this.setLoading(this._isLoading),Lt.set(t,this)}static getInstance(t){return Lt.get(t)}_handleClick(t){!this._isLoading&&t.target.closest('[data-fs-dismiss="tag"]')&&this.dismiss()}dismiss(){if(this._isLoading)return!1;let t=this.tagEl.querySelector('[data-fs-dismiss="tag"]'),e=t&&document.activeElement===t,s=new CustomEvent("fs:tag:dismissed",{bubbles:!0,cancelable:!0});if(this.tagEl.dispatchEvent(s),s.defaultPrevented)return!1;let i=e?this._getFocusTarget():null;return this.tagEl.remove(),i==null||i.focus(),!0}_getFocusTarget(){let t=this.tagEl.closest(".fs-tag-group");if(!t)return null;let e=[...t.querySelectorAll('[data-fs-dismiss="tag"]')].filter(a=>!a.disabled&&!a.hidden&&a.getAttribute("aria-hidden")!=="true"),s=this.tagEl.querySelector('[data-fs-dismiss="tag"]'),i=e.indexOf(s),n=e.filter(a=>a!==s);return n[i]||n[i-1]||null}setLoading(t){this._isLoading=!!t,this.tagEl.classList.toggle("is-loading",this._isLoading),this._isLoading?this.tagEl.setAttribute("aria-busy","true"):this.tagEl.removeAttribute("aria-busy");let e=this.tagEl.querySelector('[data-fs-dismiss="tag"]');return e&&(e.disabled=this._isLoading),this}dispose(){this.tagEl.removeEventListener("click",this._handleClick),Lt.delete(this.tagEl)}};d("tag",R);var It=h(),B=class{constructor(t){let e=document.getElementById(t.getAttribute("for"));if(!e)throw new Error("FokusStyles.FileDrop: input associado (via for=) n\xE3o encontrado.");this.labelEl=t,this.inputEl=e,this._dragDepth=0,this._handleDragEnter=this._handleDragEnter.bind(this),this._handleDragOver=this._handleDragOver.bind(this),this._handleDragLeave=this._handleDragLeave.bind(this),this._handleDrop=this._handleDrop.bind(this),t.addEventListener("dragenter",this._handleDragEnter),t.addEventListener("dragover",this._handleDragOver),t.addEventListener("dragleave",this._handleDragLeave),t.addEventListener("drop",this._handleDrop),It.set(t,this)}static getInstance(t){return It.get(t)}_handleDragEnter(t){t.preventDefault(),this._dragDepth+=1,this.labelEl.classList.add("is-dragover")}_handleDragOver(t){t.preventDefault()}_handleDragLeave(t){t.preventDefault(),this._dragDepth=Math.max(0,this._dragDepth-1),this._dragDepth===0&&this.labelEl.classList.remove("is-dragover")}_handleDrop(t){var s;if(t.preventDefault(),this._dragDepth=0,this.labelEl.classList.remove("is-dragover"),this.inputEl.disabled)return;let e=(s=t.dataTransfer)==null?void 0:s.files;!e||e.length===0||(this.inputEl.files=e,this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})))}dispose(){this.labelEl.removeEventListener("dragenter",this._handleDragEnter),this.labelEl.removeEventListener("dragover",this._handleDragOver),this.labelEl.removeEventListener("dragleave",this._handleDragLeave),this.labelEl.removeEventListener("drop",this._handleDrop),It.delete(this.labelEl)}};d("file-drop",B);var St=h(),H=class r{constructor(t,e={}){var a,o;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):null;if(!i)throw new Error("FokusStyles.Offcanvas: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.offcanvasEl=i,this.hasBackdrop=((a=e.backdrop)!=null?a:i.getAttribute("data-backdrop"))!=="false",this.staticBackdrop=((o=e.backdrop)!=null?o:i.getAttribute("data-backdrop"))==="static",this.isOpen=!1,this._focusTrap=null,this._outsideClickCleanup=null,this._backdropEl=null,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-hidden","true");let n=i.querySelector(".fs-offcanvas-title");n&&(n.id||(n.id=`fs-offcanvas-title-${Math.random().toString(36).slice(2)}`),i.setAttribute("aria-labelledby",n.id)),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleDismissClick=this._handleDismissClick.bind(this),t.addEventListener("click",this._handleTriggerClick),i.addEventListener("click",this._handleDismissClick),this._removeEscapeListener=f(()=>{this.isOpen&&!this.staticBackdrop&&this.hide()}),St.set(t,this)}static getInstance(t){return St.get(t)}static getOrCreateInstance(t,e={}){var s;return(s=this.getInstance(t))!=null?s:new r(t,e)}static show(t,e={}){return this.getOrCreateInstance(t,e).show()}static hide(t){var e;return(e=this.getInstance(t))==null?void 0:e.hide()}static toggle(t,e={}){return this.getOrCreateInstance(t,e).toggle()}_handleTriggerClick(t){t.preventDefault(),this.show()}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="offcanvas"]')&&this.hide()}show(){this.isOpen||(this.triggerEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,N(this),this.hasBackdrop&&(this._backdropEl=document.createElement("div"),this._backdropEl.className="fs-offcanvas-backdrop",document.body.appendChild(this._backdropEl),this._backdropEl.offsetHeight,this._backdropEl.classList.add("is-open")),this.offcanvasEl.classList.add("is-open"),this.offcanvasEl.setAttribute("aria-hidden","false"),x(),this._focusTrap=C(this.offcanvasEl),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isOpen&&this._focusTrap.activate()})}),this.staticBackdrop||(this._outsideClickCleanup=b(this.offcanvasEl,t=>{this.triggerEl.contains(t.target)||this.hide()})),this.triggerEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:offcanvas:shown",{bubbles:!0})))}hide(){var t,e,s;this.isOpen&&(this.triggerEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,$(this),this.offcanvasEl.classList.remove("is-open"),this.offcanvasEl.setAttribute("aria-hidden","true"),L(),(t=this._backdropEl)==null||t.remove(),this._backdropEl=null,(e=this._focusTrap)==null||e.deactivate(),this._focusTrap=null,(s=this._outsideClickCleanup)==null||s.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.triggerEl.dispatchEvent(new CustomEvent("fs:offcanvas:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.offcanvasEl.removeEventListener("click",this._handleDismissClick),St.delete(this.triggerEl)}};d("offcanvas",H,{selector:'[data-fs="offcanvas"], [data-fs-toggle="offcanvas"]'});var Dt=h(),z=class{constructor(t){if(t.tagName!=="SELECT")throw new Error("FokusStyles.Select: elemento precisa ser um <select> nativo.");this.selectEl=t,this.size=t.getAttribute("data-size"),this._originalDisplay=t.style.display,this._buildMarkup(),this._syncFromNativeSelect(),this.dropdown=new A(this.toggleEl),this.toggleEl.setAttribute("aria-haspopup","listbox"),this.menuEl.setAttribute("role","listbox"),this.toggleEl.addEventListener("fs:dropdown:shown",()=>{this.menuEl.style.width=`${this.toggleEl.offsetWidth}px`}),this._handleItemClick=this._handleItemClick.bind(this),this._handleNativeChange=this._handleNativeChange.bind(this),this.menuEl.addEventListener("click",this._handleItemClick),this.selectEl.addEventListener("change",this._handleNativeChange),Dt.set(t,this)}static getInstance(t){return Dt.get(t)}_buildMarkup(){let t=document.createElement("div");t.className="fs-dropdown fs-form-select-dropdown";let e=document.createElement("button");e.type="button",e.className="fs-form-select",(this.size==="sm"||this.size==="lg")&&e.classList.add(`fs-form-select-${this.size}`),e.disabled=this.selectEl.disabled;let s=document.createElement("div");s.className="fs-dropdown-menu",Array.from(this.selectEl.options).forEach(i=>{let n=document.createElement("button");n.type="button",n.className="fs-dropdown-item",n.setAttribute("role","option"),n.textContent=i.textContent,i.disabled&&n.classList.add("is-disabled"),s.appendChild(n)}),this.selectEl.insertAdjacentElement("afterend",t),t.appendChild(e),t.appendChild(s),this.selectEl.style.display="none",this.wrapperEl=t,this.toggleEl=e,this.menuEl=s}_syncFromNativeSelect(){let t=this.selectEl.options[this.selectEl.selectedIndex];this.toggleEl.textContent=t?t.textContent:"",Array.from(this.menuEl.children).forEach((e,s)=>{let i=s===this.selectEl.selectedIndex;e.classList.toggle("is-active",i),e.setAttribute("aria-selected",String(i))})}_handleItemClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");if(!e)return;let s=Array.from(this.menuEl.children).indexOf(e);this.selectEl.selectedIndex=s,this._syncFromNativeSelect(),this.selectEl.dispatchEvent(new Event("change",{bubbles:!0})),this.selectEl.dispatchEvent(new CustomEvent("fs:select:changed",{bubbles:!0,detail:{value:this.selectEl.value}}))}_handleNativeChange(){this._syncFromNativeSelect()}show(){this.dropdown.show()}hide(){this.dropdown.hide()}toggle(){this.dropdown.toggle()}dispose(){this.dropdown.dispose(),this.menuEl.removeEventListener("click",this._handleItemClick),this.selectEl.removeEventListener("change",this._handleNativeChange),this.wrapperEl.remove(),this.selectEl.style.display=this._originalDisplay,Dt.delete(this.selectEl)}};d("select",z);var Ot=h(),Tt=0,W=class{constructor(t){this.accordionEl=t,this.exclusive=t.getAttribute("data-multiple")!=="true"&&t.getAttribute("data-fs-always-open")!=="true",this.alwaysOpen=t.getAttribute("data-fs-always-open")==="true",this.items=[],Array.from(t.querySelectorAll(".fs-accordion-button")).forEach(s=>{let i=s.closest(".fs-accordion-item").querySelector(".fs-accordion-collapse");Tt+=1,i.id||(i.id=`fokus-accordion-panel-${Tt}`),s.id||(s.id=`fokus-accordion-button-${Tt}`),s.setAttribute("aria-controls",i.id),i.setAttribute("role","region"),i.setAttribute("aria-labelledby",s.id);let n=s.getAttribute("aria-expanded")==="true";s.setAttribute("aria-expanded",String(n)),n||(i.style.display="none"),i.hidden=!n;let a={button:s,panel:i,handleClick:()=>this._toggle(a)};this.items.push(a),s.addEventListener("click",a.handleClick)}),Ot.set(t,this)}static getInstance(t){return Ot.get(t)}_toggle(t){if(t.button.getAttribute("aria-expanded")==="true"){if(this.alwaysOpen)return;this._close(t);return}this.exclusive&&this.items.filter(s=>s!==t&&s.button.getAttribute("aria-expanded")==="true").forEach(s=>this._close(s)),this._open(t)}_open(t){t.button.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),t.button.setAttribute("aria-expanded","true"),t.panel.hidden=!1,S(t.panel).then(()=>{t.button.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),t.button.dispatchEvent(new CustomEvent("fs:accordion:shown",{bubbles:!0}))})}_close(t){t.button.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),t.button.setAttribute("aria-expanded","false"),I(t.panel).then(()=>{t.panel.hidden=!0,t.button.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),t.button.dispatchEvent(new CustomEvent("fs:accordion:hidden",{bubbles:!0}))})}dispose(){this.items.forEach(t=>t.button.removeEventListener("click",t.handleClick)),Ot.delete(this.accordionEl)}};d("accordion",W);var Pt=h(),me=0,U=class{constructor(t){let e=t.getAttribute("data-fs-target"),s=e?document.querySelector(e):null;if(!s)throw new Error("FokusStyles.Collapse: elemento n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.collapseEl=s,this.isOpen=t.getAttribute("aria-expanded")==="true",me+=1,s.id||(s.id=`fokus-collapse-${me}`),t.setAttribute("aria-controls",s.id),t.setAttribute("aria-expanded",String(this.isOpen)),this.isOpen||(s.style.display="none"),this._handleClick=()=>this.toggle(),t.addEventListener("click",this._handleClick),Pt.set(t,this)}static getInstance(t){return Pt.get(t)}show(){this.isOpen||(this.isOpen=!0,this.triggerEl.setAttribute("aria-expanded","true"),S(this.collapseEl).then(()=>{this.triggerEl.dispatchEvent(new CustomEvent("fs:collapse:shown",{bubbles:!0}))}))}hide(){this.isOpen&&(this.isOpen=!1,this.triggerEl.setAttribute("aria-expanded","false"),I(this.collapseEl).then(()=>{this.triggerEl.dispatchEvent(new CustomEvent("fs:collapse:hidden",{bubbles:!0}))}))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.triggerEl.removeEventListener("click",this._handleClick),Pt.delete(this.triggerEl)}};d("collapse",U);var Mt=h(),ge=0,Y=class r{constructor(t){this.tablistEl=t,this.tabs=Array.from(t.querySelectorAll(".fs-nav-link")),this.manualActivation=t.getAttribute("data-tabs-activation")==="manual",t.setAttribute("role","tablist"),this.tabs.forEach(e=>{let s=e.classList.contains("is-active");ge+=1,e.id||(e.id=`fokus-tab-${ge}`),e.setAttribute("role","tab"),e.setAttribute("aria-selected",String(s)),e.setAttribute("tabindex",s?"0":"-1");let i=e.getAttribute("data-fs-target"),n=i?document.querySelector(i):null;n&&(n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",e.id),n.setAttribute("tabindex","0"),n.hidden=!s)}),this._handleClick=this._handleClick.bind(this),this._handleKeydown=this._handleKeydown.bind(this),t.addEventListener("click",this._handleClick),t.addEventListener("keydown",this._handleKeydown),Mt.set(t,this)}static getInstance(t){return Mt.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}static show(t,e){return this.getOrCreateInstance(t).show(e)}static dispose(t){var e;return(e=this.getInstance(t))==null?void 0:e.dispose()}_handleClick(t){let e=t.target.closest(".fs-nav-link:not(.is-disabled)");!e||!this.tabs.includes(e)||this.show(e)}_handleKeydown(t){let e=this.tabs.filter(a=>!a.classList.contains("is-disabled")),s=e.indexOf(document.activeElement);if(s===-1)return;let i=null;if(t.key==="ArrowRight"?i=(s+1)%e.length:t.key==="ArrowLeft"?i=(s-1+e.length)%e.length:t.key==="Home"?i=0:t.key==="End"&&(i=e.length-1),i===null)return;t.preventDefault();let n=e[i];n.focus(),this.manualActivation||this.show(n)}show(t){t.classList.contains("is-active")||(this.tabs.forEach(e=>{let s=e===t;e.classList.toggle("is-active",s),e.setAttribute("aria-selected",String(s)),e.setAttribute("tabindex",s?"0":"-1");let i=e.getAttribute("data-fs-target"),n=i?document.querySelector(i):null;n==null||n.classList.toggle("is-active",s),n&&(n.hidden=!s)}),t.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),t.dispatchEvent(new CustomEvent("fs:tab:changed",{bubbles:!0,detail:{target:t.getAttribute("data-fs-target")}})))}dispose(){this.tablistEl.removeEventListener("click",this._handleClick),this.tablistEl.removeEventListener("keydown",this._handleKeydown),Mt.delete(this.tablistEl)}};d("tabs",Y);var Ft=h(),T=class{constructor(t){this.toastEl=t,this.delay=Number(t.getAttribute("data-delay"))||4e3,this.autohide=t.getAttribute("data-autohide")!=="false",this.isOpen=!1,this._hideTimer=null,this._paused=!1,this._remaining=this.delay,this._startedAt=0,this._progressTimer=null,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.style.display="none",this._handleDismissClick=this._handleDismissClick.bind(this),this._pause=()=>{!this.isOpen||this._paused||(this._paused=!0,clearTimeout(this._hideTimer),this.autohide&&this._startedAt&&(this._remaining=Math.max(0,this._remaining-(Date.now()-this._startedAt))),this._updateProgress(),clearInterval(this._progressTimer),this.toastEl.classList.add("is-paused"))},this._resume=()=>{!this.isOpen||!this._paused||(this._paused=!1,this.toastEl.classList.remove("is-paused"),this._startProgress(),this.autohide&&this._scheduleHide())},t.addEventListener("click",this._handleDismissClick),t.addEventListener("mouseenter",this._pause),t.addEventListener("mouseleave",this._resume),t.addEventListener("focusin",this._pause),t.addEventListener("focusout",this._resume),Ft.set(t,this)}static getInstance(t){return Ft.get(t)}_handleDismissClick(t){t.target.closest('[data-fs-dismiss="toast"]')&&this.hide()}show(){if(this.isOpen)return;this.toastEl.dispatchEvent(new CustomEvent("fs:show",{bubbles:!0})),this.isOpen=!0,this._remaining=this.delay,this._startedAt=Date.now(),this.toastEl.style.setProperty("--fs-toast-duration",`${this.delay}ms`);let t=S(this.toastEl);this.toastEl.classList.remove("is-progressing"),this.toastEl.offsetWidth,this.toastEl.getAttribute("data-toast-progress")==="true"&&this.autohide&&(this.toastEl.classList.add("is-progressing"),this._startProgress()),t.then(()=>{this.toastEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0})),this.toastEl.dispatchEvent(new CustomEvent("fs:toast:shown",{bubbles:!0}))}),this._scheduleHide()}_scheduleHide(){clearTimeout(this._hideTimer),this.autohide&&!this._paused&&(this._startedAt=Date.now(),this._hideTimer=setTimeout(()=>this.hide(),this._remaining))}_updateProgress(){if(this.toastEl.getAttribute("data-toast-progress")!=="true"||!this.autohide)return;let t=Math.max(0,Math.min(100,this._remaining/this.delay*100)),e=this.toastEl.querySelector(".fs-toast-progress");e&&(e.style.inlineSize=`${t}%`)}_startProgress(){this.toastEl.getAttribute("data-toast-progress")!=="true"||!this.autohide||(clearInterval(this._progressTimer),this._updateProgress(),this._progressTimer=setInterval(()=>{!this.isOpen||this._paused||(this._remaining=Math.max(0,this.delay-(Date.now()-this._startedAt)),this._updateProgress())},50))}hide(){if(!this.isOpen)return;this.toastEl.dispatchEvent(new CustomEvent("fs:hide",{bubbles:!0})),this.isOpen=!1,clearTimeout(this._hideTimer),this._hideTimer=null,clearInterval(this._progressTimer),this._progressTimer=null,this._startedAt=0,this._remaining=this.delay,this.toastEl.classList.remove("is-paused"),this.toastEl.classList.remove("is-progressing");let t=this.toastEl.querySelector(".fs-toast-progress");t&&t.style.removeProperty("inline-size"),I(this.toastEl).then(()=>{this.toastEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0})),this.toastEl.dispatchEvent(new CustomEvent("fs:toast:hidden",{bubbles:!0}))})}toggle(){this.isOpen?this.hide():this.show()}dispose(){clearTimeout(this._hideTimer),clearInterval(this._progressTimer),this.toastEl.removeEventListener("click",this._handleDismissClick),this.toastEl.removeEventListener("mouseenter",this._pause),this.toastEl.removeEventListener("mouseleave",this._resume),this.toastEl.removeEventListener("focusin",this._pause),this.toastEl.removeEventListener("focusout",this._resume),Ft.delete(this.toastEl)}};d("toast",T);var qt=h(),He="a, button, input, select, textarea, label, [contenteditable='true']",V=class r{constructor(t){var e,s,i;this.carouselEl=t,this.inner=t.querySelector(".fs-carousel-inner"),this.items=Array.from(t.querySelectorAll(".fs-carousel-item")),this.indicators=Array.from(t.querySelectorAll(".fs-carousel-indicators button")),this.prevBtn=t.querySelector(".fs-carousel-control-prev"),this.nextBtn=t.querySelector(".fs-carousel-control-next"),this.toggleBtn=t.querySelector("[data-fs-carousel-toggle]"),this.counterEl=t.querySelector("[data-fs-carousel-counter]"),this.progressEl=t.querySelector("[data-fs-carousel-progress]"),this.interval=Number(t.getAttribute("data-interval"))||5e3,this.autoplay=t.getAttribute("data-autoplay")==="true",this.dragEnabled=t.getAttribute("data-drag")!=="false",this.timer=null,this.userPaused=!1,this.isHovering=!1,this.isFocusWithin=!1,this.drag=null,this.isStatic=this.items.length<2,this.index=Math.max(this.items.findIndex(n=>n.classList.contains("is-active")),0),t.setAttribute("role","group"),t.setAttribute("aria-roledescription","carousel"),t.classList.toggle("is-static",this.isStatic),t.classList.toggle("is-two-slides",this.items.length===2),!this.isStatic&&!t.hasAttribute("tabindex")&&(t.setAttribute("tabindex","0"),this.managesTabindex=!0),this._render(),this._handlePrev=()=>this.prev(),this._handleNext=()=>this.next(),this._handleToggle=()=>this.userPaused?this.play():this.pause(),this._handleIndicator=n=>{let a=this.indicators.indexOf(n.currentTarget);a!==-1&&this.goTo(a)},this._handleKeydown=this._handleKeydown.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerEnd=this._handlePointerEnd.bind(this),this._handleVisibilityChange=this._handleVisibilityChange.bind(this),this._handleMouseEnter=()=>{this.isHovering=!0,this._syncAutoplay()},this._handleMouseLeave=()=>{this.isHovering=!1,this._syncAutoplay()},this._handleFocusIn=()=>{this.isFocusWithin=!0,this._syncAutoplay()},this._handleFocusOut=()=>{queueMicrotask(()=>{this.isFocusWithin=t.contains(document.activeElement),this._syncAutoplay()})},(e=this.prevBtn)==null||e.addEventListener("click",this._handlePrev),(s=this.nextBtn)==null||s.addEventListener("click",this._handleNext),(i=this.toggleBtn)==null||i.addEventListener("click",this._handleToggle),this.indicators.forEach(n=>n.addEventListener("click",this._handleIndicator)),t.addEventListener("keydown",this._handleKeydown),t.addEventListener("pointerdown",this._handlePointerDown),t.addEventListener("pointermove",this._handlePointerMove),t.addEventListener("pointerup",this._handlePointerEnd),t.addEventListener("pointercancel",this._handlePointerEnd),t.addEventListener("mouseenter",this._handleMouseEnter),t.addEventListener("mouseleave",this._handleMouseLeave),t.addEventListener("focusin",this._handleFocusIn),t.addEventListener("focusout",this._handleFocusOut),document.addEventListener("visibilitychange",this._handleVisibilityChange),qt.set(t,this),this._syncAutoplay()}static getInstance(t){return qt.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}static next(t){return this.getOrCreateInstance(t).next()}static prev(t){return this.getOrCreateInstance(t).prev()}static goTo(t,e){return this.getOrCreateInstance(t).goTo(e)}_isDocumentVisible(){return document.visibilityState!=="hidden"}_isTemporarilyPaused(){return this.isHovering||this.isFocusWithin||!this._isDocumentVisible()||!!this.drag}_isAutoplayEnabled(){return this.autoplay&&!this.isStatic&&!this.userPaused&&!this._isTemporarilyPaused()}_syncAutoplay(){this.timer&&(clearInterval(this.timer),this.timer=null),this._isAutoplayEnabled()&&(this.timer=setInterval(()=>this.next(),this.interval)),this._syncAutoplayA11y()}_syncAutoplayA11y(){if(this.inner&&this.inner.setAttribute("aria-live",this.timer?"off":"polite"),this.carouselEl.classList.toggle("is-autoplay-paused",this.autoplay&&!this.isStatic&&!this.timer),this.progressEl&&(this.progressEl.style.setProperty("--fs-carousel-progress-duration",`${this.interval}ms`),this.progressEl.classList.remove("is-running"),this.timer&&(this.progressEl.offsetWidth,this.progressEl.classList.add("is-running"))),!this.toggleBtn)return;let t=this.autoplay&&!this.userPaused&&!this.isStatic;this.toggleBtn.disabled=!this.autoplay||this.isStatic,this.toggleBtn.setAttribute("aria-pressed",String(t)),this.toggleBtn.setAttribute("aria-label",t?"Pausar reprodu\xE7\xE3o autom\xE1tica":"Reproduzir reprodu\xE7\xE3o autom\xE1tica")}_render(){this.inner&&!this.carouselEl.classList.contains("fs-carousel-fade")&&(this.inner.style.transform=`translate3d(-${this.index*100}%, 0, 0)`),this.items.forEach((t,e)=>{t.classList.toggle("is-active",e===this.index),t.setAttribute("aria-hidden",String(e!==this.index)),t.toggleAttribute("inert",e!==this.index)}),this.indicators.forEach((t,e)=>{t.classList.toggle("is-active",e===this.index),t.setAttribute("aria-current",String(e===this.index))}),this.counterEl&&(this.counterEl.textContent=`${this.index+1} de ${this.items.length}`),this._syncAutoplayA11y()}_goToIndex(t){let e=this.items.length;if(e<2)return;let s=this.index,i=(t%e+e)%e;i!==s&&(this.index=i,this._render(),this.carouselEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0,detail:{from:s,to:i}})),this.carouselEl.dispatchEvent(new CustomEvent("fs:carousel:slid",{bubbles:!0,detail:{from:s,to:i}})))}next(){this._goToIndex(this.index+1)}prev(){this._goToIndex(this.index-1)}goTo(t){this._goToIndex(t)}pause(){this.autoplay&&(this.userPaused=!0,this._syncAutoplay())}play(){!this.autoplay||this.isStatic||(this.userPaused=!1,this._syncAutoplay())}_handleKeydown(t){t.target===this.carouselEl&&(t.key==="ArrowRight"?(t.preventDefault(),this.next()):t.key==="ArrowLeft"?(t.preventDefault(),this.prev()):t.key==="Home"?(t.preventDefault(),this.goTo(0)):t.key==="End"&&(t.preventDefault(),this.goTo(this.items.length-1)))}_handlePointerDown(t){var e,s,i,n;if(!(!this.dragEnabled||this.isStatic||this.carouselEl.classList.contains("fs-carousel-fade"))&&!(t.isPrimary===!1||t.pointerType==="mouse"&&t.button!==0)&&!((s=(e=t.target).closest)!=null&&s.call(e,He))){this.drag={id:t.pointerId,startX:t.clientX,startY:t.clientY,deltaX:0,horizontal:!1};try{(n=(i=this.carouselEl).setPointerCapture)==null||n.call(i,t.pointerId)}catch(a){}this._syncAutoplay()}}_handlePointerMove(t){if(!this.drag||t.pointerId!==this.drag.id)return;let e=t.clientX-this.drag.startX,s=t.clientY-this.drag.startY;if(!this.drag.horizontal){if(Math.abs(s)>8&&Math.abs(s)>=Math.abs(e)){this._clearDrag();return}if(Math.abs(e)<=8||Math.abs(e)<Math.abs(s))return;this.drag.horizontal=!0,this.carouselEl.classList.add("is-dragging")}this.drag.deltaX=e,this.inner.style.transform=`translate3d(calc(-${this.index*100}% + ${e}px), 0, 0)`,t.preventDefault()}_handlePointerEnd(t){if(!this.drag||t.pointerId!==this.drag.id)return;let{deltaX:e,horizontal:s}=this.drag;if(this._clearDrag(),this._render(),t.type==="pointercancel"||!s)return;let i=this.carouselEl.getBoundingClientRect().width,n=Math.min(80,Math.max(40,i*.12));Math.abs(e)<n||(e<0?this.next():this.prev())}_clearDrag(){var t,e;if(this.drag){try{(e=(t=this.carouselEl).hasPointerCapture)!=null&&e.call(t,this.drag.id)&&this.carouselEl.releasePointerCapture(this.drag.id)}catch(s){}this.drag=null,this.carouselEl.classList.remove("is-dragging"),this._syncAutoplay()}}_handleVisibilityChange(){this._syncAutoplay()}dispose(){var t,e,s;this.userPaused=!0,this._clearDrag(),this._syncAutoplay(),(t=this.prevBtn)==null||t.removeEventListener("click",this._handlePrev),(e=this.nextBtn)==null||e.removeEventListener("click",this._handleNext),(s=this.toggleBtn)==null||s.removeEventListener("click",this._handleToggle),this.indicators.forEach(i=>i.removeEventListener("click",this._handleIndicator)),this.carouselEl.removeEventListener("keydown",this._handleKeydown),this.carouselEl.removeEventListener("pointerdown",this._handlePointerDown),this.carouselEl.removeEventListener("pointermove",this._handlePointerMove),this.carouselEl.removeEventListener("pointerup",this._handlePointerEnd),this.carouselEl.removeEventListener("pointercancel",this._handlePointerEnd),this.carouselEl.removeEventListener("mouseenter",this._handleMouseEnter),this.carouselEl.removeEventListener("mouseleave",this._handleMouseLeave),this.carouselEl.removeEventListener("focusin",this._handleFocusIn),this.carouselEl.removeEventListener("focusout",this._handleFocusOut),document.removeEventListener("visibilitychange",this._handleVisibilityChange),this.managesTabindex&&this.carouselEl.removeAttribute("tabindex"),qt.delete(this.carouselEl)}};d("carousel",V);var Nt=h(),G=class{constructor(t){var s,i;this.stepperEl=t,this.steps=Array.from(t.querySelectorAll(".fs-step")),this.linear=t.getAttribute("data-linear")!=="false";let e=Array.from(t.querySelectorAll(".fs-step-panel"));this.panels=this.steps.map((n,a)=>n.dataset.fsTarget?t.querySelector(n.dataset.fsTarget):e[a]),this.prevBtn=t.querySelector('[data-stepper="prev"]'),this.nextBtn=t.querySelector('[data-stepper="next"]'),this.finished=!1,this.current=Math.max(this.steps.findIndex(n=>n.classList.contains("fs-step-active")),0),this.steps.forEach((n,a)=>{n.setAttribute("role","listitem"),n.handleClick=()=>this._onStepClick(a),n.addEventListener("click",n.handleClick),n.handleKeydown=o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),this._onStepClick(a))},n.addEventListener("keydown",n.handleKeydown)}),this._handlePrev=()=>this.prev(),this._handleNext=()=>this.next(),(s=this.prevBtn)==null||s.addEventListener("click",this._handlePrev),(i=this.nextBtn)==null||i.addEventListener("click",this._handleNext),this._render(),Nt.set(t,this)}static getInstance(t){return Nt.get(t)}_onStepClick(t){this.linear&&t>this.current||this.goTo(t)}_render(){this.steps.forEach((t,e)=>{let s=e===this.current&&!this.finished,i=e<this.current||this.finished;t.classList.toggle("fs-step-active",s),t.classList.toggle("fs-step-completed",i),t.setAttribute("aria-current",s?"step":"false");let n=this.linear?i:!0;t.classList.toggle("fs-step-clickable",n),t.setAttribute("tabindex",n?"0":"-1");let a=this.panels[e];a&&a.classList.toggle("is-active",e===this.current)}),this.prevBtn&&(this.prevBtn.disabled=this.current===0&&!this.finished)}_change(t){let e=this.current,s=Math.max(0,Math.min(t,this.steps.length-1));if(s===e&&!this.finished)return!1;let i=new CustomEvent("fs:stepper:beforechange",{bubbles:!0,cancelable:!0,detail:{from:e,to:s}});return this.stepperEl.dispatchEvent(i),i.defaultPrevented?!1:(this.finished=!1,this.current=s,this._render(),this.stepperEl.dispatchEvent(new CustomEvent("fs:stepper:changed",{bubbles:!0,detail:{from:e,to:s}})),!0)}next(){return this.current<this.steps.length-1?this._change(this.current+1):this.complete()}prev(){return this._change(this.current-1)}goTo(t){return this._change(t)}setError(t,e=!0){let s=this.steps[t];s&&s.classList.toggle("fs-step-error",e)}complete(){let t=new CustomEvent("fs:stepper:beforechange",{bubbles:!0,cancelable:!0,detail:{from:this.current,to:this.current,completing:!0}});return this.stepperEl.dispatchEvent(t),t.defaultPrevented?!1:(this.finished=!0,this._render(),this.stepperEl.dispatchEvent(new CustomEvent("fs:stepper:completed",{bubbles:!0})),!0)}dispose(){var t,e;this.steps.forEach(s=>{s.removeEventListener("click",s.handleClick),s.removeEventListener("keydown",s.handleKeydown)}),(t=this.prevBtn)==null||t.removeEventListener("click",this._handlePrev),(e=this.nextBtn)==null||e.removeEventListener("click",this._handleNext),Nt.delete(this.stepperEl)}};d("stepper",G);var $t=h(),j=class{constructor(t,e={}){var s,i;this.listEl=t,this.maxItems=Number((i=(s=e.maxItems)!=null?s:t.getAttribute("data-max-items"))!=null?i:4),this.items=Array.from(t.children).filter(n=>n.classList.contains("fs-breadcrumb-item")),this.isCollapsed=!1,this._moreItem=null,this._dropdown=null,this._collapseQuery=window.matchMedia("(max-width: 639.98px)"),this._setupTruncation(),this._handleMediaChange=()=>this._render(),this._collapseQuery.addEventListener("change",this._handleMediaChange),this._render(),$t.set(t,this)}static getInstance(t){return $t.get(t)}_setupTruncation(){var s;let t=this.items.map(i=>{var n;return(n=i.querySelector("a"))!=null?n:i});t.forEach(i=>i.classList.add("fs-breadcrumb-item-truncate"));let e=()=>{t.forEach(i=>{i.scrollWidth>i.clientWidth&&(i.setAttribute("data-title",i.textContent.trim()),new D(i))})};(s=document.fonts)!=null&&s.ready?document.fonts.ready.then(e):requestAnimationFrame(e)}_render(){let t=this._collapseQuery.matches&&this.items.length>this.maxItems;t!==this.isCollapsed&&(this.isCollapsed=t,t?this._collapse():this._expand())}_collapse(){let t=this.items.slice(1,-1);t.forEach(n=>{n.style.display="none"});let e=document.createElement("li");e.className="fs-breadcrumb-item";let s=document.createElement("button");s.type="button",s.className="fs-breadcrumb-more",s.setAttribute("aria-label","Mostrar n\xEDveis ocultos"),s.textContent="\u2026";let i=document.createElement("div");i.className="fs-dropdown-menu",t.forEach(n=>{var c;let a=(c=n.querySelector("a"))!=null?c:n,o=a.tagName==="A",l=document.createElement(o?"a":"span");l.className="fs-dropdown-item",l.textContent=a.textContent.trim(),o&&(l.href=a.getAttribute("href")),i.appendChild(l)}),e.appendChild(s),e.appendChild(i),this.items[0].insertAdjacentElement("afterend",e),this._moreItem=e,this._dropdown=new A(s)}_expand(){var t,e;this.items.slice(1,-1).forEach(s=>{s.style.removeProperty("display")}),(t=this._dropdown)==null||t.dispose(),this._dropdown=null,(e=this._moreItem)==null||e.remove(),this._moreItem=null}dispose(){this._collapseQuery.removeEventListener("change",this._handleMediaChange),this._expand(),$t.delete(this.listEl)}};d("breadcrumb",j);var Kt=h(),be=0;function mt(r){let t=document.createElement("div");return t.textContent=r==null?"":String(r),t.innerHTML}function ze(r){let t=new Date(r),e=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0");return`${e}:${s}`}var Q=class{constructor(t,e={}){var a,o,l,c,p,u;let s=(a=e.target)!=null?a:t.getAttribute("data-fs-target"),i=s?document.querySelector(s):null;if(!i)throw new Error("FokusStyles.NotificationCenter: painel n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.panelEl=i,this.storage=(l=(o=e.storage)!=null?o:t.getAttribute("data-storage"))!=null?l:"memory",this.storageKey=(p=(c=e.storageKey)!=null?c:t.getAttribute("data-storage-key"))!=null?p:"fokus-notifications";let n=(u=e.toastContainer)!=null?u:t.getAttribute("data-toast-container");this.toastContainer=n?document.querySelector(n):this._ensureToastContainer(),this.isOpen=!1,this._outsideClickCleanup=null,this.history=this._load(),this.badgeEl=t.querySelector(".fs-notification-badge"),this.listEl=i.querySelector(".fs-notification-list"),this.emptyEl=i.querySelector(".fs-notification-empty"),document.body.appendChild(this.panelEl),t.setAttribute("aria-haspopup","dialog"),t.setAttribute("aria-expanded","false"),i.id&&t.setAttribute("aria-controls",i.id),i.getAttribute("role")||i.setAttribute("role","region"),i.getAttribute("aria-label")||i.setAttribute("aria-label","Notifica\xE7\xF5es"),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handlePanelClick=this._handlePanelClick.bind(this),t.addEventListener("click",this._handleTriggerClick),i.addEventListener("click",this._handlePanelClick),this._removeEscapeListener=f(()=>{this.isOpen&&(this.close(),this.triggerEl.focus())}),this._render(),Kt.set(t,this)}static getInstance(t){return Kt.get(t)}_ensureToastContainer(){let t=document.querySelector(".fs-toast-container");return t||(t=document.createElement("div"),t.className="fs-toast-container",document.body.appendChild(t)),t}_load(){if(this.storage!=="local")return[];try{return JSON.parse(localStorage.getItem(this.storageKey))||[]}catch(t){return[]}}_persist(){if(this.storage==="local")try{localStorage.setItem(this.storageKey,JSON.stringify(this.history))}catch(t){}}get unreadCount(){return this.history.filter(t=>!t.read).length}push(t={}){let{title:e="",body:s="",variant:i="primary",autohide:n=!0,delay:a}=t;be+=1;let o={id:`n-${be}`,title:e,body:s,variant:i,time:Date.now(),read:this.isOpen};return this.history.unshift(o),this._persist(),this._render(),this._showToast({title:e,body:s,variant:i,autohide:n,delay:a}),this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:pushed",{bubbles:!0,detail:{record:o}})),o.id}_showToast({title:t,body:e,variant:s,autohide:i,delay:n}){let a=document.createElement("div");a.className=`fs-toast fs-toast-${s}`,n!=null&&a.setAttribute("data-delay",String(n)),i||a.setAttribute("data-autohide","false"),a.innerHTML=`
|
|
15
15
|
<div class="fs-toast-header">
|
|
16
|
-
<span>${
|
|
16
|
+
<span>${mt(t)}</span>
|
|
17
17
|
<button type="button" class="fs-btn-close" data-fs-dismiss="toast" aria-label="Fechar"></button>
|
|
18
18
|
</div>
|
|
19
|
-
${e?`<div class="fs-toast-body">${
|
|
20
|
-
`,this.toastContainer.appendChild(a);let o=new
|
|
19
|
+
${e?`<div class="fs-toast-body">${mt(e)}</div>`:""}
|
|
20
|
+
`,this.toastContainer.appendChild(a);let o=new T(a);a.addEventListener("fs:toast:hidden",()=>{o.dispose(),a.remove()}),o.show()}remove(t){this.history=this.history.filter(e=>e.id!==t),this._persist(),this._render()}clear(){this.history=[],this._persist(),this._render(),this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:cleared",{bubbles:!0}))}getAll(){return this.history.slice()}_updateBadge(){if(!this.badgeEl)return;let t=this.unreadCount;this.badgeEl.textContent=String(t),this.badgeEl.toggleAttribute("hidden",t===0)}_render(){var t;this.listEl&&(this.listEl.innerHTML=this.history.map(e=>`
|
|
21
21
|
<li class="fs-notification-item fs-notification-item-${e.variant}${e.read?"":" fs-notification-item-unread"}" data-id="${e.id}">
|
|
22
22
|
<div class="fs-notification-item-content">
|
|
23
|
-
<p class="fs-notification-item-title">${
|
|
24
|
-
${e.body?`<p class="fs-notification-item-text">${
|
|
25
|
-
<span class="fs-notification-item-time">${
|
|
23
|
+
<p class="fs-notification-item-title">${mt(e.title)}</p>
|
|
24
|
+
${e.body?`<p class="fs-notification-item-text">${mt(e.body)}</p>`:""}
|
|
25
|
+
<span class="fs-notification-item-time">${ze(e.time)}</span>
|
|
26
26
|
</div>
|
|
27
27
|
<button type="button" class="fs-btn-close" data-notification-dismiss aria-label="Remover notifica\xE7\xE3o"></button>
|
|
28
|
-
</li>`).join("")),(t=this.emptyEl)==null||t.toggleAttribute("hidden",this.history.length>0),this._updateBadge()}_handleTriggerClick(t){t.preventDefault(),this.toggle()}_handlePanelClick(t){var i;if(t.target.closest('[data-notification="clear"]')){this.clear();return}let e=t.target.closest("[data-notification-dismiss]");if(e){let s=(i=e.closest(".fs-notification-item"))==null?void 0:i.dataset.id;s&&this.remove(s)}}open(){var i;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.triggerEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.panelEl.setAttribute("data-theme",t):this.panelEl.removeAttribute("data-theme"),this.panelEl.classList.add("is-open");let e=E(this.triggerEl,this.panelEl,{placement:"bottom",align:"end",offset:4});v(this.panelEl,e),this.triggerEl.setAttribute("aria-expanded","true"),this.history.forEach(s=>{s.read=!0}),this._persist(),this._render(),this._outsideClickCleanup=g(this.panelEl,s=>{this.triggerEl.contains(s.target)||this.close()}),this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:opened",{bubbles:!0}))}close(){var t;this.isOpen&&(this.isOpen=!1,this.panelEl.classList.remove("is-open"),this.panelEl.style.removeProperty("position"),this.panelEl.style.removeProperty("top"),this.panelEl.style.removeProperty("left"),this.triggerEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:closed",{bubbles:!0})))}toggle(){this.isOpen?this.close():this.open()}dispose(){this.close(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.panelEl.removeEventListener("click",this._handlePanelClick),qt.delete(this.triggerEl)}};d("notification-center",V);var Ft=h();function Nt(r){let t=[];for(let e of r.children){let i=null;e.classList.contains("fs-dropdown-item")?i=e:e.classList.contains("fs-dropdown-submenu")&&(i=e.querySelector(":scope > .fs-dropdown-item")),i&&!i.classList.contains("is-disabled")&&t.push(i)}return t}function $t(r){return r.classList.contains("fs-dropdown-item-submenu")}var G=class{constructor(t,e={}){var n,a,o,l;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):t.nextElementSibling;if(!s)throw new Error("FokusStyles.NestedMenu: elemento do menu n\xE3o encontrado (data-fs-target).");this.toggleEl=t,this.rootMenu=s,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.align=(l=(o=e.align)!=null?o:t.getAttribute("data-align"))!=null?l:"start",this.isOpen=!1,this._outsideClickCleanup=null,document.body.appendChild(this.rootMenu),this.toggleEl.setAttribute("aria-haspopup","menu"),this.toggleEl.setAttribute("aria-expanded","false"),this.rootMenu.setAttribute("role","menu"),this.rootMenu.querySelectorAll(".fs-dropdown-menu").forEach(c=>c.setAttribute("role","menu")),this.rootMenu.querySelectorAll(".fs-dropdown-item-submenu").forEach(c=>{c.setAttribute("aria-haspopup","menu"),c.setAttribute("aria-expanded","false")}),this._handleToggleClick=this._handleToggleClick.bind(this),this._handleMenuClick=this._handleMenuClick.bind(this),this._handleMenuKeydown=this._handleMenuKeydown.bind(this),this._handleMenuMouseover=this._handleMenuMouseover.bind(this),this.toggleEl.addEventListener("click",this._handleToggleClick),this.rootMenu.addEventListener("click",this._handleMenuClick),this.rootMenu.addEventListener("keydown",this._handleMenuKeydown),this.rootMenu.addEventListener("mouseover",this._handleMenuMouseover),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.toggleEl.focus())}),Ft.set(t,this)}static getInstance(t){return Ft.get(t)}_submenuOf(t){let e=t.nextElementSibling;return e&&e.classList.contains("fs-dropdown-menu")?e:null}_applyFlip(t){let e=this._submenuOf(t);if(!e)return;let i=t.getBoundingClientRect(),s=e.offsetWidth||180,n=document.documentElement.clientWidth;t.parentElement.classList.toggle("fs-dropdown-submenu-left",i.right+s>n)}_openSubmenu(t,e){var n;let i=this._submenuOf(t);if(!i)return;t.closest(".fs-dropdown-menu").querySelectorAll(":scope > .fs-dropdown-submenu > .fs-dropdown-menu.is-open").forEach(a=>{var o;a!==i&&(a.classList.remove("is-open"),(o=a.previousElementSibling)==null||o.setAttribute("aria-expanded","false"))}),this._applyFlip(t),i.classList.add("is-open"),t.setAttribute("aria-expanded","true"),e&&((n=Nt(i)[0])==null||n.focus())}_closeSubmenu(t){let e=this._submenuOf(t);e&&(e.querySelectorAll(".fs-dropdown-menu.is-open").forEach(i=>{var s;i.classList.remove("is-open"),(s=i.previousElementSibling)==null||s.setAttribute("aria-expanded","false")}),e.classList.remove("is-open"),t.parentElement.classList.remove("fs-dropdown-submenu-left"),t.setAttribute("aria-expanded","false"))}_closeAllSubmenus(){this.rootMenu.querySelectorAll(".fs-dropdown-menu.is-open").forEach(t=>{var e;t.classList.remove("is-open"),(e=t.previousElementSibling)==null||e.setAttribute("aria-expanded","false")}),this.rootMenu.querySelectorAll(".fs-dropdown-submenu-left").forEach(t=>t.classList.remove("fs-dropdown-submenu-left"))}_handleToggleClick(t){t.preventDefault(),this.toggle()}_handleMenuClick(t){var i;let e=t.target.closest(".fs-dropdown-item");if(!(!e||e.classList.contains("is-disabled"))){if($t(e)){t.preventDefault(),(i=this._submenuOf(e))!=null&&i.classList.contains("is-open")?this._closeSubmenu(e):this._openSubmenu(e,!1);return}this.hide(),this.toggleEl.focus()}}_handleMenuMouseover(t){let e=t.target.closest(".fs-dropdown-item-submenu");this.rootMenu.querySelectorAll(".fs-dropdown-menu.is-open").forEach(i=>{var s;!i.contains(t.target)&&i!==(e==null?void 0:e.nextElementSibling)&&(i.classList.remove("is-open"),(s=i.previousElementSibling)==null||s.setAttribute("aria-expanded","false"))}),e&&this._applyFlip(e)}_handleMenuKeydown(t){var l,c,p,u;let e=document.activeElement;if(!((l=e==null?void 0:e.classList)!=null&&l.contains("fs-dropdown-item")))return;let i=e.closest(".fs-dropdown-menu"),s=Nt(i),n=s.indexOf(e),a=i.parentElement,o=a==null?void 0:a.classList.contains("fs-dropdown-submenu");switch(t.key){case"ArrowDown":t.preventDefault(),(c=s[(n+1)%s.length])==null||c.focus();break;case"ArrowUp":t.preventDefault(),(p=s[(n-1+s.length)%s.length])==null||p.focus();break;case"ArrowRight":$t(e)&&(t.preventDefault(),this._openSubmenu(e,!0));break;case"ArrowLeft":if(o){t.preventDefault();let b=a.querySelector(":scope > .fs-dropdown-item");this._closeSubmenu(b),b.focus()}break;case"Enter":case" ":$t(e)&&(t.preventDefault(),(u=this._submenuOf(e))!=null&&u.classList.contains("is-open")?this._closeSubmenu(e):this._openSubmenu(e,!0));break;case"Escape":if(o){t.preventDefault(),t.stopPropagation();let b=a.querySelector(":scope > .fs-dropdown-item");this._closeSubmenu(b),b.focus()}else t.preventDefault(),this.hide(),this.toggleEl.focus();break;default:break}}show(){var i,s;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.toggleEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.rootMenu.setAttribute("data-theme",t):this.rootMenu.removeAttribute("data-theme"),this.rootMenu.classList.add("is-open");let e=E(this.toggleEl,this.rootMenu,{placement:this.placement,align:this.align,offset:4});v(this.rootMenu,e),this.toggleEl.setAttribute("aria-expanded","true"),(s=Nt(this.rootMenu)[0])==null||s.focus(),this._outsideClickCleanup=g(this.rootMenu,n=>{this.toggleEl.contains(n.target)||this.hide()}),this.toggleEl.dispatchEvent(new CustomEvent("fs:nested-menu:shown",{bubbles:!0}))}hide(){var t;this.isOpen&&(this.isOpen=!1,this._closeAllSubmenus(),this.rootMenu.classList.remove("is-open"),this.rootMenu.style.removeProperty("position"),this.rootMenu.style.removeProperty("top"),this.rootMenu.style.removeProperty("left"),this.toggleEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,this.toggleEl.dispatchEvent(new CustomEvent("fs:nested-menu:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.toggleEl.removeEventListener("click",this._handleToggleClick),this.rootMenu.removeEventListener("click",this._handleMenuClick),this.rootMenu.removeEventListener("keydown",this._handleMenuKeydown),this.rootMenu.removeEventListener("mouseover",this._handleMenuMouseover),Ft.delete(this.toggleEl)}};d("nested-menu",G);var Kt=h(),me=0;function ge(r){return me+=1,`${r}-${me}`}var j=class{constructor(t,e={}){var n,a;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):t.nextElementSibling;if(!s)throw new Error("FokusStyles.Combobox: listbox n\xE3o encontrada (data-fs-target).");this.inputEl=t,this.listboxEl=s,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.isOpen=!1,this.activeIndex=-1,this.value=null,this._outsideClickCleanup=null,this.listboxEl.id||(this.listboxEl.id=ge("fs-combobox-listbox")),document.body.appendChild(this.listboxEl),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-controls",this.listboxEl.id),this.inputEl.setAttribute("autocomplete","off"),this.listboxEl.setAttribute("role","listbox"),this._getOptions().forEach(o=>{o.id||(o.id=ge("fs-combobox-option")),o.setAttribute("role","option"),o.setAttribute("aria-selected","false")}),this._handleInput=this._handleInput.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleOptionMousedown=this._handleOptionMousedown.bind(this),this._handleOptionClick=this._handleOptionClick.bind(this),this.inputEl.addEventListener("input",this._handleInput),this.inputEl.addEventListener("keydown",this._handleKeydown),this.listboxEl.addEventListener("mousedown",this._handleOptionMousedown),this.listboxEl.addEventListener("click",this._handleOptionClick),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),Kt.set(t,this)}static getInstance(t){return Kt.get(t)}_getOptions(){return Array.from(this.listboxEl.querySelectorAll(".fs-dropdown-item"))}_getSelectableOptions(){return this._getOptions().filter(t=>!t.hidden&&!t.hasAttribute("data-fs-empty")&&!t.classList.contains("is-disabled"))}_filter(t){let e=t.trim().toLowerCase();this._getOptions().forEach(s=>{s.hasAttribute("data-fs-empty")||(s.hidden=e.length>0&&!s.textContent.toLowerCase().includes(e))});let i=this.listboxEl.querySelector("[data-fs-empty]");i&&(i.hidden=this._getSelectableOptions().length>0)}_setActiveIndex(t){let e=this._getSelectableOptions();if(e.length===0){this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant");return}let i=e[this.activeIndex];i==null||i.classList.remove("is-active"),this.activeIndex=(t%e.length+e.length)%e.length;let s=e[this.activeIndex];s.classList.add("is-active"),s.scrollIntoView({block:"nearest"}),this.inputEl.setAttribute("aria-activedescendant",s.id)}_selectOption(t){var i;let e=t.textContent.trim();this.value=(i=t.getAttribute("data-value"))!=null?i:e,this.inputEl.value=e,this._getOptions().forEach(s=>s.setAttribute("aria-selected",String(s===t))),this.hide(),this.inputEl.focus(),this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})),this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:changed",{bubbles:!0,detail:{value:this.value,label:e}}))}_handleInput(){this._filter(this.inputEl.value),this.show(),this._setActiveIndex(-1)}_handleKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this.isOpen?this._setActiveIndex(this.activeIndex+1):this.show()):t.key==="ArrowUp"?(t.preventDefault(),this.isOpen?this._setActiveIndex(this.activeIndex-1):this.show()):t.key==="Home"&&this.isOpen?(t.preventDefault(),this._setActiveIndex(0)):t.key==="End"&&this.isOpen?(t.preventDefault(),this._setActiveIndex(this._getSelectableOptions().length-1)):t.key==="Enter"&&this.isOpen&&this.activeIndex>=0&&(t.preventDefault(),this._selectOption(this._getSelectableOptions()[this.activeIndex]))}_handleOptionMousedown(t){t.target.closest(".fs-dropdown-item")&&t.preventDefault()}_handleOptionClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");!e||e.hasAttribute("data-fs-empty")||this._selectOption(e)}show(){var i;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.inputEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.listboxEl.setAttribute("data-theme",t):this.listboxEl.removeAttribute("data-theme"),this.listboxEl.classList.add("is-open"),this.listboxEl.style.width=`${this.inputEl.offsetWidth}px`;let e=E(this.inputEl,this.listboxEl,{placement:this.placement,align:"start",offset:4});v(this.listboxEl,e),this.inputEl.setAttribute("aria-expanded","true"),this._outsideClickCleanup=g(this.listboxEl,s=>{this.inputEl.contains(s.target)||this.hide()}),this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,(t=this._getSelectableOptions()[this.activeIndex])==null||t.classList.remove("is-active"),this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant"),this.listboxEl.classList.remove("is-open"),this.listboxEl.style.removeProperty("position"),this.listboxEl.style.removeProperty("top"),this.listboxEl.style.removeProperty("left"),this.listboxEl.style.removeProperty("width"),this.inputEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.inputEl.removeEventListener("input",this._handleInput),this.inputEl.removeEventListener("keydown",this._handleKeydown),this.listboxEl.removeEventListener("mousedown",this._handleOptionMousedown),this.listboxEl.removeEventListener("click",this._handleOptionClick),Kt.delete(this.inputEl)}};d("combobox",j);var Rt=h(),Te=new Intl.DateTimeFormat("pt-BR",{weekday:"narrow"}),Pe=new Intl.DateTimeFormat("pt-BR",{month:"long",year:"numeric"}),be=0;function qe(r){return be+=1,`${r}-${be}`}function ft(r){return String(r).padStart(2,"0")}function Bt(r){return`${r.getFullYear()}-${ft(r.getMonth()+1)}-${ft(r.getDate())}`}function Fe(r){return`${ft(r.getDate())}/${ft(r.getMonth()+1)}/${r.getFullYear()}`}function Ee(r){let t=r.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!t)return null;let[,e,i,s]=t,n=new Date(Number(s),Number(i)-1,Number(e));return Number.isNaN(n.getTime())?null:n.getFullYear()===Number(s)&&n.getMonth()===Number(i)-1&&n.getDate()===Number(e)?n:null}function Ht(r,t){return r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function Ne(r){let t=r.getFullYear(),e=r.getMonth(),i=new Date(t,e,1).getDay(),s=new Date(t,e+1,0).getDate(),n=new Date(t,e,0).getDate(),a=[];for(let l=i-1;l>=0;l-=1){let c=n-l,p=e===0?11:e-1;a.push({year:e===0?t-1:t,month:p,day:c,outside:!0})}for(let l=1;l<=s;l+=1)a.push({year:t,month:e,day:l,outside:!1});let o=1;for(;a.length%7!==0;){let l=e===11?0:e+1;a.push({year:e===11?t+1:t,month:l,day:o,outside:!0}),o+=1}return a}var Q=class{constructor(t,e={}){var a,o;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):t.nextElementSibling;if(!s)throw new Error("FokusStyles.Datepicker: painel n\xE3o encontrado (data-fs-target).");this.inputEl=t,this.panelEl=s,this.placement=(o=(a=e.placement)!=null?a:t.getAttribute("data-placement"))!=null?o:"bottom",this.isOpen=!1,this._suppressNextFocus=!1;let n=Ee(t.value);this.selectedDate=n,this.viewDate=n?new Date(n):new Date,this.value=n?Bt(n):null,this._outsideClickCleanup=null,this._positionCleanup=null,this._originalParent=s.parentNode,this._originalNextSibling=s.nextSibling,this.panelEl.id||(this.panelEl.id=qe("fs-datepicker-panel")),document.body.appendChild(this.panelEl),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-haspopup","grid"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-controls",this.panelEl.id),this.inputEl.setAttribute("autocomplete","off"),this.panelEl.classList.add("fs-datepicker-panel"),this.panelEl.innerHTML='<div class="fs-datepicker-header"><button type="button" class="fs-datepicker-nav" data-fs-datepicker-prev aria-label="M\xEAs anterior">\u2039</button><span class="fs-datepicker-title" aria-live="polite"></span><button type="button" class="fs-datepicker-nav" data-fs-datepicker-next aria-label="Pr\xF3ximo m\xEAs">\u203A</button></div><div class="fs-datepicker-grid" role="grid"></div>',this.titleEl=this.panelEl.querySelector(".fs-datepicker-title"),this.gridEl=this.panelEl.querySelector(".fs-datepicker-grid"),this.prevBtn=this.panelEl.querySelector("[data-fs-datepicker-prev]"),this.nextBtn=this.panelEl.querySelector("[data-fs-datepicker-next]"),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleInputKeydown=this._handleInputKeydown.bind(this),this._handleInputChange=this._handleInputChange.bind(this),this._handlePrev=this._handlePrev.bind(this),this._handleNext=this._handleNext.bind(this),this._handleGridClick=this._handleGridClick.bind(this),this._handleGridKeydown=this._handleGridKeydown.bind(this),this.inputEl.addEventListener("focus",this._handleInputFocus),this.inputEl.addEventListener("keydown",this._handleInputKeydown),this.inputEl.addEventListener("change",this._handleInputChange),this.prevBtn.addEventListener("click",this._handlePrev),this.nextBtn.addEventListener("click",this._handleNext),this.gridEl.addEventListener("click",this._handleGridClick),this.gridEl.addEventListener("keydown",this._handleGridKeydown),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this._refocusInputWithoutReopening())}),Rt.set(t,this)}static getInstance(t){return Rt.get(t)}_handleInputFocus(){if(this._suppressNextFocus){this._suppressNextFocus=!1;return}this.show()}_refocusInputWithoutReopening(){this._suppressNextFocus=!0,this.inputEl.focus()}_handleInputKeydown(t){t.key!=="ArrowDown"&&t.key!=="ArrowUp"||(t.preventDefault(),this.isOpen||this.show(),this._focusTabbable())}_handleInputChange(){let t=Ee(this.inputEl.value);t&&(this.selectedDate=t,this.viewDate=new Date(t),this.value=Bt(t),this.isOpen&&this._render())}_handlePrev(t){t.preventDefault(),this.viewDate=new Date(this.viewDate.getFullYear(),this.viewDate.getMonth()-1,1),this._render()}_handleNext(t){t.preventDefault(),this.viewDate=new Date(this.viewDate.getFullYear(),this.viewDate.getMonth()+1,1),this._render()}_handleGridClick(t){let e=t.target.closest(".fs-datepicker-day:not(:disabled)");e&&this._selectDate(new Date(Number(e.dataset.year),Number(e.dataset.month),Number(e.dataset.day)))}_handleGridKeydown(t){let e=t.target.closest(".fs-datepicker-day");if(!e)return;let i=new Date(Number(e.dataset.year),Number(e.dataset.month),Number(e.dataset.day)),s=null;switch(t.key){case"ArrowRight":s=new Date(i),s.setDate(s.getDate()+1);break;case"ArrowLeft":s=new Date(i),s.setDate(s.getDate()-1);break;case"ArrowDown":s=new Date(i),s.setDate(s.getDate()+7);break;case"ArrowUp":s=new Date(i),s.setDate(s.getDate()-7);break;case"Home":s=new Date(i),s.setDate(s.getDate()-s.getDay());break;case"End":s=new Date(i),s.setDate(s.getDate()+(6-s.getDay()));break;case"PageUp":s=t.shiftKey?new Date(i.getFullYear()-1,i.getMonth(),i.getDate()):new Date(i.getFullYear(),i.getMonth()-1,i.getDate());break;case"PageDown":s=t.shiftKey?new Date(i.getFullYear()+1,i.getMonth(),i.getDate()):new Date(i.getFullYear(),i.getMonth()+1,i.getDate());break;case"Enter":case" ":t.preventDefault(),this._selectDate(i);return;default:return}t.preventDefault(),this._moveTo(s)}_moveTo(t){t.getFullYear()===this.viewDate.getFullYear()&&t.getMonth()===this.viewDate.getMonth()||(this.viewDate=new Date(t.getFullYear(),t.getMonth(),1)),this._render(t),this._focusTabbable()}_selectDate(t){this.selectedDate=t,this.viewDate=new Date(t),this.value=Bt(t),this.inputEl.value=Fe(t),this.hide(),this._refocusInputWithoutReopening(),this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})),this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:changed",{bubbles:!0,detail:{value:this.value,date:new Date(t)}}))}_focusTabbable(){var t;(t=this.gridEl.querySelector('.fs-datepicker-day[tabindex="0"]'))==null||t.focus()}_render(t){var c,p;this.titleEl.textContent=Pe.format(this.viewDate);let e=Ne(this.viewDate),i=new Date,s=(c=t!=null?t:this.selectedDate)!=null?c:i,n=e.find(u=>!u.outside&&Ht(new Date(u.year,u.month,u.day),s));n||(n=(p=e.find(u=>!u.outside))!=null?p:e[0]);let a=Array.from({length:7},(u,b)=>{let m=new Date(2024,0,7+b);return`<div class="fs-datepicker-weekday" role="columnheader">${Te.format(m)}</div>`}).join(""),o=[];for(let u=0;u<e.length;u+=7)o.push(e.slice(u,u+7));let l=o.map(u=>`<div class="fs-datepicker-week" role="row">${u.map(m=>{let C=new Date(m.year,m.month,m.day),_=this.selectedDate?Ht(C,this.selectedDate):!1,lt=Ht(C,i),we=m===n,ht=["fs-datepicker-day"];return m.outside&&ht.push("is-outside"),lt&&ht.push("is-today"),_&&ht.push("is-selected"),`<button type="button" class="${ht.join(" ")}" role="gridcell" tabindex="${we?"0":"-1"}" aria-selected="${_}" data-year="${m.year}" data-month="${m.month}" data-day="${m.day}">${m.day}</button>`}).join("")}</div>`).join("");this.gridEl.innerHTML=`<div class="fs-datepicker-weekdays" role="row">${a}</div>${l}`}show(){var i,s;if(this.isOpen)return;this.isOpen=!0;let t=(i=this.inputEl.closest("[data-theme]"))==null?void 0:i.getAttribute("data-theme");t?this.panelEl.setAttribute("data-theme",t):this.panelEl.removeAttribute("data-theme"),this.panelEl.classList.add("is-open");let e=E(this.inputEl,this.panelEl,{placement:this.placement,align:"start",offset:4});v(this.panelEl,e),this._positionCleanup=w(this.inputEl,this.panelEl,{placement:this.placement,align:"start",offset:4}),this.inputEl.setAttribute("aria-expanded","true"),this._render((s=this.selectedDate)!=null?s:new Date),this._outsideClickCleanup=g(this.panelEl,n=>{this.inputEl.contains(n.target)||this.hide()}),this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.panelEl.classList.remove("is-open"),this.panelEl.style.removeProperty("position"),this.panelEl.style.removeProperty("top"),this.panelEl.style.removeProperty("left"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.inputEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.inputEl.removeEventListener("focus",this._handleInputFocus),this.inputEl.removeEventListener("keydown",this._handleInputKeydown),this.inputEl.removeEventListener("change",this._handleInputChange),this.prevBtn.removeEventListener("click",this._handlePrev),this.nextBtn.removeEventListener("click",this._handleNext),this.gridEl.removeEventListener("click",this._handleGridClick),this.gridEl.removeEventListener("keydown",this._handleGridKeydown),this._originalParent&&this._originalParent.insertBefore(this.panelEl,this._originalNextSibling),Rt.delete(this.inputEl)}};d("datepicker",Q);var zt=h(),Wt=5,$e='<svg class="fs-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>',Ke='<svg class="fs-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';function Re(r,t){let e=Number(r),i=Number(t);return r!==""&&t!==""&&!Number.isNaN(e)&&!Number.isNaN(i)?e-i:r.localeCompare(t,"pt-BR",{sensitivity:"base"})}function Be(r,t,e){if(e==="date")return new Date(r).getTime()-new Date(t).getTime();if(e==="number"||e==="currency"){let i=s=>Number(String(s).replace(/[^\d,-]/g,"").replace(/\./g,"").replace(",","."));return i(r)-i(t)}return Re(r,t)}var X=class{constructor(t,e={}){let i=t.querySelector(".fs-table");if(!i)throw new Error("FokusStyles.DataTable: tabela n\xE3o encontrada (.fs-table).");let s=i.querySelector("tbody");if(!s)throw new Error("FokusStyles.DataTable: <tbody> n\xE3o encontrado.");this.rootEl=t,this.tableEl=i,this.theadEl=i.querySelector("thead"),this.tbodyEl=s,this.pageSize=Number(t.getAttribute("data-fs-page-size"))||e.pageSize||10,this.filterInput=t.querySelector("[data-fs-datatable-filter]"),this.emptyEl=t.querySelector("[data-fs-datatable-empty]"),this.loadingEl=t.querySelector("[data-fs-datatable-loading]"),this.errorEl=t.querySelector("[data-fs-datatable-error]"),this.paginationEl=t.querySelector("[data-fs-datatable-pagination]"),this.paginationEl||(this.paginationEl=document.createElement("nav"),this.paginationEl.setAttribute("data-fs-datatable-pagination",""),this.paginationEl.setAttribute("aria-label","Pagina\xE7\xE3o da tabela"),t.appendChild(this.paginationEl)),this.sortKey=null,this.sortDirection="none",this.filterQuery="",this.currentPage=1,this._loading=!1,this._error=null,this._rows=[],this._sortButtons=[],this._buildSortHeaders(),this._readRows(),this._handleSortClick=this._handleSortClick.bind(this),this._handleFilterInput=this._handleFilterInput.bind(this),this._handlePaginationClick=this._handlePaginationClick.bind(this),this._handleCellKeydown=this._handleCellKeydown.bind(this),this._handleCellFocusIn=this._handleCellFocusIn.bind(this),this.theadEl&&this.theadEl.addEventListener("click",this._handleSortClick),this.filterInput&&this.filterInput.addEventListener("input",this._handleFilterInput),this.paginationEl.addEventListener("click",this._handlePaginationClick),this.tbodyEl.addEventListener("keydown",this._handleCellKeydown),this.tbodyEl.addEventListener("focusin",this._handleCellFocusIn),this._render(),this.tableEl.setAttribute("aria-busy","false"),zt.set(t,this)}static getInstance(t){return zt.get(t)}get pageCount(){return Math.max(1,Math.ceil(this._matchedRows().length/this.pageSize))}get rowCount(){return this._matchedRows().length}_buildSortHeaders(){this.theadEl&&(this._sortButtons=Array.from(this.theadEl.querySelectorAll("th[data-fs-sort]")).map(t=>{let e=t.getAttribute("data-fs-sort"),i=document.createElement("button");for(i.type="button",i.className="fs-datatable-sort-btn",i.setAttribute("data-fs-sort-key",e);t.firstChild;)i.appendChild(t.firstChild);return t.appendChild(i),t.setAttribute("aria-sort","none"),{th:t,key:e}}))}_readRows(){this._rows=Array.from(this.tbodyEl.querySelectorAll(":scope > tr")).map((t,e)=>({el:t,order:e,cells:Array.from(t.children).map(i=>{var s;return((s=i.getAttribute("data-fs-sort-value"))!=null?s:i.textContent).trim()})}))}refresh(){this._readRows(),this.currentPage=1,this._render()}_matchedRows(){var e,i;let t=this._rows;if(this.filterQuery){let s=this.filterQuery.toLowerCase();t=t.filter(n=>n.cells.some(a=>a.toLowerCase().includes(s)))}if(this.sortKey&&this.sortDirection!=="none"){let s=(e=this._sortButtons.find(o=>o.key===this.sortKey))==null?void 0:e.th,n=s?Array.from(this.theadEl.querySelectorAll("th")).indexOf(s):-1,a=(i=s==null?void 0:s.getAttribute("data-fs-sort-type"))!=null?i:"text";if(n>=0){let o=this.sortDirection==="asc"?1:-1;t=[...t].sort((l,c)=>{var p,u;return o*Be((p=l.cells[n])!=null?p:"",(u=c.cells[n])!=null?u:"",a)})}}else t=[...t].sort((s,n)=>s.order-n.order);return t}_nextDirection(t){return this.sortKey!==t?"asc":this.sortDirection==="asc"?"desc":this.sortDirection==="desc"?"none":"asc"}sort(t,e="asc"){this.sortKey=e==="none"?null:t,this.sortDirection=e,this.currentPage=1,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:sorted",{bubbles:!0,detail:{key:this.sortKey,direction:this.sortDirection}}))}filter(t){this.filterQuery=(t!=null?t:"").trim(),this.filterInput&&(this.filterInput.value=this.filterQuery),this.currentPage=1,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:filtered",{bubbles:!0,detail:{query:this.filterQuery,matched:this.rowCount}}))}goToPage(t){let e=this.pageCount,i=Math.min(Math.max(1,t),e);i!==this.currentPage&&(this.currentPage=i,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:paged",{bubbles:!0,detail:{page:this.currentPage,pageCount:e}})))}setLoading(t){this._loading=!!t,this.tableEl.setAttribute("aria-busy",String(this._loading)),this._loading&&(this._error=null),this._syncVisibility()}setError(t){var e;if(this._error=t||null,this._error&&(this._loading=!1),this.tableEl.setAttribute("aria-busy",String(this._loading)),this.errorEl){let i=this.errorEl.querySelector("[data-fs-datatable-error-message]");i&&(i.textContent=(e=this._error)!=null?e:"")}this._syncVisibility()}_syncVisibility(){let t=this._loading,e=!this._loading&&!!this._error,i=!t&&!e;this.tableEl.hidden=!i,this.filterInput&&(this.filterInput.disabled=!i),this.loadingEl&&(this.loadingEl.hidden=!t),this.errorEl&&(this.errorEl.hidden=!e),i?this._render():(this.paginationEl.hidden=!0,this.emptyEl&&(this.emptyEl.hidden=!0))}_render(){if(this._loading||this._error)return;let t=this._matchedRows(),e=Math.max(1,Math.ceil(t.length/this.pageSize));this.currentPage=Math.min(Math.max(1,this.currentPage),e);let i=(this.currentPage-1)*this.pageSize,s=t.slice(i,i+this.pageSize);s.forEach(a=>this.tbodyEl.appendChild(a.el)),this._rows.forEach(a=>{a.el.hidden=!s.includes(a)});let n=t.length===0;this.tableEl.hidden=n&&!!this.emptyEl,this.emptyEl&&(this.emptyEl.hidden=!n),this._renderPagination(e),this._syncAriaSort(),this._resetRovingTabindex()}_syncAriaSort(){this._sortButtons.forEach(({th:t,key:e})=>{let i=e===this.sortKey?this.sortDirection:"none";t.setAttribute("aria-sort",i==="asc"?"ascending":i==="desc"?"descending":"none")})}_renderPagination(t){if(this.paginationEl.hidden=t<=1,t<=1){this.paginationEl.innerHTML="";return}let e=Math.min(t,Math.max(Wt,this.currentPage+Math.floor(Wt/2))),i=Math.max(1,e-Wt+1),s=[this._pageItem($e,this.currentPage-1,this.currentPage===1,"P\xE1gina anterior")];for(let n=i;n<=e;n+=1)s.push(this._pageItem(String(n),n,!1,`P\xE1gina ${n}`,n===this.currentPage));s.push(this._pageItem(Ke,this.currentPage+1,this.currentPage===t,"Pr\xF3xima p\xE1gina")),this.paginationEl.innerHTML=`<ul class="fs-pagination">${s.join("")}</ul>`}_pageItem(t,e,i,s,n=!1){let a=["fs-page-item"];return i&&a.push("is-disabled"),n&&a.push("is-active"),`<li class="${a.join(" ")}"><button type="button" class="fs-page-link" data-fs-page="${e}" aria-label="${s}"${n?' aria-current="page"':""}${i?" disabled":""}>${t}</button></li>`}_handleSortClick(t){let e=t.target.closest("[data-fs-sort-key]");if(!e)return;let i=e.dataset.fsSortKey;this.sort(i,this._nextDirection(i))}_handleFilterInput(){this.filter(this.filterInput.value)}_handlePaginationClick(t){let e=t.target.closest("[data-fs-page]");!e||e.disabled||this.goToPage(Number(e.dataset.fsPage))}_visibleCells(){return Array.from(this.tbodyEl.querySelectorAll("tr:not([hidden]) > td, tr:not([hidden]) > th"))}_resetRovingTabindex(){this._visibleCells().forEach((t,e)=>t.setAttribute("tabindex",e===0?"0":"-1"))}_handleCellFocusIn(t){let e=t.target.closest("td, th");!e||e.parentElement.hidden||this._visibleCells().forEach(i=>i.setAttribute("tabindex",i===e?"0":"-1"))}_handleCellKeydown(t){var c,p,u;let e=t.target.closest("td, th");if(!e)return;let i=Array.from(this.tbodyEl.querySelectorAll("tr:not([hidden])")),s=i.indexOf(e.parentElement);if(s===-1)return;let n=Array.from(e.parentElement.children),a=n.indexOf(e),o=i[i.length-1],l=null;switch(t.key){case"ArrowRight":l=n[a+1];break;case"ArrowLeft":l=n[a-1];break;case"ArrowDown":l=(c=i[s+1])==null?void 0:c.children[a];break;case"ArrowUp":l=(p=i[s-1])==null?void 0:p.children[a];break;case"Home":l=t.ctrlKey?(u=i[0])==null?void 0:u.children[0]:n[0];break;case"End":l=t.ctrlKey?o==null?void 0:o.children[o.children.length-1]:n[n.length-1];break;default:return}l&&(t.preventDefault(),l.focus())}dispose(){this.theadEl&&this.theadEl.removeEventListener("click",this._handleSortClick),this.filterInput&&this.filterInput.removeEventListener("input",this._handleFilterInput),this.paginationEl.removeEventListener("click",this._handlePaginationClick),this.tbodyEl.removeEventListener("keydown",this._handleCellKeydown),this.tbodyEl.removeEventListener("focusin",this._handleCellFocusIn),zt.delete(this.rootEl)}};d("datatable",X);var Ut=h(),ve=0;function _e(r){return ve+=1,`${r}-${ve}`}function He(r){let t=r.toLowerCase().split("+").map(e=>e.trim());return{mod:t.includes("mod"),shift:t.includes("shift"),alt:t.includes("alt"),key:t[t.length-1]}}function ze(r,t){let e=r.ctrlKey||r.metaKey;return r.key.toLowerCase()===t.key&&t.mod===e&&t.shift===r.shiftKey&&t.alt===r.altKey}var J=class{constructor(t,e={}){var a,o;let i=t.getAttribute("data-fs-target"),s=i?document.querySelector(i):null;if(!s)throw new Error("FokusStyles.CommandPalette: painel n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.paletteEl=s,this.dialogEl=(a=s.querySelector(".fs-command-palette-dialog"))!=null?a:s,this.inputEl=s.querySelector(".fs-command-palette-input"),this.listEl=s.querySelector(".fs-command-palette-list"),this.isOpen=!1,this.activeIndex=-1,this._focusTrap=null,this._outsideClickCleanup=null,this.listEl.id||(this.listEl.id=_e("fs-command-palette-listbox")),s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-controls",this.listEl.id),this.inputEl.setAttribute("autocomplete","off"),this.listEl.setAttribute("role","listbox"),this._getItems().forEach(l=>{l.id||(l.id=_e("fs-command-palette-option")),l.setAttribute("role","option"),l.setAttribute("aria-selected","false")}),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleInput=this._handleInput.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleItemMousedown=this._handleItemMousedown.bind(this),this._handleItemClick=this._handleItemClick.bind(this),this._handleGlobalShortcut=this._handleGlobalShortcut.bind(this),t.addEventListener("click",this._handleTriggerClick),this.inputEl.addEventListener("input",this._handleInput),this.inputEl.addEventListener("keydown",this._handleKeydown),this.listEl.addEventListener("mousedown",this._handleItemMousedown),this.listEl.addEventListener("click",this._handleItemClick);let n=(o=e.shortcut)!=null?o:t.getAttribute("data-fs-shortcut");this._shortcut=n?He(n):null,this._shortcut&&document.addEventListener("keydown",this._handleGlobalShortcut),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),Ut.set(t,this)}static getInstance(t){return Ut.get(t)}_getItems(){return Array.from(this.listEl.querySelectorAll(".fs-dropdown-item"))}_getSelectableItems(){return this._getItems().filter(t=>!t.hidden&&!t.hasAttribute("data-fs-empty")&&!t.classList.contains("is-disabled"))}_filter(t){let e=t.trim().toLowerCase();this._getItems().forEach(s=>{s.hasAttribute("data-fs-empty")||(s.hidden=e.length>0&&!s.textContent.toLowerCase().includes(e))});let i=this.listEl.querySelector("[data-fs-empty]");i&&(i.hidden=this._getSelectableItems().length>0)}_setActiveIndex(t){let e=this._getSelectableItems();if(e.length===0){this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant");return}let i=e[this.activeIndex];i==null||i.classList.remove("is-active"),this.activeIndex=(t%e.length+e.length)%e.length;let s=e[this.activeIndex];s.classList.add("is-active"),s.scrollIntoView({block:"nearest"}),this.inputEl.setAttribute("aria-activedescendant",s.id)}_selectItem(t){var s;let e=t.textContent.trim(),i=(s=t.getAttribute("data-value"))!=null?s:e;this.hide(),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:selected",{bubbles:!0,detail:{value:i,label:e}}))}_handleTriggerClick(t){t.preventDefault(),this.toggle()}_handleInput(){this._filter(this.inputEl.value),this._setActiveIndex(0)}_handleKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this._setActiveIndex(this.activeIndex+1)):t.key==="ArrowUp"?(t.preventDefault(),this._setActiveIndex(this.activeIndex-1)):t.key==="Enter"&&this.activeIndex>=0&&(t.preventDefault(),this._selectItem(this._getSelectableItems()[this.activeIndex]))}_handleItemMousedown(t){t.target.closest(".fs-dropdown-item")&&t.preventDefault()}_handleItemClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");!e||e.hasAttribute("data-fs-empty")||this._selectItem(e)}_handleGlobalShortcut(t){ze(t,this._shortcut)&&(t.preventDefault(),this.toggle())}show(){var e;if(this.isOpen)return;this.isOpen=!0;let t=(e=this.triggerEl.closest("[data-theme]"))==null?void 0:e.getAttribute("data-theme");t?this.paletteEl.setAttribute("data-theme",t):this.paletteEl.removeAttribute("data-theme"),this.paletteEl.classList.add("is-open"),x(),this.inputEl.value="",this._filter(""),this._setActiveIndex(0),this.inputEl.setAttribute("aria-expanded","true"),this._focusTrap=y(this.dialogEl),this._focusTrap.activate(),this._outsideClickCleanup=g(this.dialogEl,()=>this.hide()),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.paletteEl.classList.remove("is-open"),A(),this.inputEl.setAttribute("aria-expanded","false"),(t=this._focusTrap)==null||t.deactivate(),this._focusTrap=null,(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.inputEl.removeEventListener("input",this._handleInput),this.inputEl.removeEventListener("keydown",this._handleKeydown),this.listEl.removeEventListener("mousedown",this._handleItemMousedown),this.listEl.removeEventListener("click",this._handleItemClick),this._shortcut&&document.removeEventListener("keydown",this._handleGlobalShortcut),Ut.delete(this.triggerEl)}};d("command-palette",J);var Yt=h(),Z=class{constructor(t){this.rootEl=t,t.setAttribute("role","tree"),this._setupItems(),this._handleClick=this._handleClick.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleFocusIn=this._handleFocusIn.bind(this),t.addEventListener("click",this._handleClick),t.addEventListener("keydown",this._handleKeydown),t.addEventListener("focusin",this._handleFocusIn),this._resetRovingTabindex(),Yt.set(t,this)}static getInstance(t){return Yt.get(t)}_setupItems(){Array.from(this.rootEl.querySelectorAll("li")).forEach(t=>{var s;t.setAttribute("role","treeitem");let e=this._group(t);if(!e)return;e.setAttribute("role","group"),t.hasAttribute("aria-expanded")||t.setAttribute("aria-expanded","false"),e.hidden=t.getAttribute("aria-expanded")!=="true";let i=(s=t.querySelector(":scope > .fs-tree-label"))!=null?s:t;if(!i.querySelector(":scope > .fs-tree-toggle")){let n=document.createElement("span");n.className="fs-tree-toggle",n.setAttribute("aria-hidden","true"),i.insertBefore(n,i.firstChild)}})}_group(t){return t.querySelector(":scope > ul, :scope > ol")}_isExpanded(t){return t.getAttribute("aria-expanded")==="true"}_isVisible(t){let e=t.parentElement.closest('[role="group"]');for(;e;){if(e.hidden)return!1;e=e.parentElement.closest('[role="group"]')}return!0}_visibleItems(){return Array.from(this.rootEl.querySelectorAll('[role="treeitem"]')).filter(t=>this._isVisible(t))}_resetRovingTabindex(){var i;let t=this._visibleItems(),e=(i=t.find(s=>s.getAttribute("tabindex")==="0"))!=null?i:t[0];t.forEach(s=>s.setAttribute("tabindex",s===e?"0":"-1"))}expand(t){let e=this._group(t);!e||this._isExpanded(t)||(t.setAttribute("aria-expanded","true"),e.hidden=!1,this._resetRovingTabindex(),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:expanded",{bubbles:!0,detail:{item:t}})))}collapse(t){let e=this._group(t);!e||!this._isExpanded(t)||(t.setAttribute("aria-expanded","false"),e.hidden=!0,this._resetRovingTabindex(),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:collapsed",{bubbles:!0,detail:{item:t}})))}toggle(t){this._isExpanded(t)?this.collapse(t):this.expand(t)}select(t){var e;this.rootEl.querySelectorAll('[aria-selected="true"]').forEach(i=>i.setAttribute("aria-selected","false")),t.setAttribute("aria-selected","true"),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:selected",{bubbles:!0,detail:{value:(e=t.dataset.value)!=null?e:t.textContent.trim(),item:t}}))}_handleClick(t){let e=t.target.closest('[role="treeitem"]');e&&(this._group(e)&&this.toggle(e),this.select(e),e.focus())}_handleFocusIn(t){let e=t.target.closest('[role="treeitem"]');!e||!this._isVisible(e)||this._visibleItems().forEach(i=>i.setAttribute("tabindex",i===e?"0":"-1"))}_handleKeydown(t){var a,o,l,c,p,u;let e=t.target.closest('[role="treeitem"]');if(!e)return;let i=this._visibleItems(),s=i.indexOf(e),n=this._group(e);switch(t.key){case"ArrowDown":t.preventDefault(),(a=i[s+1])==null||a.focus();break;case"ArrowUp":t.preventDefault(),(o=i[s-1])==null||o.focus();break;case"ArrowRight":t.preventDefault(),n&&(this._isExpanded(e)?(l=i[s+1])==null||l.focus():this.expand(e));break;case"ArrowLeft":t.preventDefault(),n&&this._isExpanded(e)?this.collapse(e):(c=e.parentElement.closest('[role="treeitem"]'))==null||c.focus();break;case"Home":t.preventDefault(),(p=i[0])==null||p.focus();break;case"End":t.preventDefault(),(u=i[i.length-1])==null||u.focus();break;case"Enter":case" ":t.preventDefault(),n&&this.toggle(e),this.select(e);break;default:return}}dispose(){this.rootEl.removeEventListener("click",this._handleClick),this.rootEl.removeEventListener("keydown",this._handleKeydown),this.rootEl.removeEventListener("focusin",this._handleFocusIn),Yt.delete(this.rootEl)}};d("tree-view",Z);var Vt=h();function We(r){let t=Number(r.min||0),e=Number(r.max||100),i=Number(r.value);return e===t?0:(i-t)/(e-t)*100}var tt=class{constructor(t){let e=t.getAttribute("data-fs-target"),i=e?document.querySelector(e):null;this.inputEl=t,this.outputEl=i,this._handleInput=this._handleInput.bind(this),t.addEventListener("input",this._handleInput),this._render(),Vt.set(t,this)}static getInstance(t){return Vt.get(t)}_handleInput(){this._render()}_render(){this.inputEl.style.setProperty("--fs-range-percent",`${We(this.inputEl)}%`),this.outputEl&&(this.outputEl.textContent=this.inputEl.value)}dispose(){this.inputEl.removeEventListener("input",this._handleInput),Vt.delete(this.inputEl)}};d("range",tt);var Gt=h(),ye=0;function et(r){let t=document.createElement("div");return t.textContent=r,t.innerHTML}function Ue(r){if(r<1024)return`${r} B`;let t=["KB","MB","GB"],e=r,i=-1;do e/=1024,i+=1;while(e>=1024&&i<t.length-1);return`${e.toFixed(1)} ${t[i]}`}function Ye(r){let t=r.lastIndexOf(".");return t===-1?"":r.slice(t+1,t+5).toUpperCase()}var it=class{constructor(t){let e=t.querySelector(".fs-file-input");if(!e)throw new Error("FokusStyles.FileUploadAdvanced: .fs-file-input n\xE3o encontrado.");this.rootEl=t,this.inputEl=e,this.listEl=t.querySelector(".fs-file-upload-list"),this.listEl||(this.listEl=document.createElement("ul"),this.listEl.className="fs-file-upload-list",t.appendChild(this.listEl)),this._items=new Map,this._handleChange=this._handleChange.bind(this),this._handleListClick=this._handleListClick.bind(this),e.addEventListener("change",this._handleChange),this.listEl.addEventListener("click",this._handleListClick),Gt.set(t,this)}static getInstance(t){return Gt.get(t)}getFiles(){return Array.from(this._items.values()).map(t=>t.file)}setProgress(t,e){let i=this._items.get(t);i&&(i.progress=Math.min(100,Math.max(0,e)),i.error=null,this._renderItem(t))}setError(t,e){let i=this._items.get(t);i&&(i.error=e,this._renderItem(t))}remove(t){let e=this._items.get(t);if(!e)return;e.thumbUrl&&URL.revokeObjectURL(e.thumbUrl),this._items.delete(t);let i=this.listEl.querySelector(`[data-file-id="${t}"]`);i==null||i.remove(),this.rootEl.dispatchEvent(new CustomEvent("fs:file-upload:removed",{bubbles:!0,detail:{id:t,file:e.file}}))}_handleChange(){var i;let t=Array.from((i=this.inputEl.files)!=null?i:[]);if(t.length===0)return;let e=[];for(let s of t){ye+=1;let n=`file-${ye}`,a=s.type.startsWith("image/")?URL.createObjectURL(s):null;this._items.set(n,{file:s,progress:0,error:null,thumbUrl:a}),e.push({id:n,file:s}),this._appendItem(n)}this.rootEl.dispatchEvent(new CustomEvent("fs:file-upload:added",{bubbles:!0,detail:{items:e}}))}_handleListClick(t){let e=t.target.closest("[data-file-upload-remove]");if(!e)return;let i=e.closest("[data-file-id]");i&&this.remove(i.getAttribute("data-file-id"))}_appendItem(t){let e=this._items.get(t),i=document.createElement("li");i.className="fs-file-upload-item",i.setAttribute("data-file-id",t),this.listEl.appendChild(i),this._renderItem(t,e)}_renderItem(t,e){let i=e!=null?e:this._items.get(t);if(!i)return;let s=this.listEl.querySelector(`[data-file-id="${t}"]`);if(!s)return;let{file:n,progress:a,error:o,thumbUrl:l}=i,c=l?`<img src="${l}" alt="">`:et(Ye(n.name)||"?");s.classList.toggle("is-error",!!o),s.innerHTML=`
|
|
28
|
+
</li>`).join("")),(t=this.emptyEl)==null||t.toggleAttribute("hidden",this.history.length>0),this._updateBadge()}_handleTriggerClick(t){t.preventDefault(),this.toggle()}_handlePanelClick(t){var s;if(t.target.closest('[data-notification="clear"]')){this.clear();return}let e=t.target.closest("[data-notification-dismiss]");if(e){let i=(s=e.closest(".fs-notification-item"))==null?void 0:s.dataset.id;i&&this.remove(i)}}open(){var s;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.triggerEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.panelEl.setAttribute("data-theme",t):this.panelEl.removeAttribute("data-theme"),this.panelEl.classList.add("is-open");let e=v(this.triggerEl,this.panelEl,{placement:"bottom",align:"end",offset:4});_(this.panelEl,e),this.triggerEl.setAttribute("aria-expanded","true"),this.history.forEach(i=>{i.read=!0}),this._persist(),this._render(),this._outsideClickCleanup=b(this.panelEl,i=>{this.triggerEl.contains(i.target)||this.close()}),this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:opened",{bubbles:!0}))}close(){var t;this.isOpen&&(this.isOpen=!1,this.panelEl.classList.remove("is-open"),this.panelEl.style.removeProperty("position"),this.panelEl.style.removeProperty("top"),this.panelEl.style.removeProperty("left"),this.triggerEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,this.triggerEl.dispatchEvent(new CustomEvent("fs:notification:closed",{bubbles:!0})))}toggle(){this.isOpen?this.close():this.open()}dispose(){this.close(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.panelEl.removeEventListener("click",this._handlePanelClick),Kt.delete(this.triggerEl)}};d("notification-center",Q);var Rt=h();function Bt(r){let t=[];for(let e of r.children){let s=null;e.classList.contains("fs-dropdown-item")?s=e:e.classList.contains("fs-dropdown-submenu")&&(s=e.querySelector(":scope > .fs-dropdown-item")),s&&!s.classList.contains("is-disabled")&&t.push(s)}return t}function Ht(r){return r.classList.contains("fs-dropdown-item-submenu")}var X=class{constructor(t,e={}){var n,a,o,l;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):t.nextElementSibling;if(!i)throw new Error("FokusStyles.NestedMenu: elemento do menu n\xE3o encontrado (data-fs-target).");this.toggleEl=t,this.rootMenu=i,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.align=(l=(o=e.align)!=null?o:t.getAttribute("data-align"))!=null?l:"start",this.isOpen=!1,this._outsideClickCleanup=null,document.body.appendChild(this.rootMenu),this.toggleEl.setAttribute("aria-haspopup","menu"),this.toggleEl.setAttribute("aria-expanded","false"),this.rootMenu.setAttribute("role","menu"),this.rootMenu.querySelectorAll(".fs-dropdown-menu").forEach(c=>c.setAttribute("role","menu")),this.rootMenu.querySelectorAll(".fs-dropdown-item-submenu").forEach(c=>{c.setAttribute("aria-haspopup","menu"),c.setAttribute("aria-expanded","false")}),this._handleToggleClick=this._handleToggleClick.bind(this),this._handleMenuClick=this._handleMenuClick.bind(this),this._handleMenuKeydown=this._handleMenuKeydown.bind(this),this._handleMenuMouseover=this._handleMenuMouseover.bind(this),this.toggleEl.addEventListener("click",this._handleToggleClick),this.rootMenu.addEventListener("click",this._handleMenuClick),this.rootMenu.addEventListener("keydown",this._handleMenuKeydown),this.rootMenu.addEventListener("mouseover",this._handleMenuMouseover),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this.toggleEl.focus())}),Rt.set(t,this)}static getInstance(t){return Rt.get(t)}_submenuOf(t){let e=t.nextElementSibling;return e&&e.classList.contains("fs-dropdown-menu")?e:null}_applyFlip(t){let e=this._submenuOf(t);if(!e)return;let s=t.getBoundingClientRect(),i=e.offsetWidth||180,n=document.documentElement.clientWidth;t.parentElement.classList.toggle("fs-dropdown-submenu-left",s.right+i>n)}_openSubmenu(t,e){var n;let s=this._submenuOf(t);if(!s)return;t.closest(".fs-dropdown-menu").querySelectorAll(":scope > .fs-dropdown-submenu > .fs-dropdown-menu.is-open").forEach(a=>{var o;a!==s&&(a.classList.remove("is-open"),(o=a.previousElementSibling)==null||o.setAttribute("aria-expanded","false"))}),this._applyFlip(t),s.classList.add("is-open"),t.setAttribute("aria-expanded","true"),e&&((n=Bt(s)[0])==null||n.focus())}_closeSubmenu(t){let e=this._submenuOf(t);e&&(e.querySelectorAll(".fs-dropdown-menu.is-open").forEach(s=>{var i;s.classList.remove("is-open"),(i=s.previousElementSibling)==null||i.setAttribute("aria-expanded","false")}),e.classList.remove("is-open"),t.parentElement.classList.remove("fs-dropdown-submenu-left"),t.setAttribute("aria-expanded","false"))}_closeAllSubmenus(){this.rootMenu.querySelectorAll(".fs-dropdown-menu.is-open").forEach(t=>{var e;t.classList.remove("is-open"),(e=t.previousElementSibling)==null||e.setAttribute("aria-expanded","false")}),this.rootMenu.querySelectorAll(".fs-dropdown-submenu-left").forEach(t=>t.classList.remove("fs-dropdown-submenu-left"))}_handleToggleClick(t){t.preventDefault(),this.toggle()}_handleMenuClick(t){var s;let e=t.target.closest(".fs-dropdown-item");if(!(!e||e.classList.contains("is-disabled"))){if(Ht(e)){t.preventDefault(),(s=this._submenuOf(e))!=null&&s.classList.contains("is-open")?this._closeSubmenu(e):this._openSubmenu(e,!1);return}this.hide(),this.toggleEl.focus()}}_handleMenuMouseover(t){let e=t.target.closest(".fs-dropdown-item-submenu");this.rootMenu.querySelectorAll(".fs-dropdown-menu.is-open").forEach(s=>{var i;!s.contains(t.target)&&s!==(e==null?void 0:e.nextElementSibling)&&(s.classList.remove("is-open"),(i=s.previousElementSibling)==null||i.setAttribute("aria-expanded","false"))}),e&&this._applyFlip(e)}_handleMenuKeydown(t){var l,c,p,u;let e=document.activeElement;if(!((l=e==null?void 0:e.classList)!=null&&l.contains("fs-dropdown-item")))return;let s=e.closest(".fs-dropdown-menu"),i=Bt(s),n=i.indexOf(e),a=s.parentElement,o=a==null?void 0:a.classList.contains("fs-dropdown-submenu");switch(t.key){case"ArrowDown":t.preventDefault(),(c=i[(n+1)%i.length])==null||c.focus();break;case"ArrowUp":t.preventDefault(),(p=i[(n-1+i.length)%i.length])==null||p.focus();break;case"ArrowRight":Ht(e)&&(t.preventDefault(),this._openSubmenu(e,!0));break;case"ArrowLeft":if(o){t.preventDefault();let E=a.querySelector(":scope > .fs-dropdown-item");this._closeSubmenu(E),E.focus()}break;case"Enter":case" ":Ht(e)&&(t.preventDefault(),(u=this._submenuOf(e))!=null&&u.classList.contains("is-open")?this._closeSubmenu(e):this._openSubmenu(e,!0));break;case"Escape":if(o){t.preventDefault(),t.stopPropagation();let E=a.querySelector(":scope > .fs-dropdown-item");this._closeSubmenu(E),E.focus()}else t.preventDefault(),this.hide(),this.toggleEl.focus();break;default:break}}show(){var s,i;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.toggleEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.rootMenu.setAttribute("data-theme",t):this.rootMenu.removeAttribute("data-theme"),this.rootMenu.classList.add("is-open");let e=v(this.toggleEl,this.rootMenu,{placement:this.placement,align:this.align,offset:4});_(this.rootMenu,e),this.toggleEl.setAttribute("aria-expanded","true"),(i=Bt(this.rootMenu)[0])==null||i.focus(),this._outsideClickCleanup=b(this.rootMenu,n=>{this.toggleEl.contains(n.target)||this.hide()}),this.toggleEl.dispatchEvent(new CustomEvent("fs:nested-menu:shown",{bubbles:!0}))}hide(){var t;this.isOpen&&(this.isOpen=!1,this._closeAllSubmenus(),this.rootMenu.classList.remove("is-open"),this.rootMenu.style.removeProperty("position"),this.rootMenu.style.removeProperty("top"),this.rootMenu.style.removeProperty("left"),this.toggleEl.setAttribute("aria-expanded","false"),(t=this._outsideClickCleanup)==null||t.call(this),this._outsideClickCleanup=null,this.toggleEl.dispatchEvent(new CustomEvent("fs:nested-menu:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.toggleEl.removeEventListener("click",this._handleToggleClick),this.rootMenu.removeEventListener("click",this._handleMenuClick),this.rootMenu.removeEventListener("keydown",this._handleMenuKeydown),this.rootMenu.removeEventListener("mouseover",this._handleMenuMouseover),Rt.delete(this.toggleEl)}};d("nested-menu",X);var zt=h(),Ee=0;function ve(r){return Ee+=1,`${r}-${Ee}`}var J=class{constructor(t,e={}){var n,a;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):t.nextElementSibling;if(!i)throw new Error("FokusStyles.Combobox: listbox n\xE3o encontrada (data-fs-target).");this.inputEl=t,this.listboxEl=i,this.placement=(a=(n=e.placement)!=null?n:t.getAttribute("data-placement"))!=null?a:"bottom",this.isOpen=!1,this.activeIndex=-1,this.value=null,this._outsideClickCleanup=null,this.listboxEl.id||(this.listboxEl.id=ve("fs-combobox-listbox")),document.body.appendChild(this.listboxEl),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-controls",this.listboxEl.id),this.inputEl.setAttribute("autocomplete","off"),this.listboxEl.setAttribute("role","listbox"),this._getOptions().forEach(o=>{o.id||(o.id=ve("fs-combobox-option")),o.setAttribute("role","option"),o.setAttribute("aria-selected","false")}),this._handleInput=this._handleInput.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleOptionMousedown=this._handleOptionMousedown.bind(this),this._handleOptionClick=this._handleOptionClick.bind(this),this.inputEl.addEventListener("input",this._handleInput),this.inputEl.addEventListener("keydown",this._handleKeydown),this.listboxEl.addEventListener("mousedown",this._handleOptionMousedown),this.listboxEl.addEventListener("click",this._handleOptionClick),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),zt.set(t,this)}static getInstance(t){return zt.get(t)}_getOptions(){return Array.from(this.listboxEl.querySelectorAll(".fs-dropdown-item"))}_getSelectableOptions(){return this._getOptions().filter(t=>!t.hidden&&!t.hasAttribute("data-fs-empty")&&!t.classList.contains("is-disabled"))}_filter(t){let e=t.trim().toLowerCase();this._getOptions().forEach(i=>{i.hasAttribute("data-fs-empty")||(i.hidden=e.length>0&&!i.textContent.toLowerCase().includes(e))});let s=this.listboxEl.querySelector("[data-fs-empty]");s&&(s.hidden=this._getSelectableOptions().length>0)}_setActiveIndex(t){let e=this._getSelectableOptions();if(e.length===0){this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant");return}let s=e[this.activeIndex];s==null||s.classList.remove("is-active"),this.activeIndex=(t%e.length+e.length)%e.length;let i=e[this.activeIndex];i.classList.add("is-active"),i.scrollIntoView({block:"nearest"}),this.inputEl.setAttribute("aria-activedescendant",i.id)}_selectOption(t){var s;let e=t.textContent.trim();this.value=(s=t.getAttribute("data-value"))!=null?s:e,this.inputEl.value=e,this._getOptions().forEach(i=>i.setAttribute("aria-selected",String(i===t))),this.hide(),this.inputEl.focus(),this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})),this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:changed",{bubbles:!0,detail:{value:this.value,label:e}}))}_handleInput(){this._filter(this.inputEl.value),this.show(),this._setActiveIndex(-1)}_handleKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this.isOpen?this._setActiveIndex(this.activeIndex+1):this.show()):t.key==="ArrowUp"?(t.preventDefault(),this.isOpen?this._setActiveIndex(this.activeIndex-1):this.show()):t.key==="Home"&&this.isOpen?(t.preventDefault(),this._setActiveIndex(0)):t.key==="End"&&this.isOpen?(t.preventDefault(),this._setActiveIndex(this._getSelectableOptions().length-1)):t.key==="Enter"&&this.isOpen&&this.activeIndex>=0&&(t.preventDefault(),this._selectOption(this._getSelectableOptions()[this.activeIndex]))}_handleOptionMousedown(t){t.target.closest(".fs-dropdown-item")&&t.preventDefault()}_handleOptionClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");!e||e.hasAttribute("data-fs-empty")||this._selectOption(e)}show(){var s;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.inputEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.listboxEl.setAttribute("data-theme",t):this.listboxEl.removeAttribute("data-theme"),this.listboxEl.classList.add("is-open"),this.listboxEl.style.width=`${this.inputEl.offsetWidth}px`;let e=v(this.inputEl,this.listboxEl,{placement:this.placement,align:"start",offset:4});_(this.listboxEl,e),this.inputEl.setAttribute("aria-expanded","true"),this._outsideClickCleanup=b(this.listboxEl,i=>{this.inputEl.contains(i.target)||this.hide()}),this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,(t=this._getSelectableOptions()[this.activeIndex])==null||t.classList.remove("is-active"),this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant"),this.listboxEl.classList.remove("is-open"),this.listboxEl.style.removeProperty("position"),this.listboxEl.style.removeProperty("top"),this.listboxEl.style.removeProperty("left"),this.listboxEl.style.removeProperty("width"),this.inputEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.inputEl.dispatchEvent(new CustomEvent("fs:combobox:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.inputEl.removeEventListener("input",this._handleInput),this.inputEl.removeEventListener("keydown",this._handleKeydown),this.listboxEl.removeEventListener("mousedown",this._handleOptionMousedown),this.listboxEl.removeEventListener("click",this._handleOptionClick),zt.delete(this.inputEl)}};d("combobox",J);var Wt=h(),We=new Intl.DateTimeFormat("pt-BR",{weekday:"narrow"}),Ue=new Intl.DateTimeFormat("pt-BR",{month:"long",year:"numeric"}),_e=0;function Ye(r){return _e+=1,`${r}-${_e}`}function gt(r){return String(r).padStart(2,"0")}function Ut(r){return`${r.getFullYear()}-${gt(r.getMonth()+1)}-${gt(r.getDate())}`}function Ve(r){return`${gt(r.getDate())}/${gt(r.getMonth()+1)}/${r.getFullYear()}`}function ye(r){let t=r.trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(!t)return null;let[,e,s,i]=t,n=new Date(Number(i),Number(s)-1,Number(e));return Number.isNaN(n.getTime())?null:n.getFullYear()===Number(i)&&n.getMonth()===Number(s)-1&&n.getDate()===Number(e)?n:null}function Yt(r,t){return r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate()}function Ge(r){let t=r.getFullYear(),e=r.getMonth(),s=new Date(t,e,1).getDay(),i=new Date(t,e+1,0).getDate(),n=new Date(t,e,0).getDate(),a=[];for(let l=s-1;l>=0;l-=1){let c=n-l,p=e===0?11:e-1;a.push({year:e===0?t-1:t,month:p,day:c,outside:!0})}for(let l=1;l<=i;l+=1)a.push({year:t,month:e,day:l,outside:!1});let o=1;for(;a.length%7!==0;){let l=e===11?0:e+1;a.push({year:e===11?t+1:t,month:l,day:o,outside:!0}),o+=1}return a}var Z=class{constructor(t,e={}){var a,o;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):t.nextElementSibling;if(!i)throw new Error("FokusStyles.Datepicker: painel n\xE3o encontrado (data-fs-target).");this.inputEl=t,this.panelEl=i,this.placement=(o=(a=e.placement)!=null?a:t.getAttribute("data-placement"))!=null?o:"bottom",this.isOpen=!1,this._suppressNextFocus=!1;let n=ye(t.value);this.selectedDate=n,this.viewDate=n?new Date(n):new Date,this.value=n?Ut(n):null,this._outsideClickCleanup=null,this._positionCleanup=null,this._originalParent=i.parentNode,this._originalNextSibling=i.nextSibling,this.panelEl.id||(this.panelEl.id=Ye("fs-datepicker-panel")),document.body.appendChild(this.panelEl),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-haspopup","grid"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-controls",this.panelEl.id),this.inputEl.setAttribute("autocomplete","off"),this.panelEl.classList.add("fs-datepicker-panel"),this.panelEl.innerHTML='<div class="fs-datepicker-header"><button type="button" class="fs-datepicker-nav" data-fs-datepicker-prev aria-label="M\xEAs anterior">\u2039</button><span class="fs-datepicker-title" aria-live="polite"></span><button type="button" class="fs-datepicker-nav" data-fs-datepicker-next aria-label="Pr\xF3ximo m\xEAs">\u203A</button></div><div class="fs-datepicker-grid" role="grid"></div>',this.titleEl=this.panelEl.querySelector(".fs-datepicker-title"),this.gridEl=this.panelEl.querySelector(".fs-datepicker-grid"),this.prevBtn=this.panelEl.querySelector("[data-fs-datepicker-prev]"),this.nextBtn=this.panelEl.querySelector("[data-fs-datepicker-next]"),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleInputKeydown=this._handleInputKeydown.bind(this),this._handleInputChange=this._handleInputChange.bind(this),this._handlePrev=this._handlePrev.bind(this),this._handleNext=this._handleNext.bind(this),this._handleGridClick=this._handleGridClick.bind(this),this._handleGridKeydown=this._handleGridKeydown.bind(this),this.inputEl.addEventListener("focus",this._handleInputFocus),this.inputEl.addEventListener("keydown",this._handleInputKeydown),this.inputEl.addEventListener("change",this._handleInputChange),this.prevBtn.addEventListener("click",this._handlePrev),this.nextBtn.addEventListener("click",this._handleNext),this.gridEl.addEventListener("click",this._handleGridClick),this.gridEl.addEventListener("keydown",this._handleGridKeydown),this._removeEscapeListener=f(()=>{this.isOpen&&(this.hide(),this._refocusInputWithoutReopening())}),Wt.set(t,this)}static getInstance(t){return Wt.get(t)}_handleInputFocus(){if(this._suppressNextFocus){this._suppressNextFocus=!1;return}this.show()}_refocusInputWithoutReopening(){this._suppressNextFocus=!0,this.inputEl.focus()}_handleInputKeydown(t){t.key!=="ArrowDown"&&t.key!=="ArrowUp"||(t.preventDefault(),this.isOpen||this.show(),this._focusTabbable())}_handleInputChange(){let t=ye(this.inputEl.value);t&&(this.selectedDate=t,this.viewDate=new Date(t),this.value=Ut(t),this.isOpen&&this._render())}_handlePrev(t){t.preventDefault(),this.viewDate=new Date(this.viewDate.getFullYear(),this.viewDate.getMonth()-1,1),this._render()}_handleNext(t){t.preventDefault(),this.viewDate=new Date(this.viewDate.getFullYear(),this.viewDate.getMonth()+1,1),this._render()}_handleGridClick(t){let e=t.target.closest(".fs-datepicker-day:not(:disabled)");e&&this._selectDate(new Date(Number(e.dataset.year),Number(e.dataset.month),Number(e.dataset.day)))}_handleGridKeydown(t){let e=t.target.closest(".fs-datepicker-day");if(!e)return;let s=new Date(Number(e.dataset.year),Number(e.dataset.month),Number(e.dataset.day)),i=null;switch(t.key){case"ArrowRight":i=new Date(s),i.setDate(i.getDate()+1);break;case"ArrowLeft":i=new Date(s),i.setDate(i.getDate()-1);break;case"ArrowDown":i=new Date(s),i.setDate(i.getDate()+7);break;case"ArrowUp":i=new Date(s),i.setDate(i.getDate()-7);break;case"Home":i=new Date(s),i.setDate(i.getDate()-i.getDay());break;case"End":i=new Date(s),i.setDate(i.getDate()+(6-i.getDay()));break;case"PageUp":i=t.shiftKey?new Date(s.getFullYear()-1,s.getMonth(),s.getDate()):new Date(s.getFullYear(),s.getMonth()-1,s.getDate());break;case"PageDown":i=t.shiftKey?new Date(s.getFullYear()+1,s.getMonth(),s.getDate()):new Date(s.getFullYear(),s.getMonth()+1,s.getDate());break;case"Enter":case" ":t.preventDefault(),this._selectDate(s);return;default:return}t.preventDefault(),this._moveTo(i)}_moveTo(t){t.getFullYear()===this.viewDate.getFullYear()&&t.getMonth()===this.viewDate.getMonth()||(this.viewDate=new Date(t.getFullYear(),t.getMonth(),1)),this._render(t),this._focusTabbable()}_selectDate(t){this.selectedDate=t,this.viewDate=new Date(t),this.value=Ut(t),this.inputEl.value=Ve(t),this.hide(),this._refocusInputWithoutReopening(),this.inputEl.dispatchEvent(new Event("change",{bubbles:!0})),this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:changed",{bubbles:!0,detail:{value:this.value,date:new Date(t)}}))}_focusTabbable(){var t;(t=this.gridEl.querySelector('.fs-datepicker-day[tabindex="0"]'))==null||t.focus()}_render(t){var c,p;this.titleEl.textContent=Ue.format(this.viewDate);let e=Ge(this.viewDate),s=new Date,i=(c=t!=null?t:this.selectedDate)!=null?c:s,n=e.find(u=>!u.outside&&Yt(new Date(u.year,u.month,u.day),i));n||(n=(p=e.find(u=>!u.outside))!=null?p:e[0]);let a=Array.from({length:7},(u,E)=>{let g=new Date(2024,0,7+E);return`<div class="fs-datepicker-weekday" role="columnheader">${We.format(g)}</div>`}).join(""),o=[];for(let u=0;u<e.length;u+=7)o.push(e.slice(u,u+7));let l=o.map(u=>`<div class="fs-datepicker-week" role="row">${u.map(g=>{let m=new Date(g.year,g.month,g.day),y=this.selectedDate?Yt(m,this.selectedDate):!1,w=Yt(m,s),Et=g===n,P=["fs-datepicker-day"];return g.outside&&P.push("is-outside"),w&&P.push("is-today"),y&&P.push("is-selected"),`<button type="button" class="${P.join(" ")}" role="gridcell" tabindex="${Et?"0":"-1"}" aria-selected="${y}" data-year="${g.year}" data-month="${g.month}" data-day="${g.day}">${g.day}</button>`}).join("")}</div>`).join("");this.gridEl.innerHTML=`<div class="fs-datepicker-weekdays" role="row">${a}</div>${l}`}show(){var s,i;if(this.isOpen)return;this.isOpen=!0;let t=(s=this.inputEl.closest("[data-theme]"))==null?void 0:s.getAttribute("data-theme");t?this.panelEl.setAttribute("data-theme",t):this.panelEl.removeAttribute("data-theme"),this.panelEl.classList.add("is-open");let e=v(this.inputEl,this.panelEl,{placement:this.placement,align:"start",offset:4});_(this.panelEl,e),this._positionCleanup=k(this.inputEl,this.panelEl,{placement:this.placement,align:"start",offset:4}),this.inputEl.setAttribute("aria-expanded","true"),this._render((i=this.selectedDate)!=null?i:new Date),this._outsideClickCleanup=b(this.panelEl,n=>{this.inputEl.contains(n.target)||this.hide()}),this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.panelEl.classList.remove("is-open"),this.panelEl.style.removeProperty("position"),this.panelEl.style.removeProperty("top"),this.panelEl.style.removeProperty("left"),(t=this._positionCleanup)==null||t.call(this),this._positionCleanup=null,this.inputEl.setAttribute("aria-expanded","false"),(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.inputEl.dispatchEvent(new CustomEvent("fs:datepicker:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.inputEl.removeEventListener("focus",this._handleInputFocus),this.inputEl.removeEventListener("keydown",this._handleInputKeydown),this.inputEl.removeEventListener("change",this._handleInputChange),this.prevBtn.removeEventListener("click",this._handlePrev),this.nextBtn.removeEventListener("click",this._handleNext),this.gridEl.removeEventListener("click",this._handleGridClick),this.gridEl.removeEventListener("keydown",this._handleGridKeydown),this._originalParent&&this._originalParent.insertBefore(this.panelEl,this._originalNextSibling),Wt.delete(this.inputEl)}};d("datepicker",Z);var Vt=h(),Gt=5,je='<svg class="fs-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>',Qe='<svg class="fs-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';function Xe(r,t){let e=Number(r),s=Number(t);return r!==""&&t!==""&&!Number.isNaN(e)&&!Number.isNaN(s)?e-s:r.localeCompare(t,"pt-BR",{sensitivity:"base"})}function Je(r,t,e){if(e==="date")return new Date(r).getTime()-new Date(t).getTime();if(e==="number"||e==="currency"){let s=i=>Number(String(i).replace(/[^\d,-]/g,"").replace(/\./g,"").replace(",","."));return s(r)-s(t)}return Xe(r,t)}var tt=class{constructor(t,e={}){let s=t.querySelector(".fs-table");if(!s)throw new Error("FokusStyles.DataTable: tabela n\xE3o encontrada (.fs-table).");let i=s.querySelector("tbody");if(!i)throw new Error("FokusStyles.DataTable: <tbody> n\xE3o encontrado.");this.rootEl=t,this.tableEl=s,this.theadEl=s.querySelector("thead"),this.tbodyEl=i,this.pageSize=Number(t.getAttribute("data-fs-page-size"))||e.pageSize||10,this.filterInput=t.querySelector("[data-fs-datatable-filter]"),this.emptyEl=t.querySelector("[data-fs-datatable-empty]"),this.loadingEl=t.querySelector("[data-fs-datatable-loading]"),this.errorEl=t.querySelector("[data-fs-datatable-error]"),this.paginationEl=t.querySelector("[data-fs-datatable-pagination]"),this.paginationEl||(this.paginationEl=document.createElement("nav"),this.paginationEl.setAttribute("data-fs-datatable-pagination",""),this.paginationEl.setAttribute("aria-label","Pagina\xE7\xE3o da tabela"),t.appendChild(this.paginationEl)),this.sortKey=null,this.sortDirection="none",this.filterQuery="",this.currentPage=1,this._loading=!1,this._error=null,this._rows=[],this._sortButtons=[],this._buildSortHeaders(),this._readRows(),this._handleSortClick=this._handleSortClick.bind(this),this._handleFilterInput=this._handleFilterInput.bind(this),this._handlePaginationClick=this._handlePaginationClick.bind(this),this._handleCellKeydown=this._handleCellKeydown.bind(this),this._handleCellFocusIn=this._handleCellFocusIn.bind(this),this.theadEl&&this.theadEl.addEventListener("click",this._handleSortClick),this.filterInput&&this.filterInput.addEventListener("input",this._handleFilterInput),this.paginationEl.addEventListener("click",this._handlePaginationClick),this.tbodyEl.addEventListener("keydown",this._handleCellKeydown),this.tbodyEl.addEventListener("focusin",this._handleCellFocusIn),this._render(),this.tableEl.setAttribute("aria-busy","false"),Vt.set(t,this)}static getInstance(t){return Vt.get(t)}get pageCount(){return Math.max(1,Math.ceil(this._matchedRows().length/this.pageSize))}get rowCount(){return this._matchedRows().length}_buildSortHeaders(){this.theadEl&&(this._sortButtons=Array.from(this.theadEl.querySelectorAll("th[data-fs-sort]")).map(t=>{let e=t.getAttribute("data-fs-sort"),s=document.createElement("button");for(s.type="button",s.className="fs-datatable-sort-btn",s.setAttribute("data-fs-sort-key",e);t.firstChild;)s.appendChild(t.firstChild);return t.appendChild(s),t.setAttribute("aria-sort","none"),{th:t,key:e}}))}_readRows(){this._rows=Array.from(this.tbodyEl.querySelectorAll(":scope > tr")).map((t,e)=>({el:t,order:e,cells:Array.from(t.children).map(s=>{var i;return((i=s.getAttribute("data-fs-sort-value"))!=null?i:s.textContent).trim()})}))}refresh(){this._readRows(),this.currentPage=1,this._render()}_matchedRows(){var e,s;let t=this._rows;if(this.filterQuery){let i=this.filterQuery.toLowerCase();t=t.filter(n=>n.cells.some(a=>a.toLowerCase().includes(i)))}if(this.sortKey&&this.sortDirection!=="none"){let i=(e=this._sortButtons.find(o=>o.key===this.sortKey))==null?void 0:e.th,n=i?Array.from(this.theadEl.querySelectorAll("th")).indexOf(i):-1,a=(s=i==null?void 0:i.getAttribute("data-fs-sort-type"))!=null?s:"text";if(n>=0){let o=this.sortDirection==="asc"?1:-1;t=[...t].sort((l,c)=>{var p,u;return o*Je((p=l.cells[n])!=null?p:"",(u=c.cells[n])!=null?u:"",a)})}}else t=[...t].sort((i,n)=>i.order-n.order);return t}_nextDirection(t){return this.sortKey!==t?"asc":this.sortDirection==="asc"?"desc":this.sortDirection==="desc"?"none":"asc"}sort(t,e="asc"){this.sortKey=e==="none"?null:t,this.sortDirection=e,this.currentPage=1,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:sorted",{bubbles:!0,detail:{key:this.sortKey,direction:this.sortDirection}}))}filter(t){this.filterQuery=(t!=null?t:"").trim(),this.filterInput&&(this.filterInput.value=this.filterQuery),this.currentPage=1,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:filtered",{bubbles:!0,detail:{query:this.filterQuery,matched:this.rowCount}}))}goToPage(t){let e=this.pageCount,s=Math.min(Math.max(1,t),e);s!==this.currentPage&&(this.currentPage=s,this._render(),this.rootEl.dispatchEvent(new CustomEvent("fs:datatable:paged",{bubbles:!0,detail:{page:this.currentPage,pageCount:e}})))}setLoading(t){this._loading=!!t,this.tableEl.setAttribute("aria-busy",String(this._loading)),this._loading&&(this._error=null),this._syncVisibility()}setError(t){var e;if(this._error=t||null,this._error&&(this._loading=!1),this.tableEl.setAttribute("aria-busy",String(this._loading)),this.errorEl){let s=this.errorEl.querySelector("[data-fs-datatable-error-message]");s&&(s.textContent=(e=this._error)!=null?e:"")}this._syncVisibility()}_syncVisibility(){let t=this._loading,e=!this._loading&&!!this._error,s=!t&&!e;this.tableEl.hidden=!s,this.filterInput&&(this.filterInput.disabled=!s),this.loadingEl&&(this.loadingEl.hidden=!t),this.errorEl&&(this.errorEl.hidden=!e),s?this._render():(this.paginationEl.hidden=!0,this.emptyEl&&(this.emptyEl.hidden=!0))}_render(){if(this._loading||this._error)return;let t=this._matchedRows(),e=Math.max(1,Math.ceil(t.length/this.pageSize));this.currentPage=Math.min(Math.max(1,this.currentPage),e);let s=(this.currentPage-1)*this.pageSize,i=t.slice(s,s+this.pageSize);i.forEach(a=>this.tbodyEl.appendChild(a.el)),this._rows.forEach(a=>{a.el.hidden=!i.includes(a)});let n=t.length===0;this.tableEl.hidden=n&&!!this.emptyEl,this.emptyEl&&(this.emptyEl.hidden=!n),this._renderPagination(e),this._syncAriaSort(),this._resetRovingTabindex()}_syncAriaSort(){this._sortButtons.forEach(({th:t,key:e})=>{let s=e===this.sortKey?this.sortDirection:"none";t.setAttribute("aria-sort",s==="asc"?"ascending":s==="desc"?"descending":"none")})}_renderPagination(t){if(this.paginationEl.hidden=t<=1,t<=1){this.paginationEl.innerHTML="";return}let e=Math.min(t,Math.max(Gt,this.currentPage+Math.floor(Gt/2))),s=Math.max(1,e-Gt+1),i=[this._pageItem(je,this.currentPage-1,this.currentPage===1,"P\xE1gina anterior")];for(let n=s;n<=e;n+=1)i.push(this._pageItem(String(n),n,!1,`P\xE1gina ${n}`,n===this.currentPage));i.push(this._pageItem(Qe,this.currentPage+1,this.currentPage===t,"Pr\xF3xima p\xE1gina")),this.paginationEl.innerHTML=`<ul class="fs-pagination">${i.join("")}</ul>`}_pageItem(t,e,s,i,n=!1){let a=["fs-page-item"];return s&&a.push("is-disabled"),n&&a.push("is-active"),`<li class="${a.join(" ")}"><button type="button" class="fs-page-link" data-fs-page="${e}" aria-label="${i}"${n?' aria-current="page"':""}${s?" disabled":""}>${t}</button></li>`}_handleSortClick(t){let e=t.target.closest("[data-fs-sort-key]");if(!e)return;let s=e.dataset.fsSortKey;this.sort(s,this._nextDirection(s))}_handleFilterInput(){this.filter(this.filterInput.value)}_handlePaginationClick(t){let e=t.target.closest("[data-fs-page]");!e||e.disabled||this.goToPage(Number(e.dataset.fsPage))}_visibleCells(){return Array.from(this.tbodyEl.querySelectorAll("tr:not([hidden]) > td, tr:not([hidden]) > th"))}_resetRovingTabindex(){this._visibleCells().forEach((t,e)=>t.setAttribute("tabindex",e===0?"0":"-1"))}_handleCellFocusIn(t){let e=t.target.closest("td, th");!e||e.parentElement.hidden||this._visibleCells().forEach(s=>s.setAttribute("tabindex",s===e?"0":"-1"))}_handleCellKeydown(t){var c,p,u;let e=t.target.closest("td, th");if(!e)return;let s=Array.from(this.tbodyEl.querySelectorAll("tr:not([hidden])")),i=s.indexOf(e.parentElement);if(i===-1)return;let n=Array.from(e.parentElement.children),a=n.indexOf(e),o=s[s.length-1],l=null;switch(t.key){case"ArrowRight":l=n[a+1];break;case"ArrowLeft":l=n[a-1];break;case"ArrowDown":l=(c=s[i+1])==null?void 0:c.children[a];break;case"ArrowUp":l=(p=s[i-1])==null?void 0:p.children[a];break;case"Home":l=t.ctrlKey?(u=s[0])==null?void 0:u.children[0]:n[0];break;case"End":l=t.ctrlKey?o==null?void 0:o.children[o.children.length-1]:n[n.length-1];break;default:return}l&&(t.preventDefault(),l.focus())}dispose(){this.theadEl&&this.theadEl.removeEventListener("click",this._handleSortClick),this.filterInput&&this.filterInput.removeEventListener("input",this._handleFilterInput),this.paginationEl.removeEventListener("click",this._handlePaginationClick),this.tbodyEl.removeEventListener("keydown",this._handleCellKeydown),this.tbodyEl.removeEventListener("focusin",this._handleCellFocusIn),Vt.delete(this.rootEl)}};d("datatable",tt);var jt=h(),we=0;function Ce(r){return we+=1,`${r}-${we}`}function Ze(r){let t=r.toLowerCase().split("+").map(e=>e.trim());return{mod:t.includes("mod"),shift:t.includes("shift"),alt:t.includes("alt"),key:t[t.length-1]}}function ts(r,t){let e=r.ctrlKey||r.metaKey;return r.key.toLowerCase()===t.key&&t.mod===e&&t.shift===r.shiftKey&&t.alt===r.altKey}var et=class{constructor(t,e={}){var a,o;let s=t.getAttribute("data-fs-target"),i=s?document.querySelector(s):null;if(!i)throw new Error("FokusStyles.CommandPalette: painel n\xE3o encontrado (data-fs-target).");this.triggerEl=t,this.paletteEl=i,this.dialogEl=(a=i.querySelector(".fs-command-palette-dialog"))!=null?a:i,this.inputEl=i.querySelector(".fs-command-palette-input"),this.listEl=i.querySelector(".fs-command-palette-list"),this.isOpen=!1,this.activeIndex=-1,this._focusTrap=null,this._outsideClickCleanup=null,this.listEl.id||(this.listEl.id=Ce("fs-command-palette-listbox")),i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),this.inputEl.setAttribute("role","combobox"),this.inputEl.setAttribute("aria-expanded","false"),this.inputEl.setAttribute("aria-autocomplete","list"),this.inputEl.setAttribute("aria-controls",this.listEl.id),this.inputEl.setAttribute("autocomplete","off"),this.listEl.setAttribute("role","listbox"),this._getItems().forEach(l=>{l.id||(l.id=Ce("fs-command-palette-option")),l.setAttribute("role","option"),l.setAttribute("aria-selected","false")}),this._handleTriggerClick=this._handleTriggerClick.bind(this),this._handleInput=this._handleInput.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleItemMousedown=this._handleItemMousedown.bind(this),this._handleItemClick=this._handleItemClick.bind(this),this._handleGlobalShortcut=this._handleGlobalShortcut.bind(this),t.addEventListener("click",this._handleTriggerClick),this.inputEl.addEventListener("input",this._handleInput),this.inputEl.addEventListener("keydown",this._handleKeydown),this.listEl.addEventListener("mousedown",this._handleItemMousedown),this.listEl.addEventListener("click",this._handleItemClick);let n=(o=e.shortcut)!=null?o:t.getAttribute("data-fs-shortcut");this._shortcut=n?Ze(n):null,this._shortcut&&document.addEventListener("keydown",this._handleGlobalShortcut),this._removeEscapeListener=f(()=>{this.isOpen&&this.hide()}),jt.set(t,this)}static getInstance(t){return jt.get(t)}_getItems(){return Array.from(this.listEl.querySelectorAll(".fs-dropdown-item"))}_getSelectableItems(){return this._getItems().filter(t=>!t.hidden&&!t.hasAttribute("data-fs-empty")&&!t.classList.contains("is-disabled"))}_filter(t){let e=t.trim().toLowerCase();this._getItems().forEach(i=>{i.hasAttribute("data-fs-empty")||(i.hidden=e.length>0&&!i.textContent.toLowerCase().includes(e))});let s=this.listEl.querySelector("[data-fs-empty]");s&&(s.hidden=this._getSelectableItems().length>0)}_setActiveIndex(t){let e=this._getSelectableItems();if(e.length===0){this.activeIndex=-1,this.inputEl.removeAttribute("aria-activedescendant");return}let s=e[this.activeIndex];s==null||s.classList.remove("is-active"),this.activeIndex=(t%e.length+e.length)%e.length;let i=e[this.activeIndex];i.classList.add("is-active"),i.scrollIntoView({block:"nearest"}),this.inputEl.setAttribute("aria-activedescendant",i.id)}_selectItem(t){var i;let e=t.textContent.trim(),s=(i=t.getAttribute("data-value"))!=null?i:e;this.hide(),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:selected",{bubbles:!0,detail:{value:s,label:e}}))}_handleTriggerClick(t){t.preventDefault(),this.toggle()}_handleInput(){this._filter(this.inputEl.value),this._setActiveIndex(0)}_handleKeydown(t){t.key==="ArrowDown"?(t.preventDefault(),this._setActiveIndex(this.activeIndex+1)):t.key==="ArrowUp"?(t.preventDefault(),this._setActiveIndex(this.activeIndex-1)):t.key==="Enter"&&this.activeIndex>=0&&(t.preventDefault(),this._selectItem(this._getSelectableItems()[this.activeIndex]))}_handleItemMousedown(t){t.target.closest(".fs-dropdown-item")&&t.preventDefault()}_handleItemClick(t){let e=t.target.closest(".fs-dropdown-item:not(.is-disabled)");!e||e.hasAttribute("data-fs-empty")||this._selectItem(e)}_handleGlobalShortcut(t){ts(t,this._shortcut)&&(t.preventDefault(),this.toggle())}show(){var e;if(this.isOpen)return;this.isOpen=!0;let t=(e=this.triggerEl.closest("[data-theme]"))==null?void 0:e.getAttribute("data-theme");t?this.paletteEl.setAttribute("data-theme",t):this.paletteEl.removeAttribute("data-theme"),this.paletteEl.classList.add("is-open"),x(),this.inputEl.value="",this._filter(""),this._setActiveIndex(0),this.inputEl.setAttribute("aria-expanded","true"),this._focusTrap=C(this.dialogEl),this._focusTrap.activate(),this._outsideClickCleanup=b(this.dialogEl,()=>this.hide()),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:shown",{bubbles:!0}))}hide(){var t,e;this.isOpen&&(this.isOpen=!1,this.paletteEl.classList.remove("is-open"),L(),this.inputEl.setAttribute("aria-expanded","false"),(t=this._focusTrap)==null||t.deactivate(),this._focusTrap=null,(e=this._outsideClickCleanup)==null||e.call(this),this._outsideClickCleanup=null,this.triggerEl.focus(),this.triggerEl.dispatchEvent(new CustomEvent("fs:command-palette:hidden",{bubbles:!0})))}toggle(){this.isOpen?this.hide():this.show()}dispose(){this.hide(),this._removeEscapeListener(),this.triggerEl.removeEventListener("click",this._handleTriggerClick),this.inputEl.removeEventListener("input",this._handleInput),this.inputEl.removeEventListener("keydown",this._handleKeydown),this.listEl.removeEventListener("mousedown",this._handleItemMousedown),this.listEl.removeEventListener("click",this._handleItemClick),this._shortcut&&document.removeEventListener("keydown",this._handleGlobalShortcut),jt.delete(this.triggerEl)}};d("command-palette",et);var Qt=h(),st=class{constructor(t){this.rootEl=t,t.setAttribute("role","tree"),this._setupItems(),this._handleClick=this._handleClick.bind(this),this._handleKeydown=this._handleKeydown.bind(this),this._handleFocusIn=this._handleFocusIn.bind(this),t.addEventListener("click",this._handleClick),t.addEventListener("keydown",this._handleKeydown),t.addEventListener("focusin",this._handleFocusIn),this._resetRovingTabindex(),Qt.set(t,this)}static getInstance(t){return Qt.get(t)}_setupItems(){Array.from(this.rootEl.querySelectorAll("li")).forEach(t=>{var i;t.setAttribute("role","treeitem");let e=this._group(t);if(!e)return;e.setAttribute("role","group"),t.hasAttribute("aria-expanded")||t.setAttribute("aria-expanded","false"),e.hidden=t.getAttribute("aria-expanded")!=="true";let s=(i=t.querySelector(":scope > .fs-tree-label"))!=null?i:t;if(!s.querySelector(":scope > .fs-tree-toggle")){let n=document.createElement("span");n.className="fs-tree-toggle",n.setAttribute("aria-hidden","true"),s.insertBefore(n,s.firstChild)}})}_group(t){return t.querySelector(":scope > ul, :scope > ol")}_isExpanded(t){return t.getAttribute("aria-expanded")==="true"}_isVisible(t){let e=t.parentElement.closest('[role="group"]');for(;e;){if(e.hidden)return!1;e=e.parentElement.closest('[role="group"]')}return!0}_visibleItems(){return Array.from(this.rootEl.querySelectorAll('[role="treeitem"]')).filter(t=>this._isVisible(t))}_resetRovingTabindex(){var s;let t=this._visibleItems(),e=(s=t.find(i=>i.getAttribute("tabindex")==="0"))!=null?s:t[0];t.forEach(i=>i.setAttribute("tabindex",i===e?"0":"-1"))}expand(t){let e=this._group(t);!e||this._isExpanded(t)||(t.setAttribute("aria-expanded","true"),e.hidden=!1,this._resetRovingTabindex(),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:expanded",{bubbles:!0,detail:{item:t}})))}collapse(t){let e=this._group(t);!e||!this._isExpanded(t)||(t.setAttribute("aria-expanded","false"),e.hidden=!0,this._resetRovingTabindex(),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:collapsed",{bubbles:!0,detail:{item:t}})))}toggle(t){this._isExpanded(t)?this.collapse(t):this.expand(t)}select(t){var e;this.rootEl.querySelectorAll('[aria-selected="true"]').forEach(s=>s.setAttribute("aria-selected","false")),t.setAttribute("aria-selected","true"),this.rootEl.dispatchEvent(new CustomEvent("fs:tree:selected",{bubbles:!0,detail:{value:(e=t.dataset.value)!=null?e:t.textContent.trim(),item:t}}))}_handleClick(t){let e=t.target.closest('[role="treeitem"]');e&&(this._group(e)&&this.toggle(e),this.select(e),e.focus())}_handleFocusIn(t){let e=t.target.closest('[role="treeitem"]');!e||!this._isVisible(e)||this._visibleItems().forEach(s=>s.setAttribute("tabindex",s===e?"0":"-1"))}_handleKeydown(t){var a,o,l,c,p,u;let e=t.target.closest('[role="treeitem"]');if(!e)return;let s=this._visibleItems(),i=s.indexOf(e),n=this._group(e);switch(t.key){case"ArrowDown":t.preventDefault(),(a=s[i+1])==null||a.focus();break;case"ArrowUp":t.preventDefault(),(o=s[i-1])==null||o.focus();break;case"ArrowRight":t.preventDefault(),n&&(this._isExpanded(e)?(l=s[i+1])==null||l.focus():this.expand(e));break;case"ArrowLeft":t.preventDefault(),n&&this._isExpanded(e)?this.collapse(e):(c=e.parentElement.closest('[role="treeitem"]'))==null||c.focus();break;case"Home":t.preventDefault(),(p=s[0])==null||p.focus();break;case"End":t.preventDefault(),(u=s[s.length-1])==null||u.focus();break;case"Enter":case" ":t.preventDefault(),n&&this.toggle(e),this.select(e);break;default:return}}dispose(){this.rootEl.removeEventListener("click",this._handleClick),this.rootEl.removeEventListener("keydown",this._handleKeydown),this.rootEl.removeEventListener("focusin",this._handleFocusIn),Qt.delete(this.rootEl)}};d("tree-view",st);var Xt=h();function es(r){let t=Number(r.min||0),e=Number(r.max||100),s=Number(r.value);return e===t?0:(s-t)/(e-t)*100}var it=class{constructor(t){let e=t.getAttribute("data-fs-target"),s=e?document.querySelector(e):null;this.inputEl=t,this.outputEl=s,this._handleInput=this._handleInput.bind(this),t.addEventListener("input",this._handleInput),this._render(),Xt.set(t,this)}static getInstance(t){return Xt.get(t)}_handleInput(){this._render()}_render(){this.inputEl.style.setProperty("--fs-range-percent",`${es(this.inputEl)}%`),this.outputEl&&(this.outputEl.textContent=this.inputEl.value)}dispose(){this.inputEl.removeEventListener("input",this._handleInput),Xt.delete(this.inputEl)}};d("range",it);var Jt=h(),ke=0;function nt(r){let t=document.createElement("div");return t.textContent=r,t.innerHTML}function ss(r){if(r<1024)return`${r} B`;let t=["KB","MB","GB"],e=r,s=-1;do e/=1024,s+=1;while(e>=1024&&s<t.length-1);return`${e.toFixed(1)} ${t[s]}`}function is(r){let t=r.lastIndexOf(".");return t===-1?"":r.slice(t+1,t+5).toUpperCase()}var rt=class{constructor(t){let e=t.querySelector(".fs-file-input");if(!e)throw new Error("FokusStyles.FileUploadAdvanced: .fs-file-input n\xE3o encontrado.");this.rootEl=t,this.inputEl=e,this.listEl=t.querySelector(".fs-file-upload-list"),this.listEl||(this.listEl=document.createElement("ul"),this.listEl.className="fs-file-upload-list",t.appendChild(this.listEl)),this._items=new Map,this._handleChange=this._handleChange.bind(this),this._handleListClick=this._handleListClick.bind(this),e.addEventListener("change",this._handleChange),this.listEl.addEventListener("click",this._handleListClick),Jt.set(t,this)}static getInstance(t){return Jt.get(t)}getFiles(){return Array.from(this._items.values()).map(t=>t.file)}setProgress(t,e){let s=this._items.get(t);s&&(s.progress=Math.min(100,Math.max(0,e)),s.error=null,this._renderItem(t))}setError(t,e){let s=this._items.get(t);s&&(s.error=e,this._renderItem(t))}remove(t){let e=this._items.get(t);if(!e)return;e.thumbUrl&&URL.revokeObjectURL(e.thumbUrl),this._items.delete(t);let s=this.listEl.querySelector(`[data-file-id="${t}"]`);s==null||s.remove(),this.rootEl.dispatchEvent(new CustomEvent("fs:file-upload:removed",{bubbles:!0,detail:{id:t,file:e.file}}))}_handleChange(){var s;let t=Array.from((s=this.inputEl.files)!=null?s:[]);if(t.length===0)return;let e=[];for(let i of t){ke+=1;let n=`file-${ke}`,a=i.type.startsWith("image/")?URL.createObjectURL(i):null;this._items.set(n,{file:i,progress:0,error:null,thumbUrl:a}),e.push({id:n,file:i}),this._appendItem(n)}this.rootEl.dispatchEvent(new CustomEvent("fs:file-upload:added",{bubbles:!0,detail:{items:e}}))}_handleListClick(t){let e=t.target.closest("[data-file-upload-remove]");if(!e)return;let s=e.closest("[data-file-id]");s&&this.remove(s.getAttribute("data-file-id"))}_appendItem(t){let e=this._items.get(t),s=document.createElement("li");s.className="fs-file-upload-item",s.setAttribute("data-file-id",t),this.listEl.appendChild(s),this._renderItem(t,e)}_renderItem(t,e){let s=e!=null?e:this._items.get(t);if(!s)return;let i=this.listEl.querySelector(`[data-file-id="${t}"]`);if(!i)return;let{file:n,progress:a,error:o,thumbUrl:l}=s,c=l?`<img src="${l}" alt="">`:nt(is(n.name)||"?");i.classList.toggle("is-error",!!o),i.innerHTML=`
|
|
29
29
|
<div class="fs-file-upload-thumb">${c}</div>
|
|
30
30
|
<div class="fs-file-upload-info">
|
|
31
|
-
<p class="fs-file-upload-name">${
|
|
32
|
-
<p class="fs-file-upload-size">${o?
|
|
33
|
-
<div class="fs-progress fs-progress-sm" role="progressbar" aria-valuenow="${a}" aria-valuemin="0" aria-valuemax="100" aria-label="Progresso de ${
|
|
31
|
+
<p class="fs-file-upload-name">${nt(n.name)}</p>
|
|
32
|
+
<p class="fs-file-upload-size">${o?nt(o):ss(n.size)}</p>
|
|
33
|
+
<div class="fs-progress fs-progress-sm" role="progressbar" aria-valuenow="${a}" aria-valuemin="0" aria-valuemax="100" aria-label="Progresso de ${nt(n.name)}">
|
|
34
34
|
<div class="fs-progress-bar${o?" fs-progress-bar-danger":""}" style="--fs-progress-value: ${a};"></div>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
|
-
<button type="button" class="fs-btn-close fs-file-upload-remove" data-file-upload-remove aria-label="Remover ${
|
|
38
|
-
`}dispose(){this.inputEl.removeEventListener("change",this._handleChange),this.listEl.removeEventListener("click",this._handleListClick);for(let t of this._items.values())t.thumbUrl&&URL.revokeObjectURL(t.thumbUrl);this._items.clear(),
|
|
37
|
+
<button type="button" class="fs-btn-close fs-file-upload-remove" data-file-upload-remove aria-label="Remover ${nt(n.name)}"></button>
|
|
38
|
+
`}dispose(){this.inputEl.removeEventListener("change",this._handleChange),this.listEl.removeEventListener("click",this._handleListClick);for(let t of this._items.values())t.thumbUrl&&URL.revokeObjectURL(t.thumbUrl);this._items.clear(),Jt.delete(this.rootEl)}};d("file-upload-advanced",rt);var Zt=h(),bt=class r{constructor(t=document.documentElement){this.root=t,Zt.set(t,this)}static getInstance(t=document.documentElement){return Zt.get(t)}static getOrCreateInstance(t=document.documentElement){var e;return(e=this.getInstance(t))!=null?e:new r(t)}static set(t,e=document.documentElement){return this.getOrCreateInstance(e).set(t)}get(){var t,e;return(e=(t=this.root.getAttribute("data-fs-theme"))!=null?t:this.root.getAttribute("data-theme"))!=null?e:"light"}set(t){if(!["light","dark","auto"].includes(t))throw new TypeError("FokusStyles.Theme: modo inv\xE1lido.");return this.root.setAttribute("data-fs-theme",t),this.root.setAttribute("data-theme",t==="dark"?"dark":"light"),this.root.dispatchEvent(new CustomEvent("fs:theme:change",{bubbles:!0,detail:{mode:t}})),this}dispose(){Zt.delete(this.root)}};var te=h(),at=class r{constructor(t){var s;this.navbarEl=t,this.toggleEl=t.querySelector('[data-fs-toggle="navbar"]');let e=(s=this.toggleEl)==null?void 0:s.getAttribute("data-fs-target");this.menuEl=e?document.querySelector(e):t.querySelector(".fs-navbar-collapse"),!(!this.toggleEl||!this.menuEl)&&(this._toggle=()=>this.toggle(),this._escape=i=>{i.key==="Escape"&&this.isOpen()&&this.hide()},this.toggleEl.addEventListener("click",this._toggle),this.menuEl.addEventListener("keydown",this._escape),te.set(t,this))}static getInstance(t){return te.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}isOpen(){var t;return(t=this.menuEl)==null?void 0:t.classList.contains("is-open")}show(){this.menuEl.classList.add("is-open"),this.menuEl.hidden=!1,this.toggleEl.setAttribute("aria-expanded","true"),this.navbarEl.dispatchEvent(new CustomEvent("fs:shown",{bubbles:!0}))}hide(){this.menuEl.classList.remove("is-open"),this.menuEl.hidden=!0,this.toggleEl.setAttribute("aria-expanded","false"),this.toggleEl.focus(),this.navbarEl.dispatchEvent(new CustomEvent("fs:hidden",{bubbles:!0}))}toggle(){this.isOpen()?this.hide():this.show()}dispose(){var t,e;(t=this.toggleEl)==null||t.removeEventListener("click",this._toggle),(e=this.menuEl)==null||e.removeEventListener("keydown",this._escape),te.delete(this.navbarEl)}};d("navbar",at);var ee=h(),ot=class r{constructor(t){this.navEl=t,this.links=[...t.querySelectorAll('a[href^="#"]')],this.sections=this.links.map(e=>document.querySelector(e.getAttribute("href"))).filter(Boolean),this.observer=typeof IntersectionObserver=="undefined"?null:new IntersectionObserver(e=>e.forEach(s=>s.isIntersecting&&this.activate(s.target)),{rootMargin:"-20% 0px -65%"}),this.sections.forEach(e=>{var s;return(s=this.observer)==null?void 0:s.observe(e)}),this._onScroll=()=>{if(this.observer)return;let e=this.sections.filter(s=>s.getBoundingClientRect().top<=window.innerHeight*.35).at(-1);e&&this.activate(e)},this.observer||window.addEventListener("scroll",this._onScroll,{passive:!0}),ee.set(t,this)}static getInstance(t){return ee.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}activate(t){this.links.forEach(e=>e.classList.toggle("is-active",e.getAttribute("href")===`#${t.id}`)),this.navEl.dispatchEvent(new CustomEvent("fs:scrollspy:activate",{bubbles:!0,detail:{section:t}}))}dispose(){var t;(t=this.observer)==null||t.disconnect(),window.removeEventListener("scroll",this._onScroll),ee.delete(this.navEl)}};d("scrollspy",ot);var se=h(),lt=class r{constructor(t){this.form=t,this._submit=e=>this.validate(e),t.addEventListener("submit",this._submit),se.set(t,this)}static getInstance(t){return se.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}validate(t){let e=this.form.checkValidity();return this.form.classList.add("fs-was-validated"),this.form.querySelectorAll('[required], [aria-required="true"]').forEach(s=>s.setAttribute("aria-invalid",String(!s.checkValidity()))),e||(t.preventDefault(),t.stopPropagation()),this.form.dispatchEvent(new CustomEvent("fs:form:validated",{bubbles:!0,detail:{valid:e}})),e}dispose(){this.form.removeEventListener("submit",this._submit),se.delete(this.form)}};d("form-validation",lt);var ie=h(),ht=class r{constructor(t){this.element=t,this._setLoading(t.hasAttribute("data-fs-loading")&&t.getAttribute("data-fs-loading")!=="false"),ie.set(t,this)}static getInstance(t){return ie.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}_setLoading(t){this.loading=t,this.element.toggleAttribute("aria-busy",t),this.element.toggleAttribute("data-fs-loading",t)}start(){this._setLoading(!0),this.element.dispatchEvent(new CustomEvent("fs:loading:start",{bubbles:!0}))}stop(){this._setLoading(!1),this.element.dispatchEvent(new CustomEvent("fs:loading:stop",{bubbles:!0}))}toggle(){this.loading?this.stop():this.start()}dispose(){ie.delete(this.element)}};d("spinner",ht);var ne=h(),dt=class r{constructor(t){this.element=t,this.current=Number(t.getAttribute("data-fs-page"))||1,this.total=Number(t.getAttribute("data-fs-pages"))||t.querySelectorAll("[data-fs-page]").length||1,this._click=e=>{let s=e.target.closest("[data-fs-page]");!s||!this.element.contains(s)||(e.preventDefault(),this.goTo(Number(s.getAttribute("data-fs-page"))))},t.addEventListener("click",this._click),ne.set(t,this),this._render()}static getInstance(t){return ne.get(t)}static getOrCreateInstance(t){var e;return(e=this.getInstance(t))!=null?e:new r(t)}goTo(t){let e=Math.max(1,Math.min(this.total,t));e!==this.current&&(this.current=e,this.element.setAttribute("data-fs-page",String(e)),this._render(),this.element.dispatchEvent(new CustomEvent("fs:pagination:change",{bubbles:!0,detail:{page:e,total:this.total}})))}_render(){this.element.querySelectorAll("[data-fs-page]").forEach(t=>{let e=Number(t.getAttribute("data-fs-page"))===this.current;t.classList.toggle("is-active",e),t.setAttribute("aria-current",e?"page":"false")})}dispose(){this.element.removeEventListener("click",this._click),ne.delete(this.element)}};d("pagination",dt);return Me(ns);})();
|
|
39
39
|
//# sourceMappingURL=fokus.min.js.map
|