upconta.frontend-utils 1.0.11 → 1.0.12

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,7 @@
1
+ import { FC } from 'react';
2
+ declare const BotonConfirmacion: FC<{
3
+ title?: string;
4
+ onConfirm: () => void;
5
+ disabled?: boolean;
6
+ }>;
7
+ export default BotonConfirmacion;
@@ -1,6 +1,6 @@
1
1
  import type { Options, Params } from '../types';
2
2
  import { ReactNode } from 'react';
3
- export type Tipos = 'clients' | 'providers' | 'sellers' | 'transporters' | 'empleados' | 'mesas' | 'meseros';
3
+ export type Tipos = 'clients' | 'providers' | 'sellers' | 'transporters' | 'cuentas-contables' | 'empleados' | 'mesas' | 'meseros';
4
4
  export interface SeekerType {
5
5
  /**
6
6
  * El label que se va a mostrar en el FormItem.
@@ -0,0 +1,7 @@
1
+ declare const _default: import("react").ForwardRefExoticComponent<{
2
+ type: "client" | "provider" | "transporter";
3
+ ocultarBotones?: boolean;
4
+ } & import("react").RefAttributes<{
5
+ insertar: unknown;
6
+ }>>;
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ declare const InformacionAdicional: FC<{
3
+ name: string;
4
+ endpoint?: string;
5
+ autocompletar?: boolean;
6
+ }>;
7
+ export default InformacionAdicional;
@@ -54,6 +54,10 @@ interface Empresa {
54
54
  nombreUsuario: string;
55
55
  testEnviroment: boolean;
56
56
  usuarioEsAdmin: boolean;
57
+ /**
58
+ * Permite verficar la exitencia y vigencia de un módulo
59
+ */
60
+ hasModule: (module: 'administrative' | 'contability' | 'payroll' | 'treasury' | 'restaurantes' | 'continuidad' | 'configurations', date?: Date | undefined | string) => boolean;
57
61
  }
58
62
  export declare function useContextoEmpresa(): Empresa;
59
63
  declare const ContextoEmpresa: FC<{
@@ -3,6 +3,8 @@ export { default as Seeker } from './Seeker';
3
3
  export { default as TemaPrincipal } from './TemaPrincipal';
4
4
  export { default as BotonMovimientos } from './BotonMovimientos';
5
5
  export { default as IdentificadorPersona } from './IdentificadorPersona';
6
+ export { default as BotonConfirmacion } from './BotonConfirmacion';
6
7
  export { default as LayoutBase } from './LayoutBase';
7
8
  export { default as ContextoEmpresa, useContextoEmpresa, } from './contexts/Empresa';
8
9
  export { useFrontendUtils } from './contexts/FrontendUtils';
10
+ export { default as FormularioPersonas } from './administrative/FormularioPersonas';
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react"),t=require("next/link"),r=require("next/router"),n=require("@ant-design/icons"),o=require("antd"),a=require("swr/immutable"),i=require("axios"),s=require("cookies-next"),u=require("dayjs"),c=require("ts-debounce"),l=require("swr"),d=require("antd/locale/es_ES"),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 p(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 m(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(u){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,u])}}}function v(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 h,y={exports:{}},g={};var b,x={};
1
+ "use strict";var e=require("react"),r=require("next/link"),t=require("next/router"),n=require("@ant-design/icons"),o=require("antd"),a=require("swr/immutable"),i=require("axios"),s=require("cookies-next"),l=require("dayjs"),c=require("ts-debounce"),u=require("swr"),d=require("antd/locale/es_ES"),f=function(){return f=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},f.apply(this,arguments)};function p(e,r,t,n){return new(t||(t=Promise))((function(o,a){function i(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(i,s)}l((n=n.apply(e,r||[])).next())}))}function m(e,r){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(t=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=r.call(e,a)}catch(e){s=[6,e],n=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function v(e,r,t){if(t||2===arguments.length)for(var n,o=0,a=r.length;o<a;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var h,y={exports:{}},g={};var b,x={};
2
2
  /**
3
3
  * @license React
4
4
  * react-jsx-runtime.development.js
@@ -7,5 +7,5 @@
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?y.exports=function(){if(h)return g;h=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 g.Fragment=n,g.jsx=s,g.jsxs=s,g}():y.exports=(b||(b=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"),d=Symbol.for("react.suspense_list"),f=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,j=!1,S=!1,k=!1,O=!1;function E(e){return e.displayName||"Context"}function C(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 d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case u:return E(e)+".Consumer";case s:return E(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 f:var t=e.displayName||null;return null!==t?t:C(e.type)||"Memo";case p:var r=e,m=r._payload,v=r._init;try{return C(v(m))}catch(e){return null}}return null}b=Symbol.for("react.module.reference");var R,P,_,F,T,I,N,D=Object.assign,L=0;function q(){}q.__reactDisabledLog=!0;var M,U=y.ReactCurrentDispatcher;function $(e,t,r){if(void 0===M)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);M=n&&n[1]||""}return"\n"+M+e}var A,B=!1,Y="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||B)return"";var r,n=A.get(e);if(void 0!==n)return n;B=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=U.current,U.current=null,function(){if(0===L){R=console.log,P=console.info,_=console.warn,F=console.error,T=console.group,I=console.groupCollapsed,N=console.groupEnd;var e={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}();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 d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&A.set(e,d),d}}while(c>=1&&l>=0);break}}}finally{B=!1,U.current=o,function(){if(0==--L){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:R}),info:D({},e,{value:P}),warn:D({},e,{value:_}),error:D({},e,{value:F}),group:D({},e,{value:T}),groupCollapsed:D({},e,{value:I}),groupEnd:D({},e,{value:N})})}L<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?$(f):"";return"function"==typeof e&&A.set(e,p),p}function V(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 d:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return W(e.render,!1);case f:return V(e.type,t,r);case p:var o=e,a=o._payload,i=o._init;try{return V(i(a),t,r)}catch(e){}}return""}A=new Y;var z=Object.prototype.hasOwnProperty,H={},J=y.ReactDebugCurrentFrame;function K(e){if(e){var t=e._owner,r=V(e.type,e._source,t?t.type:null);J.setExtraStackFrame(r)}else J.setExtraStackFrame(null)}var Q=Array.isArray;function X(e){return Q(e)}function G(e){return""+e}function Z(e){if(function(e){try{return G(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)),G(e)}var ee,te,re,ne=y.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(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)&&(u=t.ref,function(e,t){if("string"==typeof e.ref&&ne.current&&t&&ne.current.stateNode!==t){var r=C(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',C(ne.current.type),e.ref),re[r]=!0)}}(t,o)),t)z.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=y.ReactCurrentOwner,ce=y.ReactDebugCurrentFrame;function le(e){if(e){var t=e._owner,r=V(e.type,e._source,t?t.type:null);ce.setExtraStackFrame(r)}else ce.setExtraStackFrame(null)}function de(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function fe(){if(ue.current){var e=C(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=fe();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 "+C(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];de(n)&&me(n,t)}else if(de(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 a,i=o.call(e);!(a=i.next()).done;)de(a.value)&&me(a.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!==c&&r.$$typeof!==f)return;t=r.propTypes}if(t){var n=C(r);!function(e,t,r,n,o){var a=Function.call.bind(z);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||(K(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),K(null)),s instanceof Error&&!(s.message in H)&&(H[s.message]=!0,K(o),g("Failed %s type: %s",r,s.message),K(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?",C(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 x=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===i||O||e===a||e===l||e===d||k||e===m||w||j||S)||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===c||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!x){var E,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+=fe(),null===e?E="null":X(e)?E="array":void 0!==e&&e.$$typeof===r?(E="<"+(C(e.type)||"Unknown")+" />",R=" Did you accidentally export a JSX literal instead of a component?"):E=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",E,R)}var P=ie(e,t,n,h,y);if(null==P)return P;if(x){var _=t.children;if(void 0!==_)if(v)if(X(_)){for(var F=0;F<_.length;F++)ve(_[F],e);Object.freeze&&Object.freeze(_)}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(_,e)}if(z.call(t,"key")){var T=C(e),I=Object.keys(t).filter((function(e){return"key"!==e})),N=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";ye[T+N]||(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} />',N,T,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",T),ye[T+N]=!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):he(P),P}var be=function(e,t,r){return ge(e,t,r,!1)},xe=function(e,t,r){return ge(e,t,r,!0)};x.Fragment=o,x.jsx=be,x.jsxs=xe}()),x);var w=y.exports,j=function(e){return e.paths?w.jsx(o.Breadcrumb,{items:e.paths.map((function(e){var r=e.to,n=e.label;return{title:r?w.jsx(t,{href:r,children:n}):n}}))}):null},S={hostUtils:"https://utils.upconta.com",hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},k=function(e){return p(void 0,void 0,void 0,(function(){var t,r,n,o,a,i;return m(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"}]}}))}))},O=function(){var e=o.App.useApp(),t=e.modal,r=e.message,n=e.notification;return{showError:function(e,r){return p(void 0,void 0,void 0,(function(){var n;return m(this,(function(o){switch(o.label){case 0:return[4,k(e)];case 1:return n=o.sent(),t[n.tipo]({title:(null==r?void 0:r.title)||"Proceso fallido",width:450,content:w.jsxs(w.Fragment,{children:[n.message,null==r?void 0:r.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:t,message:r,notification:n}},E=function(e){return"administrador"===e?S.adminTokenName:S.userTokenName},C=function(e,t){var r="";r=!e||"fastify"===e||e.includes("/v4")?S.hostFastify:"utils"===e?S.hostUtils:S.hostRestify;var n=i.create({baseURL:r});return"utils"!==e&&(n.defaults.headers.common.Authorization=s.getCookie(E(null==t?void 0:t.tipo),{domain:S.cookieDominio,path:S.cookiePath})),n},R=function(e,t){var r=new URL(e,e.includes("/v4")?S.hostFastify:S.hostRestify),n="";return t&&(n=new URLSearchParams(t).toString()),r.href+(n?"?"+n:"")},P=function(e,t){for(var r=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),n=0,o=r.length;n<o;++n){var a=r[n];if(!e||!(a in e))return;e=e[a]}return e},_=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},F=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)},T={empresa:function(e,t){return p(void 0,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return t?[4,C("restify").get("/v3/auth/business/"+t)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},I={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:c.debounce(T[e],300)}},correos:function(){return{validator:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return p(void 0,v([e],t,!0),void 0,(function(e,t){return void 0===t&&(t=[]),m(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 p(void 0,void 0,void 0,(function(){var r;return m(this,(function(o){if(r=u(n).startOf("day").diff(u().startOf("day"),"day"),e<0?r<e:r>e)throw new Error(t);return[2]}))}))}}}},N="es-EC",D={currency:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(N,{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"),u(e).format(t)},completeDate:function(e){return u(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return u(e).format("MM/YYYY")},percent:function(e,t){return void 0===t&&(t=2),e||(e=0),new Intl.NumberFormat(N,{style:"percent",minimumFractionDigits:t}).format("number"==typeof e?e:parseFloat(e))}},L=function(t){var r=t.values.customDocumentId||"_id",i=C(t.values.endpoint),s=e.useState(!1),u=s[0],c=s[1],l=e.useState(),d=l[0],v=l[1],h=e.useRef(!1),y=e.useState(""),g=y[0],b=y[1],x=e.useMemo((function(){console.log("useMemo searchParams","valorInput:",g,"props.value:",t.value);var e=new URLSearchParams(f(f(f({limit:"50"},t.values.params),t.params),t.value?{_id:t.value}:g?{q:g}:{})).toString();return e?"?"+e:""}),[t.value,g]),j=e.useState(),S=j[0],k=j[1],O=a(u?t.values.endpoint+x:null,(function(e){return p(void 0,void 0,void 0,(function(){var r;return m(this,(function(n){switch(n.label){case 0:return[4,i.get(e)];case 1:return r=n.sent().data,console.log("useSWRImmutable",t.values.endpoint+x,r.total),[2,r]}}))}))})),E=O.data,R=O.isLoading;e.useEffect((function(){console.log("useEffect [dataSwr]"),E&&k(E)}),[E]),e.useEffect((function(){if(console.log("useEffect [valorQ]",!!h.current),!h.current&&void 0!==d){var e=setTimeout((function(){b(d),c(!0)}),500);return function(){return clearTimeout(e)}}}),[d]);var _=e.useRef(!1),F=e.useMemo((function(){return console.log("useMemo: items [data, idSeleccionado]",S,""),(null==S?void 0:S.data.map((function(e){var o,a,i=P(e,r),s=t.values.title(e),u=null===(a=(o=t.values).subtitle)||void 0===a?void 0:a.call(o,e);return{key:i,disabled:""===i,value:i,texto:u,item:e,label:w.jsxs("div",{children:[w.jsxs("div",{children:[w.jsx("b",{className:"mr-1",children:s}),t.value===i?w.jsx(n.CheckCircleTwoTone,{twoToneColor:"#52c41a"}):void 0]}),u?w.jsx("div",{className:"text-wrap",children:u}):null]})}})))||[]}),[t.value,S,""]),T=e.useMemo((function(){if(console.log("useMemo seleccionado [props.value, data]",t.value,S),t.value)return null==S?void 0:S.data.find((function(e){return P(e,r)===t.value}))}),[t.value,S]);e.useEffect((function(){console.log("useEffect [props.value]",t.value),t.value&&c(!0)}),[t.value]);var I=e.useMemo((function(){return!0===R?w.jsx(n.LoadingOutlined,{}):T&&!t.llenarCuandoTipea?w.jsx(n.CheckCircleTwoTone,{twoToneColor:"#52c41a"}):w.jsx("span",{})}),[R,T]);return e.useEffect((function(){var e,r,n;if(console.log("useEffect [seleccionado]",T),T){var o=P(T,t.values.field),a=null===(e=t.values.formItemTexto||t.values.subtitle)||void 0===e?void 0:e(T);t.onSetTextoExtra(a||""),h.current=!0,!0===_.current&&(null===(r=t.onSelect)||void 0===r||r.call(t,T)),v(o),c(!1)}else t.onSetTextoExtra(""),null===(n=t.onSelect)||void 0===n||n.call(t,null)}),[T]),w.jsx(o.AutoComplete,{options:F,value:d,onFocus:function(){t.value||c(!0)},onSelect:function(e){var r;console.log("onSelect",e),c(!1),null===(r=t.onChange)||void 0===r||r.call(t,e)},onSearch:function(e){var r,n;console.log("onSearch",e),t.llenarCuandoTipea?null===(r=t.onChange)||void 0===r||r.call(t,e):t.value&&(null===(n=t.onChange)||void 0===n||n.call(t,null)),h.current=!1,v(e)},disabled:t.disabled,onChange:function(e){console.log("onChange",e)},children:w.jsx(o.Input,{placeholder:t.values.placeholder,suffix:I})})};L.displayName="BuscadorSeeker";var q=function(t){var r,n,i,s,u=e.useState(""),c=u[0],l=u[1],d=(r={tipo:t.type,options:void 0},n=e.useRef(r.options),i=e.useMemo((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/v3/restaurantes/mesas",params:{fields:"codigo estado descripcion ordenActual lugar"},field:"codigo",placeholder:"Ingresa el código de mesas",title:function(e){return e.codigo},subtitle:function(e){return e.lugar}};case"meseros":return{label:"Mesero",endpoint:"/v3/restaurantes/meseros",params:{fields:"name codigo"},field:"name",placeholder:"Ingresa un mesero",title:function(e){return e.name},subtitle:function(e){return e.codigo}};default:return{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}}}}({opciones:n,tipo:r.tipo})}),[r.tipo]),s=a(i.withOptions&&!r.options?i.endpoint+"/get-options":null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(t){switch(t.label){case 0:return[4,C(i.endpoint).get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,s&&(n.current=s),i);return d?w.jsx(o.Form.Item,{name:t.name,label:null===t.label?void 0:t.label||d.label,extra:t.hideMessage?void 0:c,rules:t.required?[I.required()]:[{}],className:t.classNameFormItem,children:w.jsx(L,{type:t.type,canCreate:t.canCreate,values:d,params:t.params,onSetTextoExtra:function(e){t.hideMessage||l(e)},onSelect:t.onSelect,llenarCuandoTipea:t.llenarCuandoTipea,disabled:t.disabled,cuerpoCrear:t.cuerpoCrear,initialValue:t.initialValue})}):null};q.displayName="Seeker";var M=e.createContext(null);function U(){return e.useContext(M)}var $=function(t){var r=e.useState([]),n=r[0],o=r[1];return w.jsxs(M.Provider,{value:{setBitacora:o},children:[w.jsx(A,{bitacora:n,setBitacora:o}),t.children]})},A=function(e){return w.jsx(o.Drawer,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:w.jsx(o.Timeline,{items:e.bitacora.map((function(e,t){var r=function(e){switch(e){case"created":case"creacion-masiva":return{color:"green"};case"draft":return{color:"orange",icon:w.jsx(n.SaveOutlined,{})};case"failed":return{color:"red",icon:w.jsx(n.CloseCircleOutlined,{})};case"issued":case"used":return{color:"green",icon:w.jsx(n.CheckCircleOutlined,{})};case"sent":return{color:"#1890FF",icon:w.jsx(n.CloudUploadOutlined,{})};case"pre-canceled":return{color:"#FFA500",icon:w.jsx(n.QuestionCircleOutlined,{})};case"canceled":case"reversado":return{color:"red",icon:w.jsx(n.StopOutlined,{})};case"edit":return{color:"#1890FF",icon:w.jsx(n.EditOutlined,{})};case"email":return{color:"#00CCFF",icon:w.jsx(n.MailOutlined,{})};case"deleted":return{color:"red",icon:w.jsx(n.DeleteOutlined,{})};case"intermitencia":return{color:"red",icon:w.jsx(n.HourglassOutlined,{})};case"exit-notice":return{color:"red",icon:w.jsx(n.LogoutOutlined,{})};case"exit-notice-deleted":return{color:"green",icon:w.jsx(n.LoginOutlined,{})}}}(e.type);return{color:null==r?void 0:r.color,key:"movimiento"+t,dot:null==r?void 0:r.icon,children:w.jsxs(w.Fragment,{children:[e.nota," ",w.jsx("br",{}),D.completeDate(e.date)]})}}))})})},B="#F34D24",Y="#FFFFFF",W=e.createContext(null);exports.$filtros=D,exports.$reglas=I,exports.BotonMovimientos=function(t){var r=U().setBitacora,a=e.useState(!1),i=a[0],s=a[1],u=e.useMemo((function(){return Array.isArray(t.movimientos)&&0!==t.movimientos.length}),[t.movimientos]),c=function(){u&&r(t.movimientos)};return e.useEffect((function(){var e;s(null===(e=t.movimientos)||void 0===e?void 0:e.some((function(e){return!!e.mostrarBadge})))}),[t.movimientos]),w.jsx(o.Badge,{dot:i,children:t.usarIcono?w.jsx(n.HistoryOutlined,{title:"Ver historial",className:u?"":"text-gray-300 cursor-not-allowed",onClick:c}):w.jsx(o.Button,{icon:w.jsx(n.HistoryOutlined,{}),title:"Ver historial",disabled:!u,onClick:c})})},exports.ContextoEmpresa=function(t){var n=r.useRouter(),o=e.useState(!1),a=o[0],i=o[1],s=e.useState(),u=s[0],c=s[1];return e.useEffect((function(){p(void 0,void 0,void 0,(function(){var e,t,r,n;return m(this,(function(o){switch(o.label){case 0:e=C("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?(i(!0),c(e)):F(n,t.pathLogin)}))}),[]),a?w.jsx(W.Provider,{value:{business:u,nombreEmpresa:u.business,nombreUsuario:u.user,testEnviroment:u.configs.useTestEnviroment,usuarioEsAdmin:"admin"===u.userType},children:t.children}):w.jsx("div",{className:"w-full h-screen flex items-center justify-center",children:"Cargando..."})},exports.Header=function(a){var i,s=a.defaultInsert,u=void 0!==s&&s,c=a.loading,l=void 0!==c&&c,d=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}(a,["defaultInsert","loading"]),f=r.useRouter(),p=f.pathname,m=e.useState(""),v=m[0],h=m[1],y=new URLSearchParams(f.query),g=function(){var e=new URLSearchParams(y.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),f.push({query:Object.fromEntries(e)}))},b=w.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==d.ocultarBuscador?w.jsx(o.Input.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==u?u||w.jsx(t,{href:(i=p,i.endsWith("/")&&(i=i.slice(0,-1)),i+"/insert"),children:w.jsx(o.Button,{type:"primary",children:"Insertar"})}):null,d.onRefrescar?w.jsx("div",{children:w.jsx(o.Button,{loading:l,title:"Refrescar datos",icon:w.jsx(n.ReloadOutlined,{}),onClick:d.onRefrescar})}):null,d.children]});return e.useEffect((function(){f.isReady&&h(y.get("q")||"")}),[f.isReady]),w.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[w.jsxs("div",{children:[w.jsx(j,{paths:d.paths}),w.jsx(o.Typography.Title,{className:"!mb-0 mt-4",children:d.title}),d.subtitle&&w.jsx(o.Typography.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:d.subtitle})]}),null!==d.column?d.column||b:null]})},exports.IdentificadorPersona=function(t){var r=o.Form.useFormInstance(),n=e.useState([]),a=n[0],i=n[1],s=e.useMemo((function(){var e=t.rules||[];switch(t.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:v(v([],e,!0),[I.pattern(/^[0-9]{13}$/,"El ruc debe tener 13 caracteres numéricos")],!1)};case"ci":return{label:"Cédula",placeholder:"Ingresar la cédula",max:10,rules:v(v([],e,!0),[I.pattern(/^[0-9]{10}$/,"La cédula debe tener 10 caracteres numéricos")],!1)};default:return{label:"Nº identificación",placeholder:"Ingresar el número de identificación",rules:e}}}),[t.type]),u=c.debounce((function(e){return p(void 0,void 0,void 0,(function(){var r,n,o;return m(this,(function(s){switch(s.label){case 0:if(r=C("utils"),!t.campoNombre||e.length<6||!["ci","ruc"].includes(t.type))return 0!==a.length&&i([]),[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.get("/clientes/buscar",{params:{identificador:e,tipo:"ci"===t.type?"cedula":"ruc"}})];case 2:return n=s.sent().data,i(n.map((function(e){return{value:e.identificador,nombre:e.nombre,label:w.jsxs(w.Fragment,{children:[w.jsx("b",{children:e.identificador}),w.jsx("br",{}),e.nombre]})}}))),[3,4];case 3:return o=s.sent(),console.error(o),[3,4];case 4:return[2]}}))}))}),500);return w.jsx(o.Form.Item,f({name:t.name,rules:s.rules,normalize:function(e){return e.trim().toUpperCase()},className:t.className,dependencies:t.dependencies},t.hiddenLabel?{}:{label:t.label||s.label},{children:w.jsx(o.AutoComplete,{options:a,onSelect:function(e,n){r.setFieldValue(t.campoNombre,n.nombre)},onSearch:u,placeholder:t.placeholder||s.placeholder,maxLength:s.max,disabled:t.disabled,onChange:function(e){var r;return null===(r=t.onChange)||void 0===r?void 0:r.call(t,e)}})}))},exports.LayoutBase=function(r){var a=e.useState(!0),i=a[0],s=a[1],u=e.useState(!1),c=u[0],l=u[1];return w.jsxs(w.Fragment,{children:[r.sidebar?w.jsxs(o.Layout.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:i,collapsible:!0,width:"230px",onBreakpoint:function(e){s(e),l(e)},children:[w.jsx(t,{href:r.sidebar.title.href,children:w.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:w.jsx("div",{children:r.sidebar.title.label})})}),r.sidebar.menu]}):null,w.jsxs(o.Layout,{className:c||i?"ml-0":"ml-[230px]",onClick:!i&&c?function(e){e.stopPropagation(),e.preventDefault(),s(!0)}:void 0,children:[r.navbar?w.jsx(o.Layout.Header,{className:"border-b top-0 !z-[2] sticky !px-4",children:w.jsxs("div",{className:"flex justify-between items-center h-full",children:[w.jsx("div",{children:w.jsx(o.Button,{type:"text",icon:i?w.jsx(n.MenuUnfoldOutlined,{}):w.jsx(n.MenuFoldOutlined,{}),onClick:function(){return s(!i)},children:r.navbar.title})}),r.navbar.options?w.jsx("div",{children:r.navbar.options}):w.jsx("div",{})]})}):null,w.jsx(o.Layout.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:r.children}),r.footer?w.jsx(o.Layout.Footer,{className:"!text-gray-500",children:r.footer}):null]})]})},exports.Seeker=q,exports.TemaPrincipal=function(t){var r=e.useState(!1),n=r[0],a=r[1];return e.useEffect((function(){a(!0)}),[]),n?w.jsx($,{children:w.jsx(o.ConfigProvider,{locale:d,theme:{token:{colorPrimary:B,colorLink:B,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:Y,headerBg:Y},Tag:{marginXS:0}}},children:w.jsx(o.App,{children:w.jsx(o.Layout,{className:(t.className||"")+" min-h-screen w-full",style:t.style,children:t.children})})})}):null},exports.configurarUtils=function(e){S=f(f({},S),e)},exports.crearToken=function(e,t){s.setCookie(E(t.usuario),e,{domain:S.cookieDominio,maxAge:604800,path:S.cookiePath})},exports.destruirToken=function(e){s.deleteCookie(E(e),{domain:S.cookieDominio,path:S.cookiePath})},exports.getApiEndpoint=R,exports.getAxios=C,exports.getNestedPath=P,exports.hashear=_,exports.redireccionarLogin=F,exports.useContextoEmpresa=function(){return e.useContext(W)},exports.useFrontendUtils=U,exports.useUtils=O,exports.useVistaInsertar=function(i){var s=C(i.endpoint,{tipo:i.tipoUsuario||"usuario"}),u=o.Form.useForm()[0],c=e.useState(!1),l=c[0],d=c[1],f=e.useState(!1),h=f[0],y=f[1],g=r.useRouter(),b=O(),x=b.showError,j=b.message,S=function(t){var o=e.useRef(!1),a=O().modal,i=e.useRef(0),s=e.useState(0),u=s[0],c=s[1],l=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";f(),localStorage.removeItem(t)},d=function(e){e.preventDefault()},f=function(){o.current=!1,window.removeEventListener("beforeunload",d),r.Router.events.off("routeChangeStart",l),localStorage.removeItem(t),c(0)};return e.useEffect((function(){if(o.current)return i.current!==u&&(window.addEventListener("beforeunload",d),r.Router.events.on("routeChangeStart",l)),function(){window.removeEventListener("beforeunload",d),r.Router.events.off("routeChangeStart",l)}}),[i.current,u]),{cambiarHashInicial:function(e){var t=_(JSON.stringify(e));c(t),i.current=t},cambiarDatosFormulario:function(e){if(o.current&&0!==i.current){var r=JSON.stringify(e),n=_(r);c(n),n===i.current?localStorage.removeItem(t):localStorage.setItem(t,r)}},limpiar:f,reanudar:function(){o.current=!0},obtenerDataEmergencia:function(){return p(void 0,void 0,void 0,(function(){var e,r;return m(this,(function(i){switch(i.label){case 0:return e=localStorage.getItem(t),[4,new Promise((function(t){if(!e)return t(void 0);a.confirm({title:"Existen datos guardados",icon:w.jsx(n.QuestionCircleOutlined,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return t(JSON.parse(e))},onCancel:function(){return t(void 0)}})}))];case 1:return r=i.sent(),o.current=!0,[2,r]}}))}))}}}(g.asPath),k=e.useRef("emitir"),E=e.useRef(g.query.id),R=a(i.sinOptions?null:i.endpoint+"/get-options",(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(t){switch(t.label){case 0:return[4,s.get(e)];case 1:return[2,t.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,P=void 0===R?{}:R;e.useEffect((function(){E.current=i.registroId,E.current||(E.current=i.soloParaInsertar?void 0:g.query.id)}),[null==i?void 0:i.registroId,i.soloParaInsertar]);var F=g.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",T=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return p(void 0,v([e],t,!0),void 0,(function(e,t){var r,n,o,a,u,c,f,p;return void 0===t&&(t={}),m(this,(function(m){switch(m.label){case 0:if(!0===l)return[2];d(!0),S.limpiar(),r=t.endpoint||i.endpoint,n=t.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),o=void 0,E.current?[4,s.put(r+"/"+E.current,e,{params:n})]:[3,3];case 2:return o=m.sent().data,[3,5];case 3:return[4,s.post(r,e,{params:n})];case 4:o=m.sent().data,m.label=5;case 5:return!0!==t.noRedirect?(j.success("Guardado correctamente"),g.push(F)):d(!1),[2,o];case 6:if(a=m.sent(),d(!1),t.noShowError)throw a;return x(a),u=null===(p=null===(f=null==a?void 0:a.response)||void 0===f?void 0:f.data)||void 0===p?void 0:p.comprobante,c="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 c.includes(e)}))?g.push(F):!t.noRedirect&&u&&u!==E.current?(E.current=u,g.push(F+"/"+u+"/edit")):S.reanudar(),[3,7];case 7:return[2]}}))}))},I=w.jsxs(o.Space,{children:[w.jsx(o.Button,{type:"primary",loading:l,onClick:function(){return u.submit()},children:"Guardar"}),w.jsx(t,{href:F,children:w.jsx(o.Button,{children:"Cancelar"})})]}),N=w.jsxs(w.Fragment,{children:[w.jsx(o.Skeleton,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),w.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),w.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[w.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}}),w.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}})]}),w.jsxs(o.Space,{children:[w.jsx(o.Skeleton.Button,{}),w.jsx(o.Skeleton.Button,{})]})]}),D=function(){return j.warning("Revisa los errores del formulario")},L={form:u,autoComplete:"off",initialValues:i.data,onFinish:T,layout:"vertical",onFinishFailed:D};return e.useEffect((function(){if(i.recuperacionEmergencia){var e=setInterval((function(){if(h){var e=u.getFieldsValue();S.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(e)}}}),[h]),e.useEffect((function(){var e=setTimeout((function(){i.soloParaInsertar||p(void 0,void 0,void 0,(function(){var e,t,r;return m(this,(function(n){switch(n.label){case 0:return e=!1,[4,S.obtenerDataEmergencia()];case 1:return(t=n.sent())?(E.current=t._id,e=!0,[3,4]):[3,2];case 2:return E.current?[4,s.get("".concat(i.endpoint,"/").concat(E.current),{params:i.params})]:[3,4];case 3:t=n.sent().data,n.label=4;case 4:return t?[4,null===(r=i.formatearDataInicial)||void 0===r?void 0:r.call(i,t)]:[3,6];case 5:n.sent(),u.setFieldsValue(t),n.label=6;case 6:return[2,e?i.data:t||i.data]}}))})).then((function(e){var t;return Promise.all([S.cambiarHashInicial(e),null===(t=i.onMounted)||void 0===t?void 0:t.call(i)])})).then((function(){return y(!0)}))}),200);return function(){return clearTimeout(e)}}),[g.query.id]),{form:u,router:g,options:P,tipoEmision:k,objectId:E.current,mainroute:F,isLoading:l,isReady:h,data:i.data,endpoint:i.endpoint,axios:s,onSubmit:T,onMainRouter:function(){return g.push(F)},setIsLoading:d,preventor:S,ModoCarga:N,BotonesPorDefecto:I,onMensajeValidacion:D,getOption:function(e,t){var r,n;return(null===(n=null===(r=P[e])||void 0===r?void 0:r.find((function(e){return e.id===t})))||void 0===n?void 0:n.description)||""},formProps:L}},exports.useVistaPrincipal=function(e){var t=C(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),n=r.useRouter(),o=O().showError,i=l.useSWRConfig().mutate,s=a(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})).data,u=void 0===s?{}:s,c=new URLSearchParams(f(f({},e.params),n.query)).toString(),d=e.endpoint+(c?"?"+c:""),v=l(n.isReady?d:null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,t.get(e)];case 1:return[2,r.sent().data]}}))}))})),h=v.data,y=v.error,g=v.isLoading,b=(null==h?void 0:h.data)||[],x=(null==h?void 0:h.total)||0,w=new URLSearchParams(n.query),j=w.get("page"),S=j?parseInt(j):1,k=w.get("limit"),E=k?parseInt(k):20,P={loading:g,dataSource:b,rowKey:"_id",bordered:!0,pagination:{current:S,defaultPageSize:E,total:x},onChange:function(e,t,r){return p(void 0,void 0,void 0,(function(){var t,o,a,i;return m(this,(function(s){return t=w.toString(),o=new URLSearchParams(t),e.current!==S&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==E&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(r)||("ascend"===r.order?o.set("sort",r.field):"descend"===r.order?o.set("sort","-"+r.field):o.delete("sort")),t!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},_=function(){i(d)};return{data:b,isLoading:g,error:y,options:u,endpoint:e.endpoint,endpointWithHost:R(e.endpoint),mainroute:n.route,tableProps:P,axios:t,init:_,getOpt:function(e,t){var r,n=null===(r=u[e])||void 0===r?void 0:r.find((function(e){return e.id===t}));return n?n.description:""},remove:function(r){return p(void 0,void 0,void 0,(function(){var n;return m(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 n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))},cancel:function(r){return p(void 0,void 0,void 0,(function(){var n;return m(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 n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))}}};
10
+ */"production"===process.env.NODE_ENV?y.exports=function(){if(h)return g;h=1;var r=e,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,r,n){var s,l={},c=null,u=null;for(s in void 0!==n&&(c=""+n),void 0!==r.key&&(c=""+r.key),void 0!==r.ref&&(u=r.ref),r)o.call(r,s)&&!i.hasOwnProperty(s)&&(l[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===l[s]&&(l[s]=r[s]);return{$$typeof:t,type:e,key:c,ref:u,props:l,_owner:a.current}}return g.Fragment=n,g.jsx=s,g.jsxs=s,g}():y.exports=(b||(b=1,"production"!==process.env.NODE_ENV&&function(){var r=e,t=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"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=Symbol.iterator,h="@@iterator",y=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];!function(e,r,t){var n=y.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(r+="%s",t=t.concat([n]));var o=t.map((function(e){return String(e)}));o.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,o)}("error",e,t)}var b,j=!1,w=!1,S=!1,k=!1,C=!1;function I(e){return e.displayName||"Context"}function F(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 u:return"Suspense";case d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return I(e)+".Consumer";case s:return I(e._context)+".Provider";case c:return function(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return""!==o?t+"("+o+")":t}(e,e.render,"ForwardRef");case f:var r=e.displayName||null;return null!==r?r:F(e.type)||"Memo";case p:var t=e,m=t._payload,v=t._init;try{return F(v(m))}catch(e){return null}}return null}b=Symbol.for("react.module.reference");var O,E,T,R,N,P,_,D=Object.assign,L=0;function q(){}q.__reactDisabledLog=!0;var M,A=y.ReactCurrentDispatcher;function B(e,r,t){if(void 0===M)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);M=n&&n[1]||""}return"\n"+M+e}var $,U=!1,z="function"==typeof WeakMap?WeakMap:Map;function W(e,r){if(!e||U)return"";var t,n=$.get(e);if(void 0!==n)return n;U=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=A.current,A.current=null,function(){if(0===L){O=console.log,E=console.info,T=console.warn,R=console.error,N=console.group,P=console.groupCollapsed,_=console.groupEnd;var e={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}L++}();try{if(r){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){t=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){t=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){t=e}e()}}catch(r){if(r&&t&&"string"==typeof r.stack){for(var s=r.stack.split("\n"),l=t.stack.split("\n"),c=s.length-1,u=l.length-1;c>=1&&u>=0&&s[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(s[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||s[c]!==l[u]){var d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&$.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{U=!1,A.current=o,function(){if(0==--L){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:O}),info:D({},e,{value:E}),warn:D({},e,{value:T}),error:D({},e,{value:R}),group:D({},e,{value:N}),groupCollapsed:D({},e,{value:P}),groupEnd:D({},e,{value:_})})}L<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?B(f):"";return"function"==typeof e&&$.set(e,p),p}function V(e,r,t){if(null==e)return"";if("function"==typeof e)return W(e,!(!(n=e.prototype)||!n.isReactComponent));var n;if("string"==typeof e)return B(e);switch(e){case u:return B("Suspense");case d:return B("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return W(e.render,!1);case f:return V(e.type,r,t);case p:var o=e,a=o._payload,i=o._init;try{return V(i(a),r,t)}catch(e){}}return""}$=new z;var Y=Object.prototype.hasOwnProperty,H={},J=y.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,t=V(e.type,e._source,r?r.type:null);J.setExtraStackFrame(t)}else J.setExtraStackFrame(null)}var K=Array.isArray;function X(e){return K(e)}function G(e){return""+e}function Z(e){if(function(e){try{return G(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)),G(e)}var ee,re,te,ne=y.ReactCurrentOwner,oe={key:!0,ref:!0,__self:!0,__source:!0};te={};var ae=function(e,r,n,o,a,i,s){var l={$$typeof:t,type:e,key:r,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l};function ie(e,r,t,n,o){var a,i={},s=null,l=null;for(a in void 0!==t&&(Z(t),s=""+t),function(e){if(Y.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(r)&&(Z(r.key),s=""+r.key),function(e){if(Y.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return void 0!==e.ref}(r)&&(l=r.ref,function(e,r){if("string"==typeof e.ref&&ne.current&&r&&ne.current.stateNode!==r){var t=F(ne.current.type);te[t]||(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',F(ne.current.type),e.ref),te[t]=!0)}}(r,o)),r)Y.call(r,a)&&!oe.hasOwnProperty(a)&&(i[a]=r[a]);if(e&&e.defaultProps){var c=e.defaultProps;for(a in c)void 0===i[a]&&(i[a]=c[a])}if(s||l){var u="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,r){var t=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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(i,u),l&&function(e,r){var t=function(){re||(re=!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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}(i,u)}return ae(e,s,l,o,n,ne.current,i)}var se,le=y.ReactCurrentOwner,ce=y.ReactDebugCurrentFrame;function ue(e){if(e){var r=e._owner,t=V(e.type,e._source,r?r.type:null);ce.setExtraStackFrame(t)}else ce.setExtraStackFrame(null)}function de(e){return"object"==typeof e&&null!==e&&e.$$typeof===t}function fe(){if(le.current){var e=F(le.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}se=!1;var pe={};function me(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var t=function(e){var r=fe();if(!r){var t="string"==typeof e?e:e.displayName||e.name;t&&(r="\n\nCheck the top-level render call using <"+t+">.")}return r}(r);if(!pe[t]){pe[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+F(e._owner.type)+"."),ue(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.',t,n),ue(null)}}}function ve(e,r){if("object"==typeof e)if(X(e))for(var t=0;t<e.length;t++){var n=e[t];de(n)&&me(n,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var r=v&&e[v]||e[h];return"function"==typeof r?r:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)de(a.value)&&me(a.value,r)}}function he(e){var r,t=e.type;if(null!=t&&"string"!=typeof t){if("function"==typeof t)r=t.propTypes;else{if("object"!=typeof t||t.$$typeof!==c&&t.$$typeof!==f)return;r=t.propTypes}if(r){var n=F(t);!function(e,r,t,n,o){var a=Function.call.bind(Y);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var l=Error((n||"React class")+": "+t+" 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 l.name="Invariant Violation",l}s=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(Q(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",t,i,typeof s),Q(null)),s instanceof Error&&!(s.message in H)&&(H[s.message]=!0,Q(o),g("Failed %s type: %s",t,s.message),Q(null))}}(r,e.props,"prop",n,e)}else void 0===t.PropTypes||se||(se=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",F(t)||"Unknown"));"function"!=typeof t.getDefaultProps||t.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ye={};function ge(e,r,n,v,h,y){var x=function(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===i||C||e===a||e===u||e===d||k||e===m||j||w||S)||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===s||e.$$typeof===l||e.$$typeof===c||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!x){var I,O="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(O+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),O+=fe(),null===e?I="null":X(e)?I="array":void 0!==e&&e.$$typeof===t?(I="<"+(F(e.type)||"Unknown")+" />",O=" Did you accidentally export a JSX literal instead of a component?"):I=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",I,O)}var E=ie(e,r,n,h,y);if(null==E)return E;if(x){var T=r.children;if(void 0!==T)if(v)if(X(T)){for(var R=0;R<T.length;R++)ve(T[R],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 ve(T,e)}if(Y.call(r,"key")){var N=F(e),P=Object.keys(r).filter((function(e){return"key"!==e})),_=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";ye[N+_]||(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} />',_,N,P.length>0?"{"+P.join(": ..., ")+": ...}":"{}",N),ye[N+_]=!0)}return e===o?function(e){for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if("children"!==n&&"key"!==n){ue(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),ue(null);break}}null!==e.ref&&(ue(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),ue(null))}(E):he(E),E}var be=function(e,r,t){return ge(e,r,t,!1)},xe=function(e,r,t){return ge(e,r,t,!0)};x.Fragment=o,x.jsx=be,x.jsxs=xe}()),x);var j=y.exports,w=function(e){return e.paths?j.jsx(o.Breadcrumb,{items:e.paths.map((function(e){var t=e.to,n=e.label;return{title:t?j.jsx(r,{href:t,children:n}):n}}))}):null},S={hostUtils:"https://utils.upconta.com",hostFastify:"",hostRestify:"",userTokenName:"",adminTokenName:"",cookieDominio:"",cookiePath:void 0},k=function(e){return p(void 0,void 0,void 0,(function(){var r,t,n,o,a,i;return m(this,(function(s){switch(s.label){case 0:if(!((r=(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=(t=JSON).parse,[4,r.text()];case 2:return[2,n.apply(t,[s.sent()]).message];case 3:return s.sent(),o={},[4,r.text()];case 4:return[2,(o.message=s.sent(),o.tipo="error",o)];case 5:return[2,{message:r,tipo:"error"}]}}))}))},C=function(){var e=o.App.useApp(),r=e.modal,t=e.message,n=e.notification;return{showError:function(e,t){return p(void 0,void 0,void 0,(function(){var n;return m(this,(function(o){switch(o.label){case 0:return[4,k(e)];case 1:return n=o.sent(),r[n.tipo]({title:(null==t?void 0:t.title)||"Proceso fallido",width:450,content:j.jsxs(j.Fragment,{children:[n.message,null==t?void 0:t.cuerpoAdicional]}),okType:"danger"}),[2]}}))}))},modal:r,message:t,notification:n}},I=function(e){return"administrador"===e?S.adminTokenName:S.userTokenName},F=function(e,r){var t="";t=!e||"fastify"===e||e.includes("/v4")?S.hostFastify:"utils"===e?S.hostUtils:S.hostRestify;var n=i.create({baseURL:t});return"utils"!==e&&(n.defaults.headers.common.Authorization=s.getCookie(I(null==r?void 0:r.tipo),{domain:S.cookieDominio,path:S.cookiePath})),n},O=function(e,r){var t=new URL(e,e.includes("/v4")?S.hostFastify:S.hostRestify),n="";return r&&(n=new URLSearchParams(r).toString()),t.href+(n?"?"+n:"")},E=function(e,r){for(var t=(r=(r=r.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),n=0,o=t.length;n<o;++n){var a=t[n];if(!e||!(a in e))return;e=e[a]}return e},T=function(e){var r,t=0;if(0===e.length)return t;for(r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t},R=function(e,r){void 0===r&&(r="/login");var t=r.includes("://"),n=new URL(t?r:window.location.origin+r);("/"!==e.asPath||t)&&n.searchParams.append("redirect",t?window.location.href:e.asPath),t?window.location.href=n.href:e.push(n.pathname+n.search)};var N={empresa:function(e,r){return p(void 0,void 0,void 0,(function(){return m(this,(function(e){switch(e.label){case 0:return r?[4,F("restify").get("/v3/auth/business/"+r)]:[2];case 1:if(e.sent().data)throw new Error("La empresa ya se encuentra registrada");return[2]}}))}))}},P={required:function(e){return void 0===e&&(e="El campo es requerido"),{required:!0,message:e}},min:function(e,r){return void 0===r&&(r="Debe tener mínimo ".concat(e.toString()," caracteres")),{min:e,message:r}},max:function(e,r){return void 0===r&&(r="Debe tener máximo ".concat(e.toString()," caracteres")),{max:e,message:r}},email:function(e){return void 0===e&&(e="El correo electrónico no es válido"),{type:"email",message:e}},pattern:function(e,r){return void 0===r&&(r="No cumple el formato requerido"),{pattern:e,message:r}},unico:function(e){return{validator:c.debounce(N[e],300)}},correos:function(){return{validator:function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return p(void 0,v([e],r,!0),void 0,(function(e,r){return void 0===r&&(r=[]),m(this,(function(e){if(r.some((function(e){return!e.includes("@")})))throw new Error("Alguno de los correos no es válido");return[2]}))}))}}},diasDiferencia:function(e,r){return void 0===r&&(r="La fecha ingresada no es válido"),{validator:function(t,n){return p(void 0,void 0,void 0,(function(){var t;return m(this,(function(o){if(t=l(n).startOf("day").diff(l().startOf("day"),"day"),e<0?t<e:t>e)throw new Error(r);return[2]}))}))}}}},_="es-EC",D={currency:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat(_,{style:"currency",currency:"USD",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))},date:function(e,r){return void 0===r&&(r="DD/MM/YYYY"),l(e).format(r)},completeDate:function(e){return l(e).format("DD/MM/YYYY HH:mm:ss")},month:function(e){return l(e).format("MM/YYYY")},percent:function(e,r){return void 0===r&&(r=2),e||(e=0),new Intl.NumberFormat(_,{style:"percent",minimumFractionDigits:r}).format("number"==typeof e?e:parseFloat(e))}},L=function(i){var s=F(i.endpoint,{tipo:i.tipoUsuario||"usuario"}),l=o.Form.useForm()[0],c=e.useState(!1),u=c[0],d=c[1],f=e.useState(!1),h=f[0],y=f[1],g=t.useRouter(),b=C(),x=b.showError,w=b.message,S=function(r){var o=e.useRef(!1),a=C().modal,i=e.useRef(0),s=e.useState(0),l=s[0],c=s[1],u=function(){if(!window.confirm("¿Estás seguro que quieres salir?"))throw"Route Canceled";f(),localStorage.removeItem(r)},d=function(e){e.preventDefault()},f=function(){o.current=!1,window.removeEventListener("beforeunload",d),t.Router.events.off("routeChangeStart",u),localStorage.removeItem(r),c(0)};return e.useEffect((function(){if(o.current)return i.current!==l&&(window.addEventListener("beforeunload",d),t.Router.events.on("routeChangeStart",u)),function(){window.removeEventListener("beforeunload",d),t.Router.events.off("routeChangeStart",u)}}),[i.current,l]),{cambiarHashInicial:function(e){var r=T(JSON.stringify(e));c(r),i.current=r},cambiarDatosFormulario:function(e){if(o.current&&0!==i.current){var t=JSON.stringify(e),n=T(t);c(n),n===i.current?localStorage.removeItem(r):localStorage.setItem(r,t)}},limpiar:f,reanudar:function(){o.current=!0},obtenerDataEmergencia:function(){return p(void 0,void 0,void 0,(function(){var e,t;return m(this,(function(i){switch(i.label){case 0:return e=localStorage.getItem(r),[4,new Promise((function(r){if(!e)return r(void 0);a.confirm({title:"Existen datos guardados",icon:j.jsx(n.QuestionCircleOutlined,{}),content:"Hubo un cierre inesperado pero los datos fueron guardados temporalmente ¿Deseas recuperarlos?",onOk:function(){return r(JSON.parse(e))},onCancel:function(){return r(void 0)}})}))];case 1:return t=i.sent(),o.current=!0,[2,t]}}))}))}}}(g.asPath),k=e.useRef("emitir"),I=e.useRef(g.query.id),O=a(i.sinOptions?null:i.endpoint+"/get-options",(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,s.get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,E=void 0===O?{}:O;e.useEffect((function(){I.current=i.registroId,I.current||(I.current=i.soloParaInsertar?void 0:g.query.id)}),[null==i?void 0:i.registroId,i.soloParaInsertar]);var R=g.asPath.replace(/\/(insert|[\w]*\/edit$)/g,"")||"/",N=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return p(void 0,v([e],r,!0),void 0,(function(e,r){var t,n,o,a,l,c,f,p;return void 0===r&&(r={}),m(this,(function(m){switch(m.label){case 0:if(!0===u)return[2];d(!0),S.limpiar(),t=r.endpoint||i.endpoint,n=r.params||void 0,m.label=1;case 1:return m.trys.push([1,6,,7]),o=void 0,I.current?[4,s.put(t+"/"+I.current,e,{params:n})]:[3,3];case 2:return o=m.sent().data,[3,5];case 3:return[4,s.post(t,e,{params:n})];case 4:o=m.sent().data,m.label=5;case 5:return!0!==r.noRedirect?(w.success("Guardado correctamente"),g.push(R)):d(!1),[2,o];case 6:if(a=m.sent(),d(!1),r.noShowError)throw a;return x(a),l=null===(p=null===(f=null==a?void 0:a.response)||void 0===f?void 0:f.data)||void 0===p?void 0:p.comprobante,c="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 c.includes(e)}))?g.push(R):!r.noRedirect&&l&&l!==I.current?(I.current=l,g.push(R+"/"+l+"/edit")):S.reanudar(),[3,7];case 7:return[2]}}))}))},P=j.jsxs(o.Space,{children:[j.jsx(o.Button,{type:"primary",loading:u,onClick:function(){return l.submit()},children:"Guardar"}),j.jsx(r,{href:R,children:j.jsx(o.Button,{children:"Cancelar"})})]}),_=j.jsxs(j.Fragment,{children:[j.jsx(o.Skeleton,{paragraph:{rows:3,width:"100%"},className:"mb-4"}),j.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"},className:"mb-4"}),j.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[j.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}}),j.jsx(o.Skeleton,{paragraph:{rows:4,width:"100%"}})]}),j.jsxs(o.Space,{children:[j.jsx(o.Skeleton.Button,{}),j.jsx(o.Skeleton.Button,{})]})]}),D=function(){return w.warning("Revisa los errores del formulario")},L={form:l,autoComplete:"off",initialValues:i.data,onFinish:N,layout:"vertical",onFinishFailed:D};return e.useEffect((function(){if(i.recuperacionEmergencia){var e=setInterval((function(){if(h){var e=l.getFieldsValue();S.cambiarDatosFormulario(e)}}),1e3);return function(){return clearInterval(e)}}}),[h]),e.useEffect((function(){var e=setTimeout((function(){i.soloParaInsertar||p(void 0,void 0,void 0,(function(){var e,r,t;return m(this,(function(n){switch(n.label){case 0:return e=!1,[4,S.obtenerDataEmergencia()];case 1:return(r=n.sent())?(I.current=r._id,e=!0,[3,4]):[3,2];case 2:return I.current?[4,s.get("".concat(i.endpoint,"/").concat(I.current),{params:i.params})]:[3,4];case 3:r=n.sent().data,n.label=4;case 4:return r?[4,null===(t=i.formatearDataInicial)||void 0===t?void 0:t.call(i,r)]:[3,6];case 5:n.sent(),l.setFieldsValue(r),n.label=6;case 6:return[2,e?i.data:r||i.data]}}))})).then((function(e){var r;return Promise.all([S.cambiarHashInicial(e),null===(r=i.onMounted)||void 0===r?void 0:r.call(i)])})).then((function(){return y(!0)}))}),200);return function(){return clearTimeout(e)}}),[g.query.id]),{form:l,router:g,options:E,tipoEmision:k,objectId:I.current,mainroute:R,isLoading:u,isReady:h,data:i.data,endpoint:i.endpoint,axios:s,onSubmit:N,onMainRouter:function(){return g.push(R)},setIsLoading:d,preventor:S,ModoCarga:_,BotonesPorDefecto:P,onMensajeValidacion:D,getOption:function(e,r){var t,n;return(null===(n=null===(t=E[e])||void 0===t?void 0:t.find((function(e){return e.id===r})))||void 0===n?void 0:n.description)||""},formProps:L}},q=function(r){var t=r.values.customDocumentId||"_id",i=F(r.values.endpoint),s=e.useState(!1),l=s[0],c=s[1],u=e.useState(),d=u[0],v=u[1],h=e.useRef(!1),y=e.useState(""),g=y[0],b=y[1],x=e.useMemo((function(){console.log("useMemo searchParams","valorInput:",g,"props.value:",r.value);var e=new URLSearchParams(f(f(f({limit:"50"},r.values.params),r.params),r.value?{_id:r.value}:g?{q:g}:{})).toString();return e?"?"+e:""}),[r.value,g]),w=e.useState(),S=w[0],k=w[1],C=a(l?r.values.endpoint+x:null,(function(e){return p(void 0,void 0,void 0,(function(){var t;return m(this,(function(n){switch(n.label){case 0:return[4,i.get(e)];case 1:return t=n.sent().data,console.log("useSWRImmutable",r.values.endpoint+x,t.total),[2,t]}}))}))})),I=C.data,O=C.isLoading;e.useEffect((function(){console.log("useEffect [dataSwr]"),I&&k(I)}),[I]),e.useEffect((function(){if(console.log("useEffect [valorQ]",!!h.current),!h.current&&void 0!==d){var e=setTimeout((function(){b(d),c(!0)}),500);return function(){return clearTimeout(e)}}}),[d]);var T=e.useRef(!1),R=e.useMemo((function(){return console.log("useMemo: items [data, idSeleccionado]",S,""),(null==S?void 0:S.data.map((function(e){var o,a,i=E(e,t),s=r.values.title(e),l=null===(a=(o=r.values).subtitle)||void 0===a?void 0:a.call(o,e);return{key:i,disabled:""===i,value:i,texto:l,item:e,label:j.jsxs("div",{children:[j.jsxs("div",{children:[j.jsx("b",{className:"mr-1",children:s}),r.value===i?j.jsx(n.CheckCircleTwoTone,{twoToneColor:"#52c41a"}):void 0]}),l?j.jsx("div",{className:"text-wrap",children:l}):null]})}})))||[]}),[r.value,S,""]),N=e.useMemo((function(){if(console.log("useMemo seleccionado [props.value, data]",r.value,S),r.value)return null==S?void 0:S.data.find((function(e){return E(e,t)===r.value}))}),[r.value,S]);e.useEffect((function(){console.log("useEffect [props.value]",r.value),r.value&&c(!0)}),[r.value]);var P=e.useMemo((function(){return!0===O?j.jsx(n.LoadingOutlined,{}):N&&!r.llenarCuandoTipea?j.jsx(n.CheckCircleTwoTone,{twoToneColor:"#52c41a"}):j.jsx("span",{})}),[O,N]);return e.useEffect((function(){var e,t,n;if(console.log("useEffect [seleccionado]",N),N){var o=E(N,r.values.field),a=null===(e=r.values.formItemTexto||r.values.subtitle)||void 0===e?void 0:e(N);r.onSetTextoExtra(a||""),h.current=!0,!0===T.current&&(null===(t=r.onSelect)||void 0===t||t.call(r,N)),v(o),c(!1)}else r.onSetTextoExtra(""),null===(n=r.onSelect)||void 0===n||n.call(r,null)}),[N]),j.jsx(o.AutoComplete,{options:R,value:d,onFocus:function(){r.value||c(!0)},onSelect:function(e){var t;console.log("onSelect",e),c(!1),null===(t=r.onChange)||void 0===t||t.call(r,e)},onSearch:function(e){var t,n;console.log("onSearch",e),r.llenarCuandoTipea?null===(t=r.onChange)||void 0===t||t.call(r,e):r.value&&(null===(n=r.onChange)||void 0===n||n.call(r,null)),h.current=!1,v(e)},disabled:r.disabled,onChange:function(e){console.log("onChange",e)},children:j.jsx(o.Input,{placeholder:r.values.placeholder,suffix:P})})};q.displayName="BuscadorSeeker";var M=function(r){var t,n,i,s,l=e.useState(""),c=l[0],u=l[1],d=(t={tipo:r.type,options:void 0},n=e.useRef(t.options),i=e.useMemo((function(){return function(e){switch(e.tipo){case"mesas":return{label:"Mesa",endpoint:"/v3/restaurantes/mesas",params:{fields:"codigo estado descripcion ordenActual lugar"},field:"codigo",placeholder:"Ingresa el código de mesas",title:function(e){return e.codigo},subtitle:function(e){return e.lugar}};case"meseros":return{label:"Mesero",endpoint:"/v3/restaurantes/meseros",params:{fields:"name codigo"},field:"name",placeholder:"Ingresa un mesero",title:function(e){return e.name},subtitle:function(e){return e.codigo}};case"cuentas-contables":return{label:"Cuenta contable",endpoint:"/v3/contability/chart-of-accounts",params:{fields:"codigo descripcion tipoDeCuenta auxiliar signo",tipoDeCuenta:"D"},field:"codigo",placeholder:"Ingrese el código de la cuenta",title:function(e){return e.codigo},subtitle:function(e){return e.descripcion},preBusquedaQ:function(e){return/^\d+\./.test(e)?"^"+e:e}};default:return{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}}}}({opciones:n,tipo:t.tipo})}),[t.tipo]),s=a(i.withOptions&&!t.options?i.endpoint+"/get-options":null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,F(i.endpoint).get(e)];case 1:return[2,r.sent().data]}}))}))}),{revalidateOnFocus:!1}).data,s&&(n.current=s),i);return d?j.jsx(o.Form.Item,{name:r.name,label:null===r.label?void 0:r.label||d.label,extra:r.hideMessage?void 0:c,rules:r.required?[P.required()]:[{}],className:r.classNameFormItem,children:j.jsx(q,{type:r.type,canCreate:r.canCreate,values:d,params:r.params,onSetTextoExtra:function(e){r.hideMessage||u(e)},onSelect:r.onSelect,llenarCuandoTipea:r.llenarCuandoTipea,disabled:r.disabled,cuerpoCrear:r.cuerpoCrear,initialValue:r.initialValue})}):null};M.displayName="Seeker";var A=e.createContext(null);function B(){return e.useContext(A)}var $=function(r){var t=e.useState([]),n=t[0],o=t[1];return j.jsxs(A.Provider,{value:{setBitacora:o},children:[j.jsx(U,{bitacora:n,setBitacora:o}),r.children]})},U=function(e){return j.jsx(o.Drawer,{title:"Bitácora",placement:"right",closable:!1,open:0!==e.bitacora.length,onClose:function(){return e.setBitacora([])},children:j.jsx(o.Timeline,{items:e.bitacora.map((function(e,r){var t=function(e){switch(e){case"created":case"creacion-masiva":return{color:"green"};case"draft":return{color:"orange",icon:j.jsx(n.SaveOutlined,{})};case"failed":return{color:"red",icon:j.jsx(n.CloseCircleOutlined,{})};case"issued":case"used":return{color:"green",icon:j.jsx(n.CheckCircleOutlined,{})};case"sent":return{color:"#1890FF",icon:j.jsx(n.CloudUploadOutlined,{})};case"pre-canceled":return{color:"#FFA500",icon:j.jsx(n.QuestionCircleOutlined,{})};case"canceled":case"reversado":return{color:"red",icon:j.jsx(n.StopOutlined,{})};case"edit":return{color:"#1890FF",icon:j.jsx(n.EditOutlined,{})};case"email":return{color:"#00CCFF",icon:j.jsx(n.MailOutlined,{})};case"deleted":return{color:"red",icon:j.jsx(n.DeleteOutlined,{})};case"intermitencia":return{color:"red",icon:j.jsx(n.HourglassOutlined,{})};case"exit-notice":return{color:"red",icon:j.jsx(n.LogoutOutlined,{})};case"exit-notice-deleted":return{color:"green",icon:j.jsx(n.LoginOutlined,{})}}}(e.type);return{color:null==t?void 0:t.color,key:"movimiento"+r,dot:null==t?void 0:t.icon,children:j.jsxs(j.Fragment,{children:[e.nota," ",j.jsx("br",{}),D.completeDate(e.date)]})}}))})})},z="#F34D24",W="#FFFFFF",V=function(r){var t=o.Form.useFormInstance(),n=e.useState([]),a=n[0],i=n[1],s=e.useMemo((function(){var e=r.rules||[];switch(r.type){case"ruc":return{label:"RUC",placeholder:"Ingresar el RUC",max:13,rules:v(v([],e,!0),[P.pattern(/^[0-9]{13}$/,"El ruc debe tener 13 caracteres numéricos")],!1)};case"ci":return{label:"Cédula",placeholder:"Ingresar la cédula",max:10,rules:v(v([],e,!0),[P.pattern(/^[0-9]{10}$/,"La cédula debe tener 10 caracteres numéricos")],!1)};default:return{label:"Nº identificación",placeholder:"Ingresar el número de identificación",rules:e}}}),[r.type]),l=c.debounce((function(e){return p(void 0,void 0,void 0,(function(){var t,n,o;return m(this,(function(s){switch(s.label){case 0:if(t=F("utils"),!r.campoNombre||e.length<6||!["ci","ruc"].includes(r.type))return 0!==a.length&&i([]),[2];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,t.get("/clientes/buscar",{params:{identificador:e,tipo:"ci"===r.type?"cedula":"ruc"}})];case 2:return n=s.sent().data,i(n.map((function(e){return{value:e.identificador,nombre:e.nombre,label:j.jsxs(j.Fragment,{children:[j.jsx("b",{children:e.identificador}),j.jsx("br",{}),e.nombre]})}}))),[3,4];case 3:return o=s.sent(),console.error(o),[3,4];case 4:return[2]}}))}))}),500);return j.jsx(o.Form.Item,f({name:r.name,rules:s.rules,normalize:function(e){return e.trim().toUpperCase()},className:r.className,dependencies:r.dependencies},r.hiddenLabel?{}:{label:r.label||s.label},{children:j.jsx(o.AutoComplete,{options:a,onSelect:function(e,n){t.setFieldValue(r.campoNombre,n.nombre)},onSearch:l,placeholder:r.placeholder||s.placeholder,maxLength:s.max,disabled:r.disabled,onChange:function(e){var t;return null===(t=r.onChange)||void 0===t?void 0:t.call(r,e)}})}))},Y=function(r){var t=e.useState(),a=t[0],i=t[1];return j.jsx(o.Tooltip,{title:"Click para confirmar",open:!!a,children:j.jsx(o.Button,{title:r.title,disabled:r.disabled,danger:!!a,icon:a?j.jsx(n.ExclamationCircleOutlined,{}):j.jsx(n.DeleteOutlined,{}),onClick:function(){if(a)r.onConfirm(),i(void 0),clearTimeout(a);else{var e=setTimeout((function(){return i(void 0)}),1500);i(e)}}})})},H=e.createContext(null);function J(){return e.useContext(H)}var Q=function(r){var t=e.useState(!1),n=t[0],i=t[1],s=a(n&&r.autocompletar?"/v4/administrative/clients/nombres-info-adicional":null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,F(e).get(e)];case 1:return[2,r.sent().data.map((function(e){return{label:e,value:e}}))]}}))}))})).data,l=void 0===s?[]:s;return j.jsx(o.Form.List,{name:r.name,children:function(e,t){return j.jsxs("div",{children:[j.jsxs("div",{className:"flex items-center justify-between mb-4",children:[j.jsx("div",{className:"text-base font-bold",children:"Información adicional"}),j.jsx(o.Button,{type:"dashed",onClick:function(){return t.add({})},children:"Agregar"})]}),j.jsxs(o.Table,{dataSource:e,rowClassName:"align-top",bordered:!0,children:[j.jsx(o.Table.Column,{title:"Nombre",render:function(e){var t=e.name;return j.jsx(o.Form.Item,{className:"m-0 p-0",name:[t,"nombre"],rules:[P.required()],children:r.autocompletar?j.jsx(o.AutoComplete,{options:l,maxLength:300,placeholder:"Ingresar el nombre",onFocus:function(){return i(!0)}}):j.jsx(o.Input,{maxLength:300,placeholder:"Ingresar el nombre"})})}},"name"),j.jsx(o.Table.Column,{title:"Descripción",render:function(e){var r=e.name;return j.jsx(o.Form.Item,{className:"m-0 p-0",name:[r,"valor"],rules:[P.required()],children:j.jsx(o.Input,{placeholder:"Ingresar la descripción"})})}},"description"),j.jsx(o.Table.Column,{align:"center",width:1,render:function(e){var r=e.name;return j.jsx(Y,{title:"¿Eliminar información adicional?",onConfirm:function(){return t.remove(r)}})}},"opciones")]})]})}})},K=function(r){var t=r.form,n=o.Form.useWatch("address",t),a=o.Form.useWatch("direcciones",t);return e.useEffect((function(){var e=setTimeout((function(){1===a.length&&t.setFieldValue("address",a[0])}),500);return function(){return clearTimeout(e)}}),[a]),j.jsx(o.Form.List,{name:"direcciones",children:function(e,r){var i,s=r.add,l=r.remove;return j.jsxs(j.Fragment,{children:[j.jsxs("div",{className:"flex items-center justify-between mb-6",children:[j.jsx(o.Typography.Title,{level:3,className:"!m-0",children:"Direcciones"}),j.jsx(o.Button,{type:"dashed",onClick:function(){return s(null)},children:"Agregar"})]}),0===(null===(i=a||[])||void 0===i?void 0:i.length)?j.jsx(o.Empty,{className:"my-8",description:"No hay direcciones"}):e.map((function(e){return j.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-y-2 gap-x-6 mb-6 last:mb-0",children:[j.jsx(o.Form.Item,{name:e.name,rules:[P.required()],className:"mb-0 w-full",children:j.jsx(o.Input,{placeholder:"Ingresar la dirección"})}),a&&j.jsx(o.Checkbox,{checked:n===a[e.name],className:"whitespace-nowrap",onChange:function(r){return n=r.target.checked,o=e.name,void(n&&t.setFieldValue("address",a[o]));var n,o},children:"Por defecto"}),j.jsx(o.Typography.Link,{className:"whitespace-nowrap",onClick:function(){a[e.name]===n&&t.setFieldValue("address",""),l(e.name)},children:"Eliminar"})]},"direcciones"+e.key)}))]})}})},X=function(){var r=e.useState(!1),t=r[0],n=r[1],i=a(t?"/v4/administrative/clients/etiquetas":null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,F(e).get(e)];case 1:return[2,r.sent().data.etiquetas]}}))}))})).data,s=void 0===i?[]:i;return j.jsx(o.Form.Item,{name:"etiquetas",label:"Etiqueta",children:j.jsx(o.AutoComplete,{options:s.map((function(e){return{label:e,value:e}})),placeholder:"Ingresar o seleccionar una etiqueta",onFocus:function(){return n(!0)}})})},G=e.forwardRef((function(r,n){var i,s,l=t.useRouter(),c=J().hasModule,u=L({endpoint:"/v3/administrative/"+r.type+"s",soloParaInsertar:!0===r.ocultarBotones,params:{$getAllFields:"true"},data:{id:"",idType:"04",subjectType:"01",direcciones:[],address:"",name:void 0}}),d=o.Form.useWatch("idType",u.form),v="client"===r.type,h="provider"===r.type,y="transporter"===r.type,g=a("08"===d?"/v3/administrative/retenciones-v2/get-options":null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(r){switch(r.label){case 0:return[4,F(e).get(e)];case 1:return[2,r.sent().data.PaisesParaisosFiscales.map((function(e){return{label:e.description,value:parseInt(e.id)}}))]}}))}))})).data,b=e.useMemo((function(){switch(d){case"04":return"ruc";case"05":return"ci";default:return"other"}}),[d]);e.useImperativeHandle(n,(function(){return{insertar:u}}));var x="grid grid-cols-1 md:grid-cols-2 gap-x-6";return e.useEffect((function(){var e=JSON.parse(JSON.stringify(l.query)),t=e.name,n=e.idType,o=e.identificador;n&&o&&t&&r.type}),[l.query]),u.isReady?j.jsxs(o.Form,f({},u.formProps,{layout:"vertical",children:[j.jsxs("div",{className:x,children:[j.jsx(o.Form.Item,{name:"idType",label:"Tipo de identificación",rules:[P.required()],children:j.jsx(o.Select,{options:null===(i=u.options.TiposDeIdentificacion)||void 0===i?void 0:i.map((function(e){return{label:e.description,value:e.id}}))})}),j.jsx(V,{name:"id",campoNombre:"name",type:b,rules:[P.required()]}),j.jsx(o.Form.Item,{name:"name",label:"Nombres / Razón social",rules:[P.required()],children:j.jsx(o.Input,{placeholder:"Ingresar la razón social"})}),j.jsx(o.Form.Item,{name:"subjectType",label:"Tipo de sujeto",rules:[P.required()],children:j.jsx(o.Select,{options:null===(s=u.options.TiposDePersona)||void 0===s?void 0:s.map((function(e){return{label:e.description,value:e.id}}))})})]}),j.jsx(o.Typography.Title,{level:3,children:"Información de contacto"}),j.jsxs("div",{className:x,children:[j.jsx(o.Form.Item,{name:"phone",label:"Télefono 1",children:j.jsx(o.Input,{type:"phone",placeholder:"Ingresar el teléfono 1"})}),v?j.jsx(o.Form.Item,{name:"cellphone",label:"Télefono 2",children:j.jsx(o.Input,{type:"phone",placeholder:"Ingresar el teléfono 2"})}):null,j.jsx(o.Form.Item,{name:"email",label:"Correo electrónico",rules:[P.email()],normalize:function(e){return e.trim()},children:j.jsx(o.Input,{placeholder:"Ingresar el correo electrónico"})}),!y&&j.jsx(o.Form.Item,{name:"optionalEmail",label:"Correos electrónicos alternativos",rules:[P.correos()],children:j.jsx(o.Select,{mode:"tags",placeholder:"Ingresar uno o varios correos alternativos",open:!1,suffixIcon:null})})]}),j.jsx(o.Form.Item,{name:"address",noStyle:!0,children:j.jsx(o.Input,{type:"hidden"})}),!y&&j.jsx(K,{form:u.form}),j.jsx(o.Typography.Title,{level:3,children:"Otra información"}),j.jsxs("div",{className:x,children:[v&&c("treasury")&&j.jsx(o.Form.Item,{name:"creditQuotaDollars",label:"Cupo de crédito en dólares",children:j.jsx(o.InputNumber,{className:"w-full",precision:2,min:0,placeholder:"Ingresar el cupo de crédito en dólares"})}),v&&c("treasury")&&j.jsx(o.Form.Item,{name:"creditQuotaDays",label:"Cupo de crédito en días",children:j.jsx(o.InputNumber,{className:"w-full",precision:0,min:0,placeholder:"Ingresar el cupo de crédito en días"})}),h&&c("contability")&&j.jsx(M,{name:"accountingAccount",type:"cuentas-contables"}),h&&c("treasury")&&j.jsx(o.Form.Item,{name:"diasPlazo",label:"Días plazo",children:j.jsx(o.InputNumber,{className:"w-full",precision:0,min:0,placeholder:"Ingresar los días plazo"})}),y?j.jsx(o.Form.Item,{name:"licensePlate",label:"Placa",rules:[P.required()],children:j.jsx(o.Select,{mode:"tags",placeholder:"Ingresar una o varias placas",open:!1,suffixIcon:null})}):null,v&&j.jsx(o.Form.Item,{name:"descuento",label:"Descuento adicional para facturas (%)",children:j.jsx(o.InputNumber,{className:"w-full",precision:2,max:100,suffix:"%",placeholder:"Ingresar el descuento"})}),v&&"08"===d&&j.jsx(o.Form.Item,{name:"paisExportacion",label:"País de exportación",children:j.jsx(o.Select,{allowClear:!0,showSearch:!0,placeholder:"Seleccionar el país de exportación",optionFilterProp:"children",filterOption:function(e,r){var t;return(null!==(t=null==r?void 0:r.label)&&void 0!==t?t:"").toLowerCase().includes(e.toLowerCase())},options:g})}),v&&j.jsx(X,{})]}),j.jsx("div",{className:"mb-5",children:j.jsx(Q,{name:"informacionAdicional",autocompletar:!0})}),r.ocultarBotones?null:u.BotonesPorDefecto]})):u.ModoCarga}));exports.$filtros=D,exports.$reglas=P,exports.BotonConfirmacion=Y,exports.BotonMovimientos=function(r){var t=B().setBitacora,a=e.useState(!1),i=a[0],s=a[1],l=e.useMemo((function(){return Array.isArray(r.movimientos)&&0!==r.movimientos.length}),[r.movimientos]),c=function(){l&&t(r.movimientos)};return e.useEffect((function(){var e;s(null===(e=r.movimientos)||void 0===e?void 0:e.some((function(e){return!!e.mostrarBadge})))}),[r.movimientos]),j.jsx(o.Badge,{dot:i,children:r.usarIcono?j.jsx(n.HistoryOutlined,{title:"Ver historial",className:l?"":"text-gray-300 cursor-not-allowed",onClick:c}):j.jsx(o.Button,{icon:j.jsx(n.HistoryOutlined,{}),title:"Ver historial",disabled:!l,onClick:c})})},exports.ContextoEmpresa=function(r){var n=t.useRouter(),o=e.useState(!1),a=o[0],i=o[1],s=e.useState(),c=s[0],u=s[1];e.useEffect((function(){p(void 0,void 0,void 0,(function(){var e,r,t,n;return m(this,(function(o){switch(o.label){case 0:e=F("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 r=o.sent(),t=r[0].data,n=r[1].data,t.configuraciones=n,[2,t];case 3:return o.sent(),[2,null];case 4:return[2]}}))})).then((function(e){e?(i(!0),u(e)):R(n,r.pathLogin)}))}),[]);return a?j.jsx(H.Provider,{value:{business:c,nombreEmpresa:c.business,nombreUsuario:c.user,testEnviroment:c.configs.useTestEnviroment,usuarioEsAdmin:"admin"===c.userType,hasModule:function(e,r){var t=null==c?void 0:c.modules.find((function(r){return r.key===e}));return!!t&&l(r).isAfter(t.operationDate)}},children:r.children}):j.jsx("div",{className:"w-full h-screen flex items-center justify-center",children:"Cargando..."})},exports.FormularioPersonas=G,exports.Header=function(a){var i,s=a.defaultInsert,l=void 0!==s&&s,c=a.loading,u=void 0!==c&&c,d=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}(a,["defaultInsert","loading"]),f=t.useRouter(),p=f.pathname,m=e.useState(""),v=m[0],h=m[1],y=new URLSearchParams(f.query),g=function(){var e=new URLSearchParams(y.toString());(e.get("q")||"")!==v&&(v?e.set("q",v):e.delete("q"),e.delete("page"),f.push({query:Object.fromEntries(e)}))},b=j.jsxs("div",{className:"flex w-full md:w-auto flex-wrap md:flex-nowrap gap-2 justify-end",children:[!0!==d.ocultarBuscador?j.jsx(o.Input.Search,{value:v,placeholder:"Ingresar búsqueda",onChange:function(e){return h(e.target.value||"")},onSearch:g,onPressEnter:g}):null,null!==l?l||j.jsx(r,{href:(i=p,i.endsWith("/")&&(i=i.slice(0,-1)),i+"/insert"),children:j.jsx(o.Button,{type:"primary",children:"Insertar"})}):null,d.onRefrescar?j.jsx("div",{children:j.jsx(o.Button,{loading:u,title:"Refrescar datos",icon:j.jsx(n.ReloadOutlined,{}),onClick:d.onRefrescar})}):null,d.children]});return e.useEffect((function(){f.isReady&&h(y.get("q")||"")}),[f.isReady]),j.jsxs("div",{className:"flex md:flex-row flex-col md:items-end items-start justify-between gap-6 mb-6",children:[j.jsxs("div",{children:[j.jsx(w,{paths:d.paths}),j.jsx(o.Typography.Title,{className:"!mb-0 mt-4",children:d.title}),d.subtitle&&j.jsx(o.Typography.Title,{level:3,type:"secondary",className:"!font-normal !m-0",children:d.subtitle})]}),null!==d.column?d.column||b:null]})},exports.IdentificadorPersona=V,exports.LayoutBase=function(t){var a=e.useState(!0),i=a[0],s=a[1],l=e.useState(!1),c=l[0],u=l[1];return j.jsxs(j.Fragment,{children:[t.sidebar?j.jsxs(o.Layout.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:i,collapsible:!0,width:"230px",onBreakpoint:function(e){s(e),u(e)},children:[j.jsx(r,{href:t.sidebar.title.href,children:j.jsx("div",{className:"flex justify-center items-center h-16 text-lg text-white font-bold",children:j.jsx("div",{children:t.sidebar.title.label})})}),t.sidebar.menu]}):null,j.jsxs(o.Layout,{className:c||i?"ml-0":"ml-[230px]",onClick:!i&&c?function(e){e.stopPropagation(),e.preventDefault(),s(!0)}:void 0,children:[t.navbar?j.jsx(o.Layout.Header,{className:"border-b top-0 !z-[2] sticky !px-4",children:j.jsxs("div",{className:"flex justify-between items-center h-full",children:[j.jsx("div",{children:j.jsx(o.Button,{type:"text",icon:i?j.jsx(n.MenuUnfoldOutlined,{}):j.jsx(n.MenuFoldOutlined,{}),onClick:function(){return s(!i)},children:t.navbar.title})}),t.navbar.options?j.jsx("div",{children:t.navbar.options}):j.jsx("div",{})]})}):null,j.jsx(o.Layout.Content,{className:"m-4 md:m-8 xl:mx-16 xl:my-8",children:t.children}),t.footer?j.jsx(o.Layout.Footer,{className:"!text-gray-500",children:t.footer}):null]})]})},exports.Seeker=M,exports.TemaPrincipal=function(r){var t=e.useState(!1),n=t[0],a=t[1];return e.useEffect((function(){a(!0)}),[]),n?j.jsx($,{children:j.jsx(o.ConfigProvider,{locale:d,theme:{token:{colorPrimary:z,colorLink:z,colorTextDisabled:"#00000080"},components:{Layout:{bodyBg:W,headerBg:W},Tag:{marginXS:0}}},children:j.jsx(o.App,{children:j.jsx(o.Layout,{className:(r.className||"")+" min-h-screen w-full",style:r.style,children:r.children})})})}):null},exports.configurarUtils=function(e){S=f(f({},S),e)},exports.crearToken=function(e,r){s.setCookie(I(r.usuario),e,{domain:S.cookieDominio,maxAge:604800,path:S.cookiePath})},exports.destruirToken=function(e){s.deleteCookie(I(e),{domain:S.cookieDominio,path:S.cookiePath})},exports.getApiEndpoint=O,exports.getAxios=F,exports.getNestedPath=E,exports.hashear=T,exports.nDecimals=function(e,r){void 0===r&&(r=2);var t=Math.pow(10,r);return Math.round(+(e*t).toFixed(2))/t},exports.redireccionarLogin=R,exports.useContextoEmpresa=J,exports.useFrontendUtils=B,exports.useUtils=C,exports.useVistaInsertar=L,exports.useVistaPrincipal=function(e){var r=F(e.endpoint,{tipo:e.tipoUsuario||"usuario"}),n=t.useRouter(),o=C().showError,i=u.useSWRConfig().mutate,s=a(e.sinOptions?null:(e.optionsPath||e.endpoint)+"/get-options",(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(t){switch(t.label){case 0:return[4,r.get(e)];case 1:return[2,t.sent().data]}}))}))})).data,l=void 0===s?{}:s,c=new URLSearchParams(f(f({},e.params),n.query)).toString(),d=e.endpoint+(c?"?"+c:""),v=u(n.isReady?d:null,(function(e){return p(void 0,void 0,void 0,(function(){return m(this,(function(t){switch(t.label){case 0:return[4,r.get(e)];case 1:return[2,t.sent().data]}}))}))})),h=v.data,y=v.error,g=v.isLoading,b=(null==h?void 0:h.data)||[],x=(null==h?void 0:h.total)||0,j=new URLSearchParams(n.query),w=j.get("page"),S=w?parseInt(w):1,k=j.get("limit"),I=k?parseInt(k):20,E={loading:g,dataSource:b,rowKey:"_id",bordered:!0,pagination:{current:S,defaultPageSize:I,total:x},onChange:function(e,r,t){return p(void 0,void 0,void 0,(function(){var r,o,a,i;return m(this,(function(s){return r=j.toString(),o=new URLSearchParams(r),e.current!==S&&("1"===(a=e.current.toString())?o.delete("page"):o.set("page",a)),e.pageSize!==I&&("20"===(i=e.pageSize.toString())?o.delete("limit"):o.set("limit",i)),Array.isArray(t)||("ascend"===t.order?o.set("sort",t.field):"descend"===t.order?o.set("sort","-"+t.field):o.delete("sort")),r!==o.toString()&&n.push({query:Object.fromEntries(o)}),[2]}))}))}},T=function(){i(d)};return{data:b,isLoading:g,error:y,options:l,endpoint:e.endpoint,endpointWithHost:O(e.endpoint),mainroute:n.route,tableProps:E,axios:r,init:T,getOpt:function(e,r){var t,n=null===(t=l[e])||void 0===t?void 0:t.find((function(e){return e.id===r}));return n?n.description:""},remove:function(t){return p(void 0,void 0,void 0,(function(){var n;return m(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,r.delete("string"==typeof t?e.endpoint+"/"+t:t.endpoint)];case 1:return a.sent(),T(),[3,3];case 2:return n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))},cancel:function(t){return p(void 0,void 0,void 0,(function(){var n;return m(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,r.delete("string"==typeof t?e.endpoint+"/"+t+"/cancel":t.endpoint)];case 1:return a.sent(),T(),[3,3];case 2:return n=a.sent(),o(n),[3,3];case 3:return[2]}}))}))}}};
11
11
  //# sourceMappingURL=index.js.map