tempest-react-sdk 0.1.3 → 0.1.5

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.
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("react"),ge=require("react-dom"),we=require("@tanstack/react-query"),st=require("zustand"),ve=require("zustand/middleware"),ot=require("dexie"),it=require("react-hook-form");function y(...e){const t=[];for(const n of e)if(!(n==null||n===!1||n===!0)){if(typeof n=="string")n&&t.push(n);else if(typeof n=="number"||typeof n=="bigint")t.push(String(n));else if(Array.isArray(n)){const r=y(...n);r&&t.push(r)}}return t.join(" ")}const at="tempest_avatar_3xMuZ",ct="tempest_image_ieqGp",lt="tempest_xs_oSaLL",ut="tempest_sm_sZ2bk",dt="tempest_md_Fdkbz",pt="tempest_lg_pTTUA",ft="tempest_xl_mW58F",mt="tempest_status_ISBnL",ht="tempest_dot_Wgfo-",gt="tempest_online_-aWoW",_t="tempest_offline_-StX3",yt="tempest_busy_TbwuF",q={avatar:at,image:ct,xs:lt,sm:ut,md:dt,lg:pt,xl:ft,status:mt,dot:ht,online:gt,offline:_t,busy:yt};function bt(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2):`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`}function wt({src:e,alt:t,name:n="",size:r="md",status:s,className:o,onClick:i}){const[l,c]=u.useState(!1),d=u.useMemo(()=>bt(n),[n]),p=e&&!l,f=i?"button":void 0,m=i?0:void 0;return a.jsxs("span",{className:y(q.avatar,q[r],s&&q.status,o),role:f,tabIndex:m,onClick:i,onKeyDown:i?h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())}:void 0,children:[p?a.jsx("img",{src:e,alt:t??n,className:q.image,onError:()=>c(!0)}):a.jsx("span",{"aria-label":t??n,children:d}),s&&a.jsx("span",{className:y(q.dot,q[s]),"aria-hidden":!0})]})}const vt="tempest_badge_RsuMz",xt="tempest_neutral_lulSm",jt="tempest_success_u9JiS",St="tempest_warning_nsGp-",kt="tempest_danger_PD2hz",Nt="tempest_info_na6DQ",xe={badge:vt,neutral:xt,success:jt,warning:St,danger:kt,info:Nt};function Et({variant:e="neutral",className:t,children:n,...r}){return a.jsx("span",{className:y(xe.badge,xe[e],t),...r,children:n})}const $t="tempest_nav_H4g6P",Ct="tempest_item_O4g3P",Tt="tempest_link_7WM67",It="tempest_current_JdlcS",Lt="tempest_separator_zGWyJ",V={nav:$t,item:Ct,link:Tt,current:It,separator:Lt};function Pt({items:e,separator:t="/",className:n}){return a.jsx("nav",{"aria-label":"breadcrumb",className:y(V.nav,n),children:e.map((r,s)=>{const o=s===e.length-1,i=!o&&(r.href||r.onClick);return a.jsxs(u.Fragment,{children:[a.jsx("span",{className:V.item,children:i?a.jsx("a",{href:r.href,onClick:l=>{r.onClick&&(l.preventDefault(),r.onClick())},className:V.link,children:r.label}):a.jsx("span",{"aria-current":o?"page":void 0,className:o?V.current:void 0,children:r.label})}),!o&&a.jsx("span",{className:V.separator,"aria-hidden":!0,children:t})]},s)})})}const Rt="tempest_button_2ZuB7",Mt="tempest_primary_s1sM6",Dt="tempest_secondary_R0waJ",At="tempest_danger_V4fX8",Ft="tempest_ghost_1KINV",Wt="tempest_sm_NhG0g",Ot="tempest_md_hH4h3",Bt="tempest_lg_2plQf",Ut="tempest_fullWidth_36oJT",zt="tempest_loading_EQAt2",qt="tempest_hiddenText_hIiJ2",Jt="tempest_spinner_ZExvW",Gt="tempest_tempest-spin_UOSVC",B={button:Rt,primary:Mt,secondary:Dt,danger:At,ghost:Ft,sm:Wt,md:Ot,lg:Bt,fullWidth:Ut,loading:zt,hiddenText:qt,spinner:Jt,tempestSpin:Gt};function ne({variant:e="primary",size:t="md",loading:n=!1,fullWidth:r=!1,leftIcon:s,rightIcon:o,disabled:i,className:l,children:c,...d}){return a.jsxs("button",{className:y(B.button,B[e],B[t],n&&B.loading,r&&B.fullWidth,l),disabled:i||n,...d,children:[n&&a.jsx("span",{className:B.spinner,"aria-hidden":!0,children:a.jsx(Ht,{})}),a.jsxs("span",{className:y(n&&B.hiddenText),children:[s,c,o]})]})}function Ht(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Kt="tempest_card_Cb1o4",Vt="tempest_padded_oOxwN",Qt="tempest_flush_aiDZi",Yt="tempest_header_PTXf2",Zt="tempest_title_mSgoo",Xt="tempest_body_W441Z",J={card:Kt,padded:Vt,flush:Qt,header:Yt,title:Zt,body:Xt};function en({title:e,actions:t,flush:n=!1,className:r,children:s,...o}){const i=e||t;return a.jsxs("div",{className:y(J.card,!i&&!n&&J.padded,n&&J.flush,r),...o,children:[i&&a.jsxs("header",{className:J.header,children:[typeof e=="string"?a.jsx("h3",{className:J.title,children:e}):e,t]}),i?a.jsx("div",{className:J.body,children:s}):s]})}const tn="tempest_wrapper_rpthW",nn="tempest_disabled_x7-eg",rn="tempest_input_2kt-h",sn="tempest_box_OCPee",on="tempest_labelWrap_Ktbp0",an="tempest_label_cwRtI",cn="tempest_description_rMhG1",U={wrapper:tn,disabled:nn,input:rn,box:sn,labelWrap:on,label:an,description:cn},ln=u.forwardRef(function({label:t,description:n,indeterminate:r,disabled:s,wrapperClassName:o,className:i,...l},c){const d=u.useRef(null);u.useEffect(()=>{d.current&&(d.current.indeterminate=!!r)},[r]);function p(f){d.current=f,typeof c=="function"?c(f):c&&(c.current=f)}return a.jsxs("label",{className:y(U.wrapper,s&&U.disabled,o),children:[a.jsx("input",{ref:p,type:"checkbox",disabled:s,className:y(U.input,i),...l}),a.jsx("span",{className:U.box,"aria-hidden":!0,children:r?a.jsx(dn,{}):a.jsx(un,{})}),(t||n)&&a.jsxs("span",{className:U.labelWrap,children:[t&&a.jsx("span",{className:U.label,children:t}),n&&a.jsx("span",{className:U.description,children:n})]})]})});function un(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})})}function dn(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})}const pn="tempest_wrapper_KR4-F",fn="tempest_label_Mz-wX",mn="tempest_field_iIBJw",hn="tempest_error_O9n-9",gn="tempest_chip_GEwrc",_n="tempest_remove_JYDIq",yn="tempest_input_frJmk",bn="tempest_helper_Yts53",wn="tempest_errorText_llJGq",R={wrapper:pn,label:fn,field:mn,error:hn,chip:gn,remove:_n,input:yn,helper:bn,errorText:wn};function vn({value:e,onChange:t,label:n,placeholder:r="Adicionar e pressionar Enter…",helperText:s,error:o,commitKeys:i=["Enter",",","Tab"],normalize:l=!0,className:c}){const[d,p]=u.useState(""),f=u.useRef(null);function m(){const g=l?d.trim().toLowerCase():d.trim();if(g){if(e.includes(g)){p("");return}t([...e,g]),p("")}}function h(g){if(i.includes(g.key)){g.preventDefault(),m();return}g.key==="Backspace"&&!d&&e.length>0&&t(e.slice(0,-1))}function _(g){const w=e.slice();w.splice(g,1),t(w)}return a.jsxs("div",{className:y(R.wrapper,o&&R.error,c),children:[n&&a.jsx("label",{className:R.label,children:n}),a.jsxs("div",{className:R.field,onClick:()=>f.current?.focus(),children:[e.map((g,w)=>a.jsxs("span",{className:R.chip,children:[g,a.jsx("button",{type:"button",className:R.remove,"aria-label":`Remover ${g}`,onClick:()=>_(w),children:"×"})]},`${g}-${w}`)),a.jsx("input",{ref:f,className:R.input,value:d,placeholder:e.length===0?r:"",onChange:g=>p(g.target.value),onKeyDown:h,onBlur:m})]}),o?a.jsx("span",{className:R.errorText,children:o}):s?a.jsx("span",{className:R.helper,children:s}):null]})}const xn="tempest_overlay_dd9h1",jn="tempest_tempest-fade-in_DvgSp",Sn="tempest_dialog_ptM-K",kn="tempest_tempest-modal-in_UoxQC",Nn="tempest_sm_K5k3W",En="tempest_md_gvyR7",$n="tempest_lg_BgB1a",Cn="tempest_xl_MR-68",Tn="tempest_header_ILG9i",In="tempest_title_A5OeE",Ln="tempest_close_-ER1C",Pn="tempest_body_lVhql",Rn="tempest_footer_rro2w",F={overlay:xn,tempestFadeIn:jn,dialog:Sn,tempestModalIn:kn,sm:Nn,md:En,lg:$n,xl:Cn,header:Tn,title:In,close:Ln,body:Pn,footer:Rn};function Te({open:e,onClose:t,title:n,children:r,footer:s,size:o="md",closeOnBackdrop:i=!0,closeOnEsc:l=!0,className:c,hideCloseButton:d=!1}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:ge.createPortal(a.jsx("div",{className:F.overlay,role:"presentation",onClick:()=>{i&&t()},children:a.jsxs("div",{role:"dialog","aria-modal":"true",className:y(F.dialog,F[o],c),onClick:p=>p.stopPropagation(),children:[(n||!d)&&a.jsxs("header",{className:F.header,children:[a.jsx("h3",{className:F.title,children:n}),!d&&a.jsx("button",{type:"button",className:F.close,"aria-label":"Fechar",onClick:t,children:a.jsx(Mn,{})})]}),a.jsx("div",{className:F.body,children:r}),s&&a.jsx("footer",{className:F.footer,children:s})]})}),document.body)}function Mn(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function Dn({open:e,title:t,description:n,confirmLabel:r="Confirmar",cancelLabel:s="Cancelar",variant:o="primary",loading:i=!1,onConfirm:l,onCancel:c}){return a.jsx(Te,{open:e,onClose:c,title:t,size:"sm",footer:a.jsxs(a.Fragment,{children:[a.jsx(ne,{variant:"secondary",onClick:c,disabled:i,children:s}),a.jsx(ne,{variant:o,loading:i,onClick:()=>{l()},children:r})]}),children:n})}const An="tempest_wrapper_iHNUs",Fn="tempest_label_-OEBL",Wn="tempest_required_CTss-",On="tempest_field_65yGJ",Bn="tempest_input_WjT81",Un="tempest_hasLeftIcon_xYO-v",zn="tempest_hasRightIcon_C7uyr",qn="tempest_iconLeft_KrUhI",Jn="tempest_iconRight_Ssr47",Gn="tempest_error_VLISa",Hn="tempest_helper_7Vc-s",Kn="tempest_errorText_xz4xS",T={wrapper:An,label:Fn,required:Wn,field:On,input:Bn,hasLeftIcon:Un,hasRightIcon:zn,iconLeft:qn,iconRight:Jn,error:Gn,helper:Hn,errorText:Kn},re=u.forwardRef(function({label:t,helperText:n,error:r,leftIcon:s,rightIcon:o,wrapperClassName:i,className:l,id:c,required:d,...p},f){const m=u.useId(),h=c??m,_=r?`${h}-error`:n?`${h}-helper`:void 0;return a.jsxs("div",{className:y(T.wrapper,r&&T.error,i),children:[t&&a.jsxs("label",{htmlFor:h,className:T.label,children:[t,d&&a.jsx("span",{className:T.required,children:"*"})]}),a.jsxs("div",{className:T.field,children:[s&&a.jsx("span",{className:T.iconLeft,children:s}),a.jsx("input",{ref:f,id:h,"aria-invalid":!!r,"aria-describedby":_,required:d,className:y(T.input,s&&T.hasLeftIcon,o&&T.hasRightIcon,l),...p}),o&&a.jsx("span",{className:T.iconRight,children:o})]}),r?a.jsx("span",{id:`${h}-error`,className:T.errorText,children:r}):n?a.jsx("span",{id:`${h}-helper`,className:T.helper,children:n}):null]})}),Vn=u.forwardRef(function({value:t,onChange:n,mode:r="date",...s},o){return a.jsx(re,{...s,ref:o,type:r,value:t,onChange:i=>n(i.target.value)})}),Qn="tempest_overlay_hcG1G",Yn="tempest_tempest-drawer-overlay_XFbxY",Zn="tempest_panel_wUX0N",Xn="tempest_right_-oX-6",er="tempest_tempest-drawer-in-right_pWYHv",tr="tempest_left_xi3nD",nr="tempest_tempest-drawer-in-left_o7JSb",rr="tempest_top_7rGCn",sr="tempest_tempest-drawer-in-top_kn6AF",or="tempest_bottom_zd-25",ir="tempest_tempest-drawer-in-bottom_0x3u7",ar="tempest_header_sYoP1",cr="tempest_title_LqUOu",lr="tempest_close_tYPhU",ur="tempest_body_aV9FG",dr="tempest_footer_AuvUP",W={overlay:Qn,tempestDrawerOverlay:Yn,panel:Zn,right:Xn,tempestDrawerInRight:er,left:tr,tempestDrawerInLeft:nr,top:rr,tempestDrawerInTop:sr,bottom:or,tempestDrawerInBottom:ir,header:ar,title:cr,close:lr,body:ur,footer:dr};function pr({open:e,onClose:t,placement:n="right",title:r,children:s,footer:o,closeOnBackdrop:i=!0,closeOnEsc:l=!0,hideCloseButton:c=!1,className:d}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:ge.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:W.overlay,onClick:()=>{i&&t()}}),a.jsxs("aside",{role:"dialog","aria-modal":"true",className:y(W.panel,W[n],d),children:[(r||!c)&&a.jsxs("header",{className:W.header,children:[a.jsx("h3",{className:W.title,children:r}),!c&&a.jsx("button",{type:"button","aria-label":"Fechar",className:W.close,onClick:t,children:a.jsx(fr,{})})]}),a.jsx("div",{className:W.body,children:s}),o&&a.jsx("footer",{className:W.footer,children:o})]})]}),document.body)}function fr(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const mr="tempest_wrapper_gzyTd",hr="tempest_icon_qVCyh",gr="tempest_title_xPfUf",_r="tempest_description_oWwH1",yr="tempest_action_dqxw1",Q={wrapper:mr,icon:hr,title:gr,description:_r,action:yr};function br({icon:e,title:t,description:n,action:r,className:s}){return a.jsxs("div",{className:y(Q.wrapper,s),children:[e&&a.jsx("div",{className:Q.icon,children:e}),a.jsx("h4",{className:Q.title,children:t}),n&&a.jsx("p",{className:Q.description,children:n}),r&&a.jsx("div",{className:Q.action,children:r})]})}const wr="tempest_wrapper_luRyF",vr="tempest_icon_dEdBl",xr="tempest_title_StutD",jr="tempest_description_A2XCb",Sr="tempest_action_vm1LC",Y={wrapper:wr,icon:vr,title:xr,description:jr,action:Sr};function kr({title:e="Algo deu errado",description:t="Não foi possível carregar essas informações.",onRetry:n,retryLabel:r="Tentar novamente",icon:s,className:o}){return a.jsxs("div",{className:y(Y.wrapper,o),children:[a.jsx("div",{className:Y.icon,children:s??a.jsx(Nr,{})}),a.jsx("h4",{className:Y.title,children:e}),t&&a.jsx("p",{className:Y.description,children:t}),n&&a.jsx("div",{className:Y.action,children:a.jsx(ne,{variant:"secondary",onClick:n,children:r})})]})}function Nr(){return a.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Er="tempest_wrapper_E0qHs",$r="tempest_label_lbMkx",Cr="tempest_dropzone_jqua0",Tr="tempest_active_CG9Uk",Ir="tempest_disabled_WNUUl",Lr="tempest_icon_i9fGH",Pr="tempest_title_bTVFl",Rr="tempest_subtitle_S54OV",Mr="tempest_files_WljYm",Dr="tempest_file_Lp-dR",Ar="tempest_fileMeta_LTnN2",Fr="tempest_remove_jskra",Wr="tempest_hidden_ReEq6",$={wrapper:Er,label:$r,dropzone:Cr,active:Tr,disabled:Ir,icon:Lr,title:Pr,subtitle:Rr,files:Mr,file:Dr,fileMeta:Ar,remove:Fr,hidden:Wr};function Or(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Br(e,t){if(!t)return!0;const n=t.split(",").map(o=>o.trim().toLowerCase()),r=e.name.toLowerCase(),s=e.type.toLowerCase();return n.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?s.startsWith(o.replace("/*","/")):s===o)}function Ur({value:e,onChange:t,label:n,accept:r,multiple:s=!1,maxSize:o,onReject:i,disabled:l,title:c="Arraste arquivos aqui ou clique para selecionar",subtitle:d,className:p}){const[f,m]=u.useState(!1),h=u.useRef(null);function _(b){const v=[],x=[];for(const E of Array.from(b)){if(!Br(E,r)){x.push({file:E,reason:"type"});continue}if(o&&E.size>o){x.push({file:E,reason:"size"});continue}v.push(E)}if(x.length>0&&i?.(x),v.length===0)return;const k=s?[...e,...v]:v.slice(0,1);t(k)}function g(b){b.preventDefault(),m(!1),!l&&b.dataTransfer?.files&&_(b.dataTransfer.files)}function w(b){const v=e.slice();v.splice(b,1),t(v)}return a.jsxs("div",{className:y($.wrapper,p),children:[n&&a.jsx("label",{className:$.label,children:n}),a.jsxs("div",{className:y($.dropzone,f&&$.active,l&&$.disabled),role:"button",tabIndex:l?-1:0,onClick:()=>!l&&h.current?.click(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),h.current?.click())},onDragEnter:b=>{b.preventDefault(),l||m(!0)},onDragOver:b=>b.preventDefault(),onDragLeave:()=>m(!1),onDrop:g,children:[a.jsx("div",{className:$.icon,"aria-hidden":!0,children:a.jsx(zr,{})}),a.jsx("p",{className:$.title,children:c}),d&&a.jsx("p",{className:$.subtitle,children:d}),a.jsx("input",{ref:h,type:"file",accept:r,multiple:s,disabled:l,className:$.hidden,onChange:b=>{b.target.files&&_(b.target.files),b.target.value=""}})]}),e.length>0&&a.jsx("ul",{className:$.files,children:e.map((b,v)=>a.jsxs("li",{className:$.file,children:[a.jsxs("div",{children:[a.jsx("div",{children:b.name}),a.jsx("div",{className:$.fileMeta,children:Or(b.size)})]}),a.jsx("button",{type:"button","aria-label":`Remover ${b.name}`,className:$.remove,onClick:()=>w(v),children:"×"})]},`${b.name}-${v}`))})]})}function zr(){return a.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const qr="tempest_form_jNBDR",Jr="tempest_stack_O1Hl-",Gr="tempest_inline_LBQAv",Hr="tempest_grid_-B86T",Kr="tempest_section_HGqw3",Vr="tempest_sectionHeader_ji9hQ",Qr="tempest_sectionTitle_GTPwe",Yr="tempest_sectionDescription_KjW7k",Zr="tempest_sectionBody_Vp2wz",Xr="tempest_row_1EkVR",es="tempest_actions_hK95I",ts="tempest_start_gXnm3",ns="tempest_center_mKkz4",rs="tempest_end_O3yDQ",ss="tempest_between_tte2z",P={form:qr,stack:Jr,inline:Gr,grid:Hr,section:Kr,sectionHeader:Vr,sectionTitle:Qr,sectionDescription:Yr,sectionBody:Zr,row:Xr,actions:es,start:ts,center:ns,end:rs,between:ss};function se(e,t){return e===void 0?`${t*4}px`:typeof e=="number"?`${e*4}px`:e}function Ie(e){return e===void 0?"repeat(2, minmax(0, 1fr))":typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e}const os=u.forwardRef(function({layout:t="stack",columns:n,gap:r,className:s,style:o,children:i,...l},c){const d={gap:se(r,4),...t==="grid"?{gridTemplateColumns:Ie(n)}:null,...o};return a.jsx("form",{ref:c,className:y(P.form,P[t],s),style:d,...l,children:i})});function is({title:e,description:t,layout:n="stack",columns:r,gap:s,className:o,style:i,children:l,...c}){const d={gap:se(s,4),...n==="grid"?{gridTemplateColumns:Ie(r)}:null};return a.jsxs("section",{className:y(P.section,o),style:i,...c,children:[(e||t)&&a.jsxs("header",{className:P.sectionHeader,children:[e&&a.jsx("h3",{className:P.sectionTitle,children:e}),t&&a.jsx("p",{className:P.sectionDescription,children:t})]}),a.jsx("div",{className:y(P.sectionBody,P[n]),style:d,children:l})]})}function as({gap:e,className:t,style:n,children:r,...s}){const o={gap:se(e,3),...n};return a.jsx("div",{className:y(P.row,t),style:o,...s,children:r})}function cs({align:e="end",gap:t,className:n,style:r,children:s,...o}){const i={gap:se(t,2),...r};return a.jsx("div",{className:y(P.actions,P[e],n),style:i,...o,children:s})}const ls="tempest_container_fJfOt",us="tempest_sm_k8D4-",ds="tempest_md_EnpYy",ps="tempest_lg_UU-Ig",fs="tempest_xl_2TEWj",ms="tempest_full_l8bvG",hs="tempest_stack_sxR8u",gs="tempest_vertical_2TMf5",_s="tempest_horizontal_r7-c-",ys="tempest_center_EDSAh",bs="tempest_start_ucQ-K",ws="tempest_end_pnKlF",vs="tempest_stretch_pX6l7",xs="tempest_justifyStart_lHYsS",js="tempest_justifyCenter_JH2m6",Ss="tempest_justifyEnd_EBisT",ks="tempest_justifyBetween_mAJwT",Ns="tempest_wrap_-xxOh",Es="tempest_grid_o-JIX",I={container:ls,sm:us,md:ds,lg:ps,xl:fs,full:ms,stack:hs,vertical:gs,horizontal:_s,center:ys,start:bs,end:ws,stretch:vs,justifyStart:xs,justifyCenter:js,justifyEnd:Ss,justifyBetween:ks,wrap:Ns,grid:Es};function $s({size:e="lg",className:t,children:n,...r}){return a.jsx("div",{className:y(I.container,I[e],t),...r,children:n})}function Cs({direction:e="vertical",gap:t=2,align:n,justify:r,wrap:s=!1,className:o,style:i,children:l,...c}){const p={gap:typeof t=="number"?`${t*4}px`:t,...i},f=r==="between"?I.justifyBetween:r==="center"?I.justifyCenter:r==="end"?I.justifyEnd:r==="start"?I.justifyStart:void 0;return a.jsx("div",{className:y(I.stack,e==="vertical"?I.vertical:I.horizontal,n&&I[n],f,s&&I.wrap,o),style:p,...c,children:l})}function Ts({columns:e=2,gap:t=4,className:n,style:r,children:s,...o}){const i=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e,l=typeof t=="number"?`${t*4}px`:t;return a.jsx("div",{className:y(I.grid,n),style:{gridTemplateColumns:i,gap:l,...r},...o,children:s})}const Is="tempest_wrapper_cRGQm",Ls="tempest_controls_fdL-y",Ps="tempest_page_WjG0l",Rs="tempest_active_1kqsJ",Ms="tempest_ellipsis_V294k",Ds="tempest_sizeSelect_ZayTo",O={wrapper:Is,controls:Ls,page:Ps,active:Rs,ellipsis:Ms,sizeSelect:Ds};function As(e,t,n){const r=n+4;if(t<=r)return Array.from({length:t},(l,c)=>c+1);const s=Math.max(2,e-Math.floor(n/2)),o=Math.min(t-1,s+n-1),i=[1];s>2&&i.push("...");for(let l=s;l<=o;l++)i.push(l);return o<t-1&&i.push("..."),i.push(t),i}function Fs({page:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:s,pageSizeOptions:o=[10,25,50,100],totalItems:i,siblingCount:l=3,className:c}){const d=u.useMemo(()=>As(e,t,l),[e,t,l]);return t<=1&&!s?null:a.jsxs("div",{className:y(O.wrapper,c),children:[a.jsx("div",{children:typeof i=="number"?`${i} resultado${i===1?"":"s"}`:null}),a.jsxs("div",{className:O.controls,children:[a.jsx("button",{type:"button",className:O.page,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,"aria-label":"Página anterior",children:"‹"}),d.map((p,f)=>p==="..."?a.jsx("span",{className:O.ellipsis,children:"…"},`ellipsis-${f}`):a.jsx("button",{type:"button",className:y(O.page,p===e&&O.active),onClick:()=>n(p),"aria-current":p===e?"page":void 0,children:p},p)),a.jsx("button",{type:"button",className:O.page,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,"aria-label":"Próxima página",children:"›"}),s&&a.jsx("select",{className:O.sizeSelect,value:r,onChange:p=>s(Number(p.target.value)),"aria-label":"Itens por página",children:o.map(p=>a.jsxs("option",{value:p,children:[p," / página"]},p))})]})]})}const Ws="tempest_wrapper_BQek1",Os="tempest_bar_uC-0x",Bs="tempest_fill_vmg7x",Us="tempest_success_gWJ8U",zs="tempest_warning_DGkPO",qs="tempest_danger_gfwHh",Js="tempest_indeterminate_HojUj",Gs="tempest_tempest-progress-loop_0nEdF",Hs="tempest_label_qqHJM",G={wrapper:Ws,bar:Os,fill:Bs,success:Us,warning:zs,danger:qs,indeterminate:Js,tempestProgressLoop:Gs,label:Hs};function Ks({value:e=0,max:t=100,variant:n="primary",indeterminate:r=!1,showLabel:s=!1,label:o,className:i}){const l=r?0:Math.max(0,Math.min(100,e/t*100));return a.jsxs("div",{className:y(G.wrapper,i),children:[(s||o)&&a.jsxs("div",{className:G.label,children:[o&&a.jsx("span",{children:o}),s&&!r&&a.jsxs("span",{children:[Math.round(l),"%"]})]}),a.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":r?void 0:e,className:y(G.bar,r&&G.indeterminate),children:a.jsx("div",{className:y(G.fill,n!=="primary"&&G[n]),style:{width:r?void 0:`${l}%`}})})]})}const Vs="tempest_wrapper_P-gFm",Qs="tempest_disabled_0-cna",Ys="tempest_input_7R8ZN",Zs="tempest_dot_P7ejP",Xs="tempest_labelWrap_iQ1HR",eo="tempest_label_vAFIP",to="tempest_description_bEB8u",no="tempest_group_oi329",ro="tempest_horizontal_1Ovgu",A={wrapper:Vs,disabled:Qs,input:Ys,dot:Zs,labelWrap:Xs,label:eo,description:to,group:no,horizontal:ro},Le=u.createContext(null),so=u.forwardRef(function({label:t,description:n,value:r,disabled:s,name:o,checked:i,onChange:l,wrapperClassName:c,className:d,...p},f){const m=u.useContext(Le),h=m?.name??o,_=m?.disabled??s,g=m?m.value===r:i;function w(b){m&&m.onChange?.(r),l?.(b)}return a.jsxs("label",{className:y(A.wrapper,_&&A.disabled,c),children:[a.jsx("input",{ref:f,type:"radio",name:h,value:r,checked:g,disabled:_,onChange:w,className:y(A.input,d),...p}),a.jsx("span",{className:A.dot,"aria-hidden":!0}),(t||n)&&a.jsxs("span",{className:A.labelWrap,children:[t&&a.jsx("span",{className:A.label,children:t}),n&&a.jsx("span",{className:A.description,children:n})]})]})});function oo({value:e,defaultValue:t,onChange:n,name:r,disabled:s,horizontal:o=!1,className:i,children:l}){const c=u.useId(),d=r??c,[p,f]=u.useState(t),m=e!==void 0,h=m?e:p;function _(g){m||f(g),n?.(g)}return a.jsx(Le.Provider,{value:{name:d,value:h,onChange:_,disabled:s},children:a.jsx("div",{role:"radiogroup",className:y(A.group,o&&A.horizontal,i),children:l})})}const io="tempest_wrapper_dKXJJ",ao="tempest_input_m0lPc",co="tempest_iconLeft_030-U",lo="tempest_clear_nb6lG",te={wrapper:io,input:ao,iconLeft:co,clear:lo},uo=u.forwardRef(function({value:t,onChange:n,onClear:r,wrapperClassName:s,placeholder:o="Buscar...",className:i,...l},c){function d(){n(""),r?.()}return a.jsxs("div",{className:y(te.wrapper,s),children:[a.jsx("span",{className:te.iconLeft,"aria-hidden":!0,children:a.jsx(po,{})}),a.jsx("input",{ref:c,type:"search",value:t,onChange:p=>n(p.target.value),placeholder:o,className:y(te.input,i),...l}),t&&a.jsx("button",{type:"button",className:te.clear,"aria-label":"Limpar busca",onClick:d,children:a.jsx(fo,{})})]})});function po(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{cx:"11",cy:"11",r:"7",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function fo(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const mo="tempest_wrapper_KS2K3",ho="tempest_label_Lmgos",go="tempest_required_PvDVJ",_o="tempest_field_h-wBy",yo="tempest_select_cjdcr",bo="tempest_caret_MdCao",wo="tempest_error_sw9MU",vo="tempest_helper_frosK",xo="tempest_errorText_-zd6i",M={wrapper:mo,label:ho,required:go,field:_o,select:yo,caret:bo,error:wo,helper:vo,errorText:xo},jo=u.forwardRef(function({label:t,helperText:n,error:r,options:s,placeholder:o,wrapperClassName:i,className:l,children:c,id:d,required:p,...f},m){const h=u.useId(),_=d??h;return a.jsxs("div",{className:y(M.wrapper,r&&M.error,i),children:[t&&a.jsxs("label",{htmlFor:_,className:M.label,children:[t,p&&a.jsx("span",{className:M.required,children:"*"})]}),a.jsxs("div",{className:M.field,children:[a.jsxs("select",{ref:m,id:_,"aria-invalid":!!r,required:p,className:y(M.select,l),...f,children:[o&&a.jsx("option",{value:"",disabled:!0,hidden:!0,children:o}),s?.map(g=>a.jsx("option",{value:g.value,disabled:g.disabled,children:g.label},g.value)),c]}),a.jsx("span",{className:M.caret,"aria-hidden":!0,children:a.jsx(So,{})})]}),r?a.jsx("span",{className:M.errorText,children:r}):n?a.jsx("span",{className:M.helper,children:n}):null]})});function So(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 9l6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const ko="tempest_skeleton_CB4uF",No="tempest_text_-A8IF",Eo="tempest_circle_DYcl8",le={skeleton:ko,text:No,circle:Eo};function $o({variant:e="rect",width:t,height:n,className:r,style:s}){return a.jsx("span",{"aria-hidden":!0,className:y(le.skeleton,e==="text"&&le.text,e==="circle"&&le.circle,r),style:{width:t,height:n,...s}})}const Co="tempest_spinner_GpFZS",To="tempest_tempest-spinner_wKVCY",Io="tempest_sm_3sIoD",Lo="tempest_md_M2sPj",Po="tempest_lg_IxTw2",je={spinner:Co,tempestSpinner:To,sm:Io,md:Lo,lg:Po};function Ro({size:e="md",className:t,label:n="Carregando"}){return a.jsx("span",{role:"status","aria-label":n,className:y(je.spinner,je[e],t)})}const Mo="tempest_stepper_w3qjQ",Do="tempest_vertical_d4mOs",Ao="tempest_step_s2nqL",Fo="tempest_dot_d1bSL",Wo="tempest_completed_gcFHM",Oo="tempest_active_kL-CH",Bo="tempest_label_8irAI",Uo="tempest_connector_lyeWp",D={stepper:Mo,vertical:Do,step:Ao,dot:Fo,completed:Wo,active:Oo,label:Bo,connector:Uo};function zo({steps:e,current:t,orientation:n="horizontal",className:r}){return a.jsx("ol",{className:y(D.stepper,n==="vertical"&&D.vertical,r),children:e.map((s,o)=>{const i=o<t,l=o===t;return a.jsxs(u.Fragment,{children:[a.jsxs("li",{className:y(D.step,i&&D.completed,l&&D.active),"aria-current":l?"step":void 0,children:[a.jsx("span",{className:D.dot,children:i?"✓":o+1}),a.jsx("span",{className:D.label,children:s.label})]}),o<e.length-1&&a.jsx("span",{className:y(D.connector,i&&D.completed),"aria-hidden":!0})]},o)})})}const qo="tempest_wrapper_kudO9",Jo="tempest_disabled_2aZ0V",Go="tempest_input_5BPNu",Ho="tempest_track_7ObdZ",Ko="tempest_thumb_-FTeK",Vo="tempest_label_LrH7V",H={wrapper:qo,disabled:Jo,input:Go,track:Ho,thumb:Ko,label:Vo},Qo=u.forwardRef(function({label:t,disabled:n,wrapperClassName:r,className:s,...o},i){return a.jsxs("label",{className:y(H.wrapper,n&&H.disabled,r),children:[a.jsx("input",{ref:i,type:"checkbox",role:"switch",disabled:n,className:y(H.input,s),...o}),a.jsx("span",{className:H.track,"aria-hidden":!0,children:a.jsx("span",{className:H.thumb})}),t&&a.jsx("span",{className:H.label,children:t})]})}),Yo="tempest_scroll_unrJp",Zo="tempest_table_Dkosn",Xo="tempest_th_PNuEx",ei="tempest_td_jv9tA",ti="tempest_tr_7UG8J",ni="tempest_clickable_B6Si-",ri="tempest_alignRight_9hY0G",si="tempest_alignCenter_YiUQy",oi="tempest_emptyRow_kdMiv",L={scroll:Yo,table:Zo,th:Xo,td:ei,tr:ti,clickable:ni,alignRight:ri,alignCenter:si,emptyRow:oi};function ii({columns:e,data:t,rowKey:n,onRowClick:r,emptyMessage:s="Nenhum registro encontrado.",className:o}){return a.jsx("div",{className:y(L.scroll,o),children:a.jsxs("table",{className:L.table,children:[a.jsx("thead",{children:a.jsx("tr",{children:e.map(i=>a.jsx("th",{className:y(L.th,i.align==="right"&&L.alignRight,i.align==="center"&&L.alignCenter),style:{width:i.width},children:i.header},i.key))})}),a.jsx("tbody",{children:t.length===0?a.jsx("tr",{children:a.jsx("td",{className:L.emptyRow,colSpan:e.length,children:s})}):t.map((i,l)=>a.jsx("tr",{className:y(L.tr,r&&L.clickable),onClick:r?()=>r(i):void 0,children:e.map(c=>{const d=c.render?c.render(i,l):i[c.key];return a.jsx("td",{className:y(L.td,c.align==="right"&&L.alignRight,c.align==="center"&&L.alignCenter,c.className),children:d},c.key)})},n(i,l)))})]})})}const ai="tempest_tablist_WR6ag",ci="tempest_tab_IdDYc",li="tempest_active_PTNtG",ui="tempest_panel_08i9c",di="tempest_pill_lGuqn",Z={tablist:ai,tab:ci,active:li,panel:ui,pill:di};function pi({items:e,defaultId:t,activeId:n,onChange:r,variant:s="underline",className:o}){const i=e.find(h=>!h.disabled),[l,c]=u.useState(t??i?.id),d=n!==void 0,p=d?n:l,f=e.find(h=>h.id===p)??i;function m(h){d||c(h),r?.(h)}return a.jsxs("div",{className:o,children:[a.jsx("div",{role:"tablist",className:y(Z.tablist,s==="pill"&&Z.pill),children:e.map(h=>{const _=h.id===f?.id;return a.jsx("button",{type:"button",role:"tab","aria-selected":_,"aria-controls":`panel-${h.id}`,id:`tab-${h.id}`,disabled:h.disabled,className:y(Z.tab,_&&Z.active),onClick:()=>m(h.id),children:h.label},h.id)})}),f&&a.jsx("div",{role:"tabpanel",id:`panel-${f.id}`,"aria-labelledby":`tab-${f.id}`,className:Z.panel,children:f.content})]})}const fi="tempest_wrapper_C0gfg",mi="tempest_label_cWLXP",hi="tempest_required_rDZXE",gi="tempest_textarea_Z-y6g",_i="tempest_error_NWC9f",yi="tempest_helper_gedut",bi="tempest_errorText_ey07q",z={wrapper:fi,label:mi,required:hi,textarea:gi,error:_i,helper:yi,errorText:bi},wi=u.forwardRef(function({label:t,helperText:n,error:r,wrapperClassName:s,className:o,id:i,required:l,...c},d){const p=u.useId(),f=i??p;return a.jsxs("div",{className:y(z.wrapper,r&&z.error,s),children:[t&&a.jsxs("label",{htmlFor:f,className:z.label,children:[t,l&&a.jsx("span",{className:z.required,children:"*"})]}),a.jsx("textarea",{ref:d,id:f,"aria-invalid":!!r,required:l,className:y(z.textarea,o),...c}),r?a.jsx("span",{className:z.errorText,children:r}):n?a.jsx("span",{className:z.helper,children:n}):null]})}),vi="tempest_trigger_Dmc5E",xi="tempest_bubble_TPGHB",ji="tempest_tempest-tooltip-in_csYeZ",Si="tempest_top_m2tnn",ki="tempest_bottom_9Twz4",Ni="tempest_left_UPdrG",Ei="tempest_right_CV--T",ue={trigger:vi,bubble:xi,tempestTooltipIn:ji,top:Si,bottom:ki,left:Ni,right:Ei};function $i({content:e,placement:t="top",children:n,disabled:r=!1,openDelay:s=150}){const[o,i]=u.useState(!1),l=u.useId();let c=null;function d(){r||(c&&clearTimeout(c),c=setTimeout(()=>i(!0),s))}function p(){c&&(clearTimeout(c),c=null),i(!1)}const f=u.cloneElement(n,{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p,"aria-describedby":o?l:void 0});return a.jsxs("span",{className:ue.trigger,children:[f,o&&a.jsx("span",{id:l,role:"tooltip",className:y(ue.bubble,ue[t]),children:e})]})}const Ci="tempest_container_x4-Qm",Ti="tempest_toast_FLdHz",Ii="tempest_tempest-toast-in_E2d-A",Li="tempest_success_Oy694",Pi="tempest_warning_84GC8",Ri="tempest_error_hrQAA",Mi="tempest_info_eq5bQ",Di="tempest_title_-H6R2",Ai="tempest_description_-QwfC",Fi="tempest_close_i10-s",K={container:Ci,toast:Ti,tempestToastIn:Ii,success:Li,warning:Pi,error:Ri,info:Mi,title:Di,description:Ai,close:Fi},Pe=u.createContext(null);function Wi(){const e=u.useContext(Pe);if(!e)throw new Error("useToast must be used inside a <ToastProvider>");return e}function Oi({children:e,defaultDuration:t=4e3}){const[n,r]=u.useState([]),s=u.useRef(0),o=u.useCallback(c=>{r(d=>d.filter(p=>p.id!==c))},[]),i=u.useCallback(c=>{const d=c.id??`toast-${++s.current}`,p={id:d,title:c.title,description:c.description,variant:c.variant??"info",duration:c.duration??t};return r(f=>[...f,p]),d},[t]),l=u.useMemo(()=>({show:i,dismiss:o,success:(c,d)=>i({...d,description:c,variant:"success"}),error:(c,d)=>i({...d,description:c,variant:"error"}),warning:(c,d)=>i({...d,description:c,variant:"warning"}),info:(c,d)=>i({...d,description:c,variant:"info"})}),[i,o]);return a.jsxs(Pe.Provider,{value:l,children:[e,a.jsx(Bi,{toasts:n,onDismiss:o})]})}function Bi({toasts:e,onDismiss:t}){return typeof document>"u"?null:ge.createPortal(a.jsx("div",{className:K.container,"aria-live":"polite","aria-atomic":"true",children:e.map(n=>a.jsx(Ui,{toast:n,onDismiss:t},n.id))}),document.body)}function Ui({toast:e,onDismiss:t}){return u.useEffect(()=>{if(!e.duration)return;const n=setTimeout(()=>t(e.id),e.duration);return()=>clearTimeout(n)},[e.id,e.duration,t]),a.jsxs("div",{className:y(K.toast,K[e.variant]),role:"status",children:[a.jsxs("div",{children:[e.title&&a.jsx("p",{className:K.title,children:e.title}),e.description&&a.jsx("p",{className:K.description,children:e.description})]}),a.jsx("button",{type:"button",className:K.close,"aria-label":"Fechar notificação",onClick:()=>t(e.id),children:a.jsx(zi,{})})]})}function zi(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const qi="tempest_scroll_8Giwl",Ji="tempest_spacer_P3Pvl",Gi="tempest_row_Ff0VU",de={scroll:qi,spacer:Ji,row:Gi};function Hi({items:e,itemHeight:t,renderItem:n,height:r,overscan:s=4,getKey:o,className:i,style:l}){const c=u.useRef(null),[d,p]=u.useState(0),[f,m]=u.useState(0);u.useEffect(()=>{const b=c.current;if(!b||(m(b.clientHeight),typeof ResizeObserver>"u"))return;const v=new ResizeObserver(()=>m(b.clientHeight));return v.observe(b),()=>v.disconnect()},[]);const h=e.length*t,_=Math.max(0,Math.floor(d/t)-s),g=Math.ceil(f/t)+s*2,w=Math.min(e.length,_+g);return a.jsx("div",{ref:c,className:y(de.scroll,i),style:{height:r,...l},onScroll:b=>p(b.target.scrollTop),role:"list",children:a.jsx("div",{className:de.spacer,style:{height:h},children:e.slice(_,w).map((b,v)=>{const x=_+v,k=o?o(b,x):x;return a.jsx("div",{role:"listitem",className:de.row,style:{top:x*t,height:t},children:n(b,x)},k)})})})}function Ki(e,t=300){const[n,r]=u.useState(e);return u.useEffect(()=>{const s=setTimeout(()=>r(e),t);return()=>clearTimeout(s)},[e,t]),n}function Vi(e=1,t=50){const[n,r]=u.useState(e),[s,o]=u.useState(t),i=u.useCallback(()=>r(1),[]);return{page:n,size:s,setPage:r,setSize:o,reset:i}}function Qi(e,t,n){return u.useMemo(()=>{const r=t.trim().toLowerCase();return r?typeof n=="function"?e.filter(s=>n(s,r)):e.filter(s=>n.some(o=>{const i=s[o];return i!=null&&String(i).toLowerCase().includes(r)})):e},[e,t,n])}function Yi(e){const[t,n]=u.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return u.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(e),s=o=>n(o.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function Zi(){const[e,t]=u.useState(()=>typeof navigator>"u"?!0:navigator.onLine);return u.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n),window.addEventListener("offline",r),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}},[]),e}function Xi(){const[e,t]=u.useState(()=>typeof document>"u"?"visible":document.visibilityState);return u.useEffect(()=>{if(typeof document>"u")return;const n=()=>t(document.visibilityState);return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e}function ea(e,t={}){const[n,r]=u.useState(null),{once:s=!1,root:o,rootMargin:i,threshold:l}=t;return u.useEffect(()=>{const c=e.current;if(!c||typeof IntersectionObserver>"u")return;const d=new IntersectionObserver(([p])=>{p&&(r(p),s&&p.isIntersecting&&d.unobserve(c))},{root:o,rootMargin:i,threshold:l});return d.observe(c),()=>d.disconnect()},[e,s,o,i,l]),n}function ta(e){const[t,n]=u.useState(null);return u.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=new ResizeObserver(o=>{const i=o[0];if(!i)return;const l=i.contentRect;n({width:l.width,height:l.height})});return s.observe(r),()=>s.disconnect()},[e]),t}function na(e={}){const{resetAfter:t=1500}=e,[n,r]=u.useState(!1),s=u.useRef(null),o=u.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r(!1)},[]);u.useEffect(()=>()=>o(),[o]);const i=u.useCallback(async l=>{try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)await navigator.clipboard.writeText(l);else if(typeof document<"u"){const c=document.createElement("textarea");c.value=l,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c)}else return!1;return r(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>r(!1),t),!0}catch{return!1}},[t]);return{copied:n,copy:i,reset:o}}function ra(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;const n=!!t.ctrl,r=!!t.meta,s=!!t.shift,o=!!t.alt;if(t.mod){if(!e.ctrlKey&&!e.metaKey)return!1}else if(e.ctrlKey!==n||e.metaKey!==r)return!1;return!(e.shiftKey!==s||e.altKey!==o)}function sa(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"?!0:e.isContentEditable}function oa(e,t,n={}){const{disabled:r=!1,ignoreInput:s=!0}=n;u.useEffect(()=>{if(r||typeof window>"u")return;const o=i=>{s&&sa(i.target)||ra(i,e)&&t(i)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r,s,e.key,e.ctrl,e.meta,e.shift,e.alt,e.mod,t])}function ia(){const[e,t]=u.useState(null),[n,r]=u.useState(!1);u.useEffect(()=>{if(typeof window>"u")return;const o=l=>{l.preventDefault(),t(l)},i=()=>{t(null),r(!0)};return window.addEventListener("beforeinstallprompt",o),window.addEventListener("appinstalled",i),()=>{window.removeEventListener("beforeinstallprompt",o),window.removeEventListener("appinstalled",i)}},[]);const s=u.useCallback(async()=>{if(!e)return"unsupported";await e.prompt();const o=await e.userChoice;return t(null),o.outcome==="accepted"&&r(!0),o.outcome},[e]);return{installable:!!e,installed:n,prompt:s}}const Se=["mousemove","mousedown","keydown","touchstart","wheel","scroll"];function aa(e=6e4){const[t,n]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;let r=setTimeout(()=>n(!0),e);function s(){n(!1),clearTimeout(r),r=setTimeout(()=>n(!0),e)}for(const o of Se)window.addEventListener(o,s,{passive:!0});return()=>{clearTimeout(r);for(const o of Se)window.removeEventListener(o,s)}},[e]),t}function ca(e={}){const{watch:t=!1,disabled:n=!1,...r}=e,[s,o]=u.useState({loading:!n,error:null,coords:null,timestamp:null});return u.useEffect(()=>{if(n||typeof navigator>"u"||!navigator.geolocation){o(c=>({...c,loading:!1}));return}const i=c=>{o({loading:!1,error:null,coords:c.coords,timestamp:c.timestamp})},l=c=>{o(d=>({...d,loading:!1,error:c}))};if(t){const c=navigator.geolocation.watchPosition(i,l,r);return()=>navigator.geolocation.clearWatch(c)}navigator.geolocation.getCurrentPosition(i,l,r)},[n,t,r.enableHighAccuracy,r.maximumAge,r.timeout]),s}function la(e){u.useEffect(()=>{if(!e||typeof document>"u")return;const t=document.body,n=t.style.overflow;return t.style.overflow="hidden",()=>{t.style.overflow=n}},[e])}const ua=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function da(e,t){u.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement;function s(){return Array.from(n?.querySelectorAll(ua)??[]).filter(l=>{if(l.hasAttribute("aria-hidden"))return!1;const c=typeof window<"u"?window.getComputedStyle(l):null;return!(c&&(c.display==="none"||c.visibility==="hidden"))})}function o(l){if(l.key!=="Tab")return;const c=s();if(c.length===0){l.preventDefault();return}const d=c[0],p=c[c.length-1],f=document.activeElement;l.shiftKey?(f===d||!f||!n?.contains(f))&&(l.preventDefault(),p.focus()):f===p&&(l.preventDefault(),d.focus())}return s()[0]?.focus(),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),r?.focus?.()}},[e,t])}function pa(e){const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>t.current(...n),[])}function me(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>me(s,t[o]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>me(e[s],t[s]))}function fa(e){const t=u.useRef(e);return me(t.current,e)||(t.current=e),t.current}function ma(e,t,n){const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(n)for(const[s,o]of Object.entries(n))o!=null&&r.searchParams.set(s,String(o));return r.toString()}function ha(e){return typeof FormData<"u"&&e instanceof FormData}async function ke(e){let t=null;try{t=await e.clone().json()}catch{try{t=await e.text()}catch{t=null}}const n=(typeof t=="object"&&t!==null?t.detail??t.message:void 0)??`Erro ${e.status}`;return{status:e.status,detail:String(n),body:t}}function ga(e){const t=e.fetcher??globalThis.fetch.bind(globalThis);function n(){const i=e.getToken?.();return i?{Authorization:`Bearer ${i}`}:{}}async function r(i,l){const{body:c,params:d,headers:p,...f}=l,m=ha(c),h={...m?{}:{"Content-Type":"application/json"},...e.headers,...n(),...p},_={...f,headers:h,credentials:e.withCredentials?"include":f.credentials,body:c==null?void 0:m?c:JSON.stringify(c)};return t(ma(e.baseURL,i,d),_)}async function s(i,l={}){let c=await r(i,l);if(c.status===401)if(e.refresh)try{await e.refresh(),c=await r(i,l)}catch{throw await e.onUnauthorized?.(c),await ke(c)}else await e.onUnauthorized?.(c);if(!c.ok)throw await ke(c);return c.status===204?void 0:(c.headers.get("content-type")??"").includes("application/json")?await c.json():await c.text()}async function o(i,l,c="POST"){return s(i,{method:c,body:l})}return{request:s,get:(i,l)=>s(i,{...l,method:"GET"}),post:(i,l)=>s(i,{...l,method:"POST"}),put:(i,l)=>s(i,{...l,method:"PUT"}),patch:(i,l)=>s(i,{...l,method:"PATCH"}),delete:(i,l)=>s(i,{...l,method:"DELETE"}),upload:o}}function _a(e,t,n){const r=e.safeParse(t);if(r.success)return r.data;if(typeof process<"u"&&(process.env?.NODE_ENV==="development"||process.env?.NODE_ENV==="test")){const o=r.error.issues.map(i=>` - ${i.path.join(".")||"<root>"}: ${i.message}`).join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),u=require("react"),ge=require("react-dom"),xe=require("@tanstack/react-query"),st=require("zustand"),ve=require("zustand/middleware"),ot=require("dexie"),it=require("react-hook-form");function y(...e){const t=[];for(const n of e)if(!(n==null||n===!1||n===!0)){if(typeof n=="string")n&&t.push(n);else if(typeof n=="number"||typeof n=="bigint")t.push(String(n));else if(Array.isArray(n)){const r=y(...n);r&&t.push(r)}}return t.join(" ")}const at="tempest_avatar_3xMuZ",ct="tempest_image_ieqGp",lt="tempest_xs_oSaLL",ut="tempest_sm_sZ2bk",dt="tempest_md_Fdkbz",pt="tempest_lg_pTTUA",ft="tempest_xl_mW58F",mt="tempest_status_ISBnL",ht="tempest_dot_Wgfo-",_t="tempest_online_-aWoW",gt="tempest_offline_-StX3",yt="tempest_busy_TbwuF",G={avatar:at,image:ct,xs:lt,sm:ut,md:dt,lg:pt,xl:ft,status:mt,dot:ht,online:_t,offline:gt,busy:yt};function bt(e){const t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2):`${t[0].charAt(0)}${t[t.length-1].charAt(0)}`}function wt({src:e,alt:t,name:n="",size:r="md",status:s,className:o,onClick:i}){const[l,c]=u.useState(!1),d=u.useMemo(()=>bt(n),[n]),p=e&&!l,f=i?"button":void 0,m=i?0:void 0;return a.jsxs("span",{className:y(G.avatar,G[r],s&&G.status,o),role:f,tabIndex:m,onClick:i,onKeyDown:i?_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),i())}:void 0,children:[p?a.jsx("img",{src:e,alt:t??n,className:G.image,onError:()=>c(!0)}):a.jsx("span",{"aria-label":t??n,children:d}),s&&a.jsx("span",{className:y(G.dot,G[s]),"aria-hidden":!0})]})}const xt="tempest_badge_RsuMz",vt="tempest_sm_LYsCn",jt="tempest_md_4Or8q",St="tempest_lg_Bseje",kt="tempest_square_l63D-",Et="tempest_neutral_lulSm",Nt="tempest_solid_0Leug",$t="tempest_outline_x06HL",Ct="tempest_success_u9JiS",Tt="tempest_warning_nsGp-",It="tempest_danger_PD2hz",Lt="tempest_info_na6DQ",Pt="tempest_primary_S0WCS",Rt="tempest_dot_i0c-G",q={badge:xt,sm:vt,md:jt,lg:St,square:kt,neutral:Et,solid:Nt,outline:$t,success:Ct,warning:Tt,danger:It,info:Lt,primary:Pt,dot:Rt};function Mt({variant:e="neutral",appearance:t="soft",size:n="md",shape:r="pill",dot:s=!1,className:o,children:i,...l}){return a.jsxs("span",{className:y(q.badge,q[e],t==="solid"&&q.solid,t==="outline"&&q.outline,q[n],r==="square"&&q.square,o),...l,children:[s&&a.jsx("span",{className:q.dot,"aria-hidden":!0}),i]})}const Dt="tempest_nav_H4g6P",Ft="tempest_item_O4g3P",At="tempest_link_7WM67",Wt="tempest_current_JdlcS",Ot="tempest_separator_zGWyJ",Q={nav:Dt,item:Ft,link:At,current:Wt,separator:Ot};function Bt({items:e,separator:t="/",className:n}){return a.jsx("nav",{"aria-label":"breadcrumb",className:y(Q.nav,n),children:e.map((r,s)=>{const o=s===e.length-1,i=!o&&(r.href||r.onClick);return a.jsxs(u.Fragment,{children:[a.jsx("span",{className:Q.item,children:i?a.jsx("a",{href:r.href,onClick:l=>{r.onClick&&(l.preventDefault(),r.onClick())},className:Q.link,children:r.label}):a.jsx("span",{"aria-current":o?"page":void 0,className:o?Q.current:void 0,children:r.label})}),!o&&a.jsx("span",{className:Q.separator,"aria-hidden":!0,children:t})]},s)})})}const zt="tempest_button_2ZuB7",qt="tempest_primary_s1sM6",Ut="tempest_secondary_R0waJ",Jt="tempest_danger_V4fX8",Gt="tempest_success_w6qB6",Ht="tempest_ghost_1KINV",Kt="tempest_soft_c3kzm",Vt="tempest_outline_F5jq-",Qt="tempest_link_Zt5hw",Yt="tempest_xs_cF6m0",Zt="tempest_sm_NhG0g",Xt="tempest_md_hH4h3",en="tempest_lg_2plQf",tn="tempest_xl_nx4V0",nn="tempest_iconOnly_WCpTS",rn="tempest_pill_lx8lt",sn="tempest_fullWidth_36oJT",on="tempest_loading_EQAt2",an="tempest_hiddenText_hIiJ2",cn="tempest_spinner_ZExvW",ln="tempest_tempest-spin_UOSVC",M={button:zt,primary:qt,secondary:Ut,danger:Jt,success:Gt,ghost:Ht,soft:Kt,outline:Vt,link:Qt,xs:Yt,sm:Zt,md:Xt,lg:en,xl:tn,iconOnly:nn,pill:rn,fullWidth:sn,loading:on,hiddenText:an,spinner:cn,tempestSpin:ln};function re({variant:e="primary",size:t="md",loading:n=!1,fullWidth:r=!1,iconOnly:s=!1,pill:o=!1,leftIcon:i,rightIcon:l,disabled:c,className:d,children:p,...f}){return a.jsxs("button",{className:y(M.button,M[e],M[t],s&&M.iconOnly,o&&M.pill,n&&M.loading,r&&M.fullWidth,d),disabled:c||n,...f,children:[n&&a.jsx("span",{className:M.spinner,"aria-hidden":!0,children:a.jsx(un,{})}),a.jsxs("span",{className:y(n&&M.hiddenText),children:[i,p,l]})]})}function un(){return a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const dn="tempest_card_Cb1o4",pn="tempest_flat_LRpce",fn="tempest_raised_WmIqk",mn="tempest_elevated_5VEDw",hn="tempest_interactive_B8Tah",_n="tempest_padded_oOxwN",gn="tempest_flush_aiDZi",yn="tempest_header_PTXf2",bn="tempest_title_mSgoo",wn="tempest_body_W441Z",xn="tempest_footer_Mu-JC",L={card:dn,flat:pn,raised:fn,elevated:mn,interactive:hn,padded:_n,flush:gn,header:yn,title:bn,body:wn,footer:xn};function vn({title:e,actions:t,footer:n,flush:r=!1,interactive:s=!1,elevation:o="default",className:i,children:l,...c}){const d=!!(e||t);return a.jsxs("div",{className:y(L.card,o==="flat"&&L.flat,o==="raised"&&L.raised,o==="elevated"&&L.elevated,s&&L.interactive,!d&&!r&&L.padded,r&&L.flush,i),tabIndex:s?c.tabIndex??0:c.tabIndex,...c,children:[d&&a.jsxs("header",{className:L.header,children:[typeof e=="string"?a.jsx("h3",{className:L.title,children:e}):e,t]}),d?a.jsx("div",{className:L.body,children:l}):l,n&&a.jsx("footer",{className:L.footer,children:n})]})}const jn="tempest_wrapper_rpthW",Sn="tempest_disabled_x7-eg",kn="tempest_input_2kt-h",En="tempest_box_OCPee",Nn="tempest_labelWrap_Ktbp0",$n="tempest_label_cwRtI",Cn="tempest_description_rMhG1",U={wrapper:jn,disabled:Sn,input:kn,box:En,labelWrap:Nn,label:$n,description:Cn},Tn=u.forwardRef(function({label:t,description:n,indeterminate:r,disabled:s,wrapperClassName:o,className:i,...l},c){const d=u.useRef(null);u.useEffect(()=>{d.current&&(d.current.indeterminate=!!r)},[r]);function p(f){d.current=f,typeof c=="function"?c(f):c&&(c.current=f)}return a.jsxs("label",{className:y(U.wrapper,s&&U.disabled,o),children:[a.jsx("input",{ref:p,type:"checkbox",disabled:s,className:y(U.input,i),...l}),a.jsx("span",{className:U.box,"aria-hidden":!0,children:r?a.jsx(Ln,{}):a.jsx(In,{})}),(t||n)&&a.jsxs("span",{className:U.labelWrap,children:[t&&a.jsx("span",{className:U.label,children:t}),n&&a.jsx("span",{className:U.description,children:n})]})]})});function In(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12l5 5L20 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ln(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M5 12h14",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round"})})}const Pn="tempest_wrapper_KR4-F",Rn="tempest_label_Mz-wX",Mn="tempest_field_iIBJw",Dn="tempest_error_O9n-9",Fn="tempest_chip_GEwrc",An="tempest_remove_JYDIq",Wn="tempest_input_frJmk",On="tempest_helper_Yts53",Bn="tempest_errorText_llJGq",D={wrapper:Pn,label:Rn,field:Mn,error:Dn,chip:Fn,remove:An,input:Wn,helper:On,errorText:Bn};function zn({value:e,onChange:t,label:n,placeholder:r="Adicionar e pressionar Enter…",helperText:s,error:o,commitKeys:i=["Enter",",","Tab"],normalize:l=!0,className:c}){const[d,p]=u.useState(""),f=u.useRef(null);function m(){const h=l?d.trim().toLowerCase():d.trim();if(h){if(e.includes(h)){p("");return}t([...e,h]),p("")}}function _(h){if(i.includes(h.key)){h.preventDefault(),m();return}h.key==="Backspace"&&!d&&e.length>0&&t(e.slice(0,-1))}function g(h){const w=e.slice();w.splice(h,1),t(w)}return a.jsxs("div",{className:y(D.wrapper,o&&D.error,c),children:[n&&a.jsx("label",{className:D.label,children:n}),a.jsxs("div",{className:D.field,onClick:()=>f.current?.focus(),children:[e.map((h,w)=>a.jsxs("span",{className:D.chip,children:[h,a.jsx("button",{type:"button",className:D.remove,"aria-label":`Remover ${h}`,onClick:()=>g(w),children:"×"})]},`${h}-${w}`)),a.jsx("input",{ref:f,className:D.input,value:d,placeholder:e.length===0?r:"",onChange:h=>p(h.target.value),onKeyDown:_,onBlur:m})]}),o?a.jsx("span",{className:D.errorText,children:o}):s?a.jsx("span",{className:D.helper,children:s}):null]})}const qn="tempest_overlay_dd9h1",Un="tempest_tempest-fade-in_DvgSp",Jn="tempest_dialog_ptM-K",Gn="tempest_tempest-modal-in_UoxQC",Hn="tempest_sm_K5k3W",Kn="tempest_md_gvyR7",Vn="tempest_lg_BgB1a",Qn="tempest_xl_MR-68",Yn="tempest_header_ILG9i",Zn="tempest_title_A5OeE",Xn="tempest_close_-ER1C",er="tempest_body_lVhql",tr="tempest_footer_rro2w",O={overlay:qn,tempestFadeIn:Un,dialog:Jn,tempestModalIn:Gn,sm:Hn,md:Kn,lg:Vn,xl:Qn,header:Yn,title:Zn,close:Xn,body:er,footer:tr};function Te({open:e,onClose:t,title:n,children:r,footer:s,size:o="md",closeOnBackdrop:i=!0,closeOnEsc:l=!0,className:c,hideCloseButton:d=!1}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:ge.createPortal(a.jsx("div",{className:O.overlay,role:"presentation",onClick:()=>{i&&t()},children:a.jsxs("div",{role:"dialog","aria-modal":"true",className:y(O.dialog,O[o],c),onClick:p=>p.stopPropagation(),children:[(n||!d)&&a.jsxs("header",{className:O.header,children:[a.jsx("h3",{className:O.title,children:n}),!d&&a.jsx("button",{type:"button",className:O.close,"aria-label":"Fechar",onClick:t,children:a.jsx(nr,{})})]}),a.jsx("div",{className:O.body,children:r}),s&&a.jsx("footer",{className:O.footer,children:s})]})}),document.body)}function nr(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}function rr({open:e,title:t,description:n,confirmLabel:r="Confirmar",cancelLabel:s="Cancelar",variant:o="primary",loading:i=!1,onConfirm:l,onCancel:c}){return a.jsx(Te,{open:e,onClose:c,title:t,size:"sm",footer:a.jsxs(a.Fragment,{children:[a.jsx(re,{variant:"secondary",onClick:c,disabled:i,children:s}),a.jsx(re,{variant:o,loading:i,onClick:()=>{l()},children:r})]}),children:n})}const sr="tempest_wrapper_iHNUs",or="tempest_label_-OEBL",ir="tempest_required_CTss-",ar="tempest_field_65yGJ",cr="tempest_input_WjT81",lr="tempest_sizeSm_cgds6",ur="tempest_sizeMd_EPFGy",dr="tempest_sizeLg_5Cq8k",pr="tempest_hasLeftIcon_xYO-v",fr="tempest_hasRightIcon_C7uyr",mr="tempest_iconLeft_KrUhI",hr="tempest_iconRight_Ssr47",_r="tempest_error_VLISa",gr="tempest_helper_7Vc-s",yr="tempest_errorText_xz4xS",k={wrapper:sr,label:or,required:ir,field:ar,input:cr,sizeSm:lr,sizeMd:ur,sizeLg:dr,hasLeftIcon:pr,hasRightIcon:fr,iconLeft:mr,iconRight:hr,error:_r,helper:gr,errorText:yr},se=u.forwardRef(function({label:t,helperText:n,error:r,leftIcon:s,rightIcon:o,wrapperClassName:i,className:l,id:c,required:d,size:p="md",...f},m){const _=u.useId(),g=c??_,h=r?`${g}-error`:n?`${g}-helper`:void 0,w=p==="sm"?k.sizeSm:p==="lg"?k.sizeLg:k.sizeMd;return a.jsxs("div",{className:y(k.wrapper,r&&k.error,i),children:[t&&a.jsxs("label",{htmlFor:g,className:k.label,children:[t,d&&a.jsx("span",{className:k.required,children:"*"})]}),a.jsxs("div",{className:k.field,children:[s&&a.jsx("span",{className:k.iconLeft,children:s}),a.jsx("input",{ref:m,id:g,"aria-invalid":!!r,"aria-describedby":h,required:d,className:y(k.input,w,s&&k.hasLeftIcon,o&&k.hasRightIcon,l),...f}),o&&a.jsx("span",{className:k.iconRight,children:o})]}),r?a.jsx("span",{id:`${g}-error`,className:k.errorText,children:r}):n?a.jsx("span",{id:`${g}-helper`,className:k.helper,children:n}):null]})}),br=u.forwardRef(function({value:t,onChange:n,mode:r="date",...s},o){return a.jsx(se,{...s,ref:o,type:r,value:t,onChange:i=>n(i.target.value)})}),wr="tempest_overlay_hcG1G",xr="tempest_tempest-drawer-overlay_XFbxY",vr="tempest_panel_wUX0N",jr="tempest_right_-oX-6",Sr="tempest_tempest-drawer-in-right_pWYHv",kr="tempest_left_xi3nD",Er="tempest_tempest-drawer-in-left_o7JSb",Nr="tempest_top_7rGCn",$r="tempest_tempest-drawer-in-top_kn6AF",Cr="tempest_bottom_zd-25",Tr="tempest_tempest-drawer-in-bottom_0x3u7",Ir="tempest_header_sYoP1",Lr="tempest_title_LqUOu",Pr="tempest_close_tYPhU",Rr="tempest_body_aV9FG",Mr="tempest_footer_AuvUP",B={overlay:wr,tempestDrawerOverlay:xr,panel:vr,right:jr,tempestDrawerInRight:Sr,left:kr,tempestDrawerInLeft:Er,top:Nr,tempestDrawerInTop:$r,bottom:Cr,tempestDrawerInBottom:Tr,header:Ir,title:Lr,close:Pr,body:Rr,footer:Mr};function Dr({open:e,onClose:t,placement:n="right",title:r,children:s,footer:o,closeOnBackdrop:i=!0,closeOnEsc:l=!0,hideCloseButton:c=!1,className:d}){return u.useEffect(()=>{if(!e)return;const p=document.body.style.overflow;document.body.style.overflow="hidden";const f=m=>{l&&m.key==="Escape"&&t()};return window.addEventListener("keydown",f),()=>{document.body.style.overflow=p,window.removeEventListener("keydown",f)}},[e,l,t]),!e||typeof document>"u"?null:ge.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:B.overlay,onClick:()=>{i&&t()}}),a.jsxs("aside",{role:"dialog","aria-modal":"true",className:y(B.panel,B[n],d),children:[(r||!c)&&a.jsxs("header",{className:B.header,children:[a.jsx("h3",{className:B.title,children:r}),!c&&a.jsx("button",{type:"button","aria-label":"Fechar",className:B.close,onClick:t,children:a.jsx(Fr,{})})]}),a.jsx("div",{className:B.body,children:s}),o&&a.jsx("footer",{className:B.footer,children:o})]})]}),document.body)}function Fr(){return a.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Ar="tempest_wrapper_gzyTd",Wr="tempest_icon_qVCyh",Or="tempest_title_xPfUf",Br="tempest_description_oWwH1",zr="tempest_action_dqxw1",Y={wrapper:Ar,icon:Wr,title:Or,description:Br,action:zr};function qr({icon:e,title:t,description:n,action:r,className:s}){return a.jsxs("div",{className:y(Y.wrapper,s),children:[e&&a.jsx("div",{className:Y.icon,children:e}),a.jsx("h4",{className:Y.title,children:t}),n&&a.jsx("p",{className:Y.description,children:n}),r&&a.jsx("div",{className:Y.action,children:r})]})}const Ur="tempest_wrapper_luRyF",Jr="tempest_icon_dEdBl",Gr="tempest_title_StutD",Hr="tempest_description_A2XCb",Kr="tempest_action_vm1LC",Z={wrapper:Ur,icon:Jr,title:Gr,description:Hr,action:Kr};function Vr({title:e="Algo deu errado",description:t="Não foi possível carregar essas informações.",onRetry:n,retryLabel:r="Tentar novamente",icon:s,className:o}){return a.jsxs("div",{className:y(Z.wrapper,o),children:[a.jsx("div",{className:Z.icon,children:s??a.jsx(Qr,{})}),a.jsx("h4",{className:Z.title,children:e}),t&&a.jsx("p",{className:Z.description,children:t}),n&&a.jsx("div",{className:Z.action,children:a.jsx(re,{variant:"secondary",onClick:n,children:r})})]})}function Qr(){return a.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Yr="tempest_wrapper_E0qHs",Zr="tempest_label_lbMkx",Xr="tempest_dropzone_jqua0",es="tempest_active_CG9Uk",ts="tempest_disabled_WNUUl",ns="tempest_icon_i9fGH",rs="tempest_title_bTVFl",ss="tempest_subtitle_S54OV",os="tempest_files_WljYm",is="tempest_file_Lp-dR",as="tempest_fileMeta_LTnN2",cs="tempest_remove_jskra",ls="tempest_hidden_ReEq6",C={wrapper:Yr,label:Zr,dropzone:Xr,active:es,disabled:ts,icon:ns,title:rs,subtitle:ss,files:os,file:is,fileMeta:as,remove:cs,hidden:ls};function us(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function ds(e,t){if(!t)return!0;const n=t.split(",").map(o=>o.trim().toLowerCase()),r=e.name.toLowerCase(),s=e.type.toLowerCase();return n.some(o=>o.startsWith(".")?r.endsWith(o):o.endsWith("/*")?s.startsWith(o.replace("/*","/")):s===o)}function ps({value:e,onChange:t,label:n,accept:r,multiple:s=!1,maxSize:o,onReject:i,disabled:l,title:c="Arraste arquivos aqui ou clique para selecionar",subtitle:d,className:p}){const[f,m]=u.useState(!1),_=u.useRef(null);function g(b){const x=[],v=[];for(const $ of Array.from(b)){if(!ds($,r)){v.push({file:$,reason:"type"});continue}if(o&&$.size>o){v.push({file:$,reason:"size"});continue}x.push($)}if(v.length>0&&i?.(v),x.length===0)return;const E=s?[...e,...x]:x.slice(0,1);t(E)}function h(b){b.preventDefault(),m(!1),!l&&b.dataTransfer?.files&&g(b.dataTransfer.files)}function w(b){const x=e.slice();x.splice(b,1),t(x)}return a.jsxs("div",{className:y(C.wrapper,p),children:[n&&a.jsx("label",{className:C.label,children:n}),a.jsxs("div",{className:y(C.dropzone,f&&C.active,l&&C.disabled),role:"button",tabIndex:l?-1:0,onClick:()=>!l&&_.current?.click(),onKeyDown:b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),_.current?.click())},onDragEnter:b=>{b.preventDefault(),l||m(!0)},onDragOver:b=>b.preventDefault(),onDragLeave:()=>m(!1),onDrop:h,children:[a.jsx("div",{className:C.icon,"aria-hidden":!0,children:a.jsx(fs,{})}),a.jsx("p",{className:C.title,children:c}),d&&a.jsx("p",{className:C.subtitle,children:d}),a.jsx("input",{ref:_,type:"file",accept:r,multiple:s,disabled:l,className:C.hidden,onChange:b=>{b.target.files&&g(b.target.files),b.target.value=""}})]}),e.length>0&&a.jsx("ul",{className:C.files,children:e.map((b,x)=>a.jsxs("li",{className:C.file,children:[a.jsxs("div",{children:[a.jsx("div",{children:b.name}),a.jsx("div",{className:C.fileMeta,children:us(b.size)})]}),a.jsx("button",{type:"button","aria-label":`Remover ${b.name}`,className:C.remove,onClick:()=>w(x),children:"×"})]},`${b.name}-${x}`))})]})}function fs(){return a.jsx("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M12 16V4m0 0l-4 4m4-4l4 4M4 20h16",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const ms="tempest_form_jNBDR",hs="tempest_stack_O1Hl-",_s="tempest_inline_LBQAv",gs="tempest_grid_-B86T",ys="tempest_section_HGqw3",bs="tempest_sectionHeader_ji9hQ",ws="tempest_sectionTitle_GTPwe",xs="tempest_sectionDescription_KjW7k",vs="tempest_sectionBody_Vp2wz",js="tempest_row_1EkVR",Ss="tempest_actions_hK95I",ks="tempest_start_gXnm3",Es="tempest_center_mKkz4",Ns="tempest_end_O3yDQ",$s="tempest_between_tte2z",R={form:ms,stack:hs,inline:_s,grid:gs,section:ys,sectionHeader:bs,sectionTitle:ws,sectionDescription:xs,sectionBody:vs,row:js,actions:Ss,start:ks,center:Es,end:Ns,between:$s};function oe(e,t){return e===void 0?`${t*4}px`:typeof e=="number"?`${e*4}px`:e}function Ie(e){return e===void 0?"repeat(2, minmax(0, 1fr))":typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e}const Cs=u.forwardRef(function({layout:t="stack",columns:n,gap:r,className:s,style:o,children:i,...l},c){const d={gap:oe(r,4),...t==="grid"?{gridTemplateColumns:Ie(n)}:null,...o};return a.jsx("form",{ref:c,className:y(R.form,R[t],s),style:d,...l,children:i})});function Ts({title:e,description:t,layout:n="stack",columns:r,gap:s,className:o,style:i,children:l,...c}){const d={gap:oe(s,4),...n==="grid"?{gridTemplateColumns:Ie(r)}:null};return a.jsxs("section",{className:y(R.section,o),style:i,...c,children:[(e||t)&&a.jsxs("header",{className:R.sectionHeader,children:[e&&a.jsx("h3",{className:R.sectionTitle,children:e}),t&&a.jsx("p",{className:R.sectionDescription,children:t})]}),a.jsx("div",{className:y(R.sectionBody,R[n]),style:d,children:l})]})}function Is({gap:e,className:t,style:n,children:r,...s}){const o={gap:oe(e,3),...n};return a.jsx("div",{className:y(R.row,t),style:o,...s,children:r})}function Ls({align:e="end",gap:t,className:n,style:r,children:s,...o}){const i={gap:oe(t,2),...r};return a.jsx("div",{className:y(R.actions,R[e],n),style:i,...o,children:s})}const Ps="tempest_container_fJfOt",Rs="tempest_sm_k8D4-",Ms="tempest_md_EnpYy",Ds="tempest_lg_UU-Ig",Fs="tempest_xl_2TEWj",As="tempest_full_l8bvG",Ws="tempest_stack_sxR8u",Os="tempest_vertical_2TMf5",Bs="tempest_horizontal_r7-c-",zs="tempest_center_EDSAh",qs="tempest_start_ucQ-K",Us="tempest_end_pnKlF",Js="tempest_stretch_pX6l7",Gs="tempest_justifyStart_lHYsS",Hs="tempest_justifyCenter_JH2m6",Ks="tempest_justifyEnd_EBisT",Vs="tempest_justifyBetween_mAJwT",Qs="tempest_wrap_-xxOh",Ys="tempest_grid_o-JIX",I={container:Ps,sm:Rs,md:Ms,lg:Ds,xl:Fs,full:As,stack:Ws,vertical:Os,horizontal:Bs,center:zs,start:qs,end:Us,stretch:Js,justifyStart:Gs,justifyCenter:Hs,justifyEnd:Ks,justifyBetween:Vs,wrap:Qs,grid:Ys};function Zs({size:e="lg",className:t,children:n,...r}){return a.jsx("div",{className:y(I.container,I[e],t),...r,children:n})}function Xs({direction:e="vertical",gap:t=2,align:n,justify:r,wrap:s=!1,className:o,style:i,children:l,...c}){const p={gap:typeof t=="number"?`${t*4}px`:t,...i},f=r==="between"?I.justifyBetween:r==="center"?I.justifyCenter:r==="end"?I.justifyEnd:r==="start"?I.justifyStart:void 0;return a.jsx("div",{className:y(I.stack,e==="vertical"?I.vertical:I.horizontal,n&&I[n],f,s&&I.wrap,o),style:p,...c,children:l})}function eo({columns:e=2,gap:t=4,className:n,style:r,children:s,...o}){const i=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e,l=typeof t=="number"?`${t*4}px`:t;return a.jsx("div",{className:y(I.grid,n),style:{gridTemplateColumns:i,gap:l,...r},...o,children:s})}const to="tempest_wrapper_cRGQm",no="tempest_controls_fdL-y",ro="tempest_page_WjG0l",so="tempest_active_1kqsJ",oo="tempest_ellipsis_V294k",io="tempest_sizeSelect_ZayTo",z={wrapper:to,controls:no,page:ro,active:so,ellipsis:oo,sizeSelect:io};function ao(e,t,n){const r=n+4;if(t<=r)return Array.from({length:t},(l,c)=>c+1);const s=Math.max(2,e-Math.floor(n/2)),o=Math.min(t-1,s+n-1),i=[1];s>2&&i.push("...");for(let l=s;l<=o;l++)i.push(l);return o<t-1&&i.push("..."),i.push(t),i}function co({page:e,totalPages:t,onPageChange:n,pageSize:r,onPageSizeChange:s,pageSizeOptions:o=[10,25,50,100],totalItems:i,siblingCount:l=3,className:c}){const d=u.useMemo(()=>ao(e,t,l),[e,t,l]);return t<=1&&!s?null:a.jsxs("div",{className:y(z.wrapper,c),children:[a.jsx("div",{children:typeof i=="number"?`${i} resultado${i===1?"":"s"}`:null}),a.jsxs("div",{className:z.controls,children:[a.jsx("button",{type:"button",className:z.page,onClick:()=>n(Math.max(1,e-1)),disabled:e<=1,"aria-label":"Página anterior",children:"‹"}),d.map((p,f)=>p==="..."?a.jsx("span",{className:z.ellipsis,children:"…"},`ellipsis-${f}`):a.jsx("button",{type:"button",className:y(z.page,p===e&&z.active),onClick:()=>n(p),"aria-current":p===e?"page":void 0,children:p},p)),a.jsx("button",{type:"button",className:z.page,onClick:()=>n(Math.min(t,e+1)),disabled:e>=t,"aria-label":"Próxima página",children:"›"}),s&&a.jsx("select",{className:z.sizeSelect,value:r,onChange:p=>s(Number(p.target.value)),"aria-label":"Itens por página",children:o.map(p=>a.jsxs("option",{value:p,children:[p," / página"]},p))})]})]})}const lo="tempest_wrapper_BQek1",uo="tempest_bar_uC-0x",po="tempest_fill_vmg7x",fo="tempest_success_gWJ8U",mo="tempest_warning_DGkPO",ho="tempest_danger_gfwHh",_o="tempest_indeterminate_HojUj",go="tempest_tempest-progress-loop_0nEdF",yo="tempest_label_qqHJM",H={wrapper:lo,bar:uo,fill:po,success:fo,warning:mo,danger:ho,indeterminate:_o,tempestProgressLoop:go,label:yo};function bo({value:e=0,max:t=100,variant:n="primary",indeterminate:r=!1,showLabel:s=!1,label:o,className:i}){const l=r?0:Math.max(0,Math.min(100,e/t*100));return a.jsxs("div",{className:y(H.wrapper,i),children:[(s||o)&&a.jsxs("div",{className:H.label,children:[o&&a.jsx("span",{children:o}),s&&!r&&a.jsxs("span",{children:[Math.round(l),"%"]})]}),a.jsx("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":r?void 0:e,className:y(H.bar,r&&H.indeterminate),children:a.jsx("div",{className:y(H.fill,n!=="primary"&&H[n]),style:{width:r?void 0:`${l}%`}})})]})}const wo="tempest_wrapper_P-gFm",xo="tempest_disabled_0-cna",vo="tempest_input_7R8ZN",jo="tempest_dot_P7ejP",So="tempest_labelWrap_iQ1HR",ko="tempest_label_vAFIP",Eo="tempest_description_bEB8u",No="tempest_group_oi329",$o="tempest_horizontal_1Ovgu",W={wrapper:wo,disabled:xo,input:vo,dot:jo,labelWrap:So,label:ko,description:Eo,group:No,horizontal:$o},Le=u.createContext(null),Co=u.forwardRef(function({label:t,description:n,value:r,disabled:s,name:o,checked:i,onChange:l,wrapperClassName:c,className:d,...p},f){const m=u.useContext(Le),_=m?.name??o,g=m?.disabled??s,h=m?m.value===r:i;function w(b){m&&m.onChange?.(r),l?.(b)}return a.jsxs("label",{className:y(W.wrapper,g&&W.disabled,c),children:[a.jsx("input",{ref:f,type:"radio",name:_,value:r,checked:h,disabled:g,onChange:w,className:y(W.input,d),...p}),a.jsx("span",{className:W.dot,"aria-hidden":!0}),(t||n)&&a.jsxs("span",{className:W.labelWrap,children:[t&&a.jsx("span",{className:W.label,children:t}),n&&a.jsx("span",{className:W.description,children:n})]})]})});function To({value:e,defaultValue:t,onChange:n,name:r,disabled:s,horizontal:o=!1,className:i,children:l}){const c=u.useId(),d=r??c,[p,f]=u.useState(t),m=e!==void 0,_=m?e:p;function g(h){m||f(h),n?.(h)}return a.jsx(Le.Provider,{value:{name:d,value:_,onChange:g,disabled:s},children:a.jsx("div",{role:"radiogroup",className:y(W.group,o&&W.horizontal,i),children:l})})}const Io="tempest_wrapper_dKXJJ",Lo="tempest_input_m0lPc",Po="tempest_iconLeft_030-U",Ro="tempest_clear_nb6lG",ne={wrapper:Io,input:Lo,iconLeft:Po,clear:Ro},Mo=u.forwardRef(function({value:t,onChange:n,onClear:r,wrapperClassName:s,placeholder:o="Buscar...",className:i,...l},c){function d(){n(""),r?.()}return a.jsxs("div",{className:y(ne.wrapper,s),children:[a.jsx("span",{className:ne.iconLeft,"aria-hidden":!0,children:a.jsx(Do,{})}),a.jsx("input",{ref:c,type:"search",value:t,onChange:p=>n(p.target.value),placeholder:o,className:y(ne.input,i),...l}),t&&a.jsx("button",{type:"button",className:ne.clear,"aria-label":"Limpar busca",onClick:d,children:a.jsx(Fo,{})})]})});function Do(){return a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("circle",{cx:"11",cy:"11",r:"7",stroke:"currentColor",strokeWidth:"2"}),a.jsx("path",{d:"M20 20l-3.5-3.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function Fo(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const Ao="tempest_wrapper_KS2K3",Wo="tempest_label_Lmgos",Oo="tempest_required_PvDVJ",Bo="tempest_field_h-wBy",zo="tempest_select_cjdcr",qo="tempest_caret_MdCao",Uo="tempest_error_sw9MU",Jo="tempest_helper_frosK",Go="tempest_errorText_-zd6i",F={wrapper:Ao,label:Wo,required:Oo,field:Bo,select:zo,caret:qo,error:Uo,helper:Jo,errorText:Go},Ho=u.forwardRef(function({label:t,helperText:n,error:r,options:s,placeholder:o,wrapperClassName:i,className:l,children:c,id:d,required:p,...f},m){const _=u.useId(),g=d??_;return a.jsxs("div",{className:y(F.wrapper,r&&F.error,i),children:[t&&a.jsxs("label",{htmlFor:g,className:F.label,children:[t,p&&a.jsx("span",{className:F.required,children:"*"})]}),a.jsxs("div",{className:F.field,children:[a.jsxs("select",{ref:m,id:g,"aria-invalid":!!r,required:p,className:y(F.select,l),...f,children:[o&&a.jsx("option",{value:"",disabled:!0,hidden:!0,children:o}),s?.map(h=>a.jsx("option",{value:h.value,disabled:h.disabled,children:h.label},h.value)),c]}),a.jsx("span",{className:F.caret,"aria-hidden":!0,children:a.jsx(Ko,{})})]}),r?a.jsx("span",{className:F.errorText,children:r}):n?a.jsx("span",{className:F.helper,children:n}):null]})});function Ko(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 9l6 6 6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}const Vo="tempest_skeleton_CB4uF",Qo="tempest_text_-A8IF",Yo="tempest_circle_DYcl8",ue={skeleton:Vo,text:Qo,circle:Yo};function Zo({variant:e="rect",width:t,height:n,className:r,style:s}){return a.jsx("span",{"aria-hidden":!0,className:y(ue.skeleton,e==="text"&&ue.text,e==="circle"&&ue.circle,r),style:{width:t,height:n,...s}})}const Xo="tempest_spinner_GpFZS",ei="tempest_tempest-spinner_wKVCY",ti="tempest_sm_3sIoD",ni="tempest_md_M2sPj",ri="tempest_lg_IxTw2",je={spinner:Xo,tempestSpinner:ei,sm:ti,md:ni,lg:ri};function si({size:e="md",className:t,label:n="Carregando"}){return a.jsx("span",{role:"status","aria-label":n,className:y(je.spinner,je[e],t)})}const oi="tempest_stepper_w3qjQ",ii="tempest_vertical_d4mOs",ai="tempest_step_s2nqL",ci="tempest_dot_d1bSL",li="tempest_completed_gcFHM",ui="tempest_active_kL-CH",di="tempest_label_8irAI",pi="tempest_connector_lyeWp",A={stepper:oi,vertical:ii,step:ai,dot:ci,completed:li,active:ui,label:di,connector:pi};function fi({steps:e,current:t,orientation:n="horizontal",className:r}){return a.jsx("ol",{className:y(A.stepper,n==="vertical"&&A.vertical,r),children:e.map((s,o)=>{const i=o<t,l=o===t;return a.jsxs(u.Fragment,{children:[a.jsxs("li",{className:y(A.step,i&&A.completed,l&&A.active),"aria-current":l?"step":void 0,children:[a.jsx("span",{className:A.dot,children:i?"✓":o+1}),a.jsx("span",{className:A.label,children:s.label})]}),o<e.length-1&&a.jsx("span",{className:y(A.connector,i&&A.completed),"aria-hidden":!0})]},o)})})}const mi="tempest_wrapper_kudO9",hi="tempest_disabled_2aZ0V",_i="tempest_input_5BPNu",gi="tempest_track_7ObdZ",yi="tempest_thumb_-FTeK",bi="tempest_label_LrH7V",K={wrapper:mi,disabled:hi,input:_i,track:gi,thumb:yi,label:bi},wi=u.forwardRef(function({label:t,disabled:n,wrapperClassName:r,className:s,...o},i){return a.jsxs("label",{className:y(K.wrapper,n&&K.disabled,r),children:[a.jsx("input",{ref:i,type:"checkbox",role:"switch",disabled:n,className:y(K.input,s),...o}),a.jsx("span",{className:K.track,"aria-hidden":!0,children:a.jsx("span",{className:K.thumb})}),t&&a.jsx("span",{className:K.label,children:t})]})}),xi="tempest_scroll_unrJp",vi="tempest_table_Dkosn",ji="tempest_th_PNuEx",Si="tempest_td_jv9tA",ki="tempest_tr_7UG8J",Ei="tempest_clickable_B6Si-",Ni="tempest_alignRight_9hY0G",$i="tempest_alignCenter_YiUQy",Ci="tempest_emptyRow_kdMiv",P={scroll:xi,table:vi,th:ji,td:Si,tr:ki,clickable:Ei,alignRight:Ni,alignCenter:$i,emptyRow:Ci};function Ti({columns:e,data:t,rowKey:n,onRowClick:r,emptyMessage:s="Nenhum registro encontrado.",className:o}){return a.jsx("div",{className:y(P.scroll,o),children:a.jsxs("table",{className:P.table,children:[a.jsx("thead",{children:a.jsx("tr",{children:e.map(i=>a.jsx("th",{className:y(P.th,i.align==="right"&&P.alignRight,i.align==="center"&&P.alignCenter),style:{width:i.width},children:i.header},i.key))})}),a.jsx("tbody",{children:t.length===0?a.jsx("tr",{children:a.jsx("td",{className:P.emptyRow,colSpan:e.length,children:s})}):t.map((i,l)=>a.jsx("tr",{className:y(P.tr,r&&P.clickable),onClick:r?()=>r(i):void 0,children:e.map(c=>{const d=c.render?c.render(i,l):i[c.key];return a.jsx("td",{className:y(P.td,c.align==="right"&&P.alignRight,c.align==="center"&&P.alignCenter,c.className),children:d},c.key)})},n(i,l)))})]})})}const Ii="tempest_tablist_WR6ag",Li="tempest_tab_IdDYc",Pi="tempest_active_PTNtG",Ri="tempest_panel_08i9c",Mi="tempest_pill_lGuqn",X={tablist:Ii,tab:Li,active:Pi,panel:Ri,pill:Mi};function Di({items:e,defaultId:t,activeId:n,onChange:r,variant:s="underline",className:o}){const i=e.find(_=>!_.disabled),[l,c]=u.useState(t??i?.id),d=n!==void 0,p=d?n:l,f=e.find(_=>_.id===p)??i;function m(_){d||c(_),r?.(_)}return a.jsxs("div",{className:o,children:[a.jsx("div",{role:"tablist",className:y(X.tablist,s==="pill"&&X.pill),children:e.map(_=>{const g=_.id===f?.id;return a.jsx("button",{type:"button",role:"tab","aria-selected":g,"aria-controls":`panel-${_.id}`,id:`tab-${_.id}`,disabled:_.disabled,className:y(X.tab,g&&X.active),onClick:()=>m(_.id),children:_.label},_.id)})}),f&&a.jsx("div",{role:"tabpanel",id:`panel-${f.id}`,"aria-labelledby":`tab-${f.id}`,className:X.panel,children:f.content})]})}const Fi="tempest_wrapper_C0gfg",Ai="tempest_label_cWLXP",Wi="tempest_required_rDZXE",Oi="tempest_textarea_Z-y6g",Bi="tempest_error_NWC9f",zi="tempest_helper_gedut",qi="tempest_errorText_ey07q",J={wrapper:Fi,label:Ai,required:Wi,textarea:Oi,error:Bi,helper:zi,errorText:qi},Ui=u.forwardRef(function({label:t,helperText:n,error:r,wrapperClassName:s,className:o,id:i,required:l,...c},d){const p=u.useId(),f=i??p;return a.jsxs("div",{className:y(J.wrapper,r&&J.error,s),children:[t&&a.jsxs("label",{htmlFor:f,className:J.label,children:[t,l&&a.jsx("span",{className:J.required,children:"*"})]}),a.jsx("textarea",{ref:d,id:f,"aria-invalid":!!r,required:l,className:y(J.textarea,o),...c}),r?a.jsx("span",{className:J.errorText,children:r}):n?a.jsx("span",{className:J.helper,children:n}):null]})}),Ji="tempest_trigger_Dmc5E",Gi="tempest_bubble_TPGHB",Hi="tempest_tempest-tooltip-in_csYeZ",Ki="tempest_top_m2tnn",Vi="tempest_bottom_9Twz4",Qi="tempest_left_UPdrG",Yi="tempest_right_CV--T",de={trigger:Ji,bubble:Gi,tempestTooltipIn:Hi,top:Ki,bottom:Vi,left:Qi,right:Yi};function Zi({content:e,placement:t="top",children:n,disabled:r=!1,openDelay:s=150}){const[o,i]=u.useState(!1),l=u.useId();let c=null;function d(){r||(c&&clearTimeout(c),c=setTimeout(()=>i(!0),s))}function p(){c&&(clearTimeout(c),c=null),i(!1)}const f=u.cloneElement(n,{onMouseEnter:d,onMouseLeave:p,onFocus:d,onBlur:p,"aria-describedby":o?l:void 0});return a.jsxs("span",{className:de.trigger,children:[f,o&&a.jsx("span",{id:l,role:"tooltip",className:y(de.bubble,de[t]),children:e})]})}const Xi="tempest_container_x4-Qm",ea="tempest_toast_FLdHz",ta="tempest_tempest-toast-in_E2d-A",na="tempest_success_Oy694",ra="tempest_warning_84GC8",sa="tempest_error_hrQAA",oa="tempest_info_eq5bQ",ia="tempest_title_-H6R2",aa="tempest_description_-QwfC",ca="tempest_close_i10-s",V={container:Xi,toast:ea,tempestToastIn:ta,success:na,warning:ra,error:sa,info:oa,title:ia,description:aa,close:ca},Pe=u.createContext(null);function la(){const e=u.useContext(Pe);if(!e)throw new Error("useToast must be used inside a <ToastProvider>");return e}function ua({children:e,defaultDuration:t=4e3}){const[n,r]=u.useState([]),s=u.useRef(0),o=u.useCallback(c=>{r(d=>d.filter(p=>p.id!==c))},[]),i=u.useCallback(c=>{const d=c.id??`toast-${++s.current}`,p={id:d,title:c.title,description:c.description,variant:c.variant??"info",duration:c.duration??t};return r(f=>[...f,p]),d},[t]),l=u.useMemo(()=>({show:i,dismiss:o,success:(c,d)=>i({...d,description:c,variant:"success"}),error:(c,d)=>i({...d,description:c,variant:"error"}),warning:(c,d)=>i({...d,description:c,variant:"warning"}),info:(c,d)=>i({...d,description:c,variant:"info"})}),[i,o]);return a.jsxs(Pe.Provider,{value:l,children:[e,a.jsx(da,{toasts:n,onDismiss:o})]})}function da({toasts:e,onDismiss:t}){return typeof document>"u"?null:ge.createPortal(a.jsx("div",{className:V.container,"aria-live":"polite","aria-atomic":"true",children:e.map(n=>a.jsx(pa,{toast:n,onDismiss:t},n.id))}),document.body)}function pa({toast:e,onDismiss:t}){return u.useEffect(()=>{if(!e.duration)return;const n=setTimeout(()=>t(e.id),e.duration);return()=>clearTimeout(n)},[e.id,e.duration,t]),a.jsxs("div",{className:y(V.toast,V[e.variant]),role:"status",children:[a.jsxs("div",{children:[e.title&&a.jsx("p",{className:V.title,children:e.title}),e.description&&a.jsx("p",{className:V.description,children:e.description})]}),a.jsx("button",{type:"button",className:V.close,"aria-label":"Fechar notificação",onClick:()=>t(e.id),children:a.jsx(fa,{})})]})}function fa(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})}const ma="tempest_scroll_8Giwl",ha="tempest_spacer_P3Pvl",_a="tempest_row_Ff0VU",pe={scroll:ma,spacer:ha,row:_a};function ga({items:e,itemHeight:t,renderItem:n,height:r,overscan:s=4,getKey:o,className:i,style:l}){const c=u.useRef(null),[d,p]=u.useState(0),[f,m]=u.useState(0);u.useEffect(()=>{const b=c.current;if(!b||(m(b.clientHeight),typeof ResizeObserver>"u"))return;const x=new ResizeObserver(()=>m(b.clientHeight));return x.observe(b),()=>x.disconnect()},[]);const _=e.length*t,g=Math.max(0,Math.floor(d/t)-s),h=Math.ceil(f/t)+s*2,w=Math.min(e.length,g+h);return a.jsx("div",{ref:c,className:y(pe.scroll,i),style:{height:r,...l},onScroll:b=>p(b.target.scrollTop),role:"list",children:a.jsx("div",{className:pe.spacer,style:{height:_},children:e.slice(g,w).map((b,x)=>{const v=g+x,E=o?o(b,v):v;return a.jsx("div",{role:"listitem",className:pe.row,style:{top:v*t,height:t},children:n(b,v)},E)})})})}function ya(e,t=300){const[n,r]=u.useState(e);return u.useEffect(()=>{const s=setTimeout(()=>r(e),t);return()=>clearTimeout(s)},[e,t]),n}function ba(e=1,t=50){const[n,r]=u.useState(e),[s,o]=u.useState(t),i=u.useCallback(()=>r(1),[]);return{page:n,size:s,setPage:r,setSize:o,reset:i}}function wa(e,t,n){return u.useMemo(()=>{const r=t.trim().toLowerCase();return r?typeof n=="function"?e.filter(s=>n(s,r)):e.filter(s=>n.some(o=>{const i=s[o];return i!=null&&String(i).toLowerCase().includes(r)})):e},[e,t,n])}function xa(e){const[t,n]=u.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return u.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia(e),s=o=>n(o.matches);return n(r.matches),r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[e]),t}function va(){const[e,t]=u.useState(()=>typeof navigator>"u"?!0:navigator.onLine);return u.useEffect(()=>{if(typeof window>"u")return;const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n),window.addEventListener("offline",r),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}},[]),e}function ja(){const[e,t]=u.useState(()=>typeof document>"u"?"visible":document.visibilityState);return u.useEffect(()=>{if(typeof document>"u")return;const n=()=>t(document.visibilityState);return document.addEventListener("visibilitychange",n),()=>document.removeEventListener("visibilitychange",n)},[]),e}function Sa(e,t={}){const[n,r]=u.useState(null),{once:s=!1,root:o,rootMargin:i,threshold:l}=t;return u.useEffect(()=>{const c=e.current;if(!c||typeof IntersectionObserver>"u")return;const d=new IntersectionObserver(([p])=>{p&&(r(p),s&&p.isIntersecting&&d.unobserve(c))},{root:o,rootMargin:i,threshold:l});return d.observe(c),()=>d.disconnect()},[e,s,o,i,l]),n}function ka(e){const[t,n]=u.useState(null);return u.useEffect(()=>{const r=e.current;if(!r||typeof ResizeObserver>"u")return;const s=new ResizeObserver(o=>{const i=o[0];if(!i)return;const l=i.contentRect;n({width:l.width,height:l.height})});return s.observe(r),()=>s.disconnect()},[e]),t}function Ea(e={}){const{resetAfter:t=1500}=e,[n,r]=u.useState(!1),s=u.useRef(null),o=u.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r(!1)},[]);u.useEffect(()=>()=>o(),[o]);const i=u.useCallback(async l=>{try{if(typeof navigator<"u"&&navigator.clipboard?.writeText)await navigator.clipboard.writeText(l);else if(typeof document<"u"){const c=document.createElement("textarea");c.value=l,c.style.position="fixed",c.style.opacity="0",document.body.appendChild(c),c.select(),document.execCommand("copy"),document.body.removeChild(c)}else return!1;return r(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>r(!1),t),!0}catch{return!1}},[t]);return{copied:n,copy:i,reset:o}}function Na(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return!1;const n=!!t.ctrl,r=!!t.meta,s=!!t.shift,o=!!t.alt;if(t.mod){if(!e.ctrlKey&&!e.metaKey)return!1}else if(e.ctrlKey!==n||e.metaKey!==r)return!1;return!(e.shiftKey!==s||e.altKey!==o)}function $a(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"?!0:e.isContentEditable}function Ca(e,t,n={}){const{disabled:r=!1,ignoreInput:s=!0}=n;u.useEffect(()=>{if(r||typeof window>"u")return;const o=i=>{s&&$a(i.target)||Na(i,e)&&t(i)};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[r,s,e.key,e.ctrl,e.meta,e.shift,e.alt,e.mod,t])}function Ta(){const[e,t]=u.useState(null),[n,r]=u.useState(!1);u.useEffect(()=>{if(typeof window>"u")return;const o=l=>{l.preventDefault(),t(l)},i=()=>{t(null),r(!0)};return window.addEventListener("beforeinstallprompt",o),window.addEventListener("appinstalled",i),()=>{window.removeEventListener("beforeinstallprompt",o),window.removeEventListener("appinstalled",i)}},[]);const s=u.useCallback(async()=>{if(!e)return"unsupported";await e.prompt();const o=await e.userChoice;return t(null),o.outcome==="accepted"&&r(!0),o.outcome},[e]);return{installable:!!e,installed:n,prompt:s}}const Se=["mousemove","mousedown","keydown","touchstart","wheel","scroll"];function Ia(e=6e4){const[t,n]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;let r=setTimeout(()=>n(!0),e);function s(){n(!1),clearTimeout(r),r=setTimeout(()=>n(!0),e)}for(const o of Se)window.addEventListener(o,s,{passive:!0});return()=>{clearTimeout(r);for(const o of Se)window.removeEventListener(o,s)}},[e]),t}function La(e={}){const{watch:t=!1,disabled:n=!1,...r}=e,[s,o]=u.useState({loading:!n,error:null,coords:null,timestamp:null});return u.useEffect(()=>{if(n||typeof navigator>"u"||!navigator.geolocation){o(c=>({...c,loading:!1}));return}const i=c=>{o({loading:!1,error:null,coords:c.coords,timestamp:c.timestamp})},l=c=>{o(d=>({...d,loading:!1,error:c}))};if(t){const c=navigator.geolocation.watchPosition(i,l,r);return()=>navigator.geolocation.clearWatch(c)}navigator.geolocation.getCurrentPosition(i,l,r)},[n,t,r.enableHighAccuracy,r.maximumAge,r.timeout]),s}function Pa(e){u.useEffect(()=>{if(!e||typeof document>"u")return;const t=document.body,n=t.style.overflow;return t.style.overflow="hidden",()=>{t.style.overflow=n}},[e])}const Ra=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Ma(e,t){u.useEffect(()=>{if(!t)return;const n=e.current;if(!n)return;const r=document.activeElement;function s(){return Array.from(n?.querySelectorAll(Ra)??[]).filter(l=>{if(l.hasAttribute("aria-hidden"))return!1;const c=typeof window<"u"?window.getComputedStyle(l):null;return!(c&&(c.display==="none"||c.visibility==="hidden"))})}function o(l){if(l.key!=="Tab")return;const c=s();if(c.length===0){l.preventDefault();return}const d=c[0],p=c[c.length-1],f=document.activeElement;l.shiftKey?(f===d||!f||!n?.contains(f))&&(l.preventDefault(),p.focus()):f===p&&(l.preventDefault(),d.focus())}return s()[0]?.focus(),document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o),r?.focus?.()}},[e,t])}function Da(e){const t=u.useRef(e);return t.current=e,u.useCallback((...n)=>t.current(...n),[])}function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((s,o)=>he(s,t[o]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(s=>he(e[s],t[s]))}function Fa(e){const t=u.useRef(e);return he(t.current,e)||(t.current=e),t.current}function Aa(e,t,n){const r=new URL(t,e.endsWith("/")?e:`${e}/`);if(n)for(const[s,o]of Object.entries(n))o!=null&&r.searchParams.set(s,String(o));return r.toString()}function Wa(e){return typeof FormData<"u"&&e instanceof FormData}async function ke(e){let t=null;try{t=await e.clone().json()}catch{try{t=await e.text()}catch{t=null}}const n=(typeof t=="object"&&t!==null?t.detail??t.message:void 0)??`Erro ${e.status}`;return{status:e.status,detail:String(n),body:t}}function Oa(e){const t=e.fetcher??globalThis.fetch.bind(globalThis);function n(){const i=e.getToken?.();return i?{Authorization:`Bearer ${i}`}:{}}async function r(i,l){const{body:c,params:d,headers:p,...f}=l,m=Wa(c),_={...m?{}:{"Content-Type":"application/json"},...e.headers,...n(),...p},g={...f,headers:_,credentials:e.withCredentials?"include":f.credentials,body:c==null?void 0:m?c:JSON.stringify(c)};return t(Aa(e.baseURL,i,d),g)}async function s(i,l={}){let c=await r(i,l);if(c.status===401)if(e.refresh)try{await e.refresh(),c=await r(i,l)}catch{throw await e.onUnauthorized?.(c),await ke(c)}else await e.onUnauthorized?.(c);if(!c.ok)throw await ke(c);return c.status===204?void 0:(c.headers.get("content-type")??"").includes("application/json")?await c.json():await c.text()}async function o(i,l,c="POST"){return s(i,{method:c,body:l})}return{request:s,get:(i,l)=>s(i,{...l,method:"GET"}),post:(i,l)=>s(i,{...l,method:"POST"}),put:(i,l)=>s(i,{...l,method:"PUT"}),patch:(i,l)=>s(i,{...l,method:"PATCH"}),delete:(i,l)=>s(i,{...l,method:"DELETE"}),upload:o}}function Ba(e,t,n){const r=e.safeParse(t);if(r.success)return r.data;if(typeof process<"u"&&(process.env?.NODE_ENV==="development"||process.env?.NODE_ENV==="test")){const o=r.error.issues.map(i=>` - ${i.path.join(".")||"<root>"}: ${i.message}`).join(`
2
2
  `);throw new Error(`[parseResponse] Contract drift on ${n}:
3
3
  ${o}
4
4
 
5
- Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida do servidor (${n}).`)}function ya(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function ba(e){const{url:t,body:n,method:r="POST",headers:s={},getToken:o,withCredentials:i=!1,onProgress:l,signal:c,parser:d=JSON.parse}=e;return new Promise((p,f)=>{if(c?.aborted){f(new DOMException("Aborted","AbortError"));return}const m=new XMLHttpRequest;m.open(r,t),m.withCredentials=i;const h=o?.(),_={...s};h&&!("Authorization"in _)&&(_.Authorization=`Bearer ${h}`);for(const[w,b]of Object.entries(_))m.setRequestHeader(w,b);l&&(m.upload.onprogress=w=>{l({loaded:w.loaded,total:w.total,fraction:w.lengthComputable?w.loaded/w.total:null,lengthComputable:w.lengthComputable})});function g(){m.abort()}c?.addEventListener("abort",g),m.onload=()=>{c?.removeEventListener("abort",g);const w=m.status>=200&&m.status<300,b=m.getResponseHeader("content-type")??"";if(!w){const v=ya(m.responseText),x=(typeof v=="object"&&v!==null?v.detail??v.message:void 0)??`Erro ${m.status}`,k={status:m.status,detail:String(x),body:v};f(k);return}if(m.status===204||!m.responseText){p(void 0);return}if(b.includes("application/json"))try{p(d(m.responseText))}catch(v){f(v)}else p(m.responseText)},m.onerror=()=>{c?.removeEventListener("abort",g),f({status:0,detail:"Falha de rede no upload."})},m.onabort=()=>{c?.removeEventListener("abort",g),f(new DOMException("Aborted","AbortError"))},m.send(n)})}function wa(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException("Aborted","AbortError"));return}const s=setTimeout(n,e);t?.addEventListener("abort",()=>{clearTimeout(s),r(new DOMException("Aborted","AbortError"))},{once:!0})})}async function va(e,t={}){const{retries:n=3,initialDelay:r=300,maxDelay:s=1e4,shouldRetry:o=()=>!0,onRetry:i,signal:l}=t;let c=0,d;for(;c<n;){if(l?.aborted)throw new DOMException("Aborted","AbortError");try{return await e()}catch(p){if(d=p,c+=1,c>=n||!o(p,c))throw p;const f=Math.min(r*2**(c-1),s);i?.({attempt:c,delay:f,error:p}),await wa(f,l)}}throw d}function xa(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16;return(e==="x"?Math.floor(t):Math.floor(t)&3|8).toString(16)})}function ja(e,t){const{interval:n,disabled:r=!1,stopWhen:s,onError:o}=t,[i,l]=u.useState(null),[c,d]=u.useState(null),[p,f]=u.useState(!r),m=u.useRef(r),h=u.useRef(!1),_=u.useRef(null);async function g(){if(!(m.current||h.current)){h.current=!0;try{const w=await e();if(m.current)return;l(w),d(null),s?.(w)&&(m.current=!0)}catch(w){m.current||(d(w),o?.(w))}finally{h.current=!1,f(!1),m.current||(_.current=setTimeout(g,n))}}}return u.useEffect(()=>{if(m.current=r,r){_.current&&clearTimeout(_.current);return}return f(!0),g(),()=>{m.current=!0,_.current&&clearTimeout(_.current)}},[n,r]),{data:i,error:c,loading:p,stop:()=>{m.current=!0,_.current&&clearTimeout(_.current)},start:()=>{m.current&&(m.current=!1,g())}}}function Sa(e={}){const t=e.name??"tempest-auth",n=e.storage==="session"?()=>sessionStorage:()=>localStorage;return st.create()(ve.persist(r=>({user:e.initialUser??null,token:e.initialToken??null,isAuthenticated:!!e.initialToken,setSession:({user:s,token:o})=>r({user:s,token:o,isAuthenticated:!0}),setUser:s=>r({user:s}),setToken:s=>r({token:s,isAuthenticated:!!s}),logout:()=>r({user:null,token:null,isAuthenticated:!1})}),{name:t,storage:ve.createJSONStorage(n),partialize:r=>({user:r.user,token:r.token}),onRehydrateStorage:()=>r=>{r&&(r.isAuthenticated=!!r.token)}}))}function ka({isAuthenticated:e,children:t,fallback:n}){return a.jsx(a.Fragment,{children:e?t:n})}function Ne(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);return typeof atob<"u"?atob(t+n):Buffer.from(t+n,"base64").toString("binary")}function Re(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid JWT: must contain three segments.");const[n,r,s]=t;try{return{header:JSON.parse(Ne(n)),payload:JSON.parse(Ne(r)),signature:s}}catch{throw new Error("Invalid JWT: header or payload is not valid JSON.")}}function Na(e,t=0){try{const{payload:n}=Re(e);if(typeof n.exp!="number")return!0;const r=Math.floor(Date.now()/1e3);return n.exp<=r+t}catch{return!0}}function Ea(e,t={}){const{retries:n=3,initialDelay:r=400,reloadOnFinalFailure:s=!0}=t;async function o(i=1){try{return await e()}catch(l){if(i>=n)throw s&&typeof window<"u"&&window.location.reload(),l;return await new Promise(c=>setTimeout(c,r*2**(i-1))),o(i+1)}}return u.lazy(o)}function $a(e){let t=null;return()=>t||(t=(async()=>{try{await e()}finally{t=null}})(),t)}const Me={SHORT:30*1e3,DEFAULT:300*1e3,LONG:1800*1e3,INFINITE:1/0},De={SHORT:300*1e3,DEFAULT:1800*1e3,LONG:3600*1e3},Ca={REALTIME:5*1e3,FAST:30*1e3,DEFAULT:60*1e3,SLOW:300*1e3};function Ta(e,t){const n={all:[e]};for(const[r,s]of Object.entries(t))typeof s=="function"?n[r]=(...o)=>[e,...s(...o)]:n[r]=[e,...s];return n}function Ia({children:e,client:t,defaultOptions:n}){const[r]=u.useState(()=>t??new we.QueryClient({defaultOptions:{queries:{staleTime:Me.DEFAULT,gcTime:De.DEFAULT,retry:1,refetchOnWindowFocus:!1,...n?.queries??{}},mutations:{retry:0,...n?.mutations??{}}}}));return a.jsx(we.QueryClientProvider,{client:r,children:e})}function La(e){try{return JSON.parse(e)}catch{return e}}function Ae(e,t={}){const{withCredentials:n=!1,namedEvents:r=[],heartbeatEvents:s=["ping"],maxRetries:o=10,initialBackoff:i=1e3,maxBackoff:l=3e4,parser:c=La,onOpen:d,onMessage:p,onError:f,onStatusChange:m}=t;let h=null,_=null,g=0,w="idle",b=!1;function v(j){w!==j&&(w=j,m?.(j))}function x(j,N){s.includes(j)||p?.({event:j,data:c(N.data),id:N.lastEventId||void 0,raw:N})}function k(){if(b)return;if(g>=o){v("error");return}const j=Math.min(i*2**g,l);g+=1,_=setTimeout(E,j)}function E(){if(b)return;h&&h.close(),v("connecting");const j=new EventSource(e,{withCredentials:n});h=j,j.onopen=()=>{g=0,v("open"),d?.()},j.onmessage=N=>x("message",N);for(const N of r)j.addEventListener(N,ce=>x(N,ce));for(const N of s)j.addEventListener(N,()=>{});j.onerror=N=>{f?.(N),j.close(),h=null,v("closed"),k()}}function ie(){b=!0,_&&(clearTimeout(_),_=null),g=0,h&&(h.close(),h=null),v("closed")}function ae(){_&&(clearTimeout(_),_=null),g=0,b=!1,E()}return E(),{close:ie,reconnect:ae,get status(){return w}}}function Pa(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);return p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const f=Ae(e,{...s,onStatusChange:i,onMessage:m=>{c(m),p.current?.(m)}});return d.current=f.reconnect,()=>{f.close(),d.current=null}},[e,n]),{status:o,lastMessage:l,reconnect:()=>d.current?.()}}function Fe(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),o=new Uint8Array(s);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}function X(){return typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}class he extends Error{constructor(){super("Web Push não suportado neste navegador."),this.name="WebPushUnsupportedError"}}class We extends Error{constructor(){super("Permissão de notificação negada pelo usuário."),this.name="WebPushPermissionDeniedError"}}class Oe{config;constructor(t){this.config=t}static isSupported(){return X()}async registration(){if(!X())throw new he;return this.config.getRegistration?await this.config.getRegistration():await navigator.serviceWorker.ready}permission(){return typeof Notification>"u"?"unsupported":Notification.permission}async requestPermission(){if(typeof Notification>"u")throw new he;return Notification.requestPermission()}async getSubscription(){return(await this.registration()).pushManager.getSubscription()}async isSubscribed(){return X()?await this.getSubscription()!==null:!1}async subscribe(){if(await this.requestPermission()!=="granted")throw new We;const n=await this.registration(),r=await n.pushManager.getSubscription();if(r)return await this.config.onSubscribe(r.toJSON()),r;const s=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Fe(this.config.vapidPublicKey)});return await this.config.onSubscribe(s.toJSON()),s}async unsubscribe(){const t=await this.getSubscription();return t?(this.config.onUnsubscribe&&await this.config.onUnsubscribe(t.toJSON()),t.unsubscribe()):!1}}function Ra(e){const t=u.useRef(e);t.current=e;const n=u.useMemo(()=>new Oe({vapidPublicKey:e.vapidPublicKey,onSubscribe:g=>t.current.onSubscribe(g),onUnsubscribe:g=>t.current.onUnsubscribe?.(g),getRegistration:e.getRegistration}),[e.vapidPublicKey,e.getRegistration]),[r]=u.useState(()=>X()),[s,o]=u.useState(()=>n.permission()),[i,l]=u.useState(!1),[c,d]=u.useState(!1),[p,f]=u.useState(null),m=u.useCallback(async()=>{if(r){o(n.permission());try{const g=await n.isSubscribed();l(g)}catch(g){f(g instanceof Error?g:new Error(String(g)))}}},[n,r]);u.useEffect(()=>{m()},[m]);const h=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.subscribe(),l(!0),o(n.permission())}catch(g){throw f(g instanceof Error?g:new Error(String(g))),g}finally{d(!1)}}},[n,r]),_=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.unsubscribe(),l(!1)}catch(g){throw f(g instanceof Error?g:new Error(String(g))),g}finally{d(!1)}}},[n,r]);return{supported:r,permission:s,subscribed:i,loading:c,error:p,subscribe:h,unsubscribe:_,refresh:m}}async function Ma(e){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const t=await navigator.serviceWorker.register(e.url,{scope:e.scope});return t.active&&e.onReady?.(t),t.addEventListener("updatefound",()=>{const n=t.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&e.onUpdate?.(n,t)})}),t}catch(t){return e.onError?.(t),null}}function Da(e){e.postMessage({type:"SKIP_WAITING"})}async function Aa(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return 0;const e=await navigator.serviceWorker.getRegistrations();let t=0;for(const n of e)await n.unregister()&&(t+=1);return t}function _e(){return globalThis}function Fa(e={}){const t=_e(),{defaultTitle:n="Notificação",defaultIcon:r,defaultBadge:s,transform:o}=e;t.addEventListener("push",i=>{if(!i.data)return;let l;try{l=i.data.json()}catch{l={title:n,body:i.data.text()}}const c=o?o(l):l;if(!c)return;const d=c.title??n,p={body:c.body,icon:c.icon??r,badge:c.badge??s,image:c.image,tag:c.tag,data:{url:c.url??"/",...c.data??{}}};i.waitUntil(t.registration.showNotification(d,p))})}function Wa(e={}){const t=_e(),n=e.resolveUrl??(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"&&"url"in r){const s=r.url;return typeof s=="string"?s:"/"}return"/"});t.addEventListener("notificationclick",r=>{r.notification.close();const s=n(r.notification.data);r.waitUntil((async()=>{const o=await t.clients.matchAll({type:"window",includeUncontrolled:!0});for(const i of o)if(i.url.includes(s))return i.focus();return t.clients.openWindow(s)})())})}function Oa(){const e=_e();e.addEventListener("message",t=>{t.data?.type==="SKIP_WAITING"&&e.skipWaiting()})}function ye(){let e=null;async function t(r,{volume:s=1,loop:o=!1,autoplay:i=!0,stopPrevious:l=!1,onEnded:c,onError:d}={}){try{l&&e&&(e.pause(),e.currentTime=0);const p=new Audio(r);return p.volume=Math.max(0,Math.min(1,s)),p.loop=o,p.preload="auto",c&&(p.onended=c),d&&(p.onerror=f=>d(f)),e=p,i&&await p.play(),p}catch(p){return d?.(p),null}}function n(){e&&(e.pause(),e.currentTime=0)}return{play:t,stop:n,current:()=>e}}let pe=null;function Be(){return pe||(pe=ye()),pe}async function Ba(e,t){return Be().play(e,t)}function Ua(){Be().stop()}function za(){const e=u.useRef(null),[t,n]=u.useState(!1);e.current||(e.current=ye()),u.useEffect(()=>()=>{e.current?.stop()},[]);const r=u.useCallback(async(o,i)=>{await e.current.play(o,i)&&n(!0)},[]),s=u.useCallback(()=>{e.current?.stop()},[]);return{play:r,stop:s,unlocked:t}}class qa extends ot{store;constructor(t,n,r,s){super(t),this.version(n).stores({[r]:s}),this.store=this.table(r)}}function Ja(e){const{databaseName:t,version:n,tableName:r,indexes:s,keyPath:o="id",ownerField:i}=e,l=new qa(t,n,r,s),c=l.store;function d(f,m){return!i||!m?f:{...f,[i]:m}}async function p(f,m={}){const{orderBy:h=o,reverse:_=!1,limit:g,offset:w,filter:b}=m;let v=i&&f?c.where(i).equals(f):c.toCollection();b&&(v=v.filter(b));let x=h===o?await v.toArray():await v.sortBy(h);return _&&(x=x.reverse()),w&&(x=x.slice(w)),typeof g=="number"&&(x=x.slice(0,g)),x}return{put:(f,m)=>c.put(d(f,m)),bulkPut:(f,m)=>c.bulkPut(f.map(h=>d(h,m))),get:f=>c.get(f),list:p,update:(f,m)=>c.update(f,m),updateMany:async(f,m)=>{const h=m;return i&&f?c.where(i).equals(f).modify(h):c.toCollection().modify(h)},delete:f=>c.delete(f),clear:async f=>{if(i&&f){await c.where(i).equals(f).delete();return}await c.clear()},count:f=>i&&f?c.where(i).equals(f).count():c.count(),raw:c,db:l}}function Ga(e=[],t=[]){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!0;return!1}class Ha extends u.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t){this.state.error&&Ga(t.resetKeys,this.props.resetKeys)&&this.reset()}reset=()=>{this.setState({error:null})};render(){const{error:t}=this.state;if(!t)return this.props.children;const{fallback:n}=this.props;return typeof n=="function"?n({error:t,reset:this.reset}):n}}function Ka(){const[,e]=u.useState(null);return u.useCallback(t=>{e(()=>{throw t instanceof Error?t:new Error(String(t))})},[])}function Va(e,t){const n=e.safeParse(t);if(n.success)return{success:!0,data:n.data,errors:{}};const r={};for(const s of n.error.issues){const o=s.path.length===0?"_root":s.path.join(".");o in r||(r[o]=s.message)}return{success:!1,errors:r}}function Ue(e){return async(t,n,r)=>{const s=e.safeParse(t);if(s.success)return{values:s.data,errors:{}};const o={},i=r.criteriaMode??"firstError";for(const l of s.error.issues){const c=l.path.length===0?"_root":l.path.join(".");i==="firstError"&&o[c]||(o[c]={type:l.code,message:l.message})}return{values:{},errors:o}}}function Qa(e,t={}){return it.useForm({...t,resolver:Ue(e)})}function ee(e){return e.replace(/\D/g,"")}function Ya(e){const t=ee(e);if(t.length!==11||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number);let r=0;for(let o=0;o<9;o++)r+=n[o]*(10-o);let s=r*10%11;if(s===10&&(s=0),s!==n[9])return!1;r=0;for(let o=0;o<10;o++)r+=n[o]*(11-o);return s=r*10%11,s===10&&(s=0),s===n[10]}function Za(e){const t=ee(e);if(t.length!==14||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number),r=[5,4,3,2,9,8,7,6,5,4,3,2],s=[6,5,4,3,2,9,8,7,6,5,4,3,2];let o=0;for(let l=0;l<12;l++)o+=n[l]*r[l];let i=o%11;if(i=i<2?0:11-i,i!==n[12])return!1;o=0;for(let l=0;l<13;l++)o+=n[l]*s[l];return i=o%11,i=i<2?0:11-i,i===n[13]}function ze(e){return ee(e).slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")}function qe(e){return ee(e).slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2")}function Xa(e){return ee(e)}function ec(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)}function tc(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR").format(t)}function nc(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR",{dateStyle:"short",timeStyle:"short"}).format(t)}function Je(e){const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")}function Ge(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}function rc(e){return new Intl.NumberFormat("pt-BR",{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}function oe(e,t="numeric"){return u.forwardRef(function({value:r,onChange:s,...o},i){return a.jsx(re,{...o,ref:i,value:e(r??""),inputMode:t,onChange:l=>s(e(l.target.value))})})}const sc=oe(Ge),oc=oe(qe),ic=oe(Je,"tel"),ac=oe(ze);function cc(e,t,n){return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e/100)}function lc(e){const t=e.replace(/\D/g,"");return t?Number.parseInt(t,10):0}const uc=u.forwardRef(function({value:t,onChange:n,currency:r="BRL",locale:s="pt-BR",...o},i){return a.jsx(re,{...o,ref:i,type:"text",inputMode:"numeric",value:cc(t||0,s,r),onChange:l=>n(lc(l.target.value))})});function dc(){const[e,t]=u.useState(!1),[n,r]=u.useState(null),[s,o]=u.useState(null),i=u.useCallback(async c=>{const d=c.replace(/\D/g,"");if(d.length!==8)return r("CEP inválido."),null;t(!0),r(null);try{const f=await(await fetch(`https://viacep.com.br/ws/${d}/json/`)).json();return"erro"in f&&f.erro?(r("CEP não encontrado."),o(null),null):(o(f),f)}catch(p){return r(p instanceof Error?p.message:String(p)),null}finally{t(!1)}},[]),l=u.useCallback(()=>{t(!1),r(null),o(null)},[]);return{loading:e,error:n,data:s,lookup:i,reset:l}}function pc(e){try{return JSON.parse(e)}catch{return e}}function He(e,t={}){const{protocols:n,maxRetries:r=10,initialBackoff:s=1e3,maxBackoff:o=3e4,pingInterval:i=0,pingPayload:l=JSON.stringify({type:"ping"}),parser:c=pc,onOpen:d,onMessage:p,onClose:f,onError:m,onStatusChange:h}=t;let _=null,g=null,w=null,b=0,v="idle",x=!1;function k(S){v!==S&&(v=S,h?.(S))}function E(){w&&(clearInterval(w),w=null)}function ie(){!i||i<=0||(E(),w=setInterval(()=>{_?.readyState===WebSocket.OPEN&&_.send(l)},i))}function ae(){if(x)return;if(b>=r){k("error");return}const S=Math.min(s*2**b,o);b+=1,g=setTimeout(j,S)}function j(){if(x)return;_&&(_.onopen=null,_.onmessage=null,_.onclose=null,_.onerror=null,_.close()),k("connecting");const S=new WebSocket(e,n);_=S,S.onopen=C=>{b=0,k("open"),ie(),d?.(C)},S.onmessage=C=>{const rt=typeof C.data=="string"?C.data:"";p?.({data:c(rt),raw:C})},S.onerror=C=>{m?.(C)},S.onclose=C=>{E(),f?.(C),_=null,k("closed"),!x&&!C.wasClean&&ae()}}function N(S){return _?.readyState!==WebSocket.OPEN?!1:(_.send(S),!0)}function ce(S,C){x=!0,g&&(clearTimeout(g),g=null),E(),b=0,_&&(k("closing"),_.close(S,C),_=null),k("closed")}function nt(){g&&(clearTimeout(g),g=null),b=0,x=!1,j()}return j(),{send:N,close:ce,reconnect:nt,get status(){return v}}}function fc(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const h=He(e,{...s,onStatusChange:i,onMessage:_=>{c(_),p.current?.(_)}});return d.current=h,()=>{h.close(),d.current=null}},[e,n]);const f=u.useCallback(h=>d.current?.send(h)??!1,[]),m=u.useCallback(()=>{d.current?.reconnect()},[]);return{status:o,lastMessage:l,send:f,reconnect:m}}const Ke=u.createContext(null);function Ee(e){return e==="dark"||e==="light"?e:typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function mc(e){if(!e||typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function hc({children:e,defaultTheme:t="system",storageKey:n="tempest-theme",target:r,attribute:s="data-tempest-theme"}){const[o,i]=u.useState(()=>mc(n)??t),[l,c]=u.useState(()=>Ee(o)),d=u.useRef(r);d.current=r,u.useEffect(()=>{const h=d.current?.()??document.documentElement;if(!h)return;const _=Ee(o);h.setAttribute(s,_),c(_)},[o,s]),u.useEffect(()=>{if(o!=="system"||typeof window>"u")return;const h=window.matchMedia("(prefers-color-scheme: dark)"),_=()=>{const g=d.current?.()??document.documentElement,w=h.matches?"dark":"light";g?.setAttribute(s,w),c(w)};return h.addEventListener("change",_),()=>h.removeEventListener("change",_)},[o,s]);const p=u.useCallback(h=>{if(i(h),n&&typeof window<"u")try{window.localStorage.setItem(n,h)}catch{}},[n]),f=u.useCallback(()=>{p(l==="dark"?"light":"dark")},[l,p]),m=u.useMemo(()=>({theme:o,resolvedTheme:l,setTheme:p,toggle:f}),[o,l,p,f]);return a.jsx(Ke.Provider,{value:m,children:e})}function gc(){const e=u.useContext(Ke);if(!e)throw new Error("useTheme must be used inside a <ThemeProvider>");return e}function _c(e={}){const{storageKey:t="tempest-theme",defaultTheme:n="system"}=e;if(typeof window>"u")return n==="dark"?"dark":"light";let r=null;try{r=window.localStorage.getItem(t)}catch{r=null}const s=r??n;return s==="dark"||s==="light"?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function yc(e={}){const t=e.storageKey??"tempest-theme",n=e.defaultTheme??"system";return`
5
+ Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida do servidor (${n}).`)}function za(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function qa(e){const{url:t,body:n,method:r="POST",headers:s={},getToken:o,withCredentials:i=!1,onProgress:l,signal:c,parser:d=JSON.parse}=e;return new Promise((p,f)=>{if(c?.aborted){f(new DOMException("Aborted","AbortError"));return}const m=new XMLHttpRequest;m.open(r,t),m.withCredentials=i;const _=o?.(),g={...s};_&&!("Authorization"in g)&&(g.Authorization=`Bearer ${_}`);for(const[w,b]of Object.entries(g))m.setRequestHeader(w,b);l&&(m.upload.onprogress=w=>{l({loaded:w.loaded,total:w.total,fraction:w.lengthComputable?w.loaded/w.total:null,lengthComputable:w.lengthComputable})});function h(){m.abort()}c?.addEventListener("abort",h),m.onload=()=>{c?.removeEventListener("abort",h);const w=m.status>=200&&m.status<300,b=m.getResponseHeader("content-type")??"";if(!w){const x=za(m.responseText),v=(typeof x=="object"&&x!==null?x.detail??x.message:void 0)??`Erro ${m.status}`,E={status:m.status,detail:String(v),body:x};f(E);return}if(m.status===204||!m.responseText){p(void 0);return}if(b.includes("application/json"))try{p(d(m.responseText))}catch(x){f(x)}else p(m.responseText)},m.onerror=()=>{c?.removeEventListener("abort",h),f({status:0,detail:"Falha de rede no upload."})},m.onabort=()=>{c?.removeEventListener("abort",h),f(new DOMException("Aborted","AbortError"))},m.send(n)})}function Ua(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new DOMException("Aborted","AbortError"));return}const s=setTimeout(n,e);t?.addEventListener("abort",()=>{clearTimeout(s),r(new DOMException("Aborted","AbortError"))},{once:!0})})}async function Ja(e,t={}){const{retries:n=3,initialDelay:r=300,maxDelay:s=1e4,shouldRetry:o=()=>!0,onRetry:i,signal:l}=t;let c=0,d;for(;c<n;){if(l?.aborted)throw new DOMException("Aborted","AbortError");try{return await e()}catch(p){if(d=p,c+=1,c>=n||!o(p,c))throw p;const f=Math.min(r*2**(c-1),s);i?.({attempt:c,delay:f,error:p}),await Ua(f,l)}}throw d}function Ga(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16;return(e==="x"?Math.floor(t):Math.floor(t)&3|8).toString(16)})}function Ha(e,t){const{interval:n,disabled:r=!1,stopWhen:s,onError:o}=t,[i,l]=u.useState(null),[c,d]=u.useState(null),[p,f]=u.useState(!r),m=u.useRef(r),_=u.useRef(!1),g=u.useRef(null);async function h(){if(!(m.current||_.current)){_.current=!0;try{const w=await e();if(m.current)return;l(w),d(null),s?.(w)&&(m.current=!0)}catch(w){m.current||(d(w),o?.(w))}finally{_.current=!1,f(!1),m.current||(g.current=setTimeout(h,n))}}}return u.useEffect(()=>{if(m.current=r,r){g.current&&clearTimeout(g.current);return}return f(!0),h(),()=>{m.current=!0,g.current&&clearTimeout(g.current)}},[n,r]),{data:i,error:c,loading:p,stop:()=>{m.current=!0,g.current&&clearTimeout(g.current)},start:()=>{m.current&&(m.current=!1,h())}}}function Ka(e={}){const t=e.name??"tempest-auth",n=e.storage==="session"?()=>sessionStorage:()=>localStorage;return st.create()(ve.persist(r=>({user:e.initialUser??null,token:e.initialToken??null,isAuthenticated:!!e.initialToken,setSession:({user:s,token:o})=>r({user:s,token:o,isAuthenticated:!0}),setUser:s=>r({user:s}),setToken:s=>r({token:s,isAuthenticated:!!s}),logout:()=>r({user:null,token:null,isAuthenticated:!1})}),{name:t,storage:ve.createJSONStorage(n),partialize:r=>({user:r.user,token:r.token}),onRehydrateStorage:()=>r=>{r&&(r.isAuthenticated=!!r.token)}}))}function Va({isAuthenticated:e,children:t,fallback:n}){return a.jsx(a.Fragment,{children:e?t:n})}function Ee(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.length%4===0?"":"=".repeat(4-t.length%4);return typeof atob<"u"?atob(t+n):Buffer.from(t+n,"base64").toString("binary")}function Re(e){const t=e.split(".");if(t.length!==3)throw new Error("Invalid JWT: must contain three segments.");const[n,r,s]=t;try{return{header:JSON.parse(Ee(n)),payload:JSON.parse(Ee(r)),signature:s}}catch{throw new Error("Invalid JWT: header or payload is not valid JSON.")}}function Qa(e,t=0){try{const{payload:n}=Re(e);if(typeof n.exp!="number")return!0;const r=Math.floor(Date.now()/1e3);return n.exp<=r+t}catch{return!0}}function Ya(e,t={}){const{retries:n=3,initialDelay:r=400,reloadOnFinalFailure:s=!0}=t;async function o(i=1){try{return await e()}catch(l){if(i>=n)throw s&&typeof window<"u"&&window.location.reload(),l;return await new Promise(c=>setTimeout(c,r*2**(i-1))),o(i+1)}}return u.lazy(o)}function Za(e){let t=null;return()=>t||(t=(async()=>{try{await e()}finally{t=null}})(),t)}const Me={SHORT:30*1e3,DEFAULT:300*1e3,LONG:1800*1e3,INFINITE:1/0},De={SHORT:300*1e3,DEFAULT:1800*1e3,LONG:3600*1e3},Xa={REALTIME:5*1e3,FAST:30*1e3,DEFAULT:60*1e3,SLOW:300*1e3};function ec(e,t){const n={all:[e]};for(const[r,s]of Object.entries(t))typeof s=="function"?n[r]=(...o)=>[e,...s(...o)]:n[r]=[e,...s];return n}function tc({children:e,client:t,defaultOptions:n}){const[r]=u.useState(()=>t??new xe.QueryClient({defaultOptions:{queries:{staleTime:Me.DEFAULT,gcTime:De.DEFAULT,retry:1,refetchOnWindowFocus:!1,...n?.queries??{}},mutations:{retry:0,...n?.mutations??{}}}}));return a.jsx(xe.QueryClientProvider,{client:r,children:e})}function nc(e){try{return JSON.parse(e)}catch{return e}}function Fe(e,t={}){const{withCredentials:n=!1,namedEvents:r=[],heartbeatEvents:s=["ping"],maxRetries:o=10,initialBackoff:i=1e3,maxBackoff:l=3e4,parser:c=nc,onOpen:d,onMessage:p,onError:f,onStatusChange:m}=t;let _=null,g=null,h=0,w="idle",b=!1;function x(j){w!==j&&(w=j,m?.(j))}function v(j,N){s.includes(j)||p?.({event:j,data:c(N.data),id:N.lastEventId||void 0,raw:N})}function E(){if(b)return;if(h>=o){x("error");return}const j=Math.min(i*2**h,l);h+=1,g=setTimeout($,j)}function $(){if(b)return;_&&_.close(),x("connecting");const j=new EventSource(e,{withCredentials:n});_=j,j.onopen=()=>{h=0,x("open"),d?.()},j.onmessage=N=>v("message",N);for(const N of r)j.addEventListener(N,le=>v(N,le));for(const N of s)j.addEventListener(N,()=>{});j.onerror=N=>{f?.(N),j.close(),_=null,x("closed"),E()}}function ae(){b=!0,g&&(clearTimeout(g),g=null),h=0,_&&(_.close(),_=null),x("closed")}function ce(){g&&(clearTimeout(g),g=null),h=0,b=!1,$()}return $(),{close:ae,reconnect:ce,get status(){return w}}}function rc(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);return p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const f=Fe(e,{...s,onStatusChange:i,onMessage:m=>{c(m),p.current?.(m)}});return d.current=f.reconnect,()=>{f.close(),d.current=null}},[e,n]),{status:o,lastMessage:l,reconnect:()=>d.current?.()}}function Ae(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/-/g,"+").replace(/_/g,"/"),r=window.atob(n),s=new ArrayBuffer(r.length),o=new Uint8Array(s);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}function ee(){return typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window}class _e extends Error{constructor(){super("Web Push não suportado neste navegador."),this.name="WebPushUnsupportedError"}}class We extends Error{constructor(){super("Permissão de notificação negada pelo usuário."),this.name="WebPushPermissionDeniedError"}}class Oe{config;constructor(t){this.config=t}static isSupported(){return ee()}async registration(){if(!ee())throw new _e;return this.config.getRegistration?await this.config.getRegistration():await navigator.serviceWorker.ready}permission(){return typeof Notification>"u"?"unsupported":Notification.permission}async requestPermission(){if(typeof Notification>"u")throw new _e;return Notification.requestPermission()}async getSubscription(){return(await this.registration()).pushManager.getSubscription()}async isSubscribed(){return ee()?await this.getSubscription()!==null:!1}async subscribe(){if(await this.requestPermission()!=="granted")throw new We;const n=await this.registration(),r=await n.pushManager.getSubscription();if(r)return await this.config.onSubscribe(r.toJSON()),r;const s=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ae(this.config.vapidPublicKey)});return await this.config.onSubscribe(s.toJSON()),s}async unsubscribe(){const t=await this.getSubscription();return t?(this.config.onUnsubscribe&&await this.config.onUnsubscribe(t.toJSON()),t.unsubscribe()):!1}}function sc(e){const t=u.useRef(e);t.current=e;const n=u.useMemo(()=>new Oe({vapidPublicKey:e.vapidPublicKey,onSubscribe:h=>t.current.onSubscribe(h),onUnsubscribe:h=>t.current.onUnsubscribe?.(h),getRegistration:e.getRegistration}),[e.vapidPublicKey,e.getRegistration]),[r]=u.useState(()=>ee()),[s,o]=u.useState(()=>n.permission()),[i,l]=u.useState(!1),[c,d]=u.useState(!1),[p,f]=u.useState(null),m=u.useCallback(async()=>{if(r){o(n.permission());try{const h=await n.isSubscribed();l(h)}catch(h){f(h instanceof Error?h:new Error(String(h)))}}},[n,r]);u.useEffect(()=>{m()},[m]);const _=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.subscribe(),l(!0),o(n.permission())}catch(h){throw f(h instanceof Error?h:new Error(String(h))),h}finally{d(!1)}}},[n,r]),g=u.useCallback(async()=>{if(r){d(!0),f(null);try{await n.unsubscribe(),l(!1)}catch(h){throw f(h instanceof Error?h:new Error(String(h))),h}finally{d(!1)}}},[n,r]);return{supported:r,permission:s,subscribed:i,loading:c,error:p,subscribe:_,unsubscribe:g,refresh:m}}async function oc(e){if(typeof navigator>"u"||!("serviceWorker"in navigator))return null;try{const t=await navigator.serviceWorker.register(e.url,{scope:e.scope});return t.active&&e.onReady?.(t),t.addEventListener("updatefound",()=>{const n=t.installing;n&&n.addEventListener("statechange",()=>{n.state==="installed"&&navigator.serviceWorker.controller&&e.onUpdate?.(n,t)})}),t}catch(t){return e.onError?.(t),null}}function ic(e){e.postMessage({type:"SKIP_WAITING"})}async function ac(){if(typeof navigator>"u"||!("serviceWorker"in navigator))return 0;const e=await navigator.serviceWorker.getRegistrations();let t=0;for(const n of e)await n.unregister()&&(t+=1);return t}function ye(){return globalThis}function cc(e={}){const t=ye(),{defaultTitle:n="Notificação",defaultIcon:r,defaultBadge:s,transform:o}=e;t.addEventListener("push",i=>{if(!i.data)return;let l;try{l=i.data.json()}catch{l={title:n,body:i.data.text()}}const c=o?o(l):l;if(!c)return;const d=c.title??n,p={body:c.body,icon:c.icon??r,badge:c.badge??s,image:c.image,tag:c.tag,data:{url:c.url??"/",...c.data??{}}};i.waitUntil(t.registration.showNotification(d,p))})}function lc(e={}){const t=ye(),n=e.resolveUrl??(r=>{if(typeof r=="string")return r;if(r&&typeof r=="object"&&"url"in r){const s=r.url;return typeof s=="string"?s:"/"}return"/"});t.addEventListener("notificationclick",r=>{r.notification.close();const s=n(r.notification.data);r.waitUntil((async()=>{const o=await t.clients.matchAll({type:"window",includeUncontrolled:!0});for(const i of o)if(i.url.includes(s))return i.focus();return t.clients.openWindow(s)})())})}function uc(){const e=ye();e.addEventListener("message",t=>{t.data?.type==="SKIP_WAITING"&&e.skipWaiting()})}function be(){let e=null;async function t(r,{volume:s=1,loop:o=!1,autoplay:i=!0,stopPrevious:l=!1,onEnded:c,onError:d}={}){try{l&&e&&(e.pause(),e.currentTime=0);const p=new Audio(r);return p.volume=Math.max(0,Math.min(1,s)),p.loop=o,p.preload="auto",c&&(p.onended=c),d&&(p.onerror=f=>d(f)),e=p,i&&await p.play(),p}catch(p){return d?.(p),null}}function n(){e&&(e.pause(),e.currentTime=0)}return{play:t,stop:n,current:()=>e}}let fe=null;function Be(){return fe||(fe=be()),fe}async function dc(e,t){return Be().play(e,t)}function pc(){Be().stop()}function fc(){const e=u.useRef(null),[t,n]=u.useState(!1);e.current||(e.current=be()),u.useEffect(()=>()=>{e.current?.stop()},[]);const r=u.useCallback(async(o,i)=>{await e.current.play(o,i)&&n(!0)},[]),s=u.useCallback(()=>{e.current?.stop()},[]);return{play:r,stop:s,unlocked:t}}class mc extends ot{store;constructor(t,n,r,s){super(t),this.version(n).stores({[r]:s}),this.store=this.table(r)}}function hc(e){const{databaseName:t,version:n,tableName:r,indexes:s,keyPath:o="id",ownerField:i}=e,l=new mc(t,n,r,s),c=l.store;function d(f,m){return!i||!m?f:{...f,[i]:m}}async function p(f,m={}){const{orderBy:_=o,reverse:g=!1,limit:h,offset:w,filter:b}=m;let x=i&&f?c.where(i).equals(f):c.toCollection();b&&(x=x.filter(b));let v=_===o?await x.toArray():await x.sortBy(_);return g&&(v=v.reverse()),w&&(v=v.slice(w)),typeof h=="number"&&(v=v.slice(0,h)),v}return{put:(f,m)=>c.put(d(f,m)),bulkPut:(f,m)=>c.bulkPut(f.map(_=>d(_,m))),get:f=>c.get(f),list:p,update:(f,m)=>c.update(f,m),updateMany:async(f,m)=>{const _=m;return i&&f?c.where(i).equals(f).modify(_):c.toCollection().modify(_)},delete:f=>c.delete(f),clear:async f=>{if(i&&f){await c.where(i).equals(f).delete();return}await c.clear()},count:f=>i&&f?c.where(i).equals(f).count():c.count(),raw:c,db:l}}function _c(e=[],t=[]){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!0;return!1}class gc extends u.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){this.props.onError?.(t,n)}componentDidUpdate(t){this.state.error&&_c(t.resetKeys,this.props.resetKeys)&&this.reset()}reset=()=>{this.setState({error:null})};render(){const{error:t}=this.state;if(!t)return this.props.children;const{fallback:n}=this.props;return typeof n=="function"?n({error:t,reset:this.reset}):n}}function yc(){const[,e]=u.useState(null);return u.useCallback(t=>{e(()=>{throw t instanceof Error?t:new Error(String(t))})},[])}function bc(e,t){const n=e.safeParse(t);if(n.success)return{success:!0,data:n.data,errors:{}};const r={};for(const s of n.error.issues){const o=s.path.length===0?"_root":s.path.join(".");o in r||(r[o]=s.message)}return{success:!1,errors:r}}function ze(e){return async(t,n,r)=>{const s=e.safeParse(t);if(s.success)return{values:s.data,errors:{}};const o={},i=r.criteriaMode??"firstError";for(const l of s.error.issues){const c=l.path.length===0?"_root":l.path.join(".");i==="firstError"&&o[c]||(o[c]={type:l.code,message:l.message})}return{values:{},errors:o}}}function wc(e,t={}){return it.useForm({...t,resolver:ze(e)})}function te(e){return e.replace(/\D/g,"")}function xc(e){const t=te(e);if(t.length!==11||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number);let r=0;for(let o=0;o<9;o++)r+=n[o]*(10-o);let s=r*10%11;if(s===10&&(s=0),s!==n[9])return!1;r=0;for(let o=0;o<10;o++)r+=n[o]*(11-o);return s=r*10%11,s===10&&(s=0),s===n[10]}function vc(e){const t=te(e);if(t.length!==14||/^(\d)\1+$/.test(t))return!1;const n=t.split("").map(Number),r=[5,4,3,2,9,8,7,6,5,4,3,2],s=[6,5,4,3,2,9,8,7,6,5,4,3,2];let o=0;for(let l=0;l<12;l++)o+=n[l]*r[l];let i=o%11;if(i=i<2?0:11-i,i!==n[12])return!1;o=0;for(let l=0;l<13;l++)o+=n[l]*s[l];return i=o%11,i=i<2?0:11-i,i===n[13]}function qe(e){return te(e).slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")}function Ue(e){return te(e).slice(0,14).replace(/(\d{2})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1/$2").replace(/(\d{4})(\d)/,"$1-$2")}function jc(e){return te(e)}function Sc(e){return new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e)}function kc(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR").format(t)}function Ec(e){const t=typeof e=="string"?new Date(e):e;return Number.isNaN(t.getTime())?"":new Intl.DateTimeFormat("pt-BR",{dateStyle:"short",timeStyle:"short"}).format(t)}function Je(e){const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")}function Ge(e){return e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2")}function Nc(e){return new Intl.NumberFormat("pt-BR",{style:"percent",minimumFractionDigits:1,maximumFractionDigits:1}).format(e)}function ie(e,t="numeric"){return u.forwardRef(function({value:r,onChange:s,...o},i){return a.jsx(se,{...o,ref:i,value:e(r??""),inputMode:t,onChange:l=>s(e(l.target.value))})})}const $c=ie(Ge),Cc=ie(Ue),Tc=ie(Je,"tel"),Ic=ie(qe);function Lc(e,t,n){return new Intl.NumberFormat(t,{style:"currency",currency:n}).format(e/100)}function Pc(e){const t=e.replace(/\D/g,"");return t?Number.parseInt(t,10):0}const Rc=u.forwardRef(function({value:t,onChange:n,currency:r="BRL",locale:s="pt-BR",...o},i){return a.jsx(se,{...o,ref:i,type:"text",inputMode:"numeric",value:Lc(t||0,s,r),onChange:l=>n(Pc(l.target.value))})});function Mc(){const[e,t]=u.useState(!1),[n,r]=u.useState(null),[s,o]=u.useState(null),i=u.useCallback(async c=>{const d=c.replace(/\D/g,"");if(d.length!==8)return r("CEP inválido."),null;t(!0),r(null);try{const f=await(await fetch(`https://viacep.com.br/ws/${d}/json/`)).json();return"erro"in f&&f.erro?(r("CEP não encontrado."),o(null),null):(o(f),f)}catch(p){return r(p instanceof Error?p.message:String(p)),null}finally{t(!1)}},[]),l=u.useCallback(()=>{t(!1),r(null),o(null)},[]);return{loading:e,error:n,data:s,lookup:i,reset:l}}function Dc(e){try{return JSON.parse(e)}catch{return e}}function He(e,t={}){const{protocols:n,maxRetries:r=10,initialBackoff:s=1e3,maxBackoff:o=3e4,pingInterval:i=0,pingPayload:l=JSON.stringify({type:"ping"}),parser:c=Dc,onOpen:d,onMessage:p,onClose:f,onError:m,onStatusChange:_}=t;let g=null,h=null,w=null,b=0,x="idle",v=!1;function E(S){x!==S&&(x=S,_?.(S))}function $(){w&&(clearInterval(w),w=null)}function ae(){!i||i<=0||($(),w=setInterval(()=>{g?.readyState===WebSocket.OPEN&&g.send(l)},i))}function ce(){if(v)return;if(b>=r){E("error");return}const S=Math.min(s*2**b,o);b+=1,h=setTimeout(j,S)}function j(){if(v)return;g&&(g.onopen=null,g.onmessage=null,g.onclose=null,g.onerror=null,g.close()),E("connecting");const S=new WebSocket(e,n);g=S,S.onopen=T=>{b=0,E("open"),ae(),d?.(T)},S.onmessage=T=>{const rt=typeof T.data=="string"?T.data:"";p?.({data:c(rt),raw:T})},S.onerror=T=>{m?.(T)},S.onclose=T=>{$(),f?.(T),g=null,E("closed"),!v&&!T.wasClean&&ce()}}function N(S){return g?.readyState!==WebSocket.OPEN?!1:(g.send(S),!0)}function le(S,T){v=!0,h&&(clearTimeout(h),h=null),$(),b=0,g&&(E("closing"),g.close(S,T),g=null),E("closed")}function nt(){h&&(clearTimeout(h),h=null),b=0,v=!1,j()}return j(),{send:N,close:le,reconnect:nt,get status(){return x}}}function Fc(e,t={}){const{enabled:n=!0,onMessage:r,...s}=t,[o,i]=u.useState("idle"),[l,c]=u.useState(null),d=u.useRef(null),p=u.useRef(r);p.current=r,u.useEffect(()=>{if(!n||!e){i("idle");return}const _=He(e,{...s,onStatusChange:i,onMessage:g=>{c(g),p.current?.(g)}});return d.current=_,()=>{_.close(),d.current=null}},[e,n]);const f=u.useCallback(_=>d.current?.send(_)??!1,[]),m=u.useCallback(()=>{d.current?.reconnect()},[]);return{status:o,lastMessage:l,send:f,reconnect:m}}const Ke=u.createContext(null);function Ne(e){return e==="dark"||e==="light"?e:typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ac(e){if(!e||typeof window>"u")return null;try{const t=window.localStorage.getItem(e);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function Wc({children:e,defaultTheme:t="system",storageKey:n="tempest-theme",target:r,attribute:s="data-tempest-theme"}){const[o,i]=u.useState(()=>Ac(n)??t),[l,c]=u.useState(()=>Ne(o)),d=u.useRef(r);d.current=r,u.useEffect(()=>{const _=d.current?.()??document.documentElement;if(!_)return;const g=Ne(o);_.setAttribute(s,g),c(g)},[o,s]),u.useEffect(()=>{if(o!=="system"||typeof window>"u")return;const _=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{const h=d.current?.()??document.documentElement,w=_.matches?"dark":"light";h?.setAttribute(s,w),c(w)};return _.addEventListener("change",g),()=>_.removeEventListener("change",g)},[o,s]);const p=u.useCallback(_=>{if(i(_),n&&typeof window<"u")try{window.localStorage.setItem(n,_)}catch{}},[n]),f=u.useCallback(()=>{p(l==="dark"?"light":"dark")},[l,p]),m=u.useMemo(()=>({theme:o,resolvedTheme:l,setTheme:p,toggle:f}),[o,l,p,f]);return a.jsx(Ke.Provider,{value:m,children:e})}function Oc(){const e=u.useContext(Ke);if(!e)throw new Error("useTheme must be used inside a <ThemeProvider>");return e}function Bc(e={}){const{storageKey:t="tempest-theme",defaultTheme:n="system"}=e;if(typeof window>"u")return n==="dark"?"dark":"light";let r=null;try{r=window.localStorage.getItem(t)}catch{r=null}const s=r??n;return s==="dark"||s==="light"?s:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function zc(e={}){const t=e.storageKey??"tempest-theme",n=e.defaultTheme??"system";return`
6
6
  (function(){try{
7
7
  var key=${JSON.stringify(t)};
8
8
  var def=${JSON.stringify(n)};
@@ -11,5 +11,5 @@ Raw payload: ${JSON.stringify(t,null,2)}`)}throw new Error(`Resposta inválida d
11
11
  var resolved=mode==="dark"||mode==="light"?mode:(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");
12
12
  document.documentElement.setAttribute("data-tempest-theme",resolved);
13
13
  }catch(e){}})();
14
- `.trim()}function $e(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s===void 0?`{${r}}`:String(s)}):e}function fe(e,t,n,r){const s=e[t]?.[r];if(s!==void 0)return s;if(n){const o=e[n]?.[r];if(o!==void 0)return o}return null}function be(e){const{locale:t,fallbackLocale:n=null,messages:r}=e;function s(c,d){const p=fe(r,t,n,c);return p===null?c:$e(p,d)}function o(c,d,p){const m=fe(r,t,n,`${c}${d===1?"_one":"_other"}`)??fe(r,t,n,c);return m===null?c:$e(m,{count:d,...p??{}})}function i(c,d){return new Intl.NumberFormat(t,d).format(c)}function l(c,d){const p=typeof c=="string"?new Date(c):c;return Number.isNaN(p.getTime())?"":new Intl.DateTimeFormat(t,d).format(p)}return{locale:t,fallbackLocale:n,t:s,plural:o,formatNumber:i,formatDate:l,withLocale:c=>be({locale:c,fallbackLocale:n??void 0,messages:r})}}const Ve=u.createContext(null);function bc(e,t){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);return n&&t.includes(n)?n:null}catch{return null}}function wc({children:e,locale:t,fallbackLocale:n,messages:r,storageKey:s="tempest-locale"}){const o=u.useMemo(()=>Object.keys(r),[r]),[i,l]=u.useState(()=>bc(s,o)??t);u.useEffect(()=>{typeof document<"u"&&document.documentElement.setAttribute("lang",i)},[i]);const c=u.useCallback(p=>{if(l(p),s&&typeof window<"u")try{window.localStorage.setItem(s,p)}catch{}},[s]),d=u.useMemo(()=>({...be({locale:i,fallbackLocale:n,messages:r}),setLocale:c,availableLocales:o}),[i,n,r,c,o]);return a.jsx(Ve.Provider,{value:d,children:e})}function Qe(){const e=u.useContext(Ve);if(!e)throw new Error("useI18n must be used inside an <I18nProvider>");return e}function vc(){return Qe().t}const Ce=["debug","info","warn","error"];function xc(e,t){return Ce.indexOf(t)>=Ce.indexOf(e)}const Ye=({level:e,message:t,context:n})=>{const r=e==="debug"?"log":e;n?console[r](t,n):console[r](t)};function Ze(e={}){const t=e.level??"info",n=e.sinks??[Ye],r=e.namespace??"";function s(o,i,l){if(!xc(t,o))return;const c={level:o,message:r?`[${r}] ${i}`:i,context:l,timestamp:Date.now()};for(const d of n)try{d(c)}catch{}}return{debug:(o,i)=>s("debug",o,i),info:(o,i)=>s("info",o,i),warn:(o,i)=>s("warn",o,i),error:(o,i)=>s("error",o,i),child:o=>Ze({level:t,sinks:n,namespace:r?`${r}:${o}`:o})}}const Xe=u.createContext(null);function jc({adapter:e,children:t}){u.useEffect(()=>(e.init?.(),()=>{e.flush?.()}),[e]);const n=u.useMemo(()=>e,[e]);return a.jsx(Xe.Provider,{value:n,children:t})}function Sc(){return u.useContext(Xe)}const kc={identify(e){console.info("[telemetry] identify",e)},track(e){console.info("[telemetry] track",e.name,e.properties)},captureException(e,t){console.error("[telemetry] exception",e,t)}};function Nc(e){if(e===null)return null;const{id:t,email:n,name:r,traits:s}=e;return{...t!==void 0?{id:t}:null,...n!==void 0?{email:n}:null,...r!==void 0?{username:r}:null,...s??null}}function Ec(e){const{sentry:t,initOptions:n,flushTimeout:r=2e3,breadcrumbCategory:s="app"}=e;return{init(){n&&t.init&&t.init(n)},identify(o){t.setUser(Nc(o))},track(o){t.addBreadcrumb({category:s,message:o.name,level:"info",...o.properties?{data:o.properties}:null})},captureException(o,i){t.captureException(o,i?{extra:i}:void 0)},async flush(){t.flush&&await t.flush(r)}}}const et=u.createContext(null);function $c({adapter:e,children:t}){const n=u.useMemo(()=>e,[e]);return u.useEffect(()=>{},[n]),a.jsx(et.Provider,{value:n,children:t})}function tt(){const e=u.useContext(et);if(!e)throw new Error("useFeatureFlag requires <FeatureFlagsProvider>");return e}function Cc(e,t=!1){const n=tt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.isEnabled(e,t);return u.useSyncExternalStore(r,s,s)}function Tc(e,t){const n=tt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.get(e,t);return u.useSyncExternalStore(r,s,s)}function Ic(e={}){const t={...e.initial??{}},n=new Set;function r(){for(const s of n)s()}return{isEnabled(s,o=!1){return s in t?!!t[s]:o},get(s,o){return s in t?t[s]:o},onChange(s){return n.add(s),()=>n.delete(s)},set(s,o){t[s]=o,r()}}}async function Lc(e){if(typeof navigator>"u"||!("share"in navigator))return{shared:!1,unsupported:!0,cancelled:!1};if(e.files&&!navigator.canShare?.({files:e.files}))return{shared:!1,unsupported:!0,cancelled:!1};try{return await navigator.share(e),{shared:!0,unsupported:!1,cancelled:!1}}catch(t){return t instanceof DOMException&&t.name==="AbortError"?{shared:!1,unsupported:!1,cancelled:!0}:{shared:!1,unsupported:!1,cancelled:!1,error:t}}}function Pc(){return typeof navigator<"u"&&"share"in navigator}const Rc={get(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}},set(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}};exports.AuthGuard=ka;exports.Avatar=wt;exports.Badge=Et;exports.Breadcrumbs=Pt;exports.Button=ne;exports.CACHE_TIME=De;exports.CEPInput=ac;exports.CNPJInput=oc;exports.CPFInput=sc;exports.Card=en;exports.Checkbox=ln;exports.ChipInput=vn;exports.ConfirmDialog=Dn;exports.Container=$s;exports.DatePicker=Vn;exports.Drawer=pr;exports.EmptyState=br;exports.ErrorBoundary=Ha;exports.ErrorState=kr;exports.FeatureFlagsProvider=$c;exports.FileUpload=Ur;exports.Form=os;exports.FormActions=cs;exports.FormRow=as;exports.FormSection=is;exports.Grid=Ts;exports.I18nProvider=wc;exports.Input=re;exports.Modal=Te;exports.MoneyInput=uc;exports.Pagination=Fs;exports.PhoneInput=ic;exports.Progress=Ks;exports.QueryProvider=Ia;exports.REFETCH_TIME=Ca;exports.Radio=so;exports.RadioGroup=oo;exports.STALE_TIME=Me;exports.SearchBar=uo;exports.Select=jo;exports.Skeleton=$o;exports.Spinner=Ro;exports.Stack=Cs;exports.Stepper=zo;exports.Switch=Qo;exports.Table=ii;exports.Tabs=pi;exports.TelemetryProvider=jc;exports.Textarea=wi;exports.ThemeProvider=hc;exports.ToastProvider=Oi;exports.Tooltip=$i;exports.VirtualList=Hi;exports.WebPushClient=Oe;exports.WebPushPermissionDeniedError=We;exports.WebPushUnsupportedError=he;exports.cn=y;exports.consoleSink=Ye;exports.consoleTelemetryAdapter=kc;exports.createApiClient=ga;exports.createAudioPlayer=ye;exports.createAuthStore=Sa;exports.createEventStream=Ae;exports.createI18n=be;exports.createInMemoryFlags=Ic;exports.createLogger=Ze;exports.createOfflineStore=Ja;exports.createQueryKeys=Ta;exports.createRefreshQueue=$a;exports.createSentryTelemetryAdapter=Ec;exports.createWebSocket=He;exports.decodeJWT=Re;exports.formatCEP=ze;exports.formatCNPJ=qe;exports.formatCPF=Ge;exports.formatCurrency=ec;exports.formatDate=tc;exports.formatDateTime=nc;exports.formatPercent=rc;exports.formatPhone=Je;exports.generateIdempotencyKey=xa;exports.getInitialTheme=_c;exports.installNotificationClickHandler=Wa;exports.installPushHandler=Fa;exports.installSkipWaitingListener=Oa;exports.isJWTExpired=Na;exports.isPushSupported=X;exports.isShareSupported=Pc;exports.lazyWithRetry=Ea;exports.parseResponse=_a;exports.playAudio=Ba;exports.registerServiceWorker=Ma;exports.retry=va;exports.share=Lc;exports.skipWaiting=Da;exports.stopAudio=Ua;exports.storage=Rc;exports.themeInitScript=yc;exports.unmask=Xa;exports.unregisterAllServiceWorkers=Aa;exports.uploadWithProgress=ba;exports.urlBase64ToUint8Array=Fe;exports.useAudio=za;exports.useBeforeInstallPrompt=ia;exports.useClientFilter=Qi;exports.useClipboard=na;exports.useDebounce=Ki;exports.useDeepMemo=fa;exports.useDocumentVisibility=Xi;exports.useErrorHandler=Ka;exports.useEventStream=Pa;exports.useFeatureFlag=Cc;exports.useFlagValue=Tc;exports.useFocusTrap=da;exports.useGeolocation=ca;exports.useI18n=Qe;exports.useIdle=aa;exports.useIntersectionObserver=ea;exports.useKeyboardShortcut=oa;exports.useMediaQuery=Yi;exports.useOnline=Zi;exports.usePagination=Vi;exports.usePoll=ja;exports.usePushSubscription=Ra;exports.useResizeObserver=ta;exports.useScrollLock=la;exports.useStableCallback=pa;exports.useTelemetry=Sc;exports.useTheme=gc;exports.useToast=Wi;exports.useTranslate=vc;exports.useViaCEP=dc;exports.useWebSocket=fc;exports.useZodForm=Qa;exports.validateCNPJ=Za;exports.validateCPF=Ya;exports.validateForm=Va;exports.zodResolver=Ue;
14
+ `.trim()}function $e(e,t){return t?e.replace(/\{(\w+)\}/g,(n,r)=>{const s=t[r];return s===void 0?`{${r}}`:String(s)}):e}function me(e,t,n,r){const s=e[t]?.[r];if(s!==void 0)return s;if(n){const o=e[n]?.[r];if(o!==void 0)return o}return null}function we(e){const{locale:t,fallbackLocale:n=null,messages:r}=e;function s(c,d){const p=me(r,t,n,c);return p===null?c:$e(p,d)}function o(c,d,p){const m=me(r,t,n,`${c}${d===1?"_one":"_other"}`)??me(r,t,n,c);return m===null?c:$e(m,{count:d,...p??{}})}function i(c,d){return new Intl.NumberFormat(t,d).format(c)}function l(c,d){const p=typeof c=="string"?new Date(c):c;return Number.isNaN(p.getTime())?"":new Intl.DateTimeFormat(t,d).format(p)}return{locale:t,fallbackLocale:n,t:s,plural:o,formatNumber:i,formatDate:l,withLocale:c=>we({locale:c,fallbackLocale:n??void 0,messages:r})}}const Ve=u.createContext(null);function qc(e,t){if(!e||typeof window>"u")return null;try{const n=window.localStorage.getItem(e);return n&&t.includes(n)?n:null}catch{return null}}function Uc({children:e,locale:t,fallbackLocale:n,messages:r,storageKey:s="tempest-locale"}){const o=u.useMemo(()=>Object.keys(r),[r]),[i,l]=u.useState(()=>qc(s,o)??t);u.useEffect(()=>{typeof document<"u"&&document.documentElement.setAttribute("lang",i)},[i]);const c=u.useCallback(p=>{if(l(p),s&&typeof window<"u")try{window.localStorage.setItem(s,p)}catch{}},[s]),d=u.useMemo(()=>({...we({locale:i,fallbackLocale:n,messages:r}),setLocale:c,availableLocales:o}),[i,n,r,c,o]);return a.jsx(Ve.Provider,{value:d,children:e})}function Qe(){const e=u.useContext(Ve);if(!e)throw new Error("useI18n must be used inside an <I18nProvider>");return e}function Jc(){return Qe().t}const Ce=["debug","info","warn","error"];function Gc(e,t){return Ce.indexOf(t)>=Ce.indexOf(e)}const Ye=({level:e,message:t,context:n})=>{const r=e==="debug"?"log":e;n?console[r](t,n):console[r](t)};function Ze(e={}){const t=e.level??"info",n=e.sinks??[Ye],r=e.namespace??"";function s(o,i,l){if(!Gc(t,o))return;const c={level:o,message:r?`[${r}] ${i}`:i,context:l,timestamp:Date.now()};for(const d of n)try{d(c)}catch{}}return{debug:(o,i)=>s("debug",o,i),info:(o,i)=>s("info",o,i),warn:(o,i)=>s("warn",o,i),error:(o,i)=>s("error",o,i),child:o=>Ze({level:t,sinks:n,namespace:r?`${r}:${o}`:o})}}const Xe=u.createContext(null);function Hc({adapter:e,children:t}){u.useEffect(()=>(e.init?.(),()=>{e.flush?.()}),[e]);const n=u.useMemo(()=>e,[e]);return a.jsx(Xe.Provider,{value:n,children:t})}function Kc(){return u.useContext(Xe)}const Vc={identify(e){console.info("[telemetry] identify",e)},track(e){console.info("[telemetry] track",e.name,e.properties)},captureException(e,t){console.error("[telemetry] exception",e,t)}};function Qc(e){if(e===null)return null;const{id:t,email:n,name:r,traits:s}=e;return{...t!==void 0?{id:t}:null,...n!==void 0?{email:n}:null,...r!==void 0?{username:r}:null,...s??null}}function Yc(e){const{sentry:t,initOptions:n,flushTimeout:r=2e3,breadcrumbCategory:s="app"}=e;return{init(){n&&t.init&&t.init(n)},identify(o){t.setUser(Qc(o))},track(o){t.addBreadcrumb({category:s,message:o.name,level:"info",...o.properties?{data:o.properties}:null})},captureException(o,i){t.captureException(o,i?{extra:i}:void 0)},async flush(){t.flush&&await t.flush(r)}}}function Zc(e){const{email:t,name:n,traits:r}=e;return{...t!==void 0?{email:t}:null,...n!==void 0?{name:n}:null,...r??null}}function Xc(e){const{posthog:t,init:n}=e;return{init(){n&&t.init&&t.init(n.apiKey,n.options)},identify(r){if(r===null){t.reset?.();return}r.id!==void 0&&t.identify(r.id,Zc(r))},track(r){t.capture(r.name,r.properties)},captureException(r,s){if(t.captureException){t.captureException(r,s);return}const o=r instanceof Error?r:new Error(String(r));t.capture("$exception",{$exception_message:o.message,$exception_type:o.name,$exception_stack_trace_raw:o.stack,...s})}}}const et=u.createContext(null);function el({adapter:e,children:t}){const n=u.useMemo(()=>e,[e]);return u.useEffect(()=>{},[n]),a.jsx(et.Provider,{value:n,children:t})}function tt(){const e=u.useContext(et);if(!e)throw new Error("useFeatureFlag requires <FeatureFlagsProvider>");return e}function tl(e,t=!1){const n=tt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.isEnabled(e,t);return u.useSyncExternalStore(r,s,s)}function nl(e,t){const n=tt(),r=o=>n.onChange?n.onChange(o):()=>{},s=()=>n.get(e,t);return u.useSyncExternalStore(r,s,s)}function rl(e={}){const t={...e.initial??{}},n=new Set;function r(){for(const s of n)s()}return{isEnabled(s,o=!1){return s in t?!!t[s]:o},get(s,o){return s in t?t[s]:o},onChange(s){return n.add(s),()=>n.delete(s)},set(s,o){t[s]=o,r()}}}function sl(e){const{growthbook:t}=e,n=new Set;let r=!1;function s(){r||!t.setRenderer||(r=!0,t.setRenderer(()=>{for(const o of n)o()}))}return{isEnabled(o,i=!1){const l=t.isOn(o);return typeof l=="boolean"?l:i},get(o,i){return t.getFeatureValue(o,i)},onChange(o){return s(),n.add(o),()=>{n.delete(o)}}}}function ol(e){const{client:t}=e;return{isEnabled(n,r=!1){return t.variation(n,r)===!0},get(n,r){return t.variation(n,r)},onChange(n){return!t.on||!t.off?()=>{}:(t.on("change",n),()=>{t.off("change",n)})}}}async function il(e){if(typeof navigator>"u"||!("share"in navigator))return{shared:!1,unsupported:!0,cancelled:!1};if(e.files&&!navigator.canShare?.({files:e.files}))return{shared:!1,unsupported:!0,cancelled:!1};try{return await navigator.share(e),{shared:!0,unsupported:!1,cancelled:!1}}catch(t){return t instanceof DOMException&&t.name==="AbortError"?{shared:!1,unsupported:!1,cancelled:!0}:{shared:!1,unsupported:!1,cancelled:!1,error:t}}}function al(){return typeof navigator<"u"&&"share"in navigator}const cl={get(e,t){if(typeof window>"u")return t;try{const n=window.localStorage.getItem(e);return n===null?t:JSON.parse(n)}catch{return t}},set(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){if(!(typeof window>"u"))try{window.localStorage.removeItem(e)}catch{}}};exports.AuthGuard=Va;exports.Avatar=wt;exports.Badge=Mt;exports.Breadcrumbs=Bt;exports.Button=re;exports.CACHE_TIME=De;exports.CEPInput=Ic;exports.CNPJInput=Cc;exports.CPFInput=$c;exports.Card=vn;exports.Checkbox=Tn;exports.ChipInput=zn;exports.ConfirmDialog=rr;exports.Container=Zs;exports.DatePicker=br;exports.Drawer=Dr;exports.EmptyState=qr;exports.ErrorBoundary=gc;exports.ErrorState=Vr;exports.FeatureFlagsProvider=el;exports.FileUpload=ps;exports.Form=Cs;exports.FormActions=Ls;exports.FormRow=Is;exports.FormSection=Ts;exports.Grid=eo;exports.I18nProvider=Uc;exports.Input=se;exports.Modal=Te;exports.MoneyInput=Rc;exports.Pagination=co;exports.PhoneInput=Tc;exports.Progress=bo;exports.QueryProvider=tc;exports.REFETCH_TIME=Xa;exports.Radio=Co;exports.RadioGroup=To;exports.STALE_TIME=Me;exports.SearchBar=Mo;exports.Select=Ho;exports.Skeleton=Zo;exports.Spinner=si;exports.Stack=Xs;exports.Stepper=fi;exports.Switch=wi;exports.Table=Ti;exports.Tabs=Di;exports.TelemetryProvider=Hc;exports.Textarea=Ui;exports.ThemeProvider=Wc;exports.ToastProvider=ua;exports.Tooltip=Zi;exports.VirtualList=ga;exports.WebPushClient=Oe;exports.WebPushPermissionDeniedError=We;exports.WebPushUnsupportedError=_e;exports.cn=y;exports.consoleSink=Ye;exports.consoleTelemetryAdapter=Vc;exports.createApiClient=Oa;exports.createAudioPlayer=be;exports.createAuthStore=Ka;exports.createEventStream=Fe;exports.createGrowthBookFeatureFlagsAdapter=sl;exports.createI18n=we;exports.createInMemoryFlags=rl;exports.createLaunchDarklyFeatureFlagsAdapter=ol;exports.createLogger=Ze;exports.createOfflineStore=hc;exports.createPostHogTelemetryAdapter=Xc;exports.createQueryKeys=ec;exports.createRefreshQueue=Za;exports.createSentryTelemetryAdapter=Yc;exports.createWebSocket=He;exports.decodeJWT=Re;exports.formatCEP=qe;exports.formatCNPJ=Ue;exports.formatCPF=Ge;exports.formatCurrency=Sc;exports.formatDate=kc;exports.formatDateTime=Ec;exports.formatPercent=Nc;exports.formatPhone=Je;exports.generateIdempotencyKey=Ga;exports.getInitialTheme=Bc;exports.installNotificationClickHandler=lc;exports.installPushHandler=cc;exports.installSkipWaitingListener=uc;exports.isJWTExpired=Qa;exports.isPushSupported=ee;exports.isShareSupported=al;exports.lazyWithRetry=Ya;exports.parseResponse=Ba;exports.playAudio=dc;exports.registerServiceWorker=oc;exports.retry=Ja;exports.share=il;exports.skipWaiting=ic;exports.stopAudio=pc;exports.storage=cl;exports.themeInitScript=zc;exports.unmask=jc;exports.unregisterAllServiceWorkers=ac;exports.uploadWithProgress=qa;exports.urlBase64ToUint8Array=Ae;exports.useAudio=fc;exports.useBeforeInstallPrompt=Ta;exports.useClientFilter=wa;exports.useClipboard=Ea;exports.useDebounce=ya;exports.useDeepMemo=Fa;exports.useDocumentVisibility=ja;exports.useErrorHandler=yc;exports.useEventStream=rc;exports.useFeatureFlag=tl;exports.useFlagValue=nl;exports.useFocusTrap=Ma;exports.useGeolocation=La;exports.useI18n=Qe;exports.useIdle=Ia;exports.useIntersectionObserver=Sa;exports.useKeyboardShortcut=Ca;exports.useMediaQuery=xa;exports.useOnline=va;exports.usePagination=ba;exports.usePoll=Ha;exports.usePushSubscription=sc;exports.useResizeObserver=ka;exports.useScrollLock=Pa;exports.useStableCallback=Da;exports.useTelemetry=Kc;exports.useTheme=Oc;exports.useToast=la;exports.useTranslate=Jc;exports.useViaCEP=Mc;exports.useWebSocket=Fc;exports.useZodForm=wc;exports.validateCNPJ=vc;exports.validateCPF=xc;exports.validateForm=bc;exports.zodResolver=ze;
15
15
  //# sourceMappingURL=tempest-react-sdk.cjs.map