@sito/dashboard-app 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Drawer/types.d.ts +1 -0
- package/dist/dashboard-app.cjs +1 -1
- package/dist/dashboard-app.js +137 -134
- package/package.json +1 -1
package/dist/dashboard-app.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var bs=Object.defineProperty;var ps=(e,t,s)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var oe=(e,t,s)=>ps(e,typeof t!="symbol"?t+"":t,s);var Ar=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@sito/dashboard"),u=require("react/jsx-runtime"),g=require("react"),I=require("@fortawesome/free-solid-svg-icons"),se=require("@fortawesome/react-fontawesome"),Lt=require("react-dom"),xs=require("@emotion/css"),ke=require("@tanstack/react-query"),ws=require("@fortawesome/free-regular-svg-icons");function Xe(e){const{id:t,icon:s,tooltip:n,onClick:i,children:r,hidden:c=!1,disabled:o=!1,showText:f=!1,showTooltips:y=!0}=e;return c?null:u.jsxs("button",{id:t,className:`action ${f?"text-action":"icon-action"}`,disabled:o,onClick:()=>i(),"aria-disabled":o,"data-tooltip-id":"tooltip","data-tooltip-content":y?n:"",children:[s," ",f&&n,r]})}function Ze(e){const{actions:t=[],className:s="",showTooltips:n=!0,showActionTexts:i=!1}=e;return u.jsx("ul",{className:`actions-container ${s}`,children:t==null?void 0:t.map(r=>u.jsx("li",{children:u.jsx(Xe,{showTooltips:n,showText:i,...r,children:r.children})},r.id))})}const $t=e=>{const{children:t,open:s,onClose:n}=e,i=g.useRef(null),r=g.useCallback(o=>{const f=i.current;!s||!f||f.contains(o.target)||n()},[s,n]),c=g.useCallback(o=>{s&&o.key==="Escape"&&n()},[s,n]);return g.useEffect(()=>{if(s)return setTimeout(()=>{var o;return(o=i.current)==null?void 0:o.focus()},0),document.addEventListener("mousedown",r),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",c)}},[s,r,c]),u.jsx("div",{ref:i,role:"menu","aria-hidden":!s,tabIndex:-1,className:`dropdown-main ${s?"opened":"closed"}`,onClick:o=>o.stopPropagation(),children:t})},ue=e=>{const{children:t,icon:s,type:n="button",className:i="",variant:r="text",color:c="default",iconClassName:o="",...f}=e;return u.jsxs("button",{type:n,className:`icon-button ${i} ${r} ${c}`,...f,children:[u.jsx(se.FontAwesomeIcon,{icon:s,className:`!w-auto ${o}`}),t]})},fe=e=>{const{children:t,type:s="button",variant:n="text",color:i="default",className:r="",...c}=e;return u.jsx("button",{type:s,className:`button ${n} ${i} ${r}`,...c,children:t})};var Ke,wt;function vs(){if(wt)return Ke;wt=1;const e=(o,f="local",y=void 0)=>{if(f==="local"){if(localStorage.getItem(o)!==void 0&&localStorage.getItem(o)!=="undefined"&&localStorage.getItem(o)!==null)return y===void 0||y!==void 0&&localStorage.getItem(o)===y}else if(f==="session"&&sessionStorage.getItem(o)!==void 0&&sessionStorage.getItem(o)!=="undefined"&&sessionStorage.getItem(o)!==null)return y===void 0||y!==void 0&&sessionStorage.getItem(o)===y;return!1},t=o=>{const f={};return o.substring(1).split("&").forEach(h=>{const[b,m]=h.split("=");f[b]=m}),f},s=(o="")=>{if(r(o)&&o.length)return r(o);{let f=navigator.language||navigator.userLanguage;if(f.indexOf("en")<0&&f.indexOf("es")<0&&(f="en-US"),f=f.split("-")[0],f)return o.length&&i(o,730,f),f}return"en"},n=(o=0,f=0,y=window,h="smooth")=>y.scroll({top:o,left:f,behavior:h}),i=(o,f,y,h="/",b="Lax")=>{var m=new Date;m.setTime(m.getTime()+f*24*60*60*1e3);const C="; expires="+m.toUTCString();document.cookie=`${o}=${y||""}${C};path=${h};SameSite=${b}`},r=o=>{const f=`${o}=`,h=decodeURIComponent(document.cookie).split(";");for(let b=0;b<h.length;b+=1){let m=h[b];for(;m.charAt(0)===" ";)m=m.substring(1);if(m.indexOf(f)===0)return m.substring(f.length,m.length)}return""};return Ke={getCookie:r,createCookie:i,deleteCookie:o=>document.cookie=`${o}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,getUserLanguage:s,scrollTo:n,parseQueries:t,validation:e},Ke}var Cs=vs();function ks(){const{t:e,language:t}=_.useTranslation();return{timeAge:g.useCallback(n=>{const r=new Date-n,c=Math.floor(r/(1e3*60)),o=Math.floor(c/60),f=t==="es",y=e("_accessibility:labels.ago"),h=e("_accessibility:labels.minute"),b=e("_accessibility:labels.minutes"),m=e("_accessibility:labels.hour"),C=e("_accessibility:labels.hours"),S=e("_accessibility:labels.yesterday"),A=e("_accessibility:labels.justNow");return r<1e3*60?A:c<60?`${f?y:""} ${c} ${c===1?h:b} ${f?"":y}`:o<24?`${f?y:""} ${o} ${o===1?m:C} ${f?"":y}`:o<48?S:n.toLocaleDateString(navigator.language||"es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})},[e,t])}}var R=(e=>(e[e.success=0]="success",e[e.error=1]="error",e[e.warning=2]="warning",e[e.info=3]="info",e))(R||{}),G=(e=>(e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e))(G||{});async function Ae(e,t="GET",s,n){const i={...s?{"Content-Type":"application/json"}:{},...n};try{const r=await fetch(e,{method:t,headers:i,...s?{body:JSON.stringify(s)}:{}}),c=await r.text();let o=null;try{o=c?JSON.parse(c):null}catch{o=null}if(!r.ok){const f=typeof o=="object"&&o!==null?o.message??o.error??c:c||r.statusText;return{data:null,status:r.status,error:{status:r.status,message:f||"Unknown error occurred"}}}return{data:r.status!==204&&o!==null?o:null,status:r.status,error:null}}catch(r){return{data:null,status:500,error:{status:500,message:r instanceof Error?r.message:"Unknown error occurred"}}}}function Vt(e,t){if(t){const s=Object.entries(t).filter(([,n])=>n!=null).map(([n,i])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");return s?`${e}?${s}`:e}return e}const et=(e,t,s)=>{const n=[];if(t){const{sortingBy:i,sortingOrder:r,currentPage:c,pageSize:o}=t;n.push(`sort=${String(i)}`,`order=${r}`,`page=${c}`,`pageSize=${o}`)}if(s){const i=Object.entries(s).filter(([,r])=>r!=null&&r!=="").flatMap(([r,c])=>{if(Array.isArray(c))return c.map(o=>`${r}==${encodeURIComponent((o==null?void 0:o.id)??o)}`);if(typeof c=="object"&&c!==null&&"start"in c&&"end"in c){const o=[];return c.start!=null&&c.start!==""&&o.push(`${r}>=${encodeURIComponent(c.start)}`),c.end!=null&&c.end!==""&&o.push(`${r}<=${encodeURIComponent(c.end)}`),o}return typeof c=="object"&&c!==null?`${r}==${encodeURIComponent(c.id??"")}`:`${r}==${encodeURIComponent(c)}`});i.length>0&&n.push(`filters=${i.join(",")}`)}return n.length?`${e}?${n.join("&")}`:e};class tt{constructor(t,s="user",n=!0,i=null){oe(this,"baseUrl");oe(this,"userKey");oe(this,"secured");oe(this,"tokenAcquirer");this.baseUrl=t,this.secured=n,this.userKey=s,i||(this.tokenAcquirer=this.defaultTokenAcquirer)}defaultTokenAcquirer(t){if(t)return{credentials:"include"};const s=st(this.userKey);if(s&&s.length)return{Authorization:`Bearer ${s}`}}async doQuery(t,s=G.GET,n,i){const r=this.secured?this.defaultTokenAcquirer():{},{data:c,status:o,error:f}=await Ae(`${this.baseUrl}${t}`,s,n,{...r,...i??{}});if(f||o<200||o>=300)throw f??{status:o,message:String(o)};return c}async get(t,s,n){const i=et(t,s,n),r=this.secured?this.defaultTokenAcquirer():void 0,{data:c,error:o}=await Ae(`${this.baseUrl}${i}`,G.GET,null,r);if(o)throw o;return c}async patch(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.PATCH,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}async delete(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.DELETE,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}async post(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.POST,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}}class Pt{constructor(t,s="user"){oe(this,"api");this.api=new tt(t,s,!1)}async login(t){const s="auth/sign-in",n=t;return await this.api.doQuery(s,G.POST,n)}async logout(){return await this.api.doQuery("auth/sign-out",G.POST)}async register(t){return await this.api.doQuery("auth/sign-up",G.POST,t)}async getSession(){return await this.api.doQuery("auth/session",G.GET,null,{...this.api.defaultTokenAcquirer()})}}class Ss{constructor(t,s){oe(this,"auth");this.auth=new Pt(t,s)}get Auth(){return this.auth}}class As{constructor(t,s,n="user",i=!0){oe(this,"table");oe(this,"secured");oe(this,"api");this.table=t,this.secured=i,this.api=new tt(s,n,i)}async insert(t){return await this.api.post(`${this.table}`,t)}async insertMany(t){return await this.api.doQuery(`${this.table}/batch`,G.POST,t)}async update(t){return await this.api.patch(`${this.table}/${t.id}`,t)}async get(t,s){return await this.api.get(`${this.table}`,t,s)}async export(t){const s=et(`${this.table}/export`,void 0,t);return await this.api.doQuery(s,G.GET,void 0)}async import(t){return await this.api.doQuery(`${this.table}/import`,G.POST,t)}async commonGet(t){return await this.api.doQuery(Vt(`${this.table}/common`,t),G.GET)}async getById(t){return await this.api.doQuery(`${this.table}/${t}`)}async softDelete(t){return await this.api.delete(`${this.table}`,t)}async restore(t){return await this.api.patch(`${this.table}/restore`,t)}}function _s(e){return Object.keys(e).filter(t=>isNaN(Number(t))).map(t=>({key:t,value:e[t]}))}const st=(e,t="")=>{const s=localStorage.getItem(e)??void 0;if(s&&t.length)switch(t){case"object":return JSON.parse(s);case"number":return Number(s);case"boolean":return s==="true"||s==="1";default:return s}return s},ze=(e,t)=>localStorage.setItem(e,typeof t=="object"?JSON.stringify(t):t),Ge=e=>localStorage.removeItem(e);function Je(e){const t=e?new Date(e):new Date,s={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return t.toLocaleString(navigator.language||"es-ES",s)}function Ns(e){const t=e?new Date(e):new Date,s=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0");return`${s}-${n}-${i}T${r}:${c}`}const It=()=>{var s;const e=navigator,t=((s=e==null?void 0:e.userAgentData)==null?void 0:s.platform)||(e==null?void 0:e.platform)||"";return/Mac|iPhone|iPod|iPad/i.test(t)},Mt=g.createContext({});function Ts(e){const{children:t}=e,[s,n]=g.useReducer((y,h)=>{const{type:b,items:m,index:C}=h;switch(b){case"set":return(m==null?void 0:m.map((S,A)=>({...S,id:A})))??[];case"remove":return C!==void 0?y.filter((S,A)=>A!==C):[]}return y},[],()=>[]),i=y=>n({type:"set",items:[{...y,type:R.error}]}),r=y=>n({type:"set",items:[{...y}]}),c=y=>n({type:"set",items:y}),o=y=>n({type:"set",items:[{...y,type:R.success}]}),f=y=>n({type:"remove",index:y});return u.jsx(Mt.Provider,{value:{notification:s,removeNotification:f,showErrorNotification:i,showNotification:r,showSuccessNotification:o,showStackNotifications:c},children:t})}const pe=()=>{const e=g.useContext(Mt);if(e===void 0)throw new Error("NotificationContext must be used within a Provider");return e},be=new ke.QueryClient({defaultOptions:{queries:{refetchInterval:!1,refetchOnMount:!0,refetchOnReconnect:!1,retry:!1,retryOnMount:!0,refetchOnWindowFocus:!1}}}),Ot=g.createContext({}),Es=e=>{const{children:t,manager:s}=e;return u.jsx(Ot.Provider,{value:{client:s},children:u.jsx(ke.QueryClientProvider,{client:be,children:t})})},Rt=()=>{const e=g.useContext(Ot);if(e===void 0)throw new Error("managerContext must be used within a Provider");return e.client},Ut=g.createContext({}),Fs=e=>{const{children:t,guestMode:s="guest_mode",user:n="user"}=e,i=Rt(),[r,c]=g.useState({}),o=g.useCallback(()=>!!st(s,"boolean")&&r.token===void 0,[r.token]),f=g.useCallback(C=>{ze(s,C)},[]),y=g.useCallback(C=>{C&&(c(C),Ge(s),ze(n,C.token))},[]),h=g.useCallback(async()=>{try{await i.Auth.logout()}catch(C){console.error(C)}c({}),Ge(n)},[i.Auth]),b=g.useCallback(async()=>{try{const C=await i.Auth.getSession();y(C)}catch(C){console.error(C),h()}},[y,h,i.Auth]),m={account:r,logUser:y,logoutUser:h,logUserFromLocal:b,isInGuestMode:o,setGuestMode:f};return u.jsx(Ut.Provider,{value:m,children:t})},rt=()=>{const e=g.useContext(Ut);if(e===void 0)throw new Error("authContext must be used within a Provider");return e},qt=g.createContext({}),js=e=>{const{children:t,location:s,navigate:n,linkComponent:i,searchComponent:r}=e;return u.jsx(qt.Provider,{value:{location:s,navigate:n,linkComponent:i,searchComponent:r},children:t})},Fe=()=>{const e=g.useContext(qt);if(e===void 0||Object.keys(e).length===0)throw new Error("Config provider has not been set. This step is required and cannot be skipped.");return e},nt=e=>{const{showSuccessNotification:t}=pe(),{mutationFn:s,onError:n,onSuccess:i,onSuccessMessage:r}=e,[c,o]=g.useState([]),{open:f,handleClose:y,handleOpen:h}=ut(),b=()=>{y(),o([])},m=async S=>{o(S),h()},C=ke.useMutation({mutationFn:()=>s(Array.isArray(c)?c:[c]),onError:S=>{console.error(S),n&&n(S),b()},onSuccess:async S=>{i&&i(S),t({message:r}),b()}});return{open:f,onClick:m,close:b,dialogFn:C,isLoading:C.isPending}};var je=e=>e.type==="checkbox",Ce=e=>e instanceof Date,z=e=>e==null;const Bt=e=>typeof e=="object";var M=e=>!z(e)&&!Array.isArray(e)&&Bt(e)&&!Ce(e),Ds=e=>M(e)&&e.target?je(e.target)?e.target.checked:e.target.value:e,Ls=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,$s=(e,t)=>e.has(Ls(t)),Vs=e=>{const t=e.constructor&&e.constructor.prototype;return M(t)&&t.hasOwnProperty("isPrototypeOf")},it=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function H(e){let t;const s=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(it&&(e instanceof Blob||n))&&(s||M(e)))if(t=s?[]:{},!s&&!Vs(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=H(e[i]));else return e;return t}var Me=e=>/^\w*$/.test(e),U=e=>e===void 0,at=e=>Array.isArray(e)?e.filter(Boolean):[],ot=e=>at(e.replace(/["|']|\]/g,"").split(/\.|\[/)),v=(e,t,s)=>{if(!t||!M(e))return s;const n=(Me(t)?[t]:ot(t)).reduce((i,r)=>z(i)?i:i[r],e);return U(n)||n===e?U(e[t])?s:e[t]:n},ce=e=>typeof e=="boolean",V=(e,t,s)=>{let n=-1;const i=Me(t)?[t]:ot(t),r=i.length,c=r-1;for(;++n<r;){const o=i[n];let f=s;if(n!==c){const y=e[o];f=M(y)||Array.isArray(y)?y:isNaN(+i[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=f,e=e[o]}};const vt={BLUR:"blur",FOCUS_OUT:"focusout"},ie={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},de={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ps=g.createContext(null);Ps.displayName="HookFormContext";var Is=(e,t,s,n=!0)=>{const i={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(i,r,{get:()=>{const c=r;return t._proxyFormState[c]!==ie.all&&(t._proxyFormState[c]=!n||ie.all),e[c]}});return i};const Ms=typeof window<"u"?g.useLayoutEffect:g.useEffect;var le=e=>typeof e=="string",Os=(e,t,s,n,i)=>le(e)?(n&&t.watch.add(e),v(s,e,i)):Array.isArray(e)?e.map(r=>(n&&t.watch.add(r),v(s,r))):(n&&(t.watchAll=!0),s),Ye=e=>z(e)||!Bt(e);function ge(e,t,s=new WeakSet){if(Ye(e)||Ye(t))return e===t;if(Ce(e)&&Ce(t))return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const r of n){const c=e[r];if(!i.includes(r))return!1;if(r!=="ref"){const o=t[r];if(Ce(c)&&Ce(o)||M(c)&&M(o)||Array.isArray(c)&&Array.isArray(o)?!ge(c,o,s):c!==o)return!1}}return!0}var Rs=(e,t,s,n,i)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:i||!0}}:{},Te=e=>Array.isArray(e)?e:[e],Ct=()=>{let e=[];return{get observers(){return e},next:i=>{for(const r of e)r.next&&r.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(r=>r!==i)}}),unsubscribe:()=>{e=[]}}},Y=e=>M(e)&&!Object.keys(e).length,ct=e=>e.type==="file",ae=e=>typeof e=="function",Ve=e=>{if(!it)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ht=e=>e.type==="select-multiple",lt=e=>e.type==="radio",Us=e=>lt(e)||je(e),We=e=>Ve(e)&&e.isConnected;function qs(e,t){const s=t.slice(0,-1).length;let n=0;for(;n<s;)e=U(e)?n++:e[t[n++]];return e}function Bs(e){for(const t in e)if(e.hasOwnProperty(t)&&!U(e[t]))return!1;return!0}function O(e,t){const s=Array.isArray(t)?t:Me(t)?[t]:ot(t),n=s.length===1?e:qs(e,s),i=s.length-1,r=s[i];return n&&delete n[r],i!==0&&(M(n)&&Y(n)||Array.isArray(n)&&Bs(n))&&O(e,s.slice(0,-1)),e}var Qt=e=>{for(const t in e)if(ae(e[t]))return!0;return!1};function Pe(e,t={}){const s=Array.isArray(e);if(M(e)||s)for(const n in e)Array.isArray(e[n])||M(e[n])&&!Qt(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Pe(e[n],t[n])):z(e[n])||(t[n]=!0);return t}function Kt(e,t,s){const n=Array.isArray(e);if(M(e)||n)for(const i in e)Array.isArray(e[i])||M(e[i])&&!Qt(e[i])?U(t)||Ye(s[i])?s[i]=Array.isArray(e[i])?Pe(e[i],[]):{...Pe(e[i])}:Kt(e[i],z(t)?{}:t[i],s[i]):s[i]=!ge(e[i],t[i]);return s}var _e=(e,t)=>Kt(e,t,Pe(t));const kt={value:!1,isValid:!1},St={value:!0,isValid:!0};var Wt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?St:{value:e[0].value,isValid:!0}:St:kt}return kt},zt=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:n})=>U(e)?e:t?e===""?NaN:e&&+e:s&&le(e)?new Date(e):n?n(e):e;const At={isValid:!1,value:null};var Gt=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,At):At;function _t(e){const t=e.ref;return ct(t)?t.files:lt(t)?Gt(e.refs).value:Ht(t)?[...t.selectedOptions].map(({value:s})=>s):je(t)?Wt(e.refs).value:zt(U(t.value)?e.ref.value:t.value,e)}var Hs=(e,t,s,n)=>{const i={};for(const r of e){const c=v(t,r);c&&V(i,r,c._f)}return{criteriaMode:s,names:[...e],fields:i,shouldUseNativeValidation:n}},Ie=e=>e instanceof RegExp,Ne=e=>U(e)?e:Ie(e)?e.source:M(e)?Ie(e.value)?e.value.source:e.value:e,Nt=e=>({isOnSubmit:!e||e===ie.onSubmit,isOnBlur:e===ie.onBlur,isOnChange:e===ie.onChange,isOnAll:e===ie.all,isOnTouch:e===ie.onTouched});const Tt="AsyncFunction";var Qs=e=>!!e&&!!e.validate&&!!(ae(e.validate)&&e.validate.constructor.name===Tt||M(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Tt)),Ks=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Et=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ee=(e,t,s,n)=>{for(const i of s||Object.keys(e)){const r=v(e,i);if(r){const{_f:c,...o}=r;if(c){if(c.refs&&c.refs[0]&&t(c.refs[0],i)&&!n)return!0;if(c.ref&&t(c.ref,c.name)&&!n)return!0;if(Ee(o,t))break}else if(M(o)&&Ee(o,t))break}}};function Ft(e,t,s){const n=v(e,s);if(n||Me(s))return{error:n,name:s};const i=s.split(".");for(;i.length;){const r=i.join("."),c=v(t,r),o=v(e,r);if(c&&!Array.isArray(c)&&s!==r)return{name:s};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:s}}var Ws=(e,t,s,n)=>{s(e);const{name:i,...r}=e;return Y(r)||Object.keys(r).length>=Object.keys(t).length||Object.keys(r).find(c=>t[c]===(!n||ie.all))},zs=(e,t,s)=>!e||!t||e===t||Te(e).some(n=>n&&(s?n===t:n.startsWith(t)||t.startsWith(n))),Gs=(e,t,s,n,i)=>i.isOnAll?!1:!s&&i.isOnTouch?!(t||e):(s?n.isOnBlur:i.isOnBlur)?!e:(s?n.isOnChange:i.isOnChange)?e:!0,Js=(e,t)=>!at(v(e,t)).length&&O(e,t),Ys=(e,t,s)=>{const n=Te(v(e,s));return V(n,"root",t[s]),V(e,s,n),e},$e=e=>le(e);function jt(e,t,s="validate"){if($e(e)||Array.isArray(e)&&e.every($e)||ce(e)&&!e)return{type:s,message:$e(e)?e:"",ref:t}}var Se=e=>M(e)&&!Ie(e)?e:{value:e,message:""},Dt=async(e,t,s,n,i,r)=>{const{ref:c,refs:o,required:f,maxLength:y,minLength:h,min:b,max:m,pattern:C,validate:S,name:A,valueAsNumber:Q,mount:he}=e._f,N=v(s,A);if(!he||t.has(A))return{};const W=o?o[0]:c,D=T=>{i&&W.reportValidity&&(W.setCustomValidity(ce(T)?"":T||""),W.reportValidity())},j={},J=lt(c),X=je(c),xe=J||X,q=(Q||ct(c))&&U(c.value)&&U(N)||Ve(c)&&c.value===""||N===""||Array.isArray(N)&&!N.length,re=Rs.bind(null,A,n,j),Z=(T,E,P,B=de.maxLength,K=de.minLength)=>{const L=T?E:P;j[A]={type:T?B:K,message:L,ref:c,...re(T?B:K,L)}};if(r?!Array.isArray(N)||!N.length:f&&(!xe&&(q||z(N))||ce(N)&&!N||X&&!Wt(o).isValid||J&&!Gt(o).isValid)){const{value:T,message:E}=$e(f)?{value:!!f,message:f}:Se(f);if(T&&(j[A]={type:de.required,message:E,ref:W,...re(de.required,E)},!n))return D(E),j}if(!q&&(!z(b)||!z(m))){let T,E;const P=Se(m),B=Se(b);if(!z(N)&&!isNaN(N)){const K=c.valueAsNumber||N&&+N;z(P.value)||(T=K>P.value),z(B.value)||(E=K<B.value)}else{const K=c.valueAsDate||new Date(N),L=we=>new Date(new Date().toDateString()+" "+we),ee=c.type=="time",ne=c.type=="week";le(P.value)&&N&&(T=ee?L(N)>L(P.value):ne?N>P.value:K>new Date(P.value)),le(B.value)&&N&&(E=ee?L(N)<L(B.value):ne?N<B.value:K<new Date(B.value))}if((T||E)&&(Z(!!T,P.message,B.message,de.max,de.min),!n))return D(j[A].message),j}if((y||h)&&!q&&(le(N)||r&&Array.isArray(N))){const T=Se(y),E=Se(h),P=!z(T.value)&&N.length>+T.value,B=!z(E.value)&&N.length<+E.value;if((P||B)&&(Z(P,T.message,E.message),!n))return D(j[A].message),j}if(C&&!q&&le(N)){const{value:T,message:E}=Se(C);if(Ie(T)&&!N.match(T)&&(j[A]={type:de.pattern,message:E,ref:c,...re(de.pattern,E)},!n))return D(E),j}if(S){if(ae(S)){const T=await S(N,s),E=jt(T,W);if(E&&(j[A]={...E,...re(de.validate,E.message)},!n))return D(E.message),j}else if(M(S)){let T={};for(const E in S){if(!Y(T)&&!n)break;const P=jt(await S[E](N,s),W,E);P&&(T={...P,...re(E,P.message)},D(P.message),n&&(j[A]=T))}if(!Y(T)&&(j[A]={ref:W,...T},!n))return j}}return D(!0),j};const Xs={mode:ie.onSubmit,reValidateMode:ie.onChange,shouldFocusError:!0};function Zs(e={}){let t={...Xs,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:ae(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},i=M(t.defaultValues)||M(t.values)?H(t.defaultValues||t.values)||{}:{},r=t.shouldUnregister?{}:H(i),c={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,y=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let b={...h};const m={array:Ct(),state:Ct()},C=t.criteriaMode===ie.all,S=a=>l=>{clearTimeout(y),y=setTimeout(a,l)},A=async a=>{if(!t.disabled&&(h.isValid||b.isValid||a)){const l=t.resolver?Y((await X()).errors):await q(n,!0);l!==s.isValid&&m.state.next({isValid:l})}},Q=(a,l)=>{!t.disabled&&(h.isValidating||h.validatingFields||b.isValidating||b.validatingFields)&&((a||Array.from(o.mount)).forEach(d=>{d&&(l?V(s.validatingFields,d,l):O(s.validatingFields,d))}),m.state.next({validatingFields:s.validatingFields,isValidating:!Y(s.validatingFields)}))},he=(a,l=[],d,w,x=!0,p=!0)=>{if(w&&d&&!t.disabled){if(c.action=!0,p&&Array.isArray(v(n,a))){const k=d(v(n,a),w.argA,w.argB);x&&V(n,a,k)}if(p&&Array.isArray(v(s.errors,a))){const k=d(v(s.errors,a),w.argA,w.argB);x&&V(s.errors,a,k),Js(s.errors,a)}if((h.touchedFields||b.touchedFields)&&p&&Array.isArray(v(s.touchedFields,a))){const k=d(v(s.touchedFields,a),w.argA,w.argB);x&&V(s.touchedFields,a,k)}(h.dirtyFields||b.dirtyFields)&&(s.dirtyFields=_e(i,r)),m.state.next({name:a,isDirty:Z(a,l),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else V(r,a,l)},N=(a,l)=>{V(s.errors,a,l),m.state.next({errors:s.errors})},W=a=>{s.errors=a,m.state.next({errors:s.errors,isValid:!1})},D=(a,l,d,w)=>{const x=v(n,a);if(x){const p=v(r,a,U(d)?v(i,a):d);U(p)||w&&w.defaultChecked||l?V(r,a,l?p:_t(x._f)):P(a,p),c.mount&&A()}},j=(a,l,d,w,x)=>{let p=!1,k=!1;const F={name:a};if(!t.disabled){if(!d||w){(h.isDirty||b.isDirty)&&(k=s.isDirty,s.isDirty=F.isDirty=Z(),p=k!==F.isDirty);const $=ge(v(i,a),l);k=!!v(s.dirtyFields,a),$?O(s.dirtyFields,a):V(s.dirtyFields,a,!0),F.dirtyFields=s.dirtyFields,p=p||(h.dirtyFields||b.dirtyFields)&&k!==!$}if(d){const $=v(s.touchedFields,a);$||(V(s.touchedFields,a,d),F.touchedFields=s.touchedFields,p=p||(h.touchedFields||b.touchedFields)&&$!==d)}p&&x&&m.state.next(F)}return p?F:{}},J=(a,l,d,w)=>{const x=v(s.errors,a),p=(h.isValid||b.isValid)&&ce(l)&&s.isValid!==l;if(t.delayError&&d?(f=S(()=>N(a,d)),f(t.delayError)):(clearTimeout(y),f=null,d?V(s.errors,a,d):O(s.errors,a)),(d?!ge(x,d):x)||!Y(w)||p){const k={...w,...p&&ce(l)?{isValid:l}:{},errors:s.errors,name:a};s={...s,...k},m.state.next(k)}},X=async a=>{Q(a,!0);const l=await t.resolver(r,t.context,Hs(a||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return Q(a),l},xe=async a=>{const{errors:l}=await X(a);if(a)for(const d of a){const w=v(l,d);w?V(s.errors,d,w):O(s.errors,d)}else s.errors=l;return l},q=async(a,l,d={valid:!0})=>{for(const w in a){const x=a[w];if(x){const{_f:p,...k}=x;if(p){const F=o.array.has(p.name),$=x._f&&Qs(x._f);$&&h.validatingFields&&Q([w],!0);const te=await Dt(x,o.disabled,r,C,t.shouldUseNativeValidation&&!l,F);if($&&h.validatingFields&&Q([w]),te[p.name]&&(d.valid=!1,l))break;!l&&(v(te,p.name)?F?Ys(s.errors,te,p.name):V(s.errors,p.name,te[p.name]):O(s.errors,p.name))}!Y(k)&&await q(k,l,d)}}return d.valid},re=()=>{for(const a of o.unMount){const l=v(n,a);l&&(l._f.refs?l._f.refs.every(d=>!We(d)):!We(l._f.ref))&&Ue(a)}o.unMount=new Set},Z=(a,l)=>!t.disabled&&(a&&l&&V(r,a,l),!ge(we(),i)),T=(a,l,d)=>Os(a,o,{...c.mount?r:U(l)?i:le(a)?{[a]:l}:l},d,l),E=a=>at(v(c.mount?r:i,a,t.shouldUnregister?v(i,a,[]):[])),P=(a,l,d={})=>{const w=v(n,a);let x=l;if(w){const p=w._f;p&&(!p.disabled&&V(r,a,zt(l,p)),x=Ve(p.ref)&&z(l)?"":l,Ht(p.ref)?[...p.ref.options].forEach(k=>k.selected=x.includes(k.value)):p.refs?je(p.ref)?p.refs.forEach(k=>{(!k.defaultChecked||!k.disabled)&&(Array.isArray(x)?k.checked=!!x.find(F=>F===k.value):k.checked=x===k.value||!!x)}):p.refs.forEach(k=>k.checked=k.value===x):ct(p.ref)?p.ref.value="":(p.ref.value=x,p.ref.type||m.state.next({name:a,values:H(r)})))}(d.shouldDirty||d.shouldTouch)&&j(a,x,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&ne(a)},B=(a,l,d)=>{for(const w in l){if(!l.hasOwnProperty(w))return;const x=l[w],p=a+"."+w,k=v(n,p);(o.array.has(a)||M(x)||k&&!k._f)&&!Ce(x)?B(p,x,d):P(p,x,d)}},K=(a,l,d={})=>{const w=v(n,a),x=o.array.has(a),p=H(l);V(r,a,p),x?(m.array.next({name:a,values:H(r)}),(h.isDirty||h.dirtyFields||b.isDirty||b.dirtyFields)&&d.shouldDirty&&m.state.next({name:a,dirtyFields:_e(i,r),isDirty:Z(a,p)})):w&&!w._f&&!z(p)?B(a,p,d):P(a,p,d),Et(a,o)&&m.state.next({...s,name:a}),m.state.next({name:c.mount?a:void 0,values:H(r)})},L=async a=>{c.mount=!0;const l=a.target;let d=l.name,w=!0;const x=v(n,d),p=$=>{w=Number.isNaN($)||Ce($)&&isNaN($.getTime())||ge($,v(r,d,$))},k=Nt(t.mode),F=Nt(t.reValidateMode);if(x){let $,te;const Le=l.type?_t(x._f):Ds(a),ye=a.type===vt.BLUR||a.type===vt.FOCUS_OUT,hs=!Ks(x._f)&&!t.resolver&&!v(s.errors,d)&&!x._f.deps||Gs(ye,v(s.touchedFields,d),s.isSubmitted,F,k),He=Et(d,o,ye);V(r,d,Le),ye?(x._f.onBlur&&x._f.onBlur(a),f&&f(0)):x._f.onChange&&x._f.onChange(a);const Qe=j(d,Le,ye),ys=!Y(Qe)||He;if(!ye&&m.state.next({name:d,type:a.type,values:H(r)}),hs)return(h.isValid||b.isValid)&&(t.mode==="onBlur"?ye&&A():ye||A()),ys&&m.state.next({name:d,...He?{}:Qe});if(!ye&&He&&m.state.next({...s}),t.resolver){const{errors:pt}=await X([d]);if(p(Le),w){const gs=Ft(s.errors,n,d),xt=Ft(pt,n,gs.name||d);$=xt.error,d=xt.name,te=Y(pt)}}else Q([d],!0),$=(await Dt(x,o.disabled,r,C,t.shouldUseNativeValidation))[d],Q([d]),p(Le),w&&($?te=!1:(h.isValid||b.isValid)&&(te=await q(n,!0)));w&&(x._f.deps&&ne(x._f.deps),J(d,te,$,Qe))}},ee=(a,l)=>{if(v(s.errors,l)&&a.focus)return a.focus(),1},ne=async(a,l={})=>{let d,w;const x=Te(a);if(t.resolver){const p=await xe(U(a)?a:x);d=Y(p),w=a?!x.some(k=>v(p,k)):d}else a?(w=(await Promise.all(x.map(async p=>{const k=v(n,p);return await q(k&&k._f?{[p]:k}:k)}))).every(Boolean),!(!w&&!s.isValid)&&A()):w=d=await q(n);return m.state.next({...!le(a)||(h.isValid||b.isValid)&&d!==s.isValid?{}:{name:a},...t.resolver||!a?{isValid:d}:{},errors:s.errors}),l.shouldFocus&&!w&&Ee(n,ee,a?x:o.mount),w},we=a=>{const l={...c.mount?r:i};return U(a)?l:le(a)?v(l,a):a.map(d=>v(l,d))},De=(a,l)=>({invalid:!!v((l||s).errors,a),isDirty:!!v((l||s).dirtyFields,a),error:v((l||s).errors,a),isValidating:!!v(s.validatingFields,a),isTouched:!!v((l||s).touchedFields,a)}),ve=a=>{a&&Te(a).forEach(l=>O(s.errors,l)),m.state.next({errors:a?s.errors:{}})},dt=(a,l,d)=>{const w=(v(n,a,{_f:{}})._f||{}).ref,x=v(s.errors,a)||{},{ref:p,message:k,type:F,...$}=x;V(s.errors,a,{...$,...l,ref:w}),m.state.next({name:a,errors:s.errors,isValid:!1}),d&&d.shouldFocus&&w&&w.focus&&w.focus()},cs=(a,l)=>ae(a)?m.state.subscribe({next:d=>"values"in d&&a(T(void 0,l),d)}):T(a,l,!0),ft=a=>m.state.subscribe({next:l=>{zs(a.name,l.name,a.exact)&&Ws(l,a.formState||h,ms,a.reRenderRoot)&&a.callback({values:{...r},...s,...l,defaultValues:i})}}).unsubscribe,ls=a=>(c.mount=!0,b={...b,...a.formState},ft({...a,formState:b})),Ue=(a,l={})=>{for(const d of a?Te(a):o.mount)o.mount.delete(d),o.array.delete(d),l.keepValue||(O(n,d),O(r,d)),!l.keepError&&O(s.errors,d),!l.keepDirty&&O(s.dirtyFields,d),!l.keepTouched&&O(s.touchedFields,d),!l.keepIsValidating&&O(s.validatingFields,d),!t.shouldUnregister&&!l.keepDefaultValue&&O(i,d);m.state.next({values:H(r)}),m.state.next({...s,...l.keepDirty?{isDirty:Z()}:{}}),!l.keepIsValid&&A()},mt=({disabled:a,name:l})=>{(ce(a)&&c.mount||a||o.disabled.has(l))&&(a?o.disabled.add(l):o.disabled.delete(l))},qe=(a,l={})=>{let d=v(n,a);const w=ce(l.disabled)||ce(t.disabled);return V(n,a,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:a}},name:a,mount:!0,...l}}),o.mount.add(a),d?mt({disabled:ce(l.disabled)?l.disabled:t.disabled,name:a}):D(a,!0,l.value),{...w?{disabled:l.disabled||t.disabled}:{},...t.progressive?{required:!!l.required,min:Ne(l.min),max:Ne(l.max),minLength:Ne(l.minLength),maxLength:Ne(l.maxLength),pattern:Ne(l.pattern)}:{},name:a,onChange:L,onBlur:L,ref:x=>{if(x){qe(a,l),d=v(n,a);const p=U(x.value)&&x.querySelectorAll&&x.querySelectorAll("input,select,textarea")[0]||x,k=Us(p),F=d._f.refs||[];if(k?F.find($=>$===p):p===d._f.ref)return;V(n,a,{_f:{...d._f,...k?{refs:[...F.filter(We),p,...Array.isArray(v(i,a))?[{}]:[]],ref:{type:p.type,name:a}}:{ref:p}}}),D(a,!1,void 0,p)}else d=v(n,a,{}),d._f&&(d._f.mount=!1),(t.shouldUnregister||l.shouldUnregister)&&!($s(o.array,a)&&c.action)&&o.unMount.add(a)}}},Be=()=>t.shouldFocusError&&Ee(n,ee,o.mount),us=a=>{ce(a)&&(m.state.next({disabled:a}),Ee(n,(l,d)=>{const w=v(n,d);w&&(l.disabled=w._f.disabled||a,Array.isArray(w._f.refs)&&w._f.refs.forEach(x=>{x.disabled=w._f.disabled||a}))},0,!1))},ht=(a,l)=>async d=>{let w;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let x=H(r);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:p,values:k}=await X();s.errors=p,x=H(k)}else await q(n);if(o.disabled.size)for(const p of o.disabled)O(x,p);if(O(s.errors,"root"),Y(s.errors)){m.state.next({errors:{}});try{await a(x,d)}catch(p){w=p}}else l&&await l({...s.errors},d),Be(),setTimeout(Be);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Y(s.errors)&&!w,submitCount:s.submitCount+1,errors:s.errors}),w)throw w},ds=(a,l={})=>{v(n,a)&&(U(l.defaultValue)?K(a,H(v(i,a))):(K(a,l.defaultValue),V(i,a,H(l.defaultValue))),l.keepTouched||O(s.touchedFields,a),l.keepDirty||(O(s.dirtyFields,a),s.isDirty=l.defaultValue?Z(a,H(v(i,a))):Z()),l.keepError||(O(s.errors,a),h.isValid&&A()),m.state.next({...s}))},yt=(a,l={})=>{const d=a?H(a):i,w=H(d),x=Y(a),p=x?i:w;if(l.keepDefaultValues||(i=d),!l.keepValues){if(l.keepDirtyValues){const k=new Set([...o.mount,...Object.keys(_e(i,r))]);for(const F of Array.from(k))v(s.dirtyFields,F)?V(p,F,v(r,F)):K(F,v(p,F))}else{if(it&&U(a))for(const k of o.mount){const F=v(n,k);if(F&&F._f){const $=Array.isArray(F._f.refs)?F._f.refs[0]:F._f.ref;if(Ve($)){const te=$.closest("form");if(te){te.reset();break}}}}if(l.keepFieldsRef)for(const k of o.mount)K(k,v(p,k));else n={}}r=t.shouldUnregister?l.keepDefaultValues?H(i):{}:H(p),m.array.next({values:{...p}}),m.state.next({values:{...p}})}o={mount:l.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!h.isValid||!!l.keepIsValid||!!l.keepDirtyValues,c.watch=!!t.shouldUnregister,m.state.next({submitCount:l.keepSubmitCount?s.submitCount:0,isDirty:x?!1:l.keepDirty?s.isDirty:!!(l.keepDefaultValues&&!ge(a,i)),isSubmitted:l.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:x?{}:l.keepDirtyValues?l.keepDefaultValues&&r?_e(i,r):s.dirtyFields:l.keepDefaultValues&&a?_e(i,a):l.keepDirty?s.dirtyFields:{},touchedFields:l.keepTouched?s.touchedFields:{},errors:l.keepErrors?s.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1})},gt=(a,l)=>yt(ae(a)?a(r):a,l),fs=(a,l={})=>{const d=v(n,a),w=d&&d._f;if(w){const x=w.refs?w.refs[0]:w.ref;x.focus&&(x.focus(),l.shouldSelect&&ae(x.select)&&x.select())}},ms=a=>{s={...s,...a}},bt={control:{register:qe,unregister:Ue,getFieldState:De,handleSubmit:ht,setError:dt,_subscribe:ft,_runSchema:X,_focusError:Be,_getWatch:T,_getDirty:Z,_setValid:A,_setFieldArray:he,_setDisabledField:mt,_setErrors:W,_getFieldArray:E,_reset:yt,_resetDefaultValues:()=>ae(t.defaultValues)&&t.defaultValues().then(a=>{gt(a,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:us,_subjects:m,_proxyFormState:h,get _fields(){return n},get _formValues(){return r},get _state(){return c},set _state(a){c=a},get _defaultValues(){return i},get _names(){return o},set _names(a){o=a},get _formState(){return s},get _options(){return t},set _options(a){t={...t,...a}}},subscribe:ls,trigger:ne,register:qe,handleSubmit:ht,watch:cs,setValue:K,getValues:we,reset:gt,resetField:ds,clearErrors:ve,unregister:Ue,setError:dt,setFocus:fs,getFieldState:De};return{...bt,formControl:bt}}function Jt(e={}){const t=g.useRef(void 0),s=g.useRef(void 0),[n,i]=g.useState({isDirty:!1,isValidating:!1,isLoading:ae(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ae(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:c,...o}=Zs(e);t.current={...o,formState:n}}const r=t.current.control;return r._options=e,Ms(()=>{const c=r._subscribe({formState:r._proxyFormState,callback:()=>i({...r._formState}),reRenderRoot:!0});return i(o=>({...o,isReady:!0})),r._formState.isReady=!0,c},[r]),g.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),g.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),g.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),g.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),g.useEffect(()=>{if(r._proxyFormState.isDirty){const c=r._getDirty();c!==n.isDirty&&r._subjects.state.next({isDirty:c})}},[r,n.isDirty]),g.useEffect(()=>{e.values&&!ge(e.values,s.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),s.current=e.values,i(c=>({...c}))):r._resetDefaultValues()},[r,e.values]),g.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),t.current.formState=Is(n,r),t.current}const Yt=e=>{const{t}=_.useTranslation(),{showStackNotifications:s,showSuccessNotification:n}=pe(),{defaultValues:i,mutationFn:r,formToDto:c,onError:o,onSuccess:f,queryKey:y,onSuccessMessage:h}=e,{control:b,handleSubmit:m,reset:C,setError:S,getValues:A,setValue:Q}=Jt({defaultValues:i}),he=g.useCallback(D=>{const j=D==null?void 0:D.errors,J=[];return j&&j.forEach(([X,xe])=>{const q=document.querySelector(`[name="${X}"]`);(q instanceof HTMLInputElement||q instanceof HTMLTextAreaElement||q instanceof HTMLSelectElement)&&(q.focus(),q.classList.add("error"),J.push(t(`_entities:${y}.${X}.${xe}`)))}),J},[t,y]),N=g.useCallback(()=>{document.querySelectorAll("input, textarea, select").forEach(j=>{j.classList.remove("error")})},[]),W=ke.useMutation({mutationFn:r,onError:D=>{if(console.error(D),D.errors){const j=he(D);s(j.map(J=>({message:J,type:R.error})))}o&&o(D)},onSuccess:async D=>{be&&await be.invalidateQueries({queryKey:y}),f&&f(D),h&&n({message:h})}});return{control:b,getValues:A,setValue:Q,handleSubmit:m,onSubmit:D=>W.mutate(c?c(D):D),reset:C,setError:S,parseFormError:he,releaseFormError:N,isLoading:W.isPending}},Xt=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1}=e;return{action:g.useCallback(c=>({id:me.Delete,hidden:c.deleted||n,disabled:c.deleted||i,icon:u.jsx(se.FontAwesomeIcon,{className:"text-red-500",icon:I.faTrash}),tooltip:t("_pages:common.actions.delete.text"),onClick:()=>s([c==null?void 0:c.id])}),[i,n,s,t])}},Zt=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1}=e;return{action:g.useCallback(r=>({id:me.Restore,hidden:!r.deleted||n,disabled:!r.deleted,icon:u.jsx(se.FontAwesomeIcon,{className:"text-red-500",icon:I.faRotateLeft}),tooltip:t("_pages:common.actions.restore.text"),onClick:()=>s([r==null?void 0:r.id])}),[n,s,t])}},er=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1}=e;return{action:g.useCallback(r=>({id:me.Edit,hidden:r.deleted||n,disabled:r.deleted,icon:u.jsx(se.FontAwesomeIcon,{className:"primary",icon:I.faPencil}),tooltip:t("_pages:common.actions.edit.text"),onClick:()=>s(r==null?void 0:r.id)}),[n,s,t])}};var me=(e=>(e.Add="add",e.Edit="edit",e.Delete="delete",e.Restore="restore",e.Refresh="refresh",e.Export="export",e.Import="import",e))(me||{});const es=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1,isLoading:r=!1}=e;return{action:g.useCallback(()=>({id:me.Export,hidden:n,disabled:i,icon:u.jsx(se.FontAwesomeIcon,{className:`${r?"rotate":""}`,icon:r?I.faCircleNotch:I.faCloudArrowDown}),tooltip:t("_pages:common.actions.export.text"),onClick:s}),[i,n,r,s,t])}},ts=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1,isLoading:r=!1}=e;return{action:g.useCallback(()=>({id:me.Import,hidden:n,disabled:i,icon:u.jsx(se.FontAwesomeIcon,{className:`${r?"rotate":""}`,icon:r?I.faCircleNotch:I.faCloudUpload}),tooltip:t("_pages:common.actions.import.text"),onClick:s}),[i,n,r,s,t])}},tr=e=>{const{queryKey:t,onSuccess:s,...n}=e,{showStackNotifications:i}=pe(),{t:r}=_.useTranslation(),{open:c,onClick:o,close:f,dialogFn:y,isLoading:h}=nt({onSuccessMessage:r("_pages:common.actions.delete.successMessage"),onError:m=>{m.errors&&i(m.errors.map(([C,S])=>({message:r(`_pages:${C}.errors.${S}`),type:R.error})))},onSuccess:async m=>{await be.invalidateQueries({queryKey:t}),s&&s(m)},...n}),{action:b}=Xt({onClick:o});return{onClick:o,title:r("_pages:common.actions.delete.dialog.title"),open:c,isLoading:h,handleSubmit:()=>y.mutate(),handleClose:f,action:b}},ut=()=>{const[e,t]=g.useState(!1);return{open:e,setOpen:t,handleClose:()=>t(!1),handleOpen:()=>t(!0)}},sr=e=>{const{t}=_.useTranslation(),{showErrorNotification:s,showStackNotifications:n,showSuccessNotification:i}=pe(),{defaultValues:r,getFunction:c,mutationFn:o,formToDto:f,dtoToForm:y,onError:h,onSuccess:b,queryKey:m,onSuccessMessage:C,title:S}=e,[A,Q]=g.useState(0),{open:he,handleClose:N,handleOpen:W}=ut(),{control:D,handleSubmit:j,reset:J,setError:X,getValues:xe,setValue:q}=Jt({defaultValues:r}),{data:re,isLoading:Z}=ke.useQuery({queryFn:()=>c==null?void 0:c(A),queryKey:[...m,A],enabled:!!c&&!!m&&!!A});g.useEffect(()=>{re&&y&&J({...y(re)})},[re]);const T=g.useCallback(L=>{const ee=L==null?void 0:L.errors,ne=[];return ee&&ee.forEach(([we,De])=>{const ve=document.querySelector(`[name="${we}"]`);(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLSelectElement)&&(ve.focus(),ve.classList.add("error"),ne.push(t(`_entities:${m}.${we}.${De}`)))}),ne},[t,m]),E=g.useCallback(()=>{document.querySelectorAll("input, textarea, select").forEach(ee=>{ee.classList.remove("error")})},[]),P=g.useCallback(L=>{Q(L??0),W()},[W]),B=g.useCallback(()=>{E(),N(),J()},[J,E,N]),K=ke.useMutation({mutationFn:o,onError:L=>{if(console.error(L),L.errors){const ee=T(L);n(ee.map(ne=>({message:ne,type:R.error})))}else h?h(L):s({message:t("_accessibility:errors.500")})},onSuccess:async L=>{await be.invalidateQueries({queryKey:m}),b&&b(L),i({message:C}),B()}});return{open:he,openDialog:P,handleClose:B,control:D,getValues:xe,setValue:q,handleSubmit:j,onSubmit:L=>K.mutate(f(L)),reset:J,setError:X,parseFormError:T,releaseFormError:E,title:S,isLoading:Z||K.isPending}},rr=e=>{const{queryKey:t,onSuccess:s,...n}=e,{showStackNotifications:i}=pe(),{t:r}=_.useTranslation(),{open:c,onClick:o,close:f,dialogFn:y,isLoading:h}=nt({onSuccessMessage:r("_pages:common.actions.restore.successMessage"),onError:m=>{m.errors&&i(m.errors.map(([C,S])=>({message:r(`_pages:${C}.errors.${S}`),type:R.error})))},onSuccess:async m=>{await be.invalidateQueries({queryKey:t}),s&&s(m)},...n}),{action:b}=Zt({onClick:o});return{onClick:o,title:r("_pages:common.actions.restore.dialog.title"),open:c,isLoading:h,handleSubmit:()=>y.mutate(),handleClose:f,action:b}};function nr(e){const{t}=_.useTranslation(),{queryKey:s,mutationFn:n,entity:i}=e,[r,c]=g.useState(!1),o=Yt({mutationFn:n,onSuccessMessage:t("_pages:common.actions.import.successMessage"),queryKey:s}),{action:f}=ts({onClick:()=>c(!0)});return{...o,open:r,title:t("_pages:common.actions.import.dialog.title",{entity:t(`_pages:${i}.title`)}),handleClose:()=>c(!1),action:f}}const ir=e=>{const{showSuccessNotification:t}=pe(),{t:s}=_.useTranslation(),{entity:n,mutationFn:i,onError:r,onSuccess:c,onSuccessMessage:o=s("_pages:common.actions.export.successMessage")}=e,f=ke.useMutation({mutationFn:()=>i(),onError:b=>{console.error(b),r&&r(b)},onSuccess:async b=>{const m=JSON.stringify(b,null,2),C=new Blob([m],{type:"application/json"}),S=URL.createObjectURL(C),A=document.createElement("a");A.href=S,A.download=`${n}.json`,A.click(),URL.revokeObjectURL(S),c&&c(b),t({message:o})}}),y=g.useCallback(()=>{f.mutate()},[f]),{action:h}=es({onClick:y,isLoading:f.isPending});return{action:h}};function ss(e){const[t,s]=g.useState(!1),n=g.useCallback(()=>{const i=window.scrollY>e;s(i)},[e]);return g.useEffect(()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}),[n]),t}const ar=()=>{const{t:e}=_.useTranslation(),t=ss(200);return u.jsx(ue,{icon:I.faArrowUp,onClick:()=>Cs.scrollTo(0,0),"data-tooltip-id":"tooltip","data-tooltip-content":e("_accessibility:buttons.toTop"),className:`submit primary to-top ${t?"show":"hide"}`})},rs=e=>{const{actions:t=[],className:s=""}=e,{t:n}=_.useTranslation(),[i,r]=g.useState(!1);return u.jsxs("div",{className:`actions-dropdown ${s}`,children:[u.jsx(ue,{icon:I.faEllipsisV,onClick:()=>r(!0),"data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),u.jsx($t,{open:i,onClose:()=>r(!1),children:u.jsx(Ze,{showActionTexts:!0,actions:t,className:"flex-col",showTooltips:!1})})]})},or=g.forwardRef(function(e,t){const{value:s,onChange:n,state:i=_.State.default,name:r="",id:c="",label:o="",disabled:f=!1,required:y=!1,containerClassName:h="",inputClassName:b="",labelClassName:m="",helperText:C="",helperTextClassName:S="",...A}=e;return u.jsxs("div",{className:`relative z-0 w-full mb-5 group ${h}`,children:[u.jsx("textarea",{ref:t,name:r,id:c,className:`text-input text-area ${_.inputStateClassName(i)} ${b} peer`,required:y,value:s,onChange:n,disabled:f,...A}),u.jsxs("label",{htmlFor:r,className:`text-input-label ${_.labelStateClassName(i)} ${m}`,children:[o,y?" *":""]}),!!C&&u.jsx("p",{className:`text-input-helper-text ${_.helperTextStateClassName(i)} ${S}`,children:C})]})}),cr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,onSubmit:i,isLoading:r=!1,buttonEnd:c=!0,reset:o}=e;return u.jsxs("form",{className:"form-container",onSubmit:n(i),children:[s,u.jsxs("div",{className:`flex gap-2 mt-5 ${c?"justify-end":""}`,children:[u.jsxs(fe,{type:"submit",color:"primary",variant:"submit",disabled:r,name:t("_accessibility:buttons.submit"),"aria-label":t("_accessibility:ariaLabels.submit"),children:[r?u.jsx(_.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,t("_accessibility:buttons.submit")]}),u.jsx(fe,{type:"button",variant:"outlined",onClick:()=>o==null?void 0:o(),name:t("_accessibility:buttons.cancel"),"aria-label":t("_accessibility:ariaLabels.cancel"),children:t("_accessibility:buttons.cancel")})]})]})},lr=g.forwardRef(function(e,t){const[s,n]=g.useState(!1);return u.jsx(_.TextInput,{...e,type:s?"text":"password",ref:t,children:u.jsx(ue,{type:"button",tabIndex:-1,className:"absolute right-2 password-icon",onClick:()=>n(!s),icon:s?I.faEyeSlash:I.faEye})})}),Oe=e=>{const{t}=_.useTranslation(),{title:s,children:n,handleClose:i,open:r=!1,containerClassName:c="",className:o="",animationClass:f="appear"}=e,[y,h]=g.useState(window.innerWidth),b=g.useCallback(A=>{A.key==="Escape"&&r&&i()},[r,i]);g.useEffect(()=>(window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b)}),[b]);const m=g.useCallback(()=>{h(window.innerWidth)},[]);g.useEffect(()=>(window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}),[m]);const C=g.useMemo(()=>xs.css({width:`${y}px`}),[y]),S=g.useCallback(A=>{var Q;((Q=A==null?void 0:A.currentTarget)==null?void 0:Q.getAttribute("name"))===t("_accessibility:buttons.closeDialog")&&i()},[t,i]);return g.useEffect(()=>{const A=Q=>{Q?document.body.style.overflow="hidden":document.body.style.overflow="auto"};return A(r),()=>{A(r)}},[r]),Lt.createPortal(u.jsx("div",{"aria-label":t("_accessibility:ariaLabels.closeDialog"),"aria-disabled":!r,onClick:S,className:`dialog-backdrop animated ${r?`opened ${f}`:"closed"} ${C} h-screen ${r?"bg-base/20 backdrop-blur-xl":"pointer-events-none"} ${c}`,children:u.jsxs("div",{className:`dialog elevated animated ${r?`opened ${f}`:"closed"} ${o}`,children:[u.jsxs("div",{className:"dialog-header",children:[u.jsx("h3",{className:"text-text text-xl",children:s}),u.jsx(ue,{icon:I.faClose,disabled:!r,"aria-disabled":!r,onClick:i,className:"icon-button text-red-400",name:t("_accessibility:buttons.closeDialog"),"aria-label":t("_accessibility:ariaLabels.closeDialog")})]}),n]})}),document.body)},Re=e=>{const{primaryText:t,cancelText:s,onPrimaryClick:n,onCancel:i,isLoading:r=!1,disabled:c=!1,primaryType:o="button",containerClassName:f="",primaryClassName:y="",alignEnd:h=!1,primaryName:b,primaryAriaLabel:m,cancelName:C,cancelAriaLabel:S}=e;return u.jsxs("div",{className:`flex gap-2 mt-2 ${h?"justify-end":""} ${f}`,children:[u.jsxs(fe,{type:o,color:"primary",variant:"submit",className:y,disabled:c,onClick:o==="button"?n:void 0,name:b,"aria-label":m,children:[r?u.jsx(_.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,t]}),u.jsx(fe,{type:"button",variant:"outlined",disabled:c,onClick:i,name:C,"aria-label":S,children:s})]})},ur=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,onSubmit:i,handleClose:r,isLoading:c=!1,buttonEnd:o=!0,...f}=e;return u.jsx(Oe,{...f,handleClose:r,children:u.jsxs("form",{onSubmit:n(i),children:[u.jsx("div",{className:"form-container",children:s}),u.jsx(Re,{primaryType:"submit",primaryText:t("_accessibility:buttons.submit"),cancelText:t("_accessibility:buttons.cancel"),onCancel:r,isLoading:c,disabled:c,primaryClassName:"!px-6",alignEnd:o,primaryName:t("_accessibility:buttons.submit"),primaryAriaLabel:t("_accessibility:ariaLabels.submit"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})})},dr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,handleClose:i,isLoading:r=!1,...c}=e;return u.jsxs(Oe,{...c,handleClose:i,children:[s,u.jsx(Re,{primaryText:t("_accessibility:buttons.ok"),cancelText:t("_accessibility:buttons.cancel"),onPrimaryClick:n,onCancel:i,isLoading:r,disabled:r,primaryType:"button",containerClassName:"mt-5",primaryName:t("_accessibility:buttons.ok"),primaryAriaLabel:t("_accessibility:ariaLabels.ok"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})},fr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,handleClose:i,isLoading:r=!1,...c}=e;return u.jsxs(Oe,{...c,handleClose:i,children:[s,u.jsx(Re,{primaryText:t("_accessibility:buttons.ok"),cancelText:t("_accessibility:buttons.cancel"),onPrimaryClick:n,onCancel:i,isLoading:r,disabled:r,primaryType:"button",containerClassName:"mt-5",primaryName:t("_accessibility:buttons.ok"),primaryAriaLabel:t("_accessibility:ariaLabels.ok"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})};function mr(e){const{t}=_.useTranslation(),{open:s,onClose:n,menuMap:i}=e,{account:r}=rt(),{linkComponent:c}=Fe(),o=c,f=g.useMemo(()=>i.filter(h=>{const b=h.auth,m=!!(r!=null&&r.email);return b==null||b&&m||!b&&!m}),[r]),y=g.useCallback(h=>{h.key==="Escape"&&s&&n()},[n,s]);return g.useEffect(()=>(document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}),[y]),u.jsx("div",{"aria-label":t("_accessibility:ariaLabels.closeMenu"),"aria-disabled":!s,className:`${s?"opened":"closed"} drawer-backdrop`,onClick:()=>n(),children:u.jsxs("aside",{className:`${s?"opened":"closed"} bg-base drawer animated`,children:[u.jsx("h2",{className:"text-xl text-text px-5 pb-5 font-bold poppins",children:t("_pages:home.appName")}),u.jsx("ul",{className:"flex flex-col",children:f.map((h,b)=>u.jsx("li",{className:`w-full flex hover:bg-base-light ${h.path===location.pathname?"bg-base-light":""} animated`,children:h.type!=="divider"&&o?u.jsxs(o,{"aria-disabled":!s,to:h.path??`/${h.path}`,"aria-label":t(`_accessibility:ariaLabels.${h.path}`),className:"text-lg text-text-muted w-full py-2 px-5 flex items-center justify-start gap-2",children:[h.icon,t(`_pages:${h.page}.title`)]}):u.jsx("hr",{className:"border-border border-spacing-x-0.5 w-full"})},`${h.page??b}`))})]})})}function hr(e){const{error:t}=e,{t:s}=_.useTranslation();return u.jsxs("div",{className:"flex flex-col items-center justify-center pt-10 gap-5",children:[u.jsx(se.FontAwesomeIcon,{icon:ws.faSadTear,className:"text-red-300 text-4xl"}),u.jsx("p",{className:"text-text text-center",children:(t==null?void 0:t.message)??s("_accessibility:errors.unknownError")})]})}const yr=e=>{const{showBackButton:t,title:s,actions:n}=e,{t:i}=_.useTranslation(),{navigate:r}=Fe();return u.jsxs("div",{className:"page-header",children:[u.jsxs("div",{className:"flex gap-2 items-center justify-start",children:[t&&u.jsx(ue,{icon:I.faArrowLeft,onClick:()=>r(-1),name:i("_accessibility:buttons.back"),"data-tooltip-id":"tooltip","data-tooltip-content":i("_accessibility:buttons.back")}),u.jsx("h2",{className:"text-3xl font-bold",children:s})]}),u.jsxs("div",{children:[u.jsx(Ze,{className:"max-xs:!hidden",actions:n??[]}),u.jsx(rs,{className:"min-xs:hidden",actions:n??[]})]})]})},gr=e=>{const{title:t,children:s,addOptions:n,filterOptions:i,actions:r,queryKey:c,isLoading:o=!1,isAnimated:f=!0,showBackButton:y=!1}=e,{t:h}=_.useTranslation(),{countOfFilters:b}=_.useTableOptions(),m=g.useMemo(()=>{const C=Array.isArray(r)?[...r]:[];if(c){const S={id:me.Refresh,onClick:()=>be.invalidateQueries({queryKey:c}),icon:u.jsx(se.FontAwesomeIcon,{icon:I.faRotateLeft}),tooltip:h("_pages:common.actions.refresh.text")};C.unshift(S)}if(n){const S={...n,id:me.Add,icon:u.jsx(se.FontAwesomeIcon,{icon:I.faAdd})};C.unshift(S)}if(i){const S={...i,id:"filter",icon:u.jsx(se.FontAwesomeIcon,{icon:I.faFilter}),children:u.jsx(_.Badge,{className:`${b>0?"show":"hide"} `,count:b})};C.push(S)}return C},[r,n,b,i,c,h]);return u.jsxs("main",{className:"",children:[u.jsxs("div",{className:"flex flex-col",children:[u.jsx(yr,{showBackButton:y,actions:m,title:t}),u.jsx("div",{className:`px-5 py-3 h-useConfigfull ${f?"appear":""}`,children:o?u.jsx(_.Loading,{className:"flex justify-center items-center h-50"}):s})]}),u.jsx(ue,{icon:I.faAdd,color:"primary",variant:"submit",onClick:()=>{var C;return(C=n==null?void 0:n.onClick)==null?void 0:C.call(n)},className:"button fab min-xs:!hidden"})]})},br=e=>{const{t}=_.useTranslation(),{loading:s=!1,emptyComponent:n=null,emptyMessage:i=t("_accessibility:messages.empty"),renderComponent:r,data:c=[]}=e;return u.jsx(u.Fragment,{children:c!=null&&c.length?u.jsx("ul",{className:"pretty-grid-main",children:c==null?void 0:c.map(o=>u.jsx("li",{className:"pretty-grid-item",children:r(o)},o.id))}):u.jsx(u.Fragment,{children:n||u.jsx(os,{message:i})})})},pr=()=>{const[e,t]=g.useState(Je());return g.useEffect(()=>{const s=setInterval(()=>{t(Je())},1e3);return()=>clearInterval(s)},[]),u.jsx("p",{className:"capitalize max-xs:hidden",children:e})};function xr(e){const{t}=_.useTranslation(),{openDrawer:s}=e,{searchComponent:n}=Fe(),[i,r]=g.useState(!1),c=g.useCallback(f=>{(It()?f.metaKey:f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="f"&&(r(!0),f.preventDefault())},[]);g.useEffect(()=>(window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}),[c]);const o=n;return u.jsxs(u.Fragment,{children:[location.pathname!=="/"&&!!o&&u.jsx(o,{open:i,onClose:()=>r(!1)}),u.jsxs("header",{id:"header",className:"header",children:[u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(ue,{type:"button",icon:I.faBars,onClick:s,name:t("_accessibility:buttons.openMenu"),"aria-label":t("_accessibility:ariaLabels.openMenu"),className:"menu animated"}),u.jsx("h1",{className:"text-lg text-text pointer-events-none poppins font-bold",children:t("_pages:home.appName")})]}),u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(ue,{icon:I.faSearch,className:"min-xs:!hidden",onClick:()=>r(!0)}),u.jsx(pr,{})]})]})]})}function wr(){const{t:e}=_.useTranslation(),{notification:t,removeNotification:s}=pe(),[n,i]=g.useState(new Set),r=g.useCallback(h=>{if(h===void 0){const b=new Set(t.map((m,C)=>C));i(b),window.setTimeout(()=>s(),300)}else i(b=>new Set(b).add(h)),window.setTimeout(()=>s(h),300)},[t,s]),c=g.useCallback(h=>{switch(h){case R.error:return I.faWarning;default:return I.faCircleCheck}},[]),o=g.useCallback(h=>{switch(h){case R.success:return"!text-success";case R.error:return"!text-error";case R.warning:return"!text-warning";default:return"!text-info"}},[]),f=g.useCallback(h=>{switch(h){case R.success:return"bg-bg-success";case R.error:return"bg-bg-error";case R.warning:return"bg-bg-warning";default:return"bg-bg-info"}},[]),y=g.useRef();return g.useEffect(()=>{y.current=()=>r()},[r]),g.useEffect(()=>{if(!(t!=null&&t.length))return;const h=b=>{var m;return(m=y.current)==null?void 0:m.call(y,b)};return window.addEventListener("click",h),()=>{window.removeEventListener("click",h)}},[t==null?void 0:t.length]),g.useEffect(()=>{i(new Set)},[t]),Lt.createPortal(u.jsx("div",{className:`notification-portal ${t!=null&&t.length?"w-screen h-screen":""}`,children:t!=null&&t.length?t==null?void 0:t.map(({id:h,type:b,message:m},C)=>u.jsxs("div",{className:`notification ${n.has(C)?"closing":""} ${f(b??R.error)}`,onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"flex gap-3 items-center",children:[u.jsx(se.FontAwesomeIcon,{icon:c(b??R.error),className:`${o(b??R.error)}`}),u.jsx("p",{className:`whitespace-nowrap ${o(b??R.error)}`,children:m})]}),u.jsx(ue,{type:"button",icon:I.faClose,color:"error",className:"group",onClick:S=>{S.stopPropagation(),r(C)},iconClassName:`${o(b??R.error)} group-hover:!text-red-400 cursor-pointer`,name:e("_accessibility:buttons.closeNotification"),"aria-label":e("_accessibility:ariaLabels.closeNotification")})]},h)):null}),document.body)}function vr(){return u.jsx("div",{className:"w-screen h-screen flex items-center justify-center overflow-hidden",children:u.jsx(_.Loading,{className:"blur-appear"})})}const ns=e=>{const{id:t,active:s,onClick:n,children:i,to:r}=e,{linkComponent:c}=Fe(),o=c;return u.jsx(o,{to:r??`#${t}`,onClick:()=>n(),className:`button submit tab ${s?"primary":"outlined"}`,children:i})},is=e=>{var f;const{tabs:t=[],defaultTab:s,className:n="",tabsContainerClassName:i=""}=e,[r,c]=g.useState((f=t[0])==null?void 0:f.id),o=g.useMemo(()=>t.find(y=>y.id===r),[t,r]);return g.useEffect(()=>{s&&c(s)},[s]),u.jsxs("div",{className:`tabs-layout-main ${n}`,children:[u.jsx("ul",{className:`horizontal tabs tabs-container ${i}`,children:t.map(({id:y,to:h,label:b})=>u.jsx("li",{children:u.jsx(ns,{onClick:()=>c(y),id:y,to:h??"",siblings:t.length>1,active:r===y,children:b})},y))}),o==null?void 0:o.content]})},as=e=>{const{translation:t,onClickNext:s,image:n="",alt:i="",final:r=!1}=e,{setGuestMode:c}=rt(),{t:o}=_.useTranslation();return u.jsxs("div",{className:"big-appear w-md flex flex-col gap-20",children:[u.jsx("img",{src:n,alt:i}),u.jsx("h2",{className:"text-5xl text-center leading-16",children:o(`_pages:onboarding.${t}.title`)}),u.jsx("p",{className:"text-center !text-lg",children:o(`_pages:onboarding.${t}.body`)}),u.jsx("div",{className:"flex gap-5 items-center justify-center",children:r?u.jsxs(u.Fragment,{children:[u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>{c(!0),window.location.href="/"},"aria-label":o("_accessibility:ariaLabels.start"),children:o("_accessibility:buttons.startAsGuest")}),u.jsx(fe,{color:"primary",variant:"submit",className:"!px-8","aria-label":o("_accessibility:ariaLabels.start"),onClick:()=>window.location.href="/auth/sign-in",children:o("_accessibility:buttons.signIn")})]}):u.jsxs(u.Fragment,{children:[u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>window.location.href="/auth/sign-in","aria-label":o("_accessibility:ariaLabels.skip"),children:o("_accessibility:buttons.skip")}),u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>s(),"aria-label":o("_accessibility:ariaLabels.next"),children:o("_accessibility:buttons.next")})]})})]})},Cr=e=>{const{steps:t}=e,[s,n]=g.useState(1),i=g.useMemo(()=>t.map((r,c)=>({id:c+1,label:"",content:u.jsx(as,{translation:r,final:c===t.length-1,onClickNext:()=>n(s+1)})})),[s]);return u.jsx("div",{className:"onboarding-main",children:u.jsx(is,{defaultTab:s,tabs:i})})},os=e=>{const{message:t,messageProps:s={className:"text-gray-400 text-balance text-center"},action:n,iconProps:i}=e;return u.jsxs("div",{className:"flex flex-col items-center justify-center gap-5 pt-5",children:[i&&u.jsx(se.FontAwesomeIcon,{...i??{}}),u.jsx("p",{...s??{},children:t}),n&&u.jsx(Xe,{showTooltips:!1,showText:!0,...n})]})};exports.APIClient=tt;exports.Action=Xe;exports.Actions=Ze;exports.ActionsDropdown=rs;exports.AuthClient=Pt;exports.AuthProvider=Fs;exports.BaseClient=As;exports.Button=fe;exports.ConfigProvider=js;exports.ConfirmationDialog=dr;exports.Dialog=Oe;exports.DialogActions=Re;exports.Drawer=mr;exports.Dropdown=$t;exports.Empty=os;exports.Error=hr;exports.FormContainer=cr;exports.FormDialog=ur;exports.GlobalActions=me;exports.IManager=Ss;exports.IconButton=ue;exports.ImportDialog=fr;exports.ManagerProvider=Es;exports.Methods=G;exports.Navbar=xr;exports.Notification=wr;exports.NotificationEnumType=R;exports.NotificationProvider=Ts;exports.Onboarding=Cr;exports.Page=gr;exports.ParagraphInput=or;exports.PasswordInput=lr;exports.PrettyGrid=br;exports.SplashScreen=vr;exports.Step=as;exports.Tab=ns;exports.TabsLayout=is;exports.ToTop=ar;exports.buildQueryUrl=Vt;exports.enumToKeyValueArray=_s;exports.formatForDatetimeLocal=Ns;exports.fromLocal=st;exports.getFormattedDateTime=Je;exports.isMac=It;exports.makeRequest=Ae;exports.parseQueries=et;exports.queryClient=be;exports.removeFromLocal=Ge;exports.toLocal=ze;exports.useAuth=rt;exports.useConfig=Fe;exports.useConfirmationForm=nt;exports.useDeleteAction=Xt;exports.useDeleteDialog=tr;exports.useDialog=ut;exports.useEditAction=er;exports.useExportAction=es;exports.useExportActionMutate=ir;exports.useFormDialog=sr;exports.useImportAction=ts;exports.useImportDialog=nr;exports.useManager=Rt;exports.useNotification=pe;exports.usePostForm=Yt;exports.useRestoreAction=Zt;exports.useRestoreDialog=rr;exports.useScrollTrigger=ss;exports.useTimeAge=ks;Object.keys(_).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>_[e]})});
|
|
1
|
+
var bs=Object.defineProperty;var ps=(e,t,s)=>t in e?bs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var oe=(e,t,s)=>ps(e,typeof t!="symbol"?t+"":t,s);var Ar=require("./main.css");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@sito/dashboard"),u=require("react/jsx-runtime"),y=require("react"),I=require("@fortawesome/free-solid-svg-icons"),se=require("@fortawesome/react-fontawesome"),Lt=require("react-dom"),xs=require("@emotion/css"),ke=require("@tanstack/react-query"),ws=require("@fortawesome/free-regular-svg-icons");function Xe(e){const{id:t,icon:s,tooltip:n,onClick:i,children:r,hidden:c=!1,disabled:o=!1,showText:f=!1,showTooltips:g=!0}=e;return c?null:u.jsxs("button",{id:t,className:`action ${f?"text-action":"icon-action"}`,disabled:o,onClick:()=>i(),"aria-disabled":o,"data-tooltip-id":"tooltip","data-tooltip-content":g?n:"",children:[s," ",f&&n,r]})}function Ze(e){const{actions:t=[],className:s="",showTooltips:n=!0,showActionTexts:i=!1}=e;return u.jsx("ul",{className:`actions-container ${s}`,children:t==null?void 0:t.map(r=>u.jsx("li",{children:u.jsx(Xe,{showTooltips:n,showText:i,...r,children:r.children})},r.id))})}const $t=e=>{const{children:t,open:s,onClose:n}=e,i=y.useRef(null),r=y.useCallback(o=>{const f=i.current;!s||!f||f.contains(o.target)||n()},[s,n]),c=y.useCallback(o=>{s&&o.key==="Escape"&&n()},[s,n]);return y.useEffect(()=>{if(s)return setTimeout(()=>{var o;return(o=i.current)==null?void 0:o.focus()},0),document.addEventListener("mousedown",r),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",c)}},[s,r,c]),u.jsx("div",{ref:i,role:"menu","aria-hidden":!s,tabIndex:-1,className:`dropdown-main ${s?"opened":"closed"}`,onClick:o=>o.stopPropagation(),children:t})},ue=e=>{const{children:t,icon:s,type:n="button",className:i="",variant:r="text",color:c="default",iconClassName:o="",...f}=e;return u.jsxs("button",{type:n,className:`icon-button ${i} ${r} ${c}`,...f,children:[u.jsx(se.FontAwesomeIcon,{icon:s,className:`!w-auto ${o}`}),t]})},fe=e=>{const{children:t,type:s="button",variant:n="text",color:i="default",className:r="",...c}=e;return u.jsx("button",{type:s,className:`button ${n} ${i} ${r}`,...c,children:t})};var Ke,wt;function vs(){if(wt)return Ke;wt=1;const e=(o,f="local",g=void 0)=>{if(f==="local"){if(localStorage.getItem(o)!==void 0&&localStorage.getItem(o)!=="undefined"&&localStorage.getItem(o)!==null)return g===void 0||g!==void 0&&localStorage.getItem(o)===g}else if(f==="session"&&sessionStorage.getItem(o)!==void 0&&sessionStorage.getItem(o)!=="undefined"&&sessionStorage.getItem(o)!==null)return g===void 0||g!==void 0&&sessionStorage.getItem(o)===g;return!1},t=o=>{const f={};return o.substring(1).split("&").forEach(b=>{const[h,m]=b.split("=");f[h]=m}),f},s=(o="")=>{if(r(o)&&o.length)return r(o);{let f=navigator.language||navigator.userLanguage;if(f.indexOf("en")<0&&f.indexOf("es")<0&&(f="en-US"),f=f.split("-")[0],f)return o.length&&i(o,730,f),f}return"en"},n=(o=0,f=0,g=window,b="smooth")=>g.scroll({top:o,left:f,behavior:b}),i=(o,f,g,b="/",h="Lax")=>{var m=new Date;m.setTime(m.getTime()+f*24*60*60*1e3);const C="; expires="+m.toUTCString();document.cookie=`${o}=${g||""}${C};path=${b};SameSite=${h}`},r=o=>{const f=`${o}=`,b=decodeURIComponent(document.cookie).split(";");for(let h=0;h<b.length;h+=1){let m=b[h];for(;m.charAt(0)===" ";)m=m.substring(1);if(m.indexOf(f)===0)return m.substring(f.length,m.length)}return""};return Ke={getCookie:r,createCookie:i,deleteCookie:o=>document.cookie=`${o}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`,getUserLanguage:s,scrollTo:n,parseQueries:t,validation:e},Ke}var Cs=vs();function ks(){const{t:e,language:t}=_.useTranslation();return{timeAge:y.useCallback(n=>{const r=new Date-n,c=Math.floor(r/(1e3*60)),o=Math.floor(c/60),f=t==="es",g=e("_accessibility:labels.ago"),b=e("_accessibility:labels.minute"),h=e("_accessibility:labels.minutes"),m=e("_accessibility:labels.hour"),C=e("_accessibility:labels.hours"),S=e("_accessibility:labels.yesterday"),A=e("_accessibility:labels.justNow");return r<1e3*60?A:c<60?`${f?g:""} ${c} ${c===1?b:h} ${f?"":g}`:o<24?`${f?g:""} ${o} ${o===1?m:C} ${f?"":g}`:o<48?S:n.toLocaleDateString(navigator.language||"es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})},[e,t])}}var R=(e=>(e[e.success=0]="success",e[e.error=1]="error",e[e.warning=2]="warning",e[e.info=3]="info",e))(R||{}),G=(e=>(e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.DELETE="DELETE",e))(G||{});async function Ae(e,t="GET",s,n){const i={...s?{"Content-Type":"application/json"}:{},...n};try{const r=await fetch(e,{method:t,headers:i,...s?{body:JSON.stringify(s)}:{}}),c=await r.text();let o=null;try{o=c?JSON.parse(c):null}catch{o=null}if(!r.ok){const f=typeof o=="object"&&o!==null?o.message??o.error??c:c||r.statusText;return{data:null,status:r.status,error:{status:r.status,message:f||"Unknown error occurred"}}}return{data:r.status!==204&&o!==null?o:null,status:r.status,error:null}}catch(r){return{data:null,status:500,error:{status:500,message:r instanceof Error?r.message:"Unknown error occurred"}}}}function Vt(e,t){if(t){const s=Object.entries(t).filter(([,n])=>n!=null).map(([n,i])=>`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`).join("&");return s?`${e}?${s}`:e}return e}const et=(e,t,s)=>{const n=[];if(t){const{sortingBy:i,sortingOrder:r,currentPage:c,pageSize:o}=t;n.push(`sort=${String(i)}`,`order=${r}`,`page=${c}`,`pageSize=${o}`)}if(s){const i=Object.entries(s).filter(([,r])=>r!=null&&r!=="").flatMap(([r,c])=>{if(Array.isArray(c))return c.map(o=>`${r}==${encodeURIComponent((o==null?void 0:o.id)??o)}`);if(typeof c=="object"&&c!==null&&"start"in c&&"end"in c){const o=[];return c.start!=null&&c.start!==""&&o.push(`${r}>=${encodeURIComponent(c.start)}`),c.end!=null&&c.end!==""&&o.push(`${r}<=${encodeURIComponent(c.end)}`),o}return typeof c=="object"&&c!==null?`${r}==${encodeURIComponent(c.id??"")}`:`${r}==${encodeURIComponent(c)}`});i.length>0&&n.push(`filters=${i.join(",")}`)}return n.length?`${e}?${n.join("&")}`:e};class tt{constructor(t,s="user",n=!0,i=null){oe(this,"baseUrl");oe(this,"userKey");oe(this,"secured");oe(this,"tokenAcquirer");this.baseUrl=t,this.secured=n,this.userKey=s,i||(this.tokenAcquirer=this.defaultTokenAcquirer)}defaultTokenAcquirer(t){if(t)return{credentials:"include"};const s=st(this.userKey);if(s&&s.length)return{Authorization:`Bearer ${s}`}}async doQuery(t,s=G.GET,n,i){const r=this.secured?this.defaultTokenAcquirer():{},{data:c,status:o,error:f}=await Ae(`${this.baseUrl}${t}`,s,n,{...r,...i??{}});if(f||o<200||o>=300)throw f??{status:o,message:String(o)};return c}async get(t,s,n){const i=et(t,s,n),r=this.secured?this.defaultTokenAcquirer():void 0,{data:c,error:o}=await Ae(`${this.baseUrl}${i}`,G.GET,null,r);if(o)throw o;return c}async patch(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.PATCH,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}async delete(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.DELETE,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}async post(t,s){const n=this.secured?this.defaultTokenAcquirer():void 0,{error:i,data:r,status:c}=await Ae(`${this.baseUrl}${t}`,G.POST,s,n);if(i||!r)throw i??{status:c,message:"Unknown error"};return r}}class Pt{constructor(t,s="user"){oe(this,"api");this.api=new tt(t,s,!1)}async login(t){const s="auth/sign-in",n=t;return await this.api.doQuery(s,G.POST,n)}async logout(){return await this.api.doQuery("auth/sign-out",G.POST)}async register(t){return await this.api.doQuery("auth/sign-up",G.POST,t)}async getSession(){return await this.api.doQuery("auth/session",G.GET,null,{...this.api.defaultTokenAcquirer()})}}class Ss{constructor(t,s){oe(this,"auth");this.auth=new Pt(t,s)}get Auth(){return this.auth}}class As{constructor(t,s,n="user",i=!0){oe(this,"table");oe(this,"secured");oe(this,"api");this.table=t,this.secured=i,this.api=new tt(s,n,i)}async insert(t){return await this.api.post(`${this.table}`,t)}async insertMany(t){return await this.api.doQuery(`${this.table}/batch`,G.POST,t)}async update(t){return await this.api.patch(`${this.table}/${t.id}`,t)}async get(t,s){return await this.api.get(`${this.table}`,t,s)}async export(t){const s=et(`${this.table}/export`,void 0,t);return await this.api.doQuery(s,G.GET,void 0)}async import(t){return await this.api.doQuery(`${this.table}/import`,G.POST,t)}async commonGet(t){return await this.api.doQuery(Vt(`${this.table}/common`,t),G.GET)}async getById(t){return await this.api.doQuery(`${this.table}/${t}`)}async softDelete(t){return await this.api.delete(`${this.table}`,t)}async restore(t){return await this.api.patch(`${this.table}/restore`,t)}}function _s(e){return Object.keys(e).filter(t=>isNaN(Number(t))).map(t=>({key:t,value:e[t]}))}const st=(e,t="")=>{const s=localStorage.getItem(e)??void 0;if(s&&t.length)switch(t){case"object":return JSON.parse(s);case"number":return Number(s);case"boolean":return s==="true"||s==="1";default:return s}return s},ze=(e,t)=>localStorage.setItem(e,typeof t=="object"?JSON.stringify(t):t),Ge=e=>localStorage.removeItem(e);function Je(e){const t=e?new Date(e):new Date,s={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0};return t.toLocaleString(navigator.language||"es-ES",s)}function Ns(e){const t=e?new Date(e):new Date,s=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),c=String(t.getMinutes()).padStart(2,"0");return`${s}-${n}-${i}T${r}:${c}`}const It=()=>{var s;const e=navigator,t=((s=e==null?void 0:e.userAgentData)==null?void 0:s.platform)||(e==null?void 0:e.platform)||"";return/Mac|iPhone|iPod|iPad/i.test(t)},Mt=y.createContext({});function Ts(e){const{children:t}=e,[s,n]=y.useReducer((g,b)=>{const{type:h,items:m,index:C}=b;switch(h){case"set":return(m==null?void 0:m.map((S,A)=>({...S,id:A})))??[];case"remove":return C!==void 0?g.filter((S,A)=>A!==C):[]}return g},[],()=>[]),i=g=>n({type:"set",items:[{...g,type:R.error}]}),r=g=>n({type:"set",items:[{...g}]}),c=g=>n({type:"set",items:g}),o=g=>n({type:"set",items:[{...g,type:R.success}]}),f=g=>n({type:"remove",index:g});return u.jsx(Mt.Provider,{value:{notification:s,removeNotification:f,showErrorNotification:i,showNotification:r,showSuccessNotification:o,showStackNotifications:c},children:t})}const pe=()=>{const e=y.useContext(Mt);if(e===void 0)throw new Error("NotificationContext must be used within a Provider");return e},be=new ke.QueryClient({defaultOptions:{queries:{refetchInterval:!1,refetchOnMount:!0,refetchOnReconnect:!1,retry:!1,retryOnMount:!0,refetchOnWindowFocus:!1}}}),Ot=y.createContext({}),Es=e=>{const{children:t,manager:s}=e;return u.jsx(Ot.Provider,{value:{client:s},children:u.jsx(ke.QueryClientProvider,{client:be,children:t})})},Rt=()=>{const e=y.useContext(Ot);if(e===void 0)throw new Error("managerContext must be used within a Provider");return e.client},Ut=y.createContext({}),Fs=e=>{const{children:t,guestMode:s="guest_mode",user:n="user"}=e,i=Rt(),[r,c]=y.useState({}),o=y.useCallback(()=>!!st(s,"boolean")&&r.token===void 0,[r.token]),f=y.useCallback(C=>{ze(s,C)},[]),g=y.useCallback(C=>{C&&(c(C),Ge(s),ze(n,C.token))},[]),b=y.useCallback(async()=>{try{await i.Auth.logout()}catch(C){console.error(C)}c({}),Ge(n)},[i.Auth]),h=y.useCallback(async()=>{try{const C=await i.Auth.getSession();g(C)}catch(C){console.error(C),b()}},[g,b,i.Auth]),m={account:r,logUser:g,logoutUser:b,logUserFromLocal:h,isInGuestMode:o,setGuestMode:f};return u.jsx(Ut.Provider,{value:m,children:t})},rt=()=>{const e=y.useContext(Ut);if(e===void 0)throw new Error("authContext must be used within a Provider");return e},qt=y.createContext({}),js=e=>{const{children:t,location:s,navigate:n,linkComponent:i,searchComponent:r}=e;return u.jsx(qt.Provider,{value:{location:s,navigate:n,linkComponent:i,searchComponent:r},children:t})},Fe=()=>{const e=y.useContext(qt);if(e===void 0||Object.keys(e).length===0)throw new Error("Config provider has not been set. This step is required and cannot be skipped.");return e},nt=e=>{const{showSuccessNotification:t}=pe(),{mutationFn:s,onError:n,onSuccess:i,onSuccessMessage:r}=e,[c,o]=y.useState([]),{open:f,handleClose:g,handleOpen:b}=ut(),h=()=>{g(),o([])},m=async S=>{o(S),b()},C=ke.useMutation({mutationFn:()=>s(Array.isArray(c)?c:[c]),onError:S=>{console.error(S),n&&n(S),h()},onSuccess:async S=>{i&&i(S),t({message:r}),h()}});return{open:f,onClick:m,close:h,dialogFn:C,isLoading:C.isPending}};var je=e=>e.type==="checkbox",Ce=e=>e instanceof Date,z=e=>e==null;const Bt=e=>typeof e=="object";var M=e=>!z(e)&&!Array.isArray(e)&&Bt(e)&&!Ce(e),Ds=e=>M(e)&&e.target?je(e.target)?e.target.checked:e.target.value:e,Ls=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,$s=(e,t)=>e.has(Ls(t)),Vs=e=>{const t=e.constructor&&e.constructor.prototype;return M(t)&&t.hasOwnProperty("isPrototypeOf")},it=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function H(e){let t;const s=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(it&&(e instanceof Blob||n))&&(s||M(e)))if(t=s?[]:{},!s&&!Vs(e))t=e;else for(const i in e)e.hasOwnProperty(i)&&(t[i]=H(e[i]));else return e;return t}var Me=e=>/^\w*$/.test(e),U=e=>e===void 0,at=e=>Array.isArray(e)?e.filter(Boolean):[],ot=e=>at(e.replace(/["|']|\]/g,"").split(/\.|\[/)),v=(e,t,s)=>{if(!t||!M(e))return s;const n=(Me(t)?[t]:ot(t)).reduce((i,r)=>z(i)?i:i[r],e);return U(n)||n===e?U(e[t])?s:e[t]:n},ce=e=>typeof e=="boolean",V=(e,t,s)=>{let n=-1;const i=Me(t)?[t]:ot(t),r=i.length,c=r-1;for(;++n<r;){const o=i[n];let f=s;if(n!==c){const g=e[o];f=M(g)||Array.isArray(g)?g:isNaN(+i[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=f,e=e[o]}};const vt={BLUR:"blur",FOCUS_OUT:"focusout"},ie={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},de={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ps=y.createContext(null);Ps.displayName="HookFormContext";var Is=(e,t,s,n=!0)=>{const i={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(i,r,{get:()=>{const c=r;return t._proxyFormState[c]!==ie.all&&(t._proxyFormState[c]=!n||ie.all),e[c]}});return i};const Ms=typeof window<"u"?y.useLayoutEffect:y.useEffect;var le=e=>typeof e=="string",Os=(e,t,s,n,i)=>le(e)?(n&&t.watch.add(e),v(s,e,i)):Array.isArray(e)?e.map(r=>(n&&t.watch.add(r),v(s,r))):(n&&(t.watchAll=!0),s),Ye=e=>z(e)||!Bt(e);function ge(e,t,s=new WeakSet){if(Ye(e)||Ye(t))return e===t;if(Ce(e)&&Ce(t))return e.getTime()===t.getTime();const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const r of n){const c=e[r];if(!i.includes(r))return!1;if(r!=="ref"){const o=t[r];if(Ce(c)&&Ce(o)||M(c)&&M(o)||Array.isArray(c)&&Array.isArray(o)?!ge(c,o,s):c!==o)return!1}}return!0}var Rs=(e,t,s,n,i)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[n]:i||!0}}:{},Te=e=>Array.isArray(e)?e:[e],Ct=()=>{let e=[];return{get observers(){return e},next:i=>{for(const r of e)r.next&&r.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(r=>r!==i)}}),unsubscribe:()=>{e=[]}}},Y=e=>M(e)&&!Object.keys(e).length,ct=e=>e.type==="file",ae=e=>typeof e=="function",Ve=e=>{if(!it)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Ht=e=>e.type==="select-multiple",lt=e=>e.type==="radio",Us=e=>lt(e)||je(e),We=e=>Ve(e)&&e.isConnected;function qs(e,t){const s=t.slice(0,-1).length;let n=0;for(;n<s;)e=U(e)?n++:e[t[n++]];return e}function Bs(e){for(const t in e)if(e.hasOwnProperty(t)&&!U(e[t]))return!1;return!0}function O(e,t){const s=Array.isArray(t)?t:Me(t)?[t]:ot(t),n=s.length===1?e:qs(e,s),i=s.length-1,r=s[i];return n&&delete n[r],i!==0&&(M(n)&&Y(n)||Array.isArray(n)&&Bs(n))&&O(e,s.slice(0,-1)),e}var Qt=e=>{for(const t in e)if(ae(e[t]))return!0;return!1};function Pe(e,t={}){const s=Array.isArray(e);if(M(e)||s)for(const n in e)Array.isArray(e[n])||M(e[n])&&!Qt(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Pe(e[n],t[n])):z(e[n])||(t[n]=!0);return t}function Kt(e,t,s){const n=Array.isArray(e);if(M(e)||n)for(const i in e)Array.isArray(e[i])||M(e[i])&&!Qt(e[i])?U(t)||Ye(s[i])?s[i]=Array.isArray(e[i])?Pe(e[i],[]):{...Pe(e[i])}:Kt(e[i],z(t)?{}:t[i],s[i]):s[i]=!ge(e[i],t[i]);return s}var _e=(e,t)=>Kt(e,t,Pe(t));const kt={value:!1,isValid:!1},St={value:!0,isValid:!0};var Wt=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(s=>s&&s.checked&&!s.disabled).map(s=>s.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!U(e[0].attributes.value)?U(e[0].value)||e[0].value===""?St:{value:e[0].value,isValid:!0}:St:kt}return kt},zt=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:n})=>U(e)?e:t?e===""?NaN:e&&+e:s&&le(e)?new Date(e):n?n(e):e;const At={isValid:!1,value:null};var Gt=e=>Array.isArray(e)?e.reduce((t,s)=>s&&s.checked&&!s.disabled?{isValid:!0,value:s.value}:t,At):At;function _t(e){const t=e.ref;return ct(t)?t.files:lt(t)?Gt(e.refs).value:Ht(t)?[...t.selectedOptions].map(({value:s})=>s):je(t)?Wt(e.refs).value:zt(U(t.value)?e.ref.value:t.value,e)}var Hs=(e,t,s,n)=>{const i={};for(const r of e){const c=v(t,r);c&&V(i,r,c._f)}return{criteriaMode:s,names:[...e],fields:i,shouldUseNativeValidation:n}},Ie=e=>e instanceof RegExp,Ne=e=>U(e)?e:Ie(e)?e.source:M(e)?Ie(e.value)?e.value.source:e.value:e,Nt=e=>({isOnSubmit:!e||e===ie.onSubmit,isOnBlur:e===ie.onBlur,isOnChange:e===ie.onChange,isOnAll:e===ie.all,isOnTouch:e===ie.onTouched});const Tt="AsyncFunction";var Qs=e=>!!e&&!!e.validate&&!!(ae(e.validate)&&e.validate.constructor.name===Tt||M(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Tt)),Ks=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),Et=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Ee=(e,t,s,n)=>{for(const i of s||Object.keys(e)){const r=v(e,i);if(r){const{_f:c,...o}=r;if(c){if(c.refs&&c.refs[0]&&t(c.refs[0],i)&&!n)return!0;if(c.ref&&t(c.ref,c.name)&&!n)return!0;if(Ee(o,t))break}else if(M(o)&&Ee(o,t))break}}};function Ft(e,t,s){const n=v(e,s);if(n||Me(s))return{error:n,name:s};const i=s.split(".");for(;i.length;){const r=i.join("."),c=v(t,r),o=v(e,r);if(c&&!Array.isArray(c)&&s!==r)return{name:s};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:s}}var Ws=(e,t,s,n)=>{s(e);const{name:i,...r}=e;return Y(r)||Object.keys(r).length>=Object.keys(t).length||Object.keys(r).find(c=>t[c]===(!n||ie.all))},zs=(e,t,s)=>!e||!t||e===t||Te(e).some(n=>n&&(s?n===t:n.startsWith(t)||t.startsWith(n))),Gs=(e,t,s,n,i)=>i.isOnAll?!1:!s&&i.isOnTouch?!(t||e):(s?n.isOnBlur:i.isOnBlur)?!e:(s?n.isOnChange:i.isOnChange)?e:!0,Js=(e,t)=>!at(v(e,t)).length&&O(e,t),Ys=(e,t,s)=>{const n=Te(v(e,s));return V(n,"root",t[s]),V(e,s,n),e},$e=e=>le(e);function jt(e,t,s="validate"){if($e(e)||Array.isArray(e)&&e.every($e)||ce(e)&&!e)return{type:s,message:$e(e)?e:"",ref:t}}var Se=e=>M(e)&&!Ie(e)?e:{value:e,message:""},Dt=async(e,t,s,n,i,r)=>{const{ref:c,refs:o,required:f,maxLength:g,minLength:b,min:h,max:m,pattern:C,validate:S,name:A,valueAsNumber:Q,mount:he}=e._f,N=v(s,A);if(!he||t.has(A))return{};const W=o?o[0]:c,D=T=>{i&&W.reportValidity&&(W.setCustomValidity(ce(T)?"":T||""),W.reportValidity())},j={},J=lt(c),X=je(c),xe=J||X,q=(Q||ct(c))&&U(c.value)&&U(N)||Ve(c)&&c.value===""||N===""||Array.isArray(N)&&!N.length,re=Rs.bind(null,A,n,j),Z=(T,E,P,B=de.maxLength,K=de.minLength)=>{const L=T?E:P;j[A]={type:T?B:K,message:L,ref:c,...re(T?B:K,L)}};if(r?!Array.isArray(N)||!N.length:f&&(!xe&&(q||z(N))||ce(N)&&!N||X&&!Wt(o).isValid||J&&!Gt(o).isValid)){const{value:T,message:E}=$e(f)?{value:!!f,message:f}:Se(f);if(T&&(j[A]={type:de.required,message:E,ref:W,...re(de.required,E)},!n))return D(E),j}if(!q&&(!z(h)||!z(m))){let T,E;const P=Se(m),B=Se(h);if(!z(N)&&!isNaN(N)){const K=c.valueAsNumber||N&&+N;z(P.value)||(T=K>P.value),z(B.value)||(E=K<B.value)}else{const K=c.valueAsDate||new Date(N),L=we=>new Date(new Date().toDateString()+" "+we),ee=c.type=="time",ne=c.type=="week";le(P.value)&&N&&(T=ee?L(N)>L(P.value):ne?N>P.value:K>new Date(P.value)),le(B.value)&&N&&(E=ee?L(N)<L(B.value):ne?N<B.value:K<new Date(B.value))}if((T||E)&&(Z(!!T,P.message,B.message,de.max,de.min),!n))return D(j[A].message),j}if((g||b)&&!q&&(le(N)||r&&Array.isArray(N))){const T=Se(g),E=Se(b),P=!z(T.value)&&N.length>+T.value,B=!z(E.value)&&N.length<+E.value;if((P||B)&&(Z(P,T.message,E.message),!n))return D(j[A].message),j}if(C&&!q&&le(N)){const{value:T,message:E}=Se(C);if(Ie(T)&&!N.match(T)&&(j[A]={type:de.pattern,message:E,ref:c,...re(de.pattern,E)},!n))return D(E),j}if(S){if(ae(S)){const T=await S(N,s),E=jt(T,W);if(E&&(j[A]={...E,...re(de.validate,E.message)},!n))return D(E.message),j}else if(M(S)){let T={};for(const E in S){if(!Y(T)&&!n)break;const P=jt(await S[E](N,s),W,E);P&&(T={...P,...re(E,P.message)},D(P.message),n&&(j[A]=T))}if(!Y(T)&&(j[A]={ref:W,...T},!n))return j}}return D(!0),j};const Xs={mode:ie.onSubmit,reValidateMode:ie.onChange,shouldFocusError:!0};function Zs(e={}){let t={...Xs,...e},s={submitCount:0,isDirty:!1,isReady:!1,isLoading:ae(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},i=M(t.defaultValues)||M(t.values)?H(t.defaultValues||t.values)||{}:{},r=t.shouldUnregister?{}:H(i),c={action:!1,mount:!1,watch:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},f,g=0;const b={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let h={...b};const m={array:Ct(),state:Ct()},C=t.criteriaMode===ie.all,S=a=>l=>{clearTimeout(g),g=setTimeout(a,l)},A=async a=>{if(!t.disabled&&(b.isValid||h.isValid||a)){const l=t.resolver?Y((await X()).errors):await q(n,!0);l!==s.isValid&&m.state.next({isValid:l})}},Q=(a,l)=>{!t.disabled&&(b.isValidating||b.validatingFields||h.isValidating||h.validatingFields)&&((a||Array.from(o.mount)).forEach(d=>{d&&(l?V(s.validatingFields,d,l):O(s.validatingFields,d))}),m.state.next({validatingFields:s.validatingFields,isValidating:!Y(s.validatingFields)}))},he=(a,l=[],d,w,x=!0,p=!0)=>{if(w&&d&&!t.disabled){if(c.action=!0,p&&Array.isArray(v(n,a))){const k=d(v(n,a),w.argA,w.argB);x&&V(n,a,k)}if(p&&Array.isArray(v(s.errors,a))){const k=d(v(s.errors,a),w.argA,w.argB);x&&V(s.errors,a,k),Js(s.errors,a)}if((b.touchedFields||h.touchedFields)&&p&&Array.isArray(v(s.touchedFields,a))){const k=d(v(s.touchedFields,a),w.argA,w.argB);x&&V(s.touchedFields,a,k)}(b.dirtyFields||h.dirtyFields)&&(s.dirtyFields=_e(i,r)),m.state.next({name:a,isDirty:Z(a,l),dirtyFields:s.dirtyFields,errors:s.errors,isValid:s.isValid})}else V(r,a,l)},N=(a,l)=>{V(s.errors,a,l),m.state.next({errors:s.errors})},W=a=>{s.errors=a,m.state.next({errors:s.errors,isValid:!1})},D=(a,l,d,w)=>{const x=v(n,a);if(x){const p=v(r,a,U(d)?v(i,a):d);U(p)||w&&w.defaultChecked||l?V(r,a,l?p:_t(x._f)):P(a,p),c.mount&&A()}},j=(a,l,d,w,x)=>{let p=!1,k=!1;const F={name:a};if(!t.disabled){if(!d||w){(b.isDirty||h.isDirty)&&(k=s.isDirty,s.isDirty=F.isDirty=Z(),p=k!==F.isDirty);const $=ge(v(i,a),l);k=!!v(s.dirtyFields,a),$?O(s.dirtyFields,a):V(s.dirtyFields,a,!0),F.dirtyFields=s.dirtyFields,p=p||(b.dirtyFields||h.dirtyFields)&&k!==!$}if(d){const $=v(s.touchedFields,a);$||(V(s.touchedFields,a,d),F.touchedFields=s.touchedFields,p=p||(b.touchedFields||h.touchedFields)&&$!==d)}p&&x&&m.state.next(F)}return p?F:{}},J=(a,l,d,w)=>{const x=v(s.errors,a),p=(b.isValid||h.isValid)&&ce(l)&&s.isValid!==l;if(t.delayError&&d?(f=S(()=>N(a,d)),f(t.delayError)):(clearTimeout(g),f=null,d?V(s.errors,a,d):O(s.errors,a)),(d?!ge(x,d):x)||!Y(w)||p){const k={...w,...p&&ce(l)?{isValid:l}:{},errors:s.errors,name:a};s={...s,...k},m.state.next(k)}},X=async a=>{Q(a,!0);const l=await t.resolver(r,t.context,Hs(a||o.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return Q(a),l},xe=async a=>{const{errors:l}=await X(a);if(a)for(const d of a){const w=v(l,d);w?V(s.errors,d,w):O(s.errors,d)}else s.errors=l;return l},q=async(a,l,d={valid:!0})=>{for(const w in a){const x=a[w];if(x){const{_f:p,...k}=x;if(p){const F=o.array.has(p.name),$=x._f&&Qs(x._f);$&&b.validatingFields&&Q([w],!0);const te=await Dt(x,o.disabled,r,C,t.shouldUseNativeValidation&&!l,F);if($&&b.validatingFields&&Q([w]),te[p.name]&&(d.valid=!1,l))break;!l&&(v(te,p.name)?F?Ys(s.errors,te,p.name):V(s.errors,p.name,te[p.name]):O(s.errors,p.name))}!Y(k)&&await q(k,l,d)}}return d.valid},re=()=>{for(const a of o.unMount){const l=v(n,a);l&&(l._f.refs?l._f.refs.every(d=>!We(d)):!We(l._f.ref))&&Ue(a)}o.unMount=new Set},Z=(a,l)=>!t.disabled&&(a&&l&&V(r,a,l),!ge(we(),i)),T=(a,l,d)=>Os(a,o,{...c.mount?r:U(l)?i:le(a)?{[a]:l}:l},d,l),E=a=>at(v(c.mount?r:i,a,t.shouldUnregister?v(i,a,[]):[])),P=(a,l,d={})=>{const w=v(n,a);let x=l;if(w){const p=w._f;p&&(!p.disabled&&V(r,a,zt(l,p)),x=Ve(p.ref)&&z(l)?"":l,Ht(p.ref)?[...p.ref.options].forEach(k=>k.selected=x.includes(k.value)):p.refs?je(p.ref)?p.refs.forEach(k=>{(!k.defaultChecked||!k.disabled)&&(Array.isArray(x)?k.checked=!!x.find(F=>F===k.value):k.checked=x===k.value||!!x)}):p.refs.forEach(k=>k.checked=k.value===x):ct(p.ref)?p.ref.value="":(p.ref.value=x,p.ref.type||m.state.next({name:a,values:H(r)})))}(d.shouldDirty||d.shouldTouch)&&j(a,x,d.shouldTouch,d.shouldDirty,!0),d.shouldValidate&&ne(a)},B=(a,l,d)=>{for(const w in l){if(!l.hasOwnProperty(w))return;const x=l[w],p=a+"."+w,k=v(n,p);(o.array.has(a)||M(x)||k&&!k._f)&&!Ce(x)?B(p,x,d):P(p,x,d)}},K=(a,l,d={})=>{const w=v(n,a),x=o.array.has(a),p=H(l);V(r,a,p),x?(m.array.next({name:a,values:H(r)}),(b.isDirty||b.dirtyFields||h.isDirty||h.dirtyFields)&&d.shouldDirty&&m.state.next({name:a,dirtyFields:_e(i,r),isDirty:Z(a,p)})):w&&!w._f&&!z(p)?B(a,p,d):P(a,p,d),Et(a,o)&&m.state.next({...s,name:a}),m.state.next({name:c.mount?a:void 0,values:H(r)})},L=async a=>{c.mount=!0;const l=a.target;let d=l.name,w=!0;const x=v(n,d),p=$=>{w=Number.isNaN($)||Ce($)&&isNaN($.getTime())||ge($,v(r,d,$))},k=Nt(t.mode),F=Nt(t.reValidateMode);if(x){let $,te;const Le=l.type?_t(x._f):Ds(a),ye=a.type===vt.BLUR||a.type===vt.FOCUS_OUT,hs=!Ks(x._f)&&!t.resolver&&!v(s.errors,d)&&!x._f.deps||Gs(ye,v(s.touchedFields,d),s.isSubmitted,F,k),He=Et(d,o,ye);V(r,d,Le),ye?(x._f.onBlur&&x._f.onBlur(a),f&&f(0)):x._f.onChange&&x._f.onChange(a);const Qe=j(d,Le,ye),ys=!Y(Qe)||He;if(!ye&&m.state.next({name:d,type:a.type,values:H(r)}),hs)return(b.isValid||h.isValid)&&(t.mode==="onBlur"?ye&&A():ye||A()),ys&&m.state.next({name:d,...He?{}:Qe});if(!ye&&He&&m.state.next({...s}),t.resolver){const{errors:pt}=await X([d]);if(p(Le),w){const gs=Ft(s.errors,n,d),xt=Ft(pt,n,gs.name||d);$=xt.error,d=xt.name,te=Y(pt)}}else Q([d],!0),$=(await Dt(x,o.disabled,r,C,t.shouldUseNativeValidation))[d],Q([d]),p(Le),w&&($?te=!1:(b.isValid||h.isValid)&&(te=await q(n,!0)));w&&(x._f.deps&&ne(x._f.deps),J(d,te,$,Qe))}},ee=(a,l)=>{if(v(s.errors,l)&&a.focus)return a.focus(),1},ne=async(a,l={})=>{let d,w;const x=Te(a);if(t.resolver){const p=await xe(U(a)?a:x);d=Y(p),w=a?!x.some(k=>v(p,k)):d}else a?(w=(await Promise.all(x.map(async p=>{const k=v(n,p);return await q(k&&k._f?{[p]:k}:k)}))).every(Boolean),!(!w&&!s.isValid)&&A()):w=d=await q(n);return m.state.next({...!le(a)||(b.isValid||h.isValid)&&d!==s.isValid?{}:{name:a},...t.resolver||!a?{isValid:d}:{},errors:s.errors}),l.shouldFocus&&!w&&Ee(n,ee,a?x:o.mount),w},we=a=>{const l={...c.mount?r:i};return U(a)?l:le(a)?v(l,a):a.map(d=>v(l,d))},De=(a,l)=>({invalid:!!v((l||s).errors,a),isDirty:!!v((l||s).dirtyFields,a),error:v((l||s).errors,a),isValidating:!!v(s.validatingFields,a),isTouched:!!v((l||s).touchedFields,a)}),ve=a=>{a&&Te(a).forEach(l=>O(s.errors,l)),m.state.next({errors:a?s.errors:{}})},dt=(a,l,d)=>{const w=(v(n,a,{_f:{}})._f||{}).ref,x=v(s.errors,a)||{},{ref:p,message:k,type:F,...$}=x;V(s.errors,a,{...$,...l,ref:w}),m.state.next({name:a,errors:s.errors,isValid:!1}),d&&d.shouldFocus&&w&&w.focus&&w.focus()},cs=(a,l)=>ae(a)?m.state.subscribe({next:d=>"values"in d&&a(T(void 0,l),d)}):T(a,l,!0),ft=a=>m.state.subscribe({next:l=>{zs(a.name,l.name,a.exact)&&Ws(l,a.formState||b,ms,a.reRenderRoot)&&a.callback({values:{...r},...s,...l,defaultValues:i})}}).unsubscribe,ls=a=>(c.mount=!0,h={...h,...a.formState},ft({...a,formState:h})),Ue=(a,l={})=>{for(const d of a?Te(a):o.mount)o.mount.delete(d),o.array.delete(d),l.keepValue||(O(n,d),O(r,d)),!l.keepError&&O(s.errors,d),!l.keepDirty&&O(s.dirtyFields,d),!l.keepTouched&&O(s.touchedFields,d),!l.keepIsValidating&&O(s.validatingFields,d),!t.shouldUnregister&&!l.keepDefaultValue&&O(i,d);m.state.next({values:H(r)}),m.state.next({...s,...l.keepDirty?{isDirty:Z()}:{}}),!l.keepIsValid&&A()},mt=({disabled:a,name:l})=>{(ce(a)&&c.mount||a||o.disabled.has(l))&&(a?o.disabled.add(l):o.disabled.delete(l))},qe=(a,l={})=>{let d=v(n,a);const w=ce(l.disabled)||ce(t.disabled);return V(n,a,{...d||{},_f:{...d&&d._f?d._f:{ref:{name:a}},name:a,mount:!0,...l}}),o.mount.add(a),d?mt({disabled:ce(l.disabled)?l.disabled:t.disabled,name:a}):D(a,!0,l.value),{...w?{disabled:l.disabled||t.disabled}:{},...t.progressive?{required:!!l.required,min:Ne(l.min),max:Ne(l.max),minLength:Ne(l.minLength),maxLength:Ne(l.maxLength),pattern:Ne(l.pattern)}:{},name:a,onChange:L,onBlur:L,ref:x=>{if(x){qe(a,l),d=v(n,a);const p=U(x.value)&&x.querySelectorAll&&x.querySelectorAll("input,select,textarea")[0]||x,k=Us(p),F=d._f.refs||[];if(k?F.find($=>$===p):p===d._f.ref)return;V(n,a,{_f:{...d._f,...k?{refs:[...F.filter(We),p,...Array.isArray(v(i,a))?[{}]:[]],ref:{type:p.type,name:a}}:{ref:p}}}),D(a,!1,void 0,p)}else d=v(n,a,{}),d._f&&(d._f.mount=!1),(t.shouldUnregister||l.shouldUnregister)&&!($s(o.array,a)&&c.action)&&o.unMount.add(a)}}},Be=()=>t.shouldFocusError&&Ee(n,ee,o.mount),us=a=>{ce(a)&&(m.state.next({disabled:a}),Ee(n,(l,d)=>{const w=v(n,d);w&&(l.disabled=w._f.disabled||a,Array.isArray(w._f.refs)&&w._f.refs.forEach(x=>{x.disabled=w._f.disabled||a}))},0,!1))},ht=(a,l)=>async d=>{let w;d&&(d.preventDefault&&d.preventDefault(),d.persist&&d.persist());let x=H(r);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:p,values:k}=await X();s.errors=p,x=H(k)}else await q(n);if(o.disabled.size)for(const p of o.disabled)O(x,p);if(O(s.errors,"root"),Y(s.errors)){m.state.next({errors:{}});try{await a(x,d)}catch(p){w=p}}else l&&await l({...s.errors},d),Be(),setTimeout(Be);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Y(s.errors)&&!w,submitCount:s.submitCount+1,errors:s.errors}),w)throw w},ds=(a,l={})=>{v(n,a)&&(U(l.defaultValue)?K(a,H(v(i,a))):(K(a,l.defaultValue),V(i,a,H(l.defaultValue))),l.keepTouched||O(s.touchedFields,a),l.keepDirty||(O(s.dirtyFields,a),s.isDirty=l.defaultValue?Z(a,H(v(i,a))):Z()),l.keepError||(O(s.errors,a),b.isValid&&A()),m.state.next({...s}))},yt=(a,l={})=>{const d=a?H(a):i,w=H(d),x=Y(a),p=x?i:w;if(l.keepDefaultValues||(i=d),!l.keepValues){if(l.keepDirtyValues){const k=new Set([...o.mount,...Object.keys(_e(i,r))]);for(const F of Array.from(k))v(s.dirtyFields,F)?V(p,F,v(r,F)):K(F,v(p,F))}else{if(it&&U(a))for(const k of o.mount){const F=v(n,k);if(F&&F._f){const $=Array.isArray(F._f.refs)?F._f.refs[0]:F._f.ref;if(Ve($)){const te=$.closest("form");if(te){te.reset();break}}}}if(l.keepFieldsRef)for(const k of o.mount)K(k,v(p,k));else n={}}r=t.shouldUnregister?l.keepDefaultValues?H(i):{}:H(p),m.array.next({values:{...p}}),m.state.next({values:{...p}})}o={mount:l.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},c.mount=!b.isValid||!!l.keepIsValid||!!l.keepDirtyValues,c.watch=!!t.shouldUnregister,m.state.next({submitCount:l.keepSubmitCount?s.submitCount:0,isDirty:x?!1:l.keepDirty?s.isDirty:!!(l.keepDefaultValues&&!ge(a,i)),isSubmitted:l.keepIsSubmitted?s.isSubmitted:!1,dirtyFields:x?{}:l.keepDirtyValues?l.keepDefaultValues&&r?_e(i,r):s.dirtyFields:l.keepDefaultValues&&a?_e(i,a):l.keepDirty?s.dirtyFields:{},touchedFields:l.keepTouched?s.touchedFields:{},errors:l.keepErrors?s.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?s.isSubmitSuccessful:!1,isSubmitting:!1})},gt=(a,l)=>yt(ae(a)?a(r):a,l),fs=(a,l={})=>{const d=v(n,a),w=d&&d._f;if(w){const x=w.refs?w.refs[0]:w.ref;x.focus&&(x.focus(),l.shouldSelect&&ae(x.select)&&x.select())}},ms=a=>{s={...s,...a}},bt={control:{register:qe,unregister:Ue,getFieldState:De,handleSubmit:ht,setError:dt,_subscribe:ft,_runSchema:X,_focusError:Be,_getWatch:T,_getDirty:Z,_setValid:A,_setFieldArray:he,_setDisabledField:mt,_setErrors:W,_getFieldArray:E,_reset:yt,_resetDefaultValues:()=>ae(t.defaultValues)&&t.defaultValues().then(a=>{gt(a,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:us,_subjects:m,_proxyFormState:b,get _fields(){return n},get _formValues(){return r},get _state(){return c},set _state(a){c=a},get _defaultValues(){return i},get _names(){return o},set _names(a){o=a},get _formState(){return s},get _options(){return t},set _options(a){t={...t,...a}}},subscribe:ls,trigger:ne,register:qe,handleSubmit:ht,watch:cs,setValue:K,getValues:we,reset:gt,resetField:ds,clearErrors:ve,unregister:Ue,setError:dt,setFocus:fs,getFieldState:De};return{...bt,formControl:bt}}function Jt(e={}){const t=y.useRef(void 0),s=y.useRef(void 0),[n,i]=y.useState({isDirty:!1,isValidating:!1,isLoading:ae(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:ae(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!ae(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:c,...o}=Zs(e);t.current={...o,formState:n}}const r=t.current.control;return r._options=e,Ms(()=>{const c=r._subscribe({formState:r._proxyFormState,callback:()=>i({...r._formState}),reRenderRoot:!0});return i(o=>({...o,isReady:!0})),r._formState.isReady=!0,c},[r]),y.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),y.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),y.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),y.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),y.useEffect(()=>{if(r._proxyFormState.isDirty){const c=r._getDirty();c!==n.isDirty&&r._subjects.state.next({isDirty:c})}},[r,n.isDirty]),y.useEffect(()=>{e.values&&!ge(e.values,s.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),s.current=e.values,i(c=>({...c}))):r._resetDefaultValues()},[r,e.values]),y.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),t.current.formState=Is(n,r),t.current}const Yt=e=>{const{t}=_.useTranslation(),{showStackNotifications:s,showSuccessNotification:n}=pe(),{defaultValues:i,mutationFn:r,formToDto:c,onError:o,onSuccess:f,queryKey:g,onSuccessMessage:b}=e,{control:h,handleSubmit:m,reset:C,setError:S,getValues:A,setValue:Q}=Jt({defaultValues:i}),he=y.useCallback(D=>{const j=D==null?void 0:D.errors,J=[];return j&&j.forEach(([X,xe])=>{const q=document.querySelector(`[name="${X}"]`);(q instanceof HTMLInputElement||q instanceof HTMLTextAreaElement||q instanceof HTMLSelectElement)&&(q.focus(),q.classList.add("error"),J.push(t(`_entities:${g}.${X}.${xe}`)))}),J},[t,g]),N=y.useCallback(()=>{document.querySelectorAll("input, textarea, select").forEach(j=>{j.classList.remove("error")})},[]),W=ke.useMutation({mutationFn:r,onError:D=>{if(console.error(D),D.errors){const j=he(D);s(j.map(J=>({message:J,type:R.error})))}o&&o(D)},onSuccess:async D=>{be&&await be.invalidateQueries({queryKey:g}),f&&f(D),b&&n({message:b})}});return{control:h,getValues:A,setValue:Q,handleSubmit:m,onSubmit:D=>W.mutate(c?c(D):D),reset:C,setError:S,parseFormError:he,releaseFormError:N,isLoading:W.isPending}},Xt=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1}=e;return{action:y.useCallback(c=>({id:me.Delete,hidden:c.deleted||n,disabled:c.deleted||i,icon:u.jsx(se.FontAwesomeIcon,{className:"text-red-500",icon:I.faTrash}),tooltip:t("_pages:common.actions.delete.text"),onClick:()=>s([c==null?void 0:c.id])}),[i,n,s,t])}},Zt=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1}=e;return{action:y.useCallback(r=>({id:me.Restore,hidden:!r.deleted||n,disabled:!r.deleted,icon:u.jsx(se.FontAwesomeIcon,{className:"text-red-500",icon:I.faRotateLeft}),tooltip:t("_pages:common.actions.restore.text"),onClick:()=>s([r==null?void 0:r.id])}),[n,s,t])}},er=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1}=e;return{action:y.useCallback(r=>({id:me.Edit,hidden:r.deleted||n,disabled:r.deleted,icon:u.jsx(se.FontAwesomeIcon,{className:"primary",icon:I.faPencil}),tooltip:t("_pages:common.actions.edit.text"),onClick:()=>s(r==null?void 0:r.id)}),[n,s,t])}};var me=(e=>(e.Add="add",e.Edit="edit",e.Delete="delete",e.Restore="restore",e.Refresh="refresh",e.Export="export",e.Import="import",e))(me||{});const es=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1,isLoading:r=!1}=e;return{action:y.useCallback(()=>({id:me.Export,hidden:n,disabled:i,icon:u.jsx(se.FontAwesomeIcon,{className:`${r?"rotate":""}`,icon:r?I.faCircleNotch:I.faCloudArrowDown}),tooltip:t("_pages:common.actions.export.text"),onClick:s}),[i,n,r,s,t])}},ts=e=>{const{t}=_.useTranslation(),{onClick:s,hidden:n=!1,disabled:i=!1,isLoading:r=!1}=e;return{action:y.useCallback(()=>({id:me.Import,hidden:n,disabled:i,icon:u.jsx(se.FontAwesomeIcon,{className:`${r?"rotate":""}`,icon:r?I.faCircleNotch:I.faCloudUpload}),tooltip:t("_pages:common.actions.import.text"),onClick:s}),[i,n,r,s,t])}},tr=e=>{const{queryKey:t,onSuccess:s,...n}=e,{showStackNotifications:i}=pe(),{t:r}=_.useTranslation(),{open:c,onClick:o,close:f,dialogFn:g,isLoading:b}=nt({onSuccessMessage:r("_pages:common.actions.delete.successMessage"),onError:m=>{m.errors&&i(m.errors.map(([C,S])=>({message:r(`_pages:${C}.errors.${S}`),type:R.error})))},onSuccess:async m=>{await be.invalidateQueries({queryKey:t}),s&&s(m)},...n}),{action:h}=Xt({onClick:o});return{onClick:o,title:r("_pages:common.actions.delete.dialog.title"),open:c,isLoading:b,handleSubmit:()=>g.mutate(),handleClose:f,action:h}},ut=()=>{const[e,t]=y.useState(!1);return{open:e,setOpen:t,handleClose:()=>t(!1),handleOpen:()=>t(!0)}},sr=e=>{const{t}=_.useTranslation(),{showErrorNotification:s,showStackNotifications:n,showSuccessNotification:i}=pe(),{defaultValues:r,getFunction:c,mutationFn:o,formToDto:f,dtoToForm:g,onError:b,onSuccess:h,queryKey:m,onSuccessMessage:C,title:S}=e,[A,Q]=y.useState(0),{open:he,handleClose:N,handleOpen:W}=ut(),{control:D,handleSubmit:j,reset:J,setError:X,getValues:xe,setValue:q}=Jt({defaultValues:r}),{data:re,isLoading:Z}=ke.useQuery({queryFn:()=>c==null?void 0:c(A),queryKey:[...m,A],enabled:!!c&&!!m&&!!A});y.useEffect(()=>{re&&g&&J({...g(re)})},[re]);const T=y.useCallback(L=>{const ee=L==null?void 0:L.errors,ne=[];return ee&&ee.forEach(([we,De])=>{const ve=document.querySelector(`[name="${we}"]`);(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLSelectElement)&&(ve.focus(),ve.classList.add("error"),ne.push(t(`_entities:${m}.${we}.${De}`)))}),ne},[t,m]),E=y.useCallback(()=>{document.querySelectorAll("input, textarea, select").forEach(ee=>{ee.classList.remove("error")})},[]),P=y.useCallback(L=>{Q(L??0),W()},[W]),B=y.useCallback(()=>{E(),N(),J()},[J,E,N]),K=ke.useMutation({mutationFn:o,onError:L=>{if(console.error(L),L.errors){const ee=T(L);n(ee.map(ne=>({message:ne,type:R.error})))}else b?b(L):s({message:t("_accessibility:errors.500")})},onSuccess:async L=>{await be.invalidateQueries({queryKey:m}),h&&h(L),i({message:C}),B()}});return{open:he,openDialog:P,handleClose:B,control:D,getValues:xe,setValue:q,handleSubmit:j,onSubmit:L=>K.mutate(f(L)),reset:J,setError:X,parseFormError:T,releaseFormError:E,title:S,isLoading:Z||K.isPending}},rr=e=>{const{queryKey:t,onSuccess:s,...n}=e,{showStackNotifications:i}=pe(),{t:r}=_.useTranslation(),{open:c,onClick:o,close:f,dialogFn:g,isLoading:b}=nt({onSuccessMessage:r("_pages:common.actions.restore.successMessage"),onError:m=>{m.errors&&i(m.errors.map(([C,S])=>({message:r(`_pages:${C}.errors.${S}`),type:R.error})))},onSuccess:async m=>{await be.invalidateQueries({queryKey:t}),s&&s(m)},...n}),{action:h}=Zt({onClick:o});return{onClick:o,title:r("_pages:common.actions.restore.dialog.title"),open:c,isLoading:b,handleSubmit:()=>g.mutate(),handleClose:f,action:h}};function nr(e){const{t}=_.useTranslation(),{queryKey:s,mutationFn:n,entity:i}=e,[r,c]=y.useState(!1),o=Yt({mutationFn:n,onSuccessMessage:t("_pages:common.actions.import.successMessage"),queryKey:s}),{action:f}=ts({onClick:()=>c(!0)});return{...o,open:r,title:t("_pages:common.actions.import.dialog.title",{entity:t(`_pages:${i}.title`)}),handleClose:()=>c(!1),action:f}}const ir=e=>{const{showSuccessNotification:t}=pe(),{t:s}=_.useTranslation(),{entity:n,mutationFn:i,onError:r,onSuccess:c,onSuccessMessage:o=s("_pages:common.actions.export.successMessage")}=e,f=ke.useMutation({mutationFn:()=>i(),onError:h=>{console.error(h),r&&r(h)},onSuccess:async h=>{const m=JSON.stringify(h,null,2),C=new Blob([m],{type:"application/json"}),S=URL.createObjectURL(C),A=document.createElement("a");A.href=S,A.download=`${n}.json`,A.click(),URL.revokeObjectURL(S),c&&c(h),t({message:o})}}),g=y.useCallback(()=>{f.mutate()},[f]),{action:b}=es({onClick:g,isLoading:f.isPending});return{action:b}};function ss(e){const[t,s]=y.useState(!1),n=y.useCallback(()=>{const i=window.scrollY>e;s(i)},[e]);return y.useEffect(()=>(window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}),[n]),t}const ar=()=>{const{t:e}=_.useTranslation(),t=ss(200);return u.jsx(ue,{icon:I.faArrowUp,onClick:()=>Cs.scrollTo(0,0),"data-tooltip-id":"tooltip","data-tooltip-content":e("_accessibility:buttons.toTop"),className:`submit primary to-top ${t?"show":"hide"}`})},rs=e=>{const{actions:t=[],className:s=""}=e,{t:n}=_.useTranslation(),[i,r]=y.useState(!1);return u.jsxs("div",{className:`actions-dropdown ${s}`,children:[u.jsx(ue,{icon:I.faEllipsisV,onClick:()=>r(!0),"data-tooltip-id":"tooltip","data-tooltip-content":n("_accessibility:buttons.openActions")}),u.jsx($t,{open:i,onClose:()=>r(!1),children:u.jsx(Ze,{showActionTexts:!0,actions:t,className:"flex-col",showTooltips:!1})})]})},or=y.forwardRef(function(e,t){const{value:s,onChange:n,state:i=_.State.default,name:r="",id:c="",label:o="",disabled:f=!1,required:g=!1,containerClassName:b="",inputClassName:h="",labelClassName:m="",helperText:C="",helperTextClassName:S="",...A}=e;return u.jsxs("div",{className:`relative z-0 w-full mb-5 group ${b}`,children:[u.jsx("textarea",{ref:t,name:r,id:c,className:`text-input text-area ${_.inputStateClassName(i)} ${h} peer`,required:g,value:s,onChange:n,disabled:f,...A}),u.jsxs("label",{htmlFor:r,className:`text-input-label ${_.labelStateClassName(i)} ${m}`,children:[o,g?" *":""]}),!!C&&u.jsx("p",{className:`text-input-helper-text ${_.helperTextStateClassName(i)} ${S}`,children:C})]})}),cr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,onSubmit:i,isLoading:r=!1,buttonEnd:c=!0,reset:o}=e;return u.jsxs("form",{className:"form-container",onSubmit:n(i),children:[s,u.jsxs("div",{className:`flex gap-2 mt-5 ${c?"justify-end":""}`,children:[u.jsxs(fe,{type:"submit",color:"primary",variant:"submit",disabled:r,name:t("_accessibility:buttons.submit"),"aria-label":t("_accessibility:ariaLabels.submit"),children:[r?u.jsx(_.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,t("_accessibility:buttons.submit")]}),u.jsx(fe,{type:"button",variant:"outlined",onClick:()=>o==null?void 0:o(),name:t("_accessibility:buttons.cancel"),"aria-label":t("_accessibility:ariaLabels.cancel"),children:t("_accessibility:buttons.cancel")})]})]})},lr=y.forwardRef(function(e,t){const[s,n]=y.useState(!1);return u.jsx(_.TextInput,{...e,type:s?"text":"password",ref:t,children:u.jsx(ue,{type:"button",tabIndex:-1,className:"absolute right-2 password-icon",onClick:()=>n(!s),icon:s?I.faEyeSlash:I.faEye})})}),Oe=e=>{const{t}=_.useTranslation(),{title:s,children:n,handleClose:i,open:r=!1,containerClassName:c="",className:o="",animationClass:f="appear"}=e,[g,b]=y.useState(window.innerWidth),h=y.useCallback(A=>{A.key==="Escape"&&r&&i()},[r,i]);y.useEffect(()=>(window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}),[h]);const m=y.useCallback(()=>{b(window.innerWidth)},[]);y.useEffect(()=>(window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}),[m]);const C=y.useMemo(()=>xs.css({width:`${g}px`}),[g]),S=y.useCallback(A=>{var Q;((Q=A==null?void 0:A.currentTarget)==null?void 0:Q.getAttribute("name"))===t("_accessibility:buttons.closeDialog")&&i()},[t,i]);return y.useEffect(()=>{const A=Q=>{Q?document.body.style.overflow="hidden":document.body.style.overflow="auto"};return A(r),()=>{A(r)}},[r]),Lt.createPortal(u.jsx("div",{"aria-label":t("_accessibility:ariaLabels.closeDialog"),"aria-disabled":!r,onClick:S,className:`dialog-backdrop animated ${r?`opened ${f}`:"closed"} ${C} h-screen ${r?"bg-base/20 backdrop-blur-xl":"pointer-events-none"} ${c}`,children:u.jsxs("div",{className:`dialog elevated animated ${r?`opened ${f}`:"closed"} ${o}`,children:[u.jsxs("div",{className:"dialog-header",children:[u.jsx("h3",{className:"text-text text-xl",children:s}),u.jsx(ue,{icon:I.faClose,disabled:!r,"aria-disabled":!r,onClick:i,className:"icon-button text-red-400",name:t("_accessibility:buttons.closeDialog"),"aria-label":t("_accessibility:ariaLabels.closeDialog")})]}),n]})}),document.body)},Re=e=>{const{primaryText:t,cancelText:s,onPrimaryClick:n,onCancel:i,isLoading:r=!1,disabled:c=!1,primaryType:o="button",containerClassName:f="",primaryClassName:g="",alignEnd:b=!1,primaryName:h,primaryAriaLabel:m,cancelName:C,cancelAriaLabel:S}=e;return u.jsxs("div",{className:`flex gap-2 mt-2 ${b?"justify-end":""} ${f}`,children:[u.jsxs(fe,{type:o,color:"primary",variant:"submit",className:g,disabled:c,onClick:o==="button"?n:void 0,name:h,"aria-label":m,children:[r?u.jsx(_.Loading,{color:"stroke-base",loaderClass:"!w-6 mt-1",strokeWidth:"6"}):null,t]}),u.jsx(fe,{type:"button",variant:"outlined",disabled:c,onClick:i,name:C,"aria-label":S,children:s})]})},ur=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,onSubmit:i,handleClose:r,isLoading:c=!1,buttonEnd:o=!0,...f}=e;return u.jsx(Oe,{...f,handleClose:r,children:u.jsxs("form",{onSubmit:n(i),children:[u.jsx("div",{className:"form-container",children:s}),u.jsx(Re,{primaryType:"submit",primaryText:t("_accessibility:buttons.submit"),cancelText:t("_accessibility:buttons.cancel"),onCancel:r,isLoading:c,disabled:c,primaryClassName:"!px-6",alignEnd:o,primaryName:t("_accessibility:buttons.submit"),primaryAriaLabel:t("_accessibility:ariaLabels.submit"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})})},dr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,handleClose:i,isLoading:r=!1,...c}=e;return u.jsxs(Oe,{...c,handleClose:i,children:[s,u.jsx(Re,{primaryText:t("_accessibility:buttons.ok"),cancelText:t("_accessibility:buttons.cancel"),onPrimaryClick:n,onCancel:i,isLoading:r,disabled:r,primaryType:"button",containerClassName:"mt-5",primaryName:t("_accessibility:buttons.ok"),primaryAriaLabel:t("_accessibility:ariaLabels.ok"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})},fr=e=>{const{t}=_.useTranslation(),{children:s,handleSubmit:n,handleClose:i,isLoading:r=!1,...c}=e;return u.jsxs(Oe,{...c,handleClose:i,children:[s,u.jsx(Re,{primaryText:t("_accessibility:buttons.ok"),cancelText:t("_accessibility:buttons.cancel"),onPrimaryClick:n,onCancel:i,isLoading:r,disabled:r,primaryType:"button",containerClassName:"mt-5",primaryName:t("_accessibility:buttons.ok"),primaryAriaLabel:t("_accessibility:ariaLabels.ok"),cancelName:t("_accessibility:buttons.cancel"),cancelAriaLabel:t("_accessibility:ariaLabels.cancel")})]})};function mr(e){const{t}=_.useTranslation(),{open:s,onClose:n,menuMap:i,logo:r}=e,{account:c}=rt(),{linkComponent:o}=Fe(),f=o,g=y.useMemo(()=>i.filter(h=>{const m=h.auth,C=!!(c!=null&&c.email);return m==null||m&&C||!m&&!C}),[c]),b=y.useCallback(h=>{h.key==="Escape"&&s&&n()},[n,s]);return y.useEffect(()=>(document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}),[b]),u.jsx("div",{"aria-label":t("_accessibility:ariaLabels.closeMenu"),"aria-disabled":!s,className:`${s?"opened":"closed"} drawer-backdrop`,onClick:()=>n(),children:u.jsxs("aside",{className:`${s?"opened":"closed"} bg-base drawer animated`,children:[u.jsxs("div",{className:"flex gap-2 items-center justify-start px-5 pb-5",children:[r,u.jsx("h2",{className:"text-xl text-text font-bold poppins",children:t("_pages:home.appName")})]}),u.jsx("ul",{className:"flex flex-col",children:g.map((h,m)=>u.jsx("li",{className:`w-full flex hover:bg-base-light ${h.path===location.pathname?"bg-base-light":""} animated`,children:h.type!=="divider"&&f?u.jsxs(f,{"aria-disabled":!s,to:h.path??`/${h.path}`,"aria-label":t(`_accessibility:ariaLabels.${h.path}`),className:"text-lg text-text-muted w-full py-2 px-5 flex items-center justify-start gap-2",children:[h.icon,t(`_pages:${h.page}.title`)]}):u.jsx("hr",{className:"border-border border-spacing-x-0.5 w-full"})},`${h.page??m}`))})]})})}function hr(e){const{error:t}=e,{t:s}=_.useTranslation();return u.jsxs("div",{className:"flex flex-col items-center justify-center pt-10 gap-5",children:[u.jsx(se.FontAwesomeIcon,{icon:ws.faSadTear,className:"text-red-300 text-4xl"}),u.jsx("p",{className:"text-text text-center",children:(t==null?void 0:t.message)??s("_accessibility:errors.unknownError")})]})}const yr=e=>{const{showBackButton:t,title:s,actions:n}=e,{t:i}=_.useTranslation(),{navigate:r}=Fe();return u.jsxs("div",{className:"page-header",children:[u.jsxs("div",{className:"flex gap-2 items-center justify-start",children:[t&&u.jsx(ue,{icon:I.faArrowLeft,onClick:()=>r(-1),name:i("_accessibility:buttons.back"),"data-tooltip-id":"tooltip","data-tooltip-content":i("_accessibility:buttons.back")}),u.jsx("h2",{className:"text-3xl font-bold",children:s})]}),u.jsxs("div",{children:[u.jsx(Ze,{className:"max-xs:!hidden",actions:n??[]}),u.jsx(rs,{className:"min-xs:hidden",actions:n??[]})]})]})},gr=e=>{const{title:t,children:s,addOptions:n,filterOptions:i,actions:r,queryKey:c,isLoading:o=!1,isAnimated:f=!0,showBackButton:g=!1}=e,{t:b}=_.useTranslation(),{countOfFilters:h}=_.useTableOptions(),m=y.useMemo(()=>{const C=Array.isArray(r)?[...r]:[];if(c){const S={id:me.Refresh,onClick:()=>be.invalidateQueries({queryKey:c}),icon:u.jsx(se.FontAwesomeIcon,{icon:I.faRotateLeft}),tooltip:b("_pages:common.actions.refresh.text")};C.unshift(S)}if(n){const S={...n,id:me.Add,icon:u.jsx(se.FontAwesomeIcon,{icon:I.faAdd})};C.unshift(S)}if(i){const S={...i,id:"filter",icon:u.jsx(se.FontAwesomeIcon,{icon:I.faFilter}),children:u.jsx(_.Badge,{className:`${h>0?"show":"hide"} `,count:h})};C.push(S)}return C},[r,n,h,i,c,b]);return u.jsxs("main",{className:"",children:[u.jsxs("div",{className:"flex flex-col",children:[u.jsx(yr,{showBackButton:g,actions:m,title:t}),u.jsx("div",{className:`px-5 py-3 h-useConfigfull ${f?"appear":""}`,children:o?u.jsx(_.Loading,{className:"flex justify-center items-center h-50"}):s})]}),u.jsx(ue,{icon:I.faAdd,color:"primary",variant:"submit",onClick:()=>{var C;return(C=n==null?void 0:n.onClick)==null?void 0:C.call(n)},className:"button fab min-xs:!hidden"})]})},br=e=>{const{t}=_.useTranslation(),{loading:s=!1,emptyComponent:n=null,emptyMessage:i=t("_accessibility:messages.empty"),renderComponent:r,data:c=[]}=e;return u.jsx(u.Fragment,{children:c!=null&&c.length?u.jsx("ul",{className:"pretty-grid-main",children:c==null?void 0:c.map(o=>u.jsx("li",{className:"pretty-grid-item",children:r(o)},o.id))}):u.jsx(u.Fragment,{children:n||u.jsx(os,{message:i})})})},pr=()=>{const[e,t]=y.useState(Je());return y.useEffect(()=>{const s=setInterval(()=>{t(Je())},1e3);return()=>clearInterval(s)},[]),u.jsx("p",{className:"capitalize max-xs:hidden",children:e})};function xr(e){const{t}=_.useTranslation(),{openDrawer:s}=e,{searchComponent:n}=Fe(),[i,r]=y.useState(!1),c=y.useCallback(f=>{(It()?f.metaKey:f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="f"&&(r(!0),f.preventDefault())},[]);y.useEffect(()=>(window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}),[c]);const o=n;return u.jsxs(u.Fragment,{children:[location.pathname!=="/"&&!!o&&u.jsx(o,{open:i,onClose:()=>r(!1)}),u.jsxs("header",{id:"header",className:"header",children:[u.jsxs("div",{className:"flex gap-2 items-center",children:[u.jsx(ue,{type:"button",icon:I.faBars,onClick:s,name:t("_accessibility:buttons.openMenu"),"aria-label":t("_accessibility:ariaLabels.openMenu"),className:"menu animated"}),u.jsx("h1",{className:"text-lg text-text pointer-events-none poppins font-bold",children:t("_pages:home.appName")})]}),u.jsxs("div",{className:"flex items-center justify-end gap-2",children:[u.jsx(ue,{icon:I.faSearch,className:"min-xs:!hidden",onClick:()=>r(!0)}),u.jsx(pr,{})]})]})]})}function wr(){const{t:e}=_.useTranslation(),{notification:t,removeNotification:s}=pe(),[n,i]=y.useState(new Set),r=y.useCallback(b=>{if(b===void 0){const h=new Set(t.map((m,C)=>C));i(h),window.setTimeout(()=>s(),300)}else i(h=>new Set(h).add(b)),window.setTimeout(()=>s(b),300)},[t,s]),c=y.useCallback(b=>{switch(b){case R.error:return I.faWarning;default:return I.faCircleCheck}},[]),o=y.useCallback(b=>{switch(b){case R.success:return"!text-success";case R.error:return"!text-error";case R.warning:return"!text-warning";default:return"!text-info"}},[]),f=y.useCallback(b=>{switch(b){case R.success:return"bg-bg-success";case R.error:return"bg-bg-error";case R.warning:return"bg-bg-warning";default:return"bg-bg-info"}},[]),g=y.useRef();return y.useEffect(()=>{g.current=()=>r()},[r]),y.useEffect(()=>{if(!(t!=null&&t.length))return;const b=h=>{var m;return(m=g.current)==null?void 0:m.call(g,h)};return window.addEventListener("click",b),()=>{window.removeEventListener("click",b)}},[t==null?void 0:t.length]),y.useEffect(()=>{i(new Set)},[t]),Lt.createPortal(u.jsx("div",{className:`notification-portal ${t!=null&&t.length?"w-screen h-screen":""}`,children:t!=null&&t.length?t==null?void 0:t.map(({id:b,type:h,message:m},C)=>u.jsxs("div",{className:`notification ${n.has(C)?"closing":""} ${f(h??R.error)}`,onClick:S=>S.stopPropagation(),children:[u.jsxs("div",{className:"flex gap-3 items-center",children:[u.jsx(se.FontAwesomeIcon,{icon:c(h??R.error),className:`${o(h??R.error)}`}),u.jsx("p",{className:`whitespace-nowrap ${o(h??R.error)}`,children:m})]}),u.jsx(ue,{type:"button",icon:I.faClose,color:"error",className:"group",onClick:S=>{S.stopPropagation(),r(C)},iconClassName:`${o(h??R.error)} group-hover:!text-red-400 cursor-pointer`,name:e("_accessibility:buttons.closeNotification"),"aria-label":e("_accessibility:ariaLabels.closeNotification")})]},b)):null}),document.body)}function vr(){return u.jsx("div",{className:"w-screen h-screen flex items-center justify-center overflow-hidden",children:u.jsx(_.Loading,{className:"blur-appear"})})}const ns=e=>{const{id:t,active:s,onClick:n,children:i,to:r}=e,{linkComponent:c}=Fe(),o=c;return u.jsx(o,{to:r??`#${t}`,onClick:()=>n(),className:`button submit tab ${s?"primary":"outlined"}`,children:i})},is=e=>{var f;const{tabs:t=[],defaultTab:s,className:n="",tabsContainerClassName:i=""}=e,[r,c]=y.useState((f=t[0])==null?void 0:f.id),o=y.useMemo(()=>t.find(g=>g.id===r),[t,r]);return y.useEffect(()=>{s&&c(s)},[s]),u.jsxs("div",{className:`tabs-layout-main ${n}`,children:[u.jsx("ul",{className:`horizontal tabs tabs-container ${i}`,children:t.map(({id:g,to:b,label:h})=>u.jsx("li",{children:u.jsx(ns,{onClick:()=>c(g),id:g,to:b??"",siblings:t.length>1,active:r===g,children:h})},g))}),o==null?void 0:o.content]})},as=e=>{const{translation:t,onClickNext:s,image:n="",alt:i="",final:r=!1}=e,{setGuestMode:c}=rt(),{t:o}=_.useTranslation();return u.jsxs("div",{className:"big-appear w-md flex flex-col gap-20",children:[u.jsx("img",{src:n,alt:i}),u.jsx("h2",{className:"text-5xl text-center leading-16",children:o(`_pages:onboarding.${t}.title`)}),u.jsx("p",{className:"text-center !text-lg",children:o(`_pages:onboarding.${t}.body`)}),u.jsx("div",{className:"flex gap-5 items-center justify-center",children:r?u.jsxs(u.Fragment,{children:[u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>{c(!0),window.location.href="/"},"aria-label":o("_accessibility:ariaLabels.start"),children:o("_accessibility:buttons.startAsGuest")}),u.jsx(fe,{color:"primary",variant:"submit",className:"!px-8","aria-label":o("_accessibility:ariaLabels.start"),onClick:()=>window.location.href="/auth/sign-in",children:o("_accessibility:buttons.signIn")})]}):u.jsxs(u.Fragment,{children:[u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>window.location.href="/auth/sign-in","aria-label":o("_accessibility:ariaLabels.skip"),children:o("_accessibility:buttons.skip")}),u.jsx(fe,{color:"primary",className:"!px-8",variant:"outlined",onClick:()=>s(),"aria-label":o("_accessibility:ariaLabels.next"),children:o("_accessibility:buttons.next")})]})})]})},Cr=e=>{const{steps:t}=e,[s,n]=y.useState(1),i=y.useMemo(()=>t.map((r,c)=>({id:c+1,label:"",content:u.jsx(as,{translation:r,final:c===t.length-1,onClickNext:()=>n(s+1)})})),[s]);return u.jsx("div",{className:"onboarding-main",children:u.jsx(is,{defaultTab:s,tabs:i})})},os=e=>{const{message:t,messageProps:s={className:"text-gray-400 text-balance text-center"},action:n,iconProps:i}=e;return u.jsxs("div",{className:"flex flex-col items-center justify-center gap-5 pt-5",children:[i&&u.jsx(se.FontAwesomeIcon,{...i??{}}),u.jsx("p",{...s??{},children:t}),n&&u.jsx(Xe,{showTooltips:!1,showText:!0,...n})]})};exports.APIClient=tt;exports.Action=Xe;exports.Actions=Ze;exports.ActionsDropdown=rs;exports.AuthClient=Pt;exports.AuthProvider=Fs;exports.BaseClient=As;exports.Button=fe;exports.ConfigProvider=js;exports.ConfirmationDialog=dr;exports.Dialog=Oe;exports.DialogActions=Re;exports.Drawer=mr;exports.Dropdown=$t;exports.Empty=os;exports.Error=hr;exports.FormContainer=cr;exports.FormDialog=ur;exports.GlobalActions=me;exports.IManager=Ss;exports.IconButton=ue;exports.ImportDialog=fr;exports.ManagerProvider=Es;exports.Methods=G;exports.Navbar=xr;exports.Notification=wr;exports.NotificationEnumType=R;exports.NotificationProvider=Ts;exports.Onboarding=Cr;exports.Page=gr;exports.ParagraphInput=or;exports.PasswordInput=lr;exports.PrettyGrid=br;exports.SplashScreen=vr;exports.Step=as;exports.Tab=ns;exports.TabsLayout=is;exports.ToTop=ar;exports.buildQueryUrl=Vt;exports.enumToKeyValueArray=_s;exports.formatForDatetimeLocal=Ns;exports.fromLocal=st;exports.getFormattedDateTime=Je;exports.isMac=It;exports.makeRequest=Ae;exports.parseQueries=et;exports.queryClient=be;exports.removeFromLocal=Ge;exports.toLocal=ze;exports.useAuth=rt;exports.useConfig=Fe;exports.useConfirmationForm=nt;exports.useDeleteAction=Xt;exports.useDeleteDialog=tr;exports.useDialog=ut;exports.useEditAction=er;exports.useExportAction=es;exports.useExportActionMutate=ir;exports.useFormDialog=sr;exports.useImportAction=ts;exports.useImportDialog=nr;exports.useManager=Rt;exports.useNotification=pe;exports.usePostForm=Yt;exports.useRestoreAction=Zt;exports.useRestoreDialog=rr;exports.useScrollTrigger=ss;exports.useTimeAge=ks;Object.keys(_).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>_[e]})});
|
package/dist/dashboard-app.js
CHANGED
|
@@ -140,9 +140,9 @@ function Qs() {
|
|
|
140
140
|
return !1;
|
|
141
141
|
}, t = (a) => {
|
|
142
142
|
const d = {};
|
|
143
|
-
return a.substring(1).split("&").forEach((
|
|
144
|
-
const [
|
|
145
|
-
d[
|
|
143
|
+
return a.substring(1).split("&").forEach((g) => {
|
|
144
|
+
const [m, f] = g.split("=");
|
|
145
|
+
d[m] = f;
|
|
146
146
|
}), d;
|
|
147
147
|
}, s = (a = "") => {
|
|
148
148
|
if (r(a) && a.length) return r(a);
|
|
@@ -152,19 +152,19 @@ function Qs() {
|
|
|
152
152
|
return a.length && i(a, 730, d), d;
|
|
153
153
|
}
|
|
154
154
|
return "en";
|
|
155
|
-
}, n = (a = 0, d = 0, y = window,
|
|
155
|
+
}, n = (a = 0, d = 0, y = window, g = "smooth") => y.scroll({
|
|
156
156
|
top: a,
|
|
157
157
|
left: d,
|
|
158
|
-
behavior:
|
|
159
|
-
}), i = (a, d, y,
|
|
158
|
+
behavior: g
|
|
159
|
+
}), i = (a, d, y, g = "/", m = "Lax") => {
|
|
160
160
|
var f = /* @__PURE__ */ new Date();
|
|
161
161
|
f.setTime(f.getTime() + d * 24 * 60 * 60 * 1e3);
|
|
162
162
|
const x = "; expires=" + f.toUTCString();
|
|
163
|
-
document.cookie = `${a}=${y || ""}${x};path=${
|
|
163
|
+
document.cookie = `${a}=${y || ""}${x};path=${g};SameSite=${m}`;
|
|
164
164
|
}, r = (a) => {
|
|
165
|
-
const d = `${a}=`,
|
|
166
|
-
for (let
|
|
167
|
-
let f = m
|
|
165
|
+
const d = `${a}=`, g = decodeURIComponent(document.cookie).split(";");
|
|
166
|
+
for (let m = 0; m < g.length; m += 1) {
|
|
167
|
+
let f = g[m];
|
|
168
168
|
for (; f.charAt(0) === " "; )
|
|
169
169
|
f = f.substring(1);
|
|
170
170
|
if (f.indexOf(d) === 0)
|
|
@@ -187,8 +187,8 @@ function Hr() {
|
|
|
187
187
|
const { t: e, language: t } = D();
|
|
188
188
|
return { timeAge: F(
|
|
189
189
|
(n) => {
|
|
190
|
-
const r = /* @__PURE__ */ new Date() - n, c = Math.floor(r / (1e3 * 60)), a = Math.floor(c / 60), d = t === "es", y = e("_accessibility:labels.ago"),
|
|
191
|
-
return r < 1e3 * 60 ? S : c < 60 ? `${d ? y : ""} ${c} ${c === 1 ?
|
|
190
|
+
const r = /* @__PURE__ */ new Date() - n, c = Math.floor(r / (1e3 * 60)), a = Math.floor(c / 60), d = t === "es", y = e("_accessibility:labels.ago"), g = e("_accessibility:labels.minute"), m = e("_accessibility:labels.minutes"), f = e("_accessibility:labels.hour"), x = e("_accessibility:labels.hours"), C = e("_accessibility:labels.yesterday"), S = e("_accessibility:labels.justNow");
|
|
191
|
+
return r < 1e3 * 60 ? S : c < 60 ? `${d ? y : ""} ${c} ${c === 1 ? g : m} ${d ? "" : y}` : a < 24 ? `${d ? y : ""} ${a} ${a === 1 ? f : x} ${d ? "" : y}` : a < 48 ? C : n.toLocaleDateString(navigator.language || "es-ES", {
|
|
192
192
|
day: "2-digit",
|
|
193
193
|
month: "2-digit",
|
|
194
194
|
year: "numeric"
|
|
@@ -592,9 +592,9 @@ const Gs = () => {
|
|
|
592
592
|
}, Qt = Be({});
|
|
593
593
|
function Gr(e) {
|
|
594
594
|
const { children: t } = e, [s, n] = Ss(
|
|
595
|
-
(y,
|
|
596
|
-
const { type:
|
|
597
|
-
switch (
|
|
595
|
+
(y, g) => {
|
|
596
|
+
const { type: m, items: f, index: x } = g;
|
|
597
|
+
switch (m) {
|
|
598
598
|
case "set":
|
|
599
599
|
return (f == null ? void 0 : f.map((C, S) => ({
|
|
600
600
|
...C,
|
|
@@ -662,25 +662,25 @@ const ke = () => {
|
|
|
662
662
|
wt(s, x);
|
|
663
663
|
}, []), y = F((x) => {
|
|
664
664
|
x && (c(x), vt(s), wt(n, x.token));
|
|
665
|
-
}, []),
|
|
665
|
+
}, []), g = F(async () => {
|
|
666
666
|
try {
|
|
667
667
|
await i.Auth.logout();
|
|
668
668
|
} catch (x) {
|
|
669
669
|
console.error(x);
|
|
670
670
|
}
|
|
671
671
|
c({}), vt(n);
|
|
672
|
-
}, [i.Auth]),
|
|
672
|
+
}, [i.Auth]), m = F(async () => {
|
|
673
673
|
try {
|
|
674
674
|
const x = await i.Auth.getSession();
|
|
675
675
|
y(x);
|
|
676
676
|
} catch (x) {
|
|
677
|
-
console.error(x),
|
|
677
|
+
console.error(x), g();
|
|
678
678
|
}
|
|
679
|
-
}, [y,
|
|
679
|
+
}, [y, g, i.Auth]), f = {
|
|
680
680
|
account: r,
|
|
681
681
|
logUser: y,
|
|
682
|
-
logoutUser:
|
|
683
|
-
logUserFromLocal:
|
|
682
|
+
logoutUser: g,
|
|
683
|
+
logUserFromLocal: m,
|
|
684
684
|
isInGuestMode: a,
|
|
685
685
|
setGuestMode: d
|
|
686
686
|
};
|
|
@@ -707,24 +707,24 @@ const ke = () => {
|
|
|
707
707
|
);
|
|
708
708
|
return e;
|
|
709
709
|
}, Jt = (e) => {
|
|
710
|
-
const { showSuccessNotification: t } = ke(), { mutationFn: s, onError: n, onSuccess: i, onSuccessMessage: r } = e, [c, a] = X([]), { open: d, handleClose: y, handleOpen:
|
|
710
|
+
const { showSuccessNotification: t } = ke(), { mutationFn: s, onError: n, onSuccess: i, onSuccessMessage: r } = e, [c, a] = X([]), { open: d, handleClose: y, handleOpen: g } = is(), m = () => {
|
|
711
711
|
y(), a([]);
|
|
712
712
|
}, f = async (C) => {
|
|
713
|
-
a(C),
|
|
713
|
+
a(C), g();
|
|
714
714
|
}, x = He({
|
|
715
715
|
mutationFn: () => s(
|
|
716
716
|
Array.isArray(c) ? c : [c]
|
|
717
717
|
),
|
|
718
718
|
onError: (C) => {
|
|
719
|
-
console.error(C), n && n(C),
|
|
719
|
+
console.error(C), n && n(C), m();
|
|
720
720
|
},
|
|
721
721
|
onSuccess: async (C) => {
|
|
722
722
|
i && i(C), t({
|
|
723
723
|
message: r
|
|
724
|
-
}),
|
|
724
|
+
}), m();
|
|
725
725
|
}
|
|
726
726
|
});
|
|
727
|
-
return { open: d, onClick: f, close:
|
|
727
|
+
return { open: d, onClick: f, close: m, dialogFn: x, isLoading: x.isPending };
|
|
728
728
|
};
|
|
729
729
|
var Ve = (e) => e.type === "checkbox", Ce = (e) => e instanceof Date, z = (e) => e == null;
|
|
730
730
|
const Yt = (e) => typeof e == "object";
|
|
@@ -1008,7 +1008,7 @@ var Ne = (e) => I(e) && !Re(e) ? e : {
|
|
|
1008
1008
|
value: e,
|
|
1009
1009
|
message: ""
|
|
1010
1010
|
}, Dt = async (e, t, s, n, i, r) => {
|
|
1011
|
-
const { ref: c, refs: a, required: d, maxLength: y, minLength:
|
|
1011
|
+
const { ref: c, refs: a, required: d, maxLength: y, minLength: g, min: m, max: f, pattern: x, validate: C, name: S, valueAsNumber: Q, mount: ye } = e._f, k = v(s, S);
|
|
1012
1012
|
if (!ye || t.has(S))
|
|
1013
1013
|
return {};
|
|
1014
1014
|
const W = a ? a[0] : c, L = (N) => {
|
|
@@ -1032,9 +1032,9 @@ var Ne = (e) => I(e) && !Re(e) ? e : {
|
|
|
1032
1032
|
}, !n))
|
|
1033
1033
|
return L(E), T;
|
|
1034
1034
|
}
|
|
1035
|
-
if (!q && (!z(
|
|
1035
|
+
if (!q && (!z(m) || !z(f))) {
|
|
1036
1036
|
let N, E;
|
|
1037
|
-
const O = Ne(f), j = Ne(
|
|
1037
|
+
const O = Ne(f), j = Ne(m);
|
|
1038
1038
|
if (!z(k) && !isNaN(k)) {
|
|
1039
1039
|
const K = c.valueAsNumber || k && +k;
|
|
1040
1040
|
z(O.value) || (N = K > O.value), z(j.value) || (E = K < j.value);
|
|
@@ -1045,8 +1045,8 @@ var Ne = (e) => I(e) && !Re(e) ? e : {
|
|
|
1045
1045
|
if ((N || E) && (se(!!N, O.message, j.message, me.max, me.min), !n))
|
|
1046
1046
|
return L(T[S].message), T;
|
|
1047
1047
|
}
|
|
1048
|
-
if ((y ||
|
|
1049
|
-
const N = Ne(y), E = Ne(
|
|
1048
|
+
if ((y || g) && !q && (fe(k) || r && Array.isArray(k))) {
|
|
1049
|
+
const N = Ne(y), E = Ne(g), O = !z(N.value) && k.length > +N.value, j = !z(E.value) && k.length < +E.value;
|
|
1050
1050
|
if ((O || j) && (se(O, N.message, E.message), !n))
|
|
1051
1051
|
return L(T[S].message), T;
|
|
1052
1052
|
}
|
|
@@ -1123,7 +1123,7 @@ function pr(e = {}) {
|
|
|
1123
1123
|
array: /* @__PURE__ */ new Set(),
|
|
1124
1124
|
watch: /* @__PURE__ */ new Set()
|
|
1125
1125
|
}, d, y = 0;
|
|
1126
|
-
const
|
|
1126
|
+
const g = {
|
|
1127
1127
|
isDirty: !1,
|
|
1128
1128
|
dirtyFields: !1,
|
|
1129
1129
|
validatingFields: !1,
|
|
@@ -1132,8 +1132,8 @@ function pr(e = {}) {
|
|
|
1132
1132
|
isValid: !1,
|
|
1133
1133
|
errors: !1
|
|
1134
1134
|
};
|
|
1135
|
-
let
|
|
1136
|
-
...
|
|
1135
|
+
let m = {
|
|
1136
|
+
...g
|
|
1137
1137
|
};
|
|
1138
1138
|
const f = {
|
|
1139
1139
|
array: Ct(),
|
|
@@ -1141,14 +1141,14 @@ function pr(e = {}) {
|
|
|
1141
1141
|
}, x = t.criteriaMode === ce.all, C = (o) => (l) => {
|
|
1142
1142
|
clearTimeout(y), y = setTimeout(o, l);
|
|
1143
1143
|
}, S = async (o) => {
|
|
1144
|
-
if (!t.disabled && (
|
|
1144
|
+
if (!t.disabled && (g.isValid || m.isValid || o)) {
|
|
1145
1145
|
const l = t.resolver ? J((await Z()).errors) : await q(n, !0);
|
|
1146
1146
|
l !== s.isValid && f.state.next({
|
|
1147
1147
|
isValid: l
|
|
1148
1148
|
});
|
|
1149
1149
|
}
|
|
1150
1150
|
}, Q = (o, l) => {
|
|
1151
|
-
!t.disabled && (
|
|
1151
|
+
!t.disabled && (g.isValidating || g.validatingFields || m.isValidating || m.validatingFields) && ((o || Array.from(a.mount)).forEach((u) => {
|
|
1152
1152
|
u && (l ? M(s.validatingFields, u, l) : U(s.validatingFields, u));
|
|
1153
1153
|
}), f.state.next({
|
|
1154
1154
|
validatingFields: s.validatingFields,
|
|
@@ -1164,11 +1164,11 @@ function pr(e = {}) {
|
|
|
1164
1164
|
const _ = u(v(s.errors, o), w.argA, w.argB);
|
|
1165
1165
|
p && M(s.errors, o, _), yr(s.errors, o);
|
|
1166
1166
|
}
|
|
1167
|
-
if ((
|
|
1167
|
+
if ((g.touchedFields || m.touchedFields) && b && Array.isArray(v(s.touchedFields, o))) {
|
|
1168
1168
|
const _ = u(v(s.touchedFields, o), w.argA, w.argB);
|
|
1169
1169
|
p && M(s.touchedFields, o, _);
|
|
1170
1170
|
}
|
|
1171
|
-
(
|
|
1171
|
+
(g.dirtyFields || m.dirtyFields) && (s.dirtyFields = Ee(i, r)), f.state.next({
|
|
1172
1172
|
name: o,
|
|
1173
1173
|
isDirty: se(o, l),
|
|
1174
1174
|
dirtyFields: s.dirtyFields,
|
|
@@ -1199,19 +1199,19 @@ function pr(e = {}) {
|
|
|
1199
1199
|
};
|
|
1200
1200
|
if (!t.disabled) {
|
|
1201
1201
|
if (!u || w) {
|
|
1202
|
-
(
|
|
1202
|
+
(g.isDirty || m.isDirty) && (_ = s.isDirty, s.isDirty = $.isDirty = se(), b = _ !== $.isDirty);
|
|
1203
1203
|
const P = be(v(i, o), l);
|
|
1204
|
-
_ = !!v(s.dirtyFields, o), P ? U(s.dirtyFields, o) : M(s.dirtyFields, o, !0), $.dirtyFields = s.dirtyFields, b = b || (
|
|
1204
|
+
_ = !!v(s.dirtyFields, o), P ? U(s.dirtyFields, o) : M(s.dirtyFields, o, !0), $.dirtyFields = s.dirtyFields, b = b || (g.dirtyFields || m.dirtyFields) && _ !== !P;
|
|
1205
1205
|
}
|
|
1206
1206
|
if (u) {
|
|
1207
1207
|
const P = v(s.touchedFields, o);
|
|
1208
|
-
P || (M(s.touchedFields, o, u), $.touchedFields = s.touchedFields, b = b || (
|
|
1208
|
+
P || (M(s.touchedFields, o, u), $.touchedFields = s.touchedFields, b = b || (g.touchedFields || m.touchedFields) && P !== u);
|
|
1209
1209
|
}
|
|
1210
1210
|
b && p && f.state.next($);
|
|
1211
1211
|
}
|
|
1212
1212
|
return b ? $ : {};
|
|
1213
1213
|
}, G = (o, l, u, w) => {
|
|
1214
|
-
const p = v(s.errors, o), b = (
|
|
1214
|
+
const p = v(s.errors, o), b = (g.isValid || m.isValid) && de(l) && s.isValid !== l;
|
|
1215
1215
|
if (t.delayError && u ? (d = C(() => k(o, u)), d(t.delayError)) : (clearTimeout(y), d = null, u ? M(s.errors, o, u) : U(s.errors, o)), (u ? !be(p, u) : p) || !J(w) || b) {
|
|
1216
1216
|
const _ = {
|
|
1217
1217
|
...w,
|
|
@@ -1247,9 +1247,9 @@ function pr(e = {}) {
|
|
|
1247
1247
|
const { _f: b, ..._ } = p;
|
|
1248
1248
|
if (b) {
|
|
1249
1249
|
const $ = a.array.has(b.name), P = p._f && ur(p._f);
|
|
1250
|
-
P &&
|
|
1250
|
+
P && g.validatingFields && Q([w], !0);
|
|
1251
1251
|
const ne = await Dt(p, a.disabled, r, x, t.shouldUseNativeValidation && !l, $);
|
|
1252
|
-
if (P &&
|
|
1252
|
+
if (P && g.validatingFields && Q([w]), ne[b.name] && (u.valid = !1, l))
|
|
1253
1253
|
break;
|
|
1254
1254
|
!l && (v(ne, b.name) ? $ ? gr(s.errors, ne, b.name) : M(s.errors, b.name, ne[b.name]) : U(s.errors, b.name));
|
|
1255
1255
|
}
|
|
@@ -1290,7 +1290,7 @@ function pr(e = {}) {
|
|
|
1290
1290
|
M(r, o, b), p ? (f.array.next({
|
|
1291
1291
|
name: o,
|
|
1292
1292
|
values: H(r)
|
|
1293
|
-
}), (
|
|
1293
|
+
}), (g.isDirty || g.dirtyFields || m.isDirty || m.dirtyFields) && u.shouldDirty && f.state.next({
|
|
1294
1294
|
name: o,
|
|
1295
1295
|
dirtyFields: Ee(i, r),
|
|
1296
1296
|
isDirty: se(o, b)
|
|
@@ -1315,7 +1315,7 @@ function pr(e = {}) {
|
|
|
1315
1315
|
type: o.type,
|
|
1316
1316
|
values: H(r)
|
|
1317
1317
|
}), fs)
|
|
1318
|
-
return (
|
|
1318
|
+
return (g.isValid || m.isValid) && (t.mode === "onBlur" ? ge && S() : ge || S()), ms && f.state.next({ name: u, ...Je ? {} : Ye });
|
|
1319
1319
|
if (!ge && Je && f.state.next({ ...s }), t.resolver) {
|
|
1320
1320
|
const { errors: yt } = await Z([u]);
|
|
1321
1321
|
if (b(Me), w) {
|
|
@@ -1323,7 +1323,7 @@ function pr(e = {}) {
|
|
|
1323
1323
|
P = gt.error, u = gt.name, ne = J(yt);
|
|
1324
1324
|
}
|
|
1325
1325
|
} else
|
|
1326
|
-
Q([u], !0), P = (await Dt(p, a.disabled, r, x, t.shouldUseNativeValidation))[u], Q([u]), b(Me), w && (P ? ne = !1 : (
|
|
1326
|
+
Q([u], !0), P = (await Dt(p, a.disabled, r, x, t.shouldUseNativeValidation))[u], Q([u]), b(Me), w && (P ? ne = !1 : (g.isValid || m.isValid) && (ne = await q(n, !0)));
|
|
1327
1327
|
w && (p._f.deps && ae(p._f.deps), G(u, ne, P, Ye));
|
|
1328
1328
|
}
|
|
1329
1329
|
}, re = (o, l) => {
|
|
@@ -1340,7 +1340,7 @@ function pr(e = {}) {
|
|
|
1340
1340
|
return await q(_ && _._f ? { [b]: _ } : _);
|
|
1341
1341
|
}))).every(Boolean), !(!w && !s.isValid) && S()) : w = u = await q(n);
|
|
1342
1342
|
return f.state.next({
|
|
1343
|
-
...!fe(o) || (
|
|
1343
|
+
...!fe(o) || (g.isValid || m.isValid) && u !== s.isValid ? {} : { name: o },
|
|
1344
1344
|
...t.resolver || !o ? { isValid: u } : {},
|
|
1345
1345
|
errors: s.errors
|
|
1346
1346
|
}), l.shouldFocus && !w && Te(n, re, o ? p : a.mount), w;
|
|
@@ -1374,19 +1374,19 @@ function pr(e = {}) {
|
|
|
1374
1374
|
next: (u) => "values" in u && o(N(void 0, l), u)
|
|
1375
1375
|
}) : N(o, l, !0), lt = (o) => f.state.subscribe({
|
|
1376
1376
|
next: (l) => {
|
|
1377
|
-
mr(o.name, l.name, o.exact) && fr(l, o.formState ||
|
|
1377
|
+
mr(o.name, l.name, o.exact) && fr(l, o.formState || g, ds, o.reRenderRoot) && o.callback({
|
|
1378
1378
|
values: { ...r },
|
|
1379
1379
|
...s,
|
|
1380
1380
|
...l,
|
|
1381
1381
|
defaultValues: i
|
|
1382
1382
|
});
|
|
1383
1383
|
}
|
|
1384
|
-
}).unsubscribe, as = (o) => (c.mount = !0,
|
|
1385
|
-
...
|
|
1384
|
+
}).unsubscribe, as = (o) => (c.mount = !0, m = {
|
|
1385
|
+
...m,
|
|
1386
1386
|
...o.formState
|
|
1387
1387
|
}, lt({
|
|
1388
1388
|
...o,
|
|
1389
|
-
formState:
|
|
1389
|
+
formState: m
|
|
1390
1390
|
})), We = (o, l = {}) => {
|
|
1391
1391
|
for (const u of o ? $e(o) : a.mount)
|
|
1392
1392
|
a.mount.delete(u), a.array.delete(u), l.keepValue || (U(n, u), U(r, u)), !l.keepError && U(s.errors, u), !l.keepDirty && U(s.dirtyFields, u), !l.keepTouched && U(s.touchedFields, u), !l.keepIsValidating && U(s.validatingFields, u), !t.shouldUnregister && !l.keepDefaultValue && U(i, u);
|
|
@@ -1489,7 +1489,7 @@ function pr(e = {}) {
|
|
|
1489
1489
|
}), w)
|
|
1490
1490
|
throw w;
|
|
1491
1491
|
}, ls = (o, l = {}) => {
|
|
1492
|
-
v(n, o) && (R(l.defaultValue) ? K(o, H(v(i, o))) : (K(o, l.defaultValue), M(i, o, H(l.defaultValue))), l.keepTouched || U(s.touchedFields, o), l.keepDirty || (U(s.dirtyFields, o), s.isDirty = l.defaultValue ? se(o, H(v(i, o))) : se()), l.keepError || (U(s.errors, o),
|
|
1492
|
+
v(n, o) && (R(l.defaultValue) ? K(o, H(v(i, o))) : (K(o, l.defaultValue), M(i, o, H(l.defaultValue))), l.keepTouched || U(s.touchedFields, o), l.keepDirty || (U(s.dirtyFields, o), s.isDirty = l.defaultValue ? se(o, H(v(i, o))) : se()), l.keepError || (U(s.errors, o), g.isValid && S()), f.state.next({ ...s }));
|
|
1493
1493
|
}, ft = (o, l = {}) => {
|
|
1494
1494
|
const u = o ? H(o) : i, w = H(u), p = J(o), b = p ? i : w;
|
|
1495
1495
|
if (l.keepDefaultValues || (i = u), !l.keepValues) {
|
|
@@ -1535,7 +1535,7 @@ function pr(e = {}) {
|
|
|
1535
1535
|
watch: /* @__PURE__ */ new Set(),
|
|
1536
1536
|
watchAll: !1,
|
|
1537
1537
|
focus: ""
|
|
1538
|
-
}, c.mount = !
|
|
1538
|
+
}, c.mount = !g.isValid || !!l.keepIsValid || !!l.keepDirtyValues, c.watch = !!t.shouldUnregister, f.state.next({
|
|
1539
1539
|
submitCount: l.keepSubmitCount ? s.submitCount : 0,
|
|
1540
1540
|
isDirty: p ? !1 : l.keepDirty ? s.isDirty : !!(l.keepDefaultValues && !be(o, i)),
|
|
1541
1541
|
isSubmitted: l.keepIsSubmitted ? s.isSubmitted : !1,
|
|
@@ -1582,7 +1582,7 @@ function pr(e = {}) {
|
|
|
1582
1582
|
_removeUnmounted: oe,
|
|
1583
1583
|
_disableForm: cs,
|
|
1584
1584
|
_subjects: f,
|
|
1585
|
-
_proxyFormState:
|
|
1585
|
+
_proxyFormState: g,
|
|
1586
1586
|
get _fields() {
|
|
1587
1587
|
return n;
|
|
1588
1588
|
},
|
|
@@ -1711,8 +1711,8 @@ const wr = (e) => {
|
|
|
1711
1711
|
onError: a,
|
|
1712
1712
|
onSuccess: d,
|
|
1713
1713
|
queryKey: y,
|
|
1714
|
-
onSuccessMessage:
|
|
1715
|
-
} = e, { control:
|
|
1714
|
+
onSuccessMessage: g
|
|
1715
|
+
} = e, { control: m, handleSubmit: f, reset: x, setError: C, getValues: S, setValue: Q } = ns({
|
|
1716
1716
|
defaultValues: i
|
|
1717
1717
|
}), ye = F(
|
|
1718
1718
|
(L) => {
|
|
@@ -1745,14 +1745,14 @@ const wr = (e) => {
|
|
|
1745
1745
|
a && a(L);
|
|
1746
1746
|
},
|
|
1747
1747
|
onSuccess: async (L) => {
|
|
1748
|
-
Se && await Se.invalidateQueries({ queryKey: y }), d && d(L),
|
|
1749
|
-
message:
|
|
1748
|
+
Se && await Se.invalidateQueries({ queryKey: y }), d && d(L), g && n({
|
|
1749
|
+
message: g
|
|
1750
1750
|
});
|
|
1751
1751
|
}
|
|
1752
1752
|
}
|
|
1753
1753
|
);
|
|
1754
1754
|
return {
|
|
1755
|
-
control:
|
|
1755
|
+
control: m,
|
|
1756
1756
|
getValues: S,
|
|
1757
1757
|
setValue: Q,
|
|
1758
1758
|
handleSubmit: f,
|
|
@@ -1865,7 +1865,7 @@ const _r = (e) => {
|
|
|
1865
1865
|
)
|
|
1866
1866
|
};
|
|
1867
1867
|
}, en = (e) => {
|
|
1868
|
-
const { queryKey: t, onSuccess: s, ...n } = e, { showStackNotifications: i } = ke(), { t: r } = D(), { open: c, onClick: a, close: d, dialogFn: y, isLoading:
|
|
1868
|
+
const { queryKey: t, onSuccess: s, ...n } = e, { showStackNotifications: i } = ke(), { t: r } = D(), { open: c, onClick: a, close: d, dialogFn: y, isLoading: g } = Jt({
|
|
1869
1869
|
onSuccessMessage: r("_pages:common.actions.delete.successMessage"),
|
|
1870
1870
|
onError: (f) => {
|
|
1871
1871
|
f.errors && i(
|
|
@@ -1881,15 +1881,15 @@ const _r = (e) => {
|
|
|
1881
1881
|
await Se.invalidateQueries({ queryKey: t }), s && s(f);
|
|
1882
1882
|
},
|
|
1883
1883
|
...n
|
|
1884
|
-
}), { action:
|
|
1884
|
+
}), { action: m } = vr({ onClick: a });
|
|
1885
1885
|
return {
|
|
1886
1886
|
onClick: a,
|
|
1887
1887
|
title: r("_pages:common.actions.delete.dialog.title"),
|
|
1888
1888
|
open: c,
|
|
1889
|
-
isLoading:
|
|
1889
|
+
isLoading: g,
|
|
1890
1890
|
handleSubmit: () => y.mutate(),
|
|
1891
1891
|
handleClose: d,
|
|
1892
|
-
action:
|
|
1892
|
+
action: m
|
|
1893
1893
|
};
|
|
1894
1894
|
}, is = () => {
|
|
1895
1895
|
const [e, t] = X(!1);
|
|
@@ -1905,8 +1905,8 @@ const _r = (e) => {
|
|
|
1905
1905
|
mutationFn: a,
|
|
1906
1906
|
formToDto: d,
|
|
1907
1907
|
dtoToForm: y,
|
|
1908
|
-
onError:
|
|
1909
|
-
onSuccess:
|
|
1908
|
+
onError: g,
|
|
1909
|
+
onSuccess: m,
|
|
1910
1910
|
queryKey: f,
|
|
1911
1911
|
onSuccessMessage: x,
|
|
1912
1912
|
title: C
|
|
@@ -1953,10 +1953,10 @@ const _r = (e) => {
|
|
|
1953
1953
|
})
|
|
1954
1954
|
)
|
|
1955
1955
|
);
|
|
1956
|
-
} else
|
|
1956
|
+
} else g ? g(V) : s({ message: t("_accessibility:errors.500") });
|
|
1957
1957
|
},
|
|
1958
1958
|
onSuccess: async (V) => {
|
|
1959
|
-
await Se.invalidateQueries({ queryKey: f }),
|
|
1959
|
+
await Se.invalidateQueries({ queryKey: f }), m && m(V), i({
|
|
1960
1960
|
message: x
|
|
1961
1961
|
}), j();
|
|
1962
1962
|
}
|
|
@@ -1978,7 +1978,7 @@ const _r = (e) => {
|
|
|
1978
1978
|
isLoading: se || K.isPending
|
|
1979
1979
|
};
|
|
1980
1980
|
}, sn = (e) => {
|
|
1981
|
-
const { queryKey: t, onSuccess: s, ...n } = e, { showStackNotifications: i } = ke(), { t: r } = D(), { open: c, onClick: a, close: d, dialogFn: y, isLoading:
|
|
1981
|
+
const { queryKey: t, onSuccess: s, ...n } = e, { showStackNotifications: i } = ke(), { t: r } = D(), { open: c, onClick: a, close: d, dialogFn: y, isLoading: g } = Jt({
|
|
1982
1982
|
onSuccessMessage: r("_pages:common.actions.restore.successMessage"),
|
|
1983
1983
|
onError: (f) => {
|
|
1984
1984
|
f.errors && i(
|
|
@@ -1994,15 +1994,15 @@ const _r = (e) => {
|
|
|
1994
1994
|
await Se.invalidateQueries({ queryKey: t }), s && s(f);
|
|
1995
1995
|
},
|
|
1996
1996
|
...n
|
|
1997
|
-
}), { action:
|
|
1997
|
+
}), { action: m } = xr({ onClick: a });
|
|
1998
1998
|
return {
|
|
1999
1999
|
onClick: a,
|
|
2000
2000
|
title: r("_pages:common.actions.restore.dialog.title"),
|
|
2001
2001
|
open: c,
|
|
2002
|
-
isLoading:
|
|
2002
|
+
isLoading: g,
|
|
2003
2003
|
handleSubmit: () => y.mutate(),
|
|
2004
2004
|
handleClose: d,
|
|
2005
|
-
action:
|
|
2005
|
+
action: m
|
|
2006
2006
|
};
|
|
2007
2007
|
};
|
|
2008
2008
|
function rn(e) {
|
|
@@ -2032,23 +2032,23 @@ const nn = (e) => {
|
|
|
2032
2032
|
onSuccessMessage: a = s("_pages:common.actions.export.successMessage")
|
|
2033
2033
|
} = e, d = He({
|
|
2034
2034
|
mutationFn: () => i(),
|
|
2035
|
-
onError: (
|
|
2036
|
-
console.error(
|
|
2035
|
+
onError: (m) => {
|
|
2036
|
+
console.error(m), r && r(m);
|
|
2037
2037
|
},
|
|
2038
|
-
onSuccess: async (
|
|
2039
|
-
const f = JSON.stringify(
|
|
2040
|
-
S.href = C, S.download = `${n}.json`, S.click(), URL.revokeObjectURL(C), c && c(
|
|
2038
|
+
onSuccess: async (m) => {
|
|
2039
|
+
const f = JSON.stringify(m, null, 2), x = new Blob([f], { type: "application/json" }), C = URL.createObjectURL(x), S = document.createElement("a");
|
|
2040
|
+
S.href = C, S.download = `${n}.json`, S.click(), URL.revokeObjectURL(C), c && c(m), t({
|
|
2041
2041
|
message: a
|
|
2042
2042
|
});
|
|
2043
2043
|
}
|
|
2044
2044
|
}), y = F(() => {
|
|
2045
2045
|
d.mutate();
|
|
2046
|
-
}, [d]), { action:
|
|
2046
|
+
}, [d]), { action: g } = _r({
|
|
2047
2047
|
onClick: y,
|
|
2048
2048
|
isLoading: d.isPending
|
|
2049
2049
|
});
|
|
2050
2050
|
return {
|
|
2051
|
-
action:
|
|
2051
|
+
action: g
|
|
2052
2052
|
};
|
|
2053
2053
|
};
|
|
2054
2054
|
function Sr(e) {
|
|
@@ -2104,21 +2104,21 @@ const on = () => {
|
|
|
2104
2104
|
label: a = "",
|
|
2105
2105
|
disabled: d = !1,
|
|
2106
2106
|
required: y = !1,
|
|
2107
|
-
containerClassName:
|
|
2108
|
-
inputClassName:
|
|
2107
|
+
containerClassName: g = "",
|
|
2108
|
+
inputClassName: m = "",
|
|
2109
2109
|
labelClassName: f = "",
|
|
2110
2110
|
helperText: x = "",
|
|
2111
2111
|
helperTextClassName: C = "",
|
|
2112
2112
|
...S
|
|
2113
2113
|
} = e;
|
|
2114
|
-
return /* @__PURE__ */ A("div", { className: `relative z-0 w-full mb-5 group ${
|
|
2114
|
+
return /* @__PURE__ */ A("div", { className: `relative z-0 w-full mb-5 group ${g}`, children: [
|
|
2115
2115
|
/* @__PURE__ */ h(
|
|
2116
2116
|
"textarea",
|
|
2117
2117
|
{
|
|
2118
2118
|
ref: t,
|
|
2119
2119
|
name: r,
|
|
2120
2120
|
id: c,
|
|
2121
|
-
className: `text-input text-area ${ps(i)} ${
|
|
2121
|
+
className: `text-input text-area ${ps(i)} ${m} peer`,
|
|
2122
2122
|
required: y,
|
|
2123
2123
|
value: s,
|
|
2124
2124
|
onChange: n,
|
|
@@ -2206,17 +2206,17 @@ const on = () => {
|
|
|
2206
2206
|
containerClassName: c = "",
|
|
2207
2207
|
className: a = "",
|
|
2208
2208
|
animationClass: d = "appear"
|
|
2209
|
-
} = e, [y,
|
|
2209
|
+
} = e, [y, g] = X(window.innerWidth), m = F(
|
|
2210
2210
|
(S) => {
|
|
2211
2211
|
S.key === "Escape" && r && i();
|
|
2212
2212
|
},
|
|
2213
2213
|
[r, i]
|
|
2214
2214
|
);
|
|
2215
|
-
te(() => (window.addEventListener("keydown",
|
|
2216
|
-
window.removeEventListener("keydown",
|
|
2217
|
-
}), [
|
|
2215
|
+
te(() => (window.addEventListener("keydown", m), () => {
|
|
2216
|
+
window.removeEventListener("keydown", m);
|
|
2217
|
+
}), [m]);
|
|
2218
2218
|
const f = F(() => {
|
|
2219
|
-
|
|
2219
|
+
g(window.innerWidth);
|
|
2220
2220
|
}, []);
|
|
2221
2221
|
te(() => (window.addEventListener("resize", f), () => {
|
|
2222
2222
|
window.removeEventListener("resize", f);
|
|
@@ -2282,8 +2282,8 @@ const on = () => {
|
|
|
2282
2282
|
primaryType: a = "button",
|
|
2283
2283
|
containerClassName: d = "",
|
|
2284
2284
|
primaryClassName: y = "",
|
|
2285
|
-
alignEnd:
|
|
2286
|
-
primaryName:
|
|
2285
|
+
alignEnd: g = !1,
|
|
2286
|
+
primaryName: m,
|
|
2287
2287
|
primaryAriaLabel: f,
|
|
2288
2288
|
cancelName: x,
|
|
2289
2289
|
cancelAriaLabel: C
|
|
@@ -2291,7 +2291,7 @@ const on = () => {
|
|
|
2291
2291
|
return /* @__PURE__ */ A(
|
|
2292
2292
|
"div",
|
|
2293
2293
|
{
|
|
2294
|
-
className: `flex gap-2 mt-2 ${
|
|
2294
|
+
className: `flex gap-2 mt-2 ${g ? "justify-end" : ""} ${d}`,
|
|
2295
2295
|
children: [
|
|
2296
2296
|
/* @__PURE__ */ A(
|
|
2297
2297
|
pe,
|
|
@@ -2302,7 +2302,7 @@ const on = () => {
|
|
|
2302
2302
|
className: y,
|
|
2303
2303
|
disabled: c,
|
|
2304
2304
|
onClick: a === "button" ? n : void 0,
|
|
2305
|
-
name:
|
|
2305
|
+
name: m,
|
|
2306
2306
|
"aria-label": f,
|
|
2307
2307
|
children: [
|
|
2308
2308
|
r ? /* @__PURE__ */ h(qe, { color: "stroke-base", loaderClass: "!w-6 mt-1", strokeWidth: "6" }) : null,
|
|
@@ -2413,18 +2413,18 @@ const on = () => {
|
|
|
2413
2413
|
] });
|
|
2414
2414
|
};
|
|
2415
2415
|
function mn(e) {
|
|
2416
|
-
const { t } = D(), { open: s, onClose: n, menuMap: i } = e, { account:
|
|
2417
|
-
const
|
|
2418
|
-
return
|
|
2419
|
-
}), [
|
|
2416
|
+
const { t } = D(), { open: s, onClose: n, menuMap: i, logo: r } = e, { account: c } = zt(), { linkComponent: a } = Qe(), d = a, y = De(() => i.filter((m) => {
|
|
2417
|
+
const f = m.auth, x = !!(c != null && c.email);
|
|
2418
|
+
return f == null || f && x || !f && !x;
|
|
2419
|
+
}), [c]), g = F(
|
|
2420
2420
|
(m) => {
|
|
2421
2421
|
m.key === "Escape" && s && n();
|
|
2422
2422
|
},
|
|
2423
2423
|
[n, s]
|
|
2424
2424
|
);
|
|
2425
|
-
return te(() => (document.addEventListener("keydown",
|
|
2426
|
-
document.removeEventListener("keydown",
|
|
2427
|
-
}), [
|
|
2425
|
+
return te(() => (document.addEventListener("keydown", g), () => {
|
|
2426
|
+
document.removeEventListener("keydown", g);
|
|
2427
|
+
}), [g]), /* @__PURE__ */ h(
|
|
2428
2428
|
"div",
|
|
2429
2429
|
{
|
|
2430
2430
|
"aria-label": t("_accessibility:ariaLabels.closeMenu"),
|
|
@@ -2436,13 +2436,16 @@ function mn(e) {
|
|
|
2436
2436
|
{
|
|
2437
2437
|
className: `${s ? "opened" : "closed"} bg-base drawer animated`,
|
|
2438
2438
|
children: [
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
|
|
2439
|
+
/* @__PURE__ */ A("div", { className: "flex gap-2 items-center justify-start px-5 pb-5", children: [
|
|
2440
|
+
r,
|
|
2441
|
+
/* @__PURE__ */ h("h2", { className: "text-xl text-text font-bold poppins", children: t("_pages:home.appName") })
|
|
2442
|
+
] }),
|
|
2443
|
+
/* @__PURE__ */ h("ul", { className: "flex flex-col", children: y.map((m, f) => /* @__PURE__ */ h(
|
|
2441
2444
|
"li",
|
|
2442
2445
|
{
|
|
2443
2446
|
className: `w-full flex hover:bg-base-light ${m.path === location.pathname ? "bg-base-light" : ""} animated`,
|
|
2444
|
-
children: m.type !== "divider" &&
|
|
2445
|
-
|
|
2447
|
+
children: m.type !== "divider" && d ? /* @__PURE__ */ A(
|
|
2448
|
+
d,
|
|
2446
2449
|
{
|
|
2447
2450
|
"aria-disabled": !s,
|
|
2448
2451
|
to: m.path ?? `/${m.path}`,
|
|
@@ -2455,7 +2458,7 @@ function mn(e) {
|
|
|
2455
2458
|
}
|
|
2456
2459
|
) : /* @__PURE__ */ h("hr", { className: "border-border border-spacing-x-0.5 w-full" })
|
|
2457
2460
|
},
|
|
2458
|
-
`${m.page ??
|
|
2461
|
+
`${m.page ?? f}`
|
|
2459
2462
|
)) })
|
|
2460
2463
|
]
|
|
2461
2464
|
}
|
|
@@ -2502,14 +2505,14 @@ const Nr = (e) => {
|
|
|
2502
2505
|
isLoading: a = !1,
|
|
2503
2506
|
isAnimated: d = !0,
|
|
2504
2507
|
showBackButton: y = !1
|
|
2505
|
-
} = e, { t:
|
|
2508
|
+
} = e, { t: g } = D(), { countOfFilters: m } = _s(), f = De(() => {
|
|
2506
2509
|
const x = Array.isArray(r) ? [...r] : [];
|
|
2507
2510
|
if (c) {
|
|
2508
2511
|
const C = {
|
|
2509
2512
|
id: we.Refresh,
|
|
2510
2513
|
onClick: () => Se.invalidateQueries({ queryKey: c }),
|
|
2511
2514
|
icon: /* @__PURE__ */ h(ie, { icon: Mt }),
|
|
2512
|
-
tooltip:
|
|
2515
|
+
tooltip: g("_pages:common.actions.refresh.text")
|
|
2513
2516
|
};
|
|
2514
2517
|
x.unshift(C);
|
|
2515
2518
|
}
|
|
@@ -2529,15 +2532,15 @@ const Nr = (e) => {
|
|
|
2529
2532
|
children: /* @__PURE__ */ h(
|
|
2530
2533
|
Cs,
|
|
2531
2534
|
{
|
|
2532
|
-
className: `${
|
|
2533
|
-
count:
|
|
2535
|
+
className: `${m > 0 ? "show" : "hide"} `,
|
|
2536
|
+
count: m
|
|
2534
2537
|
}
|
|
2535
2538
|
)
|
|
2536
2539
|
};
|
|
2537
2540
|
x.push(C);
|
|
2538
2541
|
}
|
|
2539
2542
|
return x;
|
|
2540
|
-
}, [r, n,
|
|
2543
|
+
}, [r, n, m, i, c, g]);
|
|
2541
2544
|
return /* @__PURE__ */ A("main", { className: "", children: [
|
|
2542
2545
|
/* @__PURE__ */ A("div", { className: "flex flex-col", children: [
|
|
2543
2546
|
/* @__PURE__ */ h(
|
|
@@ -2635,23 +2638,23 @@ function bn(e) {
|
|
|
2635
2638
|
}
|
|
2636
2639
|
function pn() {
|
|
2637
2640
|
const { t: e } = D(), { notification: t, removeNotification: s } = ke(), [n, i] = X(/* @__PURE__ */ new Set()), r = F(
|
|
2638
|
-
(
|
|
2639
|
-
if (
|
|
2640
|
-
const
|
|
2641
|
-
i(
|
|
2641
|
+
(g) => {
|
|
2642
|
+
if (g === void 0) {
|
|
2643
|
+
const m = new Set(t.map((f, x) => x));
|
|
2644
|
+
i(m), window.setTimeout(() => s(), 300);
|
|
2642
2645
|
} else
|
|
2643
|
-
i((
|
|
2646
|
+
i((m) => new Set(m).add(g)), window.setTimeout(() => s(g), 300);
|
|
2644
2647
|
},
|
|
2645
2648
|
[t, s]
|
|
2646
|
-
), c = F((
|
|
2647
|
-
switch (
|
|
2649
|
+
), c = F((g) => {
|
|
2650
|
+
switch (g) {
|
|
2648
2651
|
case B.error:
|
|
2649
2652
|
return Is;
|
|
2650
2653
|
default:
|
|
2651
2654
|
return Os;
|
|
2652
2655
|
}
|
|
2653
|
-
}, []), a = F((
|
|
2654
|
-
switch (
|
|
2656
|
+
}, []), a = F((g) => {
|
|
2657
|
+
switch (g) {
|
|
2655
2658
|
case B.success:
|
|
2656
2659
|
return "!text-success";
|
|
2657
2660
|
case B.error:
|
|
@@ -2661,8 +2664,8 @@ function pn() {
|
|
|
2661
2664
|
default:
|
|
2662
2665
|
return "!text-info";
|
|
2663
2666
|
}
|
|
2664
|
-
}, []), d = F((
|
|
2665
|
-
switch (
|
|
2667
|
+
}, []), d = F((g) => {
|
|
2668
|
+
switch (g) {
|
|
2666
2669
|
case B.success:
|
|
2667
2670
|
return "bg-bg-success";
|
|
2668
2671
|
case B.error:
|
|
@@ -2677,12 +2680,12 @@ function pn() {
|
|
|
2677
2680
|
y.current = () => r();
|
|
2678
2681
|
}, [r]), te(() => {
|
|
2679
2682
|
if (!(t != null && t.length)) return;
|
|
2680
|
-
const
|
|
2683
|
+
const g = (m) => {
|
|
2681
2684
|
var f;
|
|
2682
|
-
return (f = y.current) == null ? void 0 : f.call(y,
|
|
2685
|
+
return (f = y.current) == null ? void 0 : f.call(y, m);
|
|
2683
2686
|
};
|
|
2684
|
-
return window.addEventListener("click",
|
|
2685
|
-
window.removeEventListener("click",
|
|
2687
|
+
return window.addEventListener("click", g), () => {
|
|
2688
|
+
window.removeEventListener("click", g);
|
|
2686
2689
|
};
|
|
2687
2690
|
}, [t == null ? void 0 : t.length]), te(() => {
|
|
2688
2691
|
i(/* @__PURE__ */ new Set());
|
|
@@ -2691,11 +2694,11 @@ function pn() {
|
|
|
2691
2694
|
"div",
|
|
2692
2695
|
{
|
|
2693
2696
|
className: `notification-portal ${t != null && t.length ? "w-screen h-screen" : ""}`,
|
|
2694
|
-
children: t != null && t.length ? t == null ? void 0 : t.map(({ id:
|
|
2697
|
+
children: t != null && t.length ? t == null ? void 0 : t.map(({ id: g, type: m, message: f }, x) => /* @__PURE__ */ A(
|
|
2695
2698
|
"div",
|
|
2696
2699
|
{
|
|
2697
2700
|
className: `notification ${n.has(x) ? "closing" : ""} ${d(
|
|
2698
|
-
|
|
2701
|
+
m ?? B.error
|
|
2699
2702
|
)}`,
|
|
2700
2703
|
onClick: (C) => C.stopPropagation(),
|
|
2701
2704
|
children: [
|
|
@@ -2703,15 +2706,15 @@ function pn() {
|
|
|
2703
2706
|
/* @__PURE__ */ h(
|
|
2704
2707
|
ie,
|
|
2705
2708
|
{
|
|
2706
|
-
icon: c(
|
|
2707
|
-
className: `${a(
|
|
2709
|
+
icon: c(m ?? B.error),
|
|
2710
|
+
className: `${a(m ?? B.error)}`
|
|
2708
2711
|
}
|
|
2709
2712
|
),
|
|
2710
2713
|
/* @__PURE__ */ h(
|
|
2711
2714
|
"p",
|
|
2712
2715
|
{
|
|
2713
2716
|
className: `whitespace-nowrap ${a(
|
|
2714
|
-
|
|
2717
|
+
m ?? B.error
|
|
2715
2718
|
)}`,
|
|
2716
2719
|
children: f
|
|
2717
2720
|
}
|
|
@@ -2728,7 +2731,7 @@ function pn() {
|
|
|
2728
2731
|
C.stopPropagation(), r(x);
|
|
2729
2732
|
},
|
|
2730
2733
|
iconClassName: `${a(
|
|
2731
|
-
|
|
2734
|
+
m ?? B.error
|
|
2732
2735
|
)} group-hover:!text-red-400 cursor-pointer`,
|
|
2733
2736
|
name: e("_accessibility:buttons.closeNotification"),
|
|
2734
2737
|
"aria-label": e("_accessibility:ariaLabels.closeNotification")
|
|
@@ -2736,7 +2739,7 @@ function pn() {
|
|
|
2736
2739
|
)
|
|
2737
2740
|
]
|
|
2738
2741
|
},
|
|
2739
|
-
|
|
2742
|
+
g
|
|
2740
2743
|
)) : null
|
|
2741
2744
|
}
|
|
2742
2745
|
),
|
|
@@ -2772,15 +2775,15 @@ const Er = (e) => {
|
|
|
2772
2775
|
"ul",
|
|
2773
2776
|
{
|
|
2774
2777
|
className: `horizontal tabs tabs-container ${i}`,
|
|
2775
|
-
children: t.map(({ id: y, to:
|
|
2778
|
+
children: t.map(({ id: y, to: g, label: m }) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ h(
|
|
2776
2779
|
Er,
|
|
2777
2780
|
{
|
|
2778
2781
|
onClick: () => c(y),
|
|
2779
2782
|
id: y,
|
|
2780
|
-
to:
|
|
2783
|
+
to: g ?? "",
|
|
2781
2784
|
siblings: t.length > 1,
|
|
2782
2785
|
active: r === y,
|
|
2783
|
-
children:
|
|
2786
|
+
children: m
|
|
2784
2787
|
}
|
|
2785
2788
|
) }, y))
|
|
2786
2789
|
}
|