{"version":3,"file":"app.min.js","sources":["app.js"],"sourcesContent":["if (typeof jQuery === \"undefined\") {\r\n throw new Error(\"jQuery plugins need to be before this file\");\r\n}\r\n\r\n/**\r\n * permite dar formato a un string\r\n * @example 'este es un {0}, con valor {1}'.formatter('ejemplo', '5')\r\n */\r\nString.prototype.formatter = function () {\r\n var s = this,\r\n i = arguments.length;\r\n\r\n while (i--) {\r\n s = s.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\"), arguments[i]);\r\n }\r\n return s;\r\n};\r\n\r\nvar app = {\r\n //Tomada de underscore.js\r\n // Returns a function, that, as long as it continues to be invoked, will not\r\n // be triggered. The function will be called after it stops being called for\r\n // N milliseconds. If `immediate` is passed, trigger the function on the\r\n // leading edge, instead of the trailing.\r\n debounce: function (func, wait, immediate) {\r\n var timeout;\r\n return function () {\r\n var context = this,\r\n args = arguments;\r\n var later = function () {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n var callNow = immediate && !timeout;\r\n clearTimeout(timeout);\r\n timeout = setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n },\r\n randomKey: function () {\r\n let array = new Uint32Array(1);\r\n window.crypto.getRandomValues(array);\r\n return array[0];\r\n },\r\n alertas: {\r\n warning: function (contenido, element) {\r\n let _mensaje =\r\n \"
\" +\r\n \"

¡Alerta!

\" +\r\n contenido +\r\n \"
\";\r\n\r\n $(element).html(_mensaje);\r\n },\r\n success: function (contenido, element) {\r\n let _mensaje =\r\n \"
\" +\r\n \"

¡Mensaje!

\" +\r\n contenido +\r\n \"
\";\r\n\r\n $(element).html(_mensaje);\r\n },\r\n error: function (contenido, element) {\r\n let _mensaje =\r\n \"
\" +\r\n \"

¡Error!

\" +\r\n contenido +\r\n \"
\";\r\n\r\n $(element).html(_mensaje);\r\n },\r\n info: function (contenido, element) {\r\n let _mensaje =\r\n \"
\" +\r\n \"

Información:

\" +\r\n contenido +\r\n \"
\";\r\n\r\n $(element).html(_mensaje);\r\n },\r\n loadder: function (id) {\r\n if (typeof id === \"undefined\") {\r\n id = app.randomKey();\r\n }\r\n return (\r\n '
'.formatter(id) +\r\n '
' +\r\n '
' +\r\n '
' +\r\n \"
\"\r\n );\r\n },\r\n },\r\n validator: {\r\n /**\r\n * Remueve las validaciones actuales del formularios y las re-aplica, se usa comúnmente para validar campos traídos por AJAX\r\n * @param {string} formName nombre formulario\r\n */\r\n aplicar: function (formName) {\r\n if (typeof $.validator === \"undefined\") {\r\n return;\r\n }\r\n if (typeof formName === \"undefined\") {\r\n return;\r\n }\r\n let newForm = document.getElementById(formName);\r\n $(\"#\" + formName).removeData(\"validator\");\r\n $(\"#\" + formName).removeData(\"unobtrusiveValidation\");\r\n $.validator.unobtrusive.parse(newForm);\r\n },\r\n },\r\n formato: {\r\n /**\r\n * Pasa a formato de moneda colombia\r\n * @param {string|number} moneda\r\n * @returns\r\n */\r\n cop: function (moneda) {\r\n return Intl.NumberFormat(\"es-CO\", { style: \"currency\", currency: \"COP\" }).format(\r\n moneda\r\n );\r\n },\r\n },\r\n /**\r\n *Diferentes mascaras por input mask\r\n */\r\n mascara: {\r\n /**\r\n *\r\n * @@param {string?} identificador puede ser vació\r\n */\r\n dinero: function (identificador) { },\r\n /**\r\n *\r\n * @@param {string} valor valor con mascara de dinero\r\n */\r\n unmaskDinero: function(identificador) { },\r\n /**\r\n *\r\n * @@param {string?} identificador puede ser vació\r\n */\r\n porcentaje: function (identificador) { },\r\n /**\r\n *\r\n * @@param {string?} identificador puede ser vació\r\n */\r\n dineroNoDecimals: function (identificador) { },\r\n },\r\n};\r\n"],"names":["jQuery","Error","String","prototype","formatter","s","this","i","arguments","length","replace","RegExp","app","debounce","func","wait","immediate","timeout","context","args","callNow","clearTimeout","setTimeout","apply","randomKey","let","array","Uint32Array","window","crypto","getRandomValues","alertas","warning","contenido","element","_mensaje","$","html","success","error","info","loadder","id","validator","aplicar","formName","newForm","document","getElementById","removeData","unobtrusive","parse","formato","cop","moneda","Intl","NumberFormat","style","currency","format","mascara","dinero","identificador","unmaskDinero","porcentaje","dineroNoDecimals"],"mappings":"AAAA,GAAsB,oBAAXA,OACP,MAAM,IAAIC,MAAM,8CAOpBC,OAAOC,UAAUC,UAAY,WAIzB,IAHA,IAAIC,EAAIC,KACJC,EAAIC,UAAUC,OAEXF,KACHF,EAAIA,EAAEK,QAAQ,IAAIC,OAAO,MAAQJ,EAAI,MAAO,MAAOC,UAAUD,IAEjE,OAAOF,GAGX,IAAIO,IAAM,CAMNC,SAAU,SAAUC,EAAMC,EAAMC,GAC5B,IAAIC,EACJ,OAAO,WACH,IAAIC,EAAUZ,KACVa,EAAOX,UAKPY,EAAUJ,IAAcC,EAC5BI,aAAaJ,GACbA,EAAUK,WANE,WACRL,EAAU,KACLD,GAAWF,EAAKS,MAAML,EAASC,IAIZJ,GACxBK,GAASN,EAAKS,MAAML,EAASC,KAGzCK,UAAW,WACPC,IAAIC,EAAQ,IAAIC,YAAY,GAE5B,OADAC,OAAOC,OAAOC,gBAAgBJ,GACvBA,EAAM,IAEjBK,QAAS,CACLC,QAAS,SAAUC,EAAWC,GACtBC,EACA,6MAEAF,EACA,SAEJG,EAAEF,GAASG,KAAKF,IAEpBG,QAAS,SAAUL,EAAWC,GACtBC,EACA,+LAEAF,EACA,SAEJG,EAAEF,GAASG,KAAKF,IAEpBI,MAAO,SAAUN,EAAWC,GACpBC,EACA,0LAEAF,EACA,SAEJG,EAAEF,GAASG,KAAKF,IAEpBK,KAAM,SAAUP,EAAWC,GACnBC,EACA,6LAEAF,EACA,SAEJG,EAAEF,GAASG,KAAKF,IAEpBM,QAAS,SAAUC,GAIf,YAHkB,IAAPA,IACPA,EAAK9B,IAAIY,aAGT,iCAAiCpB,UAAUsC,GAC3C,6FAOZC,UAAW,CAKPC,QAAS,SAAUC,GACf,IAMIC,OANuB,IAAhBV,EAAEO,gBAGW,IAAbE,IAGPC,EAAUC,SAASC,eAAeH,GACtCT,EAAE,IAAMS,GAAUI,WAAW,aAC7Bb,EAAE,IAAMS,GAAUI,WAAW,yBAC7Bb,EAAEO,UAAUO,YAAYC,MAAML,MAGtCM,QAAS,CAMLC,IAAK,SAAUC,GACX,OAAOC,KAAKC,aAAa,QAAS,CAAEC,MAAO,WAAYC,SAAU,QAASC,OACtEL,KAOZM,QAAS,CAKLC,OAAQ,SAAUC,KAKlBC,aAAc,SAASD,KAKvBE,WAAY,SAAUF,KAKtBG,iBAAkB,SAAUH"}