10 lines
128 KiB
JavaScript
10 lines
128 KiB
JavaScript
!function e(t,r,n){function a(o,l){if(!r[o]){if(!t[o]){var s="function"==typeof require&&require;if(!l&&s)return s(o,!0);if(i)return i(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return a(t[o][1][e]||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<n.length;o++)a(n[o]);return a}({1:[function(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=u(e),o=n[0],l=n[1],s=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,l)),c=0,f=l>0?o-4:o;for(r=0;r<f;r+=4)t=a[e.charCodeAt(r)]<<18|a[e.charCodeAt(r+1)]<<12|a[e.charCodeAt(r+2)]<<6|a[e.charCodeAt(r+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=255&t;2===l&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,s[c++]=255&t);1===l&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,s[c++]=t>>8&255,s[c++]=255&t);return s},r.fromByteArray=function(e){for(var t,r=e.length,a=r%3,i=[],o=0,l=r-a;o<l;o+=16383)i.push(c(e,o,o+16383>l?l:o+16383));1===a?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,s=o.length;l<s;++l)n[l]=o[l],a[o.charCodeAt(l)]=l;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var a,i,o=[],l=t;l<r;l+=3)a=(e[l]<<16&16711680)+(e[l+1]<<8&65280)+(255&e[l+2]),o.push(n[(i=a)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){(function(t){
|
|
/*!
|
|
* The buffer module from node.js, for the browser.
|
|
*
|
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
* @license MIT
|
|
*/
|
|
"use strict";var n=e("base64-js"),a=e("ieee754");r.Buffer=t,r.SlowBuffer=function(e){+e!=e&&(e=0);return t.alloc(+e)},r.INSPECT_MAX_BYTES=50;function i(e){if(e>2147483647)throw new RangeError('The value "'+e+'" is invalid for option "size"');var r=new Uint8Array(e);return r.__proto__=t.prototype,r}function t(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return o(e,t,r)}function o(e,r,n){if("string"==typeof e)return function(e,r){"string"==typeof r&&""!==r||(r="utf8");if(!t.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var n=0|f(e,r),a=i(n),o=a.write(e,r);o!==n&&(a=a.slice(0,o));return a}(e,r);if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(O(e,ArrayBuffer)||e&&O(e.buffer,ArrayBuffer))return function(e,r,n){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');var a;a=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);return a.__proto__=t.prototype,a}(e,r,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return t.from(a,r,n);var o=function(e){if(t.isBuffer(e)){var r=0|c(e.length),n=i(r);return 0===n.length||e.copy(n,0,0,r),n}if(void 0!==e.length)return"number"!=typeof e.length||L(e.length)?i(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return t.from(e[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return l(e),i(e<0?0:0|c(e))}function u(e){for(var t=e.length<0?0:0|c(e.length),r=i(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function c(e){if(e>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|e}function f(e,r){if(t.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||O(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===n)return 0;for(var i=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return R(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return I(e).length;default:if(i)return a?-1:R(e).length;r=(""+r).toLowerCase(),i=!0}}function d(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function p(e,r,n,a,i){if(0===e.length)return-1;if("string"==typeof n?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),L(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=t.from(r,a)),t.isBuffer(r))return 0===r.length?-1:g(e,r,n,a,i);if("number"==typeof r)return r&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):g(e,[r],n,a,i);throw new TypeError("val must be string, number or Buffer")}function g(e,t,r,n,a){var i,o=1,l=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,l/=2,s/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var c=-1;for(i=r;i<l;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===s)return c*o}else-1!==c&&(i-=i-c),c=-1}else for(r+s>l&&(r=l-s),i=r;i>=0;i--){for(var f=!0,d=0;d<s;d++)if(u(e,i+d)!==u(t,d)){f=!1;break}if(f)return i}return-1}function m(e,t,r,n){r=Number(r)||0;var a=e.length-r;n?(n=Number(n))>a&&(n=a):n=a;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o<n;++o){var l=parseInt(t.substr(2*o,2),16);if(L(l))return o;e[r+o]=l}return o}function v(e,t,r,n){return x(R(t,e.length-r),e,r,n)}function y(e,t,r,n){return x(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function b(e,t,r,n){return y(e,t,r,n)}function w(e,t,r,n){return x(I(t),e,r,n)}function _(e,t,r,n){return x(function(e,t){for(var r,n,a,i=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,a=r%256,i.push(a),i.push(n);return i}(t,e.length-r),e,r,n)}function k(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);for(var n=[],a=t;a<r;){var i,o,l,s,u=e[a],c=null,f=u>239?4:u>223?3:u>191?2:1;if(a+f<=r)switch(f){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[a+1]))&&(s=(31&u)<<6|63&i)>127&&(c=s);break;case 3:i=e[a+1],o=e[a+2],128==(192&i)&&128==(192&o)&&(s=(15&u)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[a+1],o=e[a+2],l=e[a+3],128==(192&i)&&128==(192&o)&&128==(192&l)&&(s=(15&u)<<18|(63&i)<<12|(63&o)<<6|63&l)>65535&&s<1114112&&(c=s)}null===c?(c=65533,f=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),a+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}r.kMaxLength=2147483647,t.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),t.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&t[Symbol.species]===t&&Object.defineProperty(t,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),t.poolSize=8192,t.from=function(e,t,r){return o(e,t,r)},t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array,t.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},t.allocUnsafe=function(e){return s(e)},t.allocUnsafeSlow=function(e){return s(e)},t.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==t.prototype},t.compare=function(e,r){if(O(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),O(r,Uint8Array)&&(r=t.from(r,r.offset,r.byteLength)),!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,a=r.length,i=0,o=Math.min(n,a);i<o;++i)if(e[i]!==r[i]){n=e[i],a=r[i];break}return n<a?-1:a<n?1:0},t.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return t.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var a=t.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){var o=e[n];if(O(o,Uint8Array)&&(o=t.from(o)),!t.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(a,i),i+=o.length}return a},t.byteLength=f,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},t.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},t.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},t.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):d.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===t.compare(this,e)},t.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},t.prototype.compare=function(e,r,n,a,i){if(O(e,Uint8Array)&&(e=t.from(e,e.offset,e.byteLength)),!t.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===a&&(a=0),void 0===i&&(i=this.length),r<0||n>e.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&r>=n)return 0;if(a>=i)return-1;if(r>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(a>>>=0),l=(n>>>=0)-(r>>>=0),s=Math.min(o,l),u=this.slice(a,i),c=e.slice(r,n),f=0;f<s;++f)if(u[f]!==c[f]){o=u[f],l=c[f];break}return o<l?-1:l<o?1:0},t.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},t.prototype.indexOf=function(e,t,r){return p(this,e,t,r,!0)},t.prototype.lastIndexOf=function(e,t,r){return p(this,e,t,r,!1)},t.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return y(this,e,t,r);case"latin1":case"binary":return b(this,e,t,r);case"base64":return w(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(e,t,r){var n="";r=Math.min(e.length,r);for(var a=t;a<r;++a)n+=String.fromCharCode(127&e[a]);return n}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var a=t;a<r;++a)n+=String.fromCharCode(e[a]);return n}function B(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var a="",i=t;i<r;++i)a+=N(e[i]);return a}function C(e,t,r){for(var n=e.slice(t,r),a="",i=0;i<n.length;i+=2)a+=String.fromCharCode(n[i]+256*n[i+1]);return a}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function P(e,r,n,a,i,o){if(!t.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(n+a>e.length)throw new RangeError("Index out of range")}function M(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,4),a.write(e,t,r,n,23,4),r+4}function $(e,t,r,n,i){return t=+t,r>>>=0,i||M(e,0,r,8),a.write(e,t,r,n,52,8),r+8}t.prototype.slice=function(e,r){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<e&&(r=e);var a=this.subarray(e,r);return a.__proto__=t.prototype,a},t.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],a=1,i=0;++i<t&&(a*=256);)n+=this[e+i]*a;return n},t.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e+--t],a=1;t>0&&(a*=256);)n+=this[e+--t]*a;return n},t.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},t.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},t.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},t.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},t.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},t.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],a=1,i=0;++i<t&&(a*=256);)n+=this[e+i]*a;return n>=(a*=128)&&(n-=Math.pow(2,8*t)),n},t.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},t.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},t.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},t.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},t.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),a.read(this,e,!0,23,4)},t.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),a.read(this,e,!1,23,4)},t.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),a.read(this,e,!0,52,8)},t.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),a.read(this,e,!1,52,8)},t.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[t]=255&e;++i<r&&(a*=256);)this[t+i]=e/a&255;return t+r},t.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||P(this,e,t,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[t+a]=255&e;--a>=0&&(i*=256);)this[t+a]=e/i&255;return t+r},t.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,255,0),this[t]=255&e,t+1},t.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},t.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=0,o=1,l=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===l&&0!==this[t+i-1]&&(l=1),this[t+i]=(e/o>>0)-l&255;return t+r},t.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);P(this,e,t,r,a-1,-a)}var i=r-1,o=1,l=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===l&&0!==this[t+i+1]&&(l=1),this[t+i]=(e/o>>0)-l&255;return t+r},t.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},t.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},t.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},t.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},t.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},t.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},t.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},t.prototype.writeDoubleLE=function(e,t,r){return $(this,e,t,!0,r)},t.prototype.writeDoubleBE=function(e,t,r){return $(this,e,t,!1,r)},t.prototype.copy=function(e,r,n,a){if(!t.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),a||0===a||(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<n&&(a=n),a===n)return 0;if(0===e.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-n&&(a=e.length-r+n);var i=a-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(r,n,a);else if(this===e&&n<r&&r<a)for(var o=i-1;o>=0;--o)e[o+r]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,a),r);return i},t.prototype.fill=function(e,r,n,a){if("string"==typeof e){if("string"==typeof r?(a=r,r=0,n=this.length):"string"==typeof n&&(a=n,n=this.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!t.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(1===e.length){var i=e.charCodeAt(0);("utf8"===a&&i<128||"latin1"===a)&&(e=i)}}else"number"==typeof e&&(e&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;var o;if(r>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=r;o<n;++o)this[o]=e;else{var l=t.isBuffer(e)?e:t.from(e,a),s=l.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=l[o%s]}return this};var D=/[^+/0-9A-Za-z-_]/g;function N(e){return e<16?"0"+e.toString(16):e.toString(16)}function R(e,t){var r;t=t||1/0;for(var n=e.length,a=null,i=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function I(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function x(e,t,r,n){for(var a=0;a<n&&!(a+r>=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function O(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function L(e){return e!=e}}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:2,ieee754:4}],3:[function(e,t,r){"use strict";var n={single_source_shortest_paths:function(e,t,r){var a={},i={};i[t]=0;var o,l,s,u,c,f,d,h=n.PriorityQueue.make();for(h.push(t,0);!h.empty();)for(s in l=(o=h.pop()).value,u=o.cost,c=e[l]||{})c.hasOwnProperty(s)&&(f=u+c[s],d=i[s],(void 0===i[s]||d>f)&&(i[s]=f,h.push(s,f),a[s]=l));if(void 0!==r&&void 0===i[r]){var p=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(p)}return a},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var a=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(a,r)},PriorityQueue:{make:function(e){var t,r=n.PriorityQueue,a={};for(t in e=e||{},r)r.hasOwnProperty(t)&&(a[t]=r[t]);return a.queue=[],a.sorter=e.sorter||r.default_sorter,a},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==t&&(t.exports=n)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,a){var i,o,l=8*a-n-1,s=(1<<l)-1,u=s>>1,c=-7,f=r?a-1:0,d=r?-1:1,h=e[t+f];for(f+=d,i=h&(1<<-c)-1,h>>=-c,c+=l;c>0;i=256*i+e[t+f],f+=d,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+e[t+f],f+=d,c-=8);if(0===i)i=1-u;else{if(i===s)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=u}return(h?-1:1)*o*Math.pow(2,i-n)},r.write=function(e,t,r,n,a,i){var o,l,s,u=8*i-a-1,c=(1<<u)-1,f=c>>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),(t+=o+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(o++,s/=2),o+f>=c?(l=0,o=c):o+f>=1?(l=(t*s-1)*Math.pow(2,a),o+=f):(l=t*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&l,h+=p,l/=256,a-=8);for(o=o<<a|l,u+=a;u>0;e[r+h]=255&o,h+=p,o/=256,u-=8);e[r+h-p]|=128*g}},{}],5:[function(e,t,r){var n=e("./can-promise"),a=e("./core/qrcode"),i=e("./renderer/canvas"),o=e("./renderer/svg-tag.js");function l(e,t,r,i,o){var l=[].slice.call(arguments,1),s=l.length,u="function"==typeof l[s-1];if(!u&&!n())throw new Error("Callback required as last argument");if(!u){if(s<1)throw new Error("Too few arguments provided");return 1===s?(r=t,t=i=void 0):2!==s||t.getContext||(i=r,r=t,t=void 0),new Promise((function(n,o){try{var l=a.create(r,i);n(e(l,t,i))}catch(e){o(e)}}))}if(s<2)throw new Error("Too few arguments provided");2===s?(o=r,r=t,t=i=void 0):3===s&&(t.getContext&&void 0===o?(o=i,i=void 0):(o=i,i=r,r=t,t=void 0));try{var c=a.create(r,i);o(null,e(c,t,i))}catch(e){o(e)}}r.create=a.create,r.toCanvas=l.bind(null,i.render),r.toDataURL=l.bind(null,i.renderToDataURL),r.toString=l.bind(null,(function(e,t,r){return o.render(e,r)}))},{"./can-promise":6,"./core/qrcode":22,"./renderer/canvas":29,"./renderer/svg-tag.js":30}],6:[function(e,t,r){t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},{}],7:[function(e,t,r){var n=e("./utils").getSymbolSize;r.getRowColCoords=function(e){if(1===e)return[];for(var t=Math.floor(e/7)+2,r=n(e),a=145===r?26:2*Math.ceil((r-13)/(2*t-2)),i=[r-7],o=1;o<t-1;o++)i[o]=i[o-1]-a;return i.push(6),i.reverse()},r.getPositions=function(e){for(var t=[],n=r.getRowColCoords(e),a=n.length,i=0;i<a;i++)for(var o=0;o<a;o++)0===i&&0===o||0===i&&o===a-1||i===a-1&&0===o||t.push([n[i],n[o]]);return t}},{"./utils":26}],8:[function(e,t,r){var n=e("./mode"),a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){var t;for(t=0;t+2<=this.data.length;t+=2){var r=45*a.indexOf(this.data[t]);r+=a.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(a.indexOf(this.data[t]),6)},t.exports=i},{"./mode":19}],9:[function(e,t,r){function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n},{}],10:[function(e,t,r){var n=e("../utils/buffer");function a(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new n(e*e),this.data.fill(0),this.reservedBit=new n(e*e),this.reservedBit.fill(0)}a.prototype.set=function(e,t,r,n){var a=e*this.size+t;this.data[a]=r,n&&(this.reservedBit[a]=!0)},a.prototype.get=function(e,t){return this.data[e*this.size+t]},a.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},a.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=a},{"../utils/buffer":32}],11:[function(e,t,r){var n=e("../utils/buffer"),a=e("./mode");function i(e){this.mode=a.BYTE,this.data=new n(e)}i.getBitsLength=function(e){return 8*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){for(var t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)},t.exports=i},{"../utils/buffer":32,"./mode":19}],12:[function(e,t,r){var n=e("./error-correction-level"),a=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],i=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];r.getBlocksCount=function(e,t){switch(t){case n.L:return a[4*(e-1)+0];case n.M:return a[4*(e-1)+1];case n.Q:return a[4*(e-1)+2];case n.H:return a[4*(e-1)+3];default:return}},r.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return i[4*(e-1)+0];case n.M:return i[4*(e-1)+1];case n.Q:return i[4*(e-1)+2];case n.H:return i[4*(e-1)+3];default:return}}},{"./error-correction-level":13}],13:[function(e,t,r){r.L={bit:1},r.M={bit:0},r.Q={bit:3},r.H={bit:2},r.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},r.from=function(e,t){if(r.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return r.L;case"m":case"medium":return r.M;case"q":case"quartile":return r.Q;case"h":case"high":return r.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return t}}},{}],14:[function(e,t,r){var n=e("./utils").getSymbolSize;r.getPositions=function(e){var t=n(e);return[[0,0],[t-7,0],[0,t-7]]}},{"./utils":26}],15:[function(e,t,r){var n=e("./utils"),a=n.getBCHDigit(1335);r.getEncodedBits=function(e,t){for(var r=e.bit<<3|t,i=r<<10;n.getBCHDigit(i)-a>=0;)i^=1335<<n.getBCHDigit(i)-a;return 21522^(r<<10|i)}},{"./utils":26}],16:[function(e,t,r){var n=e("../utils/buffer");if(n.alloc)var a=n.alloc(512),i=n.alloc(256);else a=new n(512),i=new n(256);!function(){for(var e=1,t=0;t<255;t++)a[t]=e,i[e]=t,256&(e<<=1)&&(e^=285);for(t=255;t<512;t++)a[t]=a[t-255]}(),r.log=function(e){if(e<1)throw new Error("log("+e+")");return i[e]},r.exp=function(e){return a[e]},r.mul=function(e,t){return 0===e||0===t?0:a[i[e]+i[t]]}},{"../utils/buffer":32}],17:[function(e,t,r){var n=e("./mode"),a=e("./utils");function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){var t;for(t=0;t<this.data.length;t++){var r=a.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}},t.exports=i},{"./mode":19,"./utils":26}],18:[function(e,t,r){r.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var n=3,a=3,i=40,o=10;function l(e,t,n){switch(e){case r.Patterns.PATTERN000:return(t+n)%2==0;case r.Patterns.PATTERN001:return t%2==0;case r.Patterns.PATTERN010:return n%3==0;case r.Patterns.PATTERN011:return(t+n)%3==0;case r.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case r.Patterns.PATTERN101:return t*n%2+t*n%3==0;case r.Patterns.PATTERN110:return(t*n%2+t*n%3)%2==0;case r.Patterns.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}r.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},r.from=function(e){return r.isValid(e)?parseInt(e,10):void 0},r.getPenaltyN1=function(e){for(var t=e.size,r=0,a=0,i=0,o=null,l=null,s=0;s<t;s++){a=i=0,o=l=null;for(var u=0;u<t;u++){var c=e.get(s,u);c===o?a++:(a>=5&&(r+=n+(a-5)),o=c,a=1),(c=e.get(u,s))===l?i++:(i>=5&&(r+=n+(i-5)),l=c,i=1)}a>=5&&(r+=n+(a-5)),i>=5&&(r+=n+(i-5))}return r},r.getPenaltyN2=function(e){for(var t=e.size,r=0,n=0;n<t-1;n++)for(var i=0;i<t-1;i++){var o=e.get(n,i)+e.get(n,i+1)+e.get(n+1,i)+e.get(n+1,i+1);4!==o&&0!==o||r++}return r*a},r.getPenaltyN3=function(e){for(var t=e.size,r=0,n=0,a=0,o=0;o<t;o++){n=a=0;for(var l=0;l<t;l++)n=n<<1&2047|e.get(o,l),l>=10&&(1488===n||93===n)&&r++,a=a<<1&2047|e.get(l,o),l>=10&&(1488===a||93===a)&&r++}return r*i},r.getPenaltyN4=function(e){for(var t=0,r=e.data.length,n=0;n<r;n++)t+=e.data[n];return Math.abs(Math.ceil(100*t/r/5)-10)*o},r.applyMask=function(e,t){for(var r=t.size,n=0;n<r;n++)for(var a=0;a<r;a++)t.isReserved(a,n)||t.xor(a,n,l(e,a,n))},r.getBestMask=function(e,t){for(var n=Object.keys(r.Patterns).length,a=0,i=1/0,o=0;o<n;o++){t(o),r.applyMask(o,e);var l=r.getPenaltyN1(e)+r.getPenaltyN2(e)+r.getPenaltyN3(e)+r.getPenaltyN4(e);r.applyMask(o,e),l<i&&(i=l,a=o)}return a}},{}],19:[function(e,t,r){var n=e("./version-check"),a=e("./regex");r.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},r.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},r.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},r.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},r.MIXED={bit:-1},r.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},r.getBestModeForData=function(e){return a.testNumeric(e)?r.NUMERIC:a.testAlphanumeric(e)?r.ALPHANUMERIC:a.testKanji(e)?r.KANJI:r.BYTE},r.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},r.isValid=function(e){return e&&e.bit&&e.ccBits},r.from=function(e,t){if(r.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return r.NUMERIC;case"alphanumeric":return r.ALPHANUMERIC;case"kanji":return r.KANJI;case"byte":return r.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return t}}},{"./regex":24,"./version-check":27}],20:[function(e,t,r){var n=e("./mode");function a(e){this.mode=n.NUMERIC,this.data=e.toString()}a.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){var t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);var a=this.data.length-t;a>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*a+1))},t.exports=a},{"./mode":19}],21:[function(e,t,r){var n=e("../utils/buffer"),a=e("./galois-field");r.mul=function(e,t){var r=new n(e.length+t.length-1);r.fill(0);for(var i=0;i<e.length;i++)for(var o=0;o<t.length;o++)r[i+o]^=a.mul(e[i],t[o]);return r},r.mod=function(e,t){for(var r=new n(e);r.length-t.length>=0;){for(var i=r[0],o=0;o<t.length;o++)r[o]^=a.mul(t[o],i);for(var l=0;l<r.length&&0===r[l];)l++;r=r.slice(l)}return r},r.generateECPolynomial=function(e){for(var t=new n([1]),i=0;i<e;i++)t=r.mul(t,[1,a.exp(i)]);return t}},{"../utils/buffer":32,"./galois-field":16}],22:[function(e,t,r){var n=e("../utils/buffer"),a=e("./utils"),i=e("./error-correction-level"),o=e("./bit-buffer"),l=e("./bit-matrix"),s=e("./alignment-pattern"),u=e("./finder-pattern"),c=e("./mask-pattern"),f=e("./error-correction-code"),d=e("./reed-solomon-encoder"),h=e("./version"),p=e("./format-info"),g=e("./mode"),m=e("./segments"),v=e("isarray");function y(e,t,r){var n,a,i=e.size,o=p.getEncodedBits(t,r);for(n=0;n<15;n++)a=1==(o>>n&1),n<6?e.set(n,8,a,!0):n<8?e.set(n+1,8,a,!0):e.set(i-15+n,8,a,!0),n<8?e.set(8,i-n-1,a,!0):n<9?e.set(8,15-n-1+1,a,!0):e.set(8,15-n-1,a,!0);e.set(i-8,8,1,!0)}function b(e,t,r){var i=new o;r.forEach((function(t){i.put(t.mode.bit,4),i.put(t.getLength(),g.getCharCountIndicator(t.mode,e)),t.write(i)}));var l=8*(a.getSymbolTotalCodewords(e)-f.getTotalCodewordsCount(e,t));for(i.getLengthInBits()+4<=l&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(0);for(var s=(l-i.getLengthInBits())/8,u=0;u<s;u++)i.put(u%2?17:236,8);return function(e,t,r){for(var i=a.getSymbolTotalCodewords(t),o=f.getTotalCodewordsCount(t,r),l=i-o,s=f.getBlocksCount(t,r),u=s-i%s,c=Math.floor(i/s),h=Math.floor(l/s),p=h+1,g=c-h,m=new d(g),v=0,y=new Array(s),b=new Array(s),w=0,_=new n(e.buffer),k=0;k<s;k++){var E=k<u?h:p;y[k]=_.slice(v,v+E),b[k]=m.encode(y[k]),v+=E,w=Math.max(w,E)}var S,T,B=new n(i),C=0;for(S=0;S<w;S++)for(T=0;T<s;T++)S<y[T].length&&(B[C++]=y[T][S]);for(S=0;S<g;S++)for(T=0;T<s;T++)B[C++]=b[T][S];return B}(i,e,t)}function w(e,t,r,n){var i;if(v(e))i=m.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");var o=t;if(!o){var f=m.rawSplit(e);o=h.getBestVersionForData(f,r)}i=m.fromString(e,o||40)}var d=h.getBestVersionForData(i,r);if(!d)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t<d)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+d+".\n")}else t=d;var p=b(t,r,i),g=a.getSymbolSize(t),w=new l(g);return function(e,t){for(var r=e.size,n=u.getPositions(t),a=0;a<n.length;a++)for(var i=n[a][0],o=n[a][1],l=-1;l<=7;l++)if(!(i+l<=-1||r<=i+l))for(var s=-1;s<=7;s++)o+s<=-1||r<=o+s||(l>=0&&l<=6&&(0===s||6===s)||s>=0&&s<=6&&(0===l||6===l)||l>=2&&l<=4&&s>=2&&s<=4?e.set(i+l,o+s,!0,!0):e.set(i+l,o+s,!1,!0))}(w,t),function(e){for(var t=e.size,r=8;r<t-8;r++){var n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}(w),function(e,t){for(var r=s.getPositions(t),n=0;n<r.length;n++)for(var a=r[n][0],i=r[n][1],o=-2;o<=2;o++)for(var l=-2;l<=2;l++)-2===o||2===o||-2===l||2===l||0===o&&0===l?e.set(a+o,i+l,!0,!0):e.set(a+o,i+l,!1,!0)}(w,t),y(w,r,0),t>=7&&function(e,t){for(var r,n,a,i=e.size,o=h.getEncodedBits(t),l=0;l<18;l++)r=Math.floor(l/3),n=l%3+i-8-3,a=1==(o>>l&1),e.set(r,n,a,!0),e.set(n,r,a,!0)}(w,t),function(e,t){for(var r=e.size,n=-1,a=r-1,i=7,o=0,l=r-1;l>0;l-=2)for(6===l&&l--;;){for(var s=0;s<2;s++)if(!e.isReserved(a,l-s)){var u=!1;o<t.length&&(u=1==(t[o]>>>i&1)),e.set(a,l-s,u),-1===--i&&(o++,i=7)}if((a+=n)<0||r<=a){a-=n,n=-n;break}}}(w,p),isNaN(n)&&(n=c.getBestMask(w,y.bind(null,w,r))),c.applyMask(n,w),y(w,r,n),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:n,segments:i}}r.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");var r,n,o=i.M;return void 0!==t&&(o=i.from(t.errorCorrectionLevel,i.M),r=h.from(t.version),n=c.from(t.maskPattern),t.toSJISFunc&&a.setToSJISFunction(t.toSJISFunc)),w(e,r,o,n)}},{"../utils/buffer":32,"./alignment-pattern":7,"./bit-buffer":9,"./bit-matrix":10,"./error-correction-code":12,"./error-correction-level":13,"./finder-pattern":14,"./format-info":15,"./mask-pattern":18,"./mode":19,"./reed-solomon-encoder":23,"./segments":25,"./utils":26,"./version":28,isarray:33}],23:[function(e,t,r){var n=e("../utils/buffer"),a=e("./polynomial");function i(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}i.prototype.initialize=function(e){this.degree=e,this.genPoly=a.generateECPolynomial(this.degree)},i.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var t=new n(this.degree);t.fill(0);var r=n.concat([e,t],e.length+this.degree),i=a.mod(r,this.genPoly),o=this.degree-i.length;if(o>0){var l=new n(this.degree);return l.fill(0),i.copy(l,o),l}return i},t.exports=i},{"../utils/buffer":32,"./polynomial":21}],24:[function(e,t,r){var n="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",a="(?:(?![A-Z0-9 $%*+\\-./:]|"+(n=n.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";r.KANJI=new RegExp(n,"g"),r.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),r.BYTE=new RegExp(a,"g"),r.NUMERIC=new RegExp("[0-9]+","g"),r.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var i=new RegExp("^"+n+"$"),o=new RegExp("^[0-9]+$"),l=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");r.testKanji=function(e){return i.test(e)},r.testNumeric=function(e){return o.test(e)},r.testAlphanumeric=function(e){return l.test(e)}},{}],25:[function(e,t,r){var n=e("./mode"),a=e("./numeric-data"),i=e("./alphanumeric-data"),o=e("./byte-data"),l=e("./kanji-data"),s=e("./regex"),u=e("./utils"),c=e("dijkstrajs");function f(e){return unescape(encodeURIComponent(e)).length}function d(e,t,r){for(var n,a=[];null!==(n=e.exec(r));)a.push({data:n[0],index:n.index,mode:t,length:n[0].length});return a}function h(e){var t,r,a=d(s.NUMERIC,n.NUMERIC,e),i=d(s.ALPHANUMERIC,n.ALPHANUMERIC,e);return u.isKanjiModeEnabled()?(t=d(s.BYTE,n.BYTE,e),r=d(s.KANJI,n.KANJI,e)):(t=d(s.BYTE_KANJI,n.BYTE,e),r=[]),a.concat(i,t,r).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function p(e,t){switch(t){case n.NUMERIC:return a.getBitsLength(e);case n.ALPHANUMERIC:return i.getBitsLength(e);case n.KANJI:return l.getBitsLength(e);case n.BYTE:return o.getBitsLength(e)}}function g(e,t){var r,s=n.getBestModeForData(e);if((r=n.from(t,s))!==n.BYTE&&r.bit<s.bit)throw new Error('"'+e+'" cannot be encoded with mode '+n.toString(r)+".\n Suggested mode is: "+n.toString(s));switch(r!==n.KANJI||u.isKanjiModeEnabled()||(r=n.BYTE),r){case n.NUMERIC:return new a(e);case n.ALPHANUMERIC:return new i(e);case n.KANJI:return new l(e);case n.BYTE:return new o(e)}}r.fromArray=function(e){return e.reduce((function(e,t){return"string"==typeof t?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e}),[])},r.fromString=function(e,t){for(var a=function(e,t){for(var r={},a={start:{}},i=["start"],o=0;o<e.length;o++){for(var l=e[o],s=[],u=0;u<l.length;u++){var c=l[u],f=""+o+u;s.push(f),r[f]={node:c,lastCount:0},a[f]={};for(var d=0;d<i.length;d++){var h=i[d];r[h]&&r[h].node.mode===c.mode?(a[h][f]=p(r[h].lastCount+c.length,c.mode)-p(r[h].lastCount,c.mode),r[h].lastCount+=c.length):(r[h]&&(r[h].lastCount=c.length),a[h][f]=p(c.length,c.mode)+4+n.getCharCountIndicator(c.mode,t))}}i=s}for(d=0;d<i.length;d++)a[i[d]].end=0;return{map:a,table:r}}(function(e){for(var t=[],r=0;r<e.length;r++){var a=e[r];switch(a.mode){case n.NUMERIC:t.push([a,{data:a.data,mode:n.ALPHANUMERIC,length:a.length},{data:a.data,mode:n.BYTE,length:a.length}]);break;case n.ALPHANUMERIC:t.push([a,{data:a.data,mode:n.BYTE,length:a.length}]);break;case n.KANJI:t.push([a,{data:a.data,mode:n.BYTE,length:f(a.data)}]);break;case n.BYTE:t.push([{data:a.data,mode:n.BYTE,length:f(a.data)}])}}return t}(h(e,u.isKanjiModeEnabled())),t),i=c.find_path(a.map,"start","end"),o=[],l=1;l<i.length-1;l++)o.push(a.table[i[l]].node);return r.fromArray(function(e){return e.reduce((function(e,t){var r=e.length-1>=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[])}(o))},r.rawSplit=function(e){return r.fromArray(h(e,u.isKanjiModeEnabled()))}},{"./alphanumeric-data":8,"./byte-data":11,"./kanji-data":17,"./mode":19,"./numeric-data":20,"./regex":24,"./utils":26,dijkstrajs:3}],26:[function(e,t,r){var n,a=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];r.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},r.getSymbolTotalCodewords=function(e){return a[e]},r.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},r.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},r.isKanjiModeEnabled=function(){return void 0!==n},r.toSJIS=function(e){return n(e)}},{}],27:[function(e,t,r){r.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},{}],28:[function(e,t,r){var n=e("./utils"),a=e("./error-correction-code"),i=e("./error-correction-level"),o=e("./mode"),l=e("./version-check"),s=e("isarray"),u=n.getBCHDigit(7973);function c(e,t){return o.getCharCountIndicator(e,t)+4}function f(e,t){var r=0;return e.forEach((function(e){var n=c(e.mode,t);r+=n+e.getBitsLength()})),r}r.from=function(e,t){return l.isValid(e)?parseInt(e,10):t},r.getCapacity=function(e,t,r){if(!l.isValid(e))throw new Error("Invalid QR Code version");void 0===r&&(r=o.BYTE);var i=8*(n.getSymbolTotalCodewords(e)-a.getTotalCodewordsCount(e,t));if(r===o.MIXED)return i;var s=i-c(r,e);switch(r){case o.NUMERIC:return Math.floor(s/10*3);case o.ALPHANUMERIC:return Math.floor(s/11*2);case o.KANJI:return Math.floor(s/13);case o.BYTE:default:return Math.floor(s/8)}},r.getBestVersionForData=function(e,t){var n,a=i.from(t,i.M);if(s(e)){if(e.length>1)return function(e,t){for(var n=1;n<=40;n++){if(f(e,n)<=r.getCapacity(n,t,o.MIXED))return n}}(e,a);if(0===e.length)return 1;n=e[0]}else n=e;return function(e,t,n){for(var a=1;a<=40;a++)if(t<=r.getCapacity(a,n,e))return a}(n.mode,n.getLength(),a)},r.getEncodedBits=function(e){if(!l.isValid(e)||e<7)throw new Error("Invalid QR Code version");for(var t=e<<12;n.getBCHDigit(t)-u>=0;)t^=7973<<n.getBCHDigit(t)-u;return e<<12|t}},{"./error-correction-code":12,"./error-correction-level":13,"./mode":19,"./utils":26,"./version-check":27,isarray:33}],29:[function(e,t,r){var n=e("./utils");r.render=function(e,t,r){var a=r,i=t;void 0!==a||t&&t.getContext||(a=t,t=void 0),t||(i=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),a=n.getOptions(a);var o=n.getImageWidth(e.modules.size,a),l=i.getContext("2d"),s=l.createImageData(o,o);return n.qrToImageData(s.data,e,a),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(l,i,o),l.putImageData(s,0,0),i},r.renderToDataURL=function(e,t,n){var a=n;void 0!==a||t&&t.getContext||(a=t,t=void 0),a||(a={});var i=r.render(e,t,a),o=a.type||"image/png",l=a.rendererOpts||{};return i.toDataURL(o,l.quality)}},{"./utils":31}],30:[function(e,t,r){var n=e("./utils");function a(e,t){var r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function i(e,t,r){var n=e+t;return void 0!==r&&(n+=" "+r),n}r.render=function(e,t,r){var o=n.getOptions(t),l=e.modules.size,s=e.modules.data,u=l+2*o.margin,c=o.color.light.a?"<path "+a(o.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",f="<path "+a(o.color.dark,"stroke")+' d="'+function(e,t,r){for(var n="",a=0,o=!1,l=0,s=0;s<e.length;s++){var u=Math.floor(s%t),c=Math.floor(s/t);u||o||(o=!0),e[s]?(l++,s>0&&u>0&&e[s-1]||(n+=o?i("M",u+r,.5+c+r):i("m",a,0),a=0,o=!1),u+1<t&&e[s+1]||(n+=i("h",l),l=0)):a++}return n}(s,l,o.margin)+'"/>',d='viewBox="0 0 '+u+" "+u+'"',h='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+c+f+"</svg>\n";return"function"==typeof r&&r(null,h),h}},{"./utils":31}],31:[function(e,t,r){function n(e){if("string"!=typeof e)throw new Error("Color should be defined as hex string");var t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");var r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}r.getOptions=function(e){e||(e={}),e.color||(e.color={});var t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,a=e.scale||4;return{width:r,scale:r?4:a,margin:t,color:{dark:n(e.color.dark||"#000000ff"),light:n(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},r.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},r.getImageWidth=function(e,t){var n=r.getScale(e,t);return Math.floor((e+2*t.margin)*n)},r.qrToImageData=function(e,t,n){for(var a=t.modules.size,i=t.modules.data,o=r.getScale(a,n),l=Math.floor((a+2*n.margin)*o),s=n.margin*o,u=[n.color.light,n.color.dark],c=0;c<l;c++)for(var f=0;f<l;f++){var d=4*(c*l+f),h=n.color.light;if(c>=s&&f>=s&&c<l-s&&f<l-s)h=u[i[Math.floor((c-s)/o)*a+Math.floor((f-s)/o)]?1:0];e[d++]=h.r,e[d++]=h.g,e[d++]=h.b,e[d]=h.a}}},{}],32:[function(e,t,r){(function(r){"use strict";var n=e("isarray");r.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}();var a=r.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function r(e,t,n){return r.TYPED_ARRAY_SUPPORT||this instanceof r?"number"==typeof e?l(this,e):function(e,t,n,a){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer)return function(e,t,n,a){if(n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(a||0))throw new RangeError("'length' is out of bounds");var i;i=void 0===n&&void 0===a?new Uint8Array(t):void 0===a?new Uint8Array(t,n):new Uint8Array(t,n,a);r.TYPED_ARRAY_SUPPORT?i.__proto__=r.prototype:i=s(e,i);return i}(e,t,n,a);if("string"==typeof t)return function(e,t){var r=0|c(t),n=o(e,r),a=n.write(t);a!==r&&(n=n.slice(0,a));return n}(e,t);return function(e,t){if(r.isBuffer(t)){var n=0|i(t.length),a=o(e,n);return 0===a.length||t.copy(a,0,0,n),a}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(l=t.length)!=l?o(e,0):s(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return s(e,t.data)}var l;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}(this,e,t,n):new r(e,t,n)}function i(e){if(e>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function o(e,t){var n;return r.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t)).__proto__=r.prototype:(null===(n=e)&&(n=new r(t)),n.length=t),n}function l(e,t){var n=o(e,t<0?0:0|i(t));if(!r.TYPED_ARRAY_SUPPORT)for(var a=0;a<t;++a)n[a]=0;return n}function s(e,t){for(var r=t.length<0?0:0|i(t.length),n=o(e,r),a=0;a<r;a+=1)n[a]=255&t[a];return n}function u(e,t){var r;t=t||1/0;for(var n=e.length,a=null,i=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function c(e){return r.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:u(e).length)}r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),r.prototype.write=function(e,t,r){void 0===t||void 0===r&&"string"==typeof t?(r=this.length,t=0):isFinite(t)&&(t|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(e,t,r,n){return function(e,t,r,n){for(var a=0;a<n&&!(a+r>=t.length||a>=e.length);++a)t[a+r]=e[a];return a}(u(t,e.length-r),e,r,n)}(this,e,t,r)},r.prototype.slice=function(e,t){var n,a=this.length;if((e=~~e)<0?(e+=a)<0&&(e=0):e>a&&(e=a),(t=void 0===t?a:~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),t<e&&(t=e),r.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=r.prototype;else{var i=t-e;n=new r(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},r.prototype.copy=function(e,t,n,a){if(n||(n=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<n&&(a=n),a===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-n&&(a=e.length-t+n);var i,o=a-n;if(this===e&&n<t&&t<a)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!r.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},r.prototype.fill=function(e,t,n){if("string"==typeof e){if("string"==typeof t?(t=0,n=this.length):"string"==typeof n&&(n=this.length),1===e.length){var a=e.charCodeAt(0);a<256&&(e=a)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var o=r.isBuffer(e)?e:new r(e),l=o.length;for(i=0;i<n-t;++i)this[i+t]=o[i%l]}return this},r.concat=function(e,t){if(!n(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o(null,0);var a;if(void 0===t)for(t=0,a=0;a<e.length;++a)t+=e[a].length;var i=l(null,t),s=0;for(a=0;a<e.length;++a){var u=e[a];if(!r.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,s),s+=u.length}return i},r.byteLength=c,r.prototype._isBuffer=!0,r.isBuffer=function(e){return!(null==e||!e._isBuffer)},t.exports=r}).call(this,e("buffer").Buffer)},{buffer:2,isarray:33}],33:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},{}],34:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,a;return t=e,(r=[{key:"getKey",value:function(e,t){var r="".concat(e,"|");for(var n in t)r+="".concat(n,"=").concat(t[n],"|");return r}},{key:"invalidateTable",value:function(e){for(var t,r=0;r<localStorage.length;r++)(t=localStorage.key(r)).indexOf("t=".concat(e))>0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var r=localStorage.getItem(e);return void 0!==r&&null!=r&&""!==r?void 0===(t=JSON.parse(r))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var r=JSON.stringify(t);return localStorage.setItem(e,r),r}}])&&n(t.prototype,r),a&&n(t,a),e}();r.default=a},{}],35:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=i(e("./ModuleBase")),a=i(e("../api-common/RequestCache"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(t){var a=f(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return c(this,r)}}function c(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(o,e);var t,r,n,i=u(o);function o(e,t,r,n){var a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(a=i.call(this)).moduleRelativeURL=null,a.tableData=[],a.sourceData=[],a.filter=null,a.origFilter=null,a.orderBy=null,a.currentElement=null,a.initAdapter(e,t,r,n),a}return t=o,(r=[{key:"initAdapter",value:function(e,t,r,n){this.moduleRelativeURL=baseUrl,this.table=e,this.tab=null==t?e:t,this.filter=null==r?null:r,this.origFilter=this.filter,this.orderBy=null==n?null:n,this.trackEvent("initAdapter",t),this.requestCache=new a.default}},{key:"setFilter",value:function(e){this.filter=e}},{key:"preSetFilterExternal",value:function(e){this.initialFilter=e}},{key:"setFilterExternal",value:function(e){var t=e;null==t&&(t=this.initialFilter),null!=t&&(this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t))}},{key:"getFilter",value:function(){return this.filter}},{key:"setOrderBy",value:function(e){this.orderBy=e}},{key:"getOrderBy",value:function(){return this.orderBy}},{key:"add",value:function(e,t,r,n){var a=this;null==r&&(r=!0),$(e).attr("a","add"),$(e).attr("t",this.table),a.showLoader(),this.requestCache.invalidateTable(this.table),$.post(this.moduleRelativeURL,e,(function(e){"SUCCESS"===e.status?a.addSuccessCallBack(t,e.object,r,n,a):a.addFailCallBack(t,e.object)}),"json").always((function(){a.hideLoader()})),this.trackEvent("add",this.tab,this.table)}},{key:"addSuccessCallBack",value:function(e,t,r,n,a){r&&this.get(e),this.initFieldMasterData(),null!=n&&n.apply(a,[t]),this.trackEvent("addSuccess",this.tab,this.table)}},{key:"addFailCallBack",value:function(e,t){try{this.closePlainMessage()}catch(e){}this.showMessage("Error saving",t),this.trackEvent("addFailed",this.tab,this.table)}},{key:"deleteObj",value:function(e,t){var r=this;r.showLoader(),this.requestCache.invalidateTable(this.table),$.post(this.moduleRelativeURL,{t:this.table,a:"delete",id:e},(function(e){"SUCCESS"===e.status?r.deleteSuccessCallBack(t,e.object):r.deleteFailCallBack(t,e.object)}),"json").always((function(){r.hideLoader()})),this.trackEvent("delete",this.tab,this.table)}},{key:"deleteSuccessCallBack",value:function(e,t){this.get(e),this.clearDeleteParams()}},{key:"deleteFailCallBack",value:function(e,t){this.clearDeleteParams(),this.showMessage("Error Occurred while Deleting Item",t)}},{key:"get",value:function(e){var t=this;if(this.getRemoteTable())return this.createTableServer(this.getTableName()),$("#".concat(this.getTableName(),"Form")).hide(),void $("#".concat(this.getTableName())).show();var r=JSON.stringify(this.getSourceMapping()),n="";null!==this.getFilter()&&(n=JSON.stringify(this.getFilter()));var a="";null!==this.getOrderBy()&&(a=this.getOrderBy()),r=this.fixJSON(r),n=this.fixJSON(n),t.showLoader(),$.post(this.moduleRelativeURL,{t:this.table,a:"get",sm:r,ft:n,ob:a},(function(r){"SUCCESS"===r.status?t.getSuccessCallBack(e,r.object):t.getFailCallBack(e,r.object)}),"json").always((function(){t.hideLoader()})),t.initFieldMasterData(),this.trackEvent("get",this.tab,this.table)}},{key:"getDataUrl",value:function(e){var t=JSON.stringify(this.getSourceMapping()),r=JSON.stringify(e),n="";null!==this.getFilter()&&(n=JSON.stringify(this.getFilter()));var a="";null!==this.getOrderBy()&&(a=this.getOrderBy());var i=this.moduleRelativeURL.replace("service.php","data.php");return i="".concat(i,"?t=").concat(this.table),i="".concat(i,"&sm=").concat(this.fixJSON(t)),i="".concat(i,"&cl=").concat(this.fixJSON(r)),i="".concat(i,"&ft=").concat(this.fixJSON(n)),i="".concat(i,"&ob=").concat(a),this.isSubProfileTable()&&(i="".concat(i,"&type=sub")),this.remoteTableSkipProfileRestriction()&&(i="".concat(i,"&skip=1")),i}},{key:"isSubProfileTable",value:function(){return!1}},{key:"remoteTableSkipProfileRestriction",value:function(){return!1}},{key:"preProcessTableData",value:function(e){return e}},{key:"getSuccessCallBack",value:function(e,t){for(var r=[],n=this.getDataMapping(),a=0;a<t.length;a++){for(var i=[],o=0;o<n.length;o++)i[o]=t[a][n[o]];r.push(this.preProcessTableData(i))}this.sourceData=t,void 0!==e.callBack&&null!==e.callBack&&(void 0!==e.callBackData&&null!==e.callBackData||(e.callBackData=[]),e.callBackData.push(t),e.callBackData.push(r),this.callFunction(e.callBack,e.callBackData)),this.tableData=r,void 0!==e.noRender&&null!==e.noRender&&!0===e.noRender||(this.createTable(this.getTableName()),$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show())}},{key:"getFailCallBack",value:function(e,t){}},{key:"getElement",value:function(e,t,r){var n=this,a=JSON.stringify(this.getSourceMapping());a=this.fixJSON(a),n.showLoader(),$.post(this.moduleRelativeURL,{t:this.table,a:"getElement",id:e,sm:a},(function(e){"SUCCESS"===e.status?(r&&delete e.object.id,this.currentElement=e.object,n.getElementSuccessCallBack.apply(n,[t,e.object])):n.getElementFailCallBack.apply(n,[t,e.object])}),"json").always((function(){n.hideLoader()})),this.trackEvent("getElement",this.tab,this.table)}},{key:"getElementSuccessCallBack",value:function(e,t){void 0!==e.callBack&&null!==e.callBack&&(void 0!==e.callBackData&&null!==e.callBackData||(e.callBackData=[]),e.callBackData.push(t),this.callFunction(e.callBack,e.callBackData,this)),this.currentElement=t,void 0!==e.noRender&&null!==e.noRender&&!0===e.noRender||this.renderForm(t)}},{key:"getElementFailCallBack",value:function(e,t){}},{key:"getTableData",value:function(){return this.tableData}},{key:"getTableName",value:function(){return this.tab}},{key:"getFieldValues",value:function(e,t){var r=this,n="",a="";void 0!==e[3]&&null!==e[3]&&(n=e[3]),void 0!==e[4]&&null!==e[4]&&(a=JSON.stringify(e[4]));var i=this.requestCache.getKey(this.moduleRelativeURL,{t:e[0],key:e[1],value:e[2],method:n,methodParams:a,a:"getFieldValues"}),o=this.requestCache.getData(i);null!=o&&"SUCCESS"===o.status&&(t.callBackData.push(o.data),null!==t.callBackSuccess&&void 0!==t.callBackSuccess&&t.callBackData.push(t.callBackSuccess),r.callFunction(t.callBack,t.callBackData));var l=function e(n){if("SUCCESS"===n.status){r.requestCache.setData(this.success.key,n);var a=t;a.callBackData=[t.callBackData[0]],a.callBackData.push(n.data),null!==a.callBackSuccess&&void 0!==a.callBackSuccess&&a.callBackData.push(t.callBackSuccess),r.callFunction(a.callBack,a.callBackData)}else"Access violation"===n.message&&alert("Error : ".concat(e.table," ").concat(n.message))};l.key=i,l.table=e[0],$.post(this.moduleRelativeURL,{t:e[0],key:e[1],value:e[2],method:n,methodParams:a,a:"getFieldValues"},l,"json")}},{key:"setAdminProfile",value:function(e){try{localStorage.clear()}catch(e){}$.post(this.moduleRelativeURL,{a:"setAdminEmp",empid:e},(function(){top.location.href=clientUrl}),"json")}},{key:"customAction",value:function(e,t,r,n,a){var i=this;r=this.fixJSON(r),a?$.post(this.moduleRelativeURL,{t:this.table,a:"ca",sa:e,mod:t,req:r},(function(e){"SUCCESS"===e.status?(n.callBackData.push(e.data),i.callFunction(n.callBackSuccess,n.callBackData)):(n.callBackData.push(e.data),i.callFunction(n.callBackFail,n.callBackData))}),"json"):$.getJSON(this.moduleRelativeURL,{t:this.table,a:"ca",sa:e,mod:t,req:r},(function(e){"SUCCESS"===e.status?(n.callBackData.push(e.data),i.callFunction(n.callBackSuccess,n.callBackData)):(n.callBackData.push(e.data),i.callFunction(n.callBackFail,n.callBackData))}))}},{key:"sendCustomRequest",value:function(e,t,r,n){t.a=e,$.post(this.moduleRelativeURL,t,(function(e){"SUCCESS"===e.status?r(e.data):n(e.data)}),"json")}},{key:"getCustomActionUrl",value:function(e,t){t.a=e;var r="";for(var n in t)t.hasOwnProperty(n)&&(""!==r&&(r+="&"),r+="".concat(n,"=").concat(t[n]));return"".concat(this.moduleRelativeURL,"?").concat(r)}},{key:"getClientDataUrl",value:function(){return"".concat(this.moduleRelativeURL.replace("service.php",""),"data/")}},{key:"getCustomUrl",value:function(e){return this.moduleRelativeURL.replace("service.php",e)}}])&&l(t.prototype,r),n&&l(t,n),o}(n.default);r.default=d},{"../api-common/RequestCache":34,"./ModuleBase":37}],36:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a={float:function(e){return!(null==e||!e.match(/^[-+]?[0-9]+(\.[0-9]+)?$/))},number:function(e){return!(null==e||!e.match(/^[0-9]+$/))},numberOrEmpty:function(e){if(""===e)return!0;return!(null==e||!e.match(/^[0-9]+$/))},email:function(e){return null!=e&&/^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/.test(e)},emailOrEmpty:function(e){if(""===e)return!0;return null!=e&&/^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/.test(e)},username:function(e){return null!=e&&/^[a-zA-Z0-9.-]+$/.test(e)},input:function(e){return null!=e&&e.length>0}},i=function(){function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=r,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,n),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=a}var t,r,i;return t=e,r=[{key:"clearError",value:function(e,t){var r=e.attr("id");$("#".concat(this.formId," #field_").concat(r)).removeClass("error"),$("#".concat(this.formId," #help_").concat(r)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var r=e.attr("id"),n=e.attr("validation"),a=e.attr("validation");$("#".concat(this.formId," #field_").concat(r)).addClass("error"),void 0===a||null==a||""===a?$("#".concat(this.formId," #help_err_").concat(r)).html(a):void 0===n||null==n||""===n?$("#".concat(this.formId," #help_err_").concat(r)).html("Required"):"float"===n||"number"===n?$("#".concat(this.formId," #help_err_").concat(r)).html("Number required"):"email"===n?$("#".concat(this.formId," #help_err_").concat(r)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(r)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var r=function(e){var r=null,n=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(n,"']")).removeClass(t.settings.LabelErrorClass);var a=e.attr("id"),i=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(i,t.inputTypes)>=0){if(e.hasClass("uploadInput"))r=e.attr("val");else if("radio"===i||"checkbox"===i)r=$("input[name='".concat(n,"']:checked")).val();else if(e.hasClass("select2Field"))r=null!=$("#".concat(t.formId," #").concat(a)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(a)).select2("data")?$("#".concat(t.formId," #").concat(a)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(a)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(a)).select2("data")){var o=$("#".concat(t.formId," #").concat(a)).select2("data");r=[];for(var l=0;l<o.length;l++)r.push(o[l].id);r=JSON.stringify(r)}else r="";else r=e.hasClass("signatureField")?$("#".concat(t.formId," #").concat(a)).data("signaturePad").isEmpty()?"":$("#".concat(a)).data("signaturePad").toDataURL():e.hasClass("simplemde")?$("#".concat(t.formId," #").concat(a)).data("simplemde").value():e.hasClass("code")?$("#".concat(t.formId," #").concat(a)).data("codemirror").getValue():e.hasClass("tinymce")?tinyMCE.get(a).getContent({format:"raw"}):e.val();var s=e.attr("validation"),u=!1;void 0!==s&&null!=s&&void 0!==t.validator[s]&&null!=t.validator[s]?u=t.validator[s](r):(u=!t.validateAll||void 0!==s&&null!=s&&"none"===s||t.validator.input(r),t.formObject[a]=r),u?(t.clearError(e,null),t.formObject[a]=r):t.addError(e,null)}},n=$("#".concat(this.formId," :input"));return n.each((function(){r($(this))})),(n=$("#".concat(this.formId," .uploadInput"))).each((function(){r($(this))})),this.showErrors(),this.tempOptions={},!this.formError}},{key:"getFormParameters",value:function(){return this.formObject}},{key:"alert",value:function(e){function t(t,r){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){alert(t)}))}],i=[{key:"getValidationRules",value:function(){return a}}],r&&n(t.prototype,r),i&&n(t,i),e}();r.default=i},{}],37:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,a=(n=e("./FormValidation"))&&n.__esModule?n:{default:n};function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.deleteParams={},this.createRemoteTable=!1,this.instanceId="None",this.ga=[],this.showEdit=!0,this.showDelete=!0,this.showSave=!0,this.showCancel=!0,this.showFormOnPopup=!1,this.filtersAlreadySet=!1,this.currentFilterString="",this.sorting=0,this.settings={},this.translations={},this.customFields=[],this.csrfRequired=!1,this.fieldTemplates=null,this.templates=null,this.customTemplates=null,this.emailTemplates=null,this.fieldMasterData=null,this.fieldMasterDataKeys=null,this.fieldMasterDataCallback=null,this.sourceMapping=null,this.currentId=null,this.currentElement=null,this.user=null,this.currentProfile=null,this.permissions={},this.baseUrl=null}var t,r,n;return t=e,(r=[{key:"init",value:function(e,t,r,n){}},{key:"setNoJSONRequests",value:function(e){this.noJSONRequests=e}},{key:"setPermissions",value:function(e){this.permissions=e}},{key:"sortingStarted",value:function(e){this.sorting=e}},{key:"checkPermission",value:function(e){return void 0===this.permissions[e]||null==this.permissions[e]||"Yes"===this.permissions[e]?"Yes":this.permissions[e]}},{key:"setBaseUrl",value:function(e){this.baseUrl=e}},{key:"setUser",value:function(e){this.user=e}},{key:"getUser",value:function(){return this.user}},{key:"setInstanceId",value:function(e){this.instanceId=e}},{key:"setCSRFRequired",value:function(e){this.csrfRequired=e}},{key:"scrollToTop",value:function(){$("html, body").animate({scrollTop:0},"fast")}},{key:"scrollToBottom",value:function(){$("html, body").animate({scrollTop:$(document).height()},"slow")}},{key:"scrollToElement",value:function(e){$(window).height()<=e.offset().top&&$("html, body").animate({scrollTop:e.offset().top},"slow")}},{key:"scrollToElementBottom",value:function(e){$(window).height()<=e.offset().top+e.height()&&$("html, body").animate({scrollTop:e.offset().top+e.height()},"slow")}},{key:"setTranslations",value:function(e){this.translations=e.messages[""]}},{key:"setTranslationsSubModules",value:function(e){this.translations=e}},{key:"gt",value:function(e){return void 0===this.translations[e]||null===this.translations[e]?e:this.translations[e][0]}},{key:"addToLangTerms",value:function(e){var t,r=localStorage.getItem("terms");if(void 0===r)t={};else try{t=JSON.parse(r)}catch(e){t={}}void 0===this.translations[e]&&(t[e]=e,localStorage.setItem("terms",JSON.stringify(t)))}},{key:"showActionButtons",value:function(){return!0}},{key:"trackEvent",value:function(e,t,r){try{void 0===t||null==t?this.ga.push(["_trackEvent",this.instanceId,e]):void 0===r||null==r?this.ga.push(["_trackEvent",this.instanceId,e,t]):this.ga.push(["_trackEvent",this.instanceId,e,t,r])}catch(e){}}},{key:"setCurrentProfile",value:function(e){this.currentProfile=e}},{key:"getCurrentProfile",value:function(){return this.currentProfile}},{key:"initFieldMasterData",value:function(e,t,r){var n;void 0!==this.showAddNew&&null!=this.showAddNew||(this.showAddNew=!0),this.fieldMasterData={},this.fieldMasterDataKeys={},this.fieldMasterDataCallback=t,this.fieldMasterDataCallbackData=r,this.sourceMapping={};var a=this.getFormFields(),i=this.getFilters();if(null!=i)for(var o=0;o<i.length;o++)(null==(n=this.getMetaFieldValues(i[o][0],a))||"select"!==n.type&&"select2"!==n.type&&"select2multi"!==n.type)&&a.push(i[o]);for(var l=[],s=[],u=null,c=null,f=0;f<a.length;f++)if(void 0!==(u=a[f])[1]["remote-source"]&&null!==u[1]["remote-source"]){var d="".concat(u[1]["remote-source"][0],"_").concat(u[1]["remote-source"][1],"_").concat(u[1]["remote-source"][2]);l.push(u),s.push(d)}else if(void 0!==u[1].form&&null!==u[1].form)for(var h=0;h<u[1].form.length;h++)if(void 0!==(c=u[1].form[h])[1]["remote-source"]&&null!==c[1]["remote-source"]){var p="".concat(c[1]["remote-source"][0],"_").concat(c[1]["remote-source"][1],"_").concat(c[1]["remote-source"][2]);s.indexOf(p)<0&&(l.push(c),s.push(p))}for(var g=0;g<l.length;g++){var m=l[g];if(void 0!==m[1]["remote-source"]&&null!=m[1]["remote-source"]){var v="".concat(m[1]["remote-source"][0],"_").concat(m[1]["remote-source"][1],"_").concat(m[1]["remote-source"][2]);this.fieldMasterDataKeys[v]=!1,this.sourceMapping[m[0]]=m[1]["remote-source"];var y={callBack:"initFieldMasterDataResponse"};y.callBackData=[v],null!=e&&(y.callBackSuccess=e),this.getFieldValues(m[1]["remote-source"],y)}}}},{key:"setShowFormOnPopup",value:function(e){this.showFormOnPopup=e}},{key:"setRemoteTable",value:function(e){this.createRemoteTable=e}},{key:"setSettings",value:function(e){this.settings=e}},{key:"getRemoteTable",value:function(){return this.createRemoteTable}},{key:"isAllLoaded",value:function(e){for(var t in e)if(!1===e[t])return!1;return!0}},{key:"initFieldMasterDataResponse",value:function(e,t,r,n){this.fieldMasterData[e]=t,this.fieldMasterDataKeys[e]=!0,null!=r&&r(),null!==this.fieldMasterDataCallback&&void 0!==this.fieldMasterDataCallback&&this.isAllLoaded(this.fieldMasterDataKeys)&&null!==this.fieldMasterDataCallbackData&&void 0!==this.fieldMasterDataCallbackData?this.fieldMasterDataCallback(this.fieldMasterDataCallbackData):null!==this.fieldMasterDataCallback&&void 0!==this.fieldMasterDataCallback&&this.isAllLoaded(this.fieldMasterDataKeys)&&this.fieldMasterDataCallback()}},{key:"getMetaFieldValues",value:function(e,t){for(var r=0;r<t.length;r++)if(e===t[r][0])return t[r][1];return null}},{key:"getThemeColors",value:function(){return["red","yellow","aqua","blue","light-blue","green","navy","teal","olive","orange","fuchsia","purple"]}},{key:"getColorByRandomString",value:function(e){var t=this.getThemeColors();return t[e.charCodeAt(0)%t.length]}},{key:"getColorByFileType",value:function(e){e=e.toLowerCase();var t={pdf:"red",csv:"yellow",xls:"green",xlsx:"green",doc:"light-blue",docx:"light-blue"};return t.docx="blue",t.ppt="orange",t.pptx="orange",t.jpg="teal",t.jpeg="teal",t.gif="green",t.png="yellow",t.bmp="fuchsia",void 0!==t[e]||null!=t[e]?t[e]:this.getColorByRandomString(e)}},{key:"getIconByFileType",value:function(e){var t={pdf:"fa fa-file-pdf-o",csv:"fa fa fa-file-code-o",xls:"fa fa-file-excel-o",xlsx:"fa fa-file-excel-o",doc:"fa fa-file-word-o",docx:"fa fa-file-word-o",ppt:"fa fa-file-powerpoint-o",pptx:"fa fa-file-powerpoint-o",jpg:"fa fa-file-image-o",jpeg:"fa fa-file-image-o",gif:"fa fa-file-image-o",png:"fa fa-file-image-o",bmp:"fa fa-file-image-o",txt:"fa fa-file-text-o",rtf:"fa fa-file-text-o"};return void 0!==t[e=e.toLowerCase()]||null!=t[e]?t[e]:"fa fa-file-o"}},{key:"getSourceMapping",value:function(){return this.sourceMapping}},{key:"setTesting",value:function(e){this.testing=e}},{key:"consoleLog",value:function(e){this.testing&&console.log(e)}},{key:"setClientMessages",value:function(e){this.msgList=e}},{key:"setTemplates",value:function(e){this.templates=e}},{key:"getWSProperty",value:function(e,t){return e.hasOwnProperty(t)?e[t]:null}},{key:"getClientMessage",value:function(e){return this.getWSProperty(this.msgList,e)}},{key:"getTemplate",value:function(e){return this.getWSProperty(this.templates,e)}},{key:"setGoogleAnalytics",value:function(e){this.gaq=e}},{key:"showView",value:function(e){null!=this.currentView&&(this.previousView=this.currentView,$("#".concat(this.currentView)).hide()),$("#".concat(e)).show(),this.currentView=e,this.moveToTop()}},{key:"showPreviousView",value:function(){this.showView(this.previousView)}},{key:"moveToTop",value:function(){}},{key:"callFunction",value:function(e,t,r){if($.isFunction(e))try{null==r?e.apply(document,t):e.apply(r,t)}catch(e){console.log(e.message)}else{var n=this[e];if($.isFunction(n))try{n.apply(this,t)}catch(e){console.log(e.message)}}}},{key:"getTableTopButtonHtml",value:function(){var e="";return this.getShowAddNew()&&(e='<button onclick="modJs.renderForm();return false;" class="btn btn-small btn-primary">'.concat(this.gt(this.getAddNewLabel()),' <i class="fa fa-plus"></i></button>')),null!=this.getFilters()&&(""!==e&&(e+=" "),e+='<button onclick="modJs.showFilters();return false;" class="btn btn-small btn-primary">'.concat(this.gt("Filter"),' <i class="fa fa-filter"></i></button>'),e+=" ",this.filtersAlreadySet?e+='<button id="__id___resetFilters" onclick="modJs.resetFilters();return false;" class="btn btn-small btn-default">__filterString__ <i class="fa fa-times"></i></button>':e+='<button id="__id___resetFilters" onclick="modJs.resetFilters();return false;" class="btn btn-small btn-default" style="display:none;">__filterString__ <i class="fa fa-times"></i></button>'),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='<div class="row"><div class="col-xs-12">'.concat(e,"</div></div>")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'<div class="box-body table-responsive"><table cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped" id="grid"></table></div>'}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var r in t)t[r].sTitle=this.gt(t[r].sTitle);var n,a=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var i=0;i<a.length;i++)a[i].push(this.getActionButtonsHtml(a[i][0],a[i]));n=this.getTableTopButtonHtml()+this.getTableHTMLTemplate();var o=$("#".concat(e," .dataTables_paginate .active a")).html(),l=0;void 0!==o&&null!=o&&(l=15*parseInt(o,10)-15),$("#".concat(e)).html(n);var s={oLanguage:{sLengthMenu:"_MENU_ records per page"},aaData:a,aoColumns:t,bSort:this.isSortable(),iDisplayLength:15,iDisplayStart:l},u=this.getCustomTableParams();$.extend(s,u),$("#".concat(e," #grid")).dataTable(s),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$(".tableActionButton").tooltip()}}},{key:"createTableServer",value:function(e){var t,r=this.getHeaders();for(var n in r.push({sTitle:"",sClass:"center"}),r)r[n].sTitle=this.gt(r[n].sTitle);t=this.getTableTopButtonHtml()+this.getTableHTMLTemplate();var a=$("#".concat(e," .dataTables_paginate .active a")).html(),i=0;void 0!==a&&null!=a&&(i=15*parseInt(a,10)-15),$("#".concat(e)).html(t);var o={oLanguage:{sLengthMenu:"_MENU_ records per page"},bProcessing:!0,bServerSide:!0,sAjaxSource:this.getDataUrl(this.getDataMapping()),aoColumns:r,bSort:this.isSortable(),parent:this,iDisplayLength:15,iDisplayStart:i};this.showActionButtons()&&(o.aoColumnDefs=[{fnRender:this.getActionButtons,aTargets:[this.getDataMapping().length]}]);var l=this.getCustomTableParams();$.extend(o,l),$("#".concat(e," #grid")).dataTable(o),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$(".tableActionButton").tooltip()}},{key:"getHeaders",value:function(){}},{key:"getDataMapping",value:function(){}},{key:"getFormFields",value:function(){}},{key:"getTableData",value:function(){}},{key:"getFilters",value:function(){return null}},{key:"edit",value:function(e){this.currentId=e,this.getElement(e,[])}},{key:"copyRow",value:function(e){this.getElement(e,[],!0)}},{key:"renderModel",value:function(e,t,r){$("#".concat(e,"ModelBody")).html(""),void 0!==r&&null!=r||(r=""),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(r)}},{key:"renderYesNoModel",value:function(e,t,r,n,a,i){var o=this,l="#yesnoModel";void 0!==t&&null!=t||(t=""),$("".concat(l,"Label")).html(e),$("".concat(l,"Body")).html(t),null!=r&&$("".concat(l,"YesBtn")).html(r),null!=n&&$("".concat(l,"NoBtn")).html(n),$("".concat(l,"YesBtn")).off().on("click",(function(){void 0!==a&&null!=a&&(a.apply(o,i),o.cancelYesno())})),$(l).modal({backdrop:"static"})}},{key:"renderModelFromDom",value:function(e,t,r){$("#".concat(e,"ModelBody")).html(""),void 0!==r&&null!=r||(r=$("<div></div>")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(r)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this,o="";o=a?"#plainMessageModel":"#messageModel",$(o).off(),a?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=r?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){r.apply(i,n),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,r,n,a){var i=this,o="";o=a?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),a?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=r?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){r.apply(i,n),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var r=new a.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(r.checkValues()){var n=r.getFormParameters();n=this.forceInjectValuesBeforeSave(n);var i=this.doCustomValidation(n);if(null==i){this.csrfRequired&&(n.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(n.id=o),n=this.makeEmptyDateFieldsNull(n),this.add(n,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(i),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new a.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var r in t)t.hasOwnProperty(r)&&"NULL"===t[r]&&delete t[r];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,r,n,a,i,o,l="",s=this.getFilters();for(var u in null==n&&(n=[]),e)if(e.hasOwnProperty(u)){if(i="",o=null,"select"===(n=this.getMetaFieldValues(u,s)).type||"select2"===n.type){if(void 0!==n["remote-source"]&&null!=n["remote-source"])t=n["remote-source"],"NULL"===e[u]?i=void 0!==n["null-label"]&&null!=n["null-label"]?n["null-label"]:"Not Selected":o=i=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[u]];else if(r=n.source[0],"NULL"===e[u])i=void 0!==n["null-label"]&&null!=n["null-label"]?n["null-label"]:"Not Selected";else for(var c=0;c<r.length;c++)if(e[u]===n.source[c][0]){o=i=n.source[c][1];break}}else if("select2multi"===n.type){a=[];try{a=JSON.parse(e[u])}catch(e){}""!==(i=a.join(","))&&(o=i)}else""!==(i=e[u])&&(o=i);null!=o&&(""!==l&&(l+=" | "),l+="".concat(n.label," = ").concat(i))}return l}},{key:"doCustomFilterValidation",value:function(e){return!0}},{key:"resetFilters",value:function(){this.filter=this.origFilter,this.filtersAlreadySet=!1,$("#".concat(this.getTableName(),"_resetFilters")).hide(),this.currentFilterString="",this.get([])}},{key:"showFilters",value:function(e){for(var t=this.templates.filterTemplate,r="",n=this.getFilters(),a=0;a<n.length;a++){var i=this.getMetaFieldForRendering(n[a][0]);if(""===i||void 0===i)r+=this.renderFormField(n[a]);else{var o=e[i];""!==o&&null!=o&&void 0!==o&&""!==o.trim()?r+=this.renderFormField(JSON.parse(o)):r+=this.renderFormField(n[a])}}t=(t=t.replace(/_id_/g,"".concat(this.getTableName(),"_filter"))).replace(/_fields_/g,r);var l=this.generateRandom(14),s=$('<div class="reviewBlock popupForm" data-content="Form"></div>');s.attr("id",l),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),r=t.find(".select2-choices").height();t.height(parseInt(r,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var r,n=this.templates.formTemplate,a="",i=this.getFormFields(),o=0;o<i.length;o++){var l=this.getMetaFieldForRendering(i[o][0]);if(""===l||void 0===l)a+=this.renderFormField(i[o]);else{var s=e[l];""!==s&&null!=s&&void 0!==s&&""!==s.trim()?a+=this.renderFormField(JSON.parse(s)):a+=this.renderFormField(i[o])}}n=(n=n.replace(/_id_/g,"".concat(this.getTableName(),"_submit"))).replace(/_fields_/g,a);var u=this.generateRandom(14);this.showFormOnPopup?(r=$('<div class="reviewBlock popupForm" data-content="Form"></div>')).attr("id",u):r=$("#".concat(this.getTableName(),"Form")),r.html(n),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var c=this.codeMirror;c&&r.find(".code").each((function(){var e=c.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),r=t.find(".select2-choices").height();t.height(parseInt(r,10))}))})),r.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var f=0;f<i.length;f++)"datagroup"===i[f][1].type&&r.find("#".concat(i[f][0])).data("field",i[f]);if(!1===this.showSave?r.find(".saveBtn").remove():(r.find(".saveBtn").off(),r.find(".saveBtn").data("modJs",this),r.find(".saveBtn").on("click",(function(){return null!=$(this).data("modJs").saveSuccessItemCallback&&void 0!==$(this).data("modJs").saveSuccessItemCallback?$(this).data("modJs").save($(this).data("modJs").retriveItemsAfterSave(),$(this).data("modJs").saveSuccessItemCallback):$(this).data("modJs").save(),!1}))),!1===this.showCancel?r.find(".cancelBtn").remove():(r.find(".cancelBtn").off(),r.find(".cancelBtn").data("modJs",this),r.find(".cancelBtn").on("click",(function(){return $(this).data("modJs").cancel(),!1}))),r.find("[mask]").each((function(){$(this).inputmask($(this).attr("mask"))})),r.find("[datemask]").each((function(){$(this).inputmask({mask:"y-1-2",placeholder:"YYYY-MM-DD",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"})})),r.find("[datetimemask]").each((function(){$(this).inputmask("datetime",{mask:"y-2-1 h:s:00",placeholder:"YYYY-MM-DD hh:mm:ss",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"})})),this.showFormOnPopup){this.showMessage("Edit","",null,null,!0),$("#plainMessageModel .modal-body").html(""),$("#plainMessageModel .modal-body").append(r);for(var d=0;d<t.length;d++)$("#".concat(t[d])).data("signaturePad",new SignaturePad(document.getElementById(t[d])));void 0!==e&&null!=e?this.fillForm(e,"#".concat(u)):this.setDefaultValues("#".concat(u))}else{$("#".concat(this.getTableName(),"Form")).show(),$("#".concat(this.getTableName())).hide();for(var h=0;h<t.length;h++)$("#".concat(t[h])).data("signaturePad",new SignaturePad(document.getElementById(t[h])));void 0!==e&&null!=e?this.fillForm(e):this.setDefaultValues(),this.scrollToTop()}this.postRenderForm(e,r)}},{key:"setDefaultValues",value:function(e,t){null!=t&&void 0!==t||(t=this.getFormFields()),null!=e&&void 0!==e&&""!==e||(e="#".concat(this.getTableName(),"Form"));for(var r=0;r<t.length;r++)"text"!==t[r][1].type&&"textarea"!==t[r][1].type||void 0!==t[r][1].default&&null!==t[r][1].default&&$("".concat(e," #").concat(t[r][0])).val(t[r][1].default)}},{key:"retriveItemsAfterSave",value:function(){return!0}},{key:"postRenderForm",value:function(e,t){}},{key:"dataGroupToHtml",value:function(e,t){var r,n,a,i,o=JSON.parse(e),l=t[1].html;null!=o&&void 0!==o&&void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]);for(var s=$('<div id="'.concat(t[0],'_div_inner"></div>')),u=0;u<o.length;u++){for(var c in n=o[u],void 0!==t[1]["pre-format-function"]&&null!=t[1]["pre-format-function"]&&(n=t[1]["pre-format-function"].apply(this,[n])),r=(r=(r=(r=l).replace("#_delete_#",'<a id="#_id_#_delete" onclick="modJs.deleteDataGroupItem(\'#_id_#\');return false;" type="button" style="float:right;margin-right:3px;" tooltip="Delete"><li class="fa fa-times"></li></a>')).replace("#_edit_#",'<a id="#_id_#_edit" onclick="modJs.editDataGroupItem(\'#_id_#\');return false;" type="button" style="float:right;margin-right:5px;" tooltip="Edit"><li class="fa fa-edit"></li></a>')).replace(/#_id_#/g,n.id),n)void 0!==(i=n[c])&&null!=i&&"string"==typeof i&&(i=i.replace(/(?:\r\n|\r|\n)/g,"<br />")),r=r.replace("#_".concat(c,"_#"),i);void 0!==t[1].render&&null!=t[1].render&&(r=r.replace("#_renderFunction_#",t[1].render(n))),(a=$(r)).attr("fieldId","".concat(t[0],"_div")),s.append(a)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var r=this.templates.datagroupTemplate,n="",a=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var i=0;i<a.length;i++)n+=this.renderFormField(a[i]);r=(r=r.replace(/_id_/g,"".concat(this.getTableName(),"_field_").concat(e[0]))).replace(/_fields_/g,n);var o=this.generateRandom(14),l=$('<div class="reviewBlock popupForm" data-content="Form"></div>');l.attr("id",o),l.html(r),l.find(".datefield").datepicker({viewMode:2}),l.find(".timefield").datetimepicker({language:"en",pickDate:!1}),l.find(".datetimefield").datetimepicker({language:"en"}),l.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(l.attr("id")," .tinymce"),height:"400"}),l.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),l.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),l.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),r=t.find(".select2-choices").height();t.height(parseInt(r,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),l,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var r=new a.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(r.checkValues()){var n=r.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[n])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;n=e.params}var i=$("#".concat(t[0])).val();""===i&&(i="[]");var o=JSON.parse(i);n.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(n),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),i=JSON.stringify(o);var l=this.dataGroupToHtml(i,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(l),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(i),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var r="";try{for(var n=e.split(" "),a=0,i=0;i<n.length;i++)(a+=n[i].length+1)>t?(r+="".concat(n[i],"<br/>"),a=0):r+="".concat(n[i]," ")}catch(e){}return r}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var r=$(e.target);if(!/html|body/i.test(r.offsetParent()[0].tagName)){var n=e.pageY-r.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(n,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,r=[],n=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),a=$("#".concat(e[0])).val();""===a&&(a="[]");var i=JSON.parse(a);n.each((function(){for(var e in t=$(this).attr("id"),i)if(i[e].id===t){r.push(i[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(r))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,r=new a.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(r.checkValues()){var n=r.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var i=e[1]["custom-validate-function"].apply(this,[n]);if(!i.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(i.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;n=i.params}if(this.doCustomFilterValidation(n)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var l=JSON.parse(o),s={},u=-1,c=[],f=0;f<l.length;f++){var d=l[f];d.id===t&&(s=d,u=f),c.push(d)}n.id=s.id,c[u]=n,void 0!==e[1]["sort-function"]&&null!=e[1]["sort-function"]&&c.sort(e[1]["sort-function"]),o=JSON.stringify(c),$("#".concat(e[0])).val(o);var h=this.dataGroupToHtml(o,e);this.orderDataGroup(e),$("#".concat(e[0],"_div")).html(""),$("#".concat(e[0],"_div")).append(h),this.makeDataGroupSortable(e,$("#".concat(e[0],"_div_inner"))),this.closeDataMessage(),this.showMessage("Item Edited","This change will be effective only when you save the form")}}return!0}},{key:"editDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),r=$("#".concat(t)).val(),n=JSON.parse(r),a={},i=0;i<n.length;i++){var o=n[i];o.id===e&&(a=o)}this.showDataGroup($("#".concat(t)).data("field"),a)}},{key:"dataGroupGetNextAutoIncrementId",value:function(e){for(var t,r=1,n=0;n<e.length;n++){var a=e[n];void 0!==a.id&&null!=a.id||(a.id=1),(t=a.id.substring(a.id.lastIndexOf("_")+1,a.id.length))>=r&&(r=parseInt(t,10)+1)}return r}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),r=$("#".concat(t)).val(),n=JSON.parse(r),a=[],i=0;i<n.length;i++){var o=n[i];o.id!==e&&a.push(o)}$("#".concat(t)).val(JSON.stringify(a)),$("#".concat(e)).remove(),this.showMessage("Item Removed","Item removed. This change will be effective only when you save the form")}},{key:"fillForm",value:function(e,t,r){var n;null!=r&&void 0!==r||(r=this.getFormFields()),null!=t&&void 0!==t&&""!==t||(t="#".concat(this.getTableName(),"Form"));for(var a=0;a<r.length;a++)if("date"===r[a][1].type)"0000-00-00"!==e[r[a][0]]&&""!==e[r[a][0]]&&null!=e[r[a][0]]&&void 0!==e[r[a][0]]&&$("".concat(t," #").concat(r[a][0],"_date")).datepicker("setValue",e[r[a][0]]);else if("colorpick"===r[a][1].type)null!=e[r[a][0]]&&void 0!==e[r[a][0]]&&($("".concat(t," #").concat(r[a][0],"_colorpick")).colorpicker("setValue",e[r[a][0]]),$("".concat(t," #").concat(r[a][0])).val(e[r[a][0]]));else if("datetime"===r[a][1].type||"time"===r[a][1].type){if("0000-00-00 00:00:00"!==e[r[a][0]]&&""!==e[r[a][0]]&&null!=e[r[a][0]]&&void 0!==e[r[a][0]]){var i=e[r[a][0]].split(" "),o=i[0].split("-"),l=i[1].split(":");$("".concat(t," #").concat(r[a][0],"_datetime")).data("datetimepicker").setLocalDate(new Date(o[0],parseInt(o[1],10)-1,o[2],l[0],l[1],l[2]))}}else if("label"===r[a][1].type)$("".concat(t," #").concat(r[a][0])).html(e[r[a][0]]);else if("placeholder"===r[a][1].type){if(void 0!==r[a][1]["remote-source"]&&null!=r[a][1]["remote-source"]){var s="".concat(r[a][1]["remote-source"][0],"_").concat(r[a][1]["remote-source"][1],"_").concat(r[a][1]["remote-source"][2]);n=this.fieldMasterData[s][e[r[a][0]]]}else n=e[r[a][0]];if(void 0===n||null==n)n="";else try{n=n.replace(/(?:\r\n|\r|\n)/g,"<br />")}catch(e){}if(void 0!==r[a][1].formatter&&r[a][1].formatter&&$.isFunction(r[a][1].formatter))try{n=r[a][1].formatter(n)}catch(e){}$("".concat(t," #").concat(r[a][0])).html(n)}else if("fileupload"===r[a][1].type)null!=e[r[a][0]]&&void 0!==e[r[a][0]]&&""!==e[r[a][0]]&&($("".concat(t," #").concat(r[a][0])).html(e[r[a][0]]),$("".concat(t," #").concat(r[a][0])).attr("val",e[r[a][0]]),$("".concat(t," #").concat(r[a][0])).show(),$("".concat(t," #").concat(r[a][0],"_download")).show(),$("".concat(t," #").concat(r[a][0],"_remove")).show()),!0===r[a][1].readonly&&$("".concat(t," #").concat(r[a][0],"_upload")).remove();else if("select"===r[a][1].type)void 0!==e[r[a][0]]&&null!=e[r[a][0]]&&""!==e[r[a][0]]||(e[r[a][0]]="NULL"),$("".concat(t," #").concat(r[a][0])).val(e[r[a][0]]);else if("select2"===r[a][1].type)void 0!==e[r[a][0]]&&null!=e[r[a][0]]&&""!==e[r[a][0]]||(e[r[a][0]]="NULL"),$("".concat(t," #").concat(r[a][0])).select2("val",e[r[a][0]]);else if("select2multi"===r[a][1].type){void 0!==e[r[a][0]]&&null!=e[r[a][0]]&&""!==e[r[a][0]]||(e[r[a][0]]="NULL");var u=[];if(void 0!==e[r[a][0]]&&null!=e[r[a][0]]&&""!==e[r[a][0]])try{u=JSON.parse(e[r[a][0]])}catch(e){}$("".concat(t," #").concat(r[a][0])).select2("val",u);var c=$("".concat(t," #").concat(r[a][0])).find(".select2-choices").height();$("".concat(t," #").concat(r[a][0])).find(".controls").css("min-height","".concat(c,"px")),$("".concat(t," #").concat(r[a][0])).css("min-height","".concat(c,"px"))}else if("datagroup"===r[a][1].type)try{var f=this.dataGroupToHtml(e[r[a][0]],r[a]);$("".concat(t," #").concat(r[a][0])).val(e[r[a][0]]),$("".concat(t," #").concat(r[a][0],"_div")).html(""),$("".concat(t," #").concat(r[a][0],"_div")).append(f),this.makeDataGroupSortable(r[a],$("".concat(t," #").concat(r[a][0],"_div_inner")))}catch(e){}else if("signature"===r[a][1].type)""===e[r[a][0]]&&void 0===e[r[a][0]]&&null==e[r[a][0]]||$("".concat(t," #").concat(r[a][0])).data("signaturePad").fromDataURL(e[r[a][0]]);else if("simplemde"===r[a][1].type)$("".concat(t," #").concat(r[a][0])).data("simplemde").value(e[r[a][0]]);else if("code"===r[a][1].type){var d=$("".concat(t," #").concat(r[a][0])).data("codemirror");d&&d.getDoc().setValue(e[r[a][0]])}else $("".concat(t," #").concat(r[a][0])).val(e[r[a][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var r=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'<font class="redFont">*</font>'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)r=r.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var n="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);r=r.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[n],e))}}else if("colorpick"===e[1].type)r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var a=this.getCurrentProfile();t=null!=a&&void 0!==a?a.id:-1*this.getUser().id,r=(r=r.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),r=(r=void 0!==e[1].filetypes&&null!=e[1].filetypes?r.replace(/_filetypes_/g,e[1].filetypes):r.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,r=(r=r.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return r=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?r.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):r.replace(/_validation_/g,""),r=void 0!==e[1].help&&null!==e[1].help?(r=r.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(r=r.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),r=void 0!==e[1].placeholder&&null!==e[1].placeholder?r.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):r.replace(/_placeholder_/g,""),r=void 0!==e[1].mask&&null!==e[1].mask?r.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):r.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var r="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?r+='<option value="NULL">'.concat(this.gt(t[1]["null-label"]),"</option>"):r+='<option value="NULL">Select</option>');var n=[];for(var a in e)n.push(e[a]);!0===t[1].sort&&n.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var i=0;i<n.length;i++){var o=n[i][0],l=n[i][1],s='<option value="_id_">_val_</option>';r+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(l))}return r}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var r="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?r+='<option value="NULL">'.concat(this.gt(t[1]["null-label"]),"</option>"):r+='<option value="NULL">Select</option>');var n=[];for(var a in e)n.push([a,e[a]]);"true"===t[1].sort&&n.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var i=0;i<n.length;i++){var o=n[i][0],l=n[i][1],s='<option value="_id_">_val_</option>';r+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(l))}return r}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var r='<div style="width:80px;">_edit__delete__clone_</div>';return r=this.showAddNew?r.replace("_clone_",'<img class="tableActionButton" src="_BASE_images/clone.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Copy" onclick="modJs.copyRow(_id_);return false;"></img>'):r.replace("_clone_",""),r=this.showDelete?r.replace("_delete_",'<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>'):r.replace("_delete_",""),r=(r=(r=this.showEdit?r.replace("_edit_",'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>'):r.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,r="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n="",a=e;a>0;--a)n+=r[Math.round(Math.random()*(r.length-1))];return n+t.getTime()}},{key:"checkFileType",value:function(e,t){var r=document.getElementById(e),n="";return r.value.lastIndexOf(".")>0&&(n=r.value.substring(r.value.lastIndexOf(".")+1,r.value.length)),n=n.toLowerCase(),!(t.split(",").indexOf(n)<0&&(r.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),r=t.toGMTString();return(t-new Date(r.substring(0,r.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var r in e)t+='<option value="__val__">__text__</option>'.replace("__val__",r).replace("__text__",e[r]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,r,n=0;n<e.length;n++)if("Hidden"!==(t=e[n]).display&&""!==t.data&&void 0!==t.data)try{if(void 0===(r=JSON.parse(t.data))||null==r)continue;if(2!==r.length)continue;if(void 0===r[1].type||null==r[1].type)continue;this.customFields.push(r)}catch(e){}}},{key:"addCustomFields",value:function(e){for(var t=0;t<this.customFields.length;t++)e.push(this.customFields[t]);return e}}])&&i(t.prototype,r),n&&i(t,n),e}();r.default=o},{"./FormValidation":36}],38:[function(e,t,r){"use strict";var n=e("./lib");window.EmployeeAdapter=n.EmployeeAdapter,window.CompanyGraphAdapter=n.CompanyGraphAdapter,window.ApiAccessAdapter=n.ApiAccessAdapter},{"./lib":39}],39:[function(e,t,r){"use strict";var n=i(e("qrcode")),a=i(e("../../../api/AdapterBase"));function i(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=m(e);if(t){var a=m(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return g(this,r)}}function g(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v=function(e){d(r,e);var t=p(r);function r(e,n,a,i){var o;return u(this,r),(o=t.call(this,e,n,a,i)).fieldNameMap={},o.hiddenFields={},o.tableFields={},o.formOnlyFields={},o.currentUserId=null,o}return f(r,[{key:"setFieldNameMap",value:function(e){for(var t,r=0;r<e.length;r++)t=e[r],this.fieldNameMap[t.name]=t,"Hidden"===t.display?this.hiddenFields[t.name]=t:"Table and Form"===t.display?this.tableFields[t.name]=t:this.formOnlyFields[t.name]=t}},{key:"getDataMapping",value:function(){return["id","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID"},{sTitle:"Employee Number"},{sTitle:"First Name"},{sTitle:"Last Name"},{sTitle:"Mobile"},{sTitle:"Department"},{sTitle:"Gender"},{sTitle:"Supervisor"}]}},{key:"getFormFields",value:function(){var e,t,r,n,a,i,o,l,s=[];e="Yes"===this.checkPermission("Edit Employee Number")?["employee_id",{label:"Employee Number",type:"text",validation:""}]:["employee_id",{label:"Employee Number",type:"placeholder",validation:""}],t="Yes"===this.checkPermission("Edit EPF/CPF Number")?["ssn_num",{label:"EPF/CPF/SS No",type:"text",validation:"none"}]:["ssn_num",{label:"EPF/CPF/SS No",type:"placeholder",validation:"none"}],r="Yes"===this.checkPermission("Edit Employment Status")?["employment_status",{label:"Employment Status",type:"select2","remote-source":["EmploymentStatus","id","name"]}]:["employment_status",{label:"Employment Status",type:"placeholder","remote-source":["EmploymentStatus","id","name"]}],n="Yes"===this.checkPermission("Edit Job Title")?["job_title",{label:"Job Title",type:"select2","remote-source":["JobTitle","id","name"]}]:["job_title",{label:"Job Title",type:"placeholder","remote-source":["JobTitle","id","name"]}],a="Yes"===this.checkPermission("Edit Pay Grade")?["pay_grade",{label:"Pay Grade",type:"select2","allow-null":!0,"remote-source":["PayGrade","id","name"]}]:["pay_grade",{label:"Pay Grade",type:"placeholder","allow-null":!0,"remote-source":["PayGrade","id","name"]}],i="Yes"===this.checkPermission("Edit Joined Date")?["joined_date",{label:"Joined Date",type:"date",validation:""}]:["joined_date",{label:"Joined Date",type:"placeholder",validation:""}],o="Yes"===this.checkPermission("Edit Department")?["department",{label:"Department",type:"select2","remote-source":["CompanyStructure","id","title"]}]:["department",{label:"Department",type:"placeholder","remote-source":["CompanyStructure","id","title"]}],l="Yes"===this.checkPermission("Edit Work Email")?["work_email",{label:"Work Email",type:"text",validation:"email"}]:["work_email",{label:"Work Email",type:"placeholder",validation:"emailOrEmpty"}];for(var u=[["id",{label:"ID",type:"hidden",validation:""}],e,["first_name",{label:"First Name",type:"text",validation:""}],["middle_name",{label:"Middle Name",type:"text",validation:"none"}],["last_name",{label:"Last Name",type:"text",validation:""}],["nationality",{label:"Nationality",type:"select2","remote-source":["Nationality","id","name"]}],["birthday",{label:"Date of Birth",type:"date",validation:""}],["gender",{label:"Gender",type:"select",source:[["Male","Male"],["Female","Female"],["Divers","Divers"]]}],["marital_status",{label:"Marital Status",type:"select",source:[["Married","Married"],["Single","Single"],["Divorced","Divorced"],["Widowed","Widowed"],["Other","Other"]]}],t,["nic_num",{label:"NIC",type:"text",validation:"none"}],["other_id",{label:"Other ID",type:"text",validation:"none"}],["driving_license",{label:"Driving License No",type:"text",validation:"none"}],r,n,a,["work_station_id",{label:"Work Station Id",type:"text",validation:"none"}],["address1",{label:"Address Line 1",type:"text",validation:"none"}],["address2",{label:"Address Line 2",type:"text",validation:"none"}],["city",{label:"City",type:"text",validation:"none"}],"Yes"===this.checkPermission("Edit Country")?["country",{label:"Country",type:"select2","remote-source":["Country","code","name"]}]:["country",{label:"Country",type:"placeholder","remote-source":["Country","code","name"]}],["province",{label:"Province",type:"select2","allow-null":!0,"remote-source":["Province","id","name"]}],["postal_code",{label:"Postal/Zip Code",type:"text",validation:"none"}],["home_phone",{label:"Home Phone",type:"text",validation:"none"}],["mobile_phone",{label:"Mobile Phone",type:"text",validation:"none"}],["work_phone",{label:"Work Phone",type:"text",validation:"none"}],l,["private_email",{label:"Private Email",type:"text",validation:"emailOrEmpty"}],i,o],c=0;c<this.customFields.length;c++)u.push(this.customFields[c]);for(var f=0;f<u.length;f++){var d=u[f];if(void 0===this.hiddenFields[d[0]]||null===this.hiddenFields[d[0]]){if(void 0!==this.fieldNameMap[d[0]]&&null!==this.fieldNameMap[d[0]]){var h=this.fieldNameMap[d[0]].textMapped;d[1].label=h}s.push(d)}}return s}},{key:"getSourceMapping",value:function(){var e=this.sourceMapping;return e.supervisor=["Employee","id","first_name+last_name"],e}},{key:"get",value:function(){var e={map:JSON.stringify(this.getSourceMapping())},t=JSON.stringify(e),r=[];r.callBackData=[],r.callBackSuccess="modEmployeeGetSuccessCallBack",r.callBackFail="modEmployeeGetFailCallBack",this.customAction("get","modules=employees",t,r)}},{key:"deleteProfileImage",value:function(e){var t={id:e},r=JSON.stringify(t),n=[];n.callBackData=[],n.callBackSuccess="modEmployeeDeleteProfileImageCallBack",n.callBackFail="modEmployeeDeleteProfileImageCallBack",this.customAction("deleteProfileImage","modules=employees",r,n)}},{key:"modEmployeeDeleteProfileImageCallBack",value:function(e){top.location.href=top.location.href}},{key:"modEmployeeGetSuccessCallBack",value:function(e){var t=this.getFormFields(),r=e[1],n=e[2];e=l(e,1)[0];for(var a=this.getCustomTemplate("myDetails.html"),i=0;i<t.length;i++)if(void 0!==this.fieldNameMap[t[i][0]]&&null!==this.fieldNameMap[t[i][0]]){var o=this.fieldNameMap[t[i][0]].textMapped;a=a.replace("#_label_".concat(t[i][0],"_#"),this.gt(o))}a=(a=a.replace(/#_.+_#/gi,"")).replace(/_id_/g,e.id),$("#".concat(this.getTableName())).html(a);for(var s=0;s<t.length;s++)$("#".concat(this.getTableName()," #").concat(t[s][0])).html(e[t[s][0]]),$("#".concat(this.getTableName()," #").concat(t[s][0],"_Name")).html(e["".concat(t[s][0],"_Name")]);$("#".concat(this.getTableName()," #supervisor_Name")).html(e.supervisor_Name);for(var u="",c=0;c<e.subordinates.length;c++)void 0!==e.subordinates[c].first_name&&null!==e.subordinates[c].first_name&&(u+="".concat(e.subordinates[c].first_name," ")),void 0!==e.subordinates[c].middle_name&&null!==e.subordinates[c].middle_name&&""!==e.subordinates[c].middle_name&&(u+="".concat(e.subordinates[c].middle_name," ")),void 0!==e.subordinates[c].last_name&&null!==e.subordinates[c].last_name&&""!==e.subordinates[c].last_name&&(u+=e.subordinates[c].last_name),u+="<br/>";if(void 0!==e.customFields&&null!==e.customFields&&Object.keys(e.customFields).length>0){var f;for(var d in e.customFields){e.customFields[d][1]||(e.customFields[d][1]=this.gt("Other Details"));var h=e.customFields[d][1].toLocaleLowerCase();if(h=h.replace(" ","_"),$("#cont_".concat(h)).length<=0){var p='<div class="panel panel-default" style="width:97.5%;"><div class="panel-heading"><h4>#_section.name_#</h4></div> <div class="panel-body" id="cont_#_section_#"> </div></div>';p=(p=p.replace("#_section_#",h)).replace("#_section.name_#",e.customFields[d][1]),$("#customFieldsCont").append($(p))}f=(f='<div class="col-xs-6 col-md-3" style="font-size:16px;"><label class="control-label col-xs-12" style="font-size:13px;">#_label_#</label><label class="control-label col-xs-12 iceLabel" style="font-size:13px;font-weight: bold;">#_value_#</label></div>').replace("#_label_#",d),f="fileupload"===e.customFields[d][2]?f.replace("#_value_#","<button onclick=\"download('".concat(e.customFields[d][0],'\');return false;" class="btn btn-mini btn-inverse" type="button">View: ').concat(d,"</button>")):f.replace("#_value_#",e.customFields[d][0]),$("#cont_".concat(h)).append($(f))}}else $("#customFieldsCont").remove();$("#".concat(this.getTableName()," #subordinates")).html(u),$("#".concat(this.getTableName()," #name")).html("".concat(e.first_name," ").concat(e.last_name)),this.currentUserId=e.id,$("#".concat(this.getTableName()," #profile_image_").concat(e.id)).attr("src",e.image),"No"===this.checkPermission("Upload/Delete Profile Image")&&($("#employeeUploadProfileImage").remove(),$("#employeeDeleteProfileImage").remove()),"No"===this.checkPermission("Edit Employee Details")&&$("#employeeProfileEditInfo").remove(),r!==n&&$("#employeeUpdatePassword").remove(),this.cancel()}},{key:"modEmployeeGetFailCallBack",value:function(e){}},{key:"editEmployee",value:function(){this.edit(this.currentUserId)}},{key:"changePassword",value:function(){$("#adminUsersModel").modal("show"),$("#adminUsersChangePwd #newpwd").val(""),$("#adminUsersChangePwd #conpwd").val(""),$("#adminUsersChangePwd_error").hide()}},{key:"changePasswordConfirm",value:function(){$("#adminUsersChangePwd_error").hide();var e=$("#adminUsersChangePwd #newpwd").val(),t=$("#adminUsersChangePwd #conpwd").val();if(t!==e)return $("#adminUsersChangePwd_error").html("Passwords don't match"),void $("#adminUsersChangePwd_error").show();var r=this.validatePassword(e);if(null!=r)return $("#adminUsersChangePwd_error").html(r),void $("#adminUsersChangePwd_error").show();var n={pwd:t},a=JSON.stringify(n),i=[];i.callBackData=[],i.callBackSuccess="changePasswordSuccessCallBack",i.callBackFail="changePasswordFailCallBack",this.customAction("changePassword","modules=employees",a,i)}},{key:"closeChangePassword",value:function(){$("#adminUsersModel").modal("hide")}},{key:"changePasswordSuccessCallBack",value:function(e,t){this.closeChangePassword(),this.showMessage("Password Change","Password changed successfully")}},{key:"changePasswordFailCallBack",value:function(e,t){this.closeChangePassword(),this.showMessage("Error",e)}}]),r}(a.default),y=function(e){d(r,e);var t=p(r);function r(e,n,a,i){var o;return u(this,r),(o=t.call(this,e,n,a,i)).nodeIdCounter=0,o}return f(r,[{key:"convertToTree",value:function(e){for(var t={id:-1,title:"",name:"",children:[]},r=null,n=0;n<e.length;n++)e[n].name=e[n].title,null!==e[n].parent&&void 0!==e[n].parent&&null!==(r=this.findParent(e,e[n].parent))&&(void 0!==r.children&&null!==r.children||(r.children=[]),r.children.push(e[n]));for(var a=0;a<e.length;a++)null!==e[a].parent&&void 0!==e[a].parent||t.children.push(e[a]);return t}},{key:"findParent",value:function(e,t){for(var r=0;r<e.length;r++)if(e[r].title===t||e[r].title===t)return e[r];return null}},{key:"createTable",value:function(e){$("#tabPageCompanyGraph").html("");var t=this.sourceData,r=this.convertToTree(t),n=[20,120,20,120],a=5e3-n[1]-n[3],i=1e3-n[0]-n[2],o=d3.layout.tree().size([i,a]);this.diagonal=d3.svg.diagonal().projection((function(e){return[e.y,e.x]})),this.vis=d3.select("#tabPageCompanyGraph").append("svg:svg").attr("width",a+n[1]+n[3]).attr("height",i+n[0]+n[2]).append("svg:g").attr("transform","translate(".concat(n[3],",").concat(n[0],")"));var l=r;l.x0=i/2,l.y0=0,this.update(l,o,l)}},{key:"update",value:function(e,t,r){var n=this,a=d3.event&&d3.event.altKey?5e3:500,i=t.nodes(r).reverse();i.forEach((function(e){e.y=180*e.depth}));var o=n.vis.selectAll("g.node").data(i,(function(e){return e.id||(e.id=++n.nodeIdCounter)})),l=o.enter().append("svg:g").attr("class","node").attr("transform",(function(t){return"translate(".concat(e.y0,",").concat(e.x0,")")})).on("click",(function(e){n.toggle(e),n.update(e,t,r)}));l.append("svg:circle").attr("r",1e-6).style("fill",(function(e){return e._children?"lightsteelblue":"#fff"})),l.append("svg:text").attr("x",(function(e){return e.children||e._children?-10:10})).attr("dy",".35em").attr("text-anchor",(function(e){return e.children||e._children?"end":"start"})).text((function(e){return e.name})).style("fill-opacity",1e-6);var s=o.transition().duration(a).attr("transform",(function(e){return"translate(".concat(e.y,",").concat(e.x,")")}));s.select("circle").attr("r",4.5).style("fill",(function(e){return e._children?"lightsteelblue":"#fff"})),s.select("text").style("fill-opacity",1);var u=o.exit().transition().duration(a).attr("transform",(function(t){return"translate(".concat(e.y,",").concat(e.x,")")})).remove();u.select("circle").attr("r",1e-6),u.select("text").style("fill-opacity",1e-6);var c=n.vis.selectAll("path.link").data(t.links(i),(function(e){return e.target.id}));c.enter().insert("svg:path","g").attr("class","link").attr("d",(function(t){var r={x:e.x0,y:e.y0};return n.diagonal({source:r,target:r})})).transition().duration(a).attr("d",n.diagonal),c.transition().duration(a).attr("d",n.diagonal),c.exit().transition().duration(a).attr("d",(function(t){var r={x:e.x,y:e.y};return n.diagonal({source:r,target:r})})).remove(),i.forEach((function(e){e.x0=e.x,e.y0=e.y}))}},{key:"toggle",value:function(e){e.children?(e._children=e.children,e.children=null):(e.children=e._children,e._children=null)}},{key:"getSourceDataById",value:function(e){for(var t=0;t<this.sourceData.length;t++)if(this.sourceData[t].id===e)return this.sourceData[t];return null}},{key:"fixCyclicParent",value:function(e){for(var t="",r=0;r<e.length;r++){var n=e[r],a=n,i={};for(i[a.id]=1;null!=a.parent&&void 0!==a.parent;){var o=this.getSourceDataById(a.parent);if(null==o)break;if(1===i[o.id]){t="".concat(n.title,"'s parent structure set to ").concat(o.title,"<br/>"),n.parent=null;break}i[o.id]=1,a=o}}return""===t||(this.showMessage("Company Structure is having a cyclic dependency","We found a cyclic dependency due to following reasons:<br/>".concat(t)),!1)}}]),r}(function(e){d(r,e);var t=p(r);function r(){return u(this,r),t.apply(this,arguments)}return f(r,[{key:"getDataMapping",value:function(){return["id","title","address","type","country","parent"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Address"},{sTitle:"Type"},{sTitle:"Country",sClass:"center"},{sTitle:"Parent Structure"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden",validation:""}],["title",{label:"Name",type:"text",validation:""}],["description",{label:"Details",type:"textarea",validation:""}],["address",{label:"Address",type:"textarea",validation:"none"}],["type",{label:"Type",type:"select",source:[["Company","Company"],["Head Office","Head Office"],["Regional Office","Regional Office"],["Department","Department"],["Unit","Unit"],["Sub Unit","Sub Unit"],["Other","Other"]]}],["country",{label:"Country",type:"select","remote-source":["Country","code","name"]}],["parent",{label:"Parent Structure",type:"select","allow-null":!0,"remote-source":["CompanyStructure","id","title"]}]]}}]),r}(a.default)),b=function(e){d(r,e);var t=p(r);function r(){return u(this,r),t.apply(this,arguments)}return f(r,[{key:"getDataMapping",value:function(){return[]}},{key:"getHeaders",value:function(){return[]}},{key:"getFormFields",value:function(){return[]}},{key:"setApiUrl",value:function(e){this.apiUrl=e}},{key:"setToken",value:function(e){this.token=e}},{key:"get",value:function(){var e=document.getElementById("apiQRcode");n.default.toCanvas(e,JSON.stringify({key:"IceHrm",url:this.apiUrl,token:this.token}),(function(e){e&&console.log(e)}))}}]),r}(a.default);t.exports={EmployeeAdapter:v,CompanyGraphAdapter:y,ApiAccessAdapter:b}},{"../../../api/AdapterBase":35,qrcode:5}]},{},[38]);
|
|
//# sourceMappingURL=employees.js.map
|