@foris/avocado-not-front 5.0.4 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avocado-not-front.es.js +1208 -1126
- package/dist/avocado-not-front.umd.js +3 -3
- package/dist/components/chart/chart.constants.d.ts +5 -0
- package/dist/components/chart/chart.types.d.ts +25 -1
- package/dist/components/chart/chart.util.d.ts +18 -0
- package/dist/components/chart/charts/HorizontalBarChart.d.ts +2 -0
- package/dist/components/chart/charts/MixBarChart.d.ts +2 -0
- package/dist/components/chart/charts/index.d.ts +3 -1
- package/dist/components/chart/components/ChartFrame.d.ts +4 -1
- package/dist/components/chart/components/Tooltip.d.ts +3 -1
- package/dist/components/chart/components/XAxis.d.ts +3 -2
- package/dist/components/chart/components/YAxis.d.ts +7 -1
- package/dist/components/round-button/RoundButton.test.d.ts +1 -0
- package/dist/types/components.type.d.ts +17 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(A,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("axios"),require("zustand"),require("react"),require("@foris/avocado-suite"),require("@foris/ai-agent"),require("jsonpath"),require("recharts"),require("@uiw/react-codemirror"),require("@codemirror/lang-json"),require("@codemirror/lang-markdown"),require("@codemirror/lang-sql"),require("@codemirror/lang-yaml"),require("@foris/avocado-icons")):typeof define=="function"&&define.amd?define(["exports","axios","zustand","react","@foris/avocado-suite","@foris/ai-agent","jsonpath","recharts","@uiw/react-codemirror","@codemirror/lang-json","@codemirror/lang-markdown","@codemirror/lang-sql","@codemirror/lang-yaml","@foris/avocado-icons"],V):(A=typeof globalThis<"u"?globalThis:A||self,V(A["avocado-not-front"]={},A.axios,A.zustand,A.React,A.AvocadoSuite,A.AiAgent,A.jsonpath,A.Recharts,A.ReactCodeMirror,A.CodeMirrorLangJson,A.CodeMirrorLangMarkdown,A.CodeMirrorLangSql,A.CodeMirrorLangYaml,A.AvocadoIcons))})(this,(function(A,V,ce,x,w,ht,K,S,le,kt,ie,de,_e,Et){"use strict";const E=ce.create(()=>({})),dt=(t,e,s,r)=>{const l=s==null?void 0:s.hash,i=r&&Object.keys(r).length>0?{...r}:{};E.setState(c=>{var n;return{...c,[t]:{...c[t],apiConfig:e,currentPageId:l,isLoading:!1,isModalOpen:!0,isDrawerOpen:!1,entries:i,overlay:null,pages:{...(n=c[t])==null?void 0:n.pages,[l]:{page:s}}}}})},Tt=(t,e,s)=>{const r=s&&Object.keys(s).length>0?{...t,...s}:t;return e.length===0?t:Object.fromEntries(Object.entries(r).filter(([l])=>!e.includes(l)))},ue=(t,e,s,r,l)=>{sessionStorage.setItem("sessionId",s),E.setState(i=>{const c=i[t]??{},n=c.entries??{},d=Tt(n,r,l);return{...i,[t]:{...c,currentPageId:e.hash,entries:d,isLoading:!1,overlay:null,pages:{...c.pages,[e.hash]:{page:{...e}}}}}})},he=(t,e,s,r)=>{E.setState(l=>{var a;const i=l[t]??{},c=i.entries??{},n=Tt(c,s,r),d=(a=e.components)==null?void 0:a.some(_=>_.component==="drawer");return{...l,[t]:{...i,entries:n,overlay:e,isLoading:!1,isModalOpen:!d,isDrawerOpen:!!d}}})},ft=t=>{E.setState(e=>({...e,[t]:{...e[t],overlay:null}}))},fe=t=>{var s;return((s=E.getState()[t])==null?void 0:s.overlay)??null},M=(t,e)=>{const{content:s,sessionId:r,deprecatedStateKeys:l=[],sessionState:i}=e;s.type!=="page"&&s.type!=="overlay"||(s.type==="page"?ue(t,s,r,l,i):he(t,s,l,i))},L=(t,e)=>{E.setState(s=>{var r;return{...s,[t]:{...s[t],entries:{...(r=s[t])==null?void 0:r.entries,...e}}}})},me=(t,e)=>{E.setState(s=>{const r=s[t];if(!r)return s;const l=r.entries??{};if(!(e in l))return s;const{[e]:i,...c}=l;return{...s,[t]:{...r,entries:c}}})},W=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isLoading:e}}))},mt=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isModalOpen:e}}))},et=(t,e)=>{E.setState(s=>({...s,[t]:{...s[t],isDrawerOpen:e}}))},At=(t,e)=>{E.setState(s=>{const r=s[t];return r?{...s,[t]:{...r,apiConfig:{...r.apiConfig,headers:e}}}:s})};let gt=!1,_t=[],St=!1;const ge=t=>t._userFlow||null,vt=t=>{_t.forEach(({resolve:e,reject:s})=>{t?s(t):e(void 0)}),_t=[]},ye=async t=>{var r,l;const e=t==null?void 0:t.config;if(((r=t==null?void 0:t.response)==null?void 0:r.status)===401&&!e._retry){const i=ge(e);if(i){const n=(l=E.getState()[i])==null?void 0:l.apiConfig;if(!n)return Promise.reject(t);if(n.onAuthenticationError||typeof n.headers=="function"){if(gt)return new Promise((a,_)=>{_t.push({resolve:a,reject:_})}).then(()=>V(e)).catch(a=>(console.error("[axiosInterceptors] Queued request failed:",a),Promise.reject(a)));e._retry=!0,gt=!0;try{let a;if(n.onAuthenticationError)a=await n.onAuthenticationError();else if(typeof n.headers=="function")a=n.headers();else throw new Error("No refresh handler available");return n.onAuthenticationError&&(typeof n.headers=="string"?At(i,JSON.stringify(a)):At(i,a)),e.headers||(e.headers={}),Object.assign(e.headers,a),vt(null),V(e)}catch(a){return console.error("[axiosInterceptors] Token refresh failed:",a),console.error("[axiosInterceptors] Rejecting queued requests:",_t.length),vt(a),Promise.reject(a)}finally{gt=!1}}else console.warn("[axiosInterceptors] No refresh handler available, rejecting request")}else console.warn("[axiosInterceptors] No userFlow found in URL:",e.url)}return Promise.reject(t)};(()=>{if(St){console.debug("[axiosInterceptors] Interceptors already initialized, skipping");return}console.debug("[axiosInterceptors] Initializing interceptors..."),V.interceptors.response.use(void 0,ye),console.debug("[axiosInterceptors] Response error interceptor registered"),St=!0,console.debug("[axiosInterceptors] Interceptors initialized successfully")})();function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var yt={exports:{}},nt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var At;function be(){if(At)return tt;At=1;var t=x,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var _,u={},h=null,m=null;a!==void 0&&(h=""+a),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(m=d.ref);for(_ in d)r.call(d,_)&&!i.hasOwnProperty(_)&&(u[_]=d[_]);if(n&&n.defaultProps)for(_ in d=n.defaultProps,d)u[_]===void 0&&(u[_]=d[_]);return{$$typeof:e,type:n,key:h,ref:m,props:u,_owner:l.current}}return tt.Fragment=s,tt.jsx=c,tt.jsxs=c,tt}var Rt;function pe(){return Rt||(Rt=1,ht.exports=be()),ht.exports}var o=pe();const Dt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(w.Heading,{...e})},Lt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(w.Text,{...e})},O=(t,e,s,r)=>{var c;const l={accordion:n=>o.jsx(Te,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Se,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiChatPanel}),aiSummaryCard:n=>o.jsx(Re,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(ve,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Ie,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Ue,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(Kn,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(Xe,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(_n,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(fn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Ge,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(He,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(Ve,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx(ze,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx(We,{...n}),chart:n=>o.jsx(Wt,{...n,userFlow:t}),dataCard:n=>o.jsx(on,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(an,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(rn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(ln,{...n}),drawer:n=>o.jsx(dn,{...n,userFlow:t,pageId:e}),heading:n=>Dt(n),link:n=>o.jsx(hn,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(bn,{...n}),previewerMarkdown:n=>o.jsx(pn,{...n}),modal:n=>o.jsx(gn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Cn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(Yt,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(Sn,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(vn,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(On,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(In,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(Gn,{...n,userFlow:t,pageId:e}),text:n=>Lt(n),textField:n=>o.jsx(Un,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(Vn,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:t,pageId:e}):null})};function Ce(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function It(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const r=t==null?void 0:t[s.key];if(Ce(r))return!0}return!1}function B(t,e){const s=E(r=>{var l;return(l=r[t])==null?void 0:l.entries});return x.useMemo(()=>({disabled:It(s,e)}),[e,s])}const Q=t=>{if(!t)return{"content-type":"application/json"};if(typeof t=="function")return t();if(typeof t=="string")try{return JSON.parse(t)}catch{return{"content-type":"application/json",Authorization:t}}return t},et=()=>new AbortController,je=(t,e={},s={},r=!1,l)=>{const i=et();r&&i.abort();const c=Q(e);return{call:U.get(t,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},ft=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.post(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},we=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.put(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},Ne=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.patch(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},ke=(t,e={},s={},r={},l=!1,i)=>{const c=et();l&&c.abort();const n=Q(e);return{call:U.delete(t,{headers:{...n},data:s,params:r,signal:c.signal,_userFlow:i}),controller:c}},Mt=()=>{let t;return{callEndpoint:async r=>{r.controller&&(t=r.controller);let l={};try{l=await r.call}catch(i){throw i}return l},cancelEndpoint:()=>{t&&t.abort()}}},Bt=async(t,e,s="",r={},l={})=>{try{const{callEndpoint:i}=Mt(),{api:c,headers:n}=t,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:e});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const _=`${c}/not-front/next-ui/?${a.toString()}`,u=Q(n),h=ft(_,u,r,l,!1,e);return await i(h)}catch(i){return console.error(i),Promise.reject(i)}},Gt=t=>{const e=t==null?void 0:t.toLowerCase();switch(e){case"post":case"get":case"put":case"patch":case"delete":return e;default:return"get"}},Ee=(t,e,s)=>{const{url:r,paginationKeys:l,params:i}=t,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const _=(l==null?void 0:l.text)??"text";c.push(`${_}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const _=Object.entries(i).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(..._)}const d=c.join("&");return d?`${r}?${d}`:r},mt=(t,e,s,r)=>{const{type:l,url:i,method:c,headers:n}=t;if(l==="rest"){const d=Ee(t,e,s),_={...(t==null?void 0:t.data)??{},...r??{}};return{type:"rest",url:d,method:Gt(c),headers:n,data:_}}else return{type:"graphql",url:i,method:"post",headers:n,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof s=="string"?{text:s}:{},page:e}}},K=()=>{const t=E(n=>n),{callEndpoint:e}=Mt(),s=async(n,d,a,_,u=!0)=>{var h;try{const m=(h=t[n])==null?void 0:h.apiConfig,g={state:{...a},triggerKey:_};return u&&q(n,!0),await Bt(m,n,d,g)}catch(m){throw u&&q(n,!1),console.error("[getNextUI] Error fetching next UI:",m),m}},r=(n,d)=>{const{url:a,headers:_,data:u,params:h}=n;switch(Gt(n.method)){case"post":return ft(a,_,u,{},!1,d);case"put":return we(a,_,u,{},!1,d);case"patch":return Ne(a,_,u,{},!1,d);case"delete":return ke(a,_,u,h,!1,d);case"get":default:return je(a,_,h,!1,d)}},l=(n,d)=>{const{url:a,headers:_}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return ft(a,{..._,"Content-Type":"application/json"},u,{},!1,d)},i=async(n,d,a=!0)=>{var _,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&q(d,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=r(n,d);break;case"graphql":h=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const m=h;return console.error("[fetchDataSource] Error:",m),{status:((_=m==null?void 0:m.response)==null?void 0:_.status)??0,data:((u=m==null?void 0:m.response)==null?void 0:u.data)??{message:m==null?void 0:m.message,code:m==null?void 0:m.code,config:m==null?void 0:m.config}}}finally{a&&q(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,_,u)=>{try{q(n,!0);const h=await i(u,n,!1);return h&&await s(n,d,a,_)}catch(h){throw q(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Kt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Te=t=>{const{userFlow:e,pageId:s,responseKey:r,dependencies:l,customContent:i,actionContent:c,components:n,...d}=t,{getNextUI:a}=K(),[_,u]=x.useState(d.checkboxChecked||!1),{disabled:h}=B(e,l),m=O(e,s,n),g=c?O(e,s,c):void 0,b=i?O(e,s,i):void 0,y=x.useCallback(async C=>{var N;try{const j=C.target.checked;u(j);const k={...(N=E.getState()[e])==null?void 0:N.entries,[r]:j};if(A(e,k),d.actionType==="GO_TO_NEXT_UI"){const T=await a(e,s,k,r);T!=null&&T.data&&I(e,T==null?void 0:T.data)}}catch(j){console.error("Error in accordion checkbox action:",j),alert(JSON.stringify(j))}},[e,s,r,d.actionType,a]),f=d.disabled||h,p={...d,className:Kt.accordion,disabled:f,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?y:void 0,actionContent:g?o.jsx(o.Fragment,{children:g.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-action-${N}`))}):void 0,customContent:b?o.jsx(o.Fragment,{children:b.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-custom-${N}`))}):void 0,children:m?o.jsx("section",{className:Kt.accordionBody,children:m.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-child-${N}`))}):void 0};return o.jsx(w.Accordion,{...p})},Se=t=>{const e=w.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,r=x.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:s==null?void 0:s.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,s==null?void 0:s.data]),l=t.locale??"en",i=x.useMemo(()=>{var n,d,a,_,u;const c={title:(n=t==null?void 0:t.translations)==null?void 0:n.title,welcomeTitle:(d=t==null?void 0:t.translations)==null?void 0:d.welcomeTitle,welcomeDescription:(a=t==null?void 0:t.translations)==null?void 0:a.welcomeDescription,placeholder:(_=t==null?void 0:t.translations)==null?void 0:_.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,r,l,i,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(dt.ChatPanel,{dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},Oe={promptCodeEditor:"_promptCodeEditor_1d57s_1"},ve=t=>{const{userFlow:e,responseKey:s,codeBlockValue:r,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_}=t,u=w.ThemeStore.useThemeStore(C=>C.theme.mode),[h,m]=x.useState(r||""),{disabled:g}=B(e,c),b=i??g,y=l??"json",f={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=C=>{m(C);const N={[s]:C};A(e,N)};return x.useEffect(()=>{r!==void 0&&r!==h&&m(r)},[r]),o.jsx("section",{className:Oe.promptCodeEditor,children:o.jsx(dt.PromptCodeEditor,{themeMode:u,requestConfig:f,language:y,disabled:b,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_,codeBlockValue:h,onCodeChange:p})})},Ae={summaryCard:"_summaryCard_jva4h_1"},Re=t=>{const e=t.dataSource,s=x.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,body:e==null?void 0:e.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,e==null?void 0:e.data]),r=t.locale??"en",l=x.useMemo(()=>{var c,n,d;const i={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(d=t==null?void 0:t.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:r,translations:l})},[t.onResolveProps,s,r,l]),t.onResolveProps?null:o.jsx("section",{className:Ae.summaryCard,children:o.jsx(dt.SummaryCard,{dataSource:s,locale:r,translations:l})})},Ht={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},De=({inputs:t})=>o.jsx("section",{className:Ht.body,children:o.jsx("div",{className:Ht.body_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),Le={slotStack:"_slotStack_1b4wy_1"},Ie=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c}=t,n=w.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=O(e,s,c!=null&&c.length?c:null),a=d&&d.length>0?o.jsx("div",{className:Le.slotStack,children:d.map((_,u)=>o.jsx(x.Fragment,{children:_},`box-${l}-${u}`))}):null;return o.jsx(w.Box,{darkMode:n,children:a})};var gt={exports:{}};/*!
|
|
9
|
+
*/var Ot;function be(){if(Ot)return nt;Ot=1;var t=x,e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,l=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(n,d,a){var _,u={},h=null,f=null;a!==void 0&&(h=""+a),d.key!==void 0&&(h=""+d.key),d.ref!==void 0&&(f=d.ref);for(_ in d)r.call(d,_)&&!i.hasOwnProperty(_)&&(u[_]=d[_]);if(n&&n.defaultProps)for(_ in d=n.defaultProps,d)u[_]===void 0&&(u[_]=d[_]);return{$$typeof:e,type:n,key:h,ref:f,props:u,_owner:l.current}}return nt.Fragment=s,nt.jsx=c,nt.jsxs=c,nt}var Rt;function pe(){return Rt||(Rt=1,yt.exports=be()),yt.exports}var o=pe();const Dt=t=>{if(!(t!=null&&t.content))return null;const e={...t,children:t.content,type:t.variant};return o.jsx(w.Heading,{...e})},Lt=t=>{if(!t)return null;const e={...t,children:t.content};return o.jsx(w.Text,{...e})},v=(t,e,s,r)=>{var c;const l={accordion:n=>o.jsx(Te,{...n,userFlow:t,pageId:e}),aiChatPanel:n=>o.jsx(Ae,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiChatPanel}),aiSummaryCard:n=>o.jsx(Re,{...n,userFlow:t,pageId:e,onResolveProps:r==null?void 0:r.aiSummaryCard}),aiPromptCodeEditor:n=>o.jsx(ve,{...n,userFlow:t,pageId:e}),box:n=>o.jsx(Ie,{...n,userFlow:t,pageId:e}),breadcrumbs:n=>o.jsx(Ue,{...n,userFlow:t,pageId:e}),tooltip:n=>o.jsx(Fn,{...n,userFlow:t,pageId:e}),textarea:n=>o.jsx(qn,{...n,userFlow:t,pageId:e}),card:n=>o.jsx(Je,{...n,userFlow:t,pageId:e}),dropdownButton:n=>o.jsx(bn,{...n,userFlow:t,pageId:e}),menu:n=>o.jsx(jn,{...n,userFlow:t,pageId:e}),radioGroup:n=>o.jsx(Ke,{...n,userFlow:t,pageId:e}),stepper:n=>o.jsx(Ge,{...n,userFlow:t,pageId:e}),progressBar:n=>o.jsx(He,{...n,userFlow:t,pageId:e}),button:n=>o.jsx(Ve,{...n,userFlow:t,pageId:e}),cardAccordion:n=>o.jsx(ze,{...n,userFlow:t,pageId:e}),cardNotification:n=>o.jsx(We,{...n}),chart:n=>o.jsx(Wt,{...n,userFlow:t}),dataCard:n=>o.jsx(mn,{...n,userFlow:t,pageId:e}),checkbox:n=>o.jsx(hn,{...n,userFlow:t,pageId:e}),code:n=>o.jsx(fn,{...n,userFlow:t,pageId:e}),divider:n=>o.jsx(yn,{...n}),drawer:n=>o.jsx(xn,{...n,userFlow:t,pageId:e}),heading:n=>Dt(n),link:n=>o.jsx(Cn,{...n,userFlow:t,pageId:e}),pill:n=>o.jsx(Tn,{...n}),previewerMarkdown:n=>o.jsx(An,{...n}),modal:n=>o.jsx(Nn,{...n,userFlow:t,pageId:e}),roundButton:n=>o.jsx(Sn,{...n,userFlow:t,pageId:e}),row:n=>o.jsx(Qt,{...n,userFlow:t,pageId:e}),select:n=>o.jsx(Mn,{...n,userFlow:t,pageId:e}),switch:n=>o.jsx(Kn,{...n,userFlow:t,pageId:e}),spacing:n=>o.jsx(Bn,{...n,userFlow:t,pageId:e}),table:n=>o.jsx(zn,{...n,userFlow:t,pageId:e}),tabs:n=>o.jsx(Wn,{...n,userFlow:t,pageId:e}),text:n=>Lt(n),textField:n=>o.jsx(Qn,{...n,userFlow:t,pageId:e}),toast:n=>o.jsx(Zn,{...n,userFlow:t,pageId:e})};return(c=s==null?void 0:s.filter(Boolean))==null?void 0:c.map(n=>{const d=l[n.component];return d?d({...n,userFlow:t,pageId:e}):null})};function Ce(t){return!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)}function It(t,e){if(!(e!=null&&e.length))return!1;for(const s of e)if(s.when==="empty"){const r=t==null?void 0:t[s.key];if(Ce(r))return!0}return!1}function B(t,e){const s=E(r=>{var l;return(l=r[t])==null?void 0:l.entries});return x.useMemo(()=>({disabled:It(s,e)}),[e,s])}const q=t=>{if(!t)return{"content-type":"application/json"};if(typeof t=="function")return t();if(typeof t=="string")try{return JSON.parse(t)}catch{return{"content-type":"application/json",Authorization:t}}return t},st=()=>new AbortController,je=(t,e={},s={},r=!1,l)=>{const i=st();r&&i.abort();const c=q(e);return{call:V.get(t,{headers:{...c},params:s,signal:i.signal,_userFlow:l}),controller:i}},xt=(t,e={},s={},r={},l=!1,i)=>{const c=st();l&&c.abort();const n=q(e);return{call:V.post(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},we=(t,e={},s={},r={},l=!1,i)=>{const c=st();l&&c.abort();const n=q(e);return{call:V.put(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},Ne=(t,e={},s={},r={},l=!1,i)=>{const c=st();l&&c.abort();const n=q(e);return{call:V.patch(t,s,{headers:{...n},params:r,signal:c.signal,_userFlow:i}),controller:c}},ke=(t,e={},s={},r={},l=!1,i)=>{const c=st();l&&c.abort();const n=q(e);return{call:V.delete(t,{headers:{...n},data:s,params:r,signal:c.signal,_userFlow:i}),controller:c}},Mt=()=>{let t;return{callEndpoint:async r=>{r.controller&&(t=r.controller);let l={};try{l=await r.call}catch(i){throw i}return l},cancelEndpoint:()=>{t&&t.abort()}}},Bt=async(t,e,s="",r={},l={})=>{try{const{callEndpoint:i}=Mt(),{api:c,headers:n}=t,d=sessionStorage.getItem("sessionId"),a=new URLSearchParams({session_name:e});s&&a.append("hash_code",s),d&&a.append("sessionId",d);const _=`${c}/not-front/next-ui/?${a.toString()}`,u=q(n),h=xt(_,u,r,l,!1,e);return await i(h)}catch(i){return console.error(i),Promise.reject(i)}},Kt=t=>{const e=t==null?void 0:t.toLowerCase();switch(e){case"post":case"get":case"put":case"patch":case"delete":return e;default:return"get"}},Ee=(t,e,s)=>{const{url:r,paginationKeys:l,params:i}=t,c=[],n=(l==null?void 0:l.page)??"page";if(c.push(`${n}=${e}`),typeof s=="string"){const _=(l==null?void 0:l.text)??"text";c.push(`${_}=${encodeURIComponent(s||"")}`)}if(i&&typeof i=="object"){const _=Object.entries(i).map(([u,h])=>`${encodeURIComponent(u)}=${encodeURIComponent(h)}`);c.push(..._)}const d=c.join("&");return d?`${r}?${d}`:r},bt=(t,e,s,r)=>{const{type:l,url:i,method:c,headers:n}=t;if(l==="rest"){const d=Ee(t,e,s),_={...(t==null?void 0:t.data)??{},...r??{}};return{type:"rest",url:d,method:Kt(c),headers:n,data:_}}else return{type:"graphql",url:i,method:"post",headers:n,query:t==null?void 0:t.query,variables:{...(t==null?void 0:t.variables)||{},...typeof s=="string"?{text:s}:{},page:e}}},U=()=>{const t=E(n=>n),{callEndpoint:e}=Mt(),s=async(n,d,a,_,u=!0)=>{var h;try{const f=(h=t[n])==null?void 0:h.apiConfig,g={state:{...a},triggerKey:_};return u&&W(n,!0),await Bt(f,n,d,g)}catch(f){throw u&&W(n,!1),console.error("[getNextUI] Error fetching next UI:",f),f}},r=(n,d)=>{const{url:a,headers:_,data:u,params:h}=n;switch(Kt(n.method)){case"post":return xt(a,_,u,{},!1,d);case"put":return we(a,_,u,{},!1,d);case"patch":return Ne(a,_,u,{},!1,d);case"delete":return ke(a,_,u,h,!1,d);case"get":default:return je(a,_,h,!1,d)}},l=(n,d)=>{const{url:a,headers:_}=n,u={query:n==null?void 0:n.query,variables:(n==null?void 0:n.variables)||{}};return xt(a,{..._,"Content-Type":"application/json"},u,{},!1,d)},i=async(n,d,a=!0)=>{var _,u;if(!n){console.warn("[fetchDataSource] Invalid or missing dataSource");return}a&&W(d,!0);try{let h;switch(n==null?void 0:n.type){case"rest":h=r(n,d);break;case"graphql":h=l(n,d);break;default:throw new Error("[fetchDataSource] Unsupported data source type")}return await e(h)}catch(h){const f=h;return console.error("[fetchDataSource] Error:",f),{status:((_=f==null?void 0:f.response)==null?void 0:_.status)??0,data:((u=f==null?void 0:f.response)==null?void 0:u.data)??{message:f==null?void 0:f.message,code:f==null?void 0:f.code,config:f==null?void 0:f.config}}}finally{a&&W(d,!1)}};return{getNextUI:s,fetchDataSource:i,fetchAndGetNextUI:async(n,d,a,_,u)=>{try{W(n,!0);const h=await i(u,n,!1);return h&&await s(n,d,a,_)}catch(h){throw W(n,!1),console.error("[fetchAndGetNextUI] Error fetching and navigating:",h),h}}}},Gt={accordion:"_accordion_1ri2t_1",accordionBody:"_accordionBody_1ri2t_8"},Te=t=>{const{userFlow:e,pageId:s,responseKey:r,dependencies:l,customContent:i,actionContent:c,components:n,...d}=t,{getNextUI:a}=U(),[_,u]=x.useState(d.checkboxChecked||!1),{disabled:h}=B(e,l),f=v(e,s,n),g=c?v(e,s,c):void 0,b=i?v(e,s,i):void 0,y=x.useCallback(async C=>{var N;try{const j=C.target.checked;u(j);const k={...(N=E.getState()[e])==null?void 0:N.entries,[r]:j};if(L(e,k),d.actionType==="GO_TO_NEXT_UI"){const T=await a(e,s,k,r);T!=null&&T.data&&M(e,T==null?void 0:T.data)}}catch(j){console.error("Error in accordion checkbox action:",j),alert(JSON.stringify(j))}},[e,s,r,d.actionType,a]),m=d.disabled||h,p={...d,className:Gt.accordion,disabled:m,checkboxChecked:_,onChanceCheckbox:d.hasCheckbox?y:void 0,actionContent:g?o.jsx(o.Fragment,{children:g.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-action-${N}`))}):void 0,customContent:b?o.jsx(o.Fragment,{children:b.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-custom-${N}`))}):void 0,children:f?o.jsx("section",{className:Gt.accordionBody,children:f.map((C,N)=>o.jsx(x.Fragment,{children:C},`accordion-child-${N}`))}):void 0};return o.jsx(w.Accordion,{...p})},Ae=t=>{const e=w.ThemeStore.useThemeStore(c=>c.theme.mode),s=t.dataSource,r=x.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,params:s==null?void 0:s.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,s==null?void 0:s.data]),l=t.locale??"en",i=x.useMemo(()=>{var n,d,a,_,u;const c={title:(n=t==null?void 0:t.translations)==null?void 0:n.title,welcomeTitle:(d=t==null?void 0:t.translations)==null?void 0:d.welcomeTitle,welcomeDescription:(a=t==null?void 0:t.translations)==null?void 0:a.welcomeDescription,placeholder:(_=t==null?void 0:t.translations)==null?void 0:_.placeholder,disclaimer:(u=t==null?void 0:t.translations)==null?void 0:u.disclaimer};return Object.fromEntries(Object.entries(c).filter(([,h])=>!!h))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},[t.onResolveProps,r,l,i,t.initialSuggestions,e]),t.onResolveProps?null:o.jsx(ht.ChatPanel,{dataSource:r,locale:l,translations:i,initialSuggestions:t.initialSuggestions,theme:e})},Se={promptCodeEditor:"_promptCodeEditor_1d57s_1"},ve=t=>{const{userFlow:e,responseKey:s,codeBlockValue:r,language:l,disabled:i,dependencies:c,dataSource:n,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_}=t,u=w.ThemeStore.useThemeStore(C=>C.theme.mode),[h,f]=x.useState(r||""),{disabled:g}=B(e,c),b=i??g,y=l??"json",m={url:(n==null?void 0:n.url)||"",method:(n==null?void 0:n.method)||"post",headers:n==null?void 0:n.headers,body:n==null?void 0:n.data},p=C=>{f(C);const N={[s]:C};L(e,N)};return x.useEffect(()=>{r!==void 0&&r!==h&&f(r)},[r]),o.jsx("section",{className:Se.promptCodeEditor,children:o.jsx(ht.PromptCodeEditor,{themeMode:u,requestConfig:m,language:y,disabled:b,inputLabel:d,inputPlaceholder:a,codeBlockLabel:_,codeBlockValue:h,onCodeChange:p})})},Oe={summaryCard:"_summaryCard_jva4h_1"},Re=t=>{const e=t.dataSource,s=x.useMemo(()=>({url:t.dataSource.url,method:t.dataSource.method,headers:t.dataSource.headers,body:e==null?void 0:e.data}),[t.dataSource.url,t.dataSource.method,t.dataSource.headers,e==null?void 0:e.data]),r=t.locale??"en",l=x.useMemo(()=>{var c,n,d;const i={title:(c=t==null?void 0:t.translations)==null?void 0:c.title,loading:(n=t==null?void 0:t.translations)==null?void 0:n.loading,noData:(d=t==null?void 0:t.translations)==null?void 0:d.noData};return Object.fromEntries(Object.entries(i).filter(([,a])=>!!a))},[t==null?void 0:t.translations]);return x.useEffect(()=>{t.onResolveProps&&t.onResolveProps({dataSource:s,locale:r,translations:l})},[t.onResolveProps,s,r,l]),t.onResolveProps?null:o.jsx("section",{className:Oe.summaryCard,children:o.jsx(ht.SummaryCard,{dataSource:s,locale:r,translations:l})})},Ht={body:"_body_14tsv_1",body_content:"_body_content_14tsv_5"},De=({inputs:t})=>o.jsx("section",{className:Ht.body,children:o.jsx("div",{className:Ht.body_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),Le={slotStack:"_slotStack_1b4wy_1"},Ie=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c}=t,n=w.ThemeStore.useThemeStore(_=>_.theme.mode)==="dark",d=v(e,s,c!=null&&c.length?c:null),a=d&&d.length>0?o.jsx("div",{className:Le.slotStack,children:d.map((_,u)=>o.jsx(x.Fragment,{children:_},`box-${l}-${u}`))}):null;return o.jsx(w.Box,{darkMode:n,children:a})};var pt={exports:{}};/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
12
12
|
http://jedwatson.github.io/classnames
|
|
13
|
-
*/var Ut;function Me(){return Ut||(Ut=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var r=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&r.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var d in i)e.call(i,d)&&i[d]&&r.push(d)}}}return r.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(gt)),gt.exports}var Be=Me();const Y=xe(Be),Z={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Ge=t=>{const{userFlow:e,pageId:s,responseKey:r,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:_}=t,u=a==="column"?"column":"row",{getNextUI:h}=K(),{disabled:m}=B(e,d),g=E(C=>{var N,j;return(j=(N=C[e])==null?void 0:N.entries)==null?void 0:j[r]}),b=g!=null?String(g):i??"",y=m,f=x.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=x.useCallback(async C=>{var N;if(!y)try{const j={...(N=E.getState()[e])==null?void 0:N.entries,[r]:C};if(A(e,j),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const R=await h(e,s,j,r,n==="GO_TO_NEXT_UI");R!=null&&R.data&&I(e,R==null?void 0:R.data)}}catch(j){alert(JSON.stringify(j))}},[n,h,y,s,r,e]);return o.jsxs("fieldset",{className:Y(Z.fieldset,u==="column"&&Z.fieldsetColumn),children:[f?o.jsx("legend",{className:Z.legend,children:f}):null,o.jsx("div",{className:Y(Z.options,u==="column"?Z.optionsColumn:Z.optionsRow),children:_.map(C=>o.jsx(w.RadioButton,{name:r,value:C.value,checked:b===C.value,disabled:y||C.disabled,labelRight:C.label,onChange:()=>{p(C.value)}},C.value))})]})},Ke=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,items:i,itemActive:c,darkMode:n})=>o.jsx(w.Stepper,{items:i,itemActive:c,darkMode:n}),He=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,total:i,done:c,inProgress:n})=>o.jsx(w.ProgressBar,{total:i,done:c,inProgress:n}),Ue=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:r}=K(),l=x.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const _=await r(t,n,{...(a=E.getState()[t])==null?void 0:a.entries},s);_!=null&&_.data&&I(t,_==null?void 0:_.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(_){alert(JSON.stringify(_))}},[]),i=x.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>l(c)})})),[]);return o.jsx(w.Breadcrumbs,{items:i})};function yt(t,e){const{getNextUI:s,fetchDataSource:r,fetchAndGetNextUI:l}=K();return x.useCallback(async i=>{var h,m,g,b;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:_}=i,u=(h=E.getState()[t])==null?void 0:h.entries;if(!It(u,_))try{const y={...(m=E.getState()[t])==null?void 0:m.entries,[c]:{status:200}};switch(A(t,y),n){case"CLOSE_MODAL":rt(t,!1);break;case"CLOSE_DRAWER":W(t,!1);break;case"OPEN_DRAWER":W(t,!0);break;case"GO_TO_NEXT_UI":{const f=await s(t,e,y,c);f!=null&&f.data&&I(t,f==null?void 0:f.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const f=await l(t,e,y,c,d);f!=null&&f.data&&I(t,f==null?void 0:f.data);break}case"FETCH_DATA_SOURCE":{const f=await r(d,t,!1);A(t,{[c]:{status:f==null?void 0:f.status,content:f==null?void 0:f.data}});break}case"GET_DATA_SOURCE":{const f=await s(t,e,y,c),p=(g=f==null?void 0:f.data)==null?void 0:g.content;if((p==null?void 0:p.type)!=="fetch")break;const C=p==null?void 0:p.dataSource,N=await r(C,t,!1),j={...(b=E.getState()[t])==null?void 0:b.entries,[c]:{status:N==null?void 0:N.status,content:N==null?void 0:N.data}};A(t,j);const k=await s(t,e,j,c);k!=null&&k.data&&I(t,k==null?void 0:k.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(y){alert(JSON.stringify(y))}},[l,r,s,e,t])}const Ve=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:_,...u}=t,h=yt(e,s),{disabled:m}=B(e,a),g={...u,children:c??i},b=(g==null?void 0:g.disabled)??m,[y,f]=x.useState(!1),p=x.useRef(!1),C=x.useCallback(async()=>{if(p.current)return;const N=l==="FETCH_DATA_SOURCE";N&&(p.current=!0,f(!0));try{await h({responseKey:r,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})}catch(j){console.error("[ButtonNotFront] Action failed:",j)}finally{N&&(p.current=!1,f(!1))}},[l,n,a,d,r,h]);return o.jsx(w.Button,{...g,loading:g.loading||y,disabled:b,onClick:()=>!b&&!y&&(_??C)()})},Vt={slotStack:"_slotStack_12u4t_5"},ze=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=t,{disabled:_}=B(e,c),u=O(e,s,n&&n.length>0?n:null),h=O(e,s,d&&d.length>0?d:null),m=u&&u.length>0?o.jsx("div",{className:Vt.slotStack,children:u.map((y,f)=>o.jsx(x.Fragment,{children:y},`card-accordion-body-${l}-${f}`))}):void 0,g=h&&h.length>0?o.jsx("div",{className:Vt.slotStack,children:h.map((y,f)=>o.jsx(x.Fragment,{children:y},`card-accordion-actions-${l}-${f}`))}):void 0,b=a.disabled||_;return o.jsx(w.CardAccordion,{...a,disabled:b,actionContent:g,children:m??null})},Je={slotStack:"_slotStack_ivk5b_1"},Xe=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:_,redirectUrl:u,dependencies:h}=t,{getNextUI:m,fetchDataSource:g,fetchAndGetNextUI:b}=K(),{disabled:y}=B(e,h),f=d??y,p=O(e,s,c&&c.length>0?c:null),C=p&&p.length>0?o.jsx("div",{className:Je.slotStack,children:p.map((j,k)=>o.jsx(x.Fragment,{children:j},`card-body-${l}-${k}`))}):null,N=x.useCallback(async()=>{var j,k,T;if(!(!a||f))try{const R={...(j=E.getState()[e])==null?void 0:j.entries,[i]:{status:200}};switch(A(e,R),a){case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const M=await m(e,s,R,i,a==="GO_TO_NEXT_UI");M!=null&&M.data&&I(e,M==null?void 0:M.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const D=await b(e,s,R,i,_);D!=null&&D.data&&I(e,D==null?void 0:D.data);break}case"GET_DATA_SOURCE":{const D=await m(e,s,R,i),M=(k=D==null?void 0:D.data)==null?void 0:k.content;if((M==null?void 0:M.type)!=="fetch")break;const P=M==null?void 0:M.dataSource,z=await g(P,e,!1),v={...(T=E.getState()[e])==null?void 0:T.entries,[i]:{status:z==null?void 0:z.status,content:z==null?void 0:z.data}};A(e,v);const H=await m(e,s,v,i);H!=null&&H.data&&I(e,H==null?void 0:H.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(R){alert(JSON.stringify(R))}},[a,_,f,b,g,m,s,u,i,e]);return o.jsx(w.Card,{colorId:n,disabled:f,onClick:a&&!f?()=>void N():void 0,children:C})},We=t=>{const{content:e,description:s,...r}=t,l={...r,children:e??s};return o.jsx(w.CardNotification,{...l})},xt=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,qe=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:r}=e,l=G.value(t,s);if(l==null)return null;try{const i={};return G.value(i,r,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",r,i),null}},zt=(t,e,s,r)=>{const l=G.query(t,e),i=l==null?void 0:l.map(a=>{var _,u;if(s){const h={};for(const[m,g]of Object.entries(s))if(typeof g=="object"&&"path"in g){const b=g,y=(_=G.query(a,b.path))==null?void 0:_[0];b.translations&&String(y)in b.translations?h[m]=xt(b.translations[String(y)]):h[m]=xt(y)}else{const b=g;h[m]=xt((u=G.query(a,b))==null?void 0:u[0])}return h}else return a}),c=G.value(t,(r==null?void 0:r.size)??"$.meta.size")??l.length,n=G.value(t,(r==null?void 0:r.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:r!=null&&r.totalPages?G.value(t,(r==null?void 0:r.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},bt=({width:t,data:e,Chart:s,children:r})=>t?o.jsx(s,{width:t,height:it,data:e,children:r}):o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsx(s,{data:e,children:r})}),ct=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:V.labelColor},children:s});return o.jsx(L.Legend,{formatter:e,wrapperStyle:{fontSize:V.fontSize,fontFamily:V.fontFamily,padding:t?"1rem 0":"0"}})},Qe=({active:t,payload:e,label:s,tooltipKey:r})=>{var i;if(!t||!e||!e.length)return null;const l={backgroundColor:V.tooltipBg,borderRadius:V.tooltipBorderRadius,color:V.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(r){const c=(i=e[0])==null?void 0:i.payload;if(c&&c[r]!==void 0&&c[r]!==null)return o.jsx("div",{style:l,children:o.jsx("p",{style:{margin:0},children:c[r]})})}return o.jsxs("div",{style:l,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((c,n)=>o.jsx("p",{style:{margin:"2px 0",color:c.color},children:`${c.name}: ${c.value}`},n))]})},lt=({tooltipKey:t}={})=>o.jsx(L.Tooltip,{content:o.jsx(Qe,{tooltipKey:t})}),pt=({dataKey:t,hide:e=!1})=>o.jsx(L.XAxis,{dataKey:t,hide:e,tick:{fill:V.labelColor,fontSize:V.fontSize}}),Ct=()=>o.jsx(L.YAxis,{tick:{fill:V.labelColor,fontSize:V.fontSize}}),Ye=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.AreaChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Area,{type:"monotone",dataKey:c,stroke:J[n%J.length],fill:J[n%J.length]},c))]})},Ze=t=>{const{data:e,yKeys:s,xKey:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.BarChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:r}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),s.map((c,n)=>o.jsx(L.Bar,{dataKey:c,fill:J[n%J.length]},c))]})},Fe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(bt,{width:i,data:e,Chart:L.LineChart,children:[o.jsx(L.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(pt,{dataKey:s}),o.jsx(Ct,{}),o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),r.map((c,n)=>o.jsx(L.Line,{type:"monotone",dataKey:c,stroke:J[n%J.length],strokeWidth:2,dot:!1},c))]})},Pe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l}=t,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:_,value:u})=>{const h=Math.PI/180,m=25+a+(_-a),g=c+m*Math.cos(-(d??0)*h),b=n+m*Math.sin(-(d??0)*h);return o.jsx("text",{x:g,y:b,fill:V.labelColor,color:V.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(L.ResponsiveContainer,{width:"100%",height:it,children:o.jsxs(L.PieChart,{children:[o.jsx(lt,{tooltipKey:l}),o.jsx(ct,{}),o.jsx(L.Pie,{data:e,dataKey:r[0],nameKey:s,label:i,outerRadius:120,children:e.map((c,n)=>o.jsx(L.Cell,{fill:J[n%J.length]},`cell-${n}`))})]})})},it=400,Jt=56,$e=new Set(["bar","line","area"]),tn={area:Ye,bar:Ze,line:Fe,pie:Pe},J=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],V={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"};function en(t,e,s=Jt){return t<=0?0:e<=0?t:Math.max(t,e*s)}const Xt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},nn="Scrollable chart area",sn=({dataLength:t,minCategoryWidth:e,children:s})=>{const r=x.useRef(null),[l,i]=x.useState(0),c=e??Jt;x.useEffect(()=>{const _=r.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=en(l,t,c),d=l>0&&n>l,a=x.useCallback(_=>{const u=r.current;if(u)switch(_.key){case"ArrowLeft":u.scrollLeft-=c,_.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,_.preventDefault();break;case"Home":u.scrollLeft=0,_.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,_.preventDefault();break}},[c]);return o.jsx("div",{ref:r,className:Xt.chartScrollViewport,role:d?"region":void 0,tabIndex:d?0:void 0,"aria-label":d?nn:void 0,onKeyDown:d?a:void 0,children:o.jsx("div",{className:Xt.chartScrollViewport_track,style:{width:n,height:it},children:l>0?s(n):null})})},Wt=t=>{const{component:e,userFlow:s,hash:r,responseKey:l,dataSource:i,...c}=t,n=tn[c.type],{fetchDataSource:d}=K(),[a,_]=x.useState(!1),[u,h]=x.useState([]),m=async()=>{var y,f;try{_(!0);const{jsonPathData:p,mapperData:C}=i,N=mt(i,1),j=await d(N,s,!1),k=p?(y=zt(j==null?void 0:j.data,p,C))==null?void 0:y.items:(f=j==null?void 0:j.data)==null?void 0:f.data;h(k),_(!1)}catch(p){alert(JSON.stringify(p)),_(!1)}};if(x.useEffect(()=>{n&&(i?m():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const g={...c,data:u};return a?o.jsx(w.SkeletonBase,{height:400}):u.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):$e.has(c.type)?o.jsx(sn,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:y=>o.jsx(n,{...g,width:y})}):o.jsx(n,{...g})},an=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,m]=x.useState(c||!1),{disabled:g}=B(e,d),b=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),y=x.useCallback(async()=>{var p;try{const C=!h;m(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]),f=(_==null?void 0:_.disabled)??g;return o.jsx(w.Checkbox,{..._,labelRight:b,checked:h,disabled:f,onChange:()=>{!f&&y()}})},F={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},rn=t=>{const{userFlow:e,responseKey:s,label:r,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:_,height:u="400px"}=t,[h,m]=x.useState(c??""),g=w.ThemeStore.useThemeStore(N=>N.theme.mode),{disabled:b}=B(e,d),y=a??b,f={json:kt.json(),markdown:ie.markdown(),sql:de.sql(),yaml:_e.yaml()},p=x.useMemo(()=>n&&r?`${r} *`:r??"",[r,n]),C=N=>{m(N);const j={[s]:N};A(e,j)};return o.jsxs("div",{className:F.codeEditor,children:[p&&p!==""&&o.jsx("label",{className:F.codeEditor_label,children:p}),o.jsxs("div",{className:F.codeEditor_wrapper,children:[o.jsx(le,{className:F.input,value:h,height:u,placeholder:i,extensions:[f[l]??kt.json()],onChange:N=>C(N),theme:g,editable:!y}),l==="markdown"&&_&&o.jsx("div",{className:F.preview,style:{height:u},children:o.jsx(w.PreviewerMarkdown,{className:F.preview_inner,children:h})})]})]})},qt={slotStack:"_slotStack_6n2wy_5"},on=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,..._}=t,u=a?`palette_${a}_50`:void 0,h=O(e,s,c&&c.length>0?c:null),m=O(e,s,n&&n.length>0?n:null),g=h&&h.length>0?o.jsx("div",{className:qt.slotStack,children:h.map((y,f)=>o.jsx(x.Fragment,{children:y},`data-card-body-${l}-${f}`))}):void 0,b=m&&m.length>0?o.jsx("div",{className:qt.slotStack,children:m.map((y,f)=>o.jsx(x.Fragment,{children:y},`data-card-top-${l}-${f}`))}):void 0;return o.jsx(w.DataCard,{..._,icon:d,headerStatusColor:u,topContent:b,children:g})},cn={dividerNotFront:"_dividerNotFront_tze3j_1"},ln=t=>o.jsx(w.Divider,{...t,className:cn.dividerNotFront}),jt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},dn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,...c})=>{const n=E(y=>{var f;return(f=y[t])==null?void 0:f.isDrawerOpen}),d=E(y=>{var f;return(f=y[t])==null?void 0:f.isLoading}),a=n&&!d,_={...c,isOpen:a,children:null},u=x.useCallback(()=>{_t(t),W(t,!1)},[t]),h=Array.isArray(r)?O(t,e,r):r?o.jsx(w.Heading,{type:"h2",children:r}):void 0,m=O(t,e,l),g=i?O(t,e,i):void 0;return o.jsx(w.Drawer,{..._,className:jt.drawer,isOpen:a,onClose:u,heightGap:50,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-header-${f}`)):h}):void 0,children:o.jsx("section",{className:jt.drawerBody,children:m.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-body-${f}`))}),footer:g?o.jsx("div",{className:jt.drawerFooter,children:g.map((y,f)=>o.jsx(x.Fragment,{children:y},`drawer-footer-${f}`))}):void 0})},_n=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:_,rightIcon:u}=t,h=yt(e,s),m=x.useMemo(()=>n.map(g=>({label:g.content??g.label??"",onClick:()=>{h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[n,h]);return o.jsx(w.DropdownButton,{disabled:d,variant:a,items:m,children:o.jsxs(x.Fragment,{children:[_?o.jsx(Et.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(Et.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Qt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},un=({components:t=[]})=>o.jsx("section",{className:Y(Qt.header,"avocado-dark-theme"),children:o.jsx("div",{className:Qt.header_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),hn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:_,...u}=t,{getNextUI:h}=K(),{disabled:m}=B(e,d),g=l&&u?(()=>{const{href:f,target:p,download:C,...N}=u;return N})():u,b=x.useCallback(async()=>{var f;if(l)try{const p={...(f=E.getState()[e])==null?void 0:f.entries,[r]:{status:200}};switch(A(e,p),l){case"GO_TO_NEXT_UI":{const C=await h(e,s,p,r);C!=null&&C.data&&I(e,C==null?void 0:C.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,h,s,c,r,n,e]),y=g.disabled??m;return o.jsx(w.Link,{...g,disabled:y,onClick:l?b:void 0,children:i})},fn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u}=t,h=yt(e,s),m=x.useMemo(()=>c.map(g=>({icon:g.leftIcon,label:g.content??g.label??"",onClick:b=>{var y;(y=b==null?void 0:b.preventDefault)==null||y.call(b),h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[c,h]);return o.jsx(w.Menu,{items:m,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u})},mn={modalContent:"_modalContent_p06ci_1"},gn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,headerStatusColor:c,...n})=>{const d=E(f=>{var p;return(p=f[t])==null?void 0:p.isModalOpen}),a=E(f=>{var p;return(p=f[t])==null?void 0:p.isLoading}),_=d&&!a,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,m=x.useCallback(()=>{_t(t),rt(t,!1)},[t,s]),g=Array.isArray(r)?O(t,e,r):r,b=O(t,e,l),y=O(t,e,i);return o.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof g=="string"?g:o.jsx(o.Fragment,{children:g.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-header-${p}`))}),children:o.jsx("section",{className:mn.modalContent,children:b.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-body-${p}`))}),actions:o.jsx(o.Fragment,{children:y.map((f,p)=>o.jsx(x.Fragment,{children:f},`modal-footer-${p}`))}),open:_,onClose:m})},yn=({userFlow:t,pageId:e})=>{var i,c;const s=fe(t);if(!s)return null;const r=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=O(t,e,r);return o.jsx(o.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return o.jsx(x.Fragment,{children:n},a)})})},xn={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},bn=t=>{const{content:e,variant:s="neutral",...r}=t,l=xn[s],i={...r,children:e,color:(r==null?void 0:r.color)??l.color,textColor:(r==null?void 0:r.textColor)??l.textColor,iconColor:(r==null?void 0:r.iconColor)??l.iconColor};return o.jsx(w.Pill,{...i})},pn=t=>{const{content:e}=t;return o.jsx(w.PreviewerMarkdown,{children:e})},Cn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=t,{getNextUI:a,fetchAndGetNextUI:_}=K(),{disabled:u}=B(e,c),h={...d},m=(h==null?void 0:h.disabled)??u,g=x.useCallback(async()=>{var b;try{const y={...(b=E.getState()[e])==null?void 0:b.entries,[r]:{status:200}};switch(A(e,y),l){case"GO_TO_NEXT_UI":{const f=await a(e,s,y,r);f!=null&&f.data&&I(e,f==null?void 0:f.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const f=await _(e,s,y,r,i);f!=null&&f.data&&I(e,f==null?void 0:f.data);break}case"CLOSE_MODAL":rt(e,!1);break;case"CLOSE_DRAWER":W(e,!1);break;case"OPEN_DRAWER":W(e,!0);break;default:console.warn(`Unhandled actionType: ${l}`);break}}catch(y){alert(JSON.stringify(y))}},[l,i,s,r,e]);return o.jsx(w.RoundButton,{...h,disabled:m,onClick:()=>!m&&(n??g)()})},X={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},Yt=t=>{const{userFlow:e,pageId:s,columnWidth:r,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=t,d=Array.isArray(l)?l.map((a,_)=>{const u=`col_${_}`,h=`col_${_}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:u,responseKey:h};const m=a;return{gap:(m==null?void 0:m.gap)??"md",justifyContent:(m==null?void 0:m.justifyContent)??"start",alignItems:(m==null?void 0:m.alignItems)??"start",items:(m==null?void 0:m.items)??[],hash:(m==null?void 0:m.hash)??u,responseKey:(m==null?void 0:m.responseKey)??h}}):[];return d.length===0?null:o.jsx("div",{className:Y(X.row,X[`row__gap-${i}`],X[`row__justify-${c}`],X[`row__align-${n}`]),children:d==null?void 0:d.map((a,_)=>{const u=(r==null?void 0:r[_])||`${100/d.length}%`,h=O(e,s,a.items);return!h||h.length===0?null:o.jsx("div",{className:Y(X.row_column,X[`row_column__gap-${a.gap}`],X[`row_column__justify-${a.justifyContent}`],X[`row_column__align-${a.alignItems}`]),style:{width:u},children:h},a.hash||_)})})};function Zt({userFlow:t,pageId:e,responseKey:s,actionType:r,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async _=>{var m;const u={...(m=E.getState()[t])==null?void 0:m.entries};if(_?(u[s]=_,A(t,u)):(delete u[s],me(t,s)),r&&(r==="GO_TO_NEXT_UI"||r==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const b=await l(t,e,u,s,r==="GO_TO_NEXT_UI");b!=null&&b.data&&I(t,b.data)}catch(g){console.error("[useSelectChange] Failed to fetch next UI",g)}},[t,e,s,r,l]);return x.useCallback(_=>{if(!i){d(_);return}if(c==null){d(_);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(_),n.current=null},c)},[i,c,d])}const jn=/\{([^}]+)\}/g,wn=(t,e)=>{var s;return e.includes("{")?e.replace(jn,(r,l)=>{var c;const i=(c=G.query(t,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=G.query(t,e))==null?void 0:s[0]},Nn=(t,e,s,r)=>{const l=G.query(t,e);return(l==null?void 0:l.map(i=>{var d;const c=wn(i,s),n=r?(d=G.query(i,r))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},kn=(t,e,s,r=10)=>{var n,d;let l,i;if(s){const a=G.value(t,s.size??"$.meta.size")??r,_=G.value(t,s.total??"$.meta.total")??0;l=a,i=_}else{const a=t==null?void 0:t.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??r,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>e:!1;return{pageSize:l,total:i,hasMore:c}},Ft={selectNotFront:"_selectNotFront_ch3v5_1"},En=({userFlow:t,pageId:e,responseKey:s,required:r,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_,fetchDataSource:u}=K(),[h,m]=x.useState((a==null?void 0:a.value)??""),{disabled:g}=B(t,c),b=(a==null?void 0:a.disabled)??g,y=x.useMemo(()=>r&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,r]),f=x.useMemo(()=>{const j=a!=null&&a.isMulti?h:[h],k={};return Array.isArray(j)&&j.forEach(T=>{if(!T)return;const R=JSON.stringify(T.value),D=JSON.stringify(T.label);k[R]=T,D in k||(k[D]=T)}),k},[h]),p=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),C=j=>{m(j),p(j)},N=async(j,k,{page:T})=>{const{jsonPathLabel:R,jsonPathOptions:D,jsonPathValue:M,jsonPathPagination:P}=l,z=mt(l,T,j),v=await u(z,t,!1),H=v==null?void 0:v.data,nt=H?Nn(H,D,R,M):[],{hasMore:wt}=kn(H,T,P);return{options:nt,hasMore:wt,additional:{page:T+1}}};return o.jsx(w.SelectPagination,{...a,className:Ft.selectNotFront,label:y,value:h,disabled:b,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:j=>!b&&C(j),loadOptions:N,additional:{page:1},isOptionDisabled:j=>{const k=JSON.stringify(j==null?void 0:j.value),T=JSON.stringify(j==null?void 0:j.label);return!!(f!=null&&f[k])||!!(f!=null&&f[T])},debounceTimeout:350})},Tn=({userFlow:t,pageId:e,responseKey:s,dataSource:r,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_}=K(),[u,h]=x.useState(a.value||""),{disabled:m}=B(t,c),g=(a==null?void 0:a.disabled)??m,b=x.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),y=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),f=p=>{h(p),y(p)};return o.jsx(w.Select,{...a,className:Ft.selectNotFront,label:b,value:u,disabled:g,onChange:p=>!g&&f(p)})},Sn=t=>{const{dataSource:e}=t;return e?o.jsx(En,{...t}):o.jsx(Tn,{...t})},Pt={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},On=t=>{const{size:e}=t,s=Y(Pt.spacing,Pt[`spacing__${e}`]);return o.jsx("div",{className:s})},vn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=K(),[h,m]=x.useState(c||!1),{disabled:g}=B(e,d),b=(_==null?void 0:_.disabled)??g,y=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),f=x.useCallback(async()=>{var p;try{const C=!h;m(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(A(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&I(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]);return o.jsx(w.Switch,{..._,label:y,checked:h,disabled:b,onChange:()=>!b&&f()})},$t={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},An=({values:t})=>{const s=t==null?void 0:t.slice(0,4),r=(t==null?void 0:t.length)-4;return o.jsxs("div",{className:$t.tableArrayPills,children:[s.map((l,i)=>o.jsx(w.Pill,{children:String(l)},i)),r>0&&o.jsxs(w.Pill,{outlined:!0,children:["+",r]})]})},Rn=({userFlow:t,pageId:e,tableResponseKey:s,component:r,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=K(),d=O(t,e,[{...r}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:_,responseKey:u,dataSource:h}=a.props,m=x.useCallback(async()=>{var g,b,y;try{const f={...(g=E.getState()[t])==null?void 0:g.entries,[u]:{status:200},[s]:[{...l}]};switch(A(t,f),_){case"GO_TO_NEXT_UI":{const p=await i(t,e,f,u);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(t,e,f,u,h);p!=null&&p.data&&I(t,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(t,e,f,u),C=(b=p==null?void 0:p.data)==null?void 0:b.content;if((C==null?void 0:C.type)!=="fetch")break;const N=C==null?void 0:C.dataSource,j=await n(N,t,!1),k={...(y=E.getState()[t])==null?void 0:y.entries,[u]:{status:j==null?void 0:j.status,content:j==null?void 0:j.data}};A(t,k);const T=await i(t,e,k,u);T!=null&&T.data&&I(t,T==null?void 0:T.data);break}default:console.warn(`Unhandled actionType: ${_}`);break}}catch(f){alert(JSON.stringify(f))}},[_,h,e,u,t]);return x.cloneElement(a,{onClick:m})},Dn=()=>o.jsx("div",{className:$t.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),Ln=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(l=>Array.isArray(s!=null&&s.accessor?l[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:l=>{const i=s.accessor?l[s.accessor]:void 0;return Array.isArray(i)?o.jsx(An,{values:i}):i??""}}:s),In=({userFlow:t,pageId:e,responseKey:s,component:r,dataSource:l,rightActions:i,data:c,pageSize:n,...d})=>{var M,P,z;const{fetchDataSource:a}=K(),[_,u]=x.useState(!1),[h,m]=x.useState(1),[g,b]=x.useState(null),y=!l&&Array.isArray(c),f=x.useRef(new Map([[1,null]])),p=x.useMemo(()=>{if(i!=null&&i.length)return i.map((v,H)=>({renderContent:nt=>o.jsx(Rn,{userFlow:t,pageId:e,tableResponseKey:s,component:v,rowData:nt},`tableRowAction${H}`)}))},[i,t,e,s]),C=async(v=1)=>{if(!l)return;const{mapperData:H,jsonPathData:nt,jsonPathPagination:wt,jsonPathCursorPagination:st}=l;if(st&&v!==1&&!f.current.has(v)){m(1),C(1);return}st&&v===1&&(f.current=new Map([[1,null]]));try{u(!0);const Nt=st?f.current.get(v)??null:null,qn=mt(l,v,void 0,Nt),$=await a(qn,t,!1);if(b(zt($==null?void 0:$.data,nt,H,wt)),st){const oe=qe($==null?void 0:$.data,st);oe&&f.current.set(v+1,oe)}u(!1)}catch(Nt){console.error("[TableNotFront] fetchData:",Nt),u(!1)}},N=v=>{m(v),C(v)};x.useEffect(()=>{y||C()},[]);const j=y?c:g==null?void 0:g.items,k=y&&!!n&&((c==null?void 0:c.length)??0)>n,T=x.useMemo(()=>{if(!k||!c||!n)return j??[];const v=(h-1)*n;return c.slice(v,v+n)},[k,c,n,h,j]),R=x.useMemo(()=>Ln(d.columns,j),[j,d.columns]),D={...d,data:T,columns:R??[],rightActions:p};return y?!j||j.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),k&&n&&c&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:m})]}):o.jsx(o.Fragment,{children:_?o.jsx(Dn,{}):g&&((M=g==null?void 0:g.items)==null?void 0:M.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),(g==null?void 0:g.pagination)&&((P=g==null?void 0:g.pagination)==null?void 0:P.totalPages)>1&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:g==null?void 0:g.pagination.size,total:(z=g==null?void 0:g.pagination)==null?void 0:z.total,onChange:N})]}):o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Mn={tabsPanel:"_tabsPanel_kvslb_1"},Bn=({userFlow:t,pageId:e,components:s})=>{const r=O(t,e,s);return r!=null&&r.length?o.jsx("section",{className:Mn.tabsPanel,children:r.map((l,i)=>o.jsx(x.Fragment,{children:l},`tabs-panel-${i}`))}):null},Gn=({userFlow:t,pageId:e,hash:s,items:r,activeIndex:l,className:i,responseKey:c})=>{const n=r.map((a,_)=>({label:a.label,disabled:a.disabled,children:o.jsx(Bn,{userFlow:t,pageId:e,components:a.components},`${s}-tab-${_}`)})),d=a=>{var u;const _={...(u=E.getState()[t])==null?void 0:u.entries,[c]:a};A(t,_)};return o.jsx(w.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},Kn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),m=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var p;const f=(p=y==null?void 0:y.target)==null?void 0:p.value;u(f),A(e,{[i]:f})};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.Textarea,{...a,label:g,value:_,disabled:m,onChange:y=>!m&&b(y)})},Hn={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},Un=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),m=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var C;const f=(C=y==null?void 0:y.target)==null?void 0:C.value;u(f);const p={[i]:f};A(e,p)};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.TextField,{...a,className:Hn.textFieldNotFront,allowClear:!1,label:g,value:_,disabled:m,onChange:y=>!m&&b(y)})},Vn=({userFlow:t,pageId:e,responseKey:s,variant:r,content:l,actionType:i,redirectUrl:c})=>{const n=x.useCallback(async()=>{_t(t);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[i,e,s,t,c]);return x.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[r]||w.toast.info)(l,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},te={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},zn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:_}=t,u=O(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:te.tooltipNotFront_content,children:u.map((m,g)=>o.jsx(x.Fragment,{children:m},`tooltip-${l}-${g}`))}):null;return o.jsx(w.Tooltip,{className:te.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:_,children:h})};function Jn({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:r}){const l=re(t,e,null,s);return o.jsxs(o.Fragment,{children:[l,r]})}const Xn={api:"",headers:{}},ee=({userFlow:t,components:e,hash:s,apiConfig:r})=>{const l=s??`${t}-page`;x.useState(()=>{var d,a;return(a=(d=E.getState()[t])==null?void 0:d.pages)!=null&&a[l]||at(t,r??Xn,{type:"page",hash:l,body:{components:e}}),null});const i=O(t,l,e);return o.jsx(o.Fragment,{children:i})};function ne(t){if(t==null||typeof t!="object"||!("components"in t)||!Array.isArray(t.components))throw new Error("[renderNotFront] payload.display must be an object with a `components` array");return t.components}const se=({payload:t,userFlow:e})=>{const s=ne(t.display),r=ee({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:r})},Wn=se,ae=(t,e,s,r,l)=>{const i=O(t,e,(r==null?void 0:r.components)||null,l);switch(s){case"body":return o.jsx(De,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return o.jsx(un,{...r,components:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},re=(t,e,s,r)=>{var h,m,g;const[l,i]=x.useState(!1),c=E(b=>b),n=(h=c[t])==null?void 0:h.currentPageId;x.useEffect(()=>{if(typeof window>"u")return;const b=new URL(window.location.href),y=b.searchParams.get("sessionId");y&&(sessionStorage.setItem("sessionId",y),b.searchParams.delete("sessionId"),window.history.replaceState({},"",b.toString()))},[]);const d=n?ae(t,n,"header",((m=c[t].pages[n].page)==null?void 0:m.header)||null,r):null,a=n?ae(t,n,"body",((g=c[t].pages[n].page)==null?void 0:g.body)||null,r):null,_=x.useMemo(()=>{var b;return o.jsxs(o.Fragment,{children:[((b=c[t])==null?void 0:b.isLoading)&&o.jsx(w.Loading,{}),d,a,n&&o.jsx(yn,{userFlow:t,pageId:n}),c[t]&&o.jsx(w.Toaster,{})]})},[d,a,n,t]),u=async()=>{try{const b=await Bt(e,t),y=b==null?void 0:b.data,f=y==null?void 0:y.content;(b==null?void 0:b.status)===200?at(t,e,f,y==null?void 0:y.sessionState):i(!0)}catch(b){console.error("[not-page]: API call failed",b),i(!0)}};return x.useEffect(()=>{e!=null&&e.api&&!s&&t?u():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?at(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const b="avocado-theme-mode-changed",y=f=>{const p=f.detail;w.ThemeStore.setThemeMode(p)};return window.addEventListener(b,y),()=>{window.removeEventListener(b,y)}},[]),l&&console.error("[not-page]: No render page"),_};S.Chart=Wt,S.NotFrontPage=Jn,S.RenderNotFront=se,S.Row=Yt,S.extractNotFrontComponents=ne,S.heading=Dt,S.renderNotFront=Wn,S.text=Lt,S.useNotFrontFragment=ee,S.usePage=re,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
13
|
+
*/var Ut;function Me(){return Ut||(Ut=1,(function(t){(function(){var e={}.hasOwnProperty;function s(){for(var r=[],l=0;l<arguments.length;l++){var i=arguments[l];if(i){var c=typeof i;if(c==="string"||c==="number")r.push(i);else if(Array.isArray(i)){if(i.length){var n=s.apply(null,i);n&&r.push(n)}}else if(c==="object"){if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]")){r.push(i.toString());continue}for(var d in i)e.call(i,d)&&i[d]&&r.push(d)}}}return r.join(" ")}t.exports?(s.default=s,t.exports=s):window.classNames=s})()})(pt)),pt.exports}var Be=Me();const Y=xe(Be),Q={fieldset:"_fieldset_1xrth_1",fieldsetColumn:"_fieldsetColumn_1xrth_8",legend:"_legend_1xrth_14",options:"_options_1xrth_20",optionsRow:"_optionsRow_1xrth_25",optionsColumn:"_optionsColumn_1xrth_36"},Ke=t=>{const{userFlow:e,pageId:s,responseKey:r,label:l,value:i,required:c,actionType:n,dependencies:d,direction:a,items:_}=t,u=a==="column"?"column":"row",{getNextUI:h}=U(),{disabled:f}=B(e,d),g=E(C=>{var N,j;return(j=(N=C[e])==null?void 0:N.entries)==null?void 0:j[r]}),b=g!=null?String(g):i??"",y=f,m=x.useMemo(()=>l?c?`${l} *`:l:null,[l,c]),p=x.useCallback(async C=>{var N;if(!y)try{const j={...(N=E.getState()[e])==null?void 0:N.entries,[r]:C};if(L(e,j),n==="GO_TO_NEXT_UI"||n==="GO_TO_NEXT_UI_WITHOUT_LOADING"){const R=await h(e,s,j,r,n==="GO_TO_NEXT_UI");R!=null&&R.data&&M(e,R==null?void 0:R.data)}}catch(j){alert(JSON.stringify(j))}},[n,h,y,s,r,e]);return o.jsxs("fieldset",{className:Y(Q.fieldset,u==="column"&&Q.fieldsetColumn),children:[m?o.jsx("legend",{className:Q.legend,children:m}):null,o.jsx("div",{className:Y(Q.options,u==="column"?Q.optionsColumn:Q.optionsRow),children:_.map(C=>o.jsx(w.RadioButton,{name:r,value:C.value,checked:b===C.value,disabled:y||C.disabled,labelRight:C.label,onChange:()=>{p(C.value)}},C.value))})]})},Ge=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,items:i,itemActive:c,darkMode:n})=>o.jsx(w.Stepper,{items:i,itemActive:c,darkMode:n}),He=({userFlow:t,pageId:e,component:s,hash:r,responseKey:l,total:i,done:c,inProgress:n})=>o.jsx(w.ProgressBar,{total:i,done:c,inProgress:n}),Ue=({userFlow:t,items:e,responseKey:s})=>{const{getNextUI:r}=U(),l=x.useCallback(async({actionType:c,hashCode:n,redirectUrl:d})=>{var a;try{switch(c){case"GO_TO_NEXT_UI":const _=await r(t,n,{...(a=E.getState()[t])==null?void 0:a.entries},s);_!=null&&_.data&&M(t,_==null?void 0:_.data);break;case"REDIRECT":d?window.location.href=d:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${c}`);break}}catch(_){alert(JSON.stringify(_))}},[]),i=x.useMemo(()=>e==null?void 0:e.map(c=>({title:c==null?void 0:c.title,component:o.jsx("div",{onClick:()=>l(c)})})),[]);return o.jsx(w.Breadcrumbs,{items:i})};function ut(t,e){const{getNextUI:s,fetchDataSource:r,fetchAndGetNextUI:l}=U();return x.useCallback(async i=>{var h,f,g,b;const{responseKey:c,actionType:n,dataSource:d,redirectUrl:a,dependencies:_}=i,u=(h=E.getState()[t])==null?void 0:h.entries;if(!It(u,_))try{const y={...(f=E.getState()[t])==null?void 0:f.entries,[c]:{status:200}};switch(L(t,y),n){case"CLOSE_MODAL":mt(t,!1);break;case"CLOSE_DRAWER":et(t,!1);break;case"OPEN_DRAWER":et(t,!0);break;case"GO_TO_NEXT_UI":{const m=await s(t,e,y,c);m!=null&&m.data&&M(t,m==null?void 0:m.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const m=await l(t,e,y,c,d);m!=null&&m.data&&M(t,m==null?void 0:m.data);break}case"FETCH_DATA_SOURCE":{const m=await r(d,t,!1);L(t,{[c]:{status:m==null?void 0:m.status,content:m==null?void 0:m.data}});break}case"GET_DATA_SOURCE":{const m=await s(t,e,y,c),p=(g=m==null?void 0:m.data)==null?void 0:g.content;if((p==null?void 0:p.type)!=="fetch")break;const C=p==null?void 0:p.dataSource,N=await r(C,t,!1),j={...(b=E.getState()[t])==null?void 0:b.entries,[c]:{status:N==null?void 0:N.status,content:N==null?void 0:N.data}};L(t,j);const k=await s(t,e,j,c);k!=null&&k.data&&M(t,k==null?void 0:k.data);break}case"REDIRECT":a?window.location.href=a:console.warn("Missing redirectUrl for REDIRECT actionType");break;default:console.warn(`Unhandled actionType: ${n}`)}}catch(y){alert(JSON.stringify(y))}},[l,r,s,e,t])}const Ve=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,content:c,dataSource:n,redirectUrl:d,dependencies:a,onClick:_,...u}=t,h=ut(e,s),{disabled:f}=B(e,a),g={...u,children:c??i},b=(g==null?void 0:g.disabled)??f,[y,m]=x.useState(!1),p=x.useRef(!1),C=x.useCallback(async()=>{if(p.current)return;const N=l==="FETCH_DATA_SOURCE";N&&(p.current=!0,m(!0));try{await h({responseKey:r,actionType:l,dataSource:n,redirectUrl:d,dependencies:a})}catch(j){console.error("[ButtonNotFront] Action failed:",j)}finally{N&&(p.current=!1,m(!1))}},[l,n,a,d,r,h]);return o.jsx(w.Button,{...g,loading:g.loading||y,disabled:b,onClick:()=>!b&&!y&&(_??C)()})},Vt={slotStack:"_slotStack_12u4t_5"},ze=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,dependencies:c,content:n,actionContent:d,...a}=t,{disabled:_}=B(e,c),u=v(e,s,n&&n.length>0?n:null),h=v(e,s,d&&d.length>0?d:null),f=u&&u.length>0?o.jsx("div",{className:Vt.slotStack,children:u.map((y,m)=>o.jsx(x.Fragment,{children:y},`card-accordion-body-${l}-${m}`))}):void 0,g=h&&h.length>0?o.jsx("div",{className:Vt.slotStack,children:h.map((y,m)=>o.jsx(x.Fragment,{children:y},`card-accordion-actions-${l}-${m}`))}):void 0,b=a.disabled||_;return o.jsx(w.CardAccordion,{...a,disabled:b,actionContent:g,children:f??null})},Xe={slotStack:"_slotStack_ivk5b_1"},Je=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,colorId:n,disabled:d,actionType:a,dataSource:_,redirectUrl:u,dependencies:h}=t,{getNextUI:f,fetchDataSource:g,fetchAndGetNextUI:b}=U(),{disabled:y}=B(e,h),m=d??y,p=v(e,s,c&&c.length>0?c:null),C=p&&p.length>0?o.jsx("div",{className:Xe.slotStack,children:p.map((j,k)=>o.jsx(x.Fragment,{children:j},`card-body-${l}-${k}`))}):null,N=x.useCallback(async()=>{var j,k,T;if(!(!a||m))try{const R={...(j=E.getState()[e])==null?void 0:j.entries,[i]:{status:200}};switch(L(e,R),a){case"CLOSE_MODAL":mt(e,!1);break;case"CLOSE_DRAWER":et(e,!1);break;case"OPEN_DRAWER":et(e,!0);break;case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const I=await f(e,s,R,i,a==="GO_TO_NEXT_UI");I!=null&&I.data&&M(e,I==null?void 0:I.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const D=await b(e,s,R,i,_);D!=null&&D.data&&M(e,D==null?void 0:D.data);break}case"GET_DATA_SOURCE":{const D=await f(e,s,R,i),I=(k=D==null?void 0:D.data)==null?void 0:k.content;if((I==null?void 0:I.type)!=="fetch")break;const $=I==null?void 0:I.dataSource,X=await g($,e,!1),O={...(T=E.getState()[e])==null?void 0:T.entries,[i]:{status:X==null?void 0:X.status,content:X==null?void 0:X.data}};L(e,O);const H=await f(e,s,O,i);H!=null&&H.data&&M(e,H==null?void 0:H.data);break}case"REDIRECT":u&&(window.location.href=u);break;default:console.warn(`Unhandled card actionType: ${a}`)}}catch(R){alert(JSON.stringify(R))}},[a,_,m,b,g,f,s,u,i,e]);return o.jsx(w.Card,{colorId:n,disabled:m,onClick:a&&!m?()=>void N():void 0,children:C})},We=t=>{const{content:e,description:s,...r}=t,l={...r,children:e??s};return o.jsx(w.CardNotification,{...l})},Ct=t=>Array.isArray(t)?t:typeof t=="object"?JSON.stringify(t):t,qe=(t,e)=>{if(!e||t==null)return null;const{extractionJsonPath:s,injectionJsonPath:r}=e,l=K.value(t,s);if(l==null)return null;try{const i={};return K.value(i,r,l),i}catch(i){return console.warn("[buildCursorPayload] invalid injectionJsonPath:",r,i),null}},zt=(t,e,s,r)=>{const l=K.query(t,e),i=l==null?void 0:l.map(a=>{var _,u;if(s){const h={};for(const[f,g]of Object.entries(s))if(typeof g=="object"&&"path"in g){const b=g,y=(_=K.query(a,b.path))==null?void 0:_[0];b.translations&&String(y)in b.translations?h[f]=Ct(b.translations[String(y)]):h[f]=Ct(y)}else{const b=g;h[f]=Ct((u=K.query(a,b))==null?void 0:u[0])}return h}else return a}),c=K.value(t,(r==null?void 0:r.size)??"$.meta.size")??l.length,n=K.value(t,(r==null?void 0:r.total)??"$.meta.total")??0,d={size:c,total:n,totalPages:r!=null&&r.totalPages?K.value(t,(r==null?void 0:r.totalPages)??"$.meta.totalPages"):c>0?Math.ceil(n/c):0};return{items:i,pagination:d}},at=({width:t,height:e,layout:s,data:r,Chart:l,children:i})=>{const c=e??ct,n=s?{layout:s}:{};return t?o.jsx(l,{width:t,height:c,data:r,...n,children:i}):o.jsx(S.ResponsiveContainer,{width:"100%",height:c,children:o.jsx(l,{data:r,...n,children:i})})},Z=({withPadding:t=!1})=>{const e=s=>o.jsx("span",{style:{color:z.labelColor},children:s});return o.jsx(S.Legend,{formatter:e,wrapperStyle:{fontSize:z.fontSize,fontFamily:z.fontFamily,padding:t?"1rem 0":"0"}})},Ye=({active:t,payload:e,label:s,tooltipKey:r,tooltipCoverage:l})=>{var _,u;if(!t||!e||!e.length)return null;const i={backgroundColor:z.tooltipBg,borderRadius:z.tooltipBorderRadius,color:z.tooltipColor,padding:"8px 12px",border:"1px solid #e5e7eb"};if(r){const h=(_=e[0])==null?void 0:_.payload;if(h&&h[r]!==void 0&&h[r]!==null)return o.jsx("div",{style:i,children:o.jsx("p",{style:{margin:0},children:h[r]})})}const c=(u=e[0])==null?void 0:u.payload,n=(l==null?void 0:l.label)??"Cobertura",d=l?c==null?void 0:c[l.denominatorKey]:void 0,a=l&&d!==void 0&&d!==null&&d>0;return o.jsxs("div",{style:i,children:[o.jsx("p",{style:{margin:"0 0 4px 0",fontWeight:"bold"},children:s}),e.map((h,f)=>o.jsx("p",{style:{margin:"2px 0",color:h.color},children:`${h.name}: ${h.value}`},f)),a&&o.jsx("p",{style:{margin:"2px 0"},children:`${n}: ${Math.round(c[l.numeratorKey]/d*100)}%`})]})},F=({tooltipKey:t,tooltipCoverage:e}={})=>o.jsx(S.Tooltip,{content:o.jsx(Ye,{tooltipKey:t,tooltipCoverage:e})}),rt=({dataKey:t,hide:e=!1,type:s})=>o.jsx(S.XAxis,{...t?{dataKey:t}:{},...s?{type:s}:{},hide:e,tick:{fill:z.labelColor,fontSize:z.fontSize}}),ot=({type:t,dataKey:e,width:s}={})=>o.jsx(S.YAxis,{...t?{type:t}:{},...e?{dataKey:e}:{},...s!==void 0?{width:s}:{},tick:{fill:z.labelColor,fontSize:z.fontSize},tickMargin:4}),Qe=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(at,{width:i,data:e,Chart:S.AreaChart,children:[o.jsx(S.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(rt,{dataKey:s}),o.jsx(ot,{}),o.jsx(F,{tooltipKey:l}),o.jsx(Z,{}),r.map((c,n)=>o.jsx(S.Area,{type:"monotone",dataKey:c,stroke:G[n%G.length],fill:G[n%G.length]},c))]})},Ze=t=>{const{data:e,yKeys:s,xKey:r,tooltipKey:l,width:i}=t;return o.jsxs(at,{width:i,data:e,Chart:S.BarChart,children:[o.jsx(S.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(rt,{dataKey:r}),o.jsx(ot,{}),o.jsx(F,{tooltipKey:l}),o.jsx(Z,{}),s.map((c,n)=>o.jsx(S.Bar,{dataKey:c,fill:G[n%G.length]},c))]})};function Fe(t,e,s=Xt){return t<=0?0:e<=0?t:Math.max(t,e*s)}function Pe(t,e=rn,s){return s!==void 0?s:t<=0?ct:Math.max(ct,t*e)}function $e(t,e,s){if(s!==void 0)return s;const r=t.reduce((l,i)=>{const c=String(i[e]??"");return Math.max(l,c.length)},0);return Math.max(on,r*cn)}const tn=t=>{const{data:e,yKeys:s,xKey:r,tooltipKey:l,minCategoryHeight:i,chartHeight:c,tooltipCoverage:n,showLegend:d=!0,yKeyLabels:a,yAxisWidth:_}=t,u=Pe(e.length,i,c),h=$e(e,r,_);return o.jsxs(at,{height:u,layout:"vertical",data:e,Chart:S.BarChart,children:[o.jsx(S.CartesianGrid,{strokeDasharray:"3 3",horizontal:!1}),o.jsx(rt,{type:"number"}),o.jsx(ot,{type:"category",dataKey:r,width:h}),o.jsx(F,{tooltipKey:l,tooltipCoverage:n}),d&&o.jsx(Z,{}),s.map((f,g)=>o.jsx(S.Bar,{dataKey:f,name:(a==null?void 0:a[f])??f,fill:G[g%G.length]},f))]})},en=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l,width:i}=t;return o.jsxs(at,{width:i,data:e,Chart:S.LineChart,children:[o.jsx(S.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(rt,{dataKey:s}),o.jsx(ot,{}),o.jsx(F,{tooltipKey:l}),o.jsx(Z,{}),r.map((c,n)=>o.jsx(S.Line,{type:"monotone",dataKey:c,stroke:G[n%G.length],strokeWidth:2,dot:!1},c))]})};var nn={NODE_ENV:"production"};const sn=t=>{const{data:e,xKey:s,series:r=[],tooltipKey:l,width:i}=t;return!r.length&&nn.NODE_ENV,o.jsxs(at,{width:i,data:e,Chart:S.BarChart,children:[o.jsx(S.CartesianGrid,{strokeDasharray:"3 3"}),o.jsx(rt,{dataKey:s}),o.jsx(ot,{}),o.jsx(F,{tooltipKey:l}),o.jsx(Z,{}),r.map((c,n)=>o.jsx(S.Bar,{dataKey:c.key,name:c.label??c.key,stackId:c.stackId,fill:c.color??G[n%G.length]},c.key))]})},an=t=>{const{data:e,xKey:s,yKeys:r,tooltipKey:l}=t,i=({cx:c,cy:n,midAngle:d,innerRadius:a,outerRadius:_,value:u})=>{const h=Math.PI/180,f=25+a+(_-a),g=c+f*Math.cos(-(d??0)*h),b=n+f*Math.sin(-(d??0)*h);return o.jsx("text",{x:g,y:b,fill:z.labelColor,color:z.labelColor,textAnchor:"middle",dominantBaseline:"central",children:u})};return o.jsx(S.ResponsiveContainer,{width:"100%",height:ct,children:o.jsxs(S.PieChart,{children:[o.jsx(F,{tooltipKey:l}),o.jsx(Z,{}),o.jsx(S.Pie,{data:e,dataKey:r[0],nameKey:s,label:i,outerRadius:120,children:e.map((c,n)=>o.jsx(S.Cell,{fill:G[n%G.length]},`cell-${n}`))})]})})},ct=400,Xt=56,rn=28,on=100,cn=8,ln=new Set(["bar","line","area","mixBar"]),dn={area:Qe,bar:Ze,horizontalBar:tn,line:en,mixBar:sn,pie:an},G=["var(--color-primitive-palette-1-50)","var(--color-primitive-palette-2-50)","var(--color-primitive-palette-3-50)","var(--color-primitive-palette-4-50)","var(--color-primitive-palette-5-50)","var(--color-primitive-palette-6-50)","var(--color-primitive-palette-7-50)","var(--color-primitive-palette-8-50)","var(--color-primitive-palette-9-50)","var(--color-primitive-palette-10-50)","var(--color-primitive-palette-11-50)","var(--color-primitive-palette-12-50)","var(--color-primitive-palette-13-50)","var(--color-primitive-palette-14-50)","var(--color-primitive-palette-15-50)","var(--color-primitive-palette-16-50)","var(--color-primitive-palette-17-50)"],z={fontFamily:"Roboto, sans-serif",fontSize:12,labelColor:"var(--color-neutral-90)",tooltipBg:"#fff",tooltipColor:"#000",tooltipBorderRadius:"4px"},Jt={chartScrollViewport:"_chartScrollViewport_sm5hx_1",chartScrollViewport_track:"_chartScrollViewport_track_sm5hx_29"},_n="Scrollable chart area",un=({dataLength:t,minCategoryWidth:e,children:s})=>{const r=x.useRef(null),[l,i]=x.useState(0),c=e??Xt;x.useEffect(()=>{const _=r.current;if(!_)return;const u=()=>{i(_.clientWidth)};u();const h=new ResizeObserver(u);return h.observe(_),()=>h.disconnect()},[]);const n=Fe(l,t,c),d=l>0&&n>l,a=x.useCallback(_=>{const u=r.current;if(u)switch(_.key){case"ArrowLeft":u.scrollLeft-=c,_.preventDefault();break;case"ArrowRight":u.scrollLeft+=c,_.preventDefault();break;case"Home":u.scrollLeft=0,_.preventDefault();break;case"End":u.scrollLeft=u.scrollWidth-u.clientWidth,_.preventDefault();break}},[c]);return o.jsx("div",{ref:r,className:Jt.chartScrollViewport,role:d?"region":void 0,tabIndex:d?0:void 0,"aria-label":d?_n:void 0,onKeyDown:d?a:void 0,children:o.jsx("div",{className:Jt.chartScrollViewport_track,style:{width:n,height:ct},children:l>0?s(n):null})})},Wt=t=>{const{component:e,userFlow:s,hash:r,responseKey:l,dataSource:i,...c}=t,n=dn[c.type],{fetchDataSource:d}=U(),[a,_]=x.useState(!1),[u,h]=x.useState([]),f=async()=>{var y,m;try{_(!0);const{jsonPathData:p,mapperData:C}=i,N=bt(i,1),j=await d(N,s,!1),k=p?(y=zt(j==null?void 0:j.data,p,C))==null?void 0:y.items:(m=j==null?void 0:j.data)==null?void 0:m.data;h(k),_(!1)}catch(p){alert(JSON.stringify(p)),_(!1)}};if(x.useEffect(()=>{n&&(i?f():h(c.data))},[]),!n)return o.jsx("div",{children:"Not supported chart type"});const g={...c,data:u};return a?o.jsx(w.SkeletonBase,{height:400}):u.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):ln.has(c.type)?o.jsx(un,{dataLength:u.length,minCategoryWidth:c.minCategoryWidth,children:y=>o.jsx(n,{...g,width:y})}):o.jsx(n,{...g})},hn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=U(),[h,f]=x.useState(c||!1),{disabled:g}=B(e,d),b=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),y=x.useCallback(async()=>{var p;try{const C=!h;f(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(L(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&M(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in checkbox action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]),m=(_==null?void 0:_.disabled)??g;return o.jsx(w.Checkbox,{..._,labelRight:b,checked:h,disabled:m,onChange:()=>{!m&&y()}})},P={codeEditor:"_codeEditor_1wi2p_1",codeEditor_label:"_codeEditor_label_1wi2p_4",codeEditor_wrapper:"_codeEditor_wrapper_1wi2p_13",input:"_input_1wi2p_17",preview:"_preview_1wi2p_18",preview_inner:"_preview_inner_1wi2p_33"},fn=t=>{const{userFlow:e,responseKey:s,label:r,language:l,placeholder:i,value:c,required:n,dependencies:d,disabled:a,showPreview:_,height:u="400px"}=t,[h,f]=x.useState(c??""),g=w.ThemeStore.useThemeStore(N=>N.theme.mode),{disabled:b}=B(e,d),y=a??b,m={json:kt.json(),markdown:ie.markdown(),sql:de.sql(),yaml:_e.yaml()},p=x.useMemo(()=>n&&r?`${r} *`:r??"",[r,n]),C=N=>{f(N);const j={[s]:N};L(e,j)};return o.jsxs("div",{className:P.codeEditor,children:[p&&p!==""&&o.jsx("label",{className:P.codeEditor_label,children:p}),o.jsxs("div",{className:P.codeEditor_wrapper,children:[o.jsx(le,{className:P.input,value:h,height:u,placeholder:i,extensions:[m[l]??kt.json()],onChange:N=>C(N),theme:g,editable:!y}),l==="markdown"&&_&&o.jsx("div",{className:P.preview,style:{height:u},children:o.jsx(w.PreviewerMarkdown,{className:P.preview_inner,children:h})})]})]})},qt={slotStack:"_slotStack_6n2wy_5"},mn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,topContent:n,icon:d,headerStatusColor:a,..._}=t,u=a?`palette_${a}_50`:void 0,h=v(e,s,c&&c.length>0?c:null),f=v(e,s,n&&n.length>0?n:null),g=h&&h.length>0?o.jsx("div",{className:qt.slotStack,children:h.map((y,m)=>o.jsx(x.Fragment,{children:y},`data-card-body-${l}-${m}`))}):void 0,b=f&&f.length>0?o.jsx("div",{className:qt.slotStack,children:f.map((y,m)=>o.jsx(x.Fragment,{children:y},`data-card-top-${l}-${m}`))}):void 0;return o.jsx(w.DataCard,{..._,icon:d,headerStatusColor:u,topContent:b,children:g})},gn={dividerNotFront:"_dividerNotFront_tze3j_1"},yn=t=>o.jsx(w.Divider,{...t,className:gn.dividerNotFront}),jt={drawer:"_drawer_13pxo_1",drawerBody:"_drawerBody_13pxo_5",drawerFooter:"_drawerFooter_13pxo_11"},xn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,...c})=>{const n=E(y=>{var m;return(m=y[t])==null?void 0:m.isDrawerOpen}),d=E(y=>{var m;return(m=y[t])==null?void 0:m.isLoading}),a=n&&!d,_={...c,isOpen:a,children:null},u=x.useCallback(()=>{ft(t),et(t,!1)},[t]),h=Array.isArray(r)?v(t,e,r):r?o.jsx(w.Heading,{type:"h2",children:r}):void 0,f=v(t,e,l),g=i?v(t,e,i):void 0;return o.jsx(w.Drawer,{..._,className:jt.drawer,isOpen:a,onClose:u,heightGap:50,title:h?o.jsx(o.Fragment,{children:Array.isArray(h)?h.map((y,m)=>o.jsx(x.Fragment,{children:y},`drawer-header-${m}`)):h}):void 0,children:o.jsx("section",{className:jt.drawerBody,children:f.map((y,m)=>o.jsx(x.Fragment,{children:y},`drawer-body-${m}`))}),footer:g?o.jsx("div",{className:jt.drawerFooter,children:g.map((y,m)=>o.jsx(x.Fragment,{children:y},`drawer-footer-${m}`))}):void 0})},bn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,items:n,disabled:d,variant:a,leftIcon:_,rightIcon:u}=t,h=ut(e,s),f=x.useMemo(()=>n.map(g=>({label:g.content??g.label??"",onClick:()=>{h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[n,h]);return o.jsx(w.DropdownButton,{disabled:d,variant:a,items:f,children:o.jsxs(x.Fragment,{children:[_?o.jsx(Et.Icon,{name:_,size:"md",style:{marginRight:8,verticalAlign:"middle"}}):null,c,u?o.jsx(Et.Icon,{name:u,size:"md",style:{marginLeft:8,verticalAlign:"middle"}}):null]})})},Yt={header:"_header_g1eri_1",header_content:"_header_content_g1eri_5"},pn=({components:t=[]})=>o.jsx("section",{className:Y(Yt.header,"avocado-dark-theme"),children:o.jsx("div",{className:Yt.header_content,children:t.map((e,s)=>o.jsx(x.Fragment,{children:e},s))})}),Cn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,content:i,redirectUrl:c,target:n,dependencies:d,component:a,hash:_,...u}=t,{getNextUI:h}=U(),{disabled:f}=B(e,d),g=l&&u?(()=>{const{href:m,target:p,download:C,...N}=u;return N})():u,b=x.useCallback(async()=>{var m;if(l)try{const p={...(m=E.getState()[e])==null?void 0:m.entries,[r]:{status:200}};switch(L(e,p),l){case"GO_TO_NEXT_UI":{const C=await h(e,s,p,r);C!=null&&C.data&&M(e,C==null?void 0:C.data);break}case"REDIRECT":if(!c){console.warn("Missing redirectUrl for REDIRECT actionType");break}n==="_blank"?window.open(c,"_blank","noopener,noreferrer"):window.location.assign(c);break;default:console.warn(`Unhandled actionType for link: ${l}`);break}}catch(p){alert(JSON.stringify(p))}},[l,h,s,c,r,n,e]),y=g.disabled??f;return o.jsx(w.Link,{...g,disabled:y,onClick:l?b:void 0,children:i})},jn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,items:c,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u}=t,h=ut(e,s),f=x.useMemo(()=>c.map(g=>({icon:g.leftIcon,label:g.content??g.label??"",onClick:b=>{var y;(y=b==null?void 0:b.preventDefault)==null||y.call(b),h({responseKey:g.responseKey,actionType:g.actionType,dataSource:g.dataSource,redirectUrl:g.redirectUrl,dependencies:g.dependencies})}})),[c,h]);return o.jsx(w.Menu,{items:f,closeOnClick:n,disabled:d,listOrigin:a,size:_,variant:u})},wn={modalContent:"_modalContent_p06ci_1"},Nn=({userFlow:t,pageId:e,responseKey:s,header:r,body:l,footer:i,headerStatusColor:c,...n})=>{const d=E(m=>{var p;return(p=m[t])==null?void 0:p.isModalOpen}),a=E(m=>{var p;return(p=m[t])==null?void 0:p.isLoading}),_=d&&!a,u={...n},h=(u==null?void 0:u.headerStatusColor)??c,f=x.useCallback(()=>{ft(t),mt(t,!1)},[t,s]),g=Array.isArray(r)?v(t,e,r):r,b=v(t,e,l),y=v(t,e,i);return o.jsx(w.Modal,{...u,headerStatusColor:h,header:typeof g=="string"?g:o.jsx(o.Fragment,{children:g.map((m,p)=>o.jsx(x.Fragment,{children:m},`modal-header-${p}`))}),children:o.jsx("section",{className:wn.modalContent,children:b.map((m,p)=>o.jsx(x.Fragment,{children:m},`modal-body-${p}`))}),actions:o.jsx(o.Fragment,{children:y.map((m,p)=>o.jsx(x.Fragment,{children:m},`modal-footer-${p}`))}),open:_,onClose:f})},kn=({userFlow:t,pageId:e})=>{var i,c;const s=fe(t);if(!s)return null;const r=[...(s==null?void 0:s.components)||[],...((i=s==null?void 0:s.header)==null?void 0:i.components)||[],...((c=s==null?void 0:s.body)==null?void 0:c.components)||[]],l=v(t,e,r);return o.jsx(o.Fragment,{children:l==null?void 0:l.map((n,d)=>{const a=`overlay-${d}-${s==null?void 0:s.hash}`;return o.jsx(x.Fragment,{children:n},a)})})},En={success:{color:"success-opacity",textColor:"success-60",iconColor:"success-50"},warning:{color:"warning-opacity",textColor:"warning-60",iconColor:"warning-50"},error:{color:"error-opacity",textColor:"error-60",iconColor:"error-50"},info:{color:"primary-10",textColor:"primary-70",iconColor:"primary-70"},neutral:{color:"neutral-10",textColor:"neutral-70",iconColor:"neutral-70"}},Tn=t=>{const{content:e,variant:s="neutral",...r}=t,l=En[s],i={...r,children:e,color:(r==null?void 0:r.color)??l.color,textColor:(r==null?void 0:r.textColor)??l.textColor,iconColor:(r==null?void 0:r.iconColor)??l.iconColor};return o.jsx(w.Pill,{...i})},An=t=>{const{content:e}=t;return o.jsx(w.PreviewerMarkdown,{children:e})},Sn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,dataSource:i,dependencies:c,onClick:n,...d}=t,a=ut(e,s),{disabled:_}=B(e,c),u={...d},h=(u==null?void 0:u.disabled)??_,[f,g]=x.useState(!1),b=x.useRef(!1),y=x.useCallback(async()=>{if(b.current)return;const m=l==="FETCH_DATA_SOURCE";m&&(b.current=!0,g(!0));try{await a({responseKey:r,actionType:l,dataSource:i,dependencies:c})}catch(p){console.error("[RoundButtonNotFront] Action failed:",p)}finally{m&&(b.current=!1,g(!1))}},[l,i,c,r,a]);return o.jsx(w.RoundButton,{...u,loading:u.loading||f,disabled:h,onClick:()=>!h&&!f&&(n??y)()})},J={row:"_row_1bqj4_1","row__gap-none":"_row__gap-none_1bqj4_5","row__gap-xxs":"_row__gap-xxs_1bqj4_8","row__gap-xs":"_row__gap-xs_1bqj4_11","row__gap-sm":"_row__gap-sm_1bqj4_14","row__gap-md":"_row__gap-md_1bqj4_17","row__gap-lg":"_row__gap-lg_1bqj4_20","row__gap-xl":"_row__gap-xl_1bqj4_23","row__gap-xxl":"_row__gap-xxl_1bqj4_26","row__gap-xxxl":"_row__gap-xxxl_1bqj4_29","row__justify-start":"_row__justify-start_1bqj4_32","row__justify-end":"_row__justify-end_1bqj4_35","row__justify-center":"_row__justify-center_1bqj4_38","row__justify-space-between":"_row__justify-space-between_1bqj4_41","row__justify-space-around":"_row__justify-space-around_1bqj4_44","row__justify-space-evenly":"_row__justify-space-evenly_1bqj4_47","row__align-start":"_row__align-start_1bqj4_50","row__align-end":"_row__align-end_1bqj4_53","row__align-center":"_row__align-center_1bqj4_56","row__align-stretch":"_row__align-stretch_1bqj4_59","row__align-baseline":"_row__align-baseline_1bqj4_62",row_column:"_row_column_1bqj4_65","row_column__gap-none":"_row_column__gap-none_1bqj4_72","row_column__gap-xxs":"_row_column__gap-xxs_1bqj4_75","row_column__gap-xs":"_row_column__gap-xs_1bqj4_78","row_column__gap-sm":"_row_column__gap-sm_1bqj4_81","row_column__gap-md":"_row_column__gap-md_1bqj4_84","row_column__gap-lg":"_row_column__gap-lg_1bqj4_87","row_column__gap-xl":"_row_column__gap-xl_1bqj4_90","row_column__gap-xxl":"_row_column__gap-xxl_1bqj4_93","row_column__gap-xxxl":"_row_column__gap-xxxl_1bqj4_96","row_column__justify-start":"_row_column__justify-start_1bqj4_99","row_column__justify-end":"_row_column__justify-end_1bqj4_102","row_column__justify-center":"_row_column__justify-center_1bqj4_105","row_column__justify-space-between":"_row_column__justify-space-between_1bqj4_108","row_column__justify-space-around":"_row_column__justify-space-around_1bqj4_111","row_column__justify-space-evenly":"_row_column__justify-space-evenly_1bqj4_114","row_column__align-start":"_row_column__align-start_1bqj4_117","row_column__align-end":"_row_column__align-end_1bqj4_120","row_column__align-center":"_row_column__align-center_1bqj4_123","row_column__align-stretch":"_row_column__align-stretch_1bqj4_126","row_column__align-baseline":"_row_column__align-baseline_1bqj4_129"},Qt=t=>{const{userFlow:e,pageId:s,columnWidth:r,columns:l,gap:i="md",justifyContent:c="start",alignItems:n="stretch"}=t,d=Array.isArray(l)?l.map((a,_)=>{const u=`col_${_}`,h=`col_${_}`;if(Array.isArray(a))return{gap:"md",justifyContent:"start",alignItems:"start",items:a,hash:u,responseKey:h};const f=a;return{gap:(f==null?void 0:f.gap)??"md",justifyContent:(f==null?void 0:f.justifyContent)??"start",alignItems:(f==null?void 0:f.alignItems)??"start",items:(f==null?void 0:f.items)??[],hash:(f==null?void 0:f.hash)??u,responseKey:(f==null?void 0:f.responseKey)??h}}):[];return d.length===0?null:o.jsx("div",{className:Y(J.row,J[`row__gap-${i}`],J[`row__justify-${c}`],J[`row__align-${n}`]),children:d==null?void 0:d.map((a,_)=>{const u=(r==null?void 0:r[_])||`${100/d.length}%`,h=v(e,s,a.items);return!h||h.length===0?null:o.jsx("div",{className:Y(J.row_column,J[`row_column__gap-${a.gap}`],J[`row_column__justify-${a.justifyContent}`],J[`row_column__align-${a.alignItems}`]),style:{width:u},children:h},a.hash||_)})})};function Zt({userFlow:t,pageId:e,responseKey:s,actionType:r,getNextUI:l,isMulti:i=!1,debounceMs:c}){const n=x.useRef(null);x.useEffect(()=>()=>{n.current!==null&&(clearTimeout(n.current),n.current=null)},[]);const d=x.useCallback(async _=>{var f;const u={...(f=E.getState()[t])==null?void 0:f.entries};if(_?(u[s]=_,L(t,u)):(delete u[s],me(t,s)),r&&(r==="GO_TO_NEXT_UI"||r==="GO_TO_NEXT_UI_WITHOUT_LOADING"))try{const b=await l(t,e,u,s,r==="GO_TO_NEXT_UI");b!=null&&b.data&&M(t,b.data)}catch(g){console.error("[useSelectChange] Failed to fetch next UI",g)}},[t,e,s,r,l]);return x.useCallback(_=>{if(!i){d(_);return}if(c==null){d(_);return}n.current!==null&&(clearTimeout(n.current),n.current=null),n.current=setTimeout(()=>{d(_),n.current=null},c)},[i,c,d])}const vn=/\{([^}]+)\}/g,On=(t,e)=>{var s;return e.includes("{")?e.replace(vn,(r,l)=>{var c;const i=(c=K.query(t,l.trim()))==null?void 0:c[0];return i!=null?String(i):""}):(s=K.query(t,e))==null?void 0:s[0]},Rn=(t,e,s,r)=>{const l=K.query(t,e);return(l==null?void 0:l.map(i=>{var d;const c=On(i,s),n=r?(d=K.query(i,r))==null?void 0:d[0]:i;return{label:c,value:n}}))??[]},Dn=(t,e,s,r=10)=>{var n,d;let l,i;if(s){const a=K.value(t,s.size??"$.meta.size")??r,_=K.value(t,s.total??"$.meta.total")??0;l=a,i=_}else{const a=t==null?void 0:t.meta;l=(a==null?void 0:a.size)??((n=a==null?void 0:a.page)==null?void 0:n.size)??r,i=(a==null?void 0:a.total)??((d=a==null?void 0:a.page)==null?void 0:d.total)??0}const c=i>0?Math.ceil(i/l)>e:!1;return{pageSize:l,total:i,hasMore:c}},Ft={selectNotFront:"_selectNotFront_ch3v5_1"},Ln=({userFlow:t,pageId:e,responseKey:s,required:r,dataSource:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_,fetchDataSource:u}=U(),[h,f]=x.useState((a==null?void 0:a.value)??""),{disabled:g}=B(t,c),b=(a==null?void 0:a.disabled)??g,y=x.useMemo(()=>r&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,r]),m=x.useMemo(()=>{const j=a!=null&&a.isMulti?h:[h],k={};return Array.isArray(j)&&j.forEach(T=>{if(!T)return;const R=JSON.stringify(T.value),D=JSON.stringify(T.label);k[R]=T,D in k||(k[D]=T)}),k},[h]),p=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),C=j=>{f(j),p(j)},N=async(j,k,{page:T})=>{const{jsonPathLabel:R,jsonPathOptions:D,jsonPathValue:I,jsonPathPagination:$}=l,X=bt(l,T,j),O=await u(X,t,!1),H=O==null?void 0:O.data,lt=H?Rn(H,D,R,I):[],{hasMore:wt}=Dn(H,T,$);return{options:lt,hasMore:wt,additional:{page:T+1}}};return o.jsx(w.SelectPagination,{...a,className:Ft.selectNotFront,label:y,value:h,disabled:b,noOptionsMessage:()=>o.jsx(o.Fragment,{children:"Sin opciones"}),onChange:j=>!b&&C(j),loadOptions:N,additional:{page:1},isOptionDisabled:j=>{const k=JSON.stringify(j==null?void 0:j.value),T=JSON.stringify(j==null?void 0:j.label);return!!(m!=null&&m[k])||!!(m!=null&&m[T])},debounceTimeout:350})},In=({userFlow:t,pageId:e,responseKey:s,dataSource:r,required:l,actionType:i,dependencies:c,debounceMs:n,...d})=>{const a={...d},{getNextUI:_}=U(),[u,h]=x.useState(a.value||""),{disabled:f}=B(t,c),g=(a==null?void 0:a.disabled)??f,b=x.useMemo(()=>l&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,l]),y=Zt({userFlow:t,pageId:e,responseKey:s,actionType:i,getNextUI:_,isMulti:a==null?void 0:a.isMulti,debounceMs:n}),m=p=>{h(p),y(p)};return o.jsx(w.Select,{...a,className:Ft.selectNotFront,label:b,value:u,disabled:g,onChange:p=>!g&&m(p)})},Mn=t=>{const{dataSource:e}=t;return e?o.jsx(Ln,{...t}):o.jsx(In,{...t})},Pt={spacing:"_spacing_19hqa_1",spacing__xxs:"_spacing__xxs_19hqa_1",spacing__xs:"_spacing__xs_19hqa_4",spacing__sm:"_spacing__sm_19hqa_7",spacing__md:"_spacing__md_19hqa_10",spacing__lg:"_spacing__lg_19hqa_13",spacing__xl:"_spacing__xl_19hqa_16",spacing__xxl:"_spacing__xxl_19hqa_19",spacing__xxxl:"_spacing__xxxl_19hqa_22"},Bn=t=>{const{size:e}=t,s=Y(Pt.spacing,Pt[`spacing__${e}`]);return o.jsx("div",{className:s})},Kn=t=>{const{userFlow:e,pageId:s,responseKey:r,actionType:l,label:i,value:c,required:n,dependencies:d,...a}=t,_={...a},{getNextUI:u}=U(),[h,f]=x.useState(c||!1),{disabled:g}=B(e,d),b=(_==null?void 0:_.disabled)??g,y=x.useMemo(()=>n&&i?`${i} *`:i??"",[i,n]),m=x.useCallback(async()=>{var p;try{const C=!h;f(C);const N={...(p=E.getState()[e])==null?void 0:p.entries,[r]:C};switch(L(e,N),l){case"GO_TO_NEXT_UI":case"GO_TO_NEXT_UI_WITHOUT_LOADING":{const k=await u(e,s,N,r,l==="GO_TO_NEXT_UI");k!=null&&k.data&&M(e,k==null?void 0:k.data);break}default:break}}catch(C){console.error("Error in switch action:",C),alert(JSON.stringify(C))}},[e,s,r,l,h]);return o.jsx(w.Switch,{..._,label:y,checked:h,disabled:b,onChange:()=>!b&&m()})},$t={tableSkeleton:"_tableSkeleton_3nr9n_1",tableArrayPills:"_tableArrayPills_3nr9n_7"},Gn=({values:t})=>{const s=t==null?void 0:t.slice(0,4),r=(t==null?void 0:t.length)-4;return o.jsxs("div",{className:$t.tableArrayPills,children:[s.map((l,i)=>o.jsx(w.Pill,{children:String(l)},i)),r>0&&o.jsxs(w.Pill,{outlined:!0,children:["+",r]})]})},Hn=({userFlow:t,pageId:e,tableResponseKey:s,component:r,rowData:l})=>{const{getNextUI:i,fetchAndGetNextUI:c,fetchDataSource:n}=U(),d=v(t,e,[{...r}]),a=(d==null?void 0:d[0])||null;if(!a)return null;const{actionType:_,responseKey:u,dataSource:h}=a.props,f=x.useCallback(async()=>{var g,b,y;try{const m={...(g=E.getState()[t])==null?void 0:g.entries,[u]:{status:200},[s]:[{...l}]};switch(L(t,m),_){case"GO_TO_NEXT_UI":{const p=await i(t,e,m,u);p!=null&&p.data&&M(t,p==null?void 0:p.data);break}case"FETCH_AND_GO_TO_NEXT_UI":{const p=await c(t,e,m,u,h);p!=null&&p.data&&M(t,p==null?void 0:p.data);break}case"GET_DATA_SOURCE":{const p=await i(t,e,m,u),C=(b=p==null?void 0:p.data)==null?void 0:b.content;if((C==null?void 0:C.type)!=="fetch")break;const N=C==null?void 0:C.dataSource,j=await n(N,t,!1),k={...(y=E.getState()[t])==null?void 0:y.entries,[u]:{status:j==null?void 0:j.status,content:j==null?void 0:j.data}};L(t,k);const T=await i(t,e,k,u);T!=null&&T.data&&M(t,T==null?void 0:T.data);break}default:console.warn(`Unhandled actionType: ${_}`);break}}catch(m){alert(JSON.stringify(m))}},[_,h,e,u,t]);return x.cloneElement(a,{onClick:f})},Un=()=>o.jsx("div",{className:$t.tableSkeleton,children:[...Array(10)].map((t,e)=>o.jsx(w.SkeletonBase,{maxWidth:"100%",height:42,radius:8},`tableSkeletonBase${e}`))}),Vn=(t,e)=>!(e!=null&&e.length)||!t?t:t.map(s=>e.some(l=>Array.isArray(s!=null&&s.accessor?l[s==null?void 0:s.accessor]:void 0))?{...s,renderCell:l=>{const i=s.accessor?l[s.accessor]:void 0;return Array.isArray(i)?o.jsx(Gn,{values:i}):i??""}}:s),zn=({userFlow:t,pageId:e,responseKey:s,component:r,dataSource:l,rightActions:i,data:c,pageSize:n,...d})=>{var I,$,X;const{fetchDataSource:a}=U(),[_,u]=x.useState(!1),[h,f]=x.useState(1),[g,b]=x.useState(null),y=!l&&Array.isArray(c),m=x.useRef(new Map([[1,null]])),p=x.useMemo(()=>{if(i!=null&&i.length)return i.map((O,H)=>({renderContent:lt=>o.jsx(Hn,{userFlow:t,pageId:e,tableResponseKey:s,component:O,rowData:lt},`tableRowAction${H}`)}))},[i,t,e,s]),C=async(O=1)=>{if(!l)return;const{mapperData:H,jsonPathData:lt,jsonPathPagination:wt,jsonPathCursorPagination:it}=l;if(it&&O!==1&&!m.current.has(O)){f(1),C(1);return}it&&O===1&&(m.current=new Map([[1,null]]));try{u(!0);const Nt=it?m.current.get(O)??null:null,es=bt(l,O,void 0,Nt),tt=await a(es,t,!1);if(b(zt(tt==null?void 0:tt.data,lt,H,wt)),it){const oe=qe(tt==null?void 0:tt.data,it);oe&&m.current.set(O+1,oe)}u(!1)}catch(Nt){console.error("[TableNotFront] fetchData:",Nt),u(!1)}},N=O=>{f(O),C(O)};x.useEffect(()=>{y||C()},[]);const j=y?c:g==null?void 0:g.items,k=y&&!!n&&((c==null?void 0:c.length)??0)>n,T=x.useMemo(()=>{if(!k||!c||!n)return j??[];const O=(h-1)*n;return c.slice(O,O+n)},[k,c,n,h,j]),R=x.useMemo(()=>Vn(d.columns,j),[j,d.columns]),D={...d,data:T,columns:R??[],rightActions:p};return y?!j||j.length===0?o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"}):o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),k&&n&&c&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:n,total:c.length,onChange:f})]}):o.jsx(o.Fragment,{children:_?o.jsx(Un,{}):g&&((I=g==null?void 0:g.items)==null?void 0:I.length)>0?o.jsxs(o.Fragment,{children:[o.jsx(w.Table,{...D}),(g==null?void 0:g.pagination)&&(($=g==null?void 0:g.pagination)==null?void 0:$.totalPages)>1&&o.jsx(w.Pager,{classname:{global:"row__end"},page:h,size:g==null?void 0:g.pagination.size,total:(X=g==null?void 0:g.pagination)==null?void 0:X.total,onChange:N})]}):o.jsx(w.CardNotification,{state:"info",title:"Sin registros",children:"No hay datos disponibles para mostrar en este momento"})})},Xn={tabsPanel:"_tabsPanel_kvslb_1"},Jn=({userFlow:t,pageId:e,components:s})=>{const r=v(t,e,s);return r!=null&&r.length?o.jsx("section",{className:Xn.tabsPanel,children:r.map((l,i)=>o.jsx(x.Fragment,{children:l},`tabs-panel-${i}`))}):null},Wn=({userFlow:t,pageId:e,hash:s,items:r,activeIndex:l,className:i,responseKey:c})=>{const n=r.map((a,_)=>({label:a.label,disabled:a.disabled,children:o.jsx(Jn,{userFlow:t,pageId:e,components:a.components},`${s}-tab-${_}`)})),d=a=>{var u;const _={...(u=E.getState()[t])==null?void 0:u.entries,[c]:a};L(t,_)};return o.jsx(w.Tabs,{className:i,activeIndex:l,items:n,onClick:d})},qn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),f=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var p;const m=(p=y==null?void 0:y.target)==null?void 0:p.value;u(m),L(e,{[i]:m})};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.Textarea,{...a,label:g,value:_,disabled:f,onChange:y=>!f&&b(y)})},Yn={textFieldNotFront:"_textFieldNotFront_1n8fy_1"},Qn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,required:c,dependencies:n,...d}=t,a={...d},[_,u]=x.useState((a==null?void 0:a.value)??""),{disabled:h}=B(e,n),f=(a==null?void 0:a.disabled)??h,g=x.useMemo(()=>c&&(a!=null&&a.label)?`${a==null?void 0:a.label} *`:(a==null?void 0:a.label)??"",[a==null?void 0:a.label,c]),b=y=>{var C;const m=(C=y==null?void 0:y.target)==null?void 0:C.value;u(m);const p={[i]:m};L(e,p)};return x.useEffect(()=>{u((a==null?void 0:a.value)??"")},[a==null?void 0:a.value]),o.jsx(w.TextField,{...a,className:Yn.textFieldNotFront,allowClear:!1,label:g,value:_,disabled:f,onChange:y=>!f&&b(y)})},Zn=({userFlow:t,pageId:e,responseKey:s,variant:r,content:l,actionType:i,redirectUrl:c})=>{const n=x.useCallback(async()=>{ft(t);try{switch(i){case"AUTOCLOSE_AND_REDIRECT":window.location.href=c;break;default:console.warn(`Unhandled actionType: ${i}`);break}}catch(d){console.error("Error in toast action:",d),alert(JSON.stringify(d))}},[i,e,s,t,c]);return x.useEffect(()=>{({info:w.toast.info,error:w.toast.error,success:w.toast.success,warning:w.toast.warning}[r]||w.toast.info)(l,{autoClose:i?!1:4e3,containerId:t,onClose:n})},[n,t]),null},te={tooltipNotFront:"_tooltipNotFront_106iw_1",tooltipNotFront_content:"_tooltipNotFront_content_106iw_5"},Fn=t=>{const{userFlow:e,pageId:s,component:r,hash:l,responseKey:i,content:c,label:n,placement:d,notShowArrow:a,visible:_}=t,u=v(e,s,c!=null&&c.length?c:null),h=u&&u.length>0?o.jsx("div",{className:te.tooltipNotFront_content,children:u.map((f,g)=>o.jsx(x.Fragment,{children:f},`tooltip-${l}-${g}`))}):null;return o.jsx(w.Tooltip,{className:te.tooltipNotFront,label:n,placement:d,notShowArrow:a,visible:_,children:h})};function Pn({sessionName:t,apiConfig:e,onResolveComponentProps:s,children:r}){const l=re(t,e,null,s);return o.jsxs(o.Fragment,{children:[l,r]})}const $n={api:"",headers:{}},ee=({userFlow:t,components:e,hash:s,apiConfig:r})=>{const l=s??`${t}-page`;x.useState(()=>{var d,a;return(a=(d=E.getState()[t])==null?void 0:d.pages)!=null&&a[l]||dt(t,r??$n,{type:"page",hash:l,body:{components:e}}),null});const i=v(t,l,e);return o.jsx(o.Fragment,{children:i})};function ne(t){if(t==null||typeof t!="object"||!("components"in t)||!Array.isArray(t.components))throw new Error("[renderNotFront] payload.display must be an object with a `components` array");return t.components}const se=({payload:t,userFlow:e})=>{const s=ne(t.display),r=ee({userFlow:e,hash:t.id,components:s});return o.jsx(o.Fragment,{children:r})},ts=se,ae=(t,e,s,r,l)=>{const i=v(t,e,(r==null?void 0:r.components)||null,l);switch(s){case"body":return o.jsx(De,{...r,inputs:i||[]},JSON.stringify(r==null?void 0:r.components));case"header":return o.jsx(pn,{...r,components:i||[]},JSON.stringify(r==null?void 0:r.components));default:return null}},re=(t,e,s,r)=>{var h,f,g;const[l,i]=x.useState(!1),c=E(b=>b),n=(h=c[t])==null?void 0:h.currentPageId;x.useEffect(()=>{if(typeof window>"u")return;const b=new URL(window.location.href),y=b.searchParams.get("sessionId");y&&(sessionStorage.setItem("sessionId",y),b.searchParams.delete("sessionId"),window.history.replaceState({},"",b.toString()))},[]);const d=n?ae(t,n,"header",((f=c[t].pages[n].page)==null?void 0:f.header)||null,r):null,a=n?ae(t,n,"body",((g=c[t].pages[n].page)==null?void 0:g.body)||null,r):null,_=x.useMemo(()=>{var b;return o.jsxs(o.Fragment,{children:[((b=c[t])==null?void 0:b.isLoading)&&o.jsx(w.Loading,{}),d,a,n&&o.jsx(kn,{userFlow:t,pageId:n}),c[t]&&o.jsx(w.Toaster,{})]})},[d,a,n,t]),u=async()=>{try{const b=await Bt(e,t),y=b==null?void 0:b.data,m=y==null?void 0:y.content;(b==null?void 0:b.status)===200?dt(t,e,m,y==null?void 0:y.sessionState):i(!0)}catch(b){console.error("[not-page]: API call failed",b),i(!0)}};return x.useEffect(()=>{e!=null&&e.api&&!s&&t?u():!(e!=null&&e.api)&&s&&t||e!=null&&e.api&&s&&t?dt(t,e,s):(!(e!=null&&e.api)&&!s||!t)&&(i(!0),console.error("[not-page]: API call failed","not api config","not userFlow"));const b="avocado-theme-mode-changed",y=m=>{const p=m.detail;w.ThemeStore.setThemeMode(p)};return window.addEventListener(b,y),()=>{window.removeEventListener(b,y)}},[]),l&&console.error("[not-page]: No render page"),_};A.Chart=Wt,A.NotFrontPage=Pn,A.RenderNotFront=se,A.Row=Qt,A.extractNotFrontComponents=ne,A.heading=Dt,A.renderNotFront=ts,A.text=Lt,A.useNotFrontFragment=ee,A.usePage=re,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { ChartTheme, ChartType } from './chart.types';
|
|
2
2
|
export declare const CHART_HEIGHT = 400;
|
|
3
3
|
export declare const CHART_CATEGORY_WIDTH_PX = 56;
|
|
4
|
+
export declare const CHART_CATEGORY_HEIGHT_PX = 28;
|
|
5
|
+
export declare const CHART_Y_AXIS_MIN_WIDTH_PX = 100;
|
|
6
|
+
export declare const CHART_Y_AXIS_CHAR_WIDTH_PX = 8;
|
|
4
7
|
export declare const scrollableChartTypes: Set<ChartType>;
|
|
5
8
|
export declare const chartRegistry: {
|
|
6
9
|
area: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
bar: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
horizontalBar: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
8
12
|
line: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
mixBar: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
9
14
|
pie: (config: import("./chart.types").ChartConfig) => import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
};
|
|
11
16
|
export declare const chartColors: string[];
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
export type ChartType = 'bar' | 'line' | 'area' | 'pie';
|
|
1
|
+
export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'horizontalBar' | 'mixBar';
|
|
2
|
+
export interface ChartSeriesConfig {
|
|
3
|
+
key: string;
|
|
4
|
+
stackId?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TooltipCoverageConfig {
|
|
9
|
+
numeratorKey: string;
|
|
10
|
+
denominatorKey: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
2
13
|
export interface ChartTheme {
|
|
3
14
|
fontFamily: string;
|
|
4
15
|
fontSize: number;
|
|
@@ -12,9 +23,22 @@ export interface ChartConfig {
|
|
|
12
23
|
data: any[];
|
|
13
24
|
xKey: string;
|
|
14
25
|
yKeys: string[];
|
|
26
|
+
series?: ChartSeriesConfig[];
|
|
15
27
|
tooltipKey?: string;
|
|
16
28
|
/** Render width in px; set by Chart when using horizontal scroll. */
|
|
17
29
|
width?: number;
|
|
18
30
|
/** Min horizontal space per category when computing scroll width. */
|
|
19
31
|
minCategoryWidth?: number;
|
|
32
|
+
/** Min vertical space per category row when computing chart height. */
|
|
33
|
+
minCategoryHeight?: number;
|
|
34
|
+
/** Fixed override for total chart height (takes precedence over computed height). */
|
|
35
|
+
chartHeight?: number;
|
|
36
|
+
/** Optional config to render a coverage % line in the tooltip. */
|
|
37
|
+
tooltipCoverage?: TooltipCoverageConfig;
|
|
38
|
+
/** Controls visibility of the internal Recharts legend (default: true). */
|
|
39
|
+
showLegend?: boolean;
|
|
40
|
+
/** Human-readable label per yKey for tooltip and legend display. */
|
|
41
|
+
yKeyLabels?: Record<string, string>;
|
|
42
|
+
/** Width in px for the category Y axis (`horizontalBar` only). Auto-computed when omitted. */
|
|
43
|
+
yAxisWidth?: number;
|
|
20
44
|
}
|
|
@@ -10,3 +10,21 @@
|
|
|
10
10
|
* @returns Content width in pixels; `0` when the container is not measured yet.
|
|
11
11
|
*/
|
|
12
12
|
export declare function getChartContentWidth(containerWidth: number, dataLength: number, minCategoryWidth?: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the pixel height the chart content should occupy.
|
|
15
|
+
*
|
|
16
|
+
* When there are more categories than fit in the default viewport, the result
|
|
17
|
+
* exceeds `CHART_HEIGHT` so each row has enough vertical space.
|
|
18
|
+
*
|
|
19
|
+
* @param dataLength - Number of data categories (rows on the Y axis).
|
|
20
|
+
* @param minCategoryHeight - Minimum vertical space per category in pixels.
|
|
21
|
+
* @param fixedHeight - When provided, overrides the computed height.
|
|
22
|
+
* @returns Content height in pixels.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getChartContentHeight(dataLength: number, minCategoryHeight?: number, fixedHeight?: number): number;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the pixel width the category Y axis should occupy.
|
|
27
|
+
*
|
|
28
|
+
* Uses the longest label in `data` when no fixed width is provided.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCategoryAxisWidth(data: unknown[], xKey: string, fixedWidth?: number): number;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AreaChart } from './AreaChart';
|
|
2
2
|
import { BarChart } from './BarChart';
|
|
3
|
+
import { HorizontalBarChart } from './HorizontalBarChart';
|
|
3
4
|
import { LineChart } from './LineChart';
|
|
5
|
+
import { MixBarChart } from './MixBarChart';
|
|
4
6
|
import { PieChart } from './PieChart';
|
|
5
|
-
export { AreaChart, BarChart, LineChart, PieChart };
|
|
7
|
+
export { AreaChart, BarChart, HorizontalBarChart, MixBarChart, LineChart, PieChart, };
|
|
@@ -4,12 +4,15 @@ interface RechartsChartProps {
|
|
|
4
4
|
height?: number;
|
|
5
5
|
data?: unknown[];
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
+
layout?: 'horizontal' | 'vertical';
|
|
7
8
|
}
|
|
8
9
|
interface ChartFrameProps {
|
|
9
10
|
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
layout?: 'horizontal' | 'vertical';
|
|
10
13
|
data: unknown[];
|
|
11
14
|
Chart: React.ComponentType<RechartsChartProps>;
|
|
12
15
|
children: React.ReactNode;
|
|
13
16
|
}
|
|
14
|
-
export declare const ChartFrame: ({ width, data, Chart, children, }: ChartFrameProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const ChartFrame: ({ width, height, layout, data, Chart, children, }: ChartFrameProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
18
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { TooltipCoverageConfig } from '../chart.types';
|
|
1
2
|
interface TooltipProps {
|
|
2
3
|
tooltipKey?: string;
|
|
4
|
+
tooltipCoverage?: TooltipCoverageConfig;
|
|
3
5
|
}
|
|
4
|
-
export declare const Tooltip: ({ tooltipKey }?: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const Tooltip: ({ tooltipKey, tooltipCoverage, }?: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface XAxisProps {
|
|
2
|
-
dataKey
|
|
2
|
+
dataKey?: string;
|
|
3
3
|
hide?: boolean;
|
|
4
|
+
type?: 'number' | 'category';
|
|
4
5
|
}
|
|
5
|
-
export declare const XAxis: ({ dataKey, hide }: XAxisProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const XAxis: ({ dataKey, hide, type }: XAxisProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
interface YAxisProps {
|
|
2
|
+
type?: 'number' | 'category';
|
|
3
|
+
dataKey?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const YAxis: ({ type, dataKey, width }?: YAxisProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AccordionProps, ButtonProps, CardAccordionProps, CardNotificationProps, CheckboxProps, DividerProps, DrawerProps, HeadingProps, LinkProps, ModalProps, PillProps, PreviewerMarkdownProps, RoundButtonProps, SelectProps, SwitchProps, TableProps, TabsProps, TextareaProps, TextFieldProps, TextProps } from '../../../avocado-suite';
|
|
2
2
|
import type { AiAgentTheme, ChatPanelTranslations, SuggestionType, SupportedLocale } from '../../../ai-agent';
|
|
3
|
+
import type { TooltipCoverageConfig } from '../components/chart/chart.types';
|
|
4
|
+
import type { ChartSeriesConfig } from '../components/chart/chart.types';
|
|
3
5
|
import { NotFrontActionType, NotFrontBaseProps, NotFrontDataSource, NotFrontDataSourceChart, NotFrontDataSourceRest, NotFrontDataSourceSelect, NotFrontDataSourceTable, NotFrontDependency } from './componentsCore.type';
|
|
4
6
|
/**
|
|
5
7
|
* Suite `Box`: single `content` slot; `darkMode` is derived in the wrapper.
|
|
@@ -14,7 +16,7 @@ export interface BoxNotFrontProps extends NotFrontBaseProps {
|
|
|
14
16
|
export interface ChartNotFrontProps extends NotFrontBaseProps {
|
|
15
17
|
component: 'chart';
|
|
16
18
|
/** Chart type */
|
|
17
|
-
type: 'area' | 'bar' | 'line' | 'pie';
|
|
19
|
+
type: 'area' | 'bar' | 'line' | 'pie' | 'horizontalBar' | 'mixBar';
|
|
18
20
|
/** Data source to load data for chart. */
|
|
19
21
|
dataSource: NotFrontDataSourceChart;
|
|
20
22
|
/** Chart data */
|
|
@@ -23,10 +25,24 @@ export interface ChartNotFrontProps extends NotFrontBaseProps {
|
|
|
23
25
|
xKey: string;
|
|
24
26
|
/** Keys for the y-axis */
|
|
25
27
|
yKeys: string[];
|
|
28
|
+
/** Per-series configuration for mixBar charts (stackId, label, color). */
|
|
29
|
+
series?: ChartSeriesConfig[];
|
|
26
30
|
/** Optional field for custom tooltip values. */
|
|
27
31
|
tooltipKey?: string;
|
|
28
32
|
/** Min horizontal pixels per category when computing scroll width. */
|
|
29
33
|
minCategoryWidth?: number;
|
|
34
|
+
/** Min vertical pixels per category row when computing chart height. */
|
|
35
|
+
minCategoryHeight?: number;
|
|
36
|
+
/** Fixed override for total chart height. */
|
|
37
|
+
chartHeight?: number;
|
|
38
|
+
/** Optional config to render a coverage % line in the tooltip. */
|
|
39
|
+
tooltipCoverage?: TooltipCoverageConfig;
|
|
40
|
+
/** Controls visibility of the internal Recharts legend (default: true). */
|
|
41
|
+
showLegend?: boolean;
|
|
42
|
+
/** Human-readable label per yKey for tooltip and legend display. */
|
|
43
|
+
yKeyLabels?: Record<string, string>;
|
|
44
|
+
/** Width in px for the category Y axis (`horizontalBar` only). Auto-computed when omitted. */
|
|
45
|
+
yAxisWidth?: number;
|
|
30
46
|
}
|
|
31
47
|
/**
|
|
32
48
|
* Represents a single breadcrumb item for the NotFront component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foris/avocado-not-front",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"recharts": "3.1.0",
|
|
57
57
|
"zustand": "4.5.4",
|
|
58
58
|
"@uiw/react-codemirror": "4.23.12",
|
|
59
|
-
"@foris/ai-agent": "1.1.1",
|
|
60
59
|
"@foris/avocado-core": "1.3.1",
|
|
60
|
+
"@foris/ai-agent": "1.1.1",
|
|
61
61
|
"@foris/avocado-icons": "1.16.7",
|
|
62
|
-
"@foris/
|
|
63
|
-
"@foris/
|
|
62
|
+
"@foris/tsconfig": "0.0.2",
|
|
63
|
+
"@foris/avocado-suite": "1.8.15"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"@codemirror/lang-json": ">=6.0.0",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"recharts": ">=3.0.0",
|
|
79
79
|
"streamdown": ">=1.6.0",
|
|
80
80
|
"zustand": ">=4.0.0",
|
|
81
|
-
"@foris/ai-agent": "1.1.1",
|
|
82
81
|
"@foris/avocado-core": "1.3.1",
|
|
82
|
+
"@foris/ai-agent": "1.1.1",
|
|
83
83
|
"@foris/avocado-icons": "1.16.7",
|
|
84
84
|
"@foris/avocado-suite": "1.8.15"
|
|
85
85
|
},
|