upconta.frontend-utils 1.0.1 → 1.0.3
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/cjs/components/LayoutBase.d.ts +17 -0
- package/.dist/cjs/components/index.d.ts +1 -0
- package/.dist/cjs/index.js +3 -3
- package/.dist/cjs/index.js.map +1 -1
- package/.dist/cjs/libs/contexts/Empresa.d.ts +62 -0
- package/.dist/cjs/libs/index.d.ts +2 -0
- package/.dist/cjs/libs/utils.d.ts +3 -0
- package/.dist/esm/index.js +3 -3
- package/.dist/esm/index.js.map +1 -1
- package/libs/LayoutPrincipal.tsx +39 -0
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface BusinessInfo {
|
|
3
|
+
_id: string;
|
|
4
|
+
business: string;
|
|
5
|
+
businessModules: Array<{
|
|
6
|
+
activationDate: string;
|
|
7
|
+
key: string;
|
|
8
|
+
operationDate: string;
|
|
9
|
+
}>;
|
|
10
|
+
configs: {
|
|
11
|
+
monthsBlocked: string[];
|
|
12
|
+
useTestEnviroment: boolean;
|
|
13
|
+
vouchers: {
|
|
14
|
+
nDecimals: number;
|
|
15
|
+
};
|
|
16
|
+
pac: {
|
|
17
|
+
usuario?: string;
|
|
18
|
+
fechaContrato?: Date;
|
|
19
|
+
fechaContratoTest?: Date;
|
|
20
|
+
};
|
|
21
|
+
nDecimals: number;
|
|
22
|
+
};
|
|
23
|
+
hasSignature: boolean;
|
|
24
|
+
createdAt: string;
|
|
25
|
+
modules: Array<{
|
|
26
|
+
icon: string;
|
|
27
|
+
key: string;
|
|
28
|
+
label: string;
|
|
29
|
+
operationDate: string;
|
|
30
|
+
submodules: Array<{
|
|
31
|
+
key?: string;
|
|
32
|
+
label: string;
|
|
33
|
+
permisos?: string;
|
|
34
|
+
items?: Array<{
|
|
35
|
+
key: string;
|
|
36
|
+
label: string;
|
|
37
|
+
permisos: string;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
}>;
|
|
41
|
+
ruc: string;
|
|
42
|
+
sessionEndDate: string;
|
|
43
|
+
sessionStartDate: string;
|
|
44
|
+
user: string;
|
|
45
|
+
userId: string;
|
|
46
|
+
userType: 'admin' | 'user';
|
|
47
|
+
esAdmin: boolean;
|
|
48
|
+
accesoBloqueoMensual: boolean;
|
|
49
|
+
wooCommerce?: boolean;
|
|
50
|
+
}
|
|
51
|
+
interface Empresa {
|
|
52
|
+
business: BusinessInfo;
|
|
53
|
+
nombreEmpresa: string;
|
|
54
|
+
nombreUsuario: string;
|
|
55
|
+
testEnviroment: boolean;
|
|
56
|
+
usuarioEsAdmin: boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare function useContextoEmpresa(): Empresa;
|
|
59
|
+
declare const ContextoEmpresa: FC<{
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
}>;
|
|
62
|
+
export default ContextoEmpresa;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './utils';
|
|
2
2
|
export { default as $reglas } from './reglas';
|
|
3
3
|
export { default as $filtros } from './filtros';
|
|
4
|
+
export * from './contexts/Empresa';
|
|
5
|
+
export { default as ContextoEmpresa } from './contexts/Empresa';
|
|
4
6
|
export { default as useVistaPrincipal } from './hooks/vista-principal';
|
|
5
7
|
export { default as useVistaInsertar } from './hooks/vista-insertar';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import type { NextRouter } from 'next/router';
|
|
2
3
|
declare let configs: {
|
|
3
4
|
hostFastify: string;
|
|
4
5
|
hostRestify: string;
|
|
5
6
|
userTokenName: string;
|
|
6
7
|
adminTokenName: string;
|
|
7
8
|
cookieDominio: string;
|
|
9
|
+
cookiePath: string | undefined;
|
|
8
10
|
};
|
|
9
11
|
export declare const configurarUtils: (override: Partial<typeof configs>) => void;
|
|
10
12
|
/**
|
|
@@ -40,4 +42,5 @@ export declare const destruirToken: (tipo: "usuario" | "administrador") => void;
|
|
|
40
42
|
*/
|
|
41
43
|
export declare const getApiEndpoint: (endpoint: string, queries?: Record<string, string>) => string;
|
|
42
44
|
export declare const hashear: (mensaje: string) => number;
|
|
45
|
+
export declare const redireccionarLogin: (router: NextRouter, pathLogin?: string) => void;
|
|
43
46
|
export {};
|
package/.dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as r,createContext as n,useContext as o,useLayoutEffect as
|
|
1
|
+
import e,{useState as t,useEffect as r,createContext as n,useContext as o,useLayoutEffect as i,useRef as a,useMemo as s,useCallback as c,useDebugValue as u}from"react";import l from"next/link";import{useRouter as f,Router as d}from"next/router";import{ReloadOutlined as p,QuestionCircleOutlined as m,MenuUnfoldOutlined as v,MenuFoldOutlined as h}from"@ant-design/icons";import{Input as y,Button as g,Typography as b,Breadcrumb as w,App as x,Form as S,Space as _,Skeleton as O,ConfigProvider as E,Layout as j}from"antd";import k from"axios";import{getCookie as R,setCookie as T,deleteCookie as P}from"cookies-next";import D from"dayjs";import{debounce as L}from"ts-debounce";import I,{useSWRConfig as F}from"swr";import C 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))}}(".fixed{position:fixed}.sticky{position:sticky}.top-0{top:0}.\\!z-\\[2\\]{z-index:2!important}.\\!m-0{margin:0!important}.m-4{margin:1rem}.\\!mb-0{margin-bottom:0!important}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.ml-0{margin-left:0}.ml-\\[230px\\]{margin-left:230px}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.h-16{height:4rem}.h-full{height:100%}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.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}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.border-b{border-bottom-width:1px}.\\!px-4{padding-left:1rem!important;padding-right:1rem!important}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.\\!font-normal{font-weight:400!important}.font-bold{font-weight:700}.\\!text-gray-500{--tw-text-opacity:1!important;color:rgb(107 114 128/var(--tw-text-opacity))!important}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.ant-table{overflow-x:auto}@media (min-width:768px){.md\\:m-8{margin:2rem}.md\\:w-auto{width:auto}.md\\:flex-row{flex-direction:row}.md\\:flex-nowrap{flex-wrap:nowrap}.md\\:items-end{align-items:flex-end}}@media (min-width:1280px){.xl\\:m-16{margin:4rem}}",{insertAt:"top"});var N=function(){return N=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},N.apply(this,arguments)};function A(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(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(a,s)}c((n=n.apply(e,t||[])).next())}))}function V(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)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 a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}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 $(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;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 q,M={exports:{}},U={};var W,B={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.development.js
|
|
@@ -7,7 +7,7 @@ import e,{useState as t,useEffect as r,createContext as n,useContext as o,useLay
|
|
|
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(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={};
|
|
10
|
+
*/"production"===process.env.NODE_ENV?M.exports=function(){if(q)return U;q=1;var t=e,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={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)&&!a.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:i.current}}return U.Fragment=n,U.jsx=s,U.jsxs=s,U}():M.exports=(W||(W=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"),i=Symbol.for("react.strict_mode"),a=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"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,h="@@iterator",y=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=y.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,_=!1,O=!1;function E(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 a:return"Profiler";case i:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return E(e)+".Consumer";case s:return E(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 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 k,R,T,P,D,L,I,F=Object.assign,C=0;function N(){}N.__reactDisabledLog=!0;var A,V=y.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,U="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||M)return"";var r,n=q.get(e);if(void 0!==n)return n;M=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=V.current,V.current=null,function(){if(0===C){k=console.log,R=console.info,T=console.warn,P=console.error,D=console.group,L=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 a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){r=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){r=e}e.call(a.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&&q.set(e,f),f}}while(u>=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:k}),info:F({},e,{value:R}),warn:F({},e,{value:T}),error:F({},e,{value:P}),group:F({},e,{value:D}),groupCollapsed:F({},e,{value:L}),groupEnd:F({},e,{value:I})})}C<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}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 W(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 u:return W(e.render,!1);case d:return Y(e.type,t,r);case p:var o=e,i=o._payload,a=o._init;try{return Y(a(i),t,r)}catch(e){}}return""}q=new U;var z=Object.prototype.hasOwnProperty,H={},K=y.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=y.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};re={};var ie=function(e,t,n,o,i,a,s){var c={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:a,_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:i}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ae(e,t,r,n,o){var i,a={},s=null,c=null;for(i in void 0!==r&&(Z(r),s=""+r),function(e){if(z.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(z.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=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)z.call(t,i)&&!oe.hasOwnProperty(i)&&(a[i]=t[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===a[i]&&(a[i]=u[i])}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})}(a,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})}(a,l)}return ie(e,s,c,o,n,ne.current,a)}var se,ce=y.ReactCurrentOwner,ue=y.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=Y(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 de(){if(ce.current){var e=j(ce.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!==ce.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[h];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)fe(i.value)&&me(i.value,t)}}function he(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!==d)return;t=r.propTypes}if(t){var n=j(r);!function(e,t,r,n,o){var i=Function.call.bind(z);for(var a in e)if(i(e,a)){var s=void 0;try{if("function"!=typeof e[a]){var c=Error((n||"React class")+": "+r+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}s=e[a](t,a,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,a,typeof s),G(null)),s instanceof Error&&!(s.message in H)&&(H[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 ye={};function ge(e,t,n,v,h,y){var E=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===a||O||e===i||e===l||e===f||_||e===m||w||x||S)||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===u||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!E){var k,R="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(R+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),R+=de(),null===e?k="null":X(e)?k="array":void 0!==e&&e.$$typeof===r?(k="<"+(j(e.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):k=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",k,R)}var T=ae(e,t,n,h,y);if(null==T)return T;if(E){var P=t.children;if(void 0!==P)if(v)if(X(P)){for(var D=0;D<P.length;D++)ve(P[D],e);Object.freeze&&Object.freeze(P)}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(P,e)}if(z.call(t,"key")){var L=j(e),I=Object.keys(t).filter((function(e){return"key"!==e})),F=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";ye[L+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,L,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",L),ye[L+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):he(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)};B.Fragment=o,B.jsx=be,B.jsxs=we}()),B);var Y=M.exports,z=function(e){return e.paths?Y.jsx(w,{items:e.paths.map((function(e){var t=e.to,r=e.label;return{title:t?Y.jsx(l,{href:t,children:r}):r}}))}):null},H=function(e){var n,o=e.defaultInsert,i=void 0!==o&&o,a=e.loading,s=void 0!==a&&a,c=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"]),u=f(),d=u.pathname,m=t(""),v=m[0],h=m[1],w=new URLSearchParams(u.query),x=function(){var e=new URLSearchParams(w.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),u.push({query:Object.fromEntries(e)}))},S=Y.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==c.ocultarBuscador?Y.jsx(y.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:x,onPressEnter:x}):null,null!==i?i||Y.jsx(l,{href:(n=d,n.endsWith("/")&&(n=n.slice(0,-1)),n+"/insert"),children:Y.jsx(g,{type:"primary",children:"Insertar"})}):null,c.onRefrescar?Y.jsx("div",{children:Y.jsx(g,{loading:s,title:"Refrescar datos",icon:Y.jsx(p,{}),onClick:c.onRefrescar})}):null,c.children]});return r((function(){u.isReady&&h(w.get("q")||"")}),[u.isReady]),Y.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[Y.jsxs("div",{children:[Y.jsx(z,{paths:c.paths}),Y.jsx(b.Title,{className:"!mb-0 mt-4",children:c.title}),c.subtitle&&Y.jsx(b.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:c.subtitle})]}),null!==c.column?c.column||S:null]})},K={hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},G=function(e){K=N(N({},K),e)},J=function(e){return A(void 0,void 0,void 0,(function(){var t,r,n,o,i,a;return V(this,(function(s){switch(s.label){case 0:if(!((t=(null===(i=e.response)||void 0===i?void 0:i.data)?(null===(a=e.response.data)||void 0===a?void 0:a.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"}]}}))}))},X=function(){var e=x.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return A(void 0,void 0,void 0,(function(){var n;return V(this,(function(o){switch(o.label){case 0:return[4,J(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:Y.jsxs(Y.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},Q=function(e){return"administrador"===e?K.adminTokenName:K.userTokenName},Z=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?K.hostFastify:K.hostRestify;var n=k.create({baseURL:r});return n.defaults.headers.common.Authorization=R(Q(null==t?void 0:t.tipo),{domain:K.cookieDominio,path:K.cookiePath}),n},ee=function(e,t){T(Q(t.usuario),e,{domain:K.cookieDominio,maxAge:604800,path:K.cookiePath})},te=function(e){P(Q(e),{domain:K.cookieDominio,path:K.cookiePath})},re=function(e,t){var r=new URL(e,e.includes("v4")?K.hostFastify:K.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},ne=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},oe=function(e,t){void 0===t&&(t="/login");var r=t.includes("://"),n=new URL(r?t:window.location.origin+t);("/"!==e.asPath||r)&&n.searchParams.append("redirect",r?window.location.href:e.asPath),r?window.location.href=n.href:e.push(n.pathname+n.search)},ie={empresa:function(e,t){return A(void 0,void 0,void 0,(function(){return V(this,(function(e){switch(e.label){case 0:return t?[4,Z("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},ae={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(ie[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return A(void 0,$([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),V(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 A(void 0,void 0,void 0,(function(){var r;return V(this,(function(o){if(r=D(n).startOf("day").diff(D().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},se="es-EC",ce={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(se,{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"),D(e).format(t)},completeDate:function(e){return D(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return D(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(se,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}},ue=n(null);function le(){return o(ue)}var fe,de=function(e){var n=f(),o=t(!1),i=o[0],a=o[1],s=t(),c=s[0],u=s[1];return r((function(){A(void 0,void 0,void 0,(function(){var e,t,r,n;return V(this,(function(o){switch(o.label){case 0:e=Z("restify"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,Promise.all([e.get("/v3/auth/user"),e.get("/v3/businesses/me/configurations",{params:{fields:"comprobantes nDecimals invoice"}})])];case 2:return t=o.sent(),r=t[0].data,n=t[1].data,r.configuraciones=n,[2,r];case 3:return o.sent(),[2,null];case 4:return[2]}}))})).then((function(e){e?(a(!0),u(e)):oe(n)}))}),[]),i?Y.jsx(ue.Provider,{value:{business:c,nombreEmpresa:c.business,nombreUsuario:c.user,testEnviroment:c.configs.useTestEnviroment,usuarioEsAdmin:"admin"===c.userType},children:e.children}):Y.jsx("div",{className:"w-full h-screen flex items-center justify-center",children:"Cargando..."})},pe={exports:{}},me={};var ve,he={};
|
|
11
11
|
/**
|
|
12
12
|
* @license React
|
|
13
13
|
* use-sync-external-store-shim.development.js
|
|
@@ -16,5 +16,5 @@ import e,{useState as t,useEffect as r,createContext as n,useContext as o,useLay
|
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
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};
|
|
19
|
+
*/"production"===process.env.NODE_ENV?pe.exports=function(){if(fe)return me;fe=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,i=t.useLayoutEffect,a=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 c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),u=c[0].inst,l=c[1];return i((function(){u.value=r,u.getSnapshot=t,s(u)&&l({inst:u})}),[e,r,t]),o((function(){return s(u)&&l({inst:u}),e((function(){s(u)&&l({inst:u})}))}),[e]),a(r),r};return me.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,me}():pe.exports=(ve||(ve=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 i=n.map((function(e){return String(e)}));i.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,i)}("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},i=t.useState,a=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,u=!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){u||void 0!==t.startTransition&&(u=!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=i({inst:{value:p,getSnapshot:r}}),h=v[0].inst,y=v[1];return s((function(){h.value=p,h.getSnapshot=r,f(h)&&y({inst:h})}),[e,p,r]),a((function(){return f(h)&&y({inst:h}),e((function(){f(h)&&y({inst:h})}))}),[e]),c(p),p},p=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:d;he.useSyncExternalStore=p,"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),he);var ye=pe.exports;const ge=()=>{},be=ge(),we=Object,xe=e=>e===be,Se=e=>"function"==typeof e,_e=(e,t)=>({...e,...t}),Oe=new WeakMap;let Ee=0;const je=e=>{const t=typeof e,r=e&&e.constructor,n=r==Date;let o,i;if(we(e)!==e||n||r==RegExp)o=n?e.toJSON():"symbol"==t?e.toString():"string"==t?JSON.stringify(e):""+e;else{if(o=Oe.get(e),o)return o;if(o=++Ee+"~",Oe.set(e,o),r==Array){for(o="@",i=0;i<e.length;i++)o+=je(e[i])+",";Oe.set(e,o)}if(r==we){o="#";const t=we.keys(e).sort();for(;!xe(i=t.pop());)xe(e[i])||(o+=i+":"+je(e[i])+",");Oe.set(e,o)}}return o},ke=new WeakMap,Re={},Te={},Pe="undefined",De=typeof window!=Pe,Le=typeof document!=Pe,Ie=(e,t)=>{const r=ke.get(e);return[()=>!xe(t)&&e.get(t)||Re,n=>{if(!xe(t)){const o=e.get(t);t in Te||(Te[t]=o),r[5](t,_e(o,n),o||Re)}},r[6],()=>!xe(t)&&t in Te?Te[t]:!xe(t)&&e.get(t)||Re]};let Fe=!0;const[Ce,Ne]=De&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ge,ge],Ae={isOnline:()=>Fe,isVisible:()=>{const e=Le&&document.visibilityState;return xe(e)||"hidden"!==e}},Ve={initFocus:e=>(Le&&document.addEventListener("visibilitychange",e),Ce("focus",e),()=>{Le&&document.removeEventListener("visibilitychange",e),Ne("focus",e)}),initReconnect:e=>{const t=()=>{Fe=!0,e()},r=()=>{Fe=!1};return Ce("online",t),Ce("offline",r),()=>{Ne("online",t),Ne("offline",r)}}},$e=!e.useId,qe=!De||"Deno"in window,Me=e=>De&&typeof window.requestAnimationFrame!=Pe?window.requestAnimationFrame(e):setTimeout(e,1),Ue=qe?r:i,We="undefined"!=typeof navigator&&navigator.connection,Be=!qe&&We&&(["slow-2g","2g"].includes(We.effectiveType)||We.saveData),Ye=e=>{if(Se(e))try{e=e()}catch(t){e=""}const t=e;return[e="string"==typeof e?e:(Array.isArray(e)?e.length:e)?je(e):"",t]};let ze=0;const He=()=>++ze;var Ke=3,Ge=0,Je=2,Xe=1;async function Qe(...e){const[t,r,n,o]=e,i=_e({populateCache:!0,throwOnError:!0},"boolean"==typeof o?{revalidate:o}:o||{});let a=i.populateCache;const s=i.rollbackOnError;let c=i.optimisticData;const u=i.throwOnError;if(Se(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]=Ye(r);if(!o)return;const[l,f]=Ie(t,o),[d,p,m,v]=ke.get(t),h=()=>{const e=d[o];return(Se(i.revalidate)?i.revalidate(l().data,r):!1!==i.revalidate)&&(delete m[o],delete v[o],e&&e[0])?e[0](2).then((()=>l().data)):l().data};if(e.length<3)return h();let y,g=n;const b=He();p[o]=[b,0];const w=!xe(c),x=l(),S=x.data,_=x._c,O=xe(_)?S:_;if(w&&(c=Se(c)?c(O,S):c,f({data:c,_c:O})),Se(g))try{g=g(O)}catch(e){y=e}if(g&&Se(g.then)){if(g=await g.catch((e=>{y=e})),b!==p[o][0]){if(y)throw y;return g}y&&w&&(e=>"function"==typeof s?s(e):!1!==s)(y)&&(a=!0,f({data:O,_c:be}))}if(a&&!y)if(Se(a)){const e=a(g,O);f({data:e,error:be,_c:be})}else f({data:g,error:be,_c:be});if(p[o][1]=He(),Promise.resolve(h()).then((()=>{f({_c:be})})),!y)return g;if(u)throw y}}const Ze=(e,t)=>{for(const r in e)e[r][0]&&e[r][0](t)},[et,tt]=((e,t)=>{if(!ke.has(e)){const r=_e(Ve,t),n={},o=Qe.bind(be,e);let i=ge;const a={},s=(e,t)=>{const r=a[e]||[];return a[e]=r,r.push(t),()=>r.splice(r.indexOf(t),1)},c=(t,r,n)=>{e.set(t,r);const o=a[t];if(o)for(const e of o)e(r,n)},u=()=>{if(!ke.has(e)&&(ke.set(e,[n,{},{},{},o,c,s]),!qe)){const t=r.initFocus(setTimeout.bind(be,Ze.bind(be,n,0))),o=r.initReconnect(setTimeout.bind(be,Ze.bind(be,n,1)));i=()=>{t&&t(),o&&o(),ke.delete(e)}}};return u(),[e,o,u,i]}return[e,ke.get(e)[4]]})(new Map),rt=_e({onLoadingSlow:ge,onSuccess:ge,onError:ge,onErrorRetry:(e,t,r,n,o)=>{const i=r.errorRetryCount,a=o.retryCount,s=~~((Math.random()+.5)*(1<<(a<8?a:8)))*r.errorRetryInterval;!xe(i)&&a>i||setTimeout(n,s,o)},onDiscarded:ge,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Be?1e4:5e3,focusThrottleInterval:5e3,dedupingInterval:2e3,loadingTimeout:Be?5e3:3e3,compare:(e,t)=>je(e)==je(t),isPaused:()=>!1,cache:et,mutate:tt,fallback:{}},Ae),nt=n({}),ot=De&&window.__SWR_DEVTOOLS_USE__,it=ot?window.__SWR_DEVTOOLS_USE__:[],at=e=>Se(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(null===e[1]?e[2]:e[1])||{}],st=it.concat((e=>(t,r,n)=>e(t,r&&((...e)=>{const[n]=Ye(t),[,,,o]=ke.get(et);if(n.startsWith("$inf$"))return r(...e);const i=o[n];return xe(i)?r(...e):(delete o[n],i)}),n)));ot&&(window.__SWR_DEVTOOLS_REACT__=e);const ct=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)}),ut={dedupe:!0},lt=(ft=(e,t,r)=>{const{cache:n,compare:o,suspense:i,fallbackData:l,revalidateOnMount:f,revalidateIfStale:d,refreshInterval:p,refreshWhenHidden:m,refreshWhenOffline:v,keepPreviousData:h}=r,[y,g,b,w]=ke.get(n),[x,S]=Ye(e),_=a(!1),O=a(!1),E=a(x),j=a(t),k=a(r),R=()=>k.current,T=()=>R().isVisible()&&R().isOnline(),[P,D,L,I]=Ie(n,x),F=a({}).current,C=xe(l)?r.fallback[x]:l,N=(e,t)=>{for(const r in F){const n=r;if("data"===n){if(!o(e[n],t[n])){if(!xe(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=!!x&&!!t&&(xe(f)?!R().isPaused()&&!i&&(!!xe(d)||d):f),r=t=>{const r=_e(t);return delete r._k,e?{isValidating:!0,isLoading:!0,...r}:r},n=P(),o=I(),a=r(n),s=n===o?a:r(o);let c=a;return[()=>{const e=r(P());return N(e,c)?(c.data=e.data,c.isLoading=e.isLoading,c.isValidating=e.isValidating,c.error=e.error,c):(c=e,e)},()=>s]}),[n,x]),V=ye.useSyncExternalStore(c((e=>L(x,((t,r)=>{N(r,t)||e()}))),[n,x]),A[0],A[1]),$=!_.current,q=y[x]&&y[x].length>0,M=V.data,U=xe(M)?C:M,W=V.error,B=a(U),Y=h?xe(M)?B.current:M:U,z=!(q&&!xe(W))&&($&&!xe(f)?f:!R().isPaused()&&(i?!xe(U)&&d:xe(U)||d)),H=!!(x&&t&&$&&z),K=xe(V.isValidating)?H:V.isValidating,G=xe(V.isLoading)?H:V.isLoading,J=c((async e=>{const t=j.current;if(!x||!t||O.current||R().isPaused())return!1;let n,i,a=!0;const s=e||{},c=!b[x]||!s.dedupe,u=()=>$e?!O.current&&x===E.current&&_.current:x===E.current,l={isValidating:!1,isLoading:!1},f=()=>{D(l)},d=()=>{const e=b[x];e&&e[1]===i&&delete b[x]},p={isValidating:!0};xe(P().data)&&(p.isLoading=!0);try{if(c&&(D(p),r.loadingTimeout&&xe(P().data)&&setTimeout((()=>{a&&u()&&R().onLoadingSlow(x,r)}),r.loadingTimeout),b[x]=[t(S),He()]),[n,i]=b[x],n=await n,c&&setTimeout(d,r.dedupingInterval),!b[x]||b[x][1]!==i)return c&&u()&&R().onDiscarded(x),!1;l.error=be;const e=g[x];if(!xe(e)&&(i<=e[0]||i<=e[1]||0===e[1]))return f(),c&&u()&&R().onDiscarded(x),!1;const s=P().data;l.data=o(s,n)?s:n,c&&u()&&R().onSuccess(n,x,r)}catch(e){d();const t=R(),{shouldRetryOnError:r}=t;t.isPaused()||(l.error=e,c&&u()&&(t.onError(e,x,t),(!0===r||Se(r)&&r(e))&&(R().revalidateOnFocus&&R().revalidateOnReconnect&&!T()||t.onErrorRetry(e,x,t,(e=>{const t=y[x];t&&t[0]&&t[0](Ke,e)}),{retryCount:(s.retryCount||0)+1,dedupe:!0}))))}return a=!1,f(),!0}),[x,n]),X=c(((...e)=>Qe(n,E.current,...e)),[]);if(Ue((()=>{j.current=t,k.current=r,xe(M)||(B.current=M)})),Ue((()=>{if(!x)return;const e=J.bind(be,ut);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())}})(x,y,((r,n={})=>{if(r==Ge){const r=Date.now();R().revalidateOnFocus&&r>t&&T()&&(t=r+R().focusThrottleInterval,e())}else if(r==Xe)R().revalidateOnReconnect&&T()&&e();else{if(r==Je)return J();if(r==Ke)return J(n)}}));return O.current=!1,E.current=x,_.current=!0,D({_k:S}),z&&(xe(U)||qe?e():Me(e)),()=>{O.current=!0,r()}}),[x]),Ue((()=>{let e;function t(){const t=Se(p)?p(P().data):p;t&&-1!==e&&(e=setTimeout(r,t))}function r(){P().error||!m&&!R().isVisible()||!v&&!R().isOnline()?t():J(ut).then(t)}return t(),()=>{e&&(clearTimeout(e),e=-1)}}),[p,m,v,x]),u(Y),i&&xe(U)&&x){if(!$e&&qe)throw new Error("Fallback data is required when using suspense in SSR.");j.current=t,k.current=r,O.current=!1;const e=w[x];if(!xe(e)){const t=X(e);ct(t)}if(!xe(W))throw W;{const e=J(ut);xe(Y)||(e.status="fulfilled",e.value=!0),ct(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=_e(rt,o(nt)),[r,n,i]=at(e),a=((e,t)=>{const r=_e(e,t);if(t){const{use:n,fallback:o}=e,{use:i,fallback:a}=t;n&&i&&(r.use=n.concat(i)),o&&a&&(r.fallback=_e(o,a))}return r})(t,i);let s=ft;const{use:c}=a,u=(c||[]).concat(st);for(let e=u.length;e--;)s=u[e](s);return s(r,n||a.fetcher||null,a)});var ft;const dt=((e,t)=>(...r)=>{const[n,o,i]=at(r),a=(i.use||[]).concat(t);return e(n,o,{...i,use:a})})(lt,(e=>(t,r,n)=>(n.revalidateOnFocus=!1,n.revalidateIfStale=!1,n.revalidateOnReconnect=!1,e(t,r,n))));var pt=function(e){var t=Z(e.endpoint),r=f(),n=X().showError,o=F().mutate,i=dt(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return A(void 0,void 0,void 0,(function(){return V(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,a=void 0===i?{}:i,s=new URLSearchParams(N(N({},e.params),r.query)).toString(),c=e.endpoint+(s?"?"+s:""),u=I(r.isReady?c:null,(function(e){return A(void 0,void 0,void 0,(function(){return V(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),l=u.data,d=u.error,p=u.isLoading,m=(null==l?void 0:l.data)||[],v=(null==l?void 0:l.total)||0,h=new URLSearchParams(r.query),y=h.get("page"),g=y?parseInt(y):1,b=h.get("limit"),w=b?parseInt(b):20,x={loading:p,dataSource:m,rowKey:"_id",bordered:!0,pagination:{current:g,defaultPageSize:w,total:v},onChange:function(e,t,n){return A(void 0,void 0,void 0,(function(){var t,o,i,a;return V(this,(function(s){return t=h.toString(),o=new URLSearchParams(t),e.current!==g&&("1"===(i=e.current.toString())?o.delete("page"):o.set("page",i)),e.pageSize!==w&&("20"===(a=e.pageSize.toString())?o.delete("limit"):o.set("limit",a)),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]}))}))}},S=function(){o(c)};return{data:m,isLoading:p,error:d,options:a,endpoint:e.endpoint,endpointWithHost:re(e.endpoint),mainroute:r.route,tableProps:x,init:S,getOpt:function(e,t){var r,n=null===(r=a[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return A(void 0,void 0,void 0,(function(){var o;return V(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r:r.endpoint)];case 1:return i.sent(),S(),[3,3];case 2:return o=i.sent(),n(o),[3,3];case 3:return[2]}}))}))},cancel:function(r){return A(void 0,void 0,void 0,(function(){var o;return V(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t.delete("string"==typeof r?e.endpoint+"/"+r+"/cancel":r.endpoint)];case 1:return i.sent(),S(),[3,3];case 2:return o=i.sent(),n(o),[3,3];case 3:return[2]}}))}))}}},mt=function(e){var n=Z(e.endpoint),o=S.useForm()[0],i=t(!1),s=i[0],c=i[1],u=t(!1),p=u[0],v=u[1],h=f(),y=X(),b=y.showError,w=y.message,x=function(e){var n=a(!1),o=X().modal,i=a(0),s=t(0),c=s[0],u=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),u(0)};return r((function(){if(n.current)return i.current!==c&&(window.addEventListener("beforeunload",f),d.events.on("routeChangeStart",l)),function(){window.removeEventListener("beforeunload",f),d.events.off("routeChangeStart",l)}}),[i.current,c]),{cambiarHashInicial:function(e){var t=ne(JSON.stringify(e));u(t),i.current=t},cambiarDatosFormulario:function(t){if(n.current&&0!==i.current){var r=JSON.stringify(t),o=ne(r);u(o),o===i.current?localStorage.removeItem(e):localStorage.setItem(e,r)}},limpiar:p,reanudar:function(){n.current=!0},obtenerDataEmergencia:function(){return A(void 0,void 0,void 0,(function(){var t,r;return V(this,(function(i){switch(i.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:Y.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=i.sent(),n.current=!0,[2,r]}}))}))}}}(h.asPath),E=a("emitir"),j=a(h.query.id),k=dt(e.sinOptions?null:e.endpoint+"/get-options",(function(e){return A(void 0,void 0,void 0,(function(){return V(this,(function(t){switch(t.label){case 0:return[4,n.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,R=void 0===k?{}:k;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,"")||"/",P=function(t){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];return A(void 0,$([t],r,!0),void 0,(function(t,r){var o,i,a,u,l,f,d,p;return void 0===r&&(r={}),V(this,(function(m){switch(m.label){case 0:if(!0===s)return[2];c(!0),x.limpiar(),o=r.endpoint||e.endpoint,i=r.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),a=void 0,j.current?[4,n.put(o+"/"+j.current,t,{params:i})]:[3,3];case 2:return a=m.sent().data,[3,5];case 3:return[4,n.post(o,t,{params:i})];case 4:a=m.sent().data,m.label=5;case 5:return!0!==r.noRedirect?(w.success("Guardado correctamente"),h.push(T)):c(!1),[2,a];case 6:if(u=m.sent(),c(!1),r.noShowError)throw u;return b(u),l=null===(p=null===(d=null==u?void 0:u.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")):x.reanudar(),[3,7];case 7:return[2]}}))}))},D=Y.jsxs(_,{children:[Y.jsx(g,{type:"primary",loading:s,onClick:function(){return o.submit()},children:"Guardar"}),Y.jsx(l,{href:T,children:Y.jsx(g,{children:"Cancelar"})})]}),L=Y.jsxs(Y.Fragment,{children:[Y.jsx(O,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),Y.jsx(O,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),Y.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[Y.jsx(O,{paragraph:{rows:4,width:"100%"}}),Y.jsx(O,{paragraph:{rows:4,width:"100%"}})]}),Y.jsxs(_,{children:[Y.jsx(O.Button,{}),Y.jsx(O.Button,{})]})]}),I=function(){return w.warning("Revisa los errores del formulario")},F={form:o,autoComplete:"off",initialValues:e.data,onFinish:P,layout:"vertical",onFinishFailed:I};return r((function(){if(e.recuperacionEmergencia){var t=setInterval((function(){if(p){var e=o.getFieldsValue();x.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(t)}}}),[p]),r((function(){var t=setTimeout((function(){e.soloParaInsertar||A(void 0,void 0,void 0,(function(){var t,r,i;return V(this,(function(a){switch(a.label){case 0:return t=!1,[4,x.obtenerDataEmergencia()];case 1:return(r=a.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=a.sent().data,a.label=4;case 4:return r?[4,null===(i=e.formatearDataInicial)||void 0===i?void 0:i.call(e,r)]:[3,6];case 5:a.sent(),o.setFieldsValue(r),a.label=6;case 6:return[2,t?e.data:r||e.data]}}))})).then((function(t){var r;return Promise.all([x.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:R,tipoEmision:E,objectId:j.current,mainroute:T,isLoading:s,isReady:p,data:e.data,endpoint:e.endpoint,onSubmit:P,onMainRouter:function(){return h.push(T)},setIsLoading:c,preventor:x,ModoCarga:L,BotonesPorDefecto:D,onMensajeValidacion:I,getOption:function(e,t){var r,n;return(null===(n=null===(r=R[e])||void 0===r?void 0:r.find((function(e){return e.id===t})))||void 0===n?void 0:n.description)||""},formProps:F}};var vt=function(e){var r=t(""),n=r[0];r[1];var o=function(e){var t=this,r=a(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=Z(n.endpoint),i=I(n.withOptions&&!e.defaultOptions?n.endpoint+"/get-options":null,(function(e){return A(t,void 0,void 0,(function(){return V(this,(function(t){switch(t.label){case 0:return[4,o.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data;return i&&(r.current=i),n}({type:e.type,defaultOptions:void 0});return o?Y.jsx(S.Item,{name:e.name,label:e.hideLabel?void 0:e.label||o.label,extra:e.hideMessage?void 0:n,rules:e.required?[ae.required()]:[{}],className:e.classNameFormItem}):null},ht="#F34D24",yt="#FFFFFF",gt=function(e){var n=t(!1),o=n[0],i=n[1];return r((function(){i(!0)}),[]),o?Y.jsx(E,{locale:C,theme:{token:{colorPrimary:ht,colorLink:ht,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:yt,headerBg:yt}}},children:Y.jsx(x,{children:Y.jsx(j,{className:e.className+" min-h-screen",style:e.style,hasSider:!0,children:e.children})})}):null},bt=function(e){var r=t(!0),n=r[0],o=r[1],i=t(!1),a=i[0],s=i[1];return Y.jsxs(Y.Fragment,{children:[e.sidebar?Y.jsxs(j.Sider,{style:{overflow:"auto",height:"100vh",position:"fixed",insetInlineStart:0,top:0,bottom:0,scrollbarWidth:"thin",scrollbarColor:"unset",zIndex:10},breakpoint:"md",collapsedWidth:0,trigger:null,collapsed:n,collapsible:!0,width:"230px",onBreakpoint:function(e){o(e),s(e)},children:[Y.jsx(l,{href:e.sidebar.title.href,children:Y.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:Y.jsx("div",{children:e.sidebar.title.label})})}),e.sidebar.menu]}):null,Y.jsxs(j,{className:a||n?"ml-0":"ml-[230px]",onClick:!n&&a?function(e){e.stopPropagation(),e.preventDefault(),o(!0)}:void 0,children:[e.navbar?Y.jsx(j.Header,{className:"border-b top-0 !z-[2] sticky !px-4",children:Y.jsxs("div",{className:"flex justify-between items-center h-full",children:[e.navbar.title?Y.jsx("div",{children:Y.jsx(g,{type:"text",icon:n?Y.jsx(v,{}):Y.jsx(h,{}),onClick:function(){return o(!n)},children:e.navbar.title})}):Y.jsx("div",{}),e.navbar.options?Y.jsx("div",{children:e.navbar.options}):Y.jsx("div",{})]})}):null,Y.jsx(j.Content,{className:"m-4 md:m-8 xl:m-16",children:e.children}),e.footer?Y.jsx(j.Footer,{className:"!text-gray-500",children:e.footer}):null]})]})};export{ce as $filtros,ae as $reglas,de as ContextoEmpresa,H as Header,bt as LayoutBase,vt as Seeker,gt as TemaPrincipal,G as configurarUtils,ee as crearToken,te as destruirToken,re as getApiEndpoint,Z as getAxios,ne as hashear,oe as redireccionarLogin,le as useContextoEmpresa,X as useUtils,mt as useVistaInsertar,pt as useVistaPrincipal};
|
|
20
20
|
//# sourceMappingURL=index.js.map
|