upconta.frontend-utils 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Identifica los datos iniciales de una página y verifica si estos han cambiado
3
+ * para prevenir cerrar la página o impedir que navegue. También guarda
4
+ * periódicamente los datos para que en el caso de un cierre se pueda restaurar.
5
+ */
6
+ declare const useConfirmacionSalida: (key: string) => {
7
+ cambiarHashInicial: (values: unknown) => void;
8
+ cambiarDatosFormulario: (values: unknown) => void;
9
+ limpiar: () => void;
10
+ reanudar: () => void;
11
+ obtenerDataEmergencia: () => Promise<any>;
12
+ };
13
+ export default useConfirmacionSalida;
@@ -0,0 +1,60 @@
1
+ import { FormProps } from 'antd';
2
+ import type { Options, Params } from '../../types';
3
+ declare const useVistaInsertar: <T>(args: {
4
+ endpoint: string;
5
+ params?: Params;
6
+ data: Partial<T>;
7
+ automatizacionPara?: any;
8
+ formatearDataInicial?: (data: T) => Promise<void> | void;
9
+ registroId?: string;
10
+ soloParaInsertar?: boolean;
11
+ recuperacionEmergencia?: boolean;
12
+ sinOptions?: boolean;
13
+ onMounted?: () => Promise<void>;
14
+ }) => {
15
+ form: import("antd").FormInstance<T>;
16
+ router: import("next/router").NextRouter;
17
+ options: Options;
18
+ tipoEmision: import("react").MutableRefObject<"emitir" | "borrador" | "lote">;
19
+ objectId: string | undefined;
20
+ mainroute: string;
21
+ isLoading: boolean;
22
+ isReady: boolean;
23
+ data: Partial<T>;
24
+ endpoint: string;
25
+ onSubmit: (values: T, opciones?: {
26
+ /**
27
+ * Indica si al guardar el documento debe redireccionar a la vista
28
+ * principal
29
+ */
30
+ noRedirect?: boolean;
31
+ /**
32
+ * Un endpoint personalizado para realizar la operación
33
+ */
34
+ endpoint?: string;
35
+ /**
36
+ * Params personalizados
37
+ */
38
+ params?: Params;
39
+ /**
40
+ * No lanza el error desde el hook, mas bien lanza un throw con el error
41
+ */
42
+ noShowError?: boolean;
43
+ }) => Promise<T | undefined>;
44
+ onMainRouter: () => Promise<boolean>;
45
+ setIsLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
46
+ preventor: {
47
+ cambiarHashInicial: (values: unknown) => void;
48
+ cambiarDatosFormulario: (values: unknown) => void;
49
+ limpiar: () => void;
50
+ reanudar: () => void;
51
+ obtenerDataEmergencia: () => Promise<any>;
52
+ };
53
+ ModoCarga: import("react/jsx-runtime").JSX.Element;
54
+ BotonesPorDefecto: import("react/jsx-runtime").JSX.Element;
55
+ onMensajeValidacion: () => import("antd/es/message/interface").MessageType;
56
+ getOption: (name: string, value: string) => string;
57
+ formProps: FormProps<any>;
58
+ };
59
+ export type VistaInsertar<T = unknown> = ReturnType<typeof useVistaInsertar<T>>;
60
+ export default useVistaInsertar;
@@ -1,11 +1,5 @@
1
1
  import { TableProps } from 'antd';
2
- type Option = {
3
- id: string;
4
- description: string;
5
- value?: number;
6
- stringValue?: string;
7
- show?: boolean;
8
- };
2
+ import type { Options } from '../../types';
9
3
  interface Params {
10
4
  q?: string;
11
5
  fields?: string;
@@ -24,7 +18,7 @@ declare const useVistaPrincipal: <T>(args: {
24
18
  data: T[];
25
19
  isLoading: boolean;
26
20
  error: any;
27
- options: Record<string, Option[]>;
21
+ options: Options;
28
22
  endpoint: string;
29
23
  endpointWithHost: string;
30
24
  mainroute: string;
@@ -2,3 +2,4 @@ export * from './utils';
2
2
  export { default as $reglas } from './reglas';
3
3
  export { default as $filtros } from './filtros';
4
4
  export { default as useVistaPrincipal } from './hooks/vista-principal';
5
+ export { default as useVistaInsertar } from './hooks/vista-insertar';
@@ -31,8 +31,13 @@ export declare const useUtils: () => {
31
31
  export declare const getAxios: (endpoint: "fastify" | "restify" | string, args?: {
32
32
  tipo: "usuario" | "administrador";
33
33
  }) => import("axios").AxiosInstance;
34
+ export declare const crearToken: (token: string, args: {
35
+ usuario: "usuario" | "administrador";
36
+ }) => void;
37
+ export declare const destruirToken: (tipo: "usuario" | "administrador") => void;
34
38
  /**
35
39
  * Retorna la url completa, apuntando al endpoind en restify o fastify
36
40
  */
37
41
  export declare const getApiEndpoint: (endpoint: string, queries?: Record<string, string>) => string;
42
+ export declare const hashear: (mensaje: string) => number;
38
43
  export {};
@@ -1,4 +1,4 @@
1
- import e,{useState as t,useEffect as r,useRef as n}from"react";import o from"next/link";import{useRouter as a}from"next/router";import{ReloadOutlined as i}from"@ant-design/icons";import{Input as s,Button as c,Typography as u,Breadcrumb as l,App as f,Form as p,ConfigProvider as d,Layout as m}from"antd";import y from"axios";import{getCookie as v}from"cookies-next";import h from"dayjs";import{debounce as g}from"ts-debounce";import b,{useSWRConfig as w}from"swr";import x from"antd/locale/es_ES";!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".\\!m-0{margin:0!important}.\\!mb-0{margin-bottom:0!important}.mb-6{margin-bottom:1.5rem}.mt-4{margin-top:1rem}.flex{display:flex}.w-full{width:100%}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-6{gap:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.\\!font-normal{font-weight:400!important}@media (min-width:768px){.md\\:w-auto{width:auto}.md\\:flex-row{flex-direction:row}.md\\:flex-nowrap{flex-wrap:nowrap}.md\\:items-end{align-items:flex-end}}",{insertAt:"top"});var S=function(){return S=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},S.apply(this,arguments)};function j(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))}function k(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}"function"==typeof SuppressedError&&SuppressedError;var O,_={exports:{}},R={};var E,P={};
1
+ import e,{useState as t,useEffect as r,createContext as n,useContext as o,useLayoutEffect as a,useRef as i,useMemo as s,useCallback as u,useDebugValue as c}from"react";import l from"next/link";import{useRouter as f,Router as d}from"next/router";import{ReloadOutlined as p,QuestionCircleOutlined as m}from"@ant-design/icons";import{Input as v,Button as y,Typography as h,Breadcrumb as g,App as b,Form as w,Space as S,Skeleton as _,ConfigProvider as O,Layout as E}from"antd";import x from"axios";import{getCookie as j,setCookie as R,deleteCookie as k}from"cookies-next";import T from"dayjs";import{debounce as L}from"ts-debounce";import D,{useSWRConfig as P}from"swr";import I from"antd/locale/es_ES";!function(e,t){void 0===t&&(t={});var r=t.insertAt;if("undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".\\!m-0{margin:0!important}.\\!mb-0{margin-bottom:0!important}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.w-full{width:100%}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.\\!font-normal{font-weight:400!important}@media (min-width:768px){.md\\:w-auto{width:auto}.md\\:flex-row{flex-direction:row}.md\\:flex-nowrap{flex-wrap:nowrap}.md\\:items-end{align-items:flex-end}}",{insertAt:"top"});var F=function(){return F=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},F.apply(this,arguments)};function C(e,t,r,n){return new(r||(r=Promise))((function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}u((n=n.apply(e,t||[])).next())}))}function N(e,t){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function A(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var V,$={exports:{}},q={};var M,U={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.development.js
@@ -7,5 +7,14 @@ import e,{useState as t,useEffect as r,useRef as n}from"react";import o from"nex
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */"production"===process.env.NODE_ENV?_.exports=function(){if(O)return R;O=1;var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,c={},u=null,l=null;for(s in void 0!==n&&(u=""+n),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,s)&&!i.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===c[s]&&(c[s]=t[s]);return{$$typeof:r,type:e,key:u,ref:l,props:c,_owner:a.current}}return R.Fragment=n,R.jsx=s,R.jsxs=s,R}():_.exports=(E||(E=1,"production"!==process.env.NODE_ENV&&function(){var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y=Symbol.iterator,v="@@iterator",h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=h.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var b,w=!1,x=!1,S=!1,j=!1,k=!1;function O(e){return e.displayName||"Context"}function _(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return O(e)+".Consumer";case s:return O(e._context)+".Provider";case u:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:_(e.type)||"Memo";case d:var r=e,m=r._payload,y=r._init;try{return _(y(m))}catch(e){return null}}return null}b=Symbol.for("react.module.reference");var R,E,T,F,N,D,C,I=Object.assign,$=0;function L(){}L.__reactDisabledLog=!0;var q,A=h.ReactCurrentDispatcher;function U(e,t,r){if(void 0===q)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return"\n"+q+e}var Y,M=!1,W="function"==typeof WeakMap?WeakMap:Map;function z(e,t){if(!e||M)return"";var r,n=Y.get(e);if(void 0!==n)return n;M=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=A.current,A.current=null,function(){if(0===$){R=console.log,E=console.info,T=console.warn,F=console.error,N=console.group,D=console.groupCollapsed,C=console.groupEnd;var e={configurable:!0,enumerable:!0,value:L,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),c=r.stack.split("\n"),u=s.length-1,l=c.length-1;u>=1&&l>=0&&s[u]!==c[l];)l--;for(;u>=1&&l>=0;u--,l--)if(s[u]!==c[l]){if(1!==u||1!==l)do{if(u--,--l<0||s[u]!==c[l]){var f="\n"+s[u].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&Y.set(e,f),f}}while(u>=1&&l>=0);break}}}finally{M=!1,A.current=o,function(){if(0==--$){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:R}),info:I({},e,{value:E}),warn:I({},e,{value:T}),error:I({},e,{value:F}),group:I({},e,{value:N}),groupCollapsed:I({},e,{value:D}),groupEnd:I({},e,{value:C})})}$<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",d=p?U(p):"";return"function"==typeof e&&Y.set(e,d),d}function B(e,t,r){if(null==e)return"";if("function"==typeof e)return z(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return U(e);switch(e){case l:return U("Suspense");case f:return U("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return z(e.render,!1);case p:return B(e.type,t,r);case d:var o=e,a=o._payload,i=o._init;try{return B(i(a),t,r)}catch(e){}}return""}Y=new W;var H=Object.prototype.hasOwnProperty,J={},K=h.ReactDebugCurrentFrame;function V(e){if(e){var t=e._owner,r=B(e.type,e._source,t?t.type:null);K.setExtraStackFrame(r)}else K.setExtraStackFrame(null)}var X=Array.isArray;function G(e){return X(e)}function Q(e){return""+e}function Z(e){if(function(e){try{return Q(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),Q(e)}var ee,te,re,ne=h.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};re={};var ae=function(e,t,n,o,a,i,s){var c={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ie(e,t,r,n,o){var a,i={},s=null,c=null;for(a in void 0!==r&&(Z(r),s=""+r),function(e){if(H.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Z(t.key),s=""+t.key),function(e){if(H.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e,t){if("string"==typeof e.ref&&ne.current&&t&&ne.current.stateNode!==t){var r=_(ne.current.type);re[r]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',_(ne.current.type),e.ref),re[r]=!0)}}(t,o)),t)H.call(t,a)&&!oe.hasOwnProperty(a)&&(i[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===i[a]&&(i[a]=u[a])}if(s||c){var l="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){ee||(ee=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(i,l),c&&function(e,t){var r=function(){te||(te=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(i,l)}return ae(e,s,c,o,n,ne.current,i)}var se,ce=h.ReactCurrentOwner,ue=h.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=B(e.type,e._source,t?t.type:null);ue.setExtraStackFrame(r)}else ue.setExtraStackFrame(null)}function fe(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function pe(){if(ce.current){var e=_(ce.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var de={};function me(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=pe();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!de[r]){de[r]=!0;var n="";e&&e._owner&&e._owner!==ce.current&&(n=" It was passed a child from "+_(e._owner.type)+"."),le(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),le(null)}}}function ye(e,t){if("object"==typeof e)if(G(e))for(var r=0;r<e.length;r++){var n=e[r];fe(n)&&me(n,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=y&&e[y]||e[v];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)fe(a.value)&&me(a.value,t)}}function ve(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==u&&r.$$typeof!==p)return;t=r.propTypes}if(t){var n=_(r);!function(e,t,r,n,o){var a=Function.call.bind(H);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var c=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}s=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(V(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),V(null)),s instanceof Error&&!(s.message in J)&&(J[s.message]=!0,V(o),g("Failed %s type: %s",r,s.message),V(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||se||(se=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var he={};function ge(e,t,n,y,v,h){var O=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===i||k||e===a||e===l||e===f||j||e===m||w||x||S)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===s||e.$$typeof===c||e.$$typeof===u||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!O){var R,E="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(E+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),E+=pe(),null===e?R="null":G(e)?R="array":void 0!==e&&e.$$typeof===r?(R="<"+(_(e.type)||"Unknown")+" />",E=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,E)}var P=ie(e,t,n,v,h);if(null==P)return P;if(O){var T=t.children;if(void 0!==T)if(y)if(G(T)){for(var F=0;F<T.length;F++)ye(T[F],e);Object.freeze&&Object.freeze(T)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ye(T,e)}if(H.call(t,"key")){var N=_(e),D=Object.keys(t).filter((function(e){return"key"!==e})),C=D.length>0?"{key: someKey, "+D.join(": ..., ")+": ...}":"{key: someKey}";he[N+C]||(g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',C,N,D.length>0?"{"+D.join(": ..., ")+": ...}":"{}",N),he[N+C]=!0)}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){le(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),le(null);break}}null!==e.ref&&(le(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}(P):ve(P),P}var be=function(e,t,r){return ge(e,t,r,!1)},we=function(e,t,r){return ge(e,t,r,!0)};P.Fragment=o,P.jsx=be,P.jsxs=we}()),P);var T=_.exports,F=function(e){return e.paths?T.jsx(l,{items:e.paths.map((function(e){var t=e.to,r=e.label;return{title:t?T.jsx(o,{href:t,children:r}):r}}))}):null},N=function(e){var n,l=e.defaultInsert,f=void 0!==l&&l,p=e.loading,d=void 0!==p&&p,m=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["defaultInsert","loading"]),y=a(),v=y.pathname,h=t(""),g=h[0],b=h[1],w=new URLSearchParams(y.query),x=function(){var e=new URLSearchParams(w.toString());(e.get("q")||"")!==g&&(g?e.set("q",g):e.delete("q"),e.delete("page"),y.push({query:Object.fromEntries(e)}))},S=T.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==m.ocultarBuscador?T.jsx(s.Search,{value:g,placeholder:"Ingresar búsqueda",onChange:function(e){return b(e.target.value||"")},onSearch:x,onPressEnter:x}):null,null!==f?f||T.jsx(o,{href:(n=v,n.endsWith("/")&&(n=n.slice(0,-1)),n+"/insert"),children:T.jsx(c,{type:"primary",children:"Insertar"})}):null,m.onRefrescar?T.jsx("div",{children:T.jsx(c,{loading:d,title:"Refrescar datos",icon:T.jsx(i,{}),onClick:m.onRefrescar})}):null,m.children]});return r((function(){y.isReady&&b(w.get("q")||"")}),[y.isReady]),T.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[T.jsxs("div",{children:[T.jsx(F,{paths:m.paths}),T.jsx(u.Title,{className:"!mb-0 mt-4",children:m.title}),m.subtitle&&T.jsx(u.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:m.subtitle})]}),null!==m.column?m.column||S:null]})},D={hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:""},C=function(e){D=S(S({},D),e)},I=function(e){return j(void 0,void 0,void 0,(function(){var t,r,n,o,a,i;return k(this,(function(s){switch(s.label){case 0:if(!((t=(null===(a=e.response)||void 0===a?void 0:a.data)?(null===(i=e.response.data)||void 0===i?void 0:i.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),n=(r=JSON).parse,[4,t.text()];case 2:return[2,n.apply(r,[s.sent()]).message];case 3:return s.sent(),o={},[4,t.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:t,tipo:"error"}]}}))}))},$=function(){var e=f.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return j(void 0,void 0,void 0,(function(){var n;return k(this,(function(o){switch(o.label){case 0:return[4,I(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:T.jsxs(T.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},L=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?D.hostFastify:D.hostRestify;var n=D.userTokenName;if("administrador"===(null==t?void 0:t.tipo))n=D.adminTokenName;var o=y.create({baseURL:r});return o.defaults.headers.common.Authorization=v(n,{domain:D.cookieDominio}),o},q=function(e,t){var r=new URL(e,e.includes("v4")?D.hostFastify:D.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},A={empresa:function(e,t){return j(void 0,void 0,void 0,(function(){return k(this,(function(e){switch(e.label){case 0:return t?[4,L("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},U={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,t){return void 0===t&&(t="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:t}},max:function(e,t){return void 0===t&&(t="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:t}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,t){return void 0===t&&(t="No cumple el formato requerido"),{pattern:e,message:t}},unico:function(e){return{validator:g(A[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return j(void 0,function(e,t,r){if(r||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),k(this,(function(e){if(t.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,t){return void 0===t&&(t="La fecha ingresada no es válido"),{validator:function(r,n){return j(void 0,void 0,void 0,(function(){var r;return k(this,(function(o){if(r=h(n).startOf("day").diff(h().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},Y="es-EC",M={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(Y,{style:"currency",currency:"USD",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))},date:function(e,t){return void 0===t&&(t="DD/MM/YYYY"),h(e).format(t)},completeDate:function(e){return h(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return h(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(Y,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}},W=function(e){var t=L(e.endpoint),r=a(),n=$().showError,o=w().mutate,i=b(e.sinOptions?null:e.optionsPath||e.endpoint+"/get-options",(function(e){return j(void 0,void 0,void 0,(function(){return k(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,s=void 0===i?{}:i,c=new URLSearchParams(S(S({},e.params),r.query)).toString(),u=e.endpoint+(c?"?"+c:""),l=b(r.isReady?u:null,(function(e){return j(void 0,void 0,void 0,(function(){return k(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),f=l.data,p=l.error,d=l.isLoading,m=(null==f?void 0:f.data)||[],y=(null==f?void 0:f.total)||0,v=new URLSearchParams(r.query),h=v.get("page"),g=h?parseInt(h):1,x=v.get("limit"),O=x?parseInt(x):20,_={loading:d,dataSource:m,rowKey:"_id",bordered:!0,pagination:{current:g,defaultPageSize:O,total:y},onChange:function(e,t,n){return j(void 0,void 0,void 0,(function(){var t,o,a,i;return k(this,(function(s){return t=v.toString(),o=new URLSearchParams(t),e.current!==g&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==O&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(n)||("ascend"===n.order?o.set("sort",n.field):"descend"===n.order?o.set("sort","-"+n.field):o.delete("sort")),t!==o.toString()&&r.push({query:Object.fromEntries(o)}),[2]}))}))}},R=function(){o(u)};return{data:m,isLoading:d,error:p,options:s,endpoint:e.endpoint,endpointWithHost:q(e.endpoint),mainroute:r.route,tableProps:_,init:R,getOpt:function(e,t){var r,n=null===(r=s[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return j(void 0,void 0,void 0,(function(){var o;return k(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return a.sent(),R(),[3,3];case 2:return o=a.sent(),n(o),[3,3];case 3:return[2]}}))}))},cancel:function(r){return j(void 0,void 0,void 0,(function(){var o;return k(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return a.sent(),R(),[3,3];case 2:return o=a.sent(),n(o),[3,3];case 3:return[2]}}))}))}}};var z=function(e){var r=t(""),o=r[0];r[1];var a=function(e){var t=this,r=n(e.defaultOptions),o=(e.type,{withOptions:!0,label:"Cliente",endpoint:"/v3/administrative/clients",params:{fields:"idType id name phone email address",estado:"activo"},field:"id",placeholder:"Ingresar la identificación del cliente",title:function(e){return"".concat(e.id)},subtitle:function(e){return e.name},preBusquedaQ:function(e){return void 0===e&&(e=""),e=e.trim(),/^\d+/.test(e)?"^"+e:e}});if(!o)return null;var a=L(o.endpoint),i=b(o.withOptions&&!e.defaultOptions?o.endpoint+"/get-options":null,(function(e){return j(t,void 0,void 0,(function(){return k(this,(function(t){switch(t.label){case 0:return[4,a.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return i&&(r.current=i),o}({type:e.type,defaultOptions:void 0});return a?T.jsx(p.Item,{name:e.name,label:e.hideLabel?void 0:e.label||a.label,extra:e.hideMessage?void 0:o,rules:e.required?[U.required()]:[{}],className:e.classNameFormItem}):null},B="#F34D24",H="#FFFFFF",J=function(e){var n=t(!1),o=n[0],a=n[1];return r((function(){a(!0)}),[]),o?T.jsx(d,{locale:x,theme:{token:{colorPrimary:B,colorLink:B,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:H,headerBg:H}}},children:T.jsx(f,{children:T.jsx(m,{className:e.className,style:e.style,children:e.children})})}):null};export{M as $filtros,U as $reglas,N as Header,z as Seeker,J as TemaPrincipal,C as configurarUtils,q as getApiEndpoint,L as getAxios,$ as useUtils,W as useVistaPrincipal};
10
+ */"production"===process.env.NODE_ENV?$.exports=function(){if(V)return q;V=1;var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,u={},c=null,l=null;for(s in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,s)&&!i.hasOwnProperty(s)&&(u[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===u[s]&&(u[s]=t[s]);return{$$typeof:r,type:e,key:c,ref:l,props:u,_owner:a.current}}return q.Fragment=n,q.jsx=s,q.jsxs=s,q}():$.exports=(M||(M=1,"production"!==process.env.NODE_ENV&&function(){var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,y="@@iterator",h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=h.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,r)}var b,w=!1,S=!1,_=!1,O=!1,E=!1;function x(e){return e.displayName||"Context"}function j(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case u:return x(e)+".Consumer";case s:return x(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:j(e.type)||"Memo";case p:var r=e,m=r._payload,v=r._init;try{return j(v(m))}catch(e){return null}}return null}b=Symbol.for("react.module.reference");var R,k,T,L,D,P,I,F=Object.assign,C=0;function N(){}N.__reactDisabledLog=!0;var A,V=h.ReactCurrentDispatcher;function $(e,t,r){if(void 0===A)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);A=n&&n[1]||""}return"\n"+A+e}var q,M=!1,W="function"==typeof WeakMap?WeakMap:Map;function B(e,t){if(!e||M)return"";var r,n=q.get(e);if(void 0!==n)return n;M=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=V.current,V.current=null,function(){if(0===C){R=console.log,k=console.info,T=console.warn,L=console.error,D=console.group,P=console.groupCollapsed,I=console.groupEnd;var e={configurable:!0,enumerable:!0,value:N,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}C++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),u=r.stack.split("\n"),c=s.length-1,l=u.length-1;c>=1&&l>=0&&s[c]!==u[l];)l--;for(;c>=1&&l>=0;c--,l--)if(s[c]!==u[l]){if(1!==c||1!==l)do{if(c--,--l<0||s[c]!==u[l]){var f="\n"+s[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&q.set(e,f),f}}while(c>=1&&l>=0);break}}}finally{M=!1,V.current=o,function(){if(0==--C){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:R}),info:F({},e,{value:k}),warn:F({},e,{value:T}),error:F({},e,{value:L}),group:F({},e,{value:D}),groupCollapsed:F({},e,{value:P}),groupEnd:F({},e,{value:I})})}C<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var d=e?e.displayName||e.name:"",p=d?$(d):"";return"function"==typeof e&&q.set(e,p),p}function Y(e,t,r){if(null==e)return"";if("function"==typeof e)return B(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return $(e);switch(e){case l:return $("Suspense");case f:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return B(e.render,!1);case d:return Y(e.type,t,r);case p:var o=e,a=o._payload,i=o._init;try{return Y(i(a),t,r)}catch(e){}}return""}q=new W;var H=Object.prototype.hasOwnProperty,z={},K=h.ReactDebugCurrentFrame;function G(e){if(e){var t=e._owner,r=Y(e.type,e._source,t?t.type:null);K.setExtraStackFrame(r)}else K.setExtraStackFrame(null)}var J=Array.isArray;function X(e){return J(e)}function Q(e){return""+e}function Z(e){if(function(e){try{return Q(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),Q(e)}var ee,te,re,ne=h.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};re={};var ae=function(e,t,n,o,a,i,s){var u={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function ie(e,t,r,n,o){var a,i={},s=null,u=null;for(a in void 0!==r&&(Z(r),s=""+r),function(e){if(H.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(Z(t.key),s=""+t.key),function(e){if(H.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(u=t.ref,function(e,t){if("string"==typeof e.ref&&ne.current&&t&&ne.current.stateNode!==t){var r=j(ne.current.type);re[r]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',j(ne.current.type),e.ref),re[r]=!0)}}(t,o)),t)H.call(t,a)&&!oe.hasOwnProperty(a)&&(i[a]=t[a]);if(e&&e.defaultProps){var c=e.defaultProps;for(a in c)void 0===i[a]&&(i[a]=c[a])}if(s||u){var l="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var r=function(){ee||(ee=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(i,l),u&&function(e,t){var r=function(){te||(te=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(i,l)}return ae(e,s,u,o,n,ne.current,i)}var se,ue=h.ReactCurrentOwner,ce=h.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=Y(e.type,e._source,t?t.type:null);ce.setExtraStackFrame(r)}else ce.setExtraStackFrame(null)}function fe(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function de(){if(ue.current){var e=j(ue.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var pe={};function me(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=de();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!pe[r]){pe[r]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+j(e._owner.type)+"."),le(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),le(null)}}}function ve(e,t){if("object"==typeof e)if(X(e))for(var r=0;r<e.length;r++){var n=e[r];fe(n)&&me(n,t)}else if(fe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=v&&e[v]||e[y];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)fe(a.value)&&me(a.value,t)}}function ye(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==d)return;t=r.propTypes}if(t){var n=j(r);!function(e,t,r,n,o){var a=Function.call.bind(H);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var u=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}s=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(G(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),G(null)),s instanceof Error&&!(s.message in z)&&(z[s.message]=!0,G(o),g("Failed %s type: %s",r,s.message),G(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||se||(se=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",j(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var he={};function ge(e,t,n,v,y,h){var x=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===i||E||e===a||e===l||e===f||O||e===m||w||S||_)||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===d||e.$$typeof===s||e.$$typeof===u||e.$$typeof===c||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!x){var R,k="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),k+=de(),null===e?R="null":X(e)?R="array":void 0!==e&&e.$$typeof===r?(R="<"+(j(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):R=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,k)}var T=ie(e,t,n,y,h);if(null==T)return T;if(x){var L=t.children;if(void 0!==L)if(v)if(X(L)){for(var D=0;D<L.length;D++)ve(L[D],e);Object.freeze&&Object.freeze(L)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ve(L,e)}if(H.call(t,"key")){var P=j(e),I=Object.keys(t).filter((function(e){return"key"!==e})),F=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";he[P+F]||(g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',F,P,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",P),he[P+F]=!0)}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){le(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),le(null);break}}null!==e.ref&&(le(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),le(null))}(T):ye(T),T}var be=function(e,t,r){return ge(e,t,r,!1)},we=function(e,t,r){return ge(e,t,r,!0)};U.Fragment=o,U.jsx=be,U.jsxs=we}()),U);var W,B=$.exports,Y=function(e){return e.paths?B.jsx(g,{items:e.paths.map((function(e){var t=e.to,r=e.label;return{title:t?B.jsx(l,{href:t,children:r}):r}}))}):null},H=function(e){var n,o=e.defaultInsert,a=void 0!==o&&o,i=e.loading,s=void 0!==i&&i,u=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["defaultInsert","loading"]),c=f(),d=c.pathname,m=t(""),g=m[0],b=m[1],w=new URLSearchParams(c.query),S=function(){var e=new URLSearchParams(w.toString());(e.get("q")||"")!==g&&(g?e.set("q",g):e.delete("q"),e.delete("page"),c.push({query:Object.fromEntries(e)}))},_=B.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==u.ocultarBuscador?B.jsx(v.Search,{value:g,placeholder:"Ingresar búsqueda",onChange:function(e){return b(e.target.value||"")},onSearch:S,onPressEnter:S}):null,null!==a?a||B.jsx(l,{href:(n=d,n.endsWith("/")&&(n=n.slice(0,-1)),n+"/insert"),children:B.jsx(y,{type:"primary",children:"Insertar"})}):null,u.onRefrescar?B.jsx("div",{children:B.jsx(y,{loading:s,title:"Refrescar datos",icon:B.jsx(p,{}),onClick:u.onRefrescar})}):null,u.children]});return r((function(){c.isReady&&b(w.get("q")||"")}),[c.isReady]),B.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[B.jsxs("div",{children:[B.jsx(Y,{paths:u.paths}),B.jsx(h.Title,{className:"!mb-0 mt-4",children:u.title}),u.subtitle&&B.jsx(h.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:u.subtitle})]}),null!==u.column?u.column||_:null]})},z={hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:""},K=function(e){z=F(F({},z),e)},G=function(e){return C(void 0,void 0,void 0,(function(){var t,r,n,o,a,i;return N(this,(function(s){switch(s.label){case 0:if(!((t=(null===(a=e.response)||void 0===a?void 0:a.data)?(null===(i=e.response.data)||void 0===i?void 0:i.message)||e.response.data:e.message)instanceof Blob))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,5]),n=(r=JSON).parse,[4,t.text()];case 2:return[2,n.apply(r,[s.sent()]).message];case 3:return s.sent(),o={},[4,t.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:t,tipo:"error"}]}}))}))},J=function(){var e=b.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return C(void 0,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return[4,G(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:B.jsxs(B.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},X=function(e){return"administrador"===e?z.adminTokenName:z.userTokenName},Q=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?z.hostFastify:z.hostRestify;var n=x.create({baseURL:r});return n.defaults.headers.common.Authorization=j(X(null==t?void 0:t.tipo),{domain:z.cookieDominio}),n},Z=function(e,t){R(X(t.usuario),e,{domain:z.cookieDominio,maxAge:604800})},ee=function(e){k(X(e),{domain:z.cookieDominio})},te=function(e,t){var r=new URL(e,e.includes("v4")?z.hostFastify:z.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},re=function(e){var t,r=0;if(0===e.length)return r;for(t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r},ne={empresa:function(e,t){return C(void 0,void 0,void 0,(function(){return N(this,(function(e){switch(e.label){case 0:return t?[4,Q("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},oe={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,t){return void 0===t&&(t="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:t}},max:function(e,t){return void 0===t&&(t="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:t}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,t){return void 0===t&&(t="No cumple el formato requerido"),{pattern:e,message:t}},unico:function(e){return{validator:L(ne[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return C(void 0,A([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),N(this,(function(e){if(t.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,t){return void 0===t&&(t="La fecha ingresada no es válido"),{validator:function(r,n){return C(void 0,void 0,void 0,(function(){var r;return N(this,(function(o){if(r=T(n).startOf("day").diff(T().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},ae="es-EC",ie={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(ae,{style:"currency",currency:"USD",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))},date:function(e,t){return void 0===t&&(t="DD/MM/YYYY"),T(e).format(t)},completeDate:function(e){return T(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return T(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(ae,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}},se={exports:{}},ue={};var ce,le={};
11
+ /**
12
+ * @license React
13
+ * use-sync-external-store-shim.development.js
14
+ *
15
+ * Copyright (c) Facebook, Inc. and its affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */"production"===process.env.NODE_ENV?se.exports=function(){if(W)return ue;W=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,a=t.useLayoutEffect,i=t.useDebugValue;function s(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),u=n({inst:{value:r,getSnapshot:t}}),c=u[0].inst,l=u[1];return a((function(){c.value=r,c.getSnapshot=t,s(c)&&l({inst:c})}),[e,r,t]),o((function(){return s(c)&&l({inst:c}),e((function(){s(c)&&l({inst:c})}))}),[e]),i(r),r};return ue.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:u,ue}():se.exports=(ce||(ce=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=e,r=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];!function(e,t,n){var o=r.ReactDebugCurrentFrame.getStackAddendum();""!==o&&(t+="%s",n=n.concat([o]));var a=n.map((function(e){return String(e)}));a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}("error",e,n)}var o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=t.useState,i=t.useEffect,s=t.useLayoutEffect,u=t.useDebugValue,c=!1,l=!1;function f(e){var t=e.getSnapshot,r=e.value;try{var n=t();return!o(r,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t,r){return t()}:function(e,r,d){c||void 0!==t.startTransition&&(c=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=r();if(!l){var m=r();o(p,m)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}var v=a({inst:{value:p,getSnapshot:r}}),y=v[0].inst,h=v[1];return s((function(){y.value=p,y.getSnapshot=r,f(y)&&h({inst:y})}),[e,p,r]),i((function(){return f(y)&&h({inst:y}),e((function(){f(y)&&h({inst:y})}))}),[e]),u(p),p},p=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d;le.useSyncExternalStore=p,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),le);var fe=se.exports;const de=()=>{},pe=de(),me=Object,ve=e=>e===pe,ye=e=>"function"==typeof e,he=(e,t)=>({...e,...t}),ge=new WeakMap;let be=0;const we=e=>{const t=typeof e,r=e&&e.constructor,n=r==Date;let o,a;if(me(e)!==e||n||r==RegExp)o=n?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=ge.get(e),o)return o;if(o=++be+"~",ge.set(e,o),r==Array){for(o="@",a=0;a<e.length;a++)o+=we(e[a])+",";ge.set(e,o)}if(r==me){o="#";const t=me.keys(e).sort();for(;!ve(a=t.pop());)ve(e[a])||(o+=a+":"+we(e[a])+",");ge.set(e,o)}}return o},Se=new WeakMap,_e={},Oe={},Ee="undefined",xe=typeof window!=Ee,je=typeof document!=Ee,Re=(e,t)=>{const r=Se.get(e);return[()=>!ve(t)&&e.get(t)||_e,n=>{if(!ve(t)){const o=e.get(t);t in Oe||(Oe[t]=o),r[5](t,he(o,n),o||_e)}},r[6],()=>!ve(t)&&t in Oe?Oe[t]:!ve(t)&&e.get(t)||_e]};let ke=!0;const[Te,Le]=xe&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[de,de],De={isOnline:()=>ke,isVisible:()=>{const e=je&&document.visibilityState;return ve(e)||"hidden"!==e}},Pe={initFocus:e=>(je&&document.addEventListener("visibilitychange",e),Te("focus",e),()=>{je&&document.removeEventListener("visibilitychange",e),Le("focus",e)}),initReconnect:e=>{const t=()=>{ke=!0,e()},r=()=>{ke=!1};return Te("online",t),Te("offline",r),()=>{Le("online",t),Le("offline",r)}}},Ie=!e.useId,Fe=!xe||"Deno"in window,Ce=e=>xe&&typeof window.requestAnimationFrame!=Ee?window.requestAnimationFrame(e):setTimeout(e,1),Ne=Fe?r:a,Ae="undefined"!=typeof navigator&&navigator.connection,Ve=!Fe&&Ae&&(["slow-2g","2g"].includes(Ae.effectiveType)||Ae.saveData),$e=e=>{if(ye(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?we(e):"",t]};let qe=0;const Me=()=>++qe;var Ue=3,We=0,Be=2,Ye=1;async function He(...e){const[t,r,n,o]=e,a=he({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let i=a.populateCache;const s=a.rollbackOnError;let u=a.optimisticData;const c=a.throwOnError;if(ye(r)){const e=r,n=[],o=t.keys();for(const r of o)!/^\$(inf|sub)\$/.test(r)&&e(t.get(r)._k)&&n.push(r);return Promise.all(n.map(l))}return l(r);async function l(r){const[o]=$e(r);if(!o)return;const[l,f]=Re(t,o),[d,p,m,v]=Se.get(t),y=()=>{const e=d[o];return(ye(a.revalidate)?a.revalidate(l().data,r):!1!==a.revalidate)&&(delete m[o],delete v[o],e&&e[0])?e[0](2).then((()=>l().data)):l().data};if(e.length<3)return y();let h,g=n;const b=Me();p[o]=[b,0];const w=!ve(u),S=l(),_=S.data,O=S._c,E=ve(O)?_:O;if(w&&(u=ye(u)?u(E,_):u,f({data:u,_c:E})),ye(g))try{g=g(E)}catch(e){h=e}if(g&&ye(g.then)){if(g=await g.catch((e=>{h=e})),b!==p[o][0]){if(h)throw h;return g}h&&w&&(e=>"function"==typeof s?s(e):!1!==s)(h)&&(i=!0,f({data:E,_c:pe}))}if(i&&!h)if(ye(i)){const e=i(g,E);f({data:e,error:pe,_c:pe})}else f({data:g,error:pe,_c:pe});if(p[o][1]=Me(),Promise.resolve(y()).then((()=>{f({_c:pe})})),!h)return g;if(c)throw h}}const ze=(e,t)=>{for(const r in e)e[r][0]&&e[r][0](t)},[Ke,Ge]=((e,t)=>{if(!Se.has(e)){const r=he(Pe,t),n={},o=He.bind(pe,e);let a=de;const i={},s=(e,t)=>{const r=i[e]||[];return i[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},u=(t,r,n)=>{e.set(t,r);const o=i[t];if(o)for(const e of o)e(r,n)},c=()=>{if(!Se.has(e)&&(Se.set(e,[n,{},{},{},o,u,s]),!Fe)){const t=r.initFocus(setTimeout.bind(pe,ze.bind(pe,n,0))),o=r.initReconnect(setTimeout.bind(pe,ze.bind(pe,n,1)));a=()=>{t&&t(),o&&o(),Se.delete(e)}}};return c(),[e,o,c,a]}return[e,Se.get(e)[4]]})(new Map),Je=he({onLoadingSlow:de,onSuccess:de,onError:de,onErrorRetry:(e,t,r,n,o)=>{const a=r.errorRetryCount,i=o.retryCount,s=~~((Math.random()+.5)*(1<<(i<8?i:8)))*r.errorRetryInterval;!ve(a)&&i>a||setTimeout(n,s,o)},onDiscarded:de,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ve?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:Ve?5e3:3e3,compare:(e,t)=>we(e)==we(t),isPaused:()=>!1,cache:Ke,mutate:Ge,fallback:{}},De),Xe=n({}),Qe=xe&&window.__SWR_DEVTOOLS_USE__,Ze=Qe?window.__SWR_DEVTOOLS_USE__:[],et=e=>ye(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],tt=Ze.concat((e=>(t,r,n)=>e(t,r&&((...e)=>{const[n]=$e(t),[,,,o]=Se.get(Ke);if(n.startsWith("$inf$"))return r(...e);const a=o[n];return ve(a)?r(...e):(delete o[n],a)}),n)));Qe&&(window.__SWR_DEVTOOLS_REACT__=e);const rt=e.use||(e=>{if("pending"===e.status)throw e;if("fulfilled"===e.status)return e.value;throw"rejected"===e.status?e.reason:(e.status="pending",e.then((t=>{e.status="fulfilled",e.value=t}),(t=>{e.status="rejected",e.reason=t})),e)}),nt={dedupe:!0},ot=(at=(e,t,r)=>{const{cache:n,compare:o,suspense:a,fallbackData:l,revalidateOnMount:f,revalidateIfStale:d,refreshInterval:p,refreshWhenHidden:m,refreshWhenOffline:v,keepPreviousData:y}=r,[h,g,b,w]=Se.get(n),[S,_]=$e(e),O=i(!1),E=i(!1),x=i(S),j=i(t),R=i(r),k=()=>R.current,T=()=>k().isVisible()&&k().isOnline(),[L,D,P,I]=Re(n,S),F=i({}).current,C=ve(l)?r.fallback[S]:l,N=(e,t)=>{for(const r in F){const n=r;if("data"===n){if(!o(e[n],t[n])){if(!ve(e[n]))return!1;if(!o(Y,t[n]))return!1}}else if(t[n]!==e[n])return!1}return!0},A=s((()=>{const e=!!S&&!!t&&(ve(f)?!k().isPaused()&&!a&&(!!ve(d)||d):f),r=t=>{const r=he(t);return delete r._k,e?{isValidating:!0,isLoading:!0,...r}:r},n=L(),o=I(),i=r(n),s=n===o?i:r(o);let u=i;return[()=>{const e=r(L());return N(e,u)?(u.data=e.data,u.isLoading=e.isLoading,u.isValidating=e.isValidating,u.error=e.error,u):(u=e,e)},()=>s]}),[n,S]),V=fe.useSyncExternalStore(u((e=>P(S,((t,r)=>{N(r,t)||e()}))),[n,S]),A[0],A[1]),$=!O.current,q=h[S]&&h[S].length>0,M=V.data,U=ve(M)?C:M,W=V.error,B=i(U),Y=y?ve(M)?B.current:M:U,H=!(q&&!ve(W))&&($&&!ve(f)?f:!k().isPaused()&&(a?!ve(U)&&d:ve(U)||d)),z=!!(S&&t&&$&&H),K=ve(V.isValidating)?z:V.isValidating,G=ve(V.isLoading)?z:V.isLoading,J=u((async e=>{const t=j.current;if(!S||!t||E.current||k().isPaused())return!1;let n,a,i=!0;const s=e||{},u=!b[S]||!s.dedupe,c=()=>Ie?!E.current&&S===x.current&&O.current:S===x.current,l={isValidating:!1,isLoading:!1},f=()=>{D(l)},d=()=>{const e=b[S];e&&e[1]===a&&delete b[S]},p={isValidating:!0};ve(L().data)&&(p.isLoading=!0);try{if(u&&(D(p),r.loadingTimeout&&ve(L().data)&&setTimeout((()=>{i&&c()&&k().onLoadingSlow(S,r)}),r.loadingTimeout),b[S]=[t(_),Me()]),[n,a]=b[S],n=await n,u&&setTimeout(d,r.dedupingInterval),!b[S]||b[S][1]!==a)return u&&c()&&k().onDiscarded(S),!1;l.error=pe;const e=g[S];if(!ve(e)&&(a<=e[0]||a<=e[1]||0===e[1]))return f(),u&&c()&&k().onDiscarded(S),!1;const s=L().data;l.data=o(s,n)?s:n,u&&c()&&k().onSuccess(n,S,r)}catch(e){d();const t=k(),{shouldRetryOnError:r}=t;t.isPaused()||(l.error=e,u&&c()&&(t.onError(e,S,t),(!0===r||ye(r)&&r(e))&&(k().revalidateOnFocus&&k().revalidateOnReconnect&&!T()||t.onErrorRetry(e,S,t,(e=>{const t=h[S];t&&t[0]&&t[0](Ue,e)}),{retryCount:(s.retryCount||0)+1,dedupe:!0}))))}return i=!1,f(),!0}),[S,n]),X=u(((...e)=>He(n,x.current,...e)),[]);if(Ne((()=>{j.current=t,R.current=r,ve(M)||(B.current=M)})),Ne((()=>{if(!S)return;const e=J.bind(pe,nt);let t=0;const r=((e,t,r)=>{const n=t[e]||(t[e]=[]);return n.push(r),()=>{const e=n.indexOf(r);e>=0&&(n[e]=n[n.length-1],n.pop())}})(S,h,((r,n={})=>{if(r==We){const r=Date.now();k().revalidateOnFocus&&r>t&&T()&&(t=r+k().focusThrottleInterval,e())}else if(r==Ye)k().revalidateOnReconnect&&T()&&e();else{if(r==Be)return J();if(r==Ue)return J(n)}}));return E.current=!1,x.current=S,O.current=!0,D({_k:_}),H&&(ve(U)||Fe?e():Ce(e)),()=>{E.current=!0,r()}}),[S]),Ne((()=>{let e;function t(){const t=ye(p)?p(L().data):p;t&&-1!==e&&(e=setTimeout(r,t))}function r(){L().error||!m&&!k().isVisible()||!v&&!k().isOnline()?t():J(nt).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[p,m,v,S]),c(Y),a&&ve(U)&&S){if(!Ie&&Fe)throw new Error("Fallback data is required when using suspense in SSR.");j.current=t,R.current=r,E.current=!1;const e=w[S];if(!ve(e)){const t=X(e);rt(t)}if(!ve(W))throw W;{const e=J(nt);ve(Y)||(e.status="fulfilled",e.value=!0),rt(e)}}return{mutate:X,get data(){return F.data=!0,Y},get error(){return F.error=!0,W},get isValidating(){return F.isValidating=!0,K},get isLoading(){return F.isLoading=!0,G}}},function(...e){const t=he(Je,o(Xe)),[r,n,a]=et(e),i=((e,t)=>{const r=he(e,t);if(t){const{use:n,fallback:o}=e,{use:a,fallback:i}=t;n&&a&&(r.use=n.concat(a)),o&&i&&(r.fallback=he(o,i))}return r})(t,a);let s=at;const{use:u}=i,c=(u||[]).concat(tt);for(let e=c.length;e--;)s=c[e](s);return s(r,n||i.fetcher||null,i)});var at;const it=((e,t)=>(...r)=>{const[n,o,a]=et(r),i=(a.use||[]).concat(t);return e(n,o,{...a,use:i})})(ot,(e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,e(t,r,n))));var st=function(e){var t=Q(e.endpoint),r=f(),n=J().showError,o=P().mutate,a=it(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return C(void 0,void 0,void 0,(function(){return N(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,i=void 0===a?{}:a,s=new URLSearchParams(F(F({},e.params),r.query)).toString(),u=e.endpoint+(s?"?"+s:""),c=D(r.isReady?u:null,(function(e){return C(void 0,void 0,void 0,(function(){return N(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),l=c.data,d=c.error,p=c.isLoading,m=(null==l?void 0:l.data)||[],v=(null==l?void 0:l.total)||0,y=new URLSearchParams(r.query),h=y.get("page"),g=h?parseInt(h):1,b=y.get("limit"),w=b?parseInt(b):20,S={loading:p,dataSource:m,rowKey:"_id",bordered:!0,pagination:{current:g,defaultPageSize:w,total:v},onChange:function(e,t,n){return C(void 0,void 0,void 0,(function(){var t,o,a,i;return N(this,(function(s){return t=y.toString(),o=new URLSearchParams(t),e.current!==g&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==w&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(n)||("ascend"===n.order?o.set("sort",n.field):"descend"===n.order?o.set("sort","-"+n.field):o.delete("sort")),t!==o.toString()&&r.push({query:Object.fromEntries(o)}),[2]}))}))}},_=function(){o(u)};return{data:m,isLoading:p,error:d,options:i,endpoint:e.endpoint,endpointWithHost:te(e.endpoint),mainroute:r.route,tableProps:S,init:_,getOpt:function(e,t){var r,n=null===(r=i[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return C(void 0,void 0,void 0,(function(){var o;return N(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return a.sent(),_(),[3,3];case 2:return o=a.sent(),n(o),[3,3];case 3:return[2]}}))}))},cancel:function(r){return C(void 0,void 0,void 0,(function(){var o;return N(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return a.sent(),_(),[3,3];case 2:return o=a.sent(),n(o),[3,3];case 3:return[2]}}))}))}}},ut=function(e){var n=Q(e.endpoint),o=w.useForm()[0],a=t(!1),s=a[0],u=a[1],c=t(!1),p=c[0],v=c[1],h=f(),g=J(),b=g.showError,O=g.message,E=function(e){var n=i(!1),o=J().modal,a=i(0),s=t(0),u=s[0],c=s[1],l=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";p(),localStorage.removeItem(e)},f=function(e){e.preventDefault()},p=function(){n.current=!1,window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",l),localStorage.removeItem(e),c(0)};return r((function(){if(n.current)return a.current!==u&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",l)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",l)}}),[a.current,u]),{cambiarHashInicial:function(e){var t=re(JSON.stringify(e));c(t),a.current=t},cambiarDatosFormulario:function(t){if(n.current&&0!==a.current){var r=JSON.stringify(t),o=re(r);c(o),o===a.current?localStorage.removeItem(e):localStorage.setItem(e,r)}},limpiar:p,reanudar:function(){n.current=!0},obtenerDataEmergencia:function(){return C(void 0,void 0,void 0,(function(){var t,r;return N(this,(function(a){switch(a.label){case 0:return t=localStorage.getItem(e),[4,new Promise((function(e){if(!t)return e(void 0);o.confirm({title:"Existen datos guardados",icon:B.jsx(m,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return e(JSON.parse(t))},onCancel:function(){return e(void 0)}})}))];case 1:return r=a.sent(),n.current=!0,[2,r]}}))}))}}}(h.asPath),x=i("emitir"),j=i(h.query.id),R=it(e.sinOptions?null:e.endpoint+"/get-options",(function(e){return C(void 0,void 0,void 0,(function(){return N(this,(function(t){switch(t.label){case 0:return[4,n.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,k=void 0===R?{}:R;r((function(){j.current=e.registroId,j.current||(j.current=e.soloParaInsertar?void 0:h.query.id)}),[null==e?void 0:e.registroId,e.soloParaInsertar]);var T=h.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",L=function(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return C(void 0,A([t],r,!0),void 0,(function(t,r){var o,a,i,c,l,f,d,p;return void 0===r&&(r={}),N(this,(function(m){switch(m.label){case 0:if(!0===s)return[2];u(!0),E.limpiar(),o=r.endpoint||e.endpoint,a=r.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),i=void 0,j.current?[4,n.put(o+"/"+j.current,t,{params:a})]:[3,3];case 2:return i=m.sent().data,[3,5];case 3:return[4,n.post(o,t,{params:a})];case 4:i=m.sent().data,m.label=5;case 5:return!0!==r.noRedirect?(O.success("Guardado correctamente"),h.push(T)):u(!1),[2,i];case 6:if(c=m.sent(),u(!1),r.noShowError)throw c;return b(c),l=null===(p=null===(d=null==c?void 0:c.response)||void 0===d?void 0:d.data)||void 0===p?void 0:p.comprobante,f="pruebas",["Hostname/IP does not match certificate's altnames:","El servidor del SRI no ha respondido en un largo tiempo por lo que se ha cerrado la conexión."].some((function(e){return f.includes(e)}))?h.push(T):!r.noRedirect&&l&&l!==j.current?(j.current=l,h.push(T+"/"+l+"/edit")):E.reanudar(),[3,7];case 7:return[2]}}))}))},D=B.jsxs(S,{children:[B.jsx(y,{type:"primary",loading:s,onClick:function(){return o.submit()},children:"Guardar"}),B.jsx(l,{href:T,children:B.jsx(y,{children:"Cancelar"})})]}),P=B.jsxs(B.Fragment,{children:[B.jsx(_,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),B.jsx(_,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),B.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[B.jsx(_,{paragraph:{rows:4,width:"100%"}}),B.jsx(_,{paragraph:{rows:4,width:"100%"}})]}),B.jsxs(S,{children:[B.jsx(_.Button,{}),B.jsx(_.Button,{})]})]}),I=function(){return O.warning("Revisa los errores del formulario")},F={form:o,autoComplete:"off",initialValues:e.data,onFinish:L,layout:"vertical",onFinishFailed:I};return r((function(){if(e.recuperacionEmergencia){var t=setInterval((function(){if(p){var e=o.getFieldsValue();E.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(t)}}}),[p]),r((function(){var t=setTimeout((function(){e.soloParaInsertar||C(void 0,void 0,void 0,(function(){var t,r,a;return N(this,(function(i){switch(i.label){case 0:return t=!1,[4,E.obtenerDataEmergencia()];case 1:return(r=i.sent())?(j.current=r._id,t=!0,[3,4]):[3,2];case 2:return j.current?[4,n.get("".concat(e.endpoint,"/").concat(j.current),{params:e.params})]:[3,4];case 3:r=i.sent().data,i.label=4;case 4:return r?[4,null===(a=e.formatearDataInicial)||void 0===a?void 0:a.call(e,r)]:[3,6];case 5:i.sent(),o.setFieldsValue(r),i.label=6;case 6:return[2,t?e.data:r||e.data]}}))})).then((function(t){var r;return Promise.all([E.cambiarHashInicial(t),null===(r=e.onMounted)||void 0===r?void 0:r.call(e)])})).then((function(){return v(!0)}))}),200);return function(){return clearTimeout(t)}}),[h.query.id]),{form:o,router:h,options:k,tipoEmision:x,objectId:j.current,mainroute:T,isLoading:s,isReady:p,data:e.data,endpoint:e.endpoint,onSubmit:L,onMainRouter:function(){return h.push(T)},setIsLoading:u,preventor:E,ModoCarga:P,BotonesPorDefecto:D,onMensajeValidacion:I,getOption:function(e,t){var r,n;return(null===(n=null===(r=k[e])||void 0===r?void 0:r.find((function(e){return e.id===t})))||void 0===n?void 0:n.description)||""},formProps:F}};var ct=function(e){var r=t(""),n=r[0];r[1];var o=function(e){var t=this,r=i(e.defaultOptions),n=(e.type,{withOptions:!0,label:"Cliente",endpoint:"/v3/administrative/clients",params:{fields:"idType id name phone email address",estado:"activo"},field:"id",placeholder:"Ingresar la identificación del cliente",title:function(e){return"".concat(e.id)},subtitle:function(e){return e.name},preBusquedaQ:function(e){return void 0===e&&(e=""),e=e.trim(),/^\d+/.test(e)?"^"+e:e}});if(!n)return null;var o=Q(n.endpoint),a=D(n.withOptions&&!e.defaultOptions?n.endpoint+"/get-options":null,(function(e){return C(t,void 0,void 0,(function(){return N(this,(function(t){switch(t.label){case 0:return[4,o.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return a&&(r.current=a),n}({type:e.type,defaultOptions:void 0});return o?B.jsx(w.Item,{name:e.name,label:e.hideLabel?void 0:e.label||o.label,extra:e.hideMessage?void 0:n,rules:e.required?[oe.required()]:[{}],className:e.classNameFormItem}):null},lt="#F34D24",ft="#FFFFFF",dt=function(e){var n=t(!1),o=n[0],a=n[1];return r((function(){a(!0)}),[]),o?B.jsx(O,{locale:I,theme:{token:{colorPrimary:lt,colorLink:lt,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:ft,headerBg:ft}}},children:B.jsx(b,{children:B.jsx(E,{className:e.className,style:e.style,children:e.children})})}):null};export{ie as $filtros,oe as $reglas,H as Header,ct as Seeker,dt as TemaPrincipal,K as configurarUtils,Z as crearToken,ee as destruirToken,te as getApiEndpoint,Q as getAxios,re as hashear,J as useUtils,ut as useVistaInsertar,st as useVistaPrincipal};
11
20
  //# sourceMappingURL=index.js.map