-
Notifications
You must be signed in to change notification settings - Fork 86
/
brightics-va-publish.min.js
2 lines (2 loc) · 257 KB
/
brightics-va-publish.min.js
1
2
/* Brightics VA Build 200427 */
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(t,e,n){"use strict";var r=function(t){for(var e,n=t||16,r="",i=0;i<n;i++)r+=(e="23456789abcdefghjkmnpqrstuvwxyz").charAt(Math.floor(Math.random()*e.length));return r},i={project:{id:function(){return"p"+r(15)}},model:{id:function(){return"m"+r(15)}},control:{id:function(){return"c"+r(15)}},func:{id:function(){return"f"+r(15)}},table:{id:function(){return"t"+r(15)}},link:{id:function(){return"k"+r(15)}},template:{id:function(){return"t"+r(15)}},notice:{id:function(){return"n"+r(15)}},send:{id:function(){return"s"+r(39)}},report:{id:function(t){return"r"+r(t||8)}},schedule:{id:function(){return"j"+r(15)}},file:{id:function(){return"f"+r(8)}},reportPage:{id:function(){return"rp"+r(14)}},reportContent:{id:function(){return"rc"+r(14)}},dataSource:{id:function(){return"ds"+r(14)}},udf:{id:function(t){return"udf_"+t+"_"+r(8)}},uuid:{id:function(t){return r(t)}},importedFile:{id:function(t){return"importedFile_"+r(8)}},version:{id:function(t){return"v"+r(t||15)}}};t.exports=i},function(t,e,n){"use strict";var r=n(12)();t.exports=function(t){return t!==r&&null!==t}},function(t,e,n){t.exports=function(){var t="function",e="object",n=typeof document===e?document:{},r=function(t,e){return typeof t===e},i=typeof Node===t?function(t){return t instanceof Node}:function(t){return t&&r(t,e)&&"nodeType"in t&&r(t.ownerDocument,e)},o=function(t){return t instanceof Array},a=function(t,e){o(e)?e.map(function(e){a(t,e)}):(s.isNode(e)||(e=n.createTextNode(e)),t.appendChild(e))};function s(){var i,c=arguments,u=c[0],l=c[1],p=2,d=c.length,f=s.attrMap;if(u=s.isElement(u)?u:n.createElement(u),1===d)return u;if((!r(l,e)||s.isNode(l)||o(l))&&(--p,l=null),d-p==1&&r(c[p],"string")&&void 0!==u.textContent)u.textContent=c[p];else for(;p<d;++p)if(null!=(i=c[p]))if(o(i))for(var h=0;h<i.length;++h)a(u,i[h]);else a(u,i);for(var g in l)if(f[g]){var y=f[g];typeof y===t?y(u,l[g]):u.setAttribute(y,l[g])}else r(l[g],t)?u[g]=l[g]:u.setAttribute(g,l[g]);return u}return s.attrMap={},s.isElement=function(t){return s.isNode(t)&&1===t.nodeType},s.isNode=i,"undefined"!=typeof Proxy&&(s.proxy=new Proxy(s,{get:function(t,e){return!(e in s)&&(s[e]=s.bind(null,e)),s[e]}})),s}()},function(t,e,n){"use strict";var r,i,o,a,s,c,u,l=n(5),p=n(19),d=Function.prototype.apply,f=Function.prototype.call,h=Object.create,g=Object.defineProperty,y=Object.defineProperties,m=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return p(e),i=this,r.call(this,t,n=function(){o.call(i,t,n),d.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:r=function(t,e){var n;return p(e),m.call(this,"__ee__")?n=this.__ee__:(n=v.value=h(null),g(this,"__ee__",v),v.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:o=function(t,e){var n,r,i,o;if(p(e),!m.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(o=0;i=r[o];++o)i!==e&&i.__eeOnceListener__!==e||(2===r.length?n[t]=r[o?0:1]:r.splice(o,1));else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,r,i,o;if(m.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];for(i=i.slice(),e=0;r=i[e];++e)d.call(r,this,o)}else switch(arguments.length){case 1:f.call(i,this);break;case 2:f.call(i,this,arguments[1]);break;case 3:f.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e)o[e-1]=arguments[e];d.call(i,this,o)}}},c={on:l(r),once:l(i),off:l(o),emit:l(a)},u=y({},c),t.exports=e=function(t){return null==t?h(u):y(Object(t),c)},e.methods=s},function(t,e,n){t.exports=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){if(o)return o(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){return i(e[a][1][t]||t)},c,c.exports,t,e,n,r)}return n[a].exports}for(var o=!1,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){(function(r,i,o,a,s,c,u,l,p){"use strict";function d(t,e){return function(t,e){var n;if(void 0===(n="passthrough"!==e.algorithm?m.createHash(e.algorithm):new y).write&&(n.write=n.update,n.end=n.update),g(e,n).dispatch(t),n.update||n.end(""),n.digest)return n.digest("buffer"===e.encoding?void 0:e.encoding);var r=n.read();return"buffer"===e.encoding?r:r.toString(e.encoding)}(t,e=f(t,e))}function f(t,e){if((e=e||{}).algorithm=e.algorithm||"sha1",e.encoding=e.encoding||"hex",e.excludeValues=!!e.excludeValues,e.algorithm=e.algorithm.toLowerCase(),e.encoding=e.encoding.toLowerCase(),e.ignoreUnknown=!0===e.ignoreUnknown,e.respectType=!1!==e.respectType,e.respectFunctionNames=!1!==e.respectFunctionNames,e.respectFunctionProperties=!1!==e.respectFunctionProperties,e.unorderedArrays=!0===e.unorderedArrays,e.unorderedSets=!1!==e.unorderedSets,e.unorderedObjects=!1!==e.unorderedObjects,e.replacer=e.replacer||void 0,e.excludeKeys=e.excludeKeys||void 0,void 0===t)throw new Error("Object argument required.");for(var n=0;n<v.length;++n)v[n].toLowerCase()===e.algorithm.toLowerCase()&&(e.algorithm=v[n]);if(-1===v.indexOf(e.algorithm))throw new Error('Algorithm "'+e.algorithm+'" not supported. supported values: '+v.join(", "));if(-1===b.indexOf(e.encoding)&&"passthrough"!==e.algorithm)throw new Error('Encoding "'+e.encoding+'" not supported. supported values: '+b.join(", "));return e}function h(t){return"function"==typeof t&&null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(t))}function g(t,e,n){n=n||[];var r=function(t){return e.update?e.update(t,"utf8"):e.write(t,"utf8")};return{dispatch:function(e){t.replacer&&(e=t.replacer(e));var n=typeof e;return null===e&&(n="null"),this["_"+n](e)},_object:function(e){var i,a=Object.prototype.toString.call(e),s=/\[object (.*)\]/i.exec(a);if(s=(s=s?s[1]:"unknown:["+a+"]").toLowerCase(),(i=n.indexOf(e))>=0)return this.dispatch("[CIRCULAR:"+i+"]");if(n.push(e),void 0!==o&&o.isBuffer&&o.isBuffer(e))return r("buffer:"),r(e);if("object"===s||"function"===s){var c=Object.keys(e);t.unorderedObjects&&(c=c.sort()),!1===t.respectType||h(e)||c.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(c=c.filter(function(e){return!t.excludeKeys(e)})),r("object:"+c.length+":");var u=this;return c.forEach(function(n){u.dispatch(n),r(":"),t.excludeValues||u.dispatch(e[n]),r(",")})}if(!this["_"+s]){if(t.ignoreUnknown)return r("["+s+"]");throw new Error('Unknown object type "'+s+'"')}this["_"+s](e)},_array:function(e,i){i=void 0!==i?i:!1!==t.unorderedArrays;var o=this;if(r("array:"+e.length+":"),!i||e.length<=1)return e.forEach(function(t){return o.dispatch(t)});var a=[],s=e.map(function(e){var r=new y,i=n.slice();return g(t,r,i).dispatch(e),a=a.concat(i.slice(n.length)),r.read().toString()});return n=n.concat(a),s.sort(),this._array(s,!1)},_date:function(t){return r("date:"+t.toJSON())},_symbol:function(t){return r("symbol:"+t.toString())},_error:function(t){return r("error:"+t.toString())},_boolean:function(t){return r("bool:"+t.toString())},_string:function(t){r("string:"+t.length+":"),r(t.toString())},_function:function(e){r("fn:"),h(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==t.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),t.respectFunctionProperties&&this._object(e)},_number:function(t){return r("number:"+t.toString())},_xml:function(t){return r("xml:"+t.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(t){return r("regex:"+t.toString())},_uint8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint8clampedarray:function(t){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},_int8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_int16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_uint32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_int32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_float32array:function(t){return r("float32array:"),this.dispatch(Array.prototype.slice.call(t))},_float64array:function(t){return r("float64array:"),this.dispatch(Array.prototype.slice.call(t))},_arraybuffer:function(t){return r("arraybuffer:"),this.dispatch(new Uint8Array(t))},_url:function(t){return r("url:"+t.toString())},_map:function(e){r("map:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets)},_set:function(e){r("set:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets)},_blob:function(){if(t.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function y(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}var m=t("crypto");(n=e.exports=d).sha1=function(t){return d(t)},n.keys=function(t){return d(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(t){return d(t,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(t){return d(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var v=m.getHashes?m.getHashes().slice():["sha1","md5"];v.push("passthrough");var b=["buffer","hex","binary","base64"];n.writeToStream=function(t,e,n){return void 0===n&&(n=e,e={}),g(e=f(t,e),n).dispatch(t)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_e8180ef5.js","/")},{buffer:3,crypto:5,lYpoI2:10}],2:[function(t,e,n){(function(t,e,r,i,o,a,s,c,u){!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===r||e===c?62:e===i||e===u?63:e<o?-1:e<o+10?e-o+26+26:e<s+26?e-s:e<a+26?e-a+26:void 0}var n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="+".charCodeAt(0),i="/".charCodeAt(0),o="0".charCodeAt(0),a="a".charCodeAt(0),s="A".charCodeAt(0),c="-".charCodeAt(0),u="_".charCodeAt(0);t.toByteArray=function(t){function r(t){u[p++]=t}var i,o,a,s,c,u;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=t.length;c="="===t.charAt(l-2)?2:"="===t.charAt(l-1)?1:0,u=new n(3*t.length/4-c),a=c>0?t.length-4:t.length;var p=0;for(i=0,o=0;i<a;i+=4,o+=3)r((16711680&(s=e(t.charAt(i))<<18|e(t.charAt(i+1))<<12|e(t.charAt(i+2))<<6|e(t.charAt(i+3))))>>16),r((65280&s)>>8),r(255&s);return 2===c?r(255&(s=e(t.charAt(i))<<2|e(t.charAt(i+1))>>4)):1===c&&(r((s=e(t.charAt(i))<<10|e(t.charAt(i+1))<<4|e(t.charAt(i+2))>>2)>>8&255),r(255&s)),u},t.fromByteArray=function(t){function e(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var r,i,o,a=t.length%3,s="";for(r=0,o=t.length-a;r<o;r+=3)s+=n(i=(t[r]<<16)+(t[r+1]<<8)+t[r+2]);switch(a){case 1:s+=e((i=t[t.length-1])>>2),s+=e(i<<4&63),s+="==";break;case 2:s+=e((i=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="="}return s}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,a,s,c,u,l){function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,a,s=typeof t;if("base64"===e&&"string"===s)for(t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t);t.length%4!=0;)t+="=";if("number"===s)r=O(t);else if("string"===s)r=i.byteLength(t,e);else{if("object"!==s)throw new Error("First argument needs to be a number, array or string.");r=O(t.length)}if(i._useTypedArrays?o=i._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(function(t){return D(t)||i.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}(t))for(a=0;a<r;a++)i.isBuffer(t)?o[a]=t.readUInt8(a):o[a]=t[a];else if("string"===s)o.write(t,0,e);else if("number"===s&&!i._useTypedArrays&&!n)for(a=0;a<r;a++)o[a]=0;return o}function p(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=e.length;R(a%2==0,"Invalid hex string"),r>a/2&&(r=a/2);for(var s=0;s<r;s++){var c=parseInt(e.substr(2*s,2),16);R(!isNaN(c),"Invalid hex string"),t[n+s]=c}return i._charsWritten=2*s,s}function d(t,e,n,r){return i._charsWritten=j(S(e),t,n,r)}function f(t,e,n,r){return i._charsWritten=j(function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function h(t,e,n,r){return i._charsWritten=j(M(e),t,n,r)}function g(t,e,n,r){return i._charsWritten=j(function(t){for(var e,n,r,i=[],o=0;o<t.length;o++)n=(e=t.charCodeAt(o))>>8,r=e%256,i.push(r),i.push(n);return i}(e),t,n,r)}function y(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;i++)r+=String.fromCharCode(t[i]);return r}function m(t,e,n,r){r||(R("boolean"==typeof n,"missing or invalid endian"),R(null!=e,"missing offset"),R(e+1<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(i=t[e],e+1<o&&(i|=t[e+1]<<8)):(i=t[e]<<8,e+1<o&&(i|=t[e+1])),i}function v(t,e,n,r){r||(R("boolean"==typeof n,"missing or invalid endian"),R(null!=e,"missing offset"),R(e+3<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(e+2<o&&(i=t[e+2]<<16),e+1<o&&(i|=t[e+1]<<8),i|=t[e],e+3<o&&(i+=t[e+3]<<24>>>0)):(e+1<o&&(i=t[e+1]<<16),e+2<o&&(i|=t[e+2]<<8),e+3<o&&(i|=t[e+3]),i+=t[e]<<24>>>0),i}function b(t,e,n,r){if(r||(R("boolean"==typeof n,"missing or invalid endian"),R(null!=e,"missing offset"),R(e+1<t.length,"Trying to read beyond buffer length")),!(e>=t.length)){var i=m(t,e,n,!0);return 32768&i?-1*(65535-i+1):i}}function _(t,e,n,r){if(r||(R("boolean"==typeof n,"missing or invalid endian"),R(null!=e,"missing offset"),R(e+3<t.length,"Trying to read beyond buffer length")),!(e>=t.length)){var i=v(t,e,n,!0);return 2147483648&i?-1*(4294967295-i+1):i}}function A(t,e,n,r){return r||(R("boolean"==typeof n,"missing or invalid endian"),R(e+3<t.length,"Trying to read beyond buffer length")),$.read(t,e,n,23,4)}function x(t,e,n,r){return r||(R("boolean"==typeof n,"missing or invalid endian"),R(e+7<t.length,"Trying to read beyond buffer length")),$.read(t,e,n,52,8)}function w(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+1<t.length,"trying to write beyond buffer length"),P(e,65535));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,2);a<s;a++)t[n+a]=(e&255<<8*(r?a:1-a))>>>8*(r?a:1-a)}function C(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+3<t.length,"trying to write beyond buffer length"),P(e,4294967295));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,4);a<s;a++)t[n+a]=e>>>8*(r?a:3-a)&255}function I(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+1<t.length,"Trying to write beyond buffer length"),N(e,32767,-32768)),n>=t.length||w(t,e>=0?e:65535+e+1,n,r,i)}function T(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+3<t.length,"Trying to write beyond buffer length"),N(e,2147483647,-2147483648)),n>=t.length||C(t,e>=0?e:4294967295+e+1,n,r,i)}function U(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+3<t.length,"Trying to write beyond buffer length"),k(e,3.4028234663852886e38,-3.4028234663852886e38)),n>=t.length||$.write(t,e,n,r,23,4)}function E(t,e,n,r,i){i||(R(null!=e,"missing value"),R("boolean"==typeof r,"missing or invalid endian"),R(null!=n,"missing offset"),R(n+7<t.length,"Trying to write beyond buffer length"),k(e,1.7976931348623157e308,-1.7976931348623157e308)),n>=t.length||$.write(t,e,n,r,52,8)}function F(t,e,n){return"number"!=typeof t?n:(t=~~t)>=e?e:t>=0||(t+=e)>=0?t:0}function O(t){return(t=~~Math.ceil(+t))<0?0:t}function D(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function V(t){return t<16?"0"+t.toString(16):t.toString(16)}function S(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(t.charCodeAt(n));else{var i=n;r>=55296&&r<=57343&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;a<o.length;a++)e.push(parseInt(o[a],16))}}return e}function M(t){return L.toByteArray(t)}function j(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function B(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function P(t,e){R("number"==typeof t,"cannot write a non-number as a number"),R(t>=0,"specified a negative value for writing an unsigned value"),R(t<=e,"value is larger than maximum value for type"),R(Math.floor(t)===t,"value has a fractional component")}function N(t,e,n){R("number"==typeof t,"cannot write a non-number as a number"),R(t<=e,"value larger than maximum allowed value"),R(t>=n,"value smaller than minimum allowed value"),R(Math.floor(t)===t,"value has a fractional component")}function k(t,e,n){R("number"==typeof t,"cannot write a non-number as a number"),R(t<=e,"value larger than maximum allowed value"),R(t>=n,"value smaller than minimum allowed value")}function R(t,e){if(!t)throw new Error(e||"Failed assertion")}var L=t("base64-js"),$=t("ieee754");n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=S(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=M(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding")}return n},i.concat=function(t,e){if(R(D(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new i(0);if(1===t.length)return t[0];var n;if("number"!=typeof e)for(e=0,n=0;n<t.length;n++)e+=t[n].length;var r=new i(e),o=0;for(n=0;n<t.length;n++){var a=t[n];a.copy(r,o),o+=a.length}return r},i.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i}e=Number(e)||0;var o,a=this.length-e;switch(n?(n=Number(n))>a&&(n=a):n=a,r=String(r||"utf8").toLowerCase()){case"hex":o=p(this,t,e,n);break;case"utf8":case"utf-8":o=d(this,t,e,n);break;case"ascii":o=f(this,t,e,n);break;case"binary":o=function(t,e,n,r){return f(t,e,n,r)}(this,t,e,n);break;case"base64":o=h(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=g(this,t,e,n);break;default:throw new Error("Unknown encoding")}return o},i.prototype.toString=function(t,e,n){var r,i=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):n=i.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;o++)i+=V(t[o]);return i}(i,e,n);break;case"utf8":case"utf-8":r=function(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;o<n;o++)t[o]<=127?(r+=B(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return r+B(i)}(i,e,n);break;case"ascii":r=y(i,e,n);break;case"binary":r=function(t,e,n){return y(i,e,n)}(0,e,n);break;case"base64":r=function(t,e,n){return 0===e&&n===t.length?L.fromByteArray(t):L.fromByteArray(t.slice(e,n))}(i,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}(i,e,n);break;default:throw new Error("Unknown encoding")}return r},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(t,e,n,r){var o=this;if(n||(n=0),r||0===r||(r=this.length),e||(e=0),r!==n&&0!==t.length&&0!==o.length){R(r>=n,"sourceEnd < sourceStart"),R(e>=0&&e<t.length,"targetStart out of bounds"),R(n>=0&&n<o.length,"sourceStart out of bounds"),R(r>=0&&r<=o.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var a=r-n;if(a<100||!i._useTypedArrays)for(var s=0;s<a;s++)t[s+e]=this[s+n];else t._set(this.subarray(n,n+a),e)}},i.prototype.slice=function(t,e){var n=this.length;if(t=F(t,n,0),e=F(e,n,n),i._useTypedArrays)return i._augment(this.subarray(t,e));for(var r=e-t,o=new i(r,void 0,!0),a=0;a<r;a++)o[a]=this[a+t];return o},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},i.prototype.readUInt8=function(t,e){if(e||(R(null!=t,"missing offset"),R(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return m(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return m(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return v(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return v(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(R(null!=t,"missing offset"),R(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return b(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return b(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return _(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return _(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return A(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return A(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return x(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return x(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(R(null!=t,"missing value"),R(null!=e,"missing offset"),R(e<this.length,"trying to write beyond buffer length"),P(t,255)),e>=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){w(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){w(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){C(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){C(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(R(null!=t,"missing value"),R(null!=e,"missing offset"),R(e<this.length,"Trying to write beyond buffer length"),N(t,127,-128)),e>=this.length||(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){I(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){I(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){T(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){T(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){U(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){U(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){E(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){E(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),R("number"==typeof t&&!isNaN(t),"value is not a number"),R(n>=e,"end < start"),n!==e&&0!==this.length){R(e>=0&&e<this.length,"start out of bounds"),R(n>=0&&n<=this.length,"end out of bounds");for(var r=e;r<n;r++)this[r]=t}},i.prototype.inspect=function(){for(var t=[],e=this.length,r=0;r<e;r++)if(t[r]=V(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return"<Buffer "+t.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e<n;e+=1)t[e]=this[e];return t.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var G=i.prototype;i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=G.get,t.set=G.set,t.write=G.write,t.toString=G.toString,t.toLocaleString=G.toString,t.toJSON=G.toJSON,t.copy=G.copy,t.slice=G.slice,t.readUInt8=G.readUInt8,t.readUInt16LE=G.readUInt16LE,t.readUInt16BE=G.readUInt16BE,t.readUInt32LE=G.readUInt32LE,t.readUInt32BE=G.readUInt32BE,t.readInt8=G.readInt8,t.readInt16LE=G.readInt16LE,t.readInt16BE=G.readInt16BE,t.readInt32LE=G.readInt32LE,t.readInt32BE=G.readInt32BE,t.readFloatLE=G.readFloatLE,t.readFloatBE=G.readFloatBE,t.readDoubleLE=G.readDoubleLE,t.readDoubleBE=G.readDoubleBE,t.writeUInt8=G.writeUInt8,t.writeUInt16LE=G.writeUInt16LE,t.writeUInt16BE=G.writeUInt16BE,t.writeUInt32LE=G.writeUInt32LE,t.writeUInt32BE=G.writeUInt32BE,t.writeInt8=G.writeInt8,t.writeInt16LE=G.writeInt16LE,t.writeInt16BE=G.writeInt16BE,t.writeInt32LE=G.writeInt32LE,t.writeInt32BE=G.writeInt32BE,t.writeFloatLE=G.writeFloatLE,t.writeFloatBE=G.writeFloatBE,t.writeDoubleLE=G.writeDoubleLE,t.writeDoubleBE=G.writeDoubleBE,t.fill=G.fill,t.inspect=G.inspect,t.toArrayBuffer=G.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,n){(function(n,r,i,o,a,s,c,u,l){i=t("buffer").Buffer;var p=new i(4);p.fill(0);e.exports={hash:function(t,e,n,r){return i.isBuffer(t)||(t=new i(t)),function(t,e,n){for(var r=new i(e),o=n?r.writeInt32BE:r.writeInt32LE,a=0;a<t.length;a++)o.call(r,t[a],4*a,!0);return r}(e(function(t,e){if(t.length%4!=0){var n=t.length+(4-t.length%4);t=i.concat([t,p],n)}for(var r=[],o=e?t.readInt32BE:t.readInt32LE,a=0;a<t.length;a+=4)r.push(o.call(t,a));return r}(t,r),8*t.length),n,r)}}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],5:[function(t,e,n){(function(e,r,i,o,a,s,c,u,l){function p(t,e){var n=y[t=t||"sha1"],r=[];return n||d("algorithm:",t,"is not yet supported"),{update:function(t){return i.isBuffer(t)||(t=new i(t)),r.push(t),t.length,this},digest:function(t){var o=i.concat(r),a=e?function(t,e,n){i.isBuffer(e)||(e=new i(e)),i.isBuffer(n)||(n=new i(n)),e.length>m?e=t(e):e.length<m&&(e=i.concat([e,v],m));for(var r=new i(m),o=new i(m),a=0;a<m;a++)r[a]=54^e[a],o[a]=92^e[a];var s=t(i.concat([r,n]));return t(i.concat([o,s]))}(n,e,o):n(o);return r=null,t?a.toString(t):a}}}function d(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}i=t("buffer").Buffer;var f=t("./sha"),h=t("./sha256"),g=t("./rng"),y={sha1:f,sha256:h,md5:t("./md5")},m=64,v=new i(m);v.fill(0),n.createHash=function(t){return p(t)},n.createHmac=function(t,e){return p(t,e)},n.randomBytes=function(t,e){if(!e||!e.call)return new i(g(t));try{e.call(this,void 0,new i(g(t)))}catch(t){e(t)}},function(t,e){for(var n in t)e(t[n])}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(t){n[t]=function(){d("sorry,",t,"is not implemented yet")}})}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(t,e,n){(function(n,r,i,o,a,s,c,u,l){function p(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,c=r,u=i,l=o;n=f(n,r,i,o,t[a+0],7,-680876936),o=f(o,n,r,i,t[a+1],12,-389564586),i=f(i,o,n,r,t[a+2],17,606105819),r=f(r,i,o,n,t[a+3],22,-1044525330),n=f(n,r,i,o,t[a+4],7,-176418897),o=f(o,n,r,i,t[a+5],12,1200080426),i=f(i,o,n,r,t[a+6],17,-1473231341),r=f(r,i,o,n,t[a+7],22,-45705983),n=f(n,r,i,o,t[a+8],7,1770035416),o=f(o,n,r,i,t[a+9],12,-1958414417),i=f(i,o,n,r,t[a+10],17,-42063),r=f(r,i,o,n,t[a+11],22,-1990404162),n=f(n,r,i,o,t[a+12],7,1804603682),o=f(o,n,r,i,t[a+13],12,-40341101),i=f(i,o,n,r,t[a+14],17,-1502002290),n=h(n,r=f(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=h(o,n,r,i,t[a+6],9,-1069501632),i=h(i,o,n,r,t[a+11],14,643717713),r=h(r,i,o,n,t[a+0],20,-373897302),n=h(n,r,i,o,t[a+5],5,-701558691),o=h(o,n,r,i,t[a+10],9,38016083),i=h(i,o,n,r,t[a+15],14,-660478335),r=h(r,i,o,n,t[a+4],20,-405537848),n=h(n,r,i,o,t[a+9],5,568446438),o=h(o,n,r,i,t[a+14],9,-1019803690),i=h(i,o,n,r,t[a+3],14,-187363961),r=h(r,i,o,n,t[a+8],20,1163531501),n=h(n,r,i,o,t[a+13],5,-1444681467),o=h(o,n,r,i,t[a+2],9,-51403784),i=h(i,o,n,r,t[a+7],14,1735328473),n=g(n,r=h(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=g(o,n,r,i,t[a+8],11,-2022574463),i=g(i,o,n,r,t[a+11],16,1839030562),r=g(r,i,o,n,t[a+14],23,-35309556),n=g(n,r,i,o,t[a+1],4,-1530992060),o=g(o,n,r,i,t[a+4],11,1272893353),i=g(i,o,n,r,t[a+7],16,-155497632),r=g(r,i,o,n,t[a+10],23,-1094730640),n=g(n,r,i,o,t[a+13],4,681279174),o=g(o,n,r,i,t[a+0],11,-358537222),i=g(i,o,n,r,t[a+3],16,-722521979),r=g(r,i,o,n,t[a+6],23,76029189),n=g(n,r,i,o,t[a+9],4,-640364487),o=g(o,n,r,i,t[a+12],11,-421815835),i=g(i,o,n,r,t[a+15],16,530742520),n=y(n,r=g(r,i,o,n,t[a+2],23,-995338651),i,o,t[a+0],6,-198630844),o=y(o,n,r,i,t[a+7],10,1126891415),i=y(i,o,n,r,t[a+14],15,-1416354905),r=y(r,i,o,n,t[a+5],21,-57434055),n=y(n,r,i,o,t[a+12],6,1700485571),o=y(o,n,r,i,t[a+3],10,-1894986606),i=y(i,o,n,r,t[a+10],15,-1051523),r=y(r,i,o,n,t[a+1],21,-2054922799),n=y(n,r,i,o,t[a+8],6,1873313359),o=y(o,n,r,i,t[a+15],10,-30611744),i=y(i,o,n,r,t[a+6],15,-1560198380),r=y(r,i,o,n,t[a+13],21,1309151649),n=y(n,r,i,o,t[a+4],6,-145523070),o=y(o,n,r,i,t[a+11],10,-1120210379),i=y(i,o,n,r,t[a+2],15,718787259),r=y(r,i,o,n,t[a+9],21,-343485551),n=m(n,s),r=m(r,c),i=m(i,u),o=m(o,l)}return Array(n,r,i,o)}function d(t,e,n,r,i,o){return m(function(t,e){return t<<i|t>>>32-i}(m(m(e,t),m(r,o))),n)}function f(t,e,n,r,i,o,a){return d(e&n|~e&r,t,e,i,o,a)}function h(t,e,n,r,i,o,a){return d(e&r|n&~r,t,e,i,o,a)}function g(t,e,n,r,i,o,a){return d(e^n^r,t,e,i,o,a)}function y(t,e,n,r,i,o,a){return d(n^(e|~r),t,e,i,o,a)}function m(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}var v=t("./helpers");e.exports=function(t){return v.hash(t,p,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,n){(function(t,n,r,i,o,a,s,c,u){!function(){var t,n;t=function(t){for(var e,n=new Array(t),r=0;r<t;r++)0==(3&r)&&(e=4294967296*Math.random()),n[r]=e>>>((3&r)<<3)&255;return n},this.crypto&&crypto.getRandomValues&&(n=function(t){var e=new Uint8Array(t);return crypto.getRandomValues(e),e}),e.exports=n||t}()}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,n){(function(n,r,i,o,a,s,c,u,l){function p(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n=Array(80),r=1732584193,i=-271733879,o=-1732584194,a=271733878,s=-1009589776,c=0;c<t.length;c+=16){for(var u=r,l=i,p=o,y=a,m=s,v=0;v<80;v++){n[v]=v<16?t[c+v]:g(n[v-3]^n[v-8]^n[v-14]^n[v-16],1);var b=h(h(g(r,5),d(v,i,o,a)),h(h(s,n[v]),f(v)));s=a,a=o,o=g(i,30),i=r,r=b}r=h(r,u),i=h(i,l),o=h(o,p),a=h(a,y),s=h(s,m)}return Array(r,i,o,a,s)}function d(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r}function f(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function h(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function g(t,e){return t<<e|t>>>32-e}var y=t("./helpers");e.exports=function(t){return y.hash(t,p,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,n){(function(n,r,i,o,a,s,c,u,l){var p=t("./helpers"),d=function(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n},f=function(t,e){return t>>>e|t<<32-e},h=function(t,e){return t>>>e},g=function(t,e,n){return t&e^~t&n},y=function(t,e,n){return t&e^t&n^e&n},m=function(t){return f(t,2)^f(t,13)^f(t,22)},v=function(t){return f(t,6)^f(t,11)^f(t,25)},b=function(t){return f(t,7)^f(t,18)^h(t,3)},_=function(t){return f(t,17)^f(t,19)^h(t,10)},A=function(t,e){var n,r,i,o,a,s,c,u,l,p,f=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),h=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),A=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var x=0;x<t.length;x+=16){n=h[0],r=h[1],i=h[2],o=h[3],a=h[4],s=h[5],c=h[6],u=h[7];for(var w=0;w<64;w++)A[w]=w<16?t[w+x]:d(d(d(_(A[w-2]),A[w-7]),b(A[w-15])),A[w-16]),l=d(d(d(d(u,v(a)),g(a,s,c)),f[w]),A[w]),p=d(m(n),y(n,r,i)),u=c,c=s,s=a,a=d(o,l),o=i,i=r,r=n,n=d(l,p);h[0]=d(n,h[0]),h[1]=d(r,h[1]),h[2]=d(i,h[2]),h[3]=d(o,h[3]),h[4]=d(a,h[4]),h[5]=d(s,h[5]),h[6]=d(c,h[6]),h[7]=d(u,h[7])}return h};e.exports=function(t){return p.hash(t,A,32,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(t,e,n){(function(t,n,r,i,o,a,s,c,u){function l(){}(t=e.exports={}).nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;(e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)&&n.shift()()},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=l,t.addListener=l,t.once=l,t.off=l,t.removeListener=l,t.removeAllListeners=l,t.emit=l,t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:10}],11:[function(t,e,n){(function(t,e,r,i,o,a,s,c,u){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,u=c>>1,l=-7,p=n?i-1:0,d=n?-1:1,f=t[e+p];for(p+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+p],p+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+p],p+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=u}return(f?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,s,c,u=8*o-i-1,l=(1<<u)-1,p=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,h=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=l?(s=0,a=l):a+p>=1?(s=(e*c-1)*Math.pow(2,i),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[n+f]=255&a,f+=h,a/=256,u-=8);t[n+f-h]|=128*g}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{buffer:3,lYpoI2:10}]},{},[1])(1)},function(t,e,n){"use strict";var r=n(6),i=n(14),o=n(15),a=n(16);(t.exports=function(t,e){var n,o,s,c,u;return arguments.length<2||"string"!=typeof t?(c=e,e=t,t=null):c=arguments[2],null==t?(n=s=!0,o=!1):(n=a.call(t,"c"),o=a.call(t,"e"),s=a.call(t,"w")),u={value:e,configurable:n,enumerable:o,writable:s},c?r(i(c),u):u}).gs=function(t,e,n){var s,c,u,l;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],null==e?e=void 0:o(e)?null==n?n=void 0:o(n)||(u=n,n=void 0):(u=e,e=n=void 0),null==t?(s=!0,c=!1):(s=a.call(t,"c"),c=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:c},u?r(i(u),l):l}},function(t,e,n){"use strict";t.exports=n(7)()?Object.assign:n(8)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var r=n(9),i=n(13),o=Math.max;t.exports=function(t,e){var n,a,s,c=o(arguments.length,2);for(t=Object(i(t)),s=function(r){try{t[r]=e[r]}catch(t){n||(n=t)}},a=1;a<c;++a)e=arguments[a],r(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(10)()?Object.keys:n(11)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var r=n(1),i=Object.keys;t.exports=function(t){return i(r(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var r=n(1);t.exports=function(t){if(!r(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var r=n(1),i=Array.prototype.forEach,o=Object.create;t.exports=function(t){var e=o(null);return i.call(arguments,function(t){r(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(17)()?String.prototype.contains:n(18)},function(t,e,n){"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&!0===r.contains("dwa")&&!1===r.contains("foo")}},function(t,e,n){"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"CORE_VERSION",function(){return It});var i=n(3);function o(t){}function a(t,e){o.call(this),this.$el=t,this.options=e}function s(t,e){a.call(this,t,e)}function c(t,e){s.call(this,t,e),this.listeners={},this.jqxOptions=this._brtcOptions2jqxOptions(this.options),this.keyIndex=0}function u(t,e){a.call(this,t,e)}function l(t,e){u.call(this,t,e),this.jqxOptions=this._brtcOptions2jqxOptions(e),this._initEventListener()}n.n(i)()(o.prototype),a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype.getParent=function(){return this.$el},a.prototype.getOptions=function(){return this.options},a.prototype.render=function(){throw new Error("not implemented")},a.prototype.destroy=function(){},s.prototype=Object.create(a.prototype),s.prototype.constructor=s,s.prototype.update=function(t){throw new Error("not implemented")},c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.update=function(t){this.source.localdata=t,this.$content.jqxGrid("updatebounddata"),this.options.selectable&&this.$content.jqxGrid("clearselection")},c.prototype.render=function(){return this.$template=$(['<div class="brtc-va-base-list">',' <div class="brtc-va-base-list-wrapper">',' <div class="brtc-va-base-list-content">'," </div>"," </div>","</div>"].join("\n")),this.$wrapper=this.$template.find(".brtc-va-base-list-wrapper"),this.$wrapper.perfectScrollbar(),this.$content=this.$template.find(".brtc-va-base-list-content"),this._registerAllListeners(this.listeners),this.$content.jqxGrid(this.jqxOptions),this.$el.empty(),this.$el.append(this.$template),this._initEventListeners(),this},c.prototype.destroy=function(){this.$content.jqxGrid("destroy")},c.prototype._brtcOptions2jqxOptions=function(t){var e={theme:"office"};return e.sortable=t.sortable||!1,e.selectionmode=t.selectable?"checkbox":"none",e.columnsresize=!1,e.filterable=!1,e.altrows=!1,e.showfiltercolumnbackground=!1,e.rowsheight=t.rowsHeight||53,e.columnsheight=t.rowsHeight||53,e.enabletooltips=!0,e.width=t.width||"auto",e.height=t.height||"auto",this.source=this._getSource(t.columns),e.source=new $.jqx.dataAdapter(this.source),t.data&&t.data.length&&(e.source.localdata=t.data),e.columns=this._getJqxGridColumnsOption(t.columns),e},c.prototype._getSource=function(t){var e={localdata:[],datatype:"array"};return e.datafileds=_.map(t,function(t){return{name:t.key,type:t.type||"string"}}),e},c.prototype._getJqxGridColumnsOption=function(t){var e={cellclassname:"brtc-va-base-list-grid-cell",renderer:this._getDefaultHeaderRenderer()};return _.map(t,function(t){if(t.key){var n={text:t.name,datafield:t.key,width:t.width||"auto",align:t.headerAlign||"center",cellsalign:t.dataAlign||"center",cellsrenderer:t.dataRenderer?this._getGenerativeRenderer(t.dataAlign,t.dataRenderer):this._getDefaultDataRenderer(t.type,t.dataAlign)};return _.extend({},e,n)}}.bind(this))},c.prototype._getDefaultHeaderRenderer=function(){return function(t){return'<div class="brtc-va-base-list-column-header">'+_.escape(t)+"</div>"}},c.prototype._getDefaultDataRenderer=function(t,e){var n=[this._getAlignClass(e)].join(" ");return function(e,r,i){return this._wrap("<div>"+_.escape(this._format(i,t))+"</div>",n)}.bind(this)},c.prototype._getAlignClass=function(t){return{left:"brtc-va-base-list-grid-cell-flex-left",center:"brtc-va-base-list-grid-cell-flex-center",right:"brtc-va-base-list-grid-cell-flex-right"}[t||"center"]},c.prototype._getGenerativeRenderer=function(t,e){var n=[this._getAlignClass(t)].join(" ");return function(t,r,i){var o=e(t,i);return this._wrap(this._getHtmlWithEventHandler(o,t),n)}.bind(this)},c.prototype._getHtmlWithEventHandler=function(t,e){var n=this.source.localdata[e],r=e,i=function(t){var e=$._data(t,"events");_.forOwn(e,function(e,i){var o=this._genHandlerKey();this.listeners[i]=this.listeners[i]||{},this.listeners[i][o]={fn:function(t){_.forEach(e,function(e){e.handler(t)})},data:n,index:r},t.setAttribute(i+"__key__",o)}.bind(this))}.bind(this),o=function(t){var e=t.children;i(t),_.forEach(e,function(t){i(t),o(t)})};return o(t[0]),t[0].outerHTML},c.prototype._wrap=function(t,e){return['<div class="'+e+'">',t,"</div>"].join("")},c.prototype._format=function(t,e){var n=t||"";return"date"==(e||"string")&&n?moment(n).format("YYYY-MM-DD HH:mm:ss"):n},c.prototype._genHandlerKey=function(){return parseInt(++this.keyIndex)},c.prototype._initEventListeners=function(t){this.$content.on("cellclick",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||"_checkboxcolumn"==t.args.datafield||(this.emit("cell-click",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this)),this.$content.on("rowselect",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||(this.emit("row-select",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this)),this.$content.on("rowunselect",function(t){return!(t.args.originalEvent&&t.args.originalEvent.cancel||(this.emit("row-unselect",{data:this.source.localdata[t.args.rowindex],index:t.args.rowindex}),0))}.bind(this))},c.prototype._registerAllListeners=function(t){var e=this.$content;_.forEach(["mousedown","click","change","dblclick","keydown","keyup"],function(n){e.on(n,function(e){e.preventDefault(),e.stopPropagation();var r=n+"__key__",i=(e.originalEvent||e.args.originalEvent).target.getAttribute(r);return t[n]&&t[n][i]&&(e.cancel=!0,e.data=t[n][i].data,e.index=t[n][i].index,t[n][i].fn(e)),!1})})},c.prototype.getSelectedRows=function(){var t=this.$content.jqxGrid("getselectedrowindexes");return _.map(t,function(t){return this.source.localdata[t]}.bind(this))},u.prototype=Object.create(a.prototype),u.prototype.constructor=u,u.prototype.setItems=function(t){throw new Error("not implemented")},u.prototype.getItems=function(){throw new Error("not implemented")},u.prototype.getSelectedItem=function(){throw new Error("not implemented")},u.prototype.isSelected=function(){throw new Error("not implemented")},u.prototype.isOpened=function(){throw new Error("not implemented")},u.prototype.open=function(){throw new Error("not implemented")},u.prototype.close=function(){throw new Error("not implemented")},u.prototype.enable=function(){throw new Error("not implemented")},u.prototype.disable=function(){throw new Error("not implemented")},l.prototype=Object.create(u.prototype),l.prototype.constructor=l,l.prototype._initEventListener=function(){this.$el.on("open",function(t){this.emit("open",t)}.bind(this)),this.$el.on("close",function(t){this.emit("close",t)}.bind(this)),this.$el.on("select",function(t){this.emit("select",t)}.bind(this))},l.prototype._getAutoDropDownHeight=function(t){return!(t.itemHeight*t.source.length>t.dropDownHeight)},l.prototype._brtcOptions2jqxOptions=function(t){var e={theme:"office"};return e.width=t.width||"100%",e.itemHeight=t.itemHeight||30,e.height=e.itemHeight,e.dropDownHeight=t.height||300,this.renderer=this._getRenderer(t.renderer),e.placeHolder=void 0!==t.placeHolder?t.placeHolder:"choose",this.data=t.data||[],e.source=this._getRenderedData(this.data),e.autoDropDownHeight=this._getAutoDropDownHeight(e),e},l.prototype._getRenderer=function(t){return t||function(t){return t}},l.prototype._getRenderedData=function(t){return _.map(t,this.renderer)},l.prototype.render=function(){return this.$el.jqxDropDownList(this.jqxOptions),this},l.prototype.setItems=function(t){return this.data=t,this.jqxOptions.source=this._getRenderedData(this.data),this.jqxOptions.autoDropDownHeight=this._getAutoDropDownHeight(this.jqxOptions),this.$el.jqxDropDownList({source:this.jqxOptions.source}),this},l.prototype.getItems=function(){return this.data},l.prototype.getSelectedItem=function(){if(!this.isSelected())throw new Error("not selected");return this.data[this.$el.jqxDropDownList("selectedIndex")]},l.prototype.isSelected=function(){return this.$el.jqxDropDownList("selectedIndex")>-1},l.prototype.isOpened=function(){return this.$el.jqxDropDownList("isOpened")},l.prototype.open=function(){return this.$el.jqxDropDownList("open"),this},l.prototype.close=function(){return this.$el.jqxDropDownList("close"),this},l.prototype.enable=function(){return this.$el.jqxDropDownList({disabled:!1}),this},l.prototype.disable=function(){return this.$el.jqxDropDownList({disabled:!0}),this},l.prototype.focus=function(){return this.$el.jqxDropDownList("focus"),this};var p={createListControl:function(t,e){return new c(t,e)},createDropdownControl:function(t,e){return new l(t,e)}},d={Wrapper:{ListWrapper:s,JqxListWrapper:c,DropdownWrapper:u,JqxDropdownWrapper:l},Base:a,ControlFactory:p},f=function(t){return Promise.resolve($.ajax(t))},h=function(t){return f({type:"GET",url:t})},g=function(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t};return f(n)},y=function(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t,async:!1};return f(n)},m=function(t){t.contents=Brightics.VA.Core.Utils.ModelUtils.extendModel(t.contents);var e=Object.keys(Brightics.VA.Core.Interface.Clazz);void 0!==t&&e.indexOf(t.contents.type)<0||(t.contents.title=t.label,t.contents.mid=t.id,t.contents.adjustLinks())},v=function(t){t.contents=Brightics.VA.Core.Utils.ModelUtils.extendModel(t.contents);var e=Object.keys(Brightics.VA.Core.Interface.Clazz);"undefined"!=typeof file&&e.indexOf(t.contents.type)<0||(t.contents.title=t.label,t.contents.mid=t.file_id,t.contents.version_id=t.version_id,t.contents.adjustLinks())},b=0,A=function(t){b=b||new Brightics.VA.Core.Tools.ModelMigrator.Executor;try{b.migrate(t)}catch(t){throw console.error(t),new Error("Migration failed.")}};function x(){}x.prototype.equals=function(t){throw new Error("not implemented")},x.prototype.getHashCode=function(){throw new Error("not implemented")},x.prototype.toJSON=function(){throw new Error("not implemented")},x.prototype.getResourceName=function(){throw new Error("not implemented")};var w=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t};function C(t){this.data=t||{},this.data.update_time&&(this.data.update_time=new Date(moment(this.data.update_time).format())),this.data.create_time&&(this.data.create_time=new Date(moment(this.data.create_time).format())),this.data.contents?(m(this.data),A(this.data.contents)):this.data.contents={}}w(C,x),C.prototype.getFileId=function(){return this.data.id},C.prototype.setFileId=function(t){return this.data.id=t,this.data.contents.mid=t,this},C.prototype.getDescription=function(){return this.data.description},C.prototype.setDescription=function(t){return this.data.description=t,this},C.prototype.getType=function(){return this.data.type},C.prototype.setType=function(t){return this.data.type=t,this},C.prototype.getEventKey=function(){return this.data.event_key},C.prototype.setEventKey=function(t){return this.data.event_key=t,this},C.prototype.getLabel=function(){return this.data.label},C.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this},C.prototype.getProjectId=function(){return this.data.project_id},C.prototype.setProjectId=function(t){return this.data.project_id=t,this},C.prototype.getUpdateTime=function(){return new Date(this.data.update_time)},C.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},C.prototype.getCreateTime=function(){return new Date(this.data.create_time)},C.prototype.setCreateTime=function(t){return this.data.create_time=t,this},C.prototype.getUpdater=function(){return this.data.updater},C.prototype.setUpdater=function(t){return this.data.updater=t,this},C.prototype.getCreator=function(){return this.data.creator},C.prototype.setCreator=function(t){return this.data.creator=t,this},C.prototype.getFromVersion=function(){return this.data.from_version},C.prototype.setFromVersion=function(t){return this.data.from_version=t,this},C.prototype.getModelImage=function(){return this.data.model_image},C.prototype.setModelImage=function(t){return this.data.model_image=t,this},C.prototype.setContents=function(t){return this.data.contents=t,this.data.contents.title=this.data.label,m(this.data),A(this.data.contents),this},C.prototype.getContents=function(t){return this.data.contents},C.prototype.toJSON=function(){return this.data},C.prototype.getHashCode=function(){return this.getFileId()},C.prototype.equals=function(t){return this.getFileId()==t.getFileId()&&this.getEventKey()==t.getEventKey()&&Number(this.getUpdateTime())==Number(t.getUpdateTime())},C.prototype.getResourceName=function(){return"file"},C.prototype.getInnerModels=function(){return this.data.contents.innerModels},C.prototype.getInnerModel=function(t){if(this.data.contents.innerModels)return this.data.contents.innerModels[t]},C.prototype.getParam=function(){return this.data.contents.param},C.prototype.setParam=function(t,e){this.data.contents.param[t]=e};var I=n(4),T=n.n(I);const{map:U,compact:E,first:F,flow:O}=_,D=t=>{try{return new C(t)}catch(t){return void console.warn("Some files are ignored.")}},V=t=>E(U(t,D)),S=O(F,D),M={getFiles:function(t){return h(`api/va/v2/ws/projects/${t}/files`).then(V)},getFile:function(t,e){return h(`api/va/v2/ws/projects/${t}/files/${e}`).then(t=>t.length?S(t):null)},addFile:function(t,e){return g(`api/va/v2/ws/projects/${t}/files`,e.toJSON())},updateFile:function(t,e){const n=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/update`;return g(n,e.toJSON()).then(S)},updateFileSync:function(t,e){const n=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/update`;return y(n,e.toJSON()).then(S)},deleteFile:function(t,e){return g(`api/va/v2/ws/projects/${t}/files/${e}/delete`)},saveFileSync:function(t,e,n){const r=`api/va/v2/ws/projects/${t}/files/${e.getFileId()}/save`,i=(o=e.getContents(),JSON.parse(JSON.stringify(o)));var o;const a=Object.assign(_.omit(e.toJSON(),"contents"),{modelDiff:n,hash:T()(i,{respectFunctionProperties:!1,respectFunctionNames:!1,respectType:!1})});return y(r,a).then(F)}};function j(t){this.data=t||{}}w(j,x),j.prototype.getProjectId=function(){return this.data.id},j.prototype.setProjectId=function(t){return this.data.id=t,this},j.prototype.getLabel=function(){return this.data.label},j.prototype.setLabel=function(t){return this.data.label=t,this},j.prototype.getUpdateTime=function(){return new Date(moment(this.data.update_time).format())},j.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},j.prototype.getCreateTime=function(){return new Date(moment(this.data.create_time).format())},j.prototype.setCreateTime=function(t){return this.data.create_time=t,this},j.prototype.getCreator=function(){return this.data.creator},j.prototype.setCreator=function(t){return this.data.creator=t,this},j.prototype.getUpdater=function(){return this.data.updater},j.prototype.setUpdater=function(t){return this.data.updater=t,this},j.prototype.getDescription=function(){return this.data.description},j.prototype.setDescription=function(t){return this.data.description=t,this},j.prototype.getModelCount=function(){return parseInt(this.data.model_count)},j.prototype.setModelCount=function(t){return this.data.model_count=t,this},j.prototype.getReportCount=function(){return parseInt(this.data.report_count)},j.prototype.setReportCount=function(t){return this.data.report_count=t,this},j.prototype.getTag=function(){return this.data.tag},j.prototype.setTag=function(t){return this.data.tag=t,this},j.prototype.getType=function(){return this.data.type},j.prototype.setType=function(t){return this.data.type=t,this},j.prototype.toJSON=function(){return this.data},j.prototype.equals=function(t){return this.getProjectId()==t.getProjectId()&&Number(this.getUpdateTime())==Number(t.getUpdateTime())},j.prototype.getHashCode=function(){return this.getProjectId()},j.prototype.getResourceName=function(){return"project"};var B=function(t){return new j(t)},P=function(t){return _.map(t,B)},N={getProjects:function(){return h("api/va/v2/ws/projects").then(P)},getProject:function(t){return h("api/va/v2/ws/projects/"+t).then(function(t){return B(t[0])})},addProject:function(t){return g("api/va/v2/ws/projects",t.toJSON()).then(B)},updateProject:function(t){var e="api/va/v2/ws/projects/"+t.getProjectId()+"/update";return g(e,t.toJSON()).then(B)},deleteProject:function(t){return g("api/va/v2/ws/projects/"+t+"/delete")}};function k(t){this.data=t||{},this.data.contents?(v(this.data),A(this.data.contents)):this.data.contents={}}w(k,x),k.prototype.getVersionId=function(){return this.data.version_id},k.prototype.setVersionId=function(t){return this.data.version_id=t,this.data.contents.version_id=t,this},k.prototype.getLabel=function(){return this.data.label},k.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this},k.prototype.getDescription=function(){return this.data.description},k.prototype.setDescription=function(t){return this.data.description=t,this},k.prototype.getFileId=function(){return this.data.file_id},k.prototype.setFileId=function(t){return this.data.file_id=t,this.data.contents.mid=t,this},k.prototype.getMajorVersion=function(){return this.data.major_version},k.prototype.setMajorVersion=function(t){return this.data.major_version=t,this},k.prototype.getMinorVersion=function(){return this.data.minor_version},k.prototype.setMinorVersion=function(t){return this.data.minor_version=t,this},k.prototype.getVersion=function(){return this.data.major_version+"."+this.data.minor_version},k.prototype.getType=function(){return this.data.type},k.prototype.setType=function(t){return this.data.type=t,this},k.prototype.getTags=function(){return this.data.tags},k.prototype.setTags=function(t){return this.data.tags=t,this},k.prototype.getModelImage=function(){return this.data.model_image},k.prototype.setModelImage=function(t){return this.data.image=t,this},k.prototype.getUpdateTime=function(){return new Date(moment(this.data.update_time).format())},k.prototype.setUpdateTime=function(t){return this.data.update_time=t,this},k.prototype.getUpdater=function(){return this.data.updater},k.prototype.setUpdater=function(t){return this.data.updater=t,this},k.prototype.getCreateTime=function(){return new Date(moment(this.data.create_time).format())},k.prototype.setCreateTime=function(t){return this.data.create_time=t,this},k.prototype.getCreator=function(){return this.data.creator},k.prototype.setCreator=function(t){return this.data.creator=t,this},k.prototype.getContents=function(){return this.data.contents},k.prototype.setContents=function(t){return this.data.contents=t,v(this.data),A(this.data.contents),this},k.prototype.toJSON=function(t){return t?this.data:_.omit(this.data,["isManual","isMajor"])},k.prototype.setIsMajor=function(t){return this.data.isMajor=t,this},k.prototype.setIsManual=function(t){return this.data.isManual=t,this},k.prototype.compareToByVersion=function(t){return this.getMajorVersion()!==t.getMajorVersion()?this.getMajorVersion()-t.getMajorVersion():this.getMinorVersion()-t.getMinorVersion()},k.prototype.equals=function(t){return this.getVersionId()===t.getVersionId()&&Number(this.getUpdateTime())===Number(t.getUpdateTime())},k.prototype.getHashCode=function(){return this.getVersionId()},k.prototype.getResourceName=function(){return"version"};var R=function(t){return new k(t)},L=function(t){return _.map(t,R)},G={getVersions:function(t,e){return h("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions").then(L)},getVersion:function(t,e,n){return h("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n).then(R)},addVersion:function(t,e,n){return g("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",n.toJSON(!0)).then(R)},updateVersion:function(t,e,n){var r="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n.getVersionId()+"/update";return g(r,n)},loadVersion:function(t,e,n){return g("api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n+"/load").then(function(t){if(t.length)return new C(t[0])})},getVersionsForced:function(t,e,n,r){var i={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",contentType:"application/json; charset=utf-8"};return $.ajax(i).done(function(t){if(n&&"function"==typeof n)return n(L(t))}).fail(function(t){if(r&&"function"==typeof r)return r(t)})},getVersionForced:function(t,e,n,r,i){var o={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n,contentType:"application/json; charset=utf-8"};return $.ajax(o).done(function(t){if(r&&"function"==typeof r)return r(R(t))}).fail(function(t){if(i&&"function"==typeof i)return i(t)})}},q=function(t){return h("api/admin/v2/s3/"+t)},W={DB:{getDbTypes:function(){return h("api/admin/v2/datasources/dbtype")},getDatasources:function(){return h("api/admin/v2/datasources")},getDatasource:function(t){return h("api/admin/v2/datasources/"+t)},addDatasource:function(t){var e="api/admin/v2/datasources/"+t.datasourceName;return g(e,t)},updateDatasource:function(t){var e="api/admin/v2/datasources/"+t.datasourceName+"/update";return g(e,t)},deleteDatasource:function(t){return g("api/admin/v2/datasources/"+t+"/delete")}},Cloud:{getS3s:function(){return h("api/admin/v2/s3")},getS3:q,addS3:function(t){var e="api/admin/v2/s3/"+t.datasourceName;return q(t.datasourceName).then(function(n){if(n)throw{errors:[{code:500,message:"Datasource name already exists."}]};return g(e,t)})},updateS3:function(t){var e="api/admin/v2/s3/"+t.datasourceName+"/update";return g(e,t)},deleteS3:function(t){return g("api/admin/v2/s3/"+t+"/delete")}}};function J(){this.map={},this.chk={}}function z(t,e){o.call(this),this.key=t,this.data=e,this.__parentNode=this,this.__childrenNodes=[],this.__childrenMap=new J}function K(){this.__root=new z}J.prototype.set=function(t,e){this.map[t]=e,this.chk[t]=!0},J.prototype.get=function(t){return this.map[t]},J.prototype.remove=function(t){var e=this.map[t];return this.chk[t]=!1,delete this.map[t],e},J.prototype.has=function(t){return this.chk[t]},J.prototype.toArray=function(){return _.toArray(this.map)},J.prototype.toJSON=function(){return this.map},w(z,o),z.prototype.hasChild=function(t){return this.__childrenMap.has(t)},z.prototype.setData=function(t){return this.data=t,this},z.prototype.getData=function(){return this.data},z.prototype.getKey=function(){return this.key},z.prototype.setParent=function(t){this.__patrentNode=t},z.prototype.getParent=function(){return this.__parentNode},z.prototype.addChild=function(t,e){if(this.__childrenMap.has(t))return this.__childrenMap.get(t).setData(e);var n=new z(t,e);return n.setParent(this),this.__childrenMap.set(t,n),this.__childrenNodes.push(n),n},z.prototype.deleteChild=function(t){var e=this.__childrenMap.remove(t);return _.remove(this.__childrenNodes,function(e){return e.getKey()==t}),e},z.prototype.updateChild=function(t,e){return this.__childrenMap.get(t).setData(e)},z.prototype.getChildren=function(){return _.map(this.__childrenNodes,function(t){return t.getData()})},z.prototype.getChildrenNodes=function(){return this.__childrenNodes},z.prototype.getChildrenMap=function(){return _.forIn(this.__childrenMap.toJSON(),function(t){return t.getData()})},z.prototype.go=function(t){return this.__childrenMap.get(t)},z.prototype.getChild=function(t){return this.__childrenMap.get(t)},z.prototype.findChildNodeBruteForce=function(t){var e=_.findIndex(this.__childrenNodes,function(e){return t(e)});return e>-1?this.__childrenNodes[e]:null},w(K,o),K.prototype.getRootNode=function(){return this.__root},K.prototype.getProjectNode=function(t){return this.__root.go(t)},K.prototype.getProjectNodeBruteForce=function(t){return this.getRootNode().findChildNodeBruteForce(t)},K.prototype.getProjectNodeByFileId=function(t){return this.getProjectNodeBruteForce(function(e){return e.hasChild(t)})},K.prototype.getFileNode=function(t,e){return t?this.getProjectNode(t).go(e):(console.warn("NO PROJECT ID"),this.getProjectNodeByFileId(e).go(e))},K.prototype.getVersionNode=function(t,e,n){return this.getFileNode(t,e).go(n)},K.prototype.getProjectMap=function(){return this.getRootNode().getChildrenMap()},K.prototype.getProjectArray=function(){return this.getRootNode().getChildren()},K.prototype.getFileMap=function(t){return this.getProjectNode(t).getChildrenMap()},K.prototype.getFileArray=function(t){return this.getProjectNode(t).getChildren()},K.prototype.getVersionMap=function(t,e){return this.getFileNode(t,e).getChildrenMap()},K.prototype.getVersionArray=function(t,e){return this.getFileNode(t,e).getChildren()},K.prototype.getProjects=function(){try{return this.getRootNode().getChildren()}catch(t){return}},K.prototype.getProject=function(t){var e=this.getProjectNode(t);if(e)return e.getData()},K.prototype.getFiles=function(t){try{return this.getProjectNode(t).getChildren()}catch(t){return}},K.prototype.getFile=function(t,e){try{return this.getFileNode(t,e).getData()}catch(t){return}},K.prototype.getVersions=function(t,e){try{return this.getFileNode(t,e).getChildren()}catch(t){return}},K.prototype.getVersion=function(t,e,n){try{return this.getVersionNode(t,e,n).getData()}catch(t){return}},K.prototype.updateProject=function(t){return this.getProjectNode(t.getProjectId()).setData(t)},K.prototype.updateFile=function(t,e){return this.getFileNode(t,e.getFileId()).setData(e)},K.prototype.updateVersion=function(t,e,n){return this.getVersionNode(t,e,n.getVersionId()).setData(n)},K.prototype.addProject=function(t){return this.getRootNode().addChild(t.getProjectId(),t)},K.prototype.addFile=function(t,e){return this.getProjectNode(t).addChild(e.getFileId(),e)},K.prototype.addVersion=function(t,e,n){return this.getFileNode(t,e).addChild(n.getVersionId(),n)},K.prototype.deleteProject=function(t){return this.getRootNode().deleteChild(t).getData()},K.prototype.deleteFile=function(t,e){return this.getProjectNode(t).deleteChild(e).getData()},K.prototype.deleteVersion=function(t,e,n){return this.getFileNode(t,e).deleteChild(n).getData()};var H=function(t){return _.reduce(t,function(t,e){return t.then(function(t){return e(t)})},Promise.resolve())},Y=function(t){return Promise.all(_.map(t,function(t){return t()}))},Q=function(t,e){return _.forEach(t,e)};function Z(){this.validateVersion={3.5:this.validateVersion3_5,3.6:this.validateVersion3_5}}Z.prototype.getValidateFunction=function(t){return this.validateVersion[t]||this.validateLegacy},Z.prototype.validate=function(t,e){return this.getValidateFunction(t.version)(t,e)},Z.prototype.validateLegacy=function(t,e){var n="Invalid Model File.",r="",i=["data","control","visual","deeplearning"];"Report"===e&&(n="Invalid Report File.");try{if(t instanceof Array){var o=[];for(var a in t){if(void 0===t[a].mid||-1===i.indexOf(t[a].type)){r=n;break}"visual"===t[a].type&&o.push(t[a])}("Report"===e&&0===o.length||"Model"===e&&o.length>0)&&(r=n)}else void 0===t.mid?r=t.jid?"Runnable Model File.":n:("Report"===e&&"visual"!==t.type||"Model"===e&&"visual"===t.type||-1===i.indexOf(t.type))&&(r=n);return r}catch(t){return"Invalid Model(.json) File."}},Z.prototype.validateVersion3_5=function(t,e){var n="";return t.main&&t.models?n="Runnable Model File.":0===t.data.length?n="Invalid Model File.":"project"===t.type&&(n="Project File."),n};var X=new Z,tt="project:add",et="project:change",nt="project:delete",rt="file:add",it="file:change",ot="file:delete",at="version:add",st="version:change",ct="version:delete";function ut(){o.call(this),this.projectTree=new K}w(ut,o),ut.prototype.initProject=function(t){var e=this;return this.fetchFiles(t.getProjectId()).then(function(t){return Promise.all(_.map(t,e.initFile.bind(e)))})},ut.prototype.initFile=function(t){return this.fetchVersions(t.getProjectId(),t.getFileId())},ut.prototype._getResourceDiff=function(t,e){var n=_.compact(_.flatten(t)),r=new J,i=[];return Q(n,function(t){r.set(t.getHashCode(),t)}),Q(e,function(t){var e=t.getHashCode();r.has(e)?(r.get(e).equals(t)||i.push({type:"change",data:t}),r.remove(e)):i.push({type:"add",data:t})}),Q(r.toArray(),function(t){i.push({type:"delete",data:t})}),i},ut.prototype._syncProject=function(t){var e=this;Q(t,function(t){var n=t.data;"add"==t.type&&e._addProject(n),"change"==t.type&&e._updateProject(n),"delete"==t.type&&e._deleteProject(n.getProjectId())})},ut.prototype._syncFile=function(t){var e=this;Q(t,function(t){var n=t.data;"add"==t.type&&e._addFile(n.getProjectId(),n),"change"==t.type&&e._updateFile(n.getProjectId(),n),"delete"==t.type&&e._deleteProject(n.getProjectId(),n.getFileId())})},ut.prototype._syncVersion=function(t){var e=this;Q(t,function(t){var n=t.data,r=e.projectTree.getProjectNodeByFileId(n.getFileId()).getData().getProjectId();"add"==t.type&&e._addVersion(r,n.getFileId(),n),"change"==t.type&&e._updateVersion(r,n.getFileId(),n)})},ut.prototype._updateProject=function(t){this.projectTree.updateProject(t),this.emit(et,t)},ut.prototype._addProject=function(t){this.projectTree.addProject(t),this.emit(tt,t)},ut.prototype._deleteProject=function(t){var e=this.projectTree.deleteProject(t);return this.emit(nt,e),e},ut.prototype._updateFile=function(t,e){return this.projectTree.updateFile(t,e),this.emit(it,e),e},ut.prototype._addFile=function(t,e){return this.projectTree.addFile(t,e),this.emit(rt,e),e},ut.prototype._deleteFile=function(t,e){var n=this.projectTree.deleteFile(t,e);return this.emit(ot,n),n},ut.prototype._updateVersion=function(t,e,n){return this.projectTree.updateVersion(t,e,n),this.emit(st,n),n},ut.prototype._addVersion=function(t,e,n){return this.projectTree.addVersion(t,e,n),this.emit(at,n),n},ut.prototype._deleteVersion=function(t,e,n){var r=this.projectTree.addVersion(t,e,n);return this.emit(ct,r),r},ut.prototype.fetchProject=function(t){var e=this;return N.getProject(t).then(function(n){var r=e.projectTree.getProject(t);return e._syncProject(e._getResourceDiff([r],[n])),n}).catch(function(t){throw console.error(t),new Error("failed to fetch project")})},ut.prototype.fetchProjects=function(){var t=this;return N.getProjects().then(function(e){var n=t.projectTree.getProjects();return t._syncProject(t._getResourceDiff([n],e)),e}).catch(function(t){throw new Error("failed to fetch projects")})},ut.prototype.fetchFiles=function(t){var e=this;return M.getFiles(t).then(function(n){var r=e.projectTree.getFiles(t);return e._syncFile(e._getResourceDiff([r],n)),n})},ut.prototype.fetchFile=function(t,e){var n=this;return M.getFile(t,e).then(function(r){var i=n.projectTree.getFile(t,e);return n._syncFile(n._getResourceDiff([i],[r])),r}).catch(function(t){throw new Error("filed to fetch file")})},ut.prototype.fetchVersions=function(t,e){var n=this;return G.getVersions(t,e).then(function(t){var r=n.projectTree.getProjectNodeByFileId(e).getData().getProjectId(),i=n.projectTree.getVersions(r,e);return n._syncVersion(n._getResourceDiff([i],t)),t}).catch(function(t){throw new Error("failed to fetch versions")})},ut.prototype.fetchVersion=function(t,e,n){var r=this;return G.getVersion(t,e,n).then(function(i){var o=r.projectTree.getVersion(t,e,n);return r._syncVersion(r._getResourceDiff([o],[i])),i}).catch(function(t){throw new Error("filed to fetch version")})},ut.prototype.build=function(){var t=this;return this.fetchProjects().then(function(e){return Promise.all(_.map(e,t.initProject.bind(t)))})},ut.prototype.getProjects=function(){return this.projectTree.getProjects()},ut.prototype.getProject=function(t){return this.projectTree.getProject(t)},ut.prototype.addProject=function(t){var e=this;return N.addProject(t).then(function(){return e._addProject(t),t}).catch(function(t){throw console.error(t),t})},ut.prototype.updateProject=function(t){var e=this;return N.updateProject(t).then(function(){return e._updateProject(t),t}).catch(function(t){throw console.error(t),t})},ut.prototype.deleteProject=function(t){var e=this;return N.deleteProject(t).then(function(){return e._deleteProject(t)}).catch(function(t){throw console.error(t),t})},ut.prototype.getFiles=function(t){return this.projectTree.getFiles(t)},ut.prototype.getFilesByModelType=function(t,e){return _.filter(this.getFiles(t),function(t){return t.getContents().type==e})},ut.prototype.getFile=function(t,e){return this.projectTree.getFile(t,e)},ut.prototype.addFile=function(t,e){var n=this;return M.addFile(t,e).then(function(){return n._addFile(t,e),e}).catch(function(t){throw console.error(t),t})},ut.prototype.updateFile=function(t,e){var n=this;return this.lastQuery=this.lastQuery||Promise.resolve(),this.lastQuery=this.lastQuery.then(function(){return new Promise(function(r,i){M.updateFileSync(t,e).then(function(i){e.setEventKey(i.getEventKey()),e.setUpdateTime(i.getUpdateTime()),n._updateFile(t,e),r([null,e])}).catch(function(t){console.error(t),r([t,e])})})}),this.lastQuery},ut.prototype.saveFile=function(t,e,n){return this.lastQuery=this.lastQuery||Promise.resolve(),this.lastQuery=this.lastQuery.then(()=>M.saveFileSync(t,e,n).then(n=>{if(n){const{event_key:r,update_time:i}=n;return e.setEventKey(r),e.setUpdateTime(i),this._updateFile(t,e),e}return new Promise(n=>{M.updateFileSync(t,e).then(r=>{e.setEventKey(r.getEventKey()),e.setUpdateTime(r.getUpdateTime()),this._updateFile(t,e),n([null,e])}).catch(function(t){console.error(t),n([t,e])})})}).catch(function(t){throw console.error(t),t})),this.lastQuery},ut.prototype.deleteFile=function(t,e){var n=this;return M.deleteFile(t,e).then(function(){return n._deleteFile(t,e)}).catch(function(t){throw console.error(t),t})},ut.prototype.getVersions=function(t,e){return this.projectTree.getVersions(t,e)},ut.prototype.getVersion=function(t,e,n){return this.projectTree.getVersion(t,e,n)},ut.prototype.addVersion=function(t,e,n){var r=this;return G.addVersion(t,e,n).then(function(n){return r._addVersion(t,e,n),n}).catch(function(t){throw console.error(t),t})},ut.prototype.updateVersion=function(t,e,n){var r=this;return G.updateVersion(t,e,n).then(function(){return r._updateVersion(t,e,n),n}).catch(function(t){throw console.error(t),t})},ut.prototype.loadVersion=function(t,e,n){var r=this;return G.loadVersion(t,e,n).then(function(e){return r._updateFile(t,e),e}).catch(function(t){throw console.error(t),t})},ut.prototype.validateFile=function(t,e){return X.validate(t,e)};var lt=new ut;const pt="table",dt={"1.0":{in:{data:"inData"},out:{data:"outData"}},3.5:{in:{data:"inData"},out:{data:"outData"}},3.6:{in:{data:"inputs"},out:{data:"outputs"}}};function ft(){o.call(this)}w(ft,o),ft.prototype.getMeta=function(t){return t.meta?t.meta:void 0},ft.prototype.getVersion=function(t){return t.version?t.version:"1.0"},ft.prototype._getVersionPath=function(t){var e=this.getVersion(t);return dt[e]},ft.prototype._getPath=function(t,e,n){var r=this._getVersionPath(t);return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(r,[e,n])},ft.prototype.getInputs=function(t){var e=this._getPath(t,"in","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ft.prototype.getOutputs=function(t){var e=this._getPath(t,"out","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ft.prototype.getInputsToObject=function(t){if(!t)return{};var e={},n=this.getInputs(t);if(this.hasMeta(t))for(var r in n)e[n[r]]=r;else{var i=this.getLabel(t);for(var o in n)e[n[o]]="["+o+"]"+i}return e},ft.prototype.getOutputsToObject=function(t){if(!t)return{};var e={},n=this.getOutputs(t);if(this.hasMeta(t))for(var r in n)if(Array.isArray(n[r]))for(var i in n[r])e[n[r][i]]=r;else e[n[r]]=r;else{var o=this.getLabel(t);for(var i in n)e[n[i]]="["+i+"]"+o}return e},ft.prototype.getInData=function(t,e){var n=[],r=this.getMeta(t),i=this.getInputs(t);if(r)for(var o in i)i[o]&&(e?r[o].type===e&&(n=n.concat(i[o])):n=n.concat(i[o]));else e?e===pt&&(n=i):n=i;return n},ft.prototype.getOutData=function(t,e){var n=[],r=this.getMeta(t),i=this.getOutputs(t);if(r)for(var o in i)i[o]&&(e?r[o].type===e&&(n=n.concat(i[o])):n=n.concat(i[o]));else e?e===pt&&(n=i):n=i;return n},ft.prototype._getData=function(t){var e=t=>_.isUndefined(t)?[]:_.isString(t)?[t]:_.isArray(t)?t.map(t=>e(t)):Object.values(t).map(t=>e(t));return _.compact(_.flattenDeep([e(t.inputs||[]),e(t.outputs||[])]))},ft.prototype.getAllData=function(t){return _.union(this.getInData(t),this.getOutData(t),this._getData(t))},ft.prototype.getData=function(t,e){return"in"===e?this.getInData(t):this.getOutData(t)},ft.prototype.getInputTypes=function(t){var e=this.getMeta(t);if(!e)return[pt];var n=[],r=this.getInputs(t);for(var i in r)n.indexOf(e[i].type)<0&&n.push(e[i].type);return n},ft.prototype.getOutputTypes=function(t){var e=this.getMeta(t);if(!e)return[pt];var n=[],r=this.getOutputs(t);for(var i in r)n.indexOf(e[i].type)<0&&n.push(e[i].type);return n},ft.prototype.getTypes=function(t,e){return"in"===e?this.getInputTypes(t):this.getOutputTypes(t)},ft.prototype.getKeyByTableId=function(t,e){if(!t)return"";if(!this.getMeta(t))return"";var n=_.assign({},this.getInputs(t),this.getOutputs(t));for(var r in n)if(n[r].indexOf(e)>-1)return r},ft.prototype.getTypeByTableId=function(t,e){if(!t)return"";var n=this.getMeta(t);if(!n)return pt;var r=_.assign({},this.getInputs(t),this.getOutputs(t));for(var i in r)if(r[i].indexOf(e)>-1)return n[i].type;return""},ft.prototype.getTypeByKey=function(t,e){if(!t)return"";var n=this.getMeta(t);return n?n[e].type:pt},ft.prototype.getInTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&n[i].type===pt&&r[i]&&(e=e.concat(r[i]))}else e=t[IN_DATA];return e},ft.prototype.getInTableByKeys=function(t,e){var n=[],r=this.getMeta(t);if(r){var i,o=this.getInputs(t);for(let t=0;t<e.length;t++)o[i=e[t]]&&r[i].type===pt&&o[i]&&(n=n.concat(o[i]))}return n},ft.prototype.getOutTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&n[i].type===pt&&r[i]&&(e=e.concat(r[i]))}else e=t[OUT_DATA];return e},ft.prototype.getInModel=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&"model"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ft.prototype.getOutModel=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&"model"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ft.prototype.getInImage=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r)r[i]&&"image"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ft.prototype.getOutImage=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r)r[i]&&"image"===n[i].type&&r[i]&&(e=e.concat(r[i]))}return e},ft.prototype.getPreviousFnUnits=function(t){var e=this,n=[],r=this.getParent(t),i=r.getPrevious(t.fid);return _.forEach(i,function(t){var i=r.getFnUnitById(t),o=e.isProcessFunction(i)?r.getAllPreviousFnUnits(i.fid):[i];n=_.union(n,o)}),n},ft.prototype.getLinkedTable=function(t){var e=this,n=[],r=this.getPreviousFnUnits(t);return _.forEach(r,function(t){n=n.concat(e.getOutTable(t))}),n},ft.prototype.getTable=function(t,e){return"in"===e?this.getInTable(t):this.getOutTable(t)},ft.prototype.getModel=function(t,e){return"in"===e?this.getInModel(t):this.getOutModel(t)},ft.prototype.getImage=function(t,e){return"in"===e?this.getInImage(t):this.getOutImage(t)},ft.prototype.hasMeta=function(t){return!!t.meta},ft.prototype.hasInput=function(t){var e=this._getPath(t,"in","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ft.prototype.hasOutput=function(t){var e=this._getPath(t,"out","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e)},ft.prototype.getInRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r){var o=n[i].type;e[o]||(e[o]={min:0,max:0}),n[i].range?(e[o].min+=n[i].range.min,e[o].max+=n[i].range.max):(e[o].min+=1,e[o].max+=1)}}else{var a=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[pt]=a["in-range"]}return e},ft.prototype.getOutRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){var o=n[i].type;e[o]||(e[o]={min:1,max:1}),n[i].range&&(e[o].min=n[i].range.min,e[o].max=n[i].range.max)}}else{var a=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[pt]=a["out-range"]}return e},ft.prototype.getTotalInRangeCount=function(t){var e={min:0,max:0},n=this.getInRange(t);for(var r in n)e.min+=n[r].min,e.max+=n[r].max;return e},ft.prototype.getTotalOutRangeCount=function(t){var e={min:0,max:0},n=this.getOutRange(t);for(var r in n)e.min+=n[r].min,e.max+=n[r].max;return e},ft.prototype.getKeyByType=function(t,e,n){var r=this.getMeta(t);if(r){var i="in"===n?this.getInputs(t):this.getOutputs(t);for(var o in i)if(r[o].type===e)return o}},ft.prototype.isProcessFunction=function(t){return["SetValue","ImportData","ExportData","brightics.function.io$unload_model"].indexOf(t[FUNCTION_NAME])>=0},ft.prototype.isSkip=function(t){return t.skip&&_.isEqual(t.skip,!0)},ft.prototype.getDefinition=function(t,e){return Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary(t,e)},ft.prototype.isExist=function(t,e){var n=this.getOutData(t),r=this.getInData(e);return _.forEach(n,function(t){_.forEach(r,function(e){if(t===e)return!0})}),!1},ft.prototype.isConnectable=function(t,e){var n=this.getDefinition("data",t.func),r=this.getDefinition("data",e.func);if(n["connectable-functions"]){if(n["connectable-functions"].indexOf(e.func)<0)return!1}else if(r["acceptable-functions"]&&r["acceptable-functions"].indexOf(t.func)<0)return!1;var i=this.getOutputTypes(t),o=this.getInputTypes(e),a=0;for(var s in i){var c=i[s];o.indexOf(c)>-1&&a++}if(0===a)return!1;var u=this.getInRange(e),l=0;for(var p in u){var d=u[p].max;this.getInData(e,p).length<d&&l++}return 0!==l},ft.prototype.connect=function(t,e){var n=this.getOutData(t),r=this.getInputTypes(e),i={table:[],model:[],image:[]};for(var o in n){var a=n[o];i[s=this.getTypeByTableId(t,a)].push(a)}for(var s in i)0!==i[s].length&&r.indexOf(s)>-1&&this.addInData(e,s,i[s])},ft.prototype.disconnect=function(t,e){var n=this.getOutData(t),r={table:[],model:[],image:[]};for(var i in n){var o=n[i];r[a=this.getTypeByTableId(t,o)].push(o)}for(var a in r)0!==r[a].length&&this.removeInData(e,a,r[a])},ft.prototype.addInData=function(t,e,n){var r=this;if(0!==n.length)if(e===pt)if(this.getMeta(t)){var i=this.getInputs(t);_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])})}else t[IN_DATA].push(n[0]);else"model"===e?(i=this.getInputs(t),_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])})):"image"===e&&(i=this.getInputs(t),_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0])}))},ft.prototype.removeInData=function(t,e,n){0!==n.length&&(n=Array.isArray(n)?n:[n],this.getMeta(t)?_.forEach(this.getInputs(t),function(e,r){_.forEach(n,function(n){_.isArray(e)&&_.indexOf(e,n)>-1?(_.remove(e,function(t){return t==n}),t.inputs[r]=e):_.isEqual(e,n)&&(t.inputs[r]="")})}):Brightics.VA.Core.Utils.CommonUtils.removeArrayElement(t[IN_DATA],n))},ft.prototype.createOutData=function(t,e){var n=this.getDefinition("data",e),r=$.extend(!0,{},n.defaultFnUnit),i={};if(r.meta)for(var o in i.outputs=r.outputs,i.outputs)Array.isArray(i.outputs[o])?i.outputs[o].push(Brightics.VA.Core.Utils.IDGenerator.table.id()):i.outputs[o]=Brightics.VA.Core.Utils.IDGenerator.table.id();else{i[OUT_DATA]=r[OUT_DATA];for(var a=n["out-range"],s=0;s<a.min;s++)i[OUT_DATA].push(Brightics.VA.Core.Utils.IDGenerator.table.id())}return i},ft.prototype.wrapInputs=function(t){return Array.isArray(t)?{inData:t}:{inputs:t}},ft.prototype.clearInData=function(t){if(this.hasInput(t))if(this.getMeta(t))for(var e in t.inputs){var n=Array.isArray(t.inputs[e])?[]:"";t.inputs[e]=n}else t[IN_DATA]=[]},ft.prototype.isArray=function(t){return Array.isArray(t)},ft.prototype.getFunc=function(t){return t?t.func:""},ft.prototype.getName=function(t){return t?t.name:""},ft.prototype.getLabel=function(t){return t?t.display.label:""},ft.prototype.getId=function(t){return t?t.fid:""},ft.prototype.getParam=function(t){return t?t.param:{}},ft.prototype.getKeyLabel=function(t,e){var n=this.getMeta(t);return _.isEmpty(n)?"":n[e].label?n[e].label:e},ft.prototype.getCategory=function(t){return this.getDefinition("data",t.func).category},ft.prototype.getContext=function(t){return t.context||"scala"},ft.prototype.isFlexibleFunction=function(t){return"control"===this.getCategory(t)||"script"===this.getCategory(t)||"rowAppend"===this.getFunc(t)},ft.prototype.inputChangable=function(t){return"script"!==this.getCategory(t)&&"rowAppend"!==this.getFunc(t)},ft.prototype.getDataPanel=function(t,e){var n=Brightics.VA.Core.Editors.Sheet.Panels.DataPanel;if("out"===e){var r=this.getFunc(t);n=Brightics.VA.Implementation.DataFlow.Functions[r]&&Brightics.VA.Implementation.DataFlow.Functions[r].DataPanel||n}return n},ft.prototype.getParent=function(t){return"function"==typeof t.parent?t.parent():Studio.getEditorContainer().getActiveModelEditor().getActiveModel()},ft.prototype.hasTable=function(t){return this.getTypes(t).indexOf(pt)>-1},ft.prototype.changeData=function(t,e,n){if(this.hasMeta(t)){var r=this.getInputs(t),i=this.getOutputs(t);_.forEach(r,function(r,i){_.isEqual(r,e)&&(t.inputs[i]=n)}),_.forEach(i,function(r,i){_.isEqual(r,e)&&(t.outputs[i]=n)});var o=t=>_.isString(t)?_.isEqual(t,e)?n:t:_.isArray(t)?t.map(t=>o(t)):_.isObject(t)?_.zipObject(Object.entries(t).map(t=>{var e=t[0],n=t[1];return[e,o(n)]})):void 0;t.inputs&&(t.inputs=o(t.inputs)),t.outputs&&(t.outputs=o(t.outputs))}else _.forEach(t.inData,function(r,i){_.isEqual(r,e)&&(t.inData[i]=n)}),_.forEach(t.outData,function(r,i){_.isEqual(r,e)&&(t.outData[i]=n)})},ft.prototype.isDustNode=function(t){return["brightics"].indexOf(this.getCategory(t))>-1},ft.prototype.isBluffNode=function(t){return!(t.inData||t.outData||t.inputs||t.outputs)},ft.prototype.isInputtable=function(t){return this.getTotalInRangeCount(t).min>0||this.isBluffNode(t)},ft.prototype.isOutputtable=function(t){return!Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func)["out-node"]},ft.prototype.isSkippable=function(t){return this.isBluffNode(t)||this.isProcessFunction(t)},ft.prototype.isAvailable=function(t){var e=this.getFunc(t);return!_.isUndefined(Brightics.VA.Core.Interface.Functions.data[e])},ft.prototype.isThirdPartyFunction=function(t){return["DataFrameExportForTableau","DataFrameExportForMSTR","DataFrameExportForQlikSense"].indexOf(t[FUNCTION_NAME])>=0};var ht=new ft,gt={duplicate:function(t){return'"'+t+'" is already exist'},index:function(){return"Should be filled previous element first"},empty:function(){return'can not switch to "Empty"'}};function yt(){}yt.prototype.render=function(t){return this.empty(t),this.init(t),this.createLayout(t),this.createInputs(t),this.bindEvents(t),this},yt.prototype.init=function(t){ht.hasMeta(t.fnUnit)?this.DATA_TYPE="object":this.DATA_TYPE="array"},yt.prototype.getPrevFnUnitByTableId=function(t,e){var n=ht.getPreviousFnUnits(t);for(var r in n){var i=n[r];if(ht.getOutData(i).indexOf(e)>-1)return i}},yt.prototype.empty=function(t){t.appendTo.empty()},yt.prototype.createLayout=function(t){var e=$('<div class="brtc-va-editors-sheet-controls-input-list"> <div class="brtc-va-editors-sheet-controls-input-list-content"/></div>');e.attr("autoArrange",t.autoArrange||!1);var n=$('<div class="brtc-va-editors-sheet-controls-input-list-container"></div>');e.append(n),t.appendTo.append(e)},yt.prototype.createInputs=function(t){var e=this,n=ht.getInputs(t.fnUnit);if(ht.hasMeta(t.fnUnit))_.forEach(n,function(n,r){var i={type:ht.getTypeByKey(t.fnUnit,r),tableId:n,key:r,fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!1};e.createInputUnit(i)});else{var r=ht.getInRange(t.fnUnit).table.max;ht.isFlexibleFunction(t.fnUnit)&&(r=ht.getInTable(t.fnUnit).length);for(var i=0;i<r;i++){var o={type:"table",tableId:n[i],key:"["+i+"]"+ht.getLabel(t.fnUnit),fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!0};e.createInputUnit(o)}}},yt.prototype.enableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("enable")},yt.prototype.disableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("disable")},yt.prototype.isDraggable=function(t){return(t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper")).hasClass("ui-draggable")},yt.prototype.createInputUnit=function(t){var e=t.key,n=t.tableId,r=t.type,i=t.fnUnit,o=this.getPrevFnUnitByInTableId(i,n),a=t.readOnly,s=t.autoArrange,c=this.createBox({appendTo:t.appendTo,label:e,type:r});!t.readOnly&&_.isEqual(this.DATA_TYPE,"array")&&(this.createDragEvent(t.appendTo,c),n?this.enableDragEvent(c):this.disableDragEvent(c)),"array"!==this.DATA_TYPE||a||c.css("cursor","move"),c.attr("key",e),c.attr("type",r),c.attr("table-id",n);var u=c.find(".brtc-style-controls-inputselector-box-contents"),l=u.find(".brtc-style-controls-inputselector-box-contents-figure"),p=u.find(".brtc-style-controls-inputselector-box-contents-remove"),d=u.find(".brtc-style-controls-inputselector-box-key");t.appendTo.find(".brtc-va-editors-sheet-controls-input-list-container").append(c),u.append(f);var f=this.createEmptyItem({parent:l,type:r,label:t.emptyLabel,readOnly:a}),h=this.createFuncItem({label:ht.getLabel(o),func:ht.getFunc(o),type:ht.getTypeByTableId(o,n),tableId:n}),g=ht.getOutputsToObject(o),y=this.createKeyItem({key:g[n],type:r}),m=this.createRemoveButton({autoArrange:s});return l.append(h),d.append(y),a||p.append(m),a||this.createDropEvent(c),n?(f.hide(),h.show(),y.show(),m.show()):(f.show(),h.hide(),y.hide(),m.hide()),this.registerRemoveEvent(m),c},yt.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=ht.getPreviousFnUnits(t);for(var r in n){var i=ht.getOutData(n[r]);if(i&&i.indexOf(e)>-1)return n[r]}}},yt.prototype.createBox=function(t){return this.createBoxWrapper(t.label,t.type)},yt.prototype.createDragEvent=function(t,e){e.draggable({helper:"clone",appendTo:t,start:function(t,n){e.css("opacity",".3"),n.helper.css({width:"220px",border:"none"}),n.helper.find(".brtc-style-controls-inputselector-box-title").hide()},stop:function(t,n){e.css("opacity","1")}})},yt.prototype.createBoxWrapper=function(t,e){var n=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-title brtc-style-ellipsis"><div class="icon"></div><div class="brtc-label"></div></div>'),i=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),o=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return n.append(r).append(i),i.append(o),r.find(".icon").attr("type",e),r.find(".brtc-label").text(t),n},yt.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").addClass("brtc-style-ellipsis"),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o},yt.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-ellipsis brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),r.attr("title",t.key),n.append(this.createTypeIcon(t.type)),e},yt.prototype.createTypeIcon=function(t){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon"></div>').attr("type",t)},yt.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty"> <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o},yt.prototype.getDropFuncTarget=function(t){return t.find(".brtc-style-controls-inputselector-box-contents")},yt.prototype.getDroppableCssSelector=function(){return[".brtc-va-fnunit-input-empty",".brtc-va-editors-sheet-controls-inputselector-item",".brtc-va-tools-sidebar-variable-remove",".brtc-style-controls-inputselector-box-key-wrapper"].join(",")},yt.prototype.addActivateClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-active")},yt.prototype.removeActivateClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-active")},yt.prototype.addHoverClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-hover")},yt.prototype.removeHoverClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-hover")},yt.prototype.createDropEvent=function(t){var e=this,n=t.attr("type");t.droppable({accept:".brtc-va-controls-datatree-li-table[type="+n+"] .ui-draggable, .brtc-style-controls-inputselector-box-wrapper",activate:function(t,n){e.addActivateClass($(this))},deactivate:function(t,n){e.removeActivateClass($(this)),e.removeHoverClass($(this))},over:function(t,n){e.addHoverClass($(this))},out:function(t,n){e.removeHoverClass($(this))},drop:function(t,n){var r=n.draggable,i=e.getMainArea($(this)),o=r.text(),a=e.validate(r,$(this));_.isEmpty(a)?(e.removeActivateClass($(this)),e.removeHoverClass($(this)),e.switchData(r,$(this)),e.handleChange($(this))):e.handleError(i,gt[a.type](o))}})},yt.prototype.validate=function(t,e){return this.checkDuplicated(t,e)?{type:"duplicate"}:this.checkIndex(t,e)?{type:"index"}:this.checkEmpty(t,e)?{type:"empty"}:void 0},yt.prototype.checkDuplicated=function(t,e){var n=this.getInputs(this.getMainArea(e)),r=t.closest("li").attr("table-id");for(var i in n)if(_.isEqual(n[i],r))return!0;return!1},yt.prototype.checkIndex=function(t,e){if("object"===this.DATA_TYPE)return!1;var n=e.prev();return!(_.isEmpty(n)||!this.isEmptyBox(n))},yt.prototype.checkEmpty=function(t,e){return!(t.hasClass("jqx-tree-item")||!this.isEmptyBox(t)&&!this.isEmptyBox(e))},yt.prototype.switchData=function(t,e){if(t.hasClass("brtc-style-controls-inputselector-box-wrapper")){var n=t.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),r=n.clone(),i=e.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),o=i.clone();return i.replaceWith(r),n.replaceWith(o),this.registerRemoveEvent(r.find(".brtc-va-tools-sidebar-variable-remove")),this.registerRemoveEvent(o.find(".brtc-va-tools-sidebar-variable-remove")),this.isEmptyBox(r)?this.disableDragEvent(r):this.enableDragEvent(r),this.isEmptyBox(o)?this.disableDragEvent(o):this.enableDragEvent(o),o}var a=t.closest("li").attr("key"),s=t.closest("li").attr("label"),c=t.closest("li").attr("type"),u=t.closest("li").attr("func"),l=t.closest("li").attr("table-id"),p=this.createFuncItem({label:s,func:u,type:c,tableId:l}),d=this.createKeyItem({key:a,type:c}),f=e.closest(".brtc-style-controls-inputselector-box-wrapper"),h=f.find(".brtc-style-controls-inputselector-box-contents"),g=h.find(".brtc-va-editors-sheet-controls-inputselector-item"),y=h.find(".brtc-style-controls-inputselector-box-key-wrapper"),m=h.find(".brtc-va-fnunit-input-empty"),v=h.find(".brtc-va-tools-sidebar-variable-remove");m.hide(),e.show(),y.show(),v.show(),this.registerRemoveEvent(v),g.replaceWith(p),y.replaceWith(d),this.enableDragEvent(p),this.createDropEvent(f)},yt.prototype.createRemoveButton=function(t){return $('<span class="brtc-va-tools-sidebar-variable-remove"></span>')},yt.prototype.registerRemoveEvent=function(t){var e=this;t.off("click"),t.click(function(){var t=e.getMainArea($(this)),n=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),r=n.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=n.find(".brtc-style-controls-inputselector-box-key-wrapper"),o=n.find(".brtc-va-fnunit-input-empty");n.find(".brtc-va-tools-sidebar-variable-remove").hide(),i.hide(),r.hide(),o.show(),e.disableDragEvent(n),"true"===t.attr("autoArrange")&&e.autoArrange(n),e.handleRemove(t)})},yt.prototype.autoArrange=function(t){var e=t.next();if(!_.isEmpty(e)&&!this.isEmptyBox(e)){var n=this.switchData(e,t);this.autoArrange(n)}},yt.prototype.isEmptyBox=function(t){return(t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper")).find(".brtc-va-fnunit-input-empty").is(":visible")},yt.prototype.handleChange=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)])},yt.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)])},yt.prototype.handleError=function(t,e){this.getMainArea(t).trigger("error",[e])},yt.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(ht.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t))}),e},yt.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t},yt.prototype.getInputs=function(t){var e=this.getMainArea(t).find(".brtc-style-controls-inputselector-box-wrapper"),n={};return _.forEach(e,function(t){var e=$(t),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o}),n},yt.prototype.destroyDragEvent=function(t){t.on("dragstop",function(e,n){t.hasClass("ui-draggable")&&n.helper.attr("table-id")!==e.target.getAttribute("table-id")&&t.draggable("destroy")})},yt.prototype.bindEvents=function(t){var e=t.appendTo.find(".brtc-va-editors-sheet-controls-input-list");"function"==typeof t.onClick&&e.bind("click",t.onClick),"function"==typeof t.onChange&&e.bind("change",t.onChange),"function"==typeof t.onError&&e.bind("error",t.onError)};var mt=new yt;function vt(){}vt.prototype.create=function(t){return this.createUnit(t)},vt.prototype.createUnit=function(t){var e=t.key,n=t.tableId,r=t.type,i=t.label,o=t.func,a=this.createBox(e);a.attr("key",e),a.attr("type",r),a.attr("label",i),a.attr("func",o),a.attr("table-id",n);var s=a.find(".brtc-style-controls-inputselector-box-contents"),c=s.find(".brtc-style-controls-inputselector-box-contents-figure"),u=s.find(".brtc-style-controls-inputselector-box-key"),l=this.createFuncItem({label:i,func:o,type:r,tableId:n}),p=this.createKeyItem({key:e,type:r});return this.createRemoveButton(),c.append(l),u.append(p),a},vt.prototype.bindEvents=function(t,e){"function"==typeof e.onClick&&t.bind("click",e.onClick),"function"==typeof e.onChange&&t.bind("change",e.onChange),"function"==typeof e.onRemove&&t.bind("remove",e.onRemove)},vt.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=FnUnitUtils.getPreviousFnUnits(t);for(var r in n){var i=FnUnitUtils.getOutData(n[r]);if(i&&i.indexOf(e)>-1)return n[r]}}},vt.prototype.createBox=function(t){return this.createBoxWrapper(t)},vt.prototype.createBoxWrapper=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>');e.css("width","100%"),e.css("height","55px");var n=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return e.append(n),n.append(r),e},vt.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o},vt.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),n.append(this.createTypeIcon()),e},vt.prototype.createTypeIcon=function(){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon" type="table"></div>')},vt.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty"> <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o},vt.prototype.getDropFuncTarget=function(t){return 1==t.find(".brtc-va-views-palette-fnunit").length?t.find(".brtc-va-views-palette-fnunit"):t},vt.prototype.createDropEvent=function(t){var e=this;t.droppable({accept:".key-items-draggable",activate:function(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-active")},deactivate:function(t,n){var r=e.getDropFuncTarget($(this));r.removeClass("brtc-style-droppable-active"),r.removeClass("brtc-style-droppable-hover")},over:function(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-hover")},out:function(t,n){e.getDropFuncTarget($(this)).removeClass("brtc-style-droppable-hover")},drop:function(t,n){var r=n.draggable,i=e.getDropFuncTarget($(this)),o=e.getMainArea($(this));i.removeClass("brtc-style-droppable-active"),i.removeClass("brtc-style-droppable-hover"),e.switchData(r,$(this));var a=e.getItems(o);o.trigger("change",[a])}})},vt.prototype.switchData=function(t,e){var n=t.closest("li").attr("key"),r=t.closest("li").attr("label"),i=t.closest("li").attr("type"),o=t.closest("li").attr("func"),a=t.closest("li").attr("table-id"),s=this.createFuncItem({label:r,func:o,type:i,tableId:a}),c=this.createKeyItem({key:n,type:i}),u=(e.hasClass("brtc-style-controls-inputselector-empty-fnunit"),e.closest(".brtc-style-controls-inputselector-box-wrapper")),l=u.find(".brtc-style-controls-inputselector-box-contents"),p=l.find(".brtc-va-editors-sheet-controls-inputselector-item"),d=l.find(".brtc-style-controls-inputselector-box-key-wrapper"),f=l.find(".brtc-va-fnunit-input-empty"),h=l.find(".brtc-va-tools-sidebar-variable-remove");f.hide(),e.show(),d.show(),h.show(),p.replaceWith(s),d.replaceWith(c),this.createDropEvent(u)},vt.prototype.createRemoveButton=function(){var t=this,e=$('<span class="brtc-va-tools-sidebar-variable-remove"></span>');return e.click(function(){var e=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),n=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.find(".brtc-style-controls-inputselector-box-key-wrapper"),i=e.find(".brtc-va-fnunit-input-empty");e.find(".brtc-va-tools-sidebar-variable-remove").hide(),r.hide(),n.hide(),i.show(),t.handleRemove($(this))}),e},vt.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getItems(t)])},vt.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(FnUnitUtils.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t))}),e},vt.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t},vt.prototype.getItems=function(t){var e=this.getMainArea(t).find(".brtc-style-controls-inputselector-box-wrapper"),n={};return _.forEach(e,function(t){var e=$(t),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o}),n},vt.prototype.destroyDragEvent=function(t){t.on("dragstop",function(e,n){t.hasClass("ui-draggable")&&n.helper.attr("table-id")!==e.target.getAttribute("table-id")&&t.draggable("destroy")})};var bt=new vt;function _t(){this.init()}_t.prototype.init=function(){this.board={}},_t.prototype.add=function(t,e,n){this.board[t]={status:e,message:n}},_t.prototype.remove=function(t){delete this.board[t]},_t.prototype.get=function(t){return this.board[t]},_t.prototype.refresh=function(){this.init()},_t.prototype.show=function(t,e){this.get(t)&&e.attr("title",this.get(t).message)};var At=new _t,xt={IN_DATA:"inData",OUT_DATA:"outData",INPUTS:"inputs",OUTPUTS:"outputs",FUNCTIONS:"functions",TYPE:"type",TITLE:"title",PARAMETER:"param",MODEL_ID:"mid",INNER_MODELS:"innerModels",PERSIST_MODE:"persist-mode",SOURCE_FID:"sourceFid",TARGET_FID:"targetFid",FUNCTION_NAME:"name",FONT_SIZES:["10","11","12","14","16","18","24","36","48","64"]},wt=n(0),Ct=n.n(wt);const It="3.6";function Tt(t,e){this.project={},this.children=[],t&&(this.project=t),e&&e instanceof Array&&(this.children=this.children.concat(e))}function Ut(t){this.data=[],t&&(t instanceof Array?this.data=this.data.concat(t):this.data.push(t))}Tt.prototype.toJSON=function(){return{type:"project",data:this.project.toJSON(),children:_.map(this.children,function(t){return{type:t.getResourceName(),data:t.toJSON()}}),version:this.getCoreVersion()}},Tt.prototype.setProject=function(t){return this.project=t,this},Tt.prototype.addFile=function(t){return this.children.add(t),this},Tt.prototype.addFiles=function(t){return this.children=this.children.concat(t),this},Tt.prototype.getProject=function(){return this.project},Tt.prototype.getFiles=function(){return this.children},Tt.prototype.getCoreVersion=function(){return It},Ut.prototype.toJSON=function(){return{type:"files",data:_.map(this.data,function(t){return{type:t.getResourceName(),data:t.toJSON(!0)}}),version:this.getCoreVersion()}},Ut.prototype.addFile=function(t){return this.data.push(t),this},Ut.prototype.addFiles=function(t){return this.data=this.data.concat(t),this},Ut.prototype.getFiles=function(){return this.data},Ut.prototype.getCoreVersion=function(){return It};const Et=function(){const t=function(t,e){const n=$.ajax({url:"api/va/v2/convert/store",type:"POST",data:JSON.stringify({contents:t,version:e}),contentType:"application/json; charset=utf-8"});return Promise.resolve(n).then(function(t){return t.contents}).catch(function(e){throw e.responseJSON.errors[0].mid=t.mid,e})},e=t=>new C(t),n=t=>new k(t);return{convertFilesSpec:function(r,i){const o=t=>t.data.map(_.property("data")),a=i?o(r).map(_.property("contents")):_.isArray(r)?r:[r];return Promise.all(_.map(a,e=>t(e,i))).then(function(t){return new Ut((i?t=>_.zip(o(r),t).map(([t,r])=>(r.version_id?n:e)(Object.assign({},t,{contents:r}))):t=>t.map(t=>(t.version_id?function(t){const e=(new k).setVersionId(t.version_id).setFileId(t.mid).setLabel(t.title).setTags(t.versionTags).setDescription(t.versionDescription).setType(t.type).setMajorVersion(_.has(t,"majorVersion")?t.majorVersion:t.major_version).setMinorVersion(_.has(t,"minorVersion")?t.minorVersion:t.minor_version).setCreator(Brightics.VA.Env.Session.userId).setIsManual(!0);return e.setContents(_.omit(t,["versionId","versionTags","versionDescription","majorVersion","minorVersion"])),e}:function(t){return(new C).setFileId(t.mid).setLabel(t.title).setDescription("").setCreator(Brightics.VA.Env.Session.userId).setContents(t)})(t)))(t)).toJSON()})},convertProjectSpec:function(r,i){const[o,a,s]=function(){if(!i){const t=t=>_.merge({contents:{gv:[]}},t);return[r[0].files.map(t),r[0].versions.map(t),new j(_.omit(r[0],["files","versions"]))]}const[t,e]=_.partition(r.children,_.matchesProperty("type","file")).map(t=>t.map(_.property("data")));return[t,e,new j(r.data)]}(),c=function(e){return function(n){return(r=n,t(r.contents,i).then(function(t){return _.assign({},r,{contents:t})})).then(e);var r}};return Promise.all([].concat(_.map(o,c(e)),_.map(a,c(n)))).then(function(t){return new Tt(s,t).toJSON()})}}}(),Ft={},Ot=[j,C,k];_.forEach(Ot,function(t){Ft[t.prototype.getResourceName()]={_constructor:t}});const Dt=new class{exportProject(t){return lt.fetchProject(t).then(e=>lt.fetchFiles(t).then(e=>this._collectResources(e,t,!0)).then(t=>this._exportProjectFromResources(e,t))).catch(t=>{console.error(t)})}_collectResources(t,e,n){const r=_.isArray(t)?t:[t];return Promise.all(_.map(r,t=>n?this._getDependentResources(t,e):[t])).then(t=>this._makeUnique(_.flatten(t))).then(t=>this._appendMissedFiles(t,e))}exportJSON(t,e,n){return lt.fetchFile(e,t).then(_.bind(this._collectResources,this,_,e,n)).then(_.bind(this._exportFilesFromResources,this)).catch(console.error)}exportJSONs(t,e,n){return Promise.all(_.map(t,_.bind(this.exportJSON,this,_,e,n))).catch(console.error)}_exportFilesFromResources(t,e){return new Ut(t).toJSON()}_exportProjectFromResources(t,e){return new Tt(t,e).toJSON()}_appendMissedFiles(t,e){return this._getMissedFile(t,e).then(function(e){return t.concat(e)})}_traverseParamFunctions(t,e){_.forEach(t,t=>{t.param.functions&&this._traverseParamFunctions(t.param.functions,e),e(t)})}_getDependentResources(t,e){const n=t.getContents(),r=new J,i=function(t){return Promise.all(_.map(t.functions,function(t){if("Flow"===t[FUNCTION_NAME]){if(t.param.mid&&t.param.versionId){if(!r.has(t.param.versionId))return lt.fetchVersion(e,t.param.mid,t.param.versionId).then(function(e){return r.set(t.param.versionId,e),o(e)}).catch(_.noop)}else if(t.param.mid&&!r.has(t.param.mid))return lt.fetchFile(e,t.param.mid).then(function(e){return r.set(t.param.mid,e),o(e)}).catch(_.noop)}else if("loadFromStaging"===t.func&&t.param.modelId&&!r.has(t.param.model))return lt.fetchFile(e,t.param.modelId).then(function(e){return r.set(t.param.modelId,e),o(e)}).catch(_.noop);const a=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(n,t);return Promise.all(_.map(a,i))}))},o=function(t){const e=t.getContents();return i(e)};return o(t).then(function(){return _.compact(r.toArray()).concat([t])})}_makeUnique(t){const e=new J;return _.forEach(t,function(t){e.set(t.getHashCode(),t)}),e.toArray()}_getMissedFile(t,e){const n=new J;_.forEach(t,function(t){t instanceof C&&n.set(t.getFileId(),t)});const r=new J;return _.forEach(t,function(t){t instanceof k&&!n.has(t.getFileId())&&!r.has(t.getFileId())&&r.set(t.getFileId(),t.getFileId())}),Promise.all(_.map(r.toArray(),function(t){return lt.fetchFile(e,t)}))}_jsons2resource(t){return _.map(t,function(t){return new(0,Ft[t.type]._constructor)(t.data)})}_importResources(t,e){this._changePrevKeys(t);const n=this._collectVersionId(t),r=this._collectModelId(t);this._remapProjectId(t,e),this._remapFileAndVersionId(t,r,n);const i=[],o=[];_.forEach(t,function(t){if(t instanceof j)throw new Error("unexpected data");t instanceof C&&i.push(function(){return lt.addFile(e,t)}),t instanceof k&&(t.setIsManual(!0),o.push(function(){return lt.addVersion(e,t.getFileId(),t)}))});const a=function(t){return function(){return Y(t)}};return H([a([]),a(i),a(o)])}checkPreviousFileSpec(t){let e=!0;return"project"===t.type&&(e=!1),_.has(t,"version")&&(e=!1),e}importJSONs(t,e){return(t=>Promise.all(_.map(t,t=>"files"!==t.type?this.checkPreviousFileSpec(t)?Et.convertFilesSpec(t,t.version):Promise.reject(new Error("invalid export file spec")):t.version!==It?Et.convertFilesSpec(t,t.version):t)))(t).then(t=>_.map(t,t=>this._jsons2resource(t.data))).then(_.flatten).then(this._makeUnique.bind(this)).then(t=>this._importResources(t,e))}importJSON(t,e){return this.importJSONs([t],e)}_collectVersionId(t){const e=new J;return _.forEach(t,function(t){t instanceof k&&(e.has(t.getVersionId())||e.set(t.getVersionId(),Ct.a.version.id()))}),e}_collectModelId(t){const e=new J,n=function(t){e.has(t)||e.set(t,Ct.a.model.id())};return _.forEach(t,function(t){(t instanceof C||t instanceof k)&&(n(t.getFileId()),_.forIn(t.getContents().functions,function(t){t.param&&t.param.modelId&&n(t.param.modelId)}),_.forIn(t.getContents().innerModels,function(t){n(t.mid)}))}),e}_remapProjectId(t,e){_.forEach(t,function(t){t instanceof C&&t.setProjectId(e)})}_remapFileAndVersionId(t,e,n){const r=function(t,i){_.forEach(i.functions,function(i){"Flow"===i[FUNCTION_NAME]&&(i.param.mid&&(i.param.mid=e.get(i.param.mid)||i.param.mid),i.param.versionId&&(i.param.versionId=n.get(i.param.versionId)||i.param.versionId)),"DataViewer"===i[FUNCTION_NAME]&&(i.param.mid=e.get(i.param.mid)),"If"===i[FUNCTION_NAME]&&(i.param.if.mid=e.get(i.param.if.mid)||i.param.if.mid,_.forEach(i.param.elseif,function(t){t.mid=e.get(t.mid)||t.mid}),i.param.else.mid=e.get(i.param.else.mid)||i.param.else.mid),"ForLoop"!==i[FUNCTION_NAME]&&"WhileLoop"!==i[FUNCTION_NAME]||(i.param.mid=e.get(i.param.mid)||i.param.mid);const o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(r,t,_))})};_.forEach(t,function(t){if(t instanceof C||t instanceof k){t.setFileId(e.get(t.getFileId())),t.getContents().mid=t.getFileId(),t instanceof k&&(t.setVersionId(n.get(t.getVersionId())),t.getContents().version_id=t.getVersionId()),t instanceof C&&"visual"===t.getType()&&_.forEach(t.getContents().functions,function(t){t.param.modelId&&(t.param.modelId=e.get(t.param.modelId))});const i=t.getContents(),o=_.reduce(_.map(i.innerModels,function(t,n){const r={};return t.mid=e.get(n)||n,r[t.mid]=t,r}),_.merge,{});i.innerModels=o,r(i,i)}})}_changePrevKeys(t){const e={fidCache:{},tidCache:{}};_.forEach(t,function(t){if(t instanceof C||t instanceof k){const n=t.getContents();Brightics.VA.Core.Utils.ModelUtils.createCacheNestedFlow(n,n,e)}}),_.forEach(t,function(t){if(t instanceof C||t instanceof k){const n=t.getContents(),r=Brightics.VA.Core.Utils.ModelUtils.setKeyNestedFlow(n,n,e);t.setContents(r)}})}preprocessProjectJson(t){return"project"===t.type&&t.version===It?Promise.resolve(t):Et.convertProjectSpec(t,t.version)}importProject(t){return this.preprocessProjectJson(t).then(function(t){const e=new j(t.data),n=Ct.a.project.id();e.setProjectId(n);const r=this._jsons2resource(t.children);return lt.addProject(e).then(()=>lt.fetchProject(n)).then(t=>this._importResources(r,n)).then(()=>n).catch(t=>{console.error(t)})}.bind(this))}validateExportedProjectSpec(t){try{return this.preprocessProjectJson(t)}catch(t){return Promise.reject(t)}}duplicateFile(t,e,n,r,i,o){return this.exportJSON(t,e,r).then(e=>{const r=_.cloneDeep(e);return function(e){e.data=_.map(e.data,function(e){return"file"===e.type&&e.data.id===t?e.data.label=o:e.data.label+="_"+i,e})}(r),this.importJSON(r,n)}).catch(function(t){console.error(t)})}calcTableIdLinks(t){const e=[],n=function(t,r){_.forEach(r.functions,function(i){"DataViewer"===i[FUNCTION_NAME]&&_.forEach(i[OUT_DATA],function(t){e.push({source:["",Brightics.VA.Env.Session.userId,i.param.mid,i[OUT_DATA]].join("/"),alias:["",Brightics.VA.Env.Session.userId,r.mid,i[OUT_DATA]].join("/")})});const o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(n,t,_))})};return _.forEach(t,function(t){if(t instanceof C||t instanceof k){const e=t.getContents();n(e,e)}}),e}};var Vt=function(t){return _.clone(t)},St=n(2),Mt=n.n(St);function jt(t){var e;this.ee=new o,this.connectionKey=t,window.addEventListener("storage",(e=this.ee,function(t){var n=t.key,r=JSON.parse(t.newValue)||{};e.emit(n,r)}))}jt.prototype.request=function(t,e,n){var r=this,i=(n||{}).timeout||5e3;return new Promise(function(n,o){var a=Date.now(),s="req_"+a,c=function(e){e.connectionKey===r.connectionKey&&e.requestKey===s&&(n(e.value),r.off(t,c))};r.on(t,c),setTimeout(function(){o(new Error("TIMEOUT")),r.off(t,c)},i),r.emit(t,{timestamp:a,requestKey:"req_"+a,connectionKey:r.connectionKey,value:e,timeout:i})})},jt.prototype.setConnectionKey=function(t){this.connectionKey=t},jt.prototype.getConnectionKey=function(){return this.connectionKey},jt.prototype.listen=function(t,e){var n=this;n.on(t,function(r){if(r.connectionKey===n.connectionKey){var i=Date.now();i-r.timestamp>=r.timeout||n.emit(t,_.assign({},r,{value:e(r),timestamp:i,responseKey:"res_"+i}))}})},jt.prototype.on=function(t,e){this.ee.on("_TAB_CH_"+t,e)},jt.prototype.off=function(t,e){this.ee.off("_TAB_CH_"+t,e)},jt.prototype.emit=function(t,e){localStorage.setItem("_TAB_CH_"+t,JSON.stringify(e))};const Bt="__brtc__model__sync__";function Pt(t,e){var n={};return n[t]=e,n}function Nt(t){return _.reduce(t,function(t,e,n){return _.isFunction(e)||(t[n]=e),t},{})}window.__module__=window.__module__||{},window.brtc_require=function(t){return window.__module__[t]};var kt=function(t,e){window.__module__[t]=window.__module__[t]||{},window.__module__[t]=e};kt("DataStructures",{HashMap:J,ProjectTree:K,TreeNode:z}),kt("Dao",{ProjectDao:N,FileDao:M,VersionDao:G,DatasourceDao:W}),kt("Controls",d),kt("ResourceManager",lt),kt("FnUnitUtils",ht),kt("FnUnitInputs",mt),kt("StatusBoard",At),kt("KeyItems",bt),kt("Vo",{Project:j,File:C,Version:k,PROP_KEY:xt}),_.forIn(xt,function(t,e){window[e]=t}),kt("EventEmitter",o),kt("ClassUtils",{inherits:w}),kt("IDGenerator",Ct.a),kt("ResourceService",Dt),kt("PromiseUtils",{serial:H,parallel:Y}),kt("ObjectUtils",{get:function(t,e){return e instanceof Array?function(t,e){try{for(var n=-1,r=e.length,i=t;++n<r;)i=i[e[n]];return i}catch(t){return}}(t,e):t[e]},updateProp:function(t,e,n){for(var r=t,i=-1,o=e.length;++i<o-1;)r=r[e[i]];var a=Vt(r[e[e.length-1]]);return r[e[e.length-1]]=Vt(n),a},addProp:function(t,e,n){for(var r=t,i=-1,o=e.length;++i<o-1;)r=r[e[i]];Array.isArray(r)?r.splice(e[e.length-1],0,n):r[e[e.length-1]]=Vt(n)},removeProp:function(t,e){for(var n=t,r=-1,i=e.length;++r<i-1;)n=n[e[r]];var o=Vt(n[e[e.length-1]]);return Array.isArray(n)?n.splice(e[e.length-1],1):delete n[e[e.length-1]],o}}),kt("_",_),window.crel=Mt.a,kt("crel",Mt.a),kt("TabChannel",jt),kt("DATA_TYPES",{integertype:{type:"number",internalType:"Integer"},longtype:{type:"number",internalType:"Long"},doubletype:{type:"number",internalType:"Double"},booleantype:{type:"string",internalType:"Boolean"},stringtype:{type:"string",internalType:"String"},"arraytype(doubletype)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype)":{type:"number[]",internalType:"Long[]"},"arraytype(booleantype)":{type:"string[]",internalType:"Boolean[]"},"arraytype(stringtype)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype)":{type:"byte[]",internalType:"Byte[]"},"arraytype(doubletype,true)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype,true)":{type:"number[]",internalType:"Long[]"},"arraytype(stringtype,true)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype,true)":{type:"byte[]",internalType:"Byte[]"},"maptype(integertype,doubletype)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype)":{type:"map",internalType:"Map(String,Double)"},"maptype(integertype,doubletype,true)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype,true)":{type:"map",internalType:"Map(String,Double)"},"maptype(stringtype,stringtype,true)":{type:"map",internalType:"Map(String,String)"},timestamptype:{type:"date",internalType:"Date"},timestamp:{type:"date",internalType:"Date"},date:{type:"date",internalType:"Date"},string:{type:"string",internalType:"String"},double:{type:"number",internalType:"Double"},boolean:{type:"string",internalType:"Boolean"},long:{type:"number",internalType:"Long"},int:{type:"number",internalType:"Integer"},integer:{type:"number",internalType:"Integer"},"array(string)":{type:"string[]",internalType:"String[]"},"array(double)":{type:"number[]",internalType:"Double[]"},"array(long)":{type:"number[]",internalType:"Long[]"},"array(int)":{type:"number[]",internalType:"Integer[]"},"array(integer)":{type:"number[]",internalType:"Integer[]"},"map(integer,double)":{type:"map",internalType:"Map(Integer,Double)"},"map(string,double)":{type:"map",internalType:"Map(String,Double)"},"map(int,double)":{type:"map",internalType:"Map(Integer,Double)"},tinyint:{type:"byte",internalType:"Byte"},float:{type:"number",internalType:"Float"},bigint:{type:"number",internalType:"Long"},smallint:{type:"short",internalType:"Short"},"array<string>":{type:"string[]",internalType:"String[]"},"array<double>":{type:"number[]",internalType:"Double[]"},"array<long>":{type:"number[]",internalType:"Long[]"},"array<int>":{type:"number[]",internalType:"Integer[]"},"array<integer>":{type:"number[]",internalType:"Integer[]"},"array<tinyint>":{type:"byte[]",internalType:"Byte[]"},"map<integer,double>":{type:"map",internalType:"Map(Integer,Double)"},"map<string,double>":{type:"map",internalType:"Map(String,Double)"},"map<int,double>":{type:"map",internalType:"Map(Integer,Double)"}}),kt("modelDiff",function(t,e){return function t(e,n){if(e===n)return{};var r=_.isArray(e),i=_.isArray(n);if(r&&i)return function(e,n){var r=Math.max(e.length,n.length);return _.range(r).reduce(function(r,i){if(!_.has(e,i))return _.merge(r,Pt(i,{[Bt]:!0,action:"add",val:n[i]}));if(!_.has(n,i))return _.merge(r,Pt(i,{[Bt]:!0,action:"remove"}));var o=t(e[i],n[i]);return _.isObject(o)&&_.isEmpty(o)?r:_.merge(r,Pt(i,o))},{})}(e,n);if(r||i||!_.isObject(e)||!_.isObject(n))return{[Bt]:!0,action:"update",val:n};var o=_.union(_.keys(e),_.keys(n));return _.reduce(o,function(r,i){if(!_.has(e,i))return _.merge(r,Pt(i,{[Bt]:!0,action:"add",val:n[i]}));if(!_.has(n,i))return _.merge(r,Pt(i,{[Bt]:!0,action:"remove"}));var o=t(e[i],n[i]);return _.isObject(o)&&_.isEmpty(o)?r:_.merge(r,Pt(i,o))},{})}(Nt(t),Nt(e))}),kt("ENV",r)}]),function(){"use strict";var t=window.__module__;this.Brightics=this.Brightics||{};var e=this.Brightics,n=brtc_require("FnUnitUtils"),r=brtc_require("ENV");$.extend(!0,this.Brightics,{VA:{Core:{Interface:{Clazz:{},Label:{},Editor:{},ModelLayoutManager:{},Toolbar:{},SideBarManager:{},RightSideBarAdapter:{},LeftSideBarAdapter:{},Validator:{},Launcher:{},LauncherDialog:{},Functions:{},WidgetUtils:{},DefaultModel:{},ProjectContextMenuList:{},Clipboard:{},RunnableFactory:{},AddonFunctionUtil:{}},Components:{Base:{}},Controls:{},Default:{},Dialogs:{FunctionProperties:{},RefineSteps:{}},Editors:{Diagram:{Commands:{ControlEditor:{}}},Sheet:{Controls:{Optimization:{}},Commands:{},Panels:{Properties:{}}}},Functions:{Library:{}},Shapes:{},Tools:{MenuBar:{},Adapter:{},Manager:{},ModelMigrator:{Executor:{},RuleList:{}}},Utils:{},Views:{Pages:{}},Widget:{Controls:{}},Wizards:{Pages:{}},Validator:{},AddonFunctionManager:{}},Implementation:{},Window:{Utils:{}},Controls:t.Controls,Dao:t.Dao,DataStructures:t.DataStructures,Default:{},Dialogs:{},Setting:{Registry:{},Implement:{}},Env:{Session:{},Recommend:{}},Utils:{},Views:{},Workspace:{},Log:{},EventEmitter:t.EventEmitter,ClassUtils:t.ClassUtils,Vo:t.Vo},Admin:{},COMMUNITY:{}}),this.Brightics.VA.Core.Utils.IDGenerator=t.IDGenerator,this.Brightics.VA.Env.Theme="office",this.Brightics.VA.Env.CoreVersion=r.CORE_VERSION,this.Brightics.VA.Env.Diagram={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:40},this.Brightics.VA.Env.DiagramInit={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:20},this.Brightics.VA.Env.Multiplicity={Zero:"0",geZero:"0..*",One:"1",geOne:"1..*"},this.Brightics.VA.Env.Recommend.NextChart={load:["table","scatter"],associationRule:["table","network"],bigDataScatter:["scatter","table"],bigDataLine:["line","table"],bigDataBoxPlot:["boxplot","table"],bigDataColumn:["column","table"],bigDataBar:["bar","table"]},this.Brightics.VA.Env.Recommend.Next={data:{default:["load","createTable","brightics.function.io$load13889","brightics.function.io$read_csv97059"],mdReplaceNumber:["mdReplaceString","imputeNumberTypeFillColumn","numericalVariableDerivation"],mdReplaceString:["mdReplaceNumber","imputeStringTypeFillColumn"],numericalVariableDerivation:["conditionalUpdate","conditionalDerivation"],conditionalDerivation:["conditionalUpdate"],conditionFilter:["minmaxFilter","lengthFilter","stringFilter"],lengthFilter:["stringFilter","conditionFilter","minmaxFilter"],minmaxFilter:["conditionFilter","stringFilter","lengthFilter"],stringFilter:["lengthFilter","conditionFilter","minmaxFilter"],imputeNumberTypeFillColumn:["mdReplaceNumber","numericalVariableDerivation"],imputeRemoveLine:["mdReplaceNumber","mdReplaceString"],imputeStringTypeFillColumn:["mdReplaceString"],join:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],changeColumnName:["capitalizeColName"],frequency:["join"],frequencyMat:["join"],statisticSummary:["join"],capitalizeColName:["changeColumnName"],linearRegressionTrain:["linearRegressionPredict"],linearRegressionPredict:["regressionEvaluation"],logisticRegressionTrain:["logisticRegressionPredict"],logisticRegressionPredict:["binaryClassEvaluation"],movingAverage:["ewma"],pivot:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],hierarchicalClustering:["hierarchicalClusteringPostProcess"],timeSeriesTranspose:["timeSeriesDistance"],quantileDiscretizer:["typeCast"],reorganizeTable:["changeColumnName","capitalizeColName"]},realtime:{default:["streamingRead"]},etl:{default:["erdTSum","fabData","ept"]},deeplearning:{default:["dlLoad","conv2D","maxPooling2D"]},getList:function(t,e){return this[e||"data"][t]||[]}},this.Brightics.VA.Env.Tags={data:["Trend","Timeseries","Transform","Sort","Preprocessing","Add Column","Filter","Remove","Missing Value","Statistics","Prescriptive"],realtime:["I/O","Clustering","Filter","Preprocessing","Prescriptive","Trend","Transform"],etl:[]},this.Brightics.VA.Default.model={addProblems:function(t){t&&this.problemList.indexOf(t)<0&&(this.problemList=this.problemList.concat(t))},getProblemsByFid:function(t){var e=[];for(var n in this.problemList)this.problemList[n]&&this.problemList[n].fid===t&&e.push(this.problemList[n]);return e},getProblemsByMid:function(t){var e=[];for(var n in this.problemList)this.problemList[n]&&this.problemList[n].mid===t&&e.push(this.problemList[n]);return e},newFnUnit:function(t){var r=e.VA.Core.Utils.WidgetUtils.getFunctionLibrary(this.type,t),i={fid:e.VA.Core.Utils.IDGenerator.func.id()};if("ifElse"===t)i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()},{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}};else if("outData"===t){var o=e.VA.Core.Utils.IDGenerator.func.id(),a=e.VA.Core.Utils.IDGenerator.func.id(),s="/brtc/repo/tmp/"+e.VA.Core.Utils.IDGenerator.file.id();i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:o,param:{"fs-paths":[s]}},{fid:a,param:{"input-path":s,"output-path":s+".csv"}}],links:[{kid:e.VA.Core.Utils.IDGenerator.link.id(),sourceFid:o,targetFid:a}]}}}else"refine"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"dbReader"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"load"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"Subflow"===r.defaultFnUnit[FUNCTION_NAME]?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"if"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{if:$.extend(!0,r.defaultFnUnit.param.if,{mid:e.VA.Core.Utils.IDGenerator.model.id()}),elseif:[],else:$.extend(!0,r.defaultFnUnit.param.else,{mid:e.VA.Core.Utils.IDGenerator.model.id()})}}:"forLoop"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"count",prop:{start:"${=}",end:"${=}","index-variable":""}}}:"whileLoop"===t&&(i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"while",prop:{expression:"${=}","index-variable":""}}});if(r.defaultFnUnit.outputs||r.defaultFnUnit.outData){var c=n.createOutData(this.type,t);$.extend(i,c),"refine"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid]):"dbReader"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]}):"load"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]},i.param.entries=[i.param.functions[0].fid]):"Subflow"===r.defaultFnUnit[FUNCTION_NAME]&&(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid])}return $.extend(!0,{"persist-mode":"auto"},r.defaultFnUnit,i)},addFnUnit:function(t,e){var n=this;t.parent=function(){return n},void 0!==e&&e>-1?n.functions.splice(e,0,t):n.functions.push(t)},removeFnUnit:function(t){var e=-1;for(var n in this.functions){var r=this.functions[n];if(r.fid==t){e=n,delete r.parent;break}}if(e>-1){var i=this.functions[e];return this.functions.splice(e,1),i}},getFnUnitById:function(t){for(var e in this.functions){var n=this.functions[e];if(n.fid==t)return n}},getFnUnitNameById:function(t,e){e=e||this.functions;for(var n in e){var r=e[n];if(r.param&&r.param.functions){var i=this.getFnUnitNameById(t,r.param.functions);if(i)return r.func+"."+i}if(r.fid==t)return r.func}},existsFnUnit:function(t){for(var e in this.functions){var n=this.functions[e];if(n.fid==t)return n;if("Subflow"==n[FUNCTION_NAME])for(var r in n.param.functions)if(n.param.functions[r].fid==t)return n}},getFnUnitByOutTable:function(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutTable(r);if($.inArray(t,i)>-1)return r}},getFnUnitByOutData:function(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutData(r);if($.inArray(t,i)>-1)return r}},getLinkUnitById:function(t){for(var e in this.links){var n=this.links[e];if(n.kid==t)return n}},getRoots:function(t){var e=[],n=this.getPrevious(t);if(0==n.length)e.push(t);else for(var r in n)e=e.concat(this.getRoots(n[r]));return e},getParents:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&(e.push(r[SOURCE_FID]),e=e.concat(this.getParents(r[SOURCE_FID])))}return e},getPrevious:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&e.push(r[SOURCE_FID])}return e},getPreFnUnitByCondition:function(t,e){var n=this.getPrevious(t);for(var r in n){var i=this.getFnUnitById(n[r]);if(e(i))return i}},getNext:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[SOURCE_FID]==t&&e.push(r[TARGET_FID])}return e},getLeafs:function(){var t=[];for(var e in this.functions){var n=this.functions[e];0===this.getNext(n.fid).length&&t.push(n.fid)}return t},getConnectedLinkUnits:function(t){var e=[];for(var n in this.links){var r=this.links[n];r[SOURCE_FID]!=t&&r[TARGET_FID]!=t||e.push(r)}return e},getParamValue:function(t,e){return this.getFnUnitById(t).param[e]},adjustLinks:function(){var t,e=[];for(t in this.functions)this.functions[t]&&e.push(this.functions[t].fid);var n=[];for(t in this.links){var r=this.links[t];(e.indexOf(r[SOURCE_FID]||r["source-fid"])<0||e.indexOf(r[TARGET_FID]||r["target-fid"])<0)&&n.push(r)}for(t in n)this.links.splice(this.links.indexOf(n[t]),1)},getAllPreviousFnUnitIds:function(t){var n=this.getPrevious(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllPreviousFnUnitIds(n);return t.concat(o)}return t.concat(n)},[]))},getAllNextFnUnitIds:function(t){var n=this.getNext(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllNextFnUnitIds(n);return t.concat(o)}return t.concat(n)},[]))},getAllPreviousFnUnits:function(t){var e=this;return this.getAllPreviousFnUnitIds(t).map(function(t){return e.getFnUnitById(t)})},getAllNextFnUnits:function(t){var e=this;return this.getAllNextFnUnitIds(t).map(function(t){return e.getFnUnitById(t)})},getLinkSourceFnUnits:function(t){var n=this,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getPrevious(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkSourceFnUnits(e))},[r]),"fid")}return[r]},getLinkTargetFnUnits:function(t){var n=this,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getNext(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkTargetFnUnits(e))},[r]),"fid")}return[r]}},this.Brightics.VA.Default.analyticsModel={type:"data",sheets:[],param:{},functions:[],links:[],preferences:{},problemList:[],report:{title:"Report",data:[]},inVariableList:function(t){return _.findIndex(this.variableRef,function(e){return e.fid===t})},getVariable:function(t,e){var n=this.inVariableList(t);if(n>-1)return this.variableRef[n].param[e]},getVariables:function(t){var e=this.inVariableList(t);if(e>-1)return this.variableRef[e].param},getParameters:function(){return this.param},getParameter:function(t){return this.param[t]},setParameter:function(t,e){this.param[t]=e},addVariableDef:function(t,e){this.variables[t]=$.extend({},e)},removeVariableDef:function(t){delete this.variables[t]},setVariableDef:function(t,e){this.variables[t]&&(this.variables[t]=$.extend({},e))},addVariable:function(t,e,n){var r=this.inVariableList(t);if(r>-1)this.variableRef[r].param[e]=n;else{var i={fid:t,param:{}};i.param[e]=n,this.variableRef.push(i)}},setVariable:function(t,e,n){var r=this.inVariableList(t);r>-1&&this.variableRef[r].param[e]&&(this.variableRef[r].param[e]=n)},removeVariable:function(t,e){var n=this.inVariableList(t);n>-1&&(delete this.variableRef[n].param[e],0===Object.keys(this.variableRef[n].param).length&&this.variableRef.splice(n,1))}},this.Brightics.VA.Utils.CookieUtil={setCookie:function(t,e,n){var r="";if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),r="expires="+i.toUTCString()}document.cookie=t+"="+e+"; "+r},getCookie:function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}}},this.Brightics.VA.Env.SQLFunctions=["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"],this.Brightics.VA.Env.PersistFalseFunctions=[]}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.DataQueryTemplate={schemaCache:{},cache:{},requested:{},addCache:function(t,e,n){var r=t+"_"+e;this.schemaCache[r]=n},removeCache:function(t,e){if(e){var n=t+"_"+e;delete this.cache[n],delete this.schemaCache[n]}else{var r=[];for(var i in this.cache)0==i.indexOf(t+"_")&&r.push(i);for(var o in r)delete this.cache[r[o]];for(var i in r=[],this.schemaCache)0==i.indexOf(t+"_")&&r.push(i);for(var o in r)delete this.schemaCache[r[o]]}},isCached:function(t,e){var n=t+"_"+e;return this.cache[n]},clearCache:function(){this.cache={},this.schemaCache={}},queryTable:function(t,e,n,r,i,o){var a=t+"_"+e;o=o||{};!0!==i&&this.cache[a]?n(this.cache[a],e):o.publish?(o.destination="publish",this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o)):this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o)},queryTableForReport:function(t,e,n,r,i){var o=t+"_"+e;!0!==i&&this.cache[o]?n(this.cache[o],e):this.queryData(t,e,0,1e3,n,r,"/report")},fetchMore:function(t,e,n,r,i){var o=1e3,a=t+"_"+e;o=this.cache[a]&&this.cache[a].columns&&this.cache[a].data?this.cache[a].data.length+n:n,this.queryData(t,e,0,o,r,i)},queryData:function(e,n,r,i,o,a,s){var c=this,u=e+"_"+n,l=s||{};this.requested[u]||(this.requested[u]=[]),this.requested[u].push({done:o,fail:a});var p=l.user||t.VA.Env.Session.userId,d=(l.destination||"api/va/v2/data")+"/staging/query?user="+p+"&mid="+e+"&tab="+n+"&offset="+r+"&limit="+i;$.get(d).done(function(t){c.addCache(e,n,t),c.requested[u].shift().done(t,n)}).fail(function(t){c.removeCache(e,n);c.requested[u].shift().fail({columns:[],data:[],count:0},n,t)})},getSchemaAsync:function(e,n,r,i,o){var a=this,s=(o||{}).user||t.VA.Env.Session.userId,c="api/va/v2/data/staging/query?"+t.VA.Core.Utils.CommonUtils.getQueryString({user:s,mid:e,tab:n,offset:0,limit:1});$.get(c).done(function(t){return a.addCache(e,n,t),r(t.columns)}).fail(function(t){return a.removeCache(e,n),i([],n,t)})},getSchema:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].columns:void 0},querySchema:function(t,e,n,r,i){this.queryTable(t,e,n,r,i)},getSchemaFromData:function(t,e){return console.warn("This method is deprecated"),this.getData(t,e)},getData:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].data:void 0},getTable:function(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n]:void 0}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library={getListByTags:function(t){var e=[];for(var n in this){var r=!1,i=this[n].tags;if(i)$.grep(i,function(e){var n=!1;for(var r in t)e.toLowerCase().indexOf(t[r].toLowerCase())>-1&&(n=!0);return n}).length>0&&(r=!0,e.push(n));if(!r&&this[n]&&this[n].defaultFnUnit&&this[n].defaultFnUnit.display&&this[n].defaultFnUnit.display.label){var o=this[n].defaultFnUnit.display.label;for(var a in t)if(o.toLowerCase().indexOf(t[a].toLowerCase())>-1){e.push(n);break}}}return e},getFunction:function(t){return $.extend(!0,{},this[t])},extendFunctions:function(t){for(var e={},n={},r=0;r<t.length;r++)n[t[r]]=this[t[r]],$.extend(!0,e,n);return e},addFunction:function(t,e){this[t]=e},getFunctionViewer:function(t,e){var n=[];return Brightics.VA.Core.Functions.Viewer[t]?n=Brightics.VA.Core.Functions.Viewer[t][e]:n.push("data"),n}}}.call(this),function(){"use strict";var t=this.Brightics;const e={func:"dummy",name:"BigDataDummy",inData:[],outData:[],param:{},label:"Big Data Dummy",display:{label:"Big Data Dummy",diagram:{position:{x:20,y:10}},sheet:{out:[{panel:[],layout:{}}]}},mandatory:[]},n={scatter:"bigDataScatter",line:"bigDataLine",area:"bigDataLine","area-stacked":"bigDataColumn","area-stacked-100":"bigDataColumn",roccurve:"bigDataLine",pie:"bigDataPie",column:"bigDataColumn","column-stacked":"bigDataColumn","column-stacked-100":"bigDataColumn",bar:"bigDataColumn","bar-stacked":"bigDataColumn","bar-stacked-100":"bigDataColumn",histogram:"bigDataHistogram",boxplot:"bigDataBoxPlot",bubble:"bigDataBubble",card:"bigDataCard",heatmap:"bigDataHeatmap","heatmap-matrix":"bigDataHeatmapMatrix",treemap:"bigDataTreemap",donut:"bigDataPie"};function r(t){this.options=t||{}}r.prototype.initFnUnit=function(){var r=this.options.chartOptions.chart.type,i=n[r],o=t.VA.Core.Functions.Library.getFunction(i).defaultFnUnit;o||(o=$.extend(!0,{},e)),o.fid=t.VA.Core.Utils.IDGenerator.func.id(),this.fnUnit=o},r.prototype.inputParams=function(){},r.prototype.setColorByParam=function(){var t=this.options.chartOptions,e=this.fnUnit.param;if(t.colorBy&&t.colorBy[0]&&t.colorBy[0].selected)for(var n in t.colorBy[0].selected)t.colorBy[0].selected[n]&&t.colorBy[0].selected[n].name&&(_.isEmpty(e["color-by"])&&(e["color-by"]=[]),e["color-by"].push(t.colorBy[0].selected[n].name))},r.prototype.setAggregationParam=function(){var t=this.fnUnit.param,e=this.aggregation;e&&""!=e?("average"==e&&(e="avg"),"unique_count"==e&&(e="ucount"),t.aggregation=e):delete t.aggregation},r.prototype.generate=function(){return this.initFnUnit(),this.inputParams(),$.extend(!0,{},this.fnUnit)},t.VA.Core.Utils.FnUnitGenerator=r}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.area=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.area,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name);else e["color-by"]=[]},t.VA.Core.Utils.FnUnitGenerator["area-stacked-100"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.area,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name);else e["color-by"]=[]},t.VA.Core.Utils.FnUnitGenerator["area-stacked"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]],this.aggregation=e.xAxis[0].selected[0].aggregation),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]]),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.bar=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]],this.aggregation=e.xAxis[0].selected[0].aggregation),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]]),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.bar,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name);else e["color-by"]=[]},t.VA.Core.Utils.FnUnitGenerator["bar-stacked"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]],this.aggregation=e.xAxis[0].selected[0].aggregation),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]]),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.bar,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name);else e["color-by"]=[]},t.VA.Core.Utils.FnUnitGenerator["bar-stacked-100"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]])},t.VA.Core.Utils.FnUnitGenerator.boxplot=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]]),this.setColorByParam(),this.setSizeByParam()},e.prototype.setSizeByParam=function(){var t=this.options.chartOptions.plotOptions.bubble,e=this.fnUnit.param;if(t.sizeBy&&t.sizeBy[0]&&t.sizeBy[0].selected)for(var n in t.sizeBy[0].selected)t.sizeBy[0].selected[n]&&t.sizeBy[0].selected[n].name&&(e["size-by"].push(t.sizeBy[0].selected[n].name),e.aggregation=t.sizeBy[0].selected[0].aggregation);else e["size-by"]=[]},t.VA.Core.Utils.FnUnitGenerator.bubble=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.plotOptions.card&&e.plotOptions.card.valueBy&&e.plotOptions.card.valueBy[0]&&e.plotOptions.card.valueBy[0].selected[0]&&(t.value=[[e.plotOptions.card.valueBy[0].selected[0].name]],this.aggregation=e.plotOptions.card.valueBy[0].selected[0].aggregation),this.setAggregationParam()},t.VA.Core.Utils.FnUnitGenerator.card=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.column=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.column,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name)},t.VA.Core.Utils.FnUnitGenerator["column-stacked-100"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setStackByParam()},e.prototype.setStackByParam=function(){var t=this.options.chartOptions.plotOptions.column,e=this.fnUnit.param;if(t.stackBy&&t.stackBy[0]&&t.stackBy[0].selected)for(var n in t.stackBy[0].selected)t.stackBy[0].selected[n]&&t.stackBy[0].selected[n].name&&e["color-by"].push(t.stackBy[0].selected[n].name)},t.VA.Core.Utils.FnUnitGenerator["column-stacked"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.plotOptions.donut&&e.plotOptions.donut.sizeBy&&e.plotOptions.donut.sizeBy[0]&&e.plotOptions.donut.sizeBy[0].selected[0]?(t["size-by"]=[e.plotOptions.donut.sizeBy[0].selected[0].name],this.aggregation=e.plotOptions.donut.sizeBy[0].selected[0].aggregation):t["size-by"]=[[]],this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.donut=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]]),this.setValueByParam(),this.setAggregationParam()},e.prototype.setValueByParam=function(){var t=this.options.chartOptions.plotOptions.heatmap,e=this.fnUnit.param;if(t.valueBy&&t.valueBy[0]&&t.valueBy[0].selected)for(var n in t.valueBy[0].selected)t.valueBy[0].selected[n]&&t.valueBy[0].selected[n].name&&(e["value-by"].push(t.valueBy[0].selected[n].name),this.aggregation=t.valueBy[0].selected[0].aggregation);else e["value-by"]=[]},t.VA.Core.Utils.FnUnitGenerator.heatmap=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;if(this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected)for(var n in t.xcolumn=[],e.xAxis[0].selected)e.xAxis[0].selected[n]&&e.xAxis[0].selected[n].name&&t.xcolumn.push([e.xAxis[0].selected[n].name]);e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[e.yAxis[0].selected[0].name]])},t.VA.Core.Utils.FnUnitGenerator["heatmap-matrix"]=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.column=this.options.chartOptions.xAxis[0].selected[0].name)},t.VA.Core.Utils.FnUnitGenerator.histogram=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.line=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.plotOptions.pie&&e.plotOptions.pie.sizeBy&&e.plotOptions.pie.sizeBy[0]&&e.plotOptions.pie.sizeBy[0].selected[0]?(t["size-by"]=[e.plotOptions.pie.sizeBy[0].selected[0].name],this.aggregation=e.plotOptions.pie.sizeBy[0].selected[0].aggregation):t["size-by"]=[[]],this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.pie=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.roccurve=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;this.aggregation="",e.xAxis&&e.xAxis[0]&&e.xAxis[0].selected&&e.xAxis[0].selected[0]&&(t.xcolumn=[[this.options.chartOptions.xAxis[0].selected[0].name]]),e.yAxis&&e.yAxis[0]&&e.yAxis[0].selected&&e.yAxis[0].selected[0]&&(t.ycolumn=[[this.options.chartOptions.yAxis[0].selected[0].name]],this.aggregation=e.yAxis[0].selected[0].aggregation),this.setAggregationParam(),this.setColorByParam()},t.VA.Core.Utils.FnUnitGenerator.scatter=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Utils.FnUnitGenerator.call(this,e)}e.prototype=Object.create(t.VA.Core.Utils.FnUnitGenerator.prototype),e.prototype.constructor=e,e.prototype.inputParams=function(){var t=this.fnUnit.param,e=this.options.chartOptions;if(this.aggregation="",e.plotOptions.treemap&&e.plotOptions.treemap.hierarchyCol&&e.plotOptions.treemap.hierarchyCol[0])for(var n in t.hierarchy=[],e.plotOptions.treemap.hierarchyCol[0].selected)e.plotOptions.treemap.hierarchyCol[0].selected[n]&&e.plotOptions.treemap.hierarchyCol[0].selected[n].name&&t.hierarchy.push([e.plotOptions.treemap.hierarchyCol[0].selected[n].name]);e.plotOptions.treemap&&e.plotOptions.treemap.sizeBy&&e.plotOptions.treemap.sizeBy[0]&&e.plotOptions.treemap.sizeBy[0].selected[0]&&(t["size-by"]=[e.plotOptions.treemap.sizeBy[0].selected[0].name],this.aggregation=e.plotOptions.treemap.sizeBy[0].selected[0].aggregation),this.setAggregationParam()},t.VA.Core.Utils.FnUnitGenerator.treemap=e}.call(this),function(){"use strict";var t={},e=brtc_require("crel");t.USER_INPT_ARR_DELIMETER="[i]",this.Brightics.VA.Core.Utils.CommonUtils={getUserBrowserName:function(){!!window.chrome&&window.chrome.webstore;return window.navigator.userAgent.indexOf("Chrome")>=0?"Chrome":document.documentMode?"Internet Explorer":!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0?"Opera":"undefined"!=typeof InstallTrigger?"Firefox":Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||"[object SafariRemoteNotification]"===(!window.safari||safari.pushNotification).toString()?"Safari":void 0},downloadJsonFile:function(t,e){var n=this.getUserBrowserName(),r=new Blob([t],{type:"text/json;charset=utf-8;"});if("Internet Explorer"===n)window.navigator.msSaveBlob(r,e+".json");else{var i=URL.createObjectURL(r),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",e+".json"),o.click(),URL.revokeObjectURL(i)}},numberToStringWithComma:function(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},getTimeDifferenceFromNow:function(t){var e=new Date(t);return((new Date).getTime()-e.getTime())/36e5},transferTimestampToDateString:function(t){var e=function(t){return t<10?"0"+t:t};return t.getFullYear()+"-"+e(t.getMonth()+1)+"-"+e(t.getDate())+" "+e(t.getHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())},convertDataTypeForText:function(t,e){if(void 0===t)return"-";if(-1!==t.indexOf("[")){var n,r=e.replace("[]","");switch(r){case"String":n="S";break;case"Integer":n="I";break;case"Long":n="L";break;case"Double":n="Db";break;case"Date":n="Dt";break;case"Boolean":n="Bl";break;case"Byte":n="Bt";break;default:n=r}return"Array("+n+")"}return"map"===t?"Map":e},convertDataTypeForTitle:function(t,e){return void 0===t?"Undefined Type":-1!==t.indexOf("[")?"Array("+e.replace("[]","")+")":e},getTypes:function(){return[{type:"number",internalType:"Integer"},{type:"number",internalType:"Long"},{type:"number",internalType:"Double"},{type:"string",internalType:"Boolean"},{type:"string",internalType:"String"},{type:"number[]",internalType:"Double[]"},{type:"number[]",internalType:"Long[]"},{type:"string[]",internalType:"Boolean[]"},{type:"string[]",internalType:"String[]"},{type:"byte[]",internalType:"Byte[]"},{type:"number[]",internalType:"Double[]"},{type:"number[]",internalType:"Long[]"},{type:"string[]",internalType:"String[]"},{type:"byte[]",internalType:"Byte[]"},{type:"map",internalType:"Map(Integer,Double)"},{type:"map",internalType:"Map(String,Double)"},{type:"map",internalType:"Map(Integer,Double)"},{type:"map",internalType:"Map(String,String)"},{type:"date",internalType:"Date"}]},fetchFromObject:function(e,n){if(void 0!==e&&void 0!==n)try{var r=e.indexOf("."),i=e.slice(0,r).indexOf(t.USER_INPT_ARR_DELIMETER);if(i>-1){var o=[],a=n[e.substring(0,i)];if(a)for(var s=0;s<a.length;s++){e.indexOf(".")>-1&&o.push(this.fetchFromObject(e.substr(i+4),a[s]))}return o.length>0?o:a}return r>-1?this.fetchFromObject(e.substr(r+1),n[e.substring(0,r)]):n[e]}catch(t){console.error(e),console.error(t)}},isPC:function(){var t=!0;return["win16","win32","win64","macintel","mac"].indexOf(navigator.platform.toLowerCase())<0&&(t=!1),t},byteCalculation:function(t){t=parseInt(t);var e=["bytes","KB","MB","GB","TB","PB"],n=Math.floor(Math.log(t)/Math.log(1024));return"-Infinity"==n?"0 "+e[0]:(t/Math.pow(1024,Math.floor(n))).toFixed(2)+" "+e[n]},getQueryString:function(t){return _.map(t,function(t,e){return e+"="+t}).join("&")},getObjByJsonPath:function(t,e){var n=Array.isArray(e)?e.reduce(function(t,e,n,r){return t=t&&t[e]?t[e]:void 0},t):t[e];return Array.isArray(n)?$.extend(!0,[],n):"object"==typeof n?$.extend(!0,{},n):n},removeArrayElement:function(t,e){_.remove(t,function(t){return e.indexOf(t)>-1})},dim:function(t,n){var r=$((n||{}).appendTo||document.body),i=Promise.resolve().then(function(){return"function"==typeof t?t():t}),o=$(e("div",{class:"brtc-dim"},e("div",{class:"brtc-dim-text brtc-style-apper-1sendond"},e("i",{class:"fa fa-spinner fa-pulse fa-5x fa-fw"}))));return r.append(o),i.then(function(t){return o.remove(),t}).catch(function(t){throw o.remove(),t})},progress:function(t,e){var n=e||{},r=e.showPercent||!1,i=e.msg||"",o=$(n.appendTo||document.body),a=Promise.resolve().then(function(){return"function"==typeof t?t():t}),s=$(' <div class="brtc-va-progress"> <div> <span class="brtc-va-progress-loading"/> <p>'+i+"</p>"+(r?'<p class="brtc-va-progress-percent"></p>':"")+" </div></div>");return s.css("top","0"),s.css("left","0"),o.append(s),a.then(function(t){return s.remove(),t}).catch(function(t){throw s.remove(),t})}}}.call(this),function(){"use strict";var t=this.Brightics;this.Brightics.VA.Core.Utils.DownLoader={run:function(t,e,n,r,i,o,a){var s="/"+t+"/"+e+"/"+n;this.runStartWithExport(r,s,i,o,a)},runStartWithExport:function(t,e,n,r,i){this.export(t,e,n,r,i)},doDownload:function(t,e,n,r,i,o){this.download(t,e).always(function(){var t={url:"api/v1/repo/alluxio/datas/"+n+"/destroy",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify({type:"tmp",data:n})};$.extend(!0,t,o),$.ajax(t),t={url:"api/v1/repo/alluxio/datas/"+n+".csv/destroy",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify({type:"tmp",data:n+".csv"})},$.extend(!0,t,o),$.ajax(t)}).done(function(){"function"==typeof r&&r()}).fail(i)},progress:function(e,n,r){var i={fail:function(t){return this.failCallback=t,this},done:function(t){return this.doneCallback=t,this}},o=function(){var e={url:"api/va/v2/analytics/jobs/"+n,type:"GET",blocking:!1};$.extend(!0,e,r),$.ajax(e).done(function(e){if("FAIL"===e.status||"ABORT"===e.status){var n={status:400,responseJSON:{errors:[{code:400,message:"Failed to export data."}]}};try{var r=t.VA.Core.Utils.MessageUtils.getFunctionLabels("unload",e.errorInfo[0].parameter);n.responseJSON.errors[0].message=t.VA.Core.Utils.MessageUtils.getMessage(e.errorInfo[0].errorCode,r),i.failCallback&&i.failCallback(n)}catch(t){i.failCallback&&i.failCallback(n)}}else"SUCCESS"===e.status?i.doneCallback&&i.doneCallback():setTimeout(o,3e3)}).fail(function(t){i.failCallback&&i.failCallback(t)})};return setTimeout(o,3e3),i},unload:function(t,e,n,r,i,o){var a=this,s={fail:function(t){return this.failCallback=t,this},done:function(t){return this.doneCallback=t,this}},c="va_"+Date.now();i?(i.delimiter||(i.delimiter=","),i["array-delimiter"]||(i["array-delimiter"]=";"),i["key-value-delimiter"]||(i["key-value-delimiter"]=":"),i["quote-delimiter"]||(i["quote-delimiter"]='"')):i={delimiter:",","array-delimiter":";","key-value-delimiter":":","quote-delimiter":'"'};var u={user:t,jid:c,main:e,args:{},models:{}};u.models[e]={mid:e,type:"data",functions:[{fid:"f-unload",func:"unload",inData:[n],name:"OutData",param:{"io-mode":"write","fs-type":"alluxiocsv","df-names":[n],"fs-paths":[r],delimiter:i.delimiter,"array-delimiter":i["array-delimiter"],"key-value-delimiter":i["key-value-delimiter"],quote:i["quote-delimiter"]}}],links:[],entries:["f-unload"]};var l={url:"api/va/v2/analytics/jobs",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify(u),blocking:!1};return $.extend(!0,l,o),$.ajax(l).done(function(){a.progress(t,c).done(s.doneCallback).fail(s.failCallback)}).fail(function(){s.failCallback&&s.failCallback()}),s},export:function(e,n,r,i,o,a){e=e;var s=r.delimiter||",",c=n,u={url:"api/va/v2/data/download",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({delimiter:s,remotePath:c,filename:e}),blocking:!1,timeout:18e5};$.extend(!0,u,a);var l=encodeURIComponent(c),p=encodeURIComponent(s),d=encodeURIComponent(e);$.ajax(u).done(function(n){if(window.navigator.msSaveBlob)Promise.resolve($.get("api/va/v2/data/download/files/?"+t.VA.Core.Utils.CommonUtils.getQueryString({key:l,delimiter:p,filename:d}))).then(function(t){console.log(t),window.navigator.msSaveBlob(new Blob([t]),e)});else{var r=document.createElement("a");r.setAttribute("href",encodeURI("api/va/v2/data/download/files/?key="+encodeURIComponent(c)+"&delimiter="+encodeURIComponent(s)+"&filename="+encodeURIComponent(e))),r.setAttribute("download",e),r.setAttribute("id","downloadfile"),r.setAttribute("target","_blank"),$(r)[0].click(),setTimeout(function(){$("#downloadfile").remove()},1e4)}i()}).fail(function(t){o(t)})},download:function(t,e,n){var r={remotePath:t,localFileName:e},i={url:"api/va/v2/data/download",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(r)};return $.extend(!0,i,n),$.ajax(i).done(function(t){$("<object>",{id:"downloadfile",data:"api/va/v2/repo/download/files/"+t.file,target:"_top",type:"text/html",title:"Title"}).hide().appendTo("body"),setTimeout(function(){$("#downloadfile").remove()},1e4)}).fail(function(t){console.log(t)})}}}.call(this),function(){"use strict";var t=this.Brightics;this.Brightics.VA.Core.Utils.ExportUtils={exportProject:function(e,n,r){!function(e,n,r){ResourceManager.fetchProject(e).then(function(t){return ResourceManager.initProject(t)}).then(function(){var n=ResourceManager.getProject(e).toJSON();return n?(n.files=_.map(ResourceManager.getFiles(e),function(t){return t.toJSON()}),function(e){var n=_.filter(e.files,function(t){return"control"===t.type}),r=_.map(n,function(n){return t.VA.Core.Utils.ModelUtils.createModelTree(e.id,n.contents)});return Promise.all(r).then(function(t){return _.reduce(t,_.merge,{})}).then(function(t){var e=[];return _.forOwn(t,function(t){_.forOwn(t.version,function(t){e.push(t)})}),e})}(n).then(function(t){return n.versions=_.map(t,function(t){return t.toJSON()}),n})):Promise.reject("there is no project")}).then(function(t){n&&"function"==typeof n&&n([t])}).catch(function(t){r(t)})}(e,n,r)}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.FileDao={getFile:function(t,e,n,r){return function(t,e,n){return new Promise(function(r,i){$.ajax(t).done(function(t){e&&"function"==typeof e&&(t&&t.length?e(t[0]):e(t||null)),t&&t.length?r(t[0]):r(t||null)}).fail(function(t){n&&"function"==typeof n&&n(t),i(t)})})}({url:"api/va/v2/ws/projects/"+t+"/files/"+e,type:"GET",contentType:"application/json; charset=utf-8"},n,r)}}}.call(this),function(){"use strict";var t;this.Brightics.VA.Core.Utils.FileVersionDao=(t=function(t,e,n){return new Promise(function(r,i){$.ajax(t).done(function(t){e&&"function"==typeof e&&e(t),r(t)}).fail(function(t){n&&"function"==typeof n&&n(t),i(t)})})},{getFileVersions:function(e,n,r,i){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions",type:"GET",contentType:"application/json; charset=utf-8"},r,i)},getFileVersion:function(e,n,r,i,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+r,type:"GET",contentType:"application/json; charset=utf-8"},i,o)},addFileVersion:function(e,n,r,i,o){var a={url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(r)};return t(a,i,o)},addFileVersionSync:function(e,n,r,i,o){var a={url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions",type:"POST",contentType:"application/json; charset=utf-8",blocking:!0,data:JSON.stringify(r)};return t(a,i,o)},deleteFileVersion:function(e,n,r,i,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+r+"/delete",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1},i,o)},updateFileVersion:function(e,n,r,i,o,a){var s={url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+r+"/update",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(i)};return t(s,o,a)},loadFileVersion:function(e,n,r,i,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+r+"/load",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1},i,o)}})}.call(this),function(){"use strict";var t=this.Brightics;const e=3e4;function n(t,e){return"string"==typeof e?t.id+e:t.id+e[OUT_DATA][0]}t.VA.Core.Utils.FullRenderingUtils={getFnUnit:function(e){var n=e.chart.type,r={chartOptions:e};return(t.VA.Core.Utils.FnUnitGenerator[n]?new t.VA.Core.Utils.FnUnitGenerator[n](r):new t.VA.Core.Utils.FnUnitGenerator(r)).generate()},convertToChartSource:function(t,e){var n=e;if("bigDataBoxPlot"===t||"boxplot"===t)for(var r in n.data){n.data[r][1].box=n.data[r][1].box.split(",").map(function(t){return parseFloat(t)});var i=n.data[r][1].outliers;i=""!=i?i.split(",").map(function(t){return parseFloat(t)}):[]}return n.dataType="chartdata",n},getRenderedData:function(r,i,o,a,s,c){var u=this,l={dataType:"rawdata",columns:[],data:[]},p=function(t){return t&&"function"==typeof t?t:function(){}},d=p(a),f=p(s),h=p(c),g=function(t){return{offset:0,limit:t,user:o.user,publish:o.publish}},y=o.mid||r.parent().mid,m=r[IN_DATA];"dummy"===r.func?function(e,n){t.VA.Core.DataQueryTemplate.queryTable(e,n,function(t,e){t.dataType="rawdata",d(t,e)},function(t,e,n){f(t,e,n)},!0,g(1e4))}(y,m):t.VA.Core.DataQueryTemplate.queryTable(y,m,function(a,s){a.count>=0&&a.count<e?(a.dataType="rawdata",d(a,s)):new Promise(function(e,i){try{if(!o.publish)return i();t.VA.Core.DataQueryTemplate.queryTable(y,n(o.contentUnit.content,r[IN_DATA][0]),function(t,n){return e([t,n])},function(t,e,n){return i(n)},!0,g(1e5))}catch(t){return i(t)}}).then(function(t){var e=t[0],n=t[1],i=u.convertToChartSource(r.func,e);d(i,n)}).catch(function(){var e={success:function(e){var n=r[OUT_DATA];t.VA.Core.DataQueryTemplate.queryTable(y,n,function(t,e){var n=u.convertToChartSource(r.func,t);d(n,e)},function(t,e,n){f(t,e,n)},!0,g(1e5)),h(e.result)},fail:function(t){f(l,s,t)},catch:function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),f(l,s,e)}};i.launchUnit(Object.assign({},r,{persist:!0}),{},o,e)})},function(t,e,n){f(t,e,n)},!0,g(e))},getBigDataTargetTid:n,isBigData:function(n){var r=n,i=r.modelId,o=r.tableId,a=r.user,s=r.isPublish,c=function(t,e){if(void 0===e)throw new Error(t+" is required")};return c("modelId",i),c("tableId",o),c("user",a),c("isPublish",s),new Promise(function(n,r){t.VA.Core.DataQueryTemplate.queryTable(i,o,function(t,r){return n(t.count>=e)},function(t,e,n){return r(n)},!0,{offset:0,limit:e,user:a,publish:s})})}}}.call(this),function(){"use strict";var t=this.Brightics;function e(t,n){for(var r in t)if(e(t[r].param.functions,n),"dataFlow"===t[r].func){var i=t[r].param.mid;t[r].param.mid=n[i]||"DeletedDataFlow"}}this.Brightics.VA.Core.Utils.ImportUtils={importProject:function(n,r,i,o,a){if(i.length){var s=t.VA.Core.Utils.IDGenerator.project.id(),c=i[0];!function(e,n,r,i,o){var a=new t.VA.Vo.Project;a.setProjectId(e),a.setLabel(n||"untitled"),a.setDescription(r||""),a.setCreator(t.VA.Env.Session.userId),ResourceManager.addProject(a).then(function(){i()}).catch(function(t){o(t)})}(s,n,r,function(){c.versions=c.versions||[];var n=function(e,n){var r={},i=function(e){_.forEach(e,function(e){e.param.functions&&i(e.param.functions),e.param.mid&&(r[e.param.mid]=r[e.param.mid]||t.VA.Core.Utils.IDGenerator.model.id())})};e&&_.forEach(e,function(e){r[e.id]=r[e.id]||t.VA.Core.Utils.IDGenerator.model.id(),i(e.contents.functions)});n&&_.forEach(n,function(e){r[e.file_id]=r[e.file_id]||t.VA.Core.Utils.IDGenerator.model.id(),i(e.contents.functions)});return r}(c.files,c.versions);!function(t,n,r){t&&_.forEach(t,function(t){"control"===t.type&&e(t.contents.functions,r);var n=t.id;t.id=r[n],t.contents.mid=r[n]});n&&_.forEach(n,function(t){"control"===t.type&&e(t.contents.functions,r);var n=t.file_id;t.file_id=r[n],t.contents.mid=r[n]})}(c.files,c.versions,n),function(e,n){var r={};e&&_.forEach(e,function(t){r[t.id]=r[t.id]||{version:{}},r[t.id].main=t.contents});n&&_.forEach(n,function(t){r[t.file_id]=r[t.file_id]||{version:{}},r[t.file_id].version[t.version_id]=t.contents});var i=t.VA.Core.Utils.ModelUtils.cloneModelsByTree(r);e&&_.forEach(e,function(t){t.contents=i[t.id].main});n&&_.forEach(n,function(t){t.contents=i[t.file_id].version[t.version_id]})}(c.files,c.versions),function(e,n){var r={};return Promise.all(_.map(n,function(n){var i=new t.VA.Vo.Version(n);return i.setIsManual(!0),t.VA.Dao.VersionDao.addVersion(e,i.getFileId(),i).then(function(t){r[i.getVersionId()]=t.getVersionId()})})).then(function(){return r})}(s,c.versions).then(function(e){!function(t,e){_.forEach(t,function(t){_.forEach(t.contents.functions,function(t){"DataFlow"===t[FUNCTION_NAME]&&t.param.version_id&&(t.param.version_id=e[t.param.version_id])})})}(c.files,e),function(e,n,r,i){var o=[];for(var a in n)if("visual"!==n[a].type){var s=n[a],c=t.VA.Core.Utils.ModelUtils.cloneModel(s.contents),u=new t.VA.Vo.File;u.setFileId(s.id),u.setProjectId(e),u.setLabel(s.label),u.setDescription(s.description),u.setContents(c),u.setCreator(t.VA.Env.Session.userId);var l=ResourceManager.addFile(e,u);o.push(l)}Promise.all(o).then(function(){r&&"function"==typeof r&&r(e)},function(t){i&&"function"==typeof i&&i(t)})}(s,c.files,function(){o&&"function"==typeof o&&o(s)},a)}).catch(function(t){a(t)})},a)}else a&&"function"==typeof a&&a("Invalid JSON Data.")}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.InputValidator={isDefaultKeyCode:function(t){var e=t.keyCode,n=t.ctrlKey;return!!(-1!==$.inArray(e,[46,8,9,27,13,110])||n||16===e||17===e||e>=35&&e<=40)},isNotInsertKeyCode:function(t){var e=t.keyCode,n=t.ctrlKey;return!!(-1!==$.inArray(e,[8,27,46,110])||n&&-1!==$.inArray(e,[65,67,88,90])||e>=35&&e<=40)},isValid:{type1:function(t){return new RegExp("^[a-zA-Z0-9_]+$").test(t)},type2:function(t){return new RegExp("^[a-zA-Z0-9_\\s]+$").test(t)},type3:function(t){return new RegExp("^[a-zA-Z0-9_{}\\$]+$").test(t)},type4:function(t){return new RegExp("^[a-zA-Z0-9_\\.]+$").test(t)},type5:function(t){return new RegExp("^[0-9_]").test(t)},type6:function(t){return new RegExp("^[a-zA-Z ]+$").test(t)},columnNameType:function(t){return!new RegExp("^[0-9]+").test(t)},integerType:function(t){return new RegExp("^[0-9]+$").test(t)},startWithSpace:function(t){return new RegExp("^\\s").test(t)},endWithSpace:function(t){return new RegExp("\\s$").test(t)},cronType:function(t){return new RegExp("^[A-Z0-9-?*/,# ]+$").test(t)},rangeType:function(t){return new RegExp("^[0-9_.-~]+$").test(t)},featureEncodingRangeType:function(t){return new RegExp("^[0-9_.~]+$").test(t)},fileNameType:function(t){return new RegExp("^[a-zA-Z0-9_./@]+$").test(t)},renamefileType:function(t){return new RegExp("^[a-zA-Z0-9_.]+$").test(t)}},replaceKoreanToEmpty:function(t){return t.replace(/[ㄱ-ㅎㅏ-ㅣ가-힣]/g,"")},appendValidationCondition:function(t){var e=this;if(t.attr("valid-type")){var n=t.attr("valid-type");t.on("paste",function(r){var i=(r.originalEvent.clipboardData||window.clipboardData).getData("Text");if(!e.isValid[n](i)){r.preventDefault();Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"※ This pasted string is NOT allowed."})}}),t.keydown(function(r){if(!e.isDefaultKeyCode(r)){var i,o={Spacebar:" ",Up:"ArrowUp",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight"}[(i=r).key]||i.key;if(e.isValid[n](o)||"Process"!==o){if(!e.isValid[n](o)){r.preventDefault();a="※ This character( "+o+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a})}}else{var a="※ Korean character is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a});var s=e.replaceKoreanToEmpty(t.val());e.replaceKoreanToEmptyTimeout&&clearTimeout(e.replaceKoreanToEmptyTimeout),e.replaceKoreanToEmptyTimeout=setTimeout(function(){t.val(s)},100)}}})}}}}.call(this),function(){"use strict";this.Brightics;this.Brightics.VA.Core.Utils.MessageUtils={initMessage:function(){var t=this;$.ajax({url:"api/va/v2/studio/message/en",type:"GET",blocking:!1}).done(function(e){var n={};for(var r in e)n[e[r].code]={message:e[r].message};t.Message=n})},initFunctionLabel:function(){var t=this;this.FunctionLabel={},$.ajax({url:"api/va/v2/studio/functionlabel/en",type:"GET",blocking:!1}).done(function(e){for(var n=0;n<e.length;n++){var r=e[n];t.FunctionLabel[r.functionName]=t.FunctionLabel[r.functionName]||{},t.FunctionLabel[r.functionName][r.parameter]=r.label}})},getFunctionLabels:function(t,e){var n=[];for(var r in e)this.FunctionLabel[t]&&this.FunctionLabel[t][e[r]]?n.push(this.FunctionLabel[t][e[r]]):"inData"===e[r]?n.push("In Table"):n.push(e[r]);return n},getFunctionLabel:function(t,e){return this.FunctionLabel[t]&&this.FunctionLabel[t][e]?this.FunctionLabel[t][e]:e},getMessage:function(t,e){if(!this.Message||!this.Message[t])return"Please contact administrator! Error: "+t;var n=this.Message[t].message;for(var r in e)n=n.replace("%s",e[r]);return n},getReplacedParam:function(t,e){if("evaluateRankingAlgorithm"==t){return["Precision","NDCG","K-Values"]}},getFunctionLabelAll:function(){return this.FunctionLabel}}}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dao,n=brtc_require("ResourceManager"),r=brtc_require("FnUnitUtils");function i(t){var e={fidCache:{},outputCache:{}};for(var n in t){var r=t[n];$.extend(!0,e,o(r))}return e}function o(e){var n={fidCache:{},outputCache:{}},r=n.fidCache,o=n.outputCache;for(var a in r[e.fid]=t.VA.Core.Utils.IDGenerator.func.id(),e[OUT_DATA])o[e[OUT_DATA][a]]=t.VA.Core.Utils.IDGenerator.table.id();return e.param.functions&&$.extend(!0,n,i(e.param.functions)),n}function a(e,n,i){var o=i.fidCache,a=i.tidCache,s=function(){return t.VA.Core.Utils.IDGenerator.table.id()},c=function(t,e,n){t[e]=t[e]||n},u=function(e){c(o,e.fid,t.VA.Core.Utils.IDGenerator.func.id()),_.forEach(r.getAllData(e),function(t){c(a,t,s())}),e.param.tableId&&c(a,e.param.tableId,s()),e.param.functions&&_.forEach(e.param.functions,function(t){u(t)})},l=function(n){_.forEach([IN_DATA,OUT_DATA],function(t){_.forEach(n[t],function(t){c(a,t,s())})}),_.forEach(n.functions,function(n){u(n);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,n);_.forEach(r,l)})};return l(n),i}function s(e,n,r){var i=r.fidCache,o=r.tidCache,a=function(n){for(var s in l(n,o),p(n,o),n.functions){var c=n.functions[s];c.fid=i[c.fid],l(c,o),p(c,o),d(c,o),f(c,i),y(c,o,i),b(c,o),"deeplearning"===n.type&&m(c,i),c.param&&c.param.functions&&a(c.param,r);var u=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,c);_.forEach(u,a)}n.report&&(_.forEach(n.report.data,function(t){t.originData&&t.originData.data&&(t.originData.data.fid=c.fid,v(t,o))}),n.report=A(n.report,i)),h(n,i)};return a(n),g(e,i),e}function c(e,n){_.forEach(e,function(e){!function(e,n){var r=n.fidCache,i=n.outputCache;e.fid.startsWith("d")?r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.dataSource.id():r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.func.id();_.forEach(e.outData,function(e){i[e]=i[e]||t.VA.Core.Utils.IDGenerator.table.id()}),e.param.functions&&c(e.param.functions,n)}(e,n)})}function u(t,e){var n=e.fidCache,r=e.outputCache;for(var i in t.functions){var o=t.functions[i];o.fid=n[o.fid],(o=b(o=y(o=f(o=d(o=p(o=l(o,r),r),r),n),r,n),r)).param&&o.param.functions&&u(o.param,e),"deeplearning"==t.type&&(o=m(o,n))}if(t.report){for(var a in t.report.data)t.report.data[a].originData.data.fid=o.fid,t.report.data[a]=v(t.report.data[a],r);t.report=A(t.report,n)}return t=g(t=h(t,n),n)}function l(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e)}),t}function p(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e)}),t}function d(t,e){if(t.param&&t.param["df-names"])for(var n in t.param["df-names"])t.param["df-names"][n]=e[t.param["df-names"][n]];return t}function f(t,e){if(t.param&&t.param.entries)for(var n in t.param.entries)t.param.entries[n]=e[t.param.entries[n]];return t}function h(e,n){for(var r in e.links){var i=e.links[r],o=t.VA.Core.Utils.IDGenerator.link.id();i.kid=o,i[SOURCE_FID]=n[i[SOURCE_FID]],i[TARGET_FID]=n[i[TARGET_FID]]}return e}function g(t,e){for(var n in t.variableRef){var r=t.variableRef[n].fid;t.variableRef[n].fid=e[r]}return t}function y(e,n,r){if("outData"===e.func&&"Subflow"===e[FUNCTION_NAME])for(var i in e.param.functions)if("exportData"===e.param.functions[i].func){var o="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();e.param["fs-paths"]=[o],e.param.functions[i]&&(e.param.functions[i].param["input-path"]=o,e.param.functions[i].param["output-path"]=o+".csv")}return"DataViewer"===e[FUNCTION_NAME]&&(e.param.fid=r[e.param.fid]),e.param.target&&e.param.linked&&e.param.linked.outputs&&(e.param.target=r[e.param.target],e.param.linked.outputs.model=n[e.param.linked.outputs.model]),e.param.variables&&_.forEach(e.param.variables,function(t,r){const i=e.param.variables[r].param.inData;i&&n[i]&&(e.param.variables[r].param.inData=n[i])}),e}function m(t,e){var n=["train_data","validation_data"];if(!t.param)return t;for(var r=0;r<n.length;r++)t.param[n[r]]&&e[t.param[n[r]]]&&(t.param[n[r]]=e[t.param[n[r]]]);return t}function v(t,e){return t.originData.data.table=e[t.originData.data.table],t}function b(t,e){return t.param.tableId&&(t.param.tableId=e[t.param.tableId]),t}function A(t,e){if(t.pages)for(var n in t.pages){var r=Object.keys(t.pages[n].contents);for(var i in r)t.pages[n].contents[r[i]].dataSourceId=e[t.pages[n].contents[r[i]].dataSourceId]}return t}this.Brightics.VA.Core.Utils.ModelUtils={extendParent:function(t,e){if(e.parent=function(){return t},e.param&&e.param.functions)for(var n in e.param.functions)void 0!==e.param.functions[n].fid&&this.extendParent(e,e.param.functions[n])},extendMainFunc:function(e,n){n.getMainModel=function(){return e},n.isMainModel=function(){return this===this.getMainModel()};var r=t.VA.Core.Utils.NestedFlowUtils.getChildModels(e,n);_.forEach(r,_.partial(this.extendMainFunc.bind(this),e,_))},extendModel:function(e,n){var r,i=this,o=t.VA.Core.Interface.DefaultModel[e.type];if(o){for(var a in r=n?$.extend(!0,{},o,e):$.extend(!0,e,o),_.forIn(r.innerModels,function(t){i.extendInnerModel(r,t)}),(r=$.extend(!0,r,t.VA.Default.model)).functions)r.functions[a]&&(this.extendParent(r,r.functions[a]),void 0===r.functions[a]["persist-mode"]&&(r.functions[a]["persist-mode"]="auto"));return void 0===r["persist-mode"]&&(r["persist-mode"]="auto"),this.extendMainFunc(r,r),r}console.error("Create DefaultModel("+e.type+")!")},extendInnerModel:function(e,n,r){var i,o=t.VA.Implementation.DataFlow.innerModel;if(o){for(var a in i=r?$.extend(!0,{},o,n):$.extend(!0,n,o),(i=$.extend(!0,i,t.VA.Default.model)).functions)i.functions[a]&&(this.extendParent(i,i.functions[a]),void 0===i.functions[a]["persist-mode"]&&(i.functions[a]["persist-mode"]="auto"));return void 0===i["persist-mode"]&&(i["persist-mode"]="auto"),this.extendMainFunc(e,i),i}console.error("Create DefaultModel("+n.type+")!")},exportAsRunnablePromise:function(e,r,i){var o=n.getFile(void 0,e.mid).getProjectId();return t.VA.Core.Utils.NestedFlowUtils.makeRunnable(o,r)},exportAsRunnable:function(t,e){var n=this,r=this.extendModel(t,!0);for(var i in delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,void 0!==e&&e||delete r.report,r.entries=[],r.functions){var o=r.functions[i],a=o.display.label||"";if(o.label=a,delete o.display,o.parent().getPrevious(o.fid).length<1&&r.entries.push(o.fid),this.checkAndRemoveOptionalInputs(o),this.carvePersist(o,!0),this.deleteEmptyArray(o),"Subflow"==o[FUNCTION_NAME]&&o.param.functions.length>0)for(var s in o.param.entries||(o.param.entries=[o.param.functions[0].fid]),o.param.functions){var c=o.param.functions[s];a=o.label||"";c.label=a,delete c.display}}return r.innerModels&&(r.innerModels=_.reduce(_.map(r.innerModels,function(t,e){var r={};return r[e]=n.exportAsRunnable(t),r}),_.merge,{})),r},previousFnUnitList:function(t,e,n){var r=t.getPrevious(e);for(var i in r)-1==n.indexOf(r[i])&&n.push(r[i]),this.previousFnUnitList(t,r[i],n)},previousLinks:function(t,e,n){for(var r in t.links){var i=t.links[r];i[TARGET_FID]==e&&(n.push(i),this.previousLinks(t,i[SOURCE_FID],n))}},exportAsRunnableForRealTime:function(t,e,n){var r=this.extendModel(t,!0),i=[];i.push(e.fid),this.previousFnUnitList(r,e.fid,i);var o=[];for(var a in r.functions)for(var s in i)i[s]===r.functions[a].fid&&o.push(r.functions[a]);var c=[];for(var u in this.previousLinks(r,e.fid,c),r.functions=o,r.links=c,delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,delete r.title,void 0!==n&&n||delete r.report,r.entries=[],r.functions){if(delete(e=r.functions[u]).display,e.parent().getPrevious(e.fid).length<1&&r.entries.push(e.fid),this.deleteEmptyArray(e),"Subflow"==e[FUNCTION_NAME]&&e.param.functions.length>0)for(var a in e.param.entries||(e.param.entries=[e.param.functions[0].fid]),e.param.functions){delete e.param.functions[a].display}}return r},getModelIds:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e)e.hasOwnProperty(i)&&(i===n&&r.push(e[i]),t(e[i],n,r));return r},getModelIdsWithVersion:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e)if(e.hasOwnProperty(i)){if(i===n){var o={};o[i]=e[i],e.hasOwnProperty("version_id")&&(o.version_id=e.version_id),r.push(o)}t(e[i],n,r)}return r},exportAsRunnableFileByTree:function(t,e,n){return this.createModelTree(t,e).then(function(t){return this._exportAsRunnableFileByTree(e,t,n)}.bind(this))},_exportAsRunnableFileByTree:function(t,e,n){var r=this.exportAsRunnable(t),i={user:"input_user_id",jid:"input_job_id",main:r.mid,args:n,models:{}};if(i.models[r.mid]=r,"control"===r.type){var o=this.getModelIdsWithVersion(r.functions,"mid",[]);_.forEach(o,function(t){var n=t.version_id?t.mid+"_"+t.version_id:t.mid,r=t.version_id?e[t.mid].version[t.version_id]:e[t.mid].main;i.models[n]=this.exportAsRunnable(r.contents)}.bind(this))}else for(var a in r.gv){var s=r.gv[a];for(var c in s.param)n&&!n[s.param[c]]&&delete s.param[c];Object.keys(s.param).length<1&&r.gv.splice(a,1)}return i},createModelTree:function(t,e){var n={};return Promise.all(this._createModelTree(t,e,n)).then(function(){return n})},_createModelTree:function(t,e,r){var i=e.functions,o=function(t,e,r){return r?n.fetchVersion(t,e,r):n.fetchFile(t,e)},a=function(t,e,n){return r[e]=r[e]||{version:{}},n?r[e].version[n]=t:r[e].main=t,!0},s=[];return _.forEach(i,function(e){e.param.functions&&s.push(this._createModelTree(t,e.param.functions,r)),"DataFlow"===e[FUNCTION_NAME]&&s.push(o(t,e.param.mid,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected control flow'):a(t,e.param.mid,e.param.version_id)})),void 0!==e.param.modelId&&s.push(o(t,e.param.modelId,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected report model'):a(t,e.param.modelId,e.param.version_id)}))}.bind(this)),_.flatten(s)},flattenModelTree:function(t,e){var n=[],r=function(t,e){return t.getMajorVersion()!==e.getMajorVersion()?e.getMajorVersion()-t.getMajorVersoin():e.getMinorVersion()-t.getMinorVersion()};return _.forOwn(t,function(t){var e=[],i=!1;_.forOwn(t.version,function(t){e.push(t),i=!0}),e.sort(r),e=_.map(e,function(t){var e=_.cloneDeep(t.getContents());return e.versionTags=t.getTags(),e.versionDescription=t.getDescription(),e.majorVersion=t.getMajorVersion(),e.minorVersion=t.getMinorVersion(),e}),i?e.push(_.omit(e[0],["version_id","versionTags","versionDescription","majorVersion","minorVersion"])):e.push(t.main.contents),n.push(e)}),_.flatten(n)},getModelArrayByTree:function(e,n,r){var i=t.VA.Core.Utils.ModelUtils.flattenModelTree(e,r);return i.push(n.getContents()),i},exportAsRunnableFile:function(e,n,r,i,o){var a=this.exportAsRunnable(e,i),s={};void 0!==a.report&&(s=$.extend(!0,{},a.report),delete a.report);var c={main:a.mid,models:{},reports:{},version:t.VA.Env.CoreVersion};if(o&&(c.duration=o),c.models[a.mid]=a,"control"===a.type){var u=this,l=this.getModelIds(a.functions,"mid",[]);$.each(l,function(t,e){for(var r in n)n[r].id==e&&(c.models[e]=u.exportAsRunnable(n[r].contents,i));c.models[e]&&(i&&c.models[e].report&&c.models[e].report.data.length>0&&(c.reports[e]=$.extend(!0,{},c.models[e].report)),delete c.models[e].report)})}else for(var p in i&&s.data.length>0&&(c.reports[a.mid]=s),a.gv){var d=a.gv[p];for(var f in d.param)r&&!r[d.param[f]]&&delete d.param[f];Object.keys(d.param).length<1&&a.gv.splice(p,1)}return c},fileArrayToModelTree:function(t){var e={};return _.forOwn(t,function(t){var n=t instanceof Array?t:[t];_.forEach(n,function(t){t.version_id?function(t){e[t.mid]=e[t.mid]||{version:{}},e[t.mid].version[t.version_id]=t}(t):function(t){e[t.mid]=e[t.mid]||{},e[t.mid].main=t}(t)})}),e},importModels:function(r,i,o,a){var s={},c={},u={},l=this.cloneModelsByTree(this.fileArrayToModelTree(i));_.forOwn(l,function(e){s[e.main.mid]=t.VA.Core.Utils.IDGenerator.model.id(),u[e.main.mid]=e.main.title});var p=function(t){_.forOwn(t,function(t){t.param.functions&&p(t.param.functions),t.param.mid&&s[t.param.mid]&&(t.param.mid=s[t.param.mid]),t.param.modelId&&s[t.param.modelId]&&(t.param.modelId=s[t.param.modelId]),t.param.tableId&&c[t.param.tableId]&&(t.param.tableId=c[t.param.tableId])})},d={},f=[];return _.forOwn(l,function(n){n.main&&p(n.main.functions),_.forOwn(n.version,function(n){var i=(new t.VA.Vo.Version).setFileId(s[n.mid]).setLabel(n.title).setTags(n.versionTags).setDescription(n.versionDescription).setIsManual(!0).setType(n.type).setMajorVersion(n.majorVersion).setMinorVersion(n.minorVersion),o=_.omit(n,["versionId","versionTags","versionDescription","majorVersion","minorVersion"]);i.setContents(o),f.push(e.VersionDao.addVersion(r,i.getFileId(),i).then(function(t){return d[n.version_id]=t.getVersionId(),t}))})}),Promise.all(f).then(function(){var e=[];return _.forOwn(l,function(i){_.forEach(i.main.functions,function(t){"DataFlow"===t[FUNCTION_NAME]&&t.param.version_id&&(t.param.version_id=d[t.param.version_id])});var o=(new t.VA.Vo.File).setFileId(s[i.main.mid]).setProjectId(r).setLabel(u[i.main.mid]).setDescription("").setCreator(t.VA.Env.Session.userId).setContents(i.main);e.push(n.addFile(r,o))}),Promise.all(e).then(function(t){return _.map(t,function(t){return n.fetchVersions(r,t.getFileId())})})})},makeEntries:function(t){if("Subflow"==t[FUNCTION_NAME]&&t.param.functions.length>0)for(var e in t.param.links||(t.param.links=[]),t.param.entries||(t.param.entries=[],t.param.entries.push(t.param.functions[0].fid)),t.param.functions)this.makeEntries(t.param.functions[e])},isControlFunction:function(t,e){return"data"===(e?e.type:t.parent().type)&&["If","ForLoop","WhileLoop"].indexOf(t[FUNCTION_NAME])>-1},isEmptyExpression:function(t){var e=t||"";return!_.trim(e.substring(3,e.length-1))},deleteEmptyExpression:function(t,e){var n=t.param;"ForLoop"===t[FUNCTION_NAME]?"count"===n.type?(_.has(n.prop,"start")&&this.isEmptyExpression(n.prop.start)&&delete n.prop.start,_.has(n.prop,"end")&&this.isEmptyExpression(n.prop.end)&&delete n.prop.end):"collection"===n.type&&_.has(n.prop,"collection")&&this.isEmptyExpression(n.prop.collection)&&delete n.prop.collection:"While"===t[FUNCTION_NAME]&&"while"===n.type&&_.has(n.prop,"expression")&&this.isEmptyExpression(n.prop.expression)&&delete n.prop.expression},isEmpty:function(t){return _.isUndefined(t)||_.isNull(t)||_.isNaN(t)||(_.isString(t)||_.isArray(t))&&_.isEmpty(t)},deleteEmptyArray:function(e,n){if(e.param)for(var r in e.param)if(this.isControlFunction(e,n))this.deleteEmptyExpression(e,n);else if("functions"==r)for(var i in e.param.functions)this.deleteEmptyArray(e.param.functions[i],n||e.parent());else if(["boolean","number"].some(t=>t===typeof e.param[r])||e.param[r]){var o=e.param[r];if(_.isArray(o)){if(o.length>1)continue;if(this.isEmpty(o[0])){if(this.isEmpty(o[0])){var a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r]}}else if(_.isArray(o[0])){if(o[0].length>1)continue;this.isEmpty(o[0][0])&&delete e.param[r]}else this.isEmpty(o[0])&&delete e.param[r]}}else{a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r]}},deleteDisplay:function(t){var e="";if(t.display&&t.display.label&&(e=t.display.label),t.label=e,t.display={label:e},"Subflow"==t[FUNCTION_NAME]){var n=t.param.functions;for(var r in n)this.deleteDisplay(n[r])}},getKeyMapFromModelTree:function(t){var e={fidCache:{},outputCache:{}};return _.forOwn(t,function(t){t.main&&c(t.main.functions,e),t.version&&_.forOwn(t.version,function(t){c(t.functions,e)})}),e},cloneModelsByTree:function(e){var n=this.getKeyMapFromModelTree(e),r={},i=function(e,n,r){var i=$.extend(!0,{},e);return r&&i.mid&&(i.mid=t.VA.Core.Utils.IDGenerator.model.id()),i=u(i,n)};return _.forOwn(e,function(t,e){r[e]={},t.main&&(r[e].main=i(t.main,n)),t.version&&(r[e].version={},_.forOwn(t.version,function(t,o){r[e].version[o]=i(t,n)}))}),r},cloneModel:function(e){if("data"===e.type)return function(e){var n=_.cloneDeep(e),r={},i=function(e){r[e]=r[e]||t.VA.Core.Utils.IDGenerator.model.id()},o=function(t){return r[t]},c=function(e){_.forEach(e.functions,function(e){"If"===e[FUNCTION_NAME]&&(i(e.param.if.mid),_.forEach(e.param.elseif,function(t){i(t.mid)}),i(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||i(e.param.mid);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,c)})};_.forEach(n.innerModels,function(t,e){i(e)});var u=function(e){_.forEach(e.functions,function(e){var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,u),"If"===e[FUNCTION_NAME]&&(e.param.if.mid=o(e.param.if.mid),_.forEach(e.param.elseif,function(t){t.mid=o(t.mid)}),e.param.else.mid=o(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||(e.param.mid=o(e.param.mid))})};c(n),u(n),n.innerModels=_.reduce(_.map(n.innerModels,function(t){t.mid=o(t.mid);var e={};return e[t.mid]=t,e}),_.merge,{});var l={fidCache:{},tidCache:{}};return a(n,n,l),s(n,n,l),n}(this.extendModel(e));var n=$.extend(!0,{},e);return n.mid&&(n.mid=t.VA.Core.Utils.IDGenerator.model.id()),n=u(n,i(n.functions))},cloneFnUnit:function(t){var e=o(t),n=$.extend(!0,{},t),r=e.fidCache,i=e.outputCache;return n.fid=r[n.fid],n[IN_DATA]&&(n[IN_DATA]=[]),"unload"===n.func&&(n.param["df-names"]=[]),(n=p(n,i)).param=u(n.param,e),n},checkAndRemoveOptionalInputs:function(t){t.inputs&&t.meta&&Object.keys(t.inputs).filter(e=>""===t.inputs[e]&&t.meta[e]&&t.meta[e].optional).forEach(e=>delete t.inputs[e])},carvePersist:function(e,n){var r,i=t.VA.SettingStorage.DEFAULT_SETTINGS["common.persist.mode"];r=t.VA.Core.Functions.Library[e.func]?t.VA.Core.Functions.Library[e.func].defaultFnUnit.persist:i;var o=e.parent()["persist-mode"];"user-mode"===i&&("true"===e["persist-mode"]?e.persist=!0:"false"===e["persist-mode"]?e.persist=!1:e.persist="true"===o||"false"!==o),"performance-mode"===i&&(e.persist=void 0!==r&&r),"storage-mode"===i&&(e.persist=void 0===r||r),"Subflow"===e[FUNCTION_NAME]&&e.param.functions.length>0&&(e.param.functions[e.param.functions.length-1].persist=!0)},generateVersionText:function(t){return t.major_version+"."+t.minor_version},openDocumentationPopup:function(){if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var e=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===e&&(e=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),window.open(e).blur()}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Help document installed in Local does not exist.\nSet up on-line help service url or contact your administrator.\n(Settings > Preferences > Common > Use on-line help..)")},openFunctionReferencePopup:function(e,n,r,i){var o,a;if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var s=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===s&&(s=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),s=_.trimRight(s,"/");try{var c=[s,(navigator.language||navigator.userLanguage).toLowerCase(),"ai","v"+(t.VA.Env.CoreVersion||"3.0"),"function_reference",r||"scala",n].join("/");o=window.open(c)}catch(t){o=window.open(s)}}else a="api/va/v2/help/function",n&&(a=a+"/"+n),a=a+"?type="+e+(r?"&context="+r:"")+(i?"&func="+i:""),o=window.open(a,"Brightics Help");o.blur()},createCachePersist:function(t,e){return c(t,e)},setKeys:function(t,e){return u(t,e)},createFileContents:function(e,n,r,i){var o=$.extend(!0,{},e);o.mid=n,r&&(o.title=r),i&&(o.description=i);var a,s,c,u,l,p,d,f,h={},g={};for(a in o.functions){for(c in h[(l=o.functions[a]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),l[OUT_DATA])g[l[OUT_DATA][c]]=t.VA.Core.Utils.IDGenerator.table.id();if("Subflow"===l[FUNCTION_NAME])for(b in l.param.functions)for(u in h[(p=l.param.functions[b]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),p[OUT_DATA])g[p[OUT_DATA][u]]=t.VA.Core.Utils.IDGenerator.table.id()}for(a in o.functions){for(b in(l=o.functions[a]).fid=h[l.fid],l[IN_DATA])l[IN_DATA][b]=g[l[IN_DATA][b]];for(b in l[OUT_DATA])l[OUT_DATA][b]=g[l[OUT_DATA][b]];if("unload"===l.func)for(b in l.param["df-names"])l.param["df-names"][b]=g[l.param["df-names"][b]];if("Subflow"===l[FUNCTION_NAME]){for(b in l.param.entries)l.param.entries[b]=h[l.param.entries[b]];for(b in l.param.functions){for(s in(p=l.param.functions[b]).fid=h[p.fid],p[IN_DATA])p[IN_DATA][s]=g[p[IN_DATA][s]];for(s in p[OUT_DATA])p[OUT_DATA][s]=g[p[OUT_DATA][s]];if("load"===p.func)for(s in p.param["df-names"])p.param["df-names"][s]=g[p.param["df-names"][s]];if("unload"==p.func){for(s in p.param["df-names"])p.param["df-names"][s]=g[p.param["df-names"][s]];var y="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();p.param["fs-paths"]=[y],l.param.functions[parseInt(b)+1]&&(l.param.functions[parseInt(b)+1].param["input-path"]=y,l.param.functions[parseInt(b)+1].param["output-path"]=y+".csv")}}for(b in l.param.links)(f=l.param.links[b]).kid=t.VA.Core.Utils.IDGenerator.link.id(),f[SOURCE_FID]=h[f[SOURCE_FID]],f[TARGET_FID]=h[f[TARGET_FID]]}}for(a in o.links)(d=o.links[a]).kid=t.VA.Core.Utils.IDGenerator.link.id(),d[SOURCE_FID]=h[d[SOURCE_FID]],d[TARGET_FID]=h[d[TARGET_FID]];if("visual"===o.type){var m=o.report.pages;for(a in m.push({id:t.VA.Core.Utils.IDGenerator.reportPage.id(),contents:{}}),m){var v=m[a].contents;for(var b in v)v[b].dataSourceId&&h[v[b].dataSourceId]&&(v[b].dataSourceId=h[v[b].dataSourceId])}}return o},initDefaultModelContents:function(){var t=this,e={url:"api/va/v2/studio/templates/data",type:"GET",contentType:"application/json; charset=utf-8",blocking:!0};$.ajax(e).done(function(e){var n=_.findIndex(e,function(t){return"Default"===t.name});n>-1&&(t.defaultModelContents=e[n].contents)})},getDefaultModelContents:function(){return this.defaultModelContents},createCacheNestedFlow:a,setKeyNestedFlow:s}}.call(this),function(t,e){"use strict";var n=t.Brightics,r=brtc_require("Dao"),i=["df-names"],o=function(t,n){var r=e.filter(t.links,function(t){return t[SOURCE_FID]===n});return e.map(r,function(t){return t[TARGET_FID]})},a=function(t){var n=[];return t.param.if&&n.push(t.param.if.mid),t.param.elseif&&e.forEach(t.param.elseif,function(t){n.push(t.mid)}),n.push(t.param.else.mid),n},s=function(t,n){var r=[],i=t.getInnerModel?t:t.getMainModel();return e.forEach(n.functions,function(t){if("if"===t.func){var n=a(t);e.forEach(n,function(t){r.push(i.getInnerModel(t))})}else"forLoop"!==t.func&&"whileLoop"!==t.func||r.push(i.getInnerModel(t.param.mid))}),e.filter(r,e.negate(e.isUndefined))},c=function(t,n){var r=s(t,n);return e.flatten(r.concat(e.map(r,e.partial(c,t))))},u=function(t,e){return t+"_"+e},l=function(t,n,i){var o={},a={},c=function(t){return function(e){if(e){var n=e.getContents();return o[t(e)]=n,d(n,n)}}},l=c(function(t){return u(t.getFileId(),t.getVersionId())}),p=c(function(t){return t.getFileId()}),d=function(n,o){var c=[];e.forEach(o.functions,function(e){var n;if("Flow"===e[FUNCTION_NAME]){var o=e.param.mid,s=e.param.versionId;o&&s?i||(n=u(o,s),a[n]||(a[n]=!0,c.push(r.VersionDao.getVersion(t,o,s).then(l)))):o&&(a[n=o]||(a[n]=!0,c.push(r.FileDao.getFile(t,o).then(p))))}});var f=s(n,o);return e.forEach(f,function(t){c.push(d(n,t))}),Promise.all(c)};return d(n,n).then(function(){var t=e.keys(o);return e.forIn(t,function(t){e.isUndefined(o[t])&&(o=e.omit(o,t))}),o})},p=function(t,n){var r=[];return function(t,n,r){var i=a(n);e.forEach(i,function(e){var n=t.getInnerModel(e);r(n)})}(t,n,function(t){r.push(t)}),r},d=function(t,n){var r=n?"forLoop"===n.func||"whileLoop"===n.func?function(t,e){return[t.getInnerModel(e.param.mid)]}(t,n):"if"===n.func?p(t,n):[]:t;return e.filter(r,e.negate(e.isUndefined))},f=function(t,e,r){var o=!1,a={fnUnit:e,ref:{param:{}}},s=Object.keys(e.param);for(var c in s){var u=s[c];i.indexOf(u)>-1&&(o=!0,a.ref.param[u]=r)}if(o)return new n.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(t,a)},h=function(t,r,i){var o={},a=function(r,c){o[c]={adj:[],version:r instanceof n.VA.Vo.File?"Current":"v"+r.getVersion()},i&&(o[c].model=r.getContents());var u,l,p,d=(u=r.getContents(),l=s(u,u).concat(u),p=[],l.forEach(function(t){t.functions.forEach(function(t){if("Flow"===t[FUNCTION_NAME]){var e=t.param.mid,n=t.param.versionId;e&&n?p.push({type:"version",mid:e,versionId:n}):e&&p.push({type:"file",mid:e})}})}),p).reduce(function(e,n){return"file"===n.type?e[n.mid]=Studio.getResourceManager().getFile(t,n.mid):e[n.mid+"_"+n.versionId]=Studio.getResourceManager().getVersion(t,n.mid,n.versionId),e},{});e.forEach(d,function(t,e){o[e]||a(t,e),o[c].adj.push(e)})};return a(Studio.getResourceManager().getFile(t,r.mid),r.mid),o},g=function(t,n){var r={},i=h(t,n),o=function(t){r[t]=-1;var n=e.any(i[t].adj,function(t){return!(r[t]||!o(t))||-1===r[t]});return r[t]=1,n};return o(n.mid)};n.VA.Core.Utils.NestedFlowUtils={getParentModel:function(t,n){if(e.has(n,"innerModels"))return n;var r=function(e){for(var i=s(t,e),o=0;o<i.length;o++){if(i[o].mid===n.mid)return e;var a=r(i[o]);if(a)return a}};return r(t)},getAdjacencyLists:function(t,n){var r={};return e.forEach(n,function(e){r[e]=o(t,e)}),r},getAdjacencyList:o,getConnectedFnUnits:function(t,n){for(var r=function(t,e){var n=function(r){for(var i=r.functions,o=0;o<i.length;o++)if(i[o].fid===e)return r;for(var a=s(t,r),c=0;c<a.length;c++){var u=n(a[c]);if(u)return u}};return n(t)}(t,n.fid),i=o(r,n.fid),a=[],c=r.functions,u=0;u<c.length;u++)e.indexOf(i,c[u].fid)>-1&&a.push(c[u]);return a},getSubModels:d,createAdjustOutTableCommand:function(t,r,i,o){for(var a=[],s=i[OUT_DATA].length;s<o;)a.push(new n.VA.Core.Editors.Diagram.Commands.AddOperationCommand(t,{target:i,path:[OUT_DATA,s],value:n.VA.Core.Utils.IDGenerator.table.id()})),s++;for(var c=function(t){return function(e){return t!==e}};s>o;){s--,a.push(new n.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(t,{target:i,path:[OUT_DATA,s]}));for(var u=i[OUT_DATA][s],l=n.VA.Core.Utils.NestedFlowUtils.getConnectedFnUnits(r,i),p=0;p<l.length;p++){var d=l[p],h=e.filter(d[IN_DATA],c(u));a.push(new n.VA.Core.Editors.Diagram.Commands.ChangeIntableCommand(t,{fnUnit:d,ref:{inData:h}}));var g=f(t,d,h);g&&a.push(g)}}return a},calcNextFnUnitOutTableSize:function(t,e,n,r){for(var i=d(t,e),o=0,a=0;a<i.length;a++)o=parseInt(Math.max(o,(i[a][OUT_DATA]?i[a][OUT_DATA].length:0)+(n===i[a].mid?r:0)));return o},getChildFlows:l,getChildModels:s,makeRunnable:function(t,r){return l(t,r).then(function(t){var i=e.indexBy(c(r,r),"mid"),o=e.cloneDeep(r),a=e.cloneDeep(t);return o.innerModels=i,(a=e.reduce(e.map(a,function(t,e){var r={};return r[e]=n.VA.Core.Utils.ModelUtils.exportAsRunnable(t),r}),e.merge,{}))[o.mid]=o,{main:o.mid,models:a,version:n.VA.Env.CoreVersion}}).catch(console.error)},getAllSubModelsFromModel:c,getAllSubModelsFromFnUnit:function(t,n){var r=d(t,n);return e.flatten(r.concat(e.map(r,e.partial(c,t))))},getNewActivityCommandOptions:function(t){var n=[];return"If"===t[FUNCTION_NAME]?(n.push({mid:t.param.if.mid,type:t.func,conditionType:"if"}),(n=n.concat(e.map(t.param.elseif,function(e){return{mid:e.mid,type:t.func,conditionType:"elseif"}}))).push({mid:t.param.else.mid,type:t.func,conditionType:"else"})):"ForLoop"!==t[FUNCTION_NAME]&&"WhileLoop"!==t[FUNCTION_NAME]||n.push({mid:t.param.mid,type:t.func}),n},getFnUnitByCondition:function(t,n){var r=function(t){return e.reduce(t.functions,function(t,e){return t||(n(e)?e:r(d(e)))},e.noop())};return r(t)},isProcessFunction:function(t){return["SetValue","ImportData","ExportData"].indexOf(t[FUNCTION_NAME])>=0},checkCycle:g,getLocalOutline:function(t,n,r){var i=function(o,a){var s=o.functions.map(function(n){return function(n){var o={type:"fn",fn:n,items:[],label:n.display.label,selected:n.fid===r};if("If"===n[FUNCTION_NAME]){var a=[].concat(n.param.if,n.param.elseif,n.param.else);o.items=e.map(a,function(e,n){var r="Else If";return 0===n&&(r="If"),n===a.length-1&&(r="Else"),i(t.getInnerModel(e.mid),r)})}else"ForLoop"!==n[FUNCTION_NAME]&&"WhileLoop"!==n[FUNCTION_NAME]||(o.items=[i(t.getInnerModel(n.param.mid),"ForLoop"===n[FUNCTION_NAME]?"For":"While")]);return o.active=e.any(e.map(o.items,"active")),o}(n)});return{type:"model",model:o,items:s,active:o.mid===n.mid||e.any(e.map(s,"active")),label:a}};return i(t,t.title)},getGlobalOutline:function(t,e){if(g(t,e))throw new Error("This model contains cycle.");var n=h(t,e,!0),r=function(t){return{id:t.model.mid,label:t.model.title+" ["+t.version+"]",items:t.adj.map(function(t){return r(n[t])})}};return r(n[e.mid])}}}(this,_),function(){"use strict";var t=this.Brightics;t.OptModelManager={isValidOptModel:function(t){var e=this.isValidObjective(t),n=this.isValidOptFunctions(t);return e&&n},isValidObjective:function(t){var e=!1;return t&&t.options&&t.options.objective&&t.options.objective.fid&&t.options.objective.tableName&&t.options.objective.row&&t.options.objective.column&&t.options.objective.sense&&(e=!0),e},isValidOptFunctions:function(t){var e=!1;if(t&&t.optFunctions)for(var n=0;n<t.optFunctions.length;n++)if("true"===t.optFunctions[n].optSelected)for(var r in t.optFunctions[n].optParam)"true"===t.optFunctions[n].optParam[r].optParamSelected&&(e=!0);return e},renderOptModels:function(e){var n=Studio.getEditorContainer().getActiveModelEditor();if(e||(e=n.diagramEditorPage),e){var r=e.$mainControl.find(".brtc-va-editors-diagram-diagrameditorpage-paper");r.find(".brtc-opt-model-box").remove();var i=n.getEditorInput().getContents().optModels;if(i&&Object.keys(i).length){for(var o={},a=e.options.scale,s=e.graph.getElements(),c=0;c<s.length;c++){var u=s[c].attributes.fid,l=$.extend(!0,{},s[c].attributes.position);o[u]=l}for(var p in i){var d,f,h,g,y=i[p].label||"Optimization",m=i[p].optFunctions,v=-1;for(c=0;c<m.length;c++)if(o[m[c].fid]){v=c;break}if(-1!=v){d=h=o[m[v].fid].y,f=g=o[m[v].fid].x;for(var b=0;b<m.length;b++){o[u=m[b].fid]&&(d=Math.min(d,o[u].y),h=Math.max(h,o[u].y),f=Math.min(f,o[u].x),g=Math.max(g,o[u].x))}var _=d*a,A=f*a+3,x=(t.VA.Env.Diagram.FIGURE_WIDTH+g-f)*a-5,w=(t.VA.Env.Diagram.FIGURE_HEIGHT+h-d)*a+7,C=this.isValidOptModel(i[p])?"#626fdb":"#ea3539",I=$(`<div class="brtc-opt-model-box" style="\n position: absolute;\n display: block;\n box-sizing: content-box;\n margin-top: -1px;\n margin-left: -5px;\n padding-right: 7px;\n pointer-events: none;\n border: 1px solid ${C};' +\n "></div>`);r.append(I),I.css({top:_,left:A,width:x,height:w});var T=$(`\n <div class="brtc-opt-model-toolbar" style="\n position: absolute;\n left: -1px;\n top: -20px;\n padding: 1px 5px 0 5px;\n border: 1px solid ${C};\n background: #fafbfc;\n pointer-events: auto;\n height: 17px;\n line-height: 17px;\n cursor: pointer;\n ">\n <div class="brtc-opt-model-label" style="\n max-width: 187px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: 11px;\n "></div>\n </div>`);T.attr("opt-id",p),T.find(".brtc-opt-model-label").attr("title",y),T.find(".brtc-opt-model-label").text(y),I.append(T),T.click(function(){var t=$(this).attr("opt-id"),e=Studio.getEditorContainer().getActiveModelEditor().getSideBarManager().getSideBars().optSetting;e.show(),e.createDetailView(t),e.render(t)})}}}}},getOptModels:function(t,e){var n=Studio.getResourceManager().getFile(t,e).getContents();if(n.optModels){var r=n.optModels;return Object.values(r).sort(function(t,e){return t.createTime<e.createTime?-1:t.createTime>e.createTime?1:0})}return[]},getOptModel:function(t,e,n){var r=Studio.getResourceManager().getFile(t,e).getContents();if(r.optModels&&r.optModels[n]){var i=r.optModels;return $.extend(!0,{},i[n])}},getTargetOptModelId:function(t,e,n){var r=Studio.getResourceManager().getFile(t,e).getContents();if(r.optModels){var i=r.optModels;for(var o in i)if(i[o].optFunctions)for(var a=i[o].optFunctions,s=0;s<a.length;s++)if(a[s].fid===n)return o}return null},createNewOptModelCommand:function(e,n,r,i){for(var o=Studio.getResourceManager().getFile(e,n).getContents(),a=[],s=[],c={},u=0;u<r.length;u++){var l=r[u],p=$.extend(!0,{},o.getFnUnitById(l));0!==Object.keys(p).length&&(c[l]=p,a.push(p))}for(u=0;u<o.links.length;u++){var d=o.links[u].sourceFid,f=o.links[u].targetFid;if(c[d]&&c[f]){var h=$.extend(!0,{},o.links[u]);s.push(h)}}var g=this.newOptModel(a,s,i);return new t.VA.Core.Editors.Diagram.Commands.NewOptModelCommand(this,{pid:e,mid:n,optModel:g})},createSetOptModelCommand:function(e,n,r,i,o){return new t.VA.Core.Editors.Diagram.Commands.SetOptModelCommand(this,{pid:e,mid:n,optId:r,optModel:i,target:o})},createRemoveOptModelCommand:function(e,n,r){return new t.VA.Core.Editors.Diagram.Commands.RemoveOptModelCommand(this,{pid:e,mid:n,optId:r})},newOptModel:function(e,n,r){var i=$.extend(!0,[],e);r=r||{};for(var o=t.VA.Core.Utils.IDGenerator.model.id(),a=[],s=0;s<i.length;s++){a.push(i[s].fid);var c=i[s].name;delete i[s].display,delete i[s].func,delete i[s].name,delete i[s].inData,delete i[s].outData,delete i[s].param,delete i[s]["persist-mode"];var u=t.OptFunctions[c];u?(i[s].optSelected=u.optSelected,i[s].optParam=$.extend(!0,{},u.optParam)):(i[s].optSelected="none",i[s].optParam={})}var l;return{optId:o,hash:a.sort().join("_"),label:r.label||"OPT "+(l=new Date,[l.getFullYear(),l.getMonth()<9?"0"+(l.getMonth()+1):l.getMonth()+1,l.getDate()<9?"0"+l.getDate():l.getDate(),l.getHours(),l.getMinutes(),l.getSeconds()].join("")),description:"description",createTime:(new Date).getTime(),creator:t.VA.Env.Session.userId,updateTime:(new Date).getTime(),updater:t.VA.Env.Session.userId,options:{activated:"true",useSavedModel:"false",method:"SOGA",maxIterations:"100",maxEvaluations:"20",constraints:[],objective:{fid:"",tableName:"",row:"1",column:"",sense:"maximize"}},optFunctions:i}},addOptModel:function(t,e,n){var r=Studio.getResourceManager().getFile(t,e).getContents();r.optModels||(r.optModels={}),r.optModels[n.optId]=$.extend(!0,{},n)},setOptModel:function(t,e,n,r){var i=Studio.getResourceManager().getFile(t,e).getContents();if(i.optModels&&i.optModels[n]){var o=i.optModels[n];for(var a in r)r[a].constructor==Array?o[a]=$.extend(!0,[],r[a]):r[a].constructor==Object?o[a]=$.extend(!0,{},r[a]):o[a]=r[a]}},removeOptModel:function(t,e,n){var r=Studio.getResourceManager().getFile(t,e).getContents();if(r.optModels&&r.optModels[n]){var i=r.optModels[n];return delete r.optModels[n],i}},buildOptRunnable:function(t){var e=function(t,e){var n=!0;if("true"!==t.options.activated&&(n=!1),n)for(var r=t.optFunctions,i=0;i<r.length;i++)if(!e[r[i].fid]){n=!1;break}return n},n=function(t){for(var e={},n=0;n<t.functions.length;n++)e[t.functions[n].fid]=t.functions[n];return e},r=function(t){var r={},o=n(t),a=t.optModels;for(var s in a)if(a.hasOwnProperty(s)){var c=a[s];e(c,o)&&(r[c.optId]=$.extend(!0,{},c))}return i(r,o,t.links)},i=function(t,e,n){for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];o(i),a(i,e),s(i,n),delete i.optFunctions}return t},o=function(t){t.optSelected={};for(var e=t.optFunctions,n=0;n<e.length;n++){var r=e[n].fid;if("true"===e[n].optSelected)for(var i in t.optSelected[r]={optParam:{}},e[n].optParam){var o=e[n].optParam[i];"true"===o.optParamSelected&&(t.optSelected[r].optParam[i]=$.extend(!0,{},o),delete t.optSelected[r].optParam[i].optParamSelected)}}},a=function(t,e){t.functions=[];for(var n=t.optFunctions,r=0;r<n.length;r++){var i=n[r].fid;t.functions.push($.extend(!0,{},e[i]))}},s=function(t,e){t.links=[];for(var n=0;n<e.length;n++){var r=e[n].sourceFid,i=e[n].targetFid;t.hash.indexOf(r)>-1&&t.hash.indexOf(i)>-1&&t.links.push($.extend(!0,{},e[n]))}},c=function(t,e){var n=[];for(var r in e)n.push({fid:e[r].optId,label:e[r].label,name:"Opt",param:{mid:e[r].optId}});for(var i=0;i<n.length;i++)t.functions.push(n[i])},u=function(t,e){var r=$.extend(!0,[],t.links),i=t.links,o=n(t),a={},s={},c={};for(var u in e){for(var l=e[u],p=0;p<r.length;p++){var d=r[p].sourceFid,f=r[p].targetFid;c[f]=!1,!(l.hash.indexOf(d)>-1)&&l.hash.indexOf(f)>-1&&(a[r[p].kid]=!0,s[d+"_"+u]||(s[d+"_"+u]=!0,i.push({sourceFid:d,targetFid:u})),i.push({sourceFid:u,targetFid:f}))}for(var h in o)!1!==c[h]&&l.hash.indexOf(h)>-1&&i.push({sourceFid:u,targetFid:h})}for(p=i.length-1;p>=0;p--)a[i[p].kid]&&i.splice(p,1)},l=$.extend(!0,{},t),p=l.models;for(var d in p)if(p.hasOwnProperty(d)){var f=p[d],h=r(f);u(f,h),c(f,h),f.optModels=$.extend(!0,{},h)}return l}}}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils.PermissionUtils={check:function(t,e){var n=this;_.map(e,function(e){n.validate(e)||n[e](t)})},validate:function(t){return!(this[t]&&!this.hasPermission(t))},hasPermission:function(e){for(var n in t.VA.Env.Session.permissions)if(t.VA.Env.Session.permissions[n].permission_id===e)return!0;return!1},data_upload_shared:function(t){!function(t){_.map(["#upload-to-shared-local","#upload-to-shared-jdbc","#upload-to-shared-alluxio"],function(e){var n=t.find(e);n.length>0&&_.map(n,function(t){$(t).jqxRadioButton({disabled:!0})})})}(t)}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.QuickHelp={showQuickModeling:function(){var t,e,n;t="brtc-va-quickhelp-quickdrawing",e=$("body"),(n=$('<div class="brtc-va-quickhelp-background"></div>')).addClass(t),e.append(n),n.on("click",function(){n.remove()})}}}.call(this),function(){"use strict";var t=window.markdownit&&new window.markdownit;this.Brightics.VA.Core.Utils.RenderUtils={md:function(e,n){var r=$('<div class="brtc-va-md-content"></div>');return e.append(r),r.html(t.render(n)),r},html:function(t,e){var n=$('<div class="brtc-va-html-content"></div>');return t.append(n),n.append(e),n},image:function(t,e){var n=$('<div class="brtc-va-image-content"></div>'),r=$("<img></img>");return t.append(n),n.append(r),r.attr("src",e),n},chart:function(t,e){t.bcharts(e)}}}.call(this),function(){"use strict";var t=this.Brightics;this.Brightics.VA.Core.Utils.RunnableFactory={_create:function(e,n){return{main:"",models:{},version:t.VA.Env.CoreVersion}},createForUnit:function(e,n,r,i,o){var a=e.parent().type||"data",s=t.VA.Core.Interface.RunnableFactory[a];if(s)return s.createForUnit(e,n,r,i,o)},createForFlow:function(e,n,r,i,o){var a=e.type,s=t.VA.Core.Interface.RunnableFactory[a];if(s)return s.createForFlow(e,n,r,i,o)},createForDummy:function(e,n,r,i,o){return{main:"mid",models:{mid:{mid:"mid",type:"data",functions:[$.extend(!0,{},e)]}},version:t.VA.Env.CoreVersion}}}}.call(this),function(t){"use strict";t.Brightics.VA.Core.Utils.VariableUtils={wrap:function(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")&&(t=t.substring(3,t.length-1)),"${="+t+"}"},strip:function(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")?t.substring(3,t.length-1):t}}}(this),function(){"use strict";var t=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?"":_.isNumber(t)?_.isNaN(t)||_.isUndefined(t)?"":t.toString():t},e=function(t){var e=t||"";return function(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")}(e)?e.substring(3,e.length-1):e};this.Brightics.VA.Core.Utils.VariableUtils={convertValueByType:function(t,e,n){},toString:t,toNumber:function(e){return _.isNull(e)||_.isUndefined(e)||""===e?0:Number(t(Number(e)))},strip:e,wrap:function(t){return"${="+t+"}"}}}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.initWebSocket()}e.prototype.initWebSocket=function(){var t=this;$.ajax({url:"api/v1/websocket",type:"GET",blocking:!1}).done(function(e){t.createWebSocket(e.address)})},e.prototype.createWebSocket=function(e){if("WebSocket"in window)try{var n=this.socket=new WebSocket(e+"/"+t.VA.Env.Session.userId);n.onopen=function(){console.log("Socket has been opened!");var e={socketAPI:"checkDuplicate",userId:t.VA.Env.Session.userId};n.send(JSON.toString(e))},n.onerror=function(t){},n.onmessage=function(t){try{console.log(t)}catch(e){return void console.log("This doesn't look like a valid JSON: ",t)}},n.onclose=function(){console.log("socket is closed.")}}catch(t){}else console.log("no WebSocket")},e.prototype.send=function(t){this.socket.send(t)},t.VA.Core.WebSocketVA=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.WidgetUtils={ALPHABET:"23456789abcdefghijkmnpqrstuvwxyz",ID_LENGTH:8,retrieveWidget:function(t){return"string"==typeof t?$(t):t},putWorkspaceRef:function(t,e){this.putData(t,"brtc-va-workspace-body-area-ref",e)},getWorkspaceRef:function(t){var e=t.closest(".brtc-va-workspace-body-area");return this.getData(e,"brtc-va-workspace-body-area-ref")},putStudioRef:function(t,e){this.putData(t,"brtc-studio-ref",e)},getStudioRef:function(t){var e=$(".brtc-va-studio");return this.getData(e,"brtc-studio-ref")},putUdfRef:function(t,e){this.removeUdfRefData(t),this.putData(t,"brtc-udf-ref",e)},getUdfRef:function(t){return this.getData(t,"brtc-udf-ref")},putModelEditorRef:function(t,e){this.putEditorRef(t,e)},getModelEditorRef:function(t){return this.getEditorRef(t,"brtc-va-editors-modeleditor")},closestModelEditor:function(t){return this.closestEditor(t,"brtc-va-editors-modeleditor")},putEditorRef:function(t,e){this.putData(t,"brtc-va-editor-ref",e)},getEditorRef:function(t,e){var n=e||"brtc-va-editor",r=this.closestEditor(t,n);return this.getData(r,"brtc-va-editor-ref")},closestEditor:function(t,e){return t.closest("."+e)},putData:function(t,e,n){t.data(e,n)},getData:function(t,e){return t.data(e)},removeUdfRefData:function(t){t.removeData("brtc-udf-ref")},isRightClick:function(t){var e,n=t||window.event;return n.which?e=3==n.which:n.button&&(e=2==n.button),e||$.jqx.mobile.isTouchDevice()},getRightClick:function(t){if(Brightics.VA.Core.Utils.WidgetUtils.isRightClick(t)){var e=$(window).scrollTop(),n=$(window).scrollLeft();return{x:parseInt(t.clientX)+n,y:parseInt(t.clientY)+e}}},createPaletteItem:function(t,e,n){var r,i,o=$('<div class="brtc-va-views-palette-fnunit-content">'),a=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');o.append(a);var s=!1,c=Brightics.VA.Core.Interface.WidgetUtils[n];if(c&&c.createPaletteItem){var u=c.createPaletteItem(e);r=u.label,i=u.category}else{var l="",p="",d="scala";void 0===Brightics.VA.Core.Interface.Functions[n][e]?(l="none",p="none"):(l=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.display.label,p=Brightics.VA.Core.Interface.Functions[n][e].category,s=s||Brightics.VA.Core.Interface.Functions[n][e].deprecated,d=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context||d),r=l,i="brtc-va-fnunit-category-"+p}return a.attr("title",r),"udf"!==p&&a.attr("context",d).attr("category",p),a.find(".brtc-va-views-palette-fnunit-label").text(r),s&&(r+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),a.attr("title",r),s&&a.addClass("deprecated"),a.addClass(i),t.append(o),this.putData(a,"func",e),a},createPaletteUDFItem:function(t,e,n,r){var i,o,a=$('<div class="brtc-va-views-palette-fnunit-content">'),s=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div> <div class="brtc-va-views-palette-fnunit-remove-icon brtc-style-views-palette-fnunit-remove-icon" title="Delete"></div></div>');a.append(s);var c=!1,u=Brightics.VA.Core.Interface.WidgetUtils[n];if(u&&u.createPaletteItem){var l=u.createPaletteItem(e);i=l.label,o=l.category}else{var p="",d="",f="scala";void 0===Brightics.VA.Core.Interface.Functions[n][e]?(p="none",d="none"):(p=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.display.label,d=Brightics.VA.Core.Interface.Functions[n][e].category,c=c||Brightics.VA.Core.Interface.Functions[n][e].deprecated,f=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context),i=p,o="brtc-va-fnunit-category-"+d}return s.attr("title",i),"udf"!==d&&s.attr("context",f),s.find(".brtc-va-views-palette-fnunit-label").text(i),c&&(i+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),s.attr("title",i),s.find(".brtc-va-views-palette-fnunit-remove-icon").on("click",function(e){e.stopPropagation();var n={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,n)}),s.find(".brtc-va-views-palette-fnunit-remove-icon").hide(),s.mouseover(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").show()}),s.mouseout(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").hide()}),c&&s.addClass("deprecated"),s.addClass(o),t.append(a),this.putData(s,"func",e),s},createPaletteBox:function(t){var e,n=$('<div class="brtc-va-views-palette-fnunit-content">'),r=$('<div class="brtc-va-views-palette-box-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div> <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');n.append(r);var i=Brightics.VA.Core.Interface.WidgetUtils.data;if(i&&i.createPaletteItem){e=i.createPaletteItem(t.func).category}else{var o="",a="scala";void 0===Brightics.VA.Core.Interface.Functions.data[t.func]?o="none":(o=Brightics.VA.Core.Interface.Functions.data[t.func].category,a=Brightics.VA.Core.Interface.Functions.data[t.func].defaultFnUnit.context),e="brtc-va-fnunit-category-"+o}return r.attr("title",t.label),r.find(".brtc-va-views-palette-fnunit-icon").attr("context",a||"scala"),r.find(".brtc-va-views-palette-fnunit-label").text(t.label),r.addClass(e),this.putData(r,"func",t.func),r},createTableItem:function(t,e){var n=$('<div class="brtc-va-views-table-content">'),r=$('<div class="brtc-style-views-table brtc-va-studio-dm-draggable"> <div class="brtc-style-views-table-icon">'+e.type.substring(0,1)+'</div> <div class="brtc-style-views-table-label"></div></div>');return n.append(r),r.attr("title",e.label),r.find(".brtc-style-views-table-label").text(e.label),t.append(n),r},createKeyItem:function(t){var e=$('<div class="brtc-va-views-key-content">'),n=$('<div class="brtc-style-views-key"> <div class="brtc-style-views-key-icon"><i></i></div> <div class="brtc-style-views-key-label"></div></div>');return e.append(n),n.attr("title",t.label),n.find(".brtc-style-views-key-icon").attr(t.type),n.find(".brtc-style-views-key-label").text(t.label),n.find("i").addClass({table:"fa fa-table",model:"fa fa-table",image:"fa fa-table"}[t.type]),e},createDialogContentsArea:function(t,e){var n=$('<div class="brtc-va-dialogs-body-content"> <span class="brtc-va-dialogs-body-content-icon"></span> <div class="brtc-va-dialogs-body-content-content-text"><span></span></div></div>');t.append(n),n.find(".brtc-va-dialogs-body-content-icon").attr("alert",e.type),n.find(".brtc-va-dialogs-body-content-content-text span").text(e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").attr("title",e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").innerHeight()>30&&n.find(".brtc-va-dialogs-body-content-content-text").css("line-height","15px")},openConfirmDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!0,contentText:t,close:e})},openConfirmWithOptionDialog:function(t,e,n,r){this.createCommonConfirmWithOptionDialog($("body"),{title:t,type:"info",isCancel:!0,contentText:e,optionText:n,close:r})},checkAgentStatus:function(){return $.ajax({url:"api/va/v2/analytics/agentuser/status",blocking:!1,type:"GET"})},createProgressDialog:function(t,e){var n,r={OK:!1,Cancel:!0},i=$('<div class="brtc-va-dialogs-main"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-progress"> <div style="padding-left: 120px;"><span class="brtc-va-progress-loading"></span></div> </div> <div class="brtc-va-dialogs-contents"> <span class="brtc-va-dialogs-body-content-icon" alert="info"></span> <div class="brtc-va-dialogs-body-content-content-text">Please try again later.</div> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>');t.append(i),i.find(".brtc-va-dialogs-body-content-content-text").css("display","none"),i.find(".brtc-va-dialogs-body-content-icon").css("display","none"),(n=i.find(".brtc-va-dialogs-buttonbar-ok")).css("display","none");var o={theme:Brightics.VA.Env.Theme,width:400,height:280,title:e.title,modal:!0,resizable:!1,showCloseButton:!1,open:function(){n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){r={OK:!0,Cancel:!1},i.dialog("close")})},close:function(){i.dialog("destroy"),i.remove(),"function"==typeof e.close&&e.close(r)},focus:function(){},keyboardCloseKey:""};return i.dialog(o),i.attr("name",o.title),i},getBadRequestErrorMessage:function(t){if(400==t.status){var e=t.responseJSON;if(!e)try{e=JSON.parse(t.responseText)}catch(t){console.error(t)}if(e&&"BR-3203"===e.errors[0].code)return"Sorry! The workspace is not available. Please contact administrator."}},openBadRequestErrorDialog:function(t,e){if(400===t.status){var n=t.responseJSON;if(!n)try{n=JSON.parse(t.responseText)}catch(t){n={errors:[{message:"Sorry! An unexpected error occurred. Please contact administrator.",code:400,detailMessage:t.responseText,detailContentType:"application/json"}]}}if(n&&"BR-3203"===n.errors[0].code){var r=this,i=this.createProgressDialog($("body"),{title:"Preparing workspace...",close:e}),o=0,a=function(){var t=function(){i.find(".brtc-va-progress").css("display","none"),i.find(".brtc-va-dialogs-body-content-content-text").css("display","block"),i.find(".brtc-va-dialogs-body-content-icon").css("display","block"),i.find(".brtc-va-dialogs-buttonbar-ok").css("display","block")};o++,r.checkAgentStatus().done(function(e){"STOP"===e?o>30?(clearTimeout(r.timer),t()):(clearTimeout(r.timer),r.timer=setTimeout(a,2e3)):(clearTimeout(r.timer),t())}).fail(function(e){clearTimeout(r.timer),t()})};clearTimeout(r.timer),r.timer=setTimeout(a,2e3)}else n&&n.errors?this.openErrorDialog(n,e):this.openErrorDialog("Sorry! An unexpected error occurred. Please contact administrator.",e)}else"function"==typeof e&&e({OK:!1,Cancel:!0})},openErrorDialog:function(t,e){var n,r,i;"string"==typeof t?n=this.codeToMessage(t):t.errors&&Array.isArray(t.errors)&&((n=t.errors[0].message)||(n="Sorry! An unexpected error occurred. Please contact administrator."),0==n.indexOf("SparkException:")||0==n.indexOf("NoClassDefFoundError:")?n="Sorry! An unexpected error occurred. Please contact administrator.":0==n.indexOf("Exception:")?n=n.substring(10,msg.length).trim():0==n.indexOf("AnalysisException:")?n=n.substring(18,msg.length).trim():0==n.indexOf("InvalidInputException:")&&(n="Input path does not exist."),n.indexOf("Not allowed condition")>-1&&(n="Can not update. Check schedule status."),t.errors[0].detailMessage&&(r=t.errors[0].detailMessage),t.errors[0].contentType&&(i=t.errors[0].contentType));var o=this;clearTimeout(this.openError),this.openError=setTimeout(function(){o.createCommonConfirmDialog($("body"),{type:"error",isCancel:!1,contentText:n,close:e,detailText:r,detailContentType:i})},500)},openInformationDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!1,contentText:t,close:e})},openQuestionDialog:function(t,e){this.createCommonConfirmDialog($("body"),{type:"info",okLabel:"Yes",cancelLabel:"No",isCancel:!0,contentText:t,close:e})},openWarningDialog:function(t,e){var n=this;clearTimeout(this.openWarning),this.openWarning=setTimeout(function(){n.createCommonConfirmDialog($("body"),{type:"warn",isCancel:!1,contentText:t,close:e})},500)},createCommonConfirmDialog:function(t,e){var n,r,i,o={OK:!1,Cancel:!0},a=$('<div class="brtc-va-dialogs-main"> <div class="brtc-va-dialogs-body"> <div class="brtc-va-dialogs-contents" style="padding-right: 0 !important; padding-bottom: 10px !important;"> </div> <div class="brtc-va-dialogs-buttonbar"> <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" /> </div> </div></div>');t.append(a),n=a.find(".brtc-va-dialogs-buttonbar-ok"),e.okLabel&&n.val(e.okLabel),e.isCancel&&(r=$('<input type="button" class="brtc-va-dialogs-buttonbar-cancel" value="Cancel" />'),a.find(".brtc-va-dialogs-buttonbar").append(r),e.cancelLabel&&r.val(e.cancelLabel)),e.detailText&&(i=$('<input type="button" class="brtc-va-dialogs-buttonbar-detail" value="Detail" />'),a.find(".brtc-va-dialogs-buttonbar").append(i));var s=this,c={theme:Brightics.VA.Env.Theme,width:400,height:210,modal:!0,resizable:!1,cancelButton:r,open:function(){$(".ui-dialog-titlebar.ui-widget-header").attr("style","border-bottom: none !important;"),$("button.ui-dialog-titlebar-close").css("top","30px !important"),s.createDialogContentsArea(a.find(".brtc-va-dialogs-contents"),e),n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){o={OK:!0,Cancel:!1},a.dialog("close")}),e.isCancel&&(r.jqxButton({theme:Brightics.VA.Env.Theme}),r.click(function(){o={OK:!1,Cancel:!0},a.dialog("close")})),e.detailText&&(i.jqxButton({theme:Brightics.VA.Env.Theme}),i.click(function(){if(e.detailContentType&&e.detailContentType.startsWith("text/html")){window.open("/detail-popup","Detail Information",["width=800","height=600","menubar=no","status=no","toolbar=no","location=no"].join(",")).document.write(e.detailText)}else new Brightics.VA.Core.Dialogs.DetailDialog(a,{title:"Detail Information",detailText:e.detailText})}))},close:function(){a.dialog("destroy"),a.remove(),"function"==typeof e.close&&e.close(o)},focus:function(){a.focus()}};return a.dialog(c),a.find(".brtc-va-dialogs-main").css("padding-left","5px"),a.attr("name",c.title),a},createCommonConfirmWithOptionDialog:function(t,e){new Brightics.VA.Core.Dialogs.ConfirmWithOptionDialog(t,e)},codeToMessage:function(t){var e;if(t&&Array.isArray(t.errors)){var n="";for(var r in t.errors)(e=t.errors[r].message)||(e="Sorry! An unexpected error occurred. Please contact administrator."),0==e.indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e.indexOf("Not allowed condition")>-1&&(e="Can not update. Check schedule status."),n+=e+"\n";return n}return"string"==typeof t?(0==(e=t).indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e):t},convertHTMLSpecialChar:function(t){return t?t=(t=(t=(t=(t=t.replace(/&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/"/g,""")).replace(/\s/g," "):t},adjustCodeMirrorEsc:function(t){t.on("endCompletion",function(t){window.event instanceof KeyboardEvent&&"keydown"==window.event.type&&"Escape"==window.event.key&&window.event.stopPropagation()})},setValidatorToCodeMirror:function(t){var e={};return e.type=void 0===t?"":t["valid-type"],e.isValid=function(t){return!e.type||Brightics.VA.Core.Utils.InputValidator.isValid[e.type](t)},e},changeCodeMirrorLineToSingle:function(t,e){var n=this.setValidatorToCodeMirror(e);t.on("beforeChange",function(t,r){var i=r.text.join("").replace(/\n/g,"");r.update(r.from,r.to,[i]);var o="+input"==r.origin&&"object"==typeof r.text&&""==r.text.join(" "),a="setValue"===r.origin||"+delete"===r.origin?void 0:r.text.join("")||"",s=n.isValid(a);if(!s){var c="※ This character( "+(a="\t"===(a=a.length>10?a.substring(0,9)+"...":a)?"Tab":""===a?"Enter":a)+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage($(t.display.lineDiv).closest(".CodeMirror"),{message:c,position:e["valid-message-position"]})}if(o||!s)return t.doc.setCursor(t.getCursor()),r.cancel();if("paste"==r.origin&&"object"==typeof r.text&&r.text.length>1){var u=r.text.join(" ");return r.update(null,null,[u])}return null}),t.setSize("100%","27px")},setCodeMirrorMaxLength:function(t){t.on("beforeChange",function(t,e){var n=t.getOption("maxLength");if(n&&e.update){var r=e.text.join("\n"),i=r.length-(t.indexFromPos(e.to)-t.indexFromPos(e.from));if(i<=0)return $(t.getTextArea()).trigger("hideOverflow"),!0;(i=t.getValue().length+i-n)>0&&($(t.getTextArea()).trigger("showOverflow"),r=r.substr(0,r.length-i),e.update(e.from,e.to,r.split("\n")))}return!0})},createUDFItem:function(t,e,n,r,i){var o,a,s=$('<div class="brtc-va-views-udf-fnunit-content brtc-va-views-udf-type-'+e.type+'">'),c=$('<div class="brtc-va-views-udf-fnunit brtc-style-views-udf-fnunit brtc-va-studio-dm-draggable"> <div class="brtc-va-views-udf-fnunit-icon"></div> <div class="brtc-va-views-udf-fnunit-label"></div> <div class="brtc-va-views-udf-fnunit-version"></div> <div class="brtc-va-views-udf-fnunit-remove-icon brtc-style-udf-fnunit-remove-icon" title="Delete"></div></div>');s.append(c);var u=Brightics.VA.Core.Interface.WidgetUtils[n];if(u&&u.createPaletteItem){var l=u.createPaletteItem(e.id);o=l.label,a=l.category}else{var p="",d="";Brightics.VA.Core.Interface.Functions[n][e.id],p=e.label,d=" ver"+e.version,o=p,a="brtc-va-fnunit-category-"+"udf"}return c.find(".brtc-va-views-udf-fnunit-open-icon").hide(),c.find(".brtc-va-views-udf-fnunit-remove-icon").hide(),c.attr("title",o),c.find(".brtc-va-views-udf-fnunit-label").text(o),c.find(".brtc-va-views-udf-fnunit-version").text(d),c.find(".brtc-va-views-udf-fnunit-open-icon").on("click",function(){i()}),c.mouseover(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").show(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").show()}),c.mouseout(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").hide(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").hide()}),c.find(".brtc-va-views-udf-fnunit-remove-icon").on("click",function(){var e={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,e)}),c.addClass(a),t.append(s),this.putData(c,"udf",e),c},getFunctionLibrary:function(t,e){return void 0===Brightics.VA.Core.Interface.Functions[t][e]?Brightics.VA.Core.Interface.Functions[t].unknownFunction:Brightics.VA.Core.Interface.Functions[t][e]},createPrivatePolicy:function(t){var e=$('<div class="brtc-va-widget-utils-private-policy-division"> <span class="brtc-va-widget-utils-private-policy-span">Private Policy</span></div>');t.append(e),e.click(function(){window.open("/private-policy","Brightics Private Policy")});var n=t.find(".brtc-va-workspace-project-list");n&&n.length&&n.css("height","calc(100% - 98px)")},updateGridSource:function(t,e){var n=new $.jqx.dataAdapter(e);t.jqxGrid("source",n),t.jqxGrid("clearfilters"),t.jqxGrid("clearselection"),this.updatePageButton(t)},updatePageButton:function(t){var e=t.jqxGrid("getpaginginformation"),n=t.find(".jqx-grid-pager div[type=button][title=first]"),r=t.find(".jqx-grid-pager div[type=button][title=previous]"),i=t.find(".jqx-grid-pager div[type=button][title=last]"),o=t.find(".jqx-grid-pager div[type=button][title=next]");0===e.pagenum?(n.css("opacity",".3").jqxButton({disabled:!0}),r.css("opacity",".3").jqxButton({disabled:!0})):(n.css("opacity","1").jqxButton({disabled:!1}),r.css("opacity","1").jqxButton({disabled:!1})),0===e.pagescount||e.pagenum===e.pagescount-1?(i.css("opacity",".3").jqxButton({disabled:!0}),o.css("opacity",".3").jqxButton({disabled:!0})):(i.css("opacity","1").jqxButton({disabled:!1}),o.css("opacity","1").jqxButton({disabled:!1}))},debounce:function(t,e){return _.debounce(t,e,{maxWait:e})},setTrimInputControlOnFocusout:function(t){t.focusout(function(e){var n=t.val(),r=Brightics.VA.Core.Utils.InputValidator.isValid;(r.startWithSpace(n)||r.endWithSpace(n))&&(t.val(n.trim()),Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"This input value is trimmed.",position:"bottom"}))})},convertInequalitySign:function(t){return t?t=(t=t.replace(/<=/g,"≤")).replace(/>=/g,"≥"):t},destroyJqxControl:function(t){t.find(".jqx-widget").each(function(){var t=$(this).data();if(t.jqxWidget){var e=t.jqxWidget.widgetName;"function"==typeof $(this)[e]&&$(this)[e]("destroy")}})}}}.call(this),function(){"use strict";var t=this.Brightics;const e="status",n="success",r="abort",i="fail",o="catch",a="ready",s="pending";function c(t){this.eventTypes=[e,n,r,i,o,a,s],this.initListeners(),this.setListeners(t||{})}c.prototype.initListeners=function(){this.listeners={},this.eventTypes.forEach(function(t){this.listeners[t]=[]}.bind(this))},c.prototype.setListeners=function(t){this.eventTypes.forEach(function(e){var n=t[e],r=this.listeners[e];n&&($.isArray(n)?n.forEach(function(t){"function"==typeof t&&r.push(t)}):"function"==typeof n&&r.push(n))}.bind(this))},c.prototype.getProcessingUnit=function(t){return t&&(this.processingUnit=t),this},c.prototype._fire=function(t,e,n){this.listeners[t].forEach(function(t){"function"==typeof t&&t(e,n)})},c.prototype._fireStatus=function(t,n){this._fire(e,t,n)},c.prototype._fireSuccess=function(t,e){this._fire(n,t,e)},c.prototype._fireFail=function(t,e){this._fire(i,t,e)},c.prototype._fireAbort=function(t,e){this._fire(r,t,e)},c.prototype._fireCatch=function(t,e){this._fire(o,t,e)},c.prototype._firePending=function(t,e){this._fire(s,t,e)},t.VA.Core.JobDelegator=c}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.JobDelegator.call(this,e),this.runnable=null,this._abort=!1}e.prototype=Object.create(t.VA.Core.JobDelegator.prototype),e.prototype.constructor=e,e.prototype._start=function(t){var e={url:"api/va/v2/analytics/jobs",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(t)};return $.ajax(e)},e.prototype._stop=function(t){var e={url:"api/va/v2/analytics/jobs/"+this.runnable.jid+"/delete",type:"POST",blocking:!1,contentType:"application/json; charset=utf-8"};if(t){var n={type:t};e.data=JSON.stringify(n)}return $.ajax(e)},e.prototype._check=function(t){var e={url:"api/va/v2/analytics/jobs/"+t,type:"GET",blocking:!1};return $.ajax(e)},e.prototype._scheduleCheckStatus=function(t){var e=this,n=function(){e._check(t).done(function(t){e._abort?e._fireAbort({jobId:e.runnable.jid,end:Date.now(),status:"ABORT",message:"Job aborted by user"}):"FAIL"===t.status?e._fireFail(t):"SUCCESS"===t.status?e._fireSuccess(t):"WAIT"===t.status?(e._firePending(t),setTimeout(n,500)):(e._fireStatus(t),setTimeout(n,500))}).fail(e._fireCatch.bind(e))};setTimeout(n,500)},e.prototype.start=function(t){var e=this;this.runnable=t,this._start(t).done(function(){e._scheduleCheckStatus(t.jid)}).fail(e._fireCatch.bind(e))},e.prototype.stop=function(t){this._stop(t),this._abort=!0},t.VA.Core.Job=e}.call(this),function(){"use strict";var t=this.Brightics;brtc_require("FnUnitUtils");function e(){this.jobScheduler={}}e.prototype._generateJobId=function(t){return"va_"+t+"_"+moment(Date.now()).format("YYYYMMDDHHmmssSSS")},e.prototype.launchUnit=function(t,e,n,r){console.error("must implement Function launchUnit")},e.prototype.launchModel=function(t,e,n,r){console.error("must implement Function launchModel")},e.prototype._launch=function(t,e,n,r){console.error("must implement Function _launch")},e.prototype._extendListeners=function(t,e){var n=t;for(var r in e){var i=e[r];i&&($.isArray(i)?i.forEach(function(t){n[r]||(n[r]=[]),n[r].push(t)}):"function"==typeof i&&(n[r]||(n[r]=[]),n[r].push(i)))}},e.prototype.terminate=function(t){var e=this.jobScheduler[t];e&&(e.stop(),delete this.jobScheduler[t])},e.prototype._getPendingMessage=function(t){return t.pendingStatus||"Pending"},e.prototype._getProcessingMessage=function(e){var n=["BR-0021","BR-0022","BR-0023","BR-0024","BR-0025","BR-0026"];if(e.errorInfo){var r=this._getFailedFuncId(e),i=[];for(var o in e.errorInfo){var a=e.errorInfo[o];if(a.errorCode){var s=Studio.getEditorContainer().getActiveModelEditor().getModel().getFnUnitNameById(r),c=t.VA.Core.Utils.MessageUtils.getFunctionLabels(s,e.errorInfo[o].parameter);if(i.push(t.VA.Core.Utils.MessageUtils.getMessage(e.errorInfo[o].errorCode,c)),e.errorInfo[o].detailMessage&&i.push(e.errorInfo[o].detailMessage),$.inArray(e.errorInfo[o].errorCode,n)>-1){var u=[];return u.push(t.VA.Core.Utils.MessageUtils.getMessage(e.errorInfo[o].errorCode,c)),u.join("\n")}}else a.message&&i.push(a.message)}return i.join("\n")}return e.message||""},e.prototype._getProcessingDetailMessage=function(t){if(t.errorInfo){var e=[];for(var n in t.errorInfo){var r=t.errorInfo[n];r.detailMessage&&e.push(r.detailMessage)}return e.join("\n")}return t.detailMessage||""},e.prototype._getFailedFuncId=function(t){var e=t.processes;for(var n in e){var r=e[n].functions;for(var i in r)if("FAIL"===r[i].status)return r[i].fid}},e.prototype._fireEvents=function(t){var e={"BEGIN-JOB":0,"PENDING-JOB":1,"BEGIN-PROCESS":2,"BEGIN-UNIT":3,"END-UNIT":4,"END-PROCESS":5,"END-JOB":6};for(var n in t.sort(function(t,n){var r=e[t.eventType]-e[n.eventType];return 0==r?t.begin-n.begin:r}),t)Studio.getInstance().fireDebugEvent(t[n])},t.VA.Core.ModelLauncher=e}.call(this),function(){"use strict";var t=this.Brightics,e=brtc_require("FnUnitUtils");function n(){this.jobScheduler={},this.createControls()}n.prototype.createControls=function(){for(var e in this.launchers={},t.VA.Core.Interface.Launcher)this.launchers[e]=new t.VA.Core.Interface.Launcher[e]},n.prototype.terminate=function(t,e){if(e&&this.launchers[e])this.launchers[e].terminate(t);else for(var n in this.launchers)this.launchers[n].terminate(t)},n.prototype.prepareLaunch=function(){Studio.getEditorContainer().getActiveModelEditor().prepareLaunch()},n.prototype.launchModel=function(e,n,r,i){try{var o={catch:[function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e)}]};this._extendListeners(o,i),this.launchers[e.type].launchModel(e,n,r,i)}catch(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog("Cannot execute the flow. It contains invalid contents.")}},n.prototype.launchUnit=function(n,r,i,o){var a=n.parent().getMainModel(),s=this,c=(r=r||{},i=i||{},a.type),u=e.getOutTable(n);for(var l in u)t.VA.Core.DataQueryTemplate.removeCache(a.mid,u[l]);var p=/\$\{=(?:[a-zA-z_])(?:[a-zA-Z0-9_]*)\}/,d=/"(\\[\s\S]|[^"])*"|'(\\[\s\S]|[^'])*'|(--.*|\/\/.*|\/\*[\s\S]*?\*\/)/gm,f=!1;for(var h in n.param){var g=("string"==typeof n.param[h]?n.param[h]:JSON.stringify(n.param[h])).replace(d,function(t,e,n,r){return e?t:n?t:r?"":void 0}),y=p.exec(g);if(y&&y.length>0&&-1===["${=true}","${=false}"].indexOf(y[0])){f=!0;break}}var m={catch:[function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e)}]};this._extendListeners(m,o);var v=function(t){var e=t?t.args:r;s.launchers[c].launchUnit(n,e,i,m)},b={close:function(t){t.OK&&v(t)},analyticsModel:a};if(!f&&a.variableRef&&a.variableRef.length)for(var A in a.variableRef){var x=a.variableRef[A].fid;if(x===n.fid){f=!0;break}if("Subflow"===n[FUNCTION_NAME])for(var w in n.param.functions)if(x===n.param.functions[w].fid){f=!0;break}if(f)break}if(f){var C=Studio.getEditorContainer().getActiveModelEditor().getMainArea();if(a.variables&&Object.keys(a.variables).length>0)if("realtime"===c)if("true"===t.VA.SettingStorage.getValue("editor.variable.visible"))new t.VA.Core.Dialogs.RunRealTimeDialog(C,b);else{var I={};for(var h in a.variables){T=(U=a.variables[h]).type.indexOf("array")>-1&&1==U.value.length?U.value[0]:U.value,_.isUndefined(T)||(I[h]=U.value)}v({OK:!0,args:I})}else if("etl"===c)new t.VA.Implementation.ETLFlow.Dialogs.LaunchProgressDialog(C,b);else if("true"===t.VA.SettingStorage.getValue("editor.variable.visible"))new t.VA.Core.Dialogs.RunDataDialog(C,b);else{I={};for(var h in a.variables){var T,U=a.variables[h];T=_.isArray(U.value)&&1===U.value.length?U.value[0]:U.value,_.isUndefined(T)||(I[h]=U.value)}v({OK:!0,args:I})}else setTimeout(function(){t.VA.Core.Utils.WidgetUtils.openErrorDialog("Variables are required to run the function.")},100)}else v()},n.prototype.stopCheckModel=function(){this.launchers.deeplearning.stopCheckModel()},n.prototype._extendListeners=function(t,e){var n=t;for(var r in e){var i=e[r];i&&($.isArray(i)?i.forEach(function(t){n[r]||(n[r]=[]),n[r].push(t)}):"function"==typeof i&&(n[r]||(n[r]=[]),n[r].push(i)))}},t.VA.Core.ModelLauncherManager=n}.call(this),function(){"use strict";var t=this.Brightics;function e(t){for(var e in this.cache={},this.labelMap={},this.subflowMap={},this.launchOptions=t,this.launchOptions.originalModels){var n=this.launchOptions.originalModels[e];this.labelMap[n.mid]=n.title,this._scanFunctions(n.mid,n)}}e.prototype._scanFunctions=function(t,e,n){for(var r in e.functions){var i=e.functions[r],o=t+"_"+i.fid;if(this.labelMap[o]=i.display.label,"Subflow"==i[FUNCTION_NAME]&&i.param.functions.length>0){var a={fid:i.fid,first:i.param.functions[0].fid,last:i.param.functions[i.param.functions.length-1].fid};for(var s in i.param.functions){var c=i.param.functions[s];this.subflowMap[t+"_"+c.fid]=a}}else i.param.functions&&this._scanFunctions(t,i.param,i.fid)}},e.prototype.createUnitEvent=function(t,e,n,r){var i,o=[];return(i=this._createUnitStartEvent(t,e,n,r))&&o.push(i),(i=this._createUnitEndEvent(t,e,n,r))&&o.push(i),o},e.prototype._createUnitStartEvent=function(t,e,n,r){if(this.cache[t]&&!(n.fid.indexOf("internal_function")>-1)){var i,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(i=a?o=a.fid:o+"@"+r,"WAIT"!==n.status&&!this.cache[t][i]){var s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"PROCESSING"==this.cache[t][i].event.status)){s={eventType:"UPDATE-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}}},e.prototype._createUnitEndEvent=function(t,e,n,r){var i,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(i=a?o=a.fid:o+"@"+r,this.cache[t]&&this.cache[t][i]&&"PROCESSING"==this.cache[t][i].event.status&&this.cache[t][i].event.status!=n.status)return this.cache[t][i].event.status=n.status,{eventType:"END-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:n.status,label:this.labelMap[e+"_"+o],begin:n.begin,end:n.end,message:n.message,sequence:r}},e.prototype.createProcessEvent=function(t,e,n,r,i,o){var a,s=[];return(a=this._createProcessStartEvent(t,e,n,o,i))&&s.push(a),(a=this._createProcessEndEvent(t,e,n,r,i))&&s.push(a),s},e.prototype._createProcessStartEvent=function(t,e,n,r,i){if(!(e.indexOf("internal_process")>-1||this.cache[t]&&this.cache[t].begin===n&&"0"==r)){var o={eventType:"BEGIN-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:i,begin:n,count:1};return this.cache[t]={mid:o.mid,status:o.status,begin:o.begin},o}},e.prototype._createProcessEndEvent=function(t,e,n,r,i){if(this.cache[t]&&this.cache[t].begin===n&&this.cache[t].status!==i)return{eventType:"END-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:i,begin:n,end:r}},t.VA.Core.EventDetector=e}.call(this),function(){"use strict";var t=this.Brightics;function e(t){for(var e in this.cache={},this.labelMap={},this.subflowMap={},this.launchOptions=t,this.launchOptions.originalModels){var n=this.launchOptions.originalModels[e];this.labelMap[n.mid]=n.title,this._scanFunctions(n.mid,n)}}e.prototype._scanFunctions=function(t,e,n){for(var r in e.functions){var i=e.functions[r],o=t+"_"+i.fid;if(this.labelMap[o]=i.display.label,"Subflow"==i[FUNCTION_NAME]&&i.param.functions.length>0){var a={fid:i.fid,first:i.param.functions[0].fid,last:i.param.functions[i.param.functions.length-1].fid};for(var s in i.param.functions){var c=i.param.functions[s];this.subflowMap[t+"_"+c.fid]=a}}else i.param.functions&&this._scanFunctions(t,i.param,i.fid)}},e.prototype.createUnitEvent=function(t,e,n,r){var i,o=[];return(i=this._createUnitStartEvent(t,e,n,r))&&o.push(i),(i=this._createUnitEndEvent(t,e,n,r))&&o.push(i),o},e.prototype._createUnitStartEvent=function(t,e,n,r){if(this.cache[t]&&!(n.fid.indexOf("internal_function")>-1)){var i,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(i=a?o=a.fid:o+"@"+r,"WAIT"!==n.status&&!this.cache[t][i]){var s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"PROCESSING"==this.cache[t][i].event.status)){s={eventType:"UPDATE-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,message:n.message,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}if(this.cache[t][i]&&(this.cache[t][i].event.begin!=n.begin||"SUCCESS"==this.cache[t][i].event.status)){s={eventType:"BEGIN-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:"PROCESSING",label:this.labelMap[e+"_"+o],begin:n.begin,sequence:r};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][i]={event:s},s}}},e.prototype._createUnitEndEvent=function(t,e,n,r){var i,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(i=a?o=a.fid:o+"@"+r,this.cache[t]&&this.cache[t][i]&&"PROCESSING"==this.cache[t][i].event.status&&this.cache[t][i].event.status!=n.status)return this.cache[t][i].event.status=n.status,{eventType:"END-UNIT",launchOptions:this.launchOptions,pid:t,mid:e,fid:o,status:n.status,label:this.labelMap[e+"_"+o],begin:n.begin,end:n.end,message:n.message,sequence:r}},e.prototype.createProcessEvent=function(t,e,n,r,i,o){var a,s=[];return(a=this._createProcessStartEvent(t,e,n,o))&&s.push(a),(a=this._createProcessEndEvent(t,e,n,r,i))&&s.push(a),s},e.prototype._createProcessStartEvent=function(t,e,n,r){if(!(e.indexOf("internal_process")>-1||this.cache[t]&&"0"==r)){var i={eventType:"BEGIN-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:"PROCESSING",begin:n};return this.cache[t]={mid:i.mid,status:i.status},i}},e.prototype._createProcessEndEvent=function(t,e,n,r,i){if(this.cache[t]&&"PROCESSING"==this.cache[t].status&&this.cache[t].status!=i)return{eventType:"END-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:i,begin:n,end:r}},t.VA.Implementation.Visual.EventDetector=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.JobDelegator.call(this,e),this.runnable=null,this._abort=!1}e.prototype=Object.create(t.VA.Core.JobDelegator.prototype),e.prototype.constructor=e,e.prototype._start=function(t,e){var n="api/va/v2/analytics/jobs/execute";e.publish&&(n="publish/jobs/execute");var r={url:n,type:"POST",blocking:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(Object.assign(e.publish?{user:e.user}:{},t))};return Promise.resolve($.ajax(r)).then(function(t){return JSON.parse(t)})},e.prototype._stop=function(t){var e={url:"api/va/v2/analytics/jobs/"+this.runnable.jid+"/delete",type:"POST",blocking:!1,contentType:"application/json; charset=utf-8"};if(t){var n={type:t};e.data=JSON.stringify(n)}return $.ajax(e)},e.prototype._check=function(t,e){var n="api/va/v2/analytics/jobs/"+t;e.publish&&(n="publish/jobs/"+t);var r={url:n,blocking:!1,type:"GET"};return $.ajax(r)},e.prototype._scheduleCheckStatus=function(t,e){var n=this,r=function(){n._check(t,e).done(function(t){n._abort?n._fireAbort({jobId:n.runnable.jid,end:Date.now(),status:"ABORT",message:"Job aborted by user"}):"FAIL"===t.status?n._fireFail(t):"SUCCESS"===t.status?n._fireSuccess(t):"WAIT"===t.status?(n._firePending(t),setTimeout(r,3e3)):(n._fireStatus(t),setTimeout(r,3e3))}).fail(n._fireCatch.bind(n))};setTimeout(r,2e3)},e.prototype.start=function(t,e){var n=this;return this.runnable=t,this._start(t,e).then(function(t){return n._scheduleCheckStatus(t.result,e),t},n._fireCatch.bind(n))},e.prototype.stop=function(t){this._stop(t),this._abort=!0},t.VA.Implementation.Visual.Job=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.ModelLauncher.call(this)}e.prototype=Object.create(t.VA.Core.ModelLauncher.prototype),e.prototype.constructor=e,e.prototype.launchUnit=function(e,n,r,i){var o={mode:"unit",clazz:t.VA.Implementation.Visual.Clazz,expectedUnitCount:1,originalModels:[{mid:r.mid||e.parent().mid,title:e.parent().title,type:t.VA.Implementation.Visual.Clazz,functions:[$.extend(!0,{},e)],getFnUnitById:function(){}}],runnable:this._createUnitRunnable(e,n,r)};this._launch(o,r,i)},e.prototype._createUnitRunnable=function(e,n,r){var i=this._generateJobId(e.fid),o=r.user||t.VA.Env.Session.userId,a=t.VA.Core.Utils.RunnableFactory._create(i,o),s=$.extend(!0,{},e);t.VA.Core.Utils.ModelUtils.carvePersist(s,r.persist||!1),t.VA.Core.Utils.ModelUtils.deleteDisplay(s),t.VA.Core.Utils.ModelUtils.deleteEmptyArray(s);var c=r.mid||e.parent().mid;a.main=c,a.models[c]={mid:c,type:"data",functions:[s],links:[],entries:[s.fid]},a.version=t.VA.Env.CoreVersion;o=r.user||t.VA.Env.Session.userId;if("SQLExecutor"===s.name){var u={title:"SQL Query Executor",mid:c,type:"script",functions:[{func:"sql",name:"SQL",param:{script:"select\n\t*\nfrom\n\t#{DF0000}",limit:"1000",alias:{"#{DF0000}":"/"+o+"/"+c+"/"+s.outData}},fid:s.fid,label:s.display.label}],entries:[s.fid],links:[]};a.models[c]=u}return a},e.prototype.launchModel=function(e,n,r,i){var o=e.mid,a=this._generateJobId(o),s=t.VA.Env.Session.userId,c={mode:"workflow",clazz:t.VA.Implementation.Visual.Clazz,originalModels:[e],runnable:t.VA.Core.Utils.RunnableFactory.createForFlow(e,a,s,n,r)},u=c.runnable.models;for(var l in c.runnable.models){u[l].type="data";for(var p=u[l].functions,d=p.length-1;d>=0;d--)"Empty"===p[d][FUNCTION_NAME]&&p.splice(d,1);for(var f=0;f<p.length-1;f++)u[l].links.push({sourceFid:p[f].fid,targetFid:p[f+1].fid});u[l].entries=[u[l].entries[0]],c.expectedUnitCount=p.length}this._launch(c,r,i)},e.prototype._launch=function(e,n,r){var i=this,o=new t.VA.Implementation.Visual.EventDetector(e),a=function(t){for(var e in t.processes){var r=t.processes[e],a=r.pid||"pid_undefined",s=r.mid,c=o.createProcessEvent(a,s,r.begin,r.end,r.status);for(var u in r.functions){var l=r.functions[u];"PROCESSING"==l.status&&(i.processingUnit=l),c=c.concat(o.createUnitEvent(a,s,l,u))}for(var p in c)c[p].originalResponse=t;n.hideDialog||i._fireEvents(c)}},s=function(t){var r={eventType:"END-JOB",jid:t.jobId,message:t.message,status:t.status,launchOptions:e,originalResponse:t};n.hideDialog||i._fireEvents([r]),delete i.jobScheduler[t.jobId]},c={status:[function(t){a(t)}],success:[function(t){a(t),s(t)}],abort:[function(t){s(t)}],fail:[function(t){a(t),s(t)}],pending:[function(t){!function(t){var r={eventType:"PENDING-JOB",jid:t.jobId,message:i._getPendingMessage(t),status:t.status,launchOptions:e,originalResponse:t};n&&n.hideDialog||i._fireEvents([r])}(t)}],catch:[function(t){s({jobId:e.runnable.jid,status:"FAIL",exception:t})}]};this._extendListeners(c,r);var u=new t.VA.Implementation.Visual.Job(c);u.start(e.runnable,n).then(function(t){i.jobScheduler[t.result]=u;var r={eventType:"BEGIN-JOB",jid:t.result,status:"WAIT",launchOptions:e};n&&n.hideDialog||i._fireEvents([r])})},t.VA.Implementation.Visual.VisualModelLauncher=e;var n=null;t.VA.Implementation.Visual.VisualModelLauncher.instance=function(){return null==n&&(n=new t.VA.Implementation.Visual.VisualModelLauncher),n}}.call(this);