text: /*   Brightics VA Build 181122 */!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports;}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i});},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=28);}([function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var i=function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t;};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(30);function r(t){}n.n(i)()(r.prototype);},function(t,e,n){"use strict";n.d(e,"a",function(){return r;}),n.d(e,"b",function(){return o;}),n.d(e,"c",function(){return a;});var i=function i(t){return Promise.resolve($.ajax(t));},r=function r(t){return i({type:"GET",url:t});},o=function o(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t};return i(n);},a=function a(t,e){var n={type:"POST",data:JSON.stringify(e),contentType:"application/json; charset=utf-8",url:t,async:!1};return i(n);};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(1);function r(t,e){i.a.call(this),this.$el=t,this.options=e;}r.prototype=Object.create(i.a.prototype),r.prototype.constructor=r,r.prototype.getParent=function(){return this.$el;},r.prototype.getOptions=function(){return this.options;},r.prototype.render=function(){throw new Error("not implemented");},r.prototype.destroy=function(){};},function(t,e,n){"use strict";var i=n(38)();t.exports=function(t){return t!==i&&null!==t;};},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var i=n(15),r=n(6),o=n(0);function a(t){this.data=t||{},this.data.update_time&&(this.data.update_time=new Date(this.data.update_time)),this.data.create_time&&(this.data.create_time=new Date(this.data.create_time)),this.data.contents?(Object(i.a)(this.data),Object(i.c)(this.data.contents)):this.data.contents={};}Object(o.a)(a,r.a),a.prototype.getFileId=function(){return this.data.id;},a.prototype.setFileId=function(t){return this.data.id=t,this.data.contents.mid=t,this;},a.prototype.getDescription=function(){return this.data.description;},a.prototype.setDescription=function(t){return this.data.description=t,this;},a.prototype.getType=function(){return this.data.type;},a.prototype.setType=function(t){return this.data.type=t,this;},a.prototype.getEventKey=function(){return this.data.event_key;},a.prototype.setEventKey=function(t){return this.data.event_key=t,this;},a.prototype.getLabel=function(){return this.data.label;},a.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this;},a.prototype.getProjectId=function(){return this.data.project_id;},a.prototype.setProjectId=function(t){return this.data.project_id=t,this;},a.prototype.getUpdateTime=function(){return new Date(this.data.update_time);},a.prototype.setUpdateTime=function(t){return this.data.update_time=t,this;},a.prototype.getCreateTime=function(){return new Date(this.data.create_time);},a.prototype.setCreateTime=function(t){return this.data.create_time=t,this;},a.prototype.getUpdater=function(){return this.data.updater;},a.prototype.setUpdater=function(t){return this.data.updater=t,this;},a.prototype.getCreator=function(){return this.data.creator;},a.prototype.setCreator=function(t){return this.data.creator=t,this;},a.prototype.getFromVersion=function(){return this.data.from_version;},a.prototype.setFromVersion=function(t){return this.data.from_version=t,this;},a.prototype.getModelImage=function(){return this.data.model_image;},a.prototype.setModelImage=function(t){return this.data.model_image=t,this;},a.prototype.setContents=function(t){return this.data.contents=t,this.data.contents.title=this.data.label,Object(i.a)(this.data),Object(i.c)(this.data.contents),this;},a.prototype.getContents=function(t){return this.data.contents;},a.prototype.toJSON=function(){return this.data;},a.prototype.getHashCode=function(){return this.getFileId();},a.prototype.equals=function(t){return this.getFileId()==t.getFileId()&&this.getEventKey()==t.getEventKey()&&Number(this.getUpdateTime())==Number(t.getUpdateTime());},a.prototype.getResourceName=function(){return"file";},a.prototype.getInnerModels=function(){return this.data.contents.innerModels;},a.prototype.getInnerModel=function(t){if(this.data.contents.innerModels)return this.data.contents.innerModels[t];},a.prototype.getParam=function(){return this.data.contents.param;},a.prototype.setParam=function(t,e){this.data.contents.param[t]=e;};},function(t,e,n){"use strict";function i(){}n.d(e,"a",function(){return i;}),i.prototype.equals=function(t){throw new Error("not implemented");},i.prototype.getHashCode=function(){throw new Error("not implemented");},i.prototype.toJSON=function(){throw new Error("not implemented");},i.prototype.getResourceName=function(){throw new Error("not implemented");};},function(t,e,n){"use strict";function i(){this.map={},this.chk={};}n.d(e,"a",function(){return i;}),i.prototype.set=function(t,e){this.map[t]=e,this.chk[t]=!0;},i.prototype.get=function(t){return this.map[t];},i.prototype.remove=function(t){var e=this.map[t];return this.chk[t]=!1,delete this.map[t],e;},i.prototype.has=function(t){return this.chk[t];},i.prototype.toArray=function(){return _.toArray(this.map);},i.prototype.toJSON=function(){return this.map;};},function(t,e,n){"use strict";n.d(e,"b",function(){return i;}),n.d(e,"a",function(){return r;});var i=function i(t){return _.reduce(t,function(t,e){return t.then(function(t){return e(t);});},Promise.resolve());},r=function r(t){return Promise.all(_.map(t,function(t){return t();}));};},function(t,e,n){"use strict";var i=n(17),r=n(5),o=n(19),a=n(60);n.d(e,"c",function(){return i.a;}),n.d(e,"a",function(){return r.a;}),n.d(e,"d",function(){return o.a;}),n.d(e,"b",function(){return a.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(3);function r(t,e){i.a.call(this,t,e);}r.prototype=Object.create(i.a.prototype),r.prototype.constructor=r,r.prototype.update=function(t){throw new Error("not implemented");};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(10);function r(t,e){i.a.call(this,t,e),this.listeners={},this.jqxOptions=this._brtcOptions2jqxOptions(this.options),this.keyIndex=0;}r.prototype=Object.create(i.a.prototype),r.prototype.constructor=r,r.prototype.update=function(t){this.source.localdata=t,this.$content.jqxGrid("updatebounddata"),this.options.selectable&&this.$content.jqxGrid("clearselection");},r.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;},r.prototype.destroy=function(){this.$content.jqxGrid("destroy");},r.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;},r.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;},r.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));},r.prototype._getDefaultHeaderRenderer=function(){return function(t){return'<div class="brtc-va-base-list-column-header">'+_.escape(t)+"</div>";};},r.prototype._getDefaultDataRenderer=function(t,e){var n=[this._getAlignClass(e)].join(" ");return function(e,i,r){return this._wrap("<div>"+_.escape(this._format(r,t))+"</div>",n);}.bind(this);},r.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"];},r.prototype._getGenerativeRenderer=function(t,e){var n=[this._getAlignClass(t)].join(" ");return function(t,i,r){var o=e(t,r);return this._wrap(this._getHtmlWithEventHandler(o,t),n);}.bind(this);},r.prototype._getHtmlWithEventHandler=function(t,e){var n=this.source.localdata[e],i=e,r=function(t){var e=$._data(t,"events");_.forOwn(e,function(e,r){var o=this._genHandlerKey();this.listeners[r]=this.listeners[r]||{},this.listeners[r][o]={fn:function fn(t){_.forEach(e,function(e){e.handler(t);});},data:n,index:i},t.setAttribute(r+"__key__",o);}.bind(this));}.bind(this),o=function o(t){var e=t.children;r(t),_.forEach(e,function(t){r(t),o(t);});};return o(t[0]),t[0].outerHTML;},r.prototype._wrap=function(t,e){return['<div class="'+e+'">',t,"</div>"].join("");},r.prototype._format=function(t,e){var n=t||"";return"date"==(e||"string")&&n?moment(n).format("YYYY-MM-DD HH:mm:ss"):n;},r.prototype._genHandlerKey=function(){return parseInt(++this.keyIndex);},r.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));},r.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 i=n+"__key__",r=(e.originalEvent||e.args.originalEvent).target.getAttribute(i);return t[n]&&t[n][r]&&(e.cancel=!0,e.data=t[n][r].data,e.index=t[n][r].index,t[n][r].fn(e)),!1;});});},r.prototype.getSelectedRows=function(){var t=this.$content.jqxGrid("getselectedrowindexes");return _.map(t,function(t){return this.source.localdata[t];}.bind(this));};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(3);function r(t,e){i.a.call(this,t,e);}r.prototype=Object.create(i.a.prototype),r.prototype.constructor=r,r.prototype.setItems=function(t){throw new Error("not implemented");},r.prototype.getItems=function(){throw new Error("not implemented");},r.prototype.getSelectedItem=function(){throw new Error("not implemented");},r.prototype.isSelected=function(){throw new Error("not implemented");},r.prototype.isOpened=function(){throw new Error("not implemented");},r.prototype.open=function(){throw new Error("not implemented");},r.prototype.close=function(){throw new Error("not implemented");},r.prototype.enable=function(){throw new Error("not implemented");},r.prototype.disable=function(){throw new Error("not implemented");};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var i=n(12);function r(t,e){i.a.call(this,t,e),this.jqxOptions=this._brtcOptions2jqxOptions(e),this._initEventListener();}r.prototype=Object.create(i.a.prototype),r.prototype.constructor=r,r.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));},r.prototype._getAutoDropDownHeight=function(t){return!(t.itemHeight*t.source.length>t.dropDownHeight);},r.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;},r.prototype._getRenderer=function(t){return t||function(t){return t;};},r.prototype._getRenderedData=function(t){return _.map(t,this.renderer);},r.prototype.render=function(){return this.$el.jqxDropDownList(this.jqxOptions),this;},r.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;},r.prototype.getItems=function(){return this.data;},r.prototype.getSelectedItem=function(){if(!this.isSelected())throw new Error("not selected");return this.data[this.$el.jqxDropDownList("selectedIndex")];},r.prototype.isSelected=function(){return this.$el.jqxDropDownList("selectedIndex")>-1;},r.prototype.isOpened=function(){return this.$el.jqxDropDownList("isOpened");},r.prototype.open=function(){return this.$el.jqxDropDownList("open"),this;},r.prototype.close=function(){return this.$el.jqxDropDownList("close"),this;},r.prototype.enable=function(){return this.$el.jqxDropDownList({disabled:!1}),this;},r.prototype.disable=function(){return this.$el.jqxDropDownList({disabled:!0}),this;},r.prototype.focus=function(){return this.$el.jqxDropDownList("focus"),this;};},function(t,e,n){"use strict";n.d(e,"a",function(){return s;});var i=n(2),r=n(5),o=function o(t){try{return new r.a(t);}catch(t){return void console.warn("Some files are ignored.");}},a=function a(t){return _.filter(_.map(t,o),_.negate(_.isUndefined));},s={getFiles:function getFiles(t){var e="api/va/v2/ws/projects/"+t+"/files";return Object(i.a)(e).then(a);},getFile:function getFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e;return Object(i.a)(n).then(function(t){return t.length?o(t[0]):null;});},addFile:function addFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files";return Object(i.b)(n,e.toJSON());},updateFile:function updateFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e.getFileId()+"/update";return Object(i.b)(n,e.toJSON()).then(function(t){return o(t[0]);});},updateFileSync:function updateFileSync(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e.getFileId()+"/update";return Object(i.c)(n,e.toJSON()).then(function(t){return o(t[0]);});},deleteFile:function deleteFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e+"/delete";return Object(i.b)(n);}};},function(t,e,n){"use strict";n.d(e,"a",function(){return i;}),n.d(e,"b",function(){return r;}),n.d(e,"c",function(){return a;});var i=function i(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());},r=function r(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());},o=0,a=function a(t){o=o||new Brightics.VA.Core.Tools.ModelMigrator.Executor();try{o.migrate(t);}catch(t){throw console.error(t),new Error("Migration failed.");}};},function(t,e,n){"use strict";n.d(e,"a",function(){return s;});var i=n(2),r=n(17),o=function o(t){return new r.a(t);},a=function a(t){return _.map(t,o);},s={getProjects:function getProjects(){return Object(i.a)("api/va/v2/ws/projects").then(a);},getProject:function getProject(t){var e="api/va/v2/ws/projects/"+t;return Object(i.a)(e).then(function(t){return o(t[0]);});},addProject:function addProject(t){return Object(i.b)("api/va/v2/ws/projects",t.toJSON()).then(o);},updateProject:function updateProject(t){var e="api/va/v2/ws/projects/"+t.getProjectId()+"/update";return Object(i.b)(e,t.toJSON()).then(o);},deleteProject:function deleteProject(t){var e="api/va/v2/ws/projects/"+t+"/delete";return Object(i.b)(e);}};},function(t,e,n){"use strict";n.d(e,"a",function(){return o;});var i=n(6),r=n(0);function o(t){this.data=t||{};}Object(r.a)(o,i.a),o.prototype.getProjectId=function(){return this.data.id;},o.prototype.setProjectId=function(t){return this.data.id=t,this;},o.prototype.getLabel=function(){return this.data.label;},o.prototype.setLabel=function(t){return this.data.label=t,this;},o.prototype.getUpdateTime=function(){return new Date(this.data.update_time);},o.prototype.setUpdateTime=function(t){return this.data.update_time=t,this;},o.prototype.getCreateTime=function(){return new Date(this.data.create_time);},o.prototype.setCreateTime=function(t){return this.data.create_time=t,this;},o.prototype.getCreator=function(){return this.data.creator;},o.prototype.setCreator=function(t){return this.data.creator=t,this;},o.prototype.getUpdater=function(){return this.data.updater;},o.prototype.setUpdater=function(t){return this.data.updater=t,this;},o.prototype.getDescription=function(){return this.data.description;},o.prototype.setDescription=function(t){return this.data.description=t,this;},o.prototype.getModelCount=function(){return parseInt(this.data.model_count);},o.prototype.setModelCount=function(t){return this.data.model_count=t,this;},o.prototype.getReportCount=function(){return parseInt(this.data.report_count);},o.prototype.setReportCount=function(t){return this.data.report_count=t,this;},o.prototype.getTag=function(){return this.data.tag;},o.prototype.setTag=function(t){return this.data.tag=t,this;},o.prototype.getType=function(){return this.data.type;},o.prototype.setType=function(t){return this.data.type=t,this;},o.prototype.toJSON=function(){return this.data;},o.prototype.equals=function(t){return this.getProjectId()==t.getProjectId()&&Number(this.getUpdateTime())==Number(t.getUpdateTime());},o.prototype.getHashCode=function(){return this.getProjectId();},o.prototype.getResourceName=function(){return"project";};},function(t,e,n){"use strict";n.d(e,"a",function(){return c;});var i=n(2),r=n(5),o=n(19),a=function a(t){return new o.a(t);},s=function s(t){return _.map(t,a);},c={getVersions:function getVersions(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions";return Object(i.a)(n).then(s);},getVersion:function getVersion(t,e,n){var r="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n;return Object(i.a)(r).then(a);},addVersion:function addVersion(t,e,n){var r="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions";return Object(i.b)(r,n.toJSON(!0)).then(a);},updateVersion:function updateVersion(t,e,n){var r="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n.getVersionId()+"/update";return Object(i.b)(r,n);},loadVersion:function loadVersion(t,e,n){var o="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n+"/load";return Object(i.b)(o).then(function(t){if(t.length)return e=t[0],new r.a(e);var e;});},getVersionsForced:function getVersionsForced(t,e,n,i){var r={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",contentType:"application/json; charset=utf-8"};return $.ajax(r).done(function(t){if(n&&"function"==typeof n)return n(s(t));}).fail(function(t){if(i&&"function"==typeof i)return i(t);});},getVersionForced:function getVersionForced(t,e,n,i,r){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(i&&"function"==typeof i)return i(a(t));}).fail(function(t){if(r&&"function"==typeof r)return r(t);});}};},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var i=n(6),r=n(0),o=n(15);function a(t){this.data=t||{},this.data.contents?(Object(o.b)(this.data),Object(o.c)(this.data.contents)):this.data.contents={};}Object(r.a)(a,i.a),a.prototype.getVersionId=function(){return this.data.version_id;},a.prototype.setVersionId=function(t){return this.data.version_id=t,this.data.contents.version_id=t,this;},a.prototype.getLabel=function(){return this.data.label;},a.prototype.setLabel=function(t){return this.data.label=t,this.data.contents.title=t,this;},a.prototype.getDescription=function(){return this.data.description;},a.prototype.setDescription=function(t){return this.data.description=t,this;},a.prototype.getFileId=function(){return this.data.file_id;},a.prototype.setFileId=function(t){return this.data.file_id=t,this.data.contents.mid=t,this;},a.prototype.getMajorVersion=function(){return this.data.major_version;},a.prototype.setMajorVersion=function(t){return this.data.major_version=t,this;},a.prototype.getMinorVersion=function(){return this.data.minor_version;},a.prototype.setMinorVersion=function(t){return this.data.minor_version=t,this;},a.prototype.getVersion=function(){return this.data.major_version+"."+this.data.minor_version;},a.prototype.getType=function(){return this.data.type;},a.prototype.setType=function(t){return this.data.type=t,this;},a.prototype.getTags=function(){return this.data.tags;},a.prototype.setTags=function(t){return this.data.tags=t,this;},a.prototype.getModelImage=function(){return this.data.model_image;},a.prototype.setModelImage=function(t){return this.data.image=t,this;},a.prototype.getUpdateTime=function(){return new Date(this.data.update_time);},a.prototype.setUpdateTime=function(t){return this.data.update_time=t,this;},a.prototype.getUpdater=function(){return this.data.updater;},a.prototype.setUpdater=function(t){return this.data.updater=t,this;},a.prototype.getCreateTime=function(){return new Date(this.data.create_time);},a.prototype.setCreateTime=function(t){return this.data.create_time=t,this;},a.prototype.getCreator=function(){return this.data.creator;},a.prototype.setCreator=function(t){return this.data.creator=t,this;},a.prototype.getContents=function(){return this.data.contents;},a.prototype.setContents=function(t){return this.data.contents=t,Object(o.b)(this.data),Object(o.c)(this.data.contents),this;},a.prototype.toJSON=function(t){return t?this.data:_.omit(this.data,["isManual","isMajor"]);},a.prototype.setIsMajor=function(t){return this.data.isMajor=t,this;},a.prototype.setIsManual=function(t){return this.data.isManual=t,this;},a.prototype.compareToByVersion=function(t){return this.getMajorVersion()!==t.getMajorVersion()?this.getMajorVersion()-t.getMajorVersion():this.getMinorVersion()-t.getMinorVersion();},a.prototype.equals=function(t){return this.getVersionId()===t.getVersionId()&&Number(this.getUpdateTime())===Number(t.getUpdateTime());},a.prototype.getHashCode=function(){return this.getVersionId();},a.prototype.getResourceName=function(){return"version";};},function(t,e,n){"use strict";var i=n(7),r=n(21),o=n(22);n.d(e,"a",function(){return i.a;}),n.d(e,"b",function(){return r.a;}),n.d(e,"c",function(){return o.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var i=n(22),r=n(1),o=n(0);function a(){this.__root=new i.a();}Object(o.a)(a,r.a),a.prototype.getRootNode=function(){return this.__root;},a.prototype.getProjectNode=function(t){return this.__root.go(t);},a.prototype.getProjectNodeBruteForce=function(t){return this.getRootNode().findChildNodeBruteForce(t);},a.prototype.getProjectNodeByFileId=function(t){return this.getProjectNodeBruteForce(function(e){return e.hasChild(t);});},a.prototype.getFileNode=function(t,e){return t?this.getProjectNode(t).go(e):(console.warn("NO PROJECT ID"),this.getProjectNodeByFileId(e).go(e));},a.prototype.getVersionNode=function(t,e,n){return this.getFileNode(t,e).go(n);},a.prototype.getProjectMap=function(){return this.getRootNode().getChildrenMap();},a.prototype.getProjectArray=function(){return this.getRootNode().getChildren();},a.prototype.getFileMap=function(t){return this.getProjectNode(t).getChildrenMap();},a.prototype.getFileArray=function(t){return this.getProjectNode(t).getChildren();},a.prototype.getVersionMap=function(t,e){return this.getFileNode(t,e).getChildrenMap();},a.prototype.getVersionArray=function(t,e){return this.getFileNode(t,e).getChildren();},a.prototype.getProjects=function(){try{return this.getRootNode().getChildren();}catch(t){return;}},a.prototype.getProject=function(t){var e=this.getProjectNode(t);if(e)return e.getData();},a.prototype.getFiles=function(t){try{return this.getProjectNode(t).getChildren();}catch(t){return;}},a.prototype.getFile=function(t,e){try{return this.getFileNode(t,e).getData();}catch(t){return;}},a.prototype.getVersions=function(t,e){try{return this.getFileNode(t,e).getChildren();}catch(t){return;}},a.prototype.getVersion=function(t,e,n){try{return this.getVersionNode(t,e,n).getData();}catch(t){return;}},a.prototype.updateProject=function(t){return this.getProjectNode(t.getProjectId()).setData(t);},a.prototype.updateFile=function(t,e){return this.getFileNode(t,e.getFileId()).setData(e);},a.prototype.updateVersion=function(t,e,n){return this.getVersionNode(t,e,n.getVersionId()).setData(n);},a.prototype.addProject=function(t){return this.getRootNode().addChild(t.getProjectId(),t);},a.prototype.addFile=function(t,e){return this.getProjectNode(t).addChild(e.getFileId(),e);},a.prototype.addVersion=function(t,e,n){return this.getFileNode(t,e).addChild(n.getVersionId(),n);},a.prototype.deleteProject=function(t){return this.getRootNode().deleteChild(t).getData();},a.prototype.deleteFile=function(t,e){return this.getProjectNode(t).deleteChild(e).getData();},a.prototype.deleteVersion=function(t,e,n){return this.getFileNode(t,e).deleteChild(n).getData();};},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var i=n(7),r=n(1),o=n(0);function a(t,e){r.a.call(this),this.key=t,this.data=e,this.__parentNode=this,this.__childrenNodes=[],this.__childrenMap=new i.a();}Object(o.a)(a,r.a),a.prototype.hasChild=function(t){return this.__childrenMap.has(t);},a.prototype.setData=function(t){return this.data=t,this;},a.prototype.getData=function(){return this.data;},a.prototype.getKey=function(){return this.key;},a.prototype.setParent=function(t){this.__patrentNode=t;},a.prototype.getParent=function(){return this.__parentNode;},a.prototype.addChild=function(t,e){if(this.__childrenMap.has(t))return this.__childrenMap.get(t).setData(e);var n=new a(t,e);return n.setParent(this),this.__childrenMap.set(t,n),this.__childrenNodes.push(n),n;},a.prototype.deleteChild=function(t){var e=this.__childrenMap.remove(t);return _.remove(this.__childrenNodes,function(e){return e.getKey()==t;}),e;},a.prototype.updateChild=function(t,e){return this.__childrenMap.get(t).setData(e);},a.prototype.getChildren=function(){return _.map(this.__childrenNodes,function(t){return t.getData();});},a.prototype.getChildrenNodes=function(){return this.__childrenNodes;},a.prototype.getChildrenMap=function(){return _.forIn(this.__childrenMap.toJSON(),function(t){return t.getData();});},a.prototype.go=function(t){return this.__childrenMap.get(t);},a.prototype.getChild=function(t){return this.__childrenMap.get(t);},a.prototype.findChildNodeBruteForce=function(t){var e=_.findIndex(this.__childrenNodes,function(e){return t(e);});return e>-1?this.__childrenNodes[e]:null;};},function(t,e,n){"use strict";n.d(e,"a",function(){return v;});var i=n(1),r=n(16),o=n(14),a=n(18),s=n(0),c=n(20),u=n(21),l=n(49),p=n(56),d={ADD:"project:add",CHANGE:"project:change",DELETE:"project:delete"},f={ADD:"file:add",CHANGE:"file:change",DELETE:"file:delete"},h={ADD:"version:add",CHANGE:"version:change",DELETE:"version:delete"};function g(){i.a.call(this),this.projectTree=new u.a();}Object(s.a)(g,i.a),g.prototype.initProject=function(t){var e=this;return this.fetchFiles(t.getProjectId()).then(function(t){return Promise.all(_.map(t,e.initFile.bind(e)));});},g.prototype.initFile=function(t){return this.fetchVersions(t.getProjectId(),t.getFileId());},g.prototype._getResourceDiff=function(t,e){var n=_.compact(_.flatten(t)),i=new c.a(),r=[];return Object(l.a)(n,function(t){i.set(t.getHashCode(),t);}),Object(l.a)(e,function(t){var e=t.getHashCode();i.has(e)?(i.get(e).equals(t)||r.push({type:"change",data:t}),i.remove(e)):r.push({type:"add",data:t});}),Object(l.a)(i.toArray(),function(t){r.push({type:"delete",data:t});}),r;},g.prototype._syncProject=function(t){var e=this;Object(l.a)(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());});},g.prototype._syncFile=function(t){var e=this;Object(l.a)(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());});},g.prototype._syncVersion=function(t){var e=this;Object(l.a)(t,function(t){var n=t.data,i=e.projectTree.getProjectNodeByFileId(n.getFileId()).getData().getProjectId();"add"==t.type&&e._addVersion(i,n.getFileId(),n),"change"==t.type&&e._updateVersion(i,n.getFileId(),n);});},g.prototype._updateProject=function(t){this.projectTree.updateProject(t),this.emit(d.CHANGE,t);},g.prototype._addProject=function(t){this.projectTree.addProject(t),this.emit(d.ADD,t);},g.prototype._deleteProject=function(t){var e=this.projectTree.deleteProject(t);return this.emit(d.DELETE,e),e;},g.prototype._updateFile=function(t,e){return this.projectTree.updateFile(t,e),this.emit(f.CHANGE,e),e;},g.prototype._addFile=function(t,e){return this.projectTree.addFile(t,e),this.emit(f.ADD,e),e;},g.prototype._deleteFile=function(t,e){var n=this.projectTree.deleteFile(t,e);return this.emit(f.DELETE,n),n;},g.prototype._updateVersion=function(t,e,n){return this.projectTree.updateVersion(t,e,n),this.emit(h.CHANGE,n),n;},g.prototype._addVersion=function(t,e,n){return this.projectTree.addVersion(t,e,n),this.emit(h.ADD,n),n;},g.prototype._deleteVersion=function(t,e,n){var i=this.projectTree.addVersion(t,e,n);return this.emit(h.DELETE,i),i;},g.prototype.fetchProject=function(t){var e=this;return r.a.getProject(t).then(function(n){var i=e.projectTree.getProject(t);return e._syncProject(e._getResourceDiff([i],[n])),n;}).catch(function(t){throw console.error(t),new Error("failed to fetch project");});},g.prototype.fetchProjects=function(){var t=this;return r.a.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");});},g.prototype.fetchFiles=function(t){var e=this;return o.a.getFiles(t).then(function(n){var i=e.projectTree.getFiles(t);return e._syncFile(e._getResourceDiff([i],n)),n;});},g.prototype.fetchFile=function(t,e){var n=this;return o.a.getFile(t,e).then(function(i){var r=n.projectTree.getFile(t,e);return n._syncFile(n._getResourceDiff([r],[i])),i;}).catch(function(t){throw new Error("filed to fetch file");});},g.prototype.fetchVersions=function(t,e){var n=this;return a.a.getVersions(t,e).then(function(t){var i=n.projectTree.getProjectNodeByFileId(e).getData().getProjectId(),r=n.projectTree.getVersions(i,e);return n._syncVersion(n._getResourceDiff([r],t)),t;}).catch(function(t){throw new Error("failed to fetch versions");});},g.prototype.fetchVersion=function(t,e,n){var i=this;return a.a.getVersion(t,e,n).then(function(r){var o=i.projectTree.getVersion(t,e,n);return i._syncVersion(i._getResourceDiff([o],[r])),r;}).catch(function(t){throw new Error("filed to fetch version");});},g.prototype.build=function(){var t=this;return this.fetchProjects().then(function(e){return Promise.all(_.map(e,t.initProject.bind(t)));});},g.prototype.getProjects=function(){return this.projectTree.getProjects();},g.prototype.getProject=function(t){return this.projectTree.getProject(t);},g.prototype.addProject=function(t){var e=this;return r.a.addProject(t).then(function(){return e._addProject(t),t;}).catch(function(t){throw console.error(t),t;});},g.prototype.updateProject=function(t){var e=this;return r.a.updateProject(t).then(function(){return e._updateProject(t),t;}).catch(function(t){throw console.error(t),t;});},g.prototype.deleteProject=function(t){var e=this;return r.a.deleteProject(t).then(function(){return e._deleteProject(t);}).catch(function(t){throw console.error(t),t;});},g.prototype.getFiles=function(t){return this.projectTree.getFiles(t);},g.prototype.getFilesByModelType=function(t,e){return _.filter(this.getFiles(t),function(t){return t.getContents().type==e;});},g.prototype.getFile=function(t,e){return this.projectTree.getFile(t,e);},g.prototype.addFile=function(t,e){var n=this;return o.a.addFile(t,e).then(function(){return n._addFile(t,e),e;}).catch(function(t){throw console.error(t),t;});},g.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(i,r){o.a.updateFileSync(t,e).then(function(r){e.setEventKey(r.getEventKey()),e.setUpdateTime(r.getUpdateTime()),n._updateFile(t,e),i([null,e]);}).catch(function(t){console.error(t),i([t,e]);});});}),this.lastQuery;},g.prototype.deleteFile=function(t,e){var n=this;return o.a.deleteFile(t,e).then(function(){return n._deleteFile(t,e);}).catch(function(t){throw console.error(t),t;});},g.prototype.getVersions=function(t,e){return this.projectTree.getVersions(t,e);},g.prototype.getVersion=function(t,e,n){return this.projectTree.getVersion(t,e,n);},g.prototype.addVersion=function(t,e,n){var i=this;return a.a.addVersion(t,e,n).then(function(n){return i._addVersion(t,e,n),n;}).catch(function(t){throw console.error(t),t;});},g.prototype.updateVersion=function(t,e,n){var i=this;return a.a.updateVersion(t,e,n).then(function(){return i._updateVersion(t,e,n),n;}).catch(function(t){throw console.error(t),t;});},g.prototype.loadVersion=function(t,e,n){var i=this;return a.a.loadVersion(t,e,n).then(function(e){return i._updateFile(t,e),e;}).catch(function(t){throw console.error(t),t;});},g.prototype.validateFile=function(t,e){return p.a.validate(t,e);};var v=new g();},function(t,e,n){"use strict";n.d(e,"a",function(){return l;});var i=n(1),r=n(0);var o="table",a="model",s="image",c={"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 u(){i.a.call(this);}Object(r.a)(u,i.a),u.prototype.getMeta=function(t){return t.meta?t.meta:void 0;},u.prototype.getVersion=function(t){return t.version?t.version:"1.0";},u.prototype._getVersionPath=function(t){var e=this.getVersion(t);return c[e];},u.prototype._getPath=function(t,e,n){var i=this._getVersionPath(t);return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(i,[e,n]);},u.prototype.getInputs=function(t){var e=this._getPath(t,"in","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},u.prototype.getOutputs=function(t){var e=this._getPath(t,"out","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},u.prototype.getInputsToObject=function(t){if(!t)return{};var e={},n=this.getInputs(t);if(this.hasMeta(t))for(var i in n){e[n[i]]=i;}else{var r=this.getLabel(t);for(var o in n){e[n[o]]="["+o+"]"+r;}}return e;},u.prototype.getOutputsToObject=function(t){if(!t)return{};var e={},n=this.getOutputs(t);if(this.hasMeta(t))for(var i in n){if(Array.isArray(n[i]))for(var r in n[i]){e[n[i][r]]=i;}else e[n[i]]=i;}else{var o=this.getLabel(t);for(var r in n){e[n[r]]="["+r+"]"+o;}}return e;},u.prototype.getInData=function(t,e){var n=[],i=this.getMeta(t),r=this.getInputs(t);if(i)for(var a in r){r[a]&&(e?i[a].type===e&&(n=n.concat(r[a])):n=n.concat(r[a]));}else e?e===o&&(n=r):n=r;return n;},u.prototype.getOutData=function(t,e){var n=[],i=this.getMeta(t),r=this.getOutputs(t);if(i)for(var a in r){r[a]&&(e?i[a].type===e&&(n=n.concat(r[a])):n=n.concat(r[a]));}else e?e===o&&(n=r):n=r;return n;},u.prototype._getData=function(t){var e=function e(t){return _.isUndefined(t)?[]:_.isString(t)?[t]:_.isArray(t)?t.map(function(t){return e(t);}):Object.values(t).map(function(t){return e(t);});};return _.compact(_.flattenDeep([e(t.inputs||[]),e(t.outputs||[])]));},u.prototype.getAllData=function(t){return _.union(this.getInData(t),this.getOutData(t),this._getData(t));},u.prototype.getData=function(t,e){return"in"===e?this.getInData(t):this.getOutData(t);},u.prototype.getInputTypes=function(t){var e=this.getMeta(t);if(!e)return[o];var n=[],i=this.getInputs(t);for(var r in i){n.indexOf(e[r].type)<0&&n.push(e[r].type);}return n;},u.prototype.getOutputTypes=function(t){var e=this.getMeta(t);if(!e)return[o];var n=[],i=this.getOutputs(t);for(var r in i){n.indexOf(e[r].type)<0&&n.push(e[r].type);}return n;},u.prototype.getTypes=function(t,e){return"in"===e?this.getInputTypes(t):this.getOutputTypes(t);},u.prototype.getKeyByTableId=function(t,e){if(!t)return"";if(!this.getMeta(t))return"";var n=_.assign({},this.getInputs(t),this.getOutputs(t));for(var i in n){if(n[i].indexOf(e)>-1)return i;}},u.prototype.getTypeByTableId=function(t,e){if(!t)return"";var n=this.getMeta(t);if(!n)return o;var i=_.assign({},this.getInputs(t),this.getOutputs(t));for(var r in i){if(i[r].indexOf(e)>-1)return n[r].type;}return"";},u.prototype.getTypeByKey=function(t,e){if(!t)return"";var n=this.getMeta(t);return n?n[e].type:o;},u.prototype.getInTable=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getInputs(t);for(var r in i){i[r]&&n[r].type===o&&i[r]&&(e=e.concat(i[r]));}}else e=t[IN_DATA];return e;},u.prototype.getOutTable=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getOutputs(t);for(var r in i){i[r]&&n[r].type===o&&i[r]&&(e=e.concat(i[r]));}}else e=t[OUT_DATA];return e;},u.prototype.getInModel=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getInputs(t);for(var r in i){i[r]&&n[r].type===a&&i[r]&&(e=e.concat(i[r]));}}else;return e;},u.prototype.getOutModel=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getOutputs(t);for(var r in i){i[r]&&n[r].type===a&&i[r]&&(e=e.concat(i[r]));}}else;return e;},u.prototype.getInImage=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getInputs(t);for(var r in i){i[r]&&n[r].type===s&&i[r]&&(e=e.concat(i[r]));}}else;return e;},u.prototype.getOutImage=function(t){var e=[],n=this.getMeta(t);if(n){var i=this.getOutputs(t);for(var r in i){i[r]&&n[r].type===s&&i[r]&&(e=e.concat(i[r]));}}else;return e;},u.prototype.getPreviousFnUnits=function(t){var e=this,n=[],i=this.getParent(t),r=i.getPrevious(t.fid);return _.forEach(r,function(t){var r=i.getFnUnitById(t),o=e.isProcessFunction(r)?i.getAllPreviousFnUnits(r.fid):[r];n=_.union(n,o);}),n;},u.prototype.getLinkedTable=function(t){var e=this,n=[],i=this.getPreviousFnUnits(t);return _.forEach(i,function(t){n=n.concat(e.getOutTable(t));}),n;},u.prototype.getTable=function(t,e){return"in"===e?this.getInTable(t):this.getOutTable(t);},u.prototype.getModel=function(t,e){return"in"===e?this.getInModel(t):this.getOutModel(t);},u.prototype.getImage=function(t,e){return"in"===e?this.getInImage(t):this.getOutImage(t);},u.prototype.hasMeta=function(t){return!!t.meta;},u.prototype.hasInput=function(t){var e=this._getPath(t,"in","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},u.prototype.hasOutput=function(t){var e=this._getPath(t,"out","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},u.prototype.getInRange=function(t){var e={},n=this.getMeta(t);if(n){var i=this.getInputs(t);for(var r in i){var a=n[r].type;e[a]||(e[a]={min:0,max:0}),n[r].range?(e[a].min+=n[r].range.min,e[a].max+=n[r].range.max):(e[a].min+=1,e[a].max+=1);}}else{var s=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[o]=s["in-range"];}return e;},u.prototype.getOutRange=function(t){var e={},n=this.getMeta(t);if(n){var i=this.getOutputs(t);for(var r in i){var a=n[r].type;e[a]||(e[a]={min:1,max:1}),n[r].range&&(e[a].min=n[r].range.min,e[a].max=n[r].range.max);}}else{var s=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[o]=s["out-range"];}return e;},u.prototype.getTotalInRangeCount=function(t){var e={min:0,max:0},n=this.getInRange(t);for(var i in n){e.min+=n[i].min,e.max+=n[i].max;}return e;},u.prototype.getTotalOutRangeCount=function(t){var e={min:0,max:0},n=this.getOutRange(t);for(var i in n){e.min+=n[i].min,e.max+=n[i].max;}return e;},u.prototype.getKeyByType=function(t,e,n){var i=this.getMeta(t);if(i){var r="in"===n?this.getInputs(t):this.getOutputs(t);for(var o in r){if(i[o].type===e)return o;}}},u.prototype.isProcessFunction=function(t){return["SetValue","ImportData","ExportData"].indexOf(t[FUNCTION_NAME])>=0;},u.prototype.isSkip=function(t){return t.skip&&_.isEqual(t.skip,!0);},u.prototype.getDefinition=function(t,e){return Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary(t,e);},u.prototype.isExist=function(t,e){var n=this.getOutData(t),i=this.getInData(e);return _.forEach(n,function(t){_.forEach(i,function(e){if(t===e)return!0;});}),!1;},u.prototype.isConnectable=function(t,e){var n=this.getDefinition("data",t.func),i=this.getDefinition("data",e.func);if(n["connectable-functions"]){if(n["connectable-functions"].indexOf(e.func)<0)return!1;}else if(i["acceptable-functions"]&&i["acceptable-functions"].indexOf(t.func)<0)return!1;var r=this.getOutputTypes(t),o=this.getInputTypes(e),a=0;for(var s in r){var c=r[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;},u.prototype.connect=function(t,e){var n=this.getOutData(t),i=this.getInputTypes(e),r={table:[],model:[],image:[]};for(var o in n){var a=n[o];r[s=this.getTypeByTableId(t,a)].push(a);}for(var s in r){0!==r[s].length&&i.indexOf(s)>-1&&this.addInData(e,s,r[s]);}},u.prototype.disconnect=function(t,e){var n=this.getOutData(t),i={table:[],model:[],image:[]};for(var r in n){var o=n[r];i[a=this.getTypeByTableId(t,o)].push(o);}for(var a in i){0!==i[a].length&&this.removeInData(e,a,i[a]);}},u.prototype.addInData=function(t,e,n){var i=this;if(0!==n.length)if(e===o){if(this.getMeta(t)){var r=this.getInputs(t);_.forEach(r,function(r,o){_.isArray(r)&&_.isEqual(e,i.getTypeByKey(t,o))?t.inputs[o]=_.union([],r,n):_.isEmpty(r)&&_.isEqual(e,i.getTypeByKey(t,o))&&_.isEmpty(i.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}else t[IN_DATA].push(n[0]);}else if("model"===e){r=this.getInputs(t);_.forEach(r,function(r,o){_.isArray(r)&&_.isEqual(e,i.getTypeByKey(t,o))?t.inputs[o]=_.union([],r,n):_.isEmpty(r)&&_.isEqual(e,i.getTypeByKey(t,o))&&_.isEmpty(i.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}else if("image"===e){r=this.getInputs(t);_.forEach(r,function(r,o){_.isArray(r)&&_.isEqual(e,i.getTypeByKey(t,o))?t.inputs[o]=_.union([],r,n):_.isEmpty(r)&&_.isEqual(e,i.getTypeByKey(t,o))&&_.isEmpty(i.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}},u.prototype.removeInData=function(t,e,n){if(0!==n.length){var i=this;n=Array.isArray(n)?n:[n];this.getMeta(t)?_.forEach(n,function(e){var n=i.getKeyByTableId(t,e);if(!_.isEmpty(n)){var r=t.inputs[n];_.isArray(r)?(_.remove(r,function(t){return t==e;}),t.inputs[n]=r):t.inputs[n]="";}}):Brightics.VA.Core.Utils.CommonUtils.removeArrayElement(t[IN_DATA],n);}},u.prototype.createOutData=function(t,e){var n=this.getDefinition("data",e),i=$.extend(!0,{},n.defaultFnUnit),r={};if(i.meta)for(var o in r.outputs=i.outputs,r.outputs){Array.isArray(r.outputs[o])?r.outputs[o].push(Brightics.VA.Core.Utils.IDGenerator.table.id()):r.outputs[o]=Brightics.VA.Core.Utils.IDGenerator.table.id();}else{r[OUT_DATA]=i[OUT_DATA];for(var a=n["out-range"],s=0;s<a.min;s++){r[OUT_DATA].push(Brightics.VA.Core.Utils.IDGenerator.table.id());}}return r;},u.prototype.wrapInputs=function(t){return Array.isArray(t)?{inData:t}:{inputs:t};},u.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]=[];},u.prototype.isArray=function(t){return Array.isArray(t);},u.prototype.getFunc=function(t){return t?t.func:"";},u.prototype.getName=function(t){return t?t.name:"";},u.prototype.getLabel=function(t){return t?t.display.label:"";},u.prototype.getId=function(t){return t?t.fid:"";},u.prototype.getParam=function(t){return t?t.param:{};},u.prototype.getKeyLabel=function(t,e){var n=this.getMeta(t);return _.isEmpty(n)?"":n[e].label?n[e].label:e;},u.prototype.getCategory=function(t){return this.getDefinition("data",t.func).category;},u.prototype.getContext=function(t){return t.context||"scala";},u.prototype.isFlexibleFunction=function(t){return"control"===this.getCategory(t)||"script"===this.getCategory(t)||"rowAppend"===this.getFunc(t);},u.prototype.inputChangable=function(t){return"script"!==this.getCategory(t)&&"rowAppend"!==this.getFunc(t);},u.prototype.getDataPanel=function(t,e){var n=Brightics.VA.Core.Editors.Sheet.Panels.DataPanel;if("out"===e){var i=this.getFunc(t);n=Brightics.VA.Implementation.DataFlow.Functions[i]&&Brightics.VA.Implementation.DataFlow.Functions[i].DataPanel||n;}return n;},u.prototype.getParent=function(t){return"function"==typeof t.parent?t.parent():Studio.getEditorContainer().getActiveModelEditor().getActiveModel();},u.prototype.hasTable=function(t){return this.getTypes(t).indexOf(o)>-1;},u.prototype.changeData=function(t,e,n){if(this.hasMeta(t)){var i=this.getInputs(t),r=this.getOutputs(t);_.forEach(i,function(i,r){_.isEqual(i,e)&&(t.inputs[r]=n);}),_.forEach(r,function(i,r){_.isEqual(i,e)&&(t.outputs[r]=n);});var o=function o(t){return _.isString(t)?_.isEqual(t,e)?n:t:_.isArray(t)?t.map(function(t){return o(t);}):_.isObject(t)?_.zipObject(Object.entries(t).map(function(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(i,r){_.isEqual(i,e)&&(t.inData[r]=n);}),_.forEach(t.outData,function(i,r){_.isEqual(i,e)&&(t.outData[r]=n);});},u.prototype.isDustNode=function(t){return["brightics"].indexOf(this.getCategory(t))>-1;},u.prototype.isBluffNode=function(t){return!(t.inData||t.outData||t.inputs||t.outputs);},u.prototype.isInputtable=function(t){return this.getTotalInRangeCount(t).min>0||this.isBluffNode(t);},u.prototype.isOutputtable=function(t){return!Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func)["out-node"];},u.prototype.isSkippable=function(t){return this.isBluffNode(t)||this.isProcessFunction(t);},u.prototype.isAvailable=function(t){var e=this.getFunc(t);return!_.isUndefined(Brightics.VA.Core.Interface.Functions.data[e]);};var l=new u();},function(t,e,n){"use strict";var i=function i(t){for(var e,n=t||16,i="",r=0;r<n;r++){i+=(e="23456789abcdefghjkmnpqrstuvwxyz").charAt(Math.floor(Math.random()*e.length));}return i;},r={project:{id:function id(){return"p"+i(15);}},model:{id:function id(){return"m"+i(15);}},control:{id:function id(){return"c"+i(15);}},func:{id:function id(){return"f"+i(15);}},table:{id:function id(){return"t"+i(15);}},link:{id:function id(){return"k"+i(15);}},template:{id:function id(){return"t"+i(15);}},notice:{id:function id(){return"n"+i(15);}},send:{id:function id(){return"s"+i(39);}},report:{id:function id(t){return"r"+i(t||8);}},schedule:{id:function id(){return"j"+i(15);}},file:{id:function id(){return"f"+i(8);}},reportPage:{id:function id(){return"rp"+i(14);}},reportContent:{id:function id(){return"rc"+i(14);}},dataSource:{id:function id(){return"ds"+i(14);}},udf:{id:function id(t){return"udf_"+t+"_"+i(8);}},uuid:{id:function id(t){return i(t);}},importedFile:{id:function id(t){return"importedFile_"+i(8);}},version:{id:function id(t){return"v"+i(t||15);}}};t.exports=r;},function(t,e,n){"use strict";function i(t,e){this.project={},this.children=[],t&&(this.project=t),e&&e instanceof Array&&(this.children=this.children.concat(e));}n.d(e,"a",function(){return i;}),i.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()};},i.prototype.setProject=function(t){return this.project=t,this;},i.prototype.addFile=function(t){return this.children.add(t),this;},i.prototype.addFiles=function(t){return this.children=this.children.concat(t),this;},i.prototype.getProject=function(){return this.project;},i.prototype.getFiles=function(){return this.children;},i.prototype.getCoreVersion=function(){return Brightics.VA.Env.CoreVersion;};},function(t,e,n){"use strict";function i(t){this.data=[],t&&(t instanceof Array?this.data=this.data.concat(t):this.data.push(t));}n.d(e,"a",function(){return i;}),i.prototype.toJSON=function(){return{type:"files",data:_.map(this.data,function(t){return{type:t.getResourceName(),data:t.toJSON(!0)};}),version:this.getCoreVersion()};},i.prototype.addFile=function(t){return this.data.push(t),this;},i.prototype.addFiles=function(t){return this.data=this.data.concat(t),this;},i.prototype.getFiles=function(){return this.data;},i.prototype.getCoreVersion=function(){return Brightics.VA.Env.CoreVersion;};},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29),r=n(47),o=n(20),a=n(23),s=n(24),c=n(57),u=n(58),l=n(59),p=n(1),d=n(9),f=n(0),h=n(25),g=n.n(h),v=n(61),m=n(8),y=n(64),b=n(65),A=n.n(b),x=n(66),C=n(67);window.__module__=window.__module__||{},window.brtc_require=function(t){return window.__module__[t];};var O=function O(t,e){window.__module__[t]=window.__module__[t]||{},window.__module__[t]=e;};O("DataStructures",{HashMap:o.a,ProjectTree:o.b,TreeNode:o.c}),O("Dao",{ProjectDao:r.c,FileDao:r.b,VersionDao:r.d,DatasourceDao:r.a}),O("Controls",i.a),O("ResourceManager",a.a),O("FnUnitUtils",s.a),O("FnUnitInputs",c.a),O("StatusBoard",l.a),O("KeyItems",u.a),O("Vo",{Project:d.c,File:d.a,Version:d.d,PROP_KEY:d.b}),_.forIn(d.b,function(t,e){window[e]=t;}),O("EventEmitter",p.a),O("ClassUtils",{inherits:f.a}),O("IDGenerator",g.a),O("ResourceService",v.a),O("PromiseUtils",{serial:m.b,parallel:m.a}),O("ObjectUtils",{get:y.b,updateProp:y.d,addProp:y.a,removeProp:y.c}),O("_",_),window.crel=A.a,O("crel",A.a),O("TabChannel",x.a),O("DATA_TYPES",C.DATA_TYPES);},function(t,e,n){"use strict";n.d(e,"a",function(){return u;});var i=n(10),r=n(11),o=n(12),a=n(13),s=n(3),c=n(46),u={Wrapper:{ListWrapper:i.a,JqxListWrapper:r.a,DropdownWrapper:o.a,JqxDropdownWrapper:a.a},Base:s.a,ControlFactory:c.a};},function(t,e,n){"use strict";var i,r,o,a,s,c,u,l=n(31),p=n(45),d=Function.prototype.apply,f=Function.prototype.call,h=Object.create,g=Object.defineProperty,v=Object.defineProperties,m=Object.prototype.hasOwnProperty,y={configurable:!0,enumerable:!1,writable:!0};r=function r(t,e){var _n,r;return p(e),r=this,i.call(this,t,_n=function n(){o.call(r,t,_n),d.call(e,this,arguments);}),_n.__eeOnceListener__=e,this;},s={on:i=function i(t,e){var n;return p(e),m.call(this,"__ee__")?n=this.__ee__:(n=y.value=h(null),g(this,"__ee__",y),y.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this;},once:r,off:o=function o(t,e){var n,i,r,o;if(p(e),!m.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(i=n[t]))for(o=0;r=i[o];++o){r!==e&&r.__eeOnceListener__!==e||(2===i.length?n[t]=i[o?0:1]:i.splice(o,1));}else i!==e&&i.__eeOnceListener__!==e||delete n[t];return this;},emit:a=function a(t){var e,n,i,r,o;if(m.call(this,"__ee__")&&(r=this.__ee__[t]))if("object"==typeof r){for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e){o[e-1]=arguments[e];}for(r=r.slice(),e=0;i=r[e];++e){d.call(i,this,o);}}else switch(arguments.length){case 1:f.call(r,this);break;case 2:f.call(r,this,arguments[1]);break;case 3:f.call(r,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(r,this,o);}}},c={on:l(i),once:l(r),off:l(o),emit:l(a)},u=v({},c),t.exports=e=function e(t){return null==t?h(u):v(Object(t),c);},e.methods=s;},function(t,e,n){"use strict";var i=n(32),r=n(40),o=n(41),a=n(42);(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?i(r(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?i(r(u),l):l;};},function(t,e,n){"use strict";t.exports=n(33)()?Object.assign:n(34);},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 i=n(35),r=n(39),o=Math.max;t.exports=function(t,e){var n,a,s,c=o(arguments.length,2);for(t=Object(r(t)),s=function s(i){try{t[i]=e[i];}catch(t){n||(n=t);}},a=1;a<c;++a){e=arguments[a],i(e).forEach(s);}if(void 0!==n)throw n;return t;};},function(t,e,n){"use strict";t.exports=n(36)()?Object.keys:n(37);},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 i=n(4),r=Object.keys;t.exports=function(t){return r(i(t)?Object(t):t);};},function(t,e,n){"use strict";t.exports=function(){};},function(t,e,n){"use strict";var i=n(4);t.exports=function(t){if(!i(t))throw new TypeError("Cannot use null or undefined");return t;};},function(t,e,n){"use strict";var i=n(4),r=Array.prototype.forEach,o=Object.create;t.exports=function(t){var e=o(null);return r.call(arguments,function(t){i(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(43)()?String.prototype.contains:n(44);},function(t,e,n){"use strict";var i="razdwatrzy";t.exports=function(){return"function"==typeof i.contains&&!0===i.contains("dwa")&&!1===i.contains("foo");};},function(t,e,n){"use strict";var i=String.prototype.indexOf;t.exports=function(t){return i.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.d(e,"a",function(){return o;});var i=n(11),r=n(13),o={createListControl:function createListControl(t,e){return new i.a(t,e);},createDropdownControl:function createDropdownControl(t,e){return new r.a(t,e);}};},function(t,e,n){"use strict";var i=n(14),r=n(16),o=n(18),a=n(48);n.d(e,"b",function(){return i.a;}),n.d(e,"c",function(){return r.a;}),n.d(e,"d",function(){return o.a;}),n.d(e,"a",function(){return a.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return o;});var i=n(2),r=function r(t){var e="api/admin/v2/s3/"+t;return Object(i.a)(e);},o={DB:{getDbTypes:function getDbTypes(){return Object(i.a)("api/admin/v2/datasources/dbtype");},getDatasources:function getDatasources(){return Object(i.a)("api/admin/v2/datasources");},getDatasource:function getDatasource(t){var e="api/admin/v2/datasources/"+t;return Object(i.a)(e);},addDatasource:function addDatasource(t){var e="api/admin/v2/datasources/"+t.datasourceName;return Object(i.b)(e,t);},updateDatasource:function updateDatasource(t){var e="api/admin/v2/datasources/"+t.datasourceName+"/update";return Object(i.b)(e,t);},deleteDatasource:function deleteDatasource(t){var e="api/admin/v2/datasources/"+t+"/delete";return Object(i.b)(e);}},Cloud:{getS3s:function getS3s(){return Object(i.a)("api/admin/v2/s3");},getS3:r,addS3:function addS3(t){var e="api/admin/v2/s3/"+t.datasourceName;return r(t.datasourceName).then(function(n){if(n)throw{errors:[{code:500,message:"Datasource name already exists."}]};return Object(i.b)(e,t);});},updateS3:function updateS3(t){var e="api/admin/v2/s3/"+t.datasourceName+"/update";return Object(i.b)(e,t);},deleteS3:function deleteS3(t){var e="api/admin/v2/s3/"+t+"/delete";return Object(i.b)(e);}}};},function(t,e,n){"use strict";n(0),n(2),n(8);var i=n(50);n.d(e,"a",function(){return i.a;});},function(t,e,n){"use strict";n(51),n(52);var i=n(53);n(54),n(55);n.d(e,"a",function(){return i.a;});},function(t,e,n){"use strict";},function(t,e,n){"use strict";},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var i=function i(t,e){return _.forEach(t,e);};},function(t,e,n){"use strict";},function(t,e,n){"use strict";},function(t,e,n){"use strict";function i(){this.validateVersion={3.5:this.validateVersion3_5};}n.d(e,"a",function(){return r;}),i.prototype.getValidateFunction=function(t){var e=this.validateVersion[t];return e||this.validateLegacy;},i.prototype.validate=function(t,e){return this.getValidateFunction(t.version)(t,e);},i.prototype.validateLegacy=function(t,e){var n="Invalid Model File.",i="",r=["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===r.indexOf(t[a].type)){i=n;break;}"visual"===t[a].type&&o.push(t[a]);}"Report"===e&&0===o.length?i=n:"Model"===e&&o.length>0&&(i=n);}else void 0===t.mid?i=t.jid?"Runnable Model File.":n:"Report"===e&&"visual"!==t.type||"Model"===e&&"visual"===t.type?i=n:-1===r.indexOf(t.type)&&(i=n);return i;}catch(t){return"Invalid Model(.json) File.";}},i.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 r=new i();},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var i=n(24);var r={duplicate:function duplicate(t){return'"'+t+'" is already exist';},index:function index(){return"Should be filled previous element first";},empty:function empty(){return'can not switch to "Empty"';}};function o(){}o.prototype.render=function(t){return this.empty(t),this.init(t),this.createLayout(t),this.createInputs(t),this.bindEvents(t),this;},o.prototype.init=function(t){i.a.hasMeta(t.fnUnit)?this.DATA_TYPE="object":this.DATA_TYPE="array";},o.prototype.getPrevFnUnitByTableId=function(t,e){var n=i.a.getPreviousFnUnits(t);for(var r in n){var o=n[r];if(i.a.getOutData(o).indexOf(e)>-1)return o;}},o.prototype.empty=function(t){t.appendTo.empty();},o.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);},o.prototype.createInputs=function(t){var e=this,n=i.a.getInputs(t.fnUnit);if(i.a.hasMeta(t.fnUnit))_.forEach(n,function(n,r){var o={type:i.a.getTypeByKey(t.fnUnit,r),tableId:n,key:r,fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!1};e.createInputUnit(o);});else{var r=i.a.getInRange(t.fnUnit).table.max;i.a.isFlexibleFunction(t.fnUnit)&&(r=i.a.getInTable(t.fnUnit).length);for(var o=0;o<r;o++){var a={type:"table",tableId:n[o],key:"["+o+"]"+i.a.getLabel(t.fnUnit),fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!0};e.createInputUnit(a);}}},o.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");},o.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");},o.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");},o.prototype.createInputUnit=function(t){var e=t.key,n=t.tableId,r=t.type,o=t.fnUnit,a=this.getPrevFnUnitByInTableId(o,n),s=t.readOnly,c=t.autoArrange,u=this.createBox({appendTo:t.appendTo,label:e,type:r});!t.readOnly&&_.isEqual(this.DATA_TYPE,"array")&&(this.createDragEvent(t.appendTo,u),n?this.enableDragEvent(u):this.disableDragEvent(u)),"array"!==this.DATA_TYPE||s||u.css("cursor","move"),u.attr("key",e),u.attr("type",r),u.attr("table-id",n);var l=u.find(".brtc-style-controls-inputselector-box-contents"),p=l.find(".brtc-style-controls-inputselector-box-contents-figure"),d=l.find(".brtc-style-controls-inputselector-box-contents-remove"),f=l.find(".brtc-style-controls-inputselector-box-key");t.appendTo.find(".brtc-va-editors-sheet-controls-input-list-container").append(u),l.append(h);var h=this.createEmptyItem({parent:p,type:r,label:t.emptyLabel,readOnly:s}),g=this.createFuncItem({label:i.a.getLabel(a),func:i.a.getFunc(a),type:i.a.getTypeByTableId(a,n),tableId:n}),v=i.a.getOutputsToObject(a),m=this.createKeyItem({key:v[n],type:r}),y=this.createRemoveButton({autoArrange:c});return p.append(g),f.append(m),s||d.append(y),s||this.createDropEvent(u),n?(h.hide(),g.show(),m.show(),y.show()):(h.show(),g.hide(),m.hide(),y.hide()),this.registerRemoveEvent(y),u;},o.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=i.a.getPreviousFnUnits(t);for(var r in n){var o=i.a.getOutData(n[r]);if(o&&o.indexOf(e)>-1)return n[r];}}},o.prototype.createBox=function(t){return this.createBoxWrapper(t.label,t.type);},o.prototype.createDragEvent=function(t,e){e.draggable({helper:"clone",appendTo:t,start:function start(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 stop(t,n){e.css("opacity","1");}});},o.prototype.createBoxWrapper=function(t,e){var n=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>'),i=$('<div class="brtc-style-controls-inputselector-box-title brtc-style-ellipsis"><div class="icon"></div><div class="brtc-label"></div></div>'),r=$('<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(i).append(r),r.append(o),i.find(".icon").attr("type",e),i.find(".brtc-label").text(t),n;},o.prototype.createFuncItem=function(t){var e=t.label,n=t.func,i=t.type,r=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",r),o.attr("type",i),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},o.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>'),i=$('<div class="brtc-style-ellipsis brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(i),i.text(t.key),i.attr("title",t.key),n.append(this.createTypeIcon(t.type)),e;},o.prototype.createTypeIcon=function(t){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon"></div>').attr("type",t);},o.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,i=t.type,r=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty">   <div>'+e+"</div></div>");return n.append(o),r||this.createDropEvent(o,i),o;},o.prototype.getDropFuncTarget=function(t){return t.find(".brtc-style-controls-inputselector-box-contents");},o.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(",");},o.prototype.addActivateClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-active");},o.prototype.removeActivateClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-active");},o.prototype.addHoverClass=function(t){t.find(this.getDroppableCssSelector()).addClass("brtc-style-droppable-hover");},o.prototype.removeHoverClass=function(t){t.find(this.getDroppableCssSelector()).removeClass("brtc-style-droppable-hover");},o.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 activate(t,n){e.addActivateClass($(this));},deactivate:function deactivate(t,n){e.removeActivateClass($(this)),e.removeHoverClass($(this));},over:function over(t,n){e.addHoverClass($(this));},out:function out(t,n){e.removeHoverClass($(this));},drop:function drop(t,n){var i=n.draggable,o=e.getMainArea($(this)),a=i.text(),s=e.validate(i,$(this));_.isEmpty(s)?(e.removeActivateClass($(this)),e.removeHoverClass($(this)),e.switchData(i,$(this)),e.handleChange($(this))):e.handleError(o,r[s.type](a));}});},o.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;},o.prototype.checkDuplicated=function(t,e){var n=this.getInputs(this.getMainArea(e)),i=t.closest("li").attr("table-id");for(var r in n){if(_.isEqual(n[r],i))return!0;}return!1;},o.prototype.checkIndex=function(t,e){if("object"===this.DATA_TYPE)return!1;var n=e.prev();return!(_.isEmpty(n)||!this.isEmptyBox(n));},o.prototype.checkEmpty=function(t,e){return!t.hasClass("jqx-tree-item")&&!(!this.isEmptyBox(t)&&!this.isEmptyBox(e));},o.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"),i=n.clone(),r=e.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),o=r.clone();return r.replaceWith(i),n.replaceWith(o),this.registerRemoveEvent(i.find(".brtc-va-tools-sidebar-variable-remove")),this.registerRemoveEvent(o.find(".brtc-va-tools-sidebar-variable-remove")),this.isEmptyBox(i)?this.disableDragEvent(i):this.enableDragEvent(i),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"),v=h.find(".brtc-style-controls-inputselector-box-key-wrapper"),m=h.find(".brtc-va-fnunit-input-empty"),y=h.find(".brtc-va-tools-sidebar-variable-remove");m.hide(),e.show(),v.show(),y.show(),this.registerRemoveEvent(y),g.replaceWith(p),v.replaceWith(d),this.enableDragEvent(p),this.createDropEvent(f);},o.prototype.createRemoveButton=function(t){return $('<span class="brtc-va-tools-sidebar-variable-remove"></span>');},o.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"),i=n.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=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(),r.hide(),i.hide(),o.show(),e.disableDragEvent(n),"true"===t.attr("autoArrange")&&e.autoArrange(n),e.handleRemove(t);});},o.prototype.autoArrange=function(t){var e=t.next();if(!_.isEmpty(e)&&!this.isEmptyBox(e)){var n=this.switchData(e,t);this.autoArrange(n);}},o.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");},o.prototype.handleChange=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)]);},o.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getInputs(t)]);},o.prototype.handleError=function(t,e){this.getMainArea(t).trigger("error",[e]);},o.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(i.a.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t));}),e;},o.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t;},o.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),i=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.attr("key"),o=i.is(":visible")?i.attr("table-id"):"";n[r]=o;}),n;},o.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");});},o.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 a=new o();},function(t,e,n){"use strict";function i(){}n.d(e,"a",function(){return r;}),i.prototype.create=function(t){return this.createUnit(t);},i.prototype.createUnit=function(t){var e=t.key,n=t.tableId,i=t.type,r=t.label,o=t.func,a=this.createBox(e);a.attr("key",e),a.attr("type",i),a.attr("label",r),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:r,func:o,type:i,tableId:n}),p=this.createKeyItem({key:e,type:i});this.createRemoveButton();return c.append(l),u.append(p),a;},i.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);},i.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=FnUnitUtils.getPreviousFnUnits(t);for(var i in n){var r=FnUnitUtils.getOutData(n[i]);if(r&&r.indexOf(e)>-1)return n[i];}}},i.prototype.createBox=function(t){return this.createBoxWrapper(t);},i.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>'),i=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return e.append(n),n.append(i),e;},i.prototype.createFuncItem=function(t){var e=t.label,n=t.func,i=t.type,r=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",r),o.attr("type",i),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},i.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>'),i=$('<div class="brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(i),i.text(t.key),n.append(this.createTypeIcon()),e;},i.prototype.createTypeIcon=function(){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon" type="table"></div>');},i.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,i=t.type,r=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty">   <div>'+e+"</div></div>");return n.append(o),r||this.createDropEvent(o,i),o;},i.prototype.getDropFuncTarget=function(t){return 1==t.find(".brtc-va-views-palette-fnunit").length?t.find(".brtc-va-views-palette-fnunit"):t;},i.prototype.createDropEvent=function(t){var e=this;t.droppable({accept:".key-items-draggable",activate:function activate(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-active");},deactivate:function deactivate(t,n){var i=e.getDropFuncTarget($(this));i.removeClass("brtc-style-droppable-active"),i.removeClass("brtc-style-droppable-hover");},over:function over(t,n){e.getDropFuncTarget($(this)).addClass("brtc-style-droppable-hover");},out:function out(t,n){e.getDropFuncTarget($(this)).removeClass("brtc-style-droppable-hover");},drop:function drop(t,n){var i=n.draggable,r=e.getDropFuncTarget($(this)),o=e.getMainArea($(this));r.removeClass("brtc-style-droppable-active"),r.removeClass("brtc-style-droppable-hover"),e.switchData(i,$(this));var a=e.getItems(o);o.trigger("change",[a]);}});},i.prototype.switchData=function(t,e){var n=t.closest("li").attr("key"),i=t.closest("li").attr("label"),r=t.closest("li").attr("type"),o=t.closest("li").attr("func"),a=t.closest("li").attr("table-id"),s=this.createFuncItem({label:i,func:o,type:r,tableId:a}),c=this.createKeyItem({key:n,type:r}),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);},i.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"),i=e.find(".brtc-style-controls-inputselector-box-key-wrapper"),r=e.find(".brtc-va-fnunit-input-empty");e.find(".brtc-va-tools-sidebar-variable-remove").hide(),i.hide(),n.hide(),r.show(),t.handleRemove($(this));}),e;},i.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getItems(t)]);},i.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),i=n.getPrevious(FnUnitUtils.getId(t));return _.forEach(i,function(t){e.push(n.getFnUnitById(t));}),e;},i.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t;},i.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),i=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.attr("key"),o=i.is(":visible")?i.attr("table-id"):"";n[r]=o;}),n;},i.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 r=new i();},function(t,e,n){"use strict";function i(){this.init();}n.d(e,"a",function(){return r;}),i.prototype.init=function(){this.board={};},i.prototype.add=function(t,e,n){this.board[t]={status:e,message:n};},i.prototype.remove=function(t){delete this.board[t];},i.prototype.get=function(t){return this.board[t];},i.prototype.refresh=function(){this.init();},i.prototype.show=function(t,e){this.get(t)&&e.attr("title",this.get(t).message);};var r=new i();},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var i={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"]};},function(t,e,n){"use strict";var i=n(62);n.d(e,"a",function(){return i.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return g;});var i=n(9),r=n(23),o=n(7),a=n(8),s=n(26),c=n(27),u=n(63),l=n(25),p=n.n(l),d={},f=[i.c,i.a,i.d];function h(){}_.forEach(f,function(t){d[t.prototype.getResourceName()]={_constructor:t};}),h.prototype.exportProject=function(t){var e=this;return r.a.fetchProject(t).then(function(n){return r.a.fetchFiles(t).then(function(n){return e._collectResources(n,t,!0);}).then(function(t){return e._exportProjectFromResources(n,t);});}).catch(function(t){console.error(t);});},h.prototype._collectResources=function(t,e,n){var i=this,r=_.isArray(t)?t:[t];return Promise.all(_.map(r,function(t){return n?i._getDependentResources(t,e):[t];})).then(function(t){return i._makeUnique(_.flatten(t));}).then(function(t){return i._appendMissedFiles(t,e);});},h.prototype.exportJSON=function(t,e,n){return r.a.fetchFile(e,t).then(_.bind(this._collectResources,this,_,e,n)).then(_.bind(this._exportFilesFromResources,this)).catch(console.error);},h.prototype.exportJSONs=function(t,e,n){return Promise.all(_.map(t,_.bind(this.exportJSON,this,_,e,n))).catch(console.error);},h.prototype._exportFilesFromResources=function(t,e){return new c.a(t).toJSON();},h.prototype._exportProjectFromResources=function(t,e){return new s.a(t,e).toJSON();},h.prototype._appendMissedFiles=function(t,e){return this._getMissedFile(t,e).then(function(e){return t.concat(e);});},h.prototype._traverseParamFunctions=function(t,e){var n=this;_.forEach(t,function(t){t.param.functions&&n._traverseParamFunctions(t.param.functions,e),e(t);});},h.prototype._getDependentResources=function(t,e){var n=t.getContents(),i=new o.a(),a=function a(t){return Promise.all(_.map(t.functions,function(t){if("Flow"===t[FUNCTION_NAME]){if(t.param.mid&&t.param.versionId){if(!i.has(t.param.versionId))return r.a.fetchVersion(e,t.param.mid,t.param.versionId).then(function(e){return i.set(t.param.versionId,e),s(e);}).catch(_.noop);}else if(t.param.mid&&!i.has(t.param.mid))return r.a.fetchFile(e,t.param.mid).then(function(e){return i.set(t.param.mid,e),s(e);}).catch(_.noop);}else if("loadFromStaging"===t.func&&t.param.modelId&&!i.has(t.param.model))return r.a.fetchFile(e,t.param.modelId).then(function(e){return i.set(t.param.modelId,e),s(e);}).catch(_.noop);var o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(n,t);return Promise.all(_.map(o,a));}));},s=function s(t){var e=t.getContents();return a(e);};return s(t).then(function(){return _.compact(i.toArray()).concat([t]);});},h.prototype._makeUnique=function(t){var e=new o.a();return _.forEach(t,function(t){e.set(t.getHashCode(),t);}),e.toArray();},h.prototype._getMissedFile=function(t,e){var n=new o.a();_.forEach(t,function(t){t instanceof i.a&&n.set(t.getFileId(),t);});var a=new o.a();return _.forEach(t,function(t){t instanceof i.d&&!n.has(t.getFileId())&&!a.has(t.getFileId())&&a.set(t.getFileId(),t.getFileId());}),Promise.all(_.map(a.toArray(),function(t){return r.a.fetchFile(e,t);}));},h.prototype._jsons2resource=function(t){return _.map(t,function(t){return new(0,d[t.type]._constructor)(t.data);});},h.prototype._importResources=function(t,e){this._changePrevKeys(t);var n=this._collectVersionId(t),o=this._collectModelId(t);this._remapProjectId(t,e),this._remapFileAndVersionId(t,o,n);var s=[],c=[];_.forEach(t,function(t){if(t instanceof i.c)throw new Error("unexpected data");t instanceof i.a&&s.push(function(){return r.a.addFile(e,t);}),t instanceof i.d&&(t.setIsManual(!0),c.push(function(){return r.a.addVersion(e,t.getFileId(),t);}));});var u=function u(t){return function(){return Object(a.a)(t);};};return Object(a.b)([u([]),u(s),u(c)]);},h.prototype.checkPreviousFileSpec=function(t){var e=!0;return"project"===t.type&&(e=!1),_.has(t,"version")&&(e=!1),e;},h.prototype.importJSONs=function(t,e){var n,i=this;return(n=t,Promise.all(_.map(n,function(t){return"files"!==t.type?i.checkPreviousFileSpec(t)?u.a.convertFilesSpec(t):Promise.reject(new Error("invalid export file spec")):t;}))).then(function(t){return _.map(t,function(t){return i._jsons2resource(t.data);});}).then(_.flatten).then(this._makeUnique.bind(this)).then(function(t){return i._importResources(t,e);});},h.prototype.importJSON=function(t,e){return this.importJSONs([t],e);},h.prototype._collectVersionId=function(t){var e=new o.a();return _.forEach(t,function(t){t instanceof i.d&&(e.has(t.getVersionId())||e.set(t.getVersionId(),p.a.version.id()));}),e;},h.prototype._collectModelId=function(t){var e=new o.a(),n=function n(t){e.has(t)||e.set(t,p.a.model.id());};return _.forEach(t,function(t){(t instanceof i.a||t instanceof i.d)&&(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;},h.prototype._remapProjectId=function(t,e){_.forEach(t,function(t){t instanceof i.a&&t.setProjectId(e);});},h.prototype._remapFileAndVersionId=function(t,e,n){var r=function r(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);var o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(r,t,_));});};_.forEach(t,function(t){if(t instanceof i.a||t instanceof i.d){t.setFileId(e.get(t.getFileId())),t.getContents().mid=t.getFileId(),t instanceof i.d&&(t.setVersionId(n.get(t.getVersionId())),t.getContents().version_id=t.getVersionId()),t instanceof i.a&&"visual"===t.getType()&&_.forEach(t.getContents().functions,function(t){t.param.modelId&&(t.param.modelId=e.get(t.param.modelId));});var o=t.getContents(),a=_.reduce(_.map(o.innerModels,function(t,n){var i={};return t.mid=e.get(n)||n,i[t.mid]=t,i;}),_.merge,{});o.innerModels=a,r(o,o);}});},h.prototype._changePrevKeys=function(t){var e={fidCache:{},tidCache:{}};_.forEach(t,function(t){if(t instanceof i.a||t instanceof i.d){var n=t.getContents();Brightics.VA.Core.Utils.ModelUtils.createCacheNestedFlow(n,n,e);}}),_.forEach(t,function(t){if(t instanceof i.a||t instanceof i.d){var n=t.getContents(),r=Brightics.VA.Core.Utils.ModelUtils.setKeyNestedFlow(n,n,e);t.setContents(r);}});},h.prototype.preprocessProjectJson=function(t){return"project"===t.type&&"3.5"===t.version?Promise.resolve(t):u.a.convertProjectSpec(t);},h.prototype.importProject=function(t){return this.preprocessProjectJson(t).then(function(t){var e=this,n=new i.c(t.data),o=p.a.project.id();n.setProjectId(o);var a=this._jsons2resource(t.children);return r.a.addProject(n).then(function(){return r.a.fetchProject(o);}).then(function(t){return e._importResources(a,o);}).then(function(){return o;}).catch(function(t){console.error(t);});}.bind(this));},h.prototype.validateExportedProjectSpec=function(t){try{return this.preprocessProjectJson(t);}catch(t){return Promise.reject(t);}},h.prototype.duplicateFile=function(t,e,n,i,r,o){var a=this;return this.exportJSON(t,e,i).then(function(e){var i=_.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+="_"+r,e;});}(i),a.importJSON(i,n);}).catch(function(t){console.error(t);});},h.prototype.calcTableIdLinks=function(t){var e=[],n=function n(t,i){_.forEach(i.functions,function(r){"DataViewer"===r[FUNCTION_NAME]&&_.forEach(r[OUT_DATA],function(t){e.push({source:["",Brightics.VA.Env.Session.userId,r.param.mid,r[OUT_DATA]].join("/"),alias:["",Brightics.VA.Env.Session.userId,i.mid,r[OUT_DATA]].join("/")});});var o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,r);_.forEach(o,_.partial(n,t,_));});};return _.forEach(t,function(t){if(t instanceof i.a||t instanceof i.d){var e=t.getContents();n(e,e);}}),e;};var g=new h();},function(t,e,n){"use strict";n.d(e,"a",function(){return s;});var i,r=n(9),o=n(27),a=n(26),s=(i=function i(t){var e=$.ajax({url:"api/va/v2/convert/store",type:"POST",data:JSON.stringify(t),contentType:"application/json; charset=utf-8"});return Promise.resolve(e).then(function(t){return t.contents;}).catch(function(e){throw e.responseJSON.errors[0].mid=t.mid,e;});},{convertFilesSpec:function convertFilesSpec(t){var e=_.isArray(t)?t:[t];return Promise.all(_.map(e,i)).then(function(t){return new o.a(_.map(t,function(t){return t.version_id?(e=t,(n=new r.d().setVersionId(e.version_id).setFileId(e.mid).setLabel(e.title).setTags(e.versionTags).setDescription(e.versionDescription).setType(e.type).setMajorVersion(_.has(e,"majorVersion")?e.majorVersion:e.major_version).setMinorVersion(_.has(e,"minorVersion")?e.minorVersion:e.minor_version).setCreator(Brightics.VA.Env.Session.userId).setIsManual(!0)).setContents(_.omit(e,["versionId","versionTags","versionDescription","majorVersion","minorVersion"])),n):function(t){return new r.a().setFileId(t.mid).setLabel(t.title).setDescription("").setCreator(Brightics.VA.Env.Session.userId).setContents(t);}(t);var e,n;})).toJSON();});},convertProjectSpec:function convertProjectSpec(t){var e=t[0].files,n=t[0].versions,o=new r.c(_.omit(t[0],["files","versions"])),s=function s(t){return function(e){return(n=e,i(n.contents).then(function(t){return _.assign({},n,{contents:t});})).then(t);var n;};};return Promise.all([].concat(_.map(e,s(function(t){return new r.a(t);})),_.map(n,s(function(t){return new r.d(t);})))).then(function(t){return new a.a(o,t).toJSON();});}});},function(t,e,n){"use strict";n.d(e,"b",function(){return i;}),n.d(e,"d",function(){return o;}),n.d(e,"a",function(){return a;}),n.d(e,"c",function(){return s;});var i=function i(t,e){return e instanceof Array?function(t,e){try{for(var n=-1,i=e.length,r=t;++n<i;){r=r[e[n]];}return r;}catch(t){return;}}(t,e):t[e];},r=function r(t){return _.clone(t);},o=function o(t,e,n){for(var i=t,o=-1,a=e.length;++o<a-1;){i=i[e[o]];}var s=r(i[e[e.length-1]]);return i[e[e.length-1]]=r(n),s;},a=function a(t,e,n){for(var i=t,o=-1,a=e.length;++o<a-1;){i=i[e[o]];}Array.isArray(i)?i.splice(e[e.length-1],0,n):i[e[e.length-1]]=r(n);},s=function s(t,e){for(var n=t,i=-1,o=e.length;++i<o-1;){n=n[e[i]];}var a=r(n[e[e.length-1]]);return Array.isArray(n)?n.splice(e[e.length-1],1):delete n[e[e.length-1]],a;};},function(t,e,n){var i;i=function i(){var t="function",e="object",n="textContent",i="setAttribute",r="attrMap",o="isNode",a="isElement",s=typeof document===e?document:{},c=function c(t,e){return typeof t===e;},u=typeof Node===t?function(t){return t instanceof Node;}:function(t){return t&&c(t,e)&&"nodeType"in t&&c(t.ownerDocument,e);},l=function l(t){return t instanceof Array;},p=function p(t,e){l(e)?e.map(function(e){p(t,e);}):(d[o](e)||(e=s.createTextNode(e)),t.appendChild(e));};function d(){var u,f=arguments,h=f[0],g=f[1],v=2,m=f.length,y=d[r];if(h=d[a](h)?h:s.createElement(h),1===m)return h;if((!c(g,e)||d[o](g)||l(g))&&(--v,g=null),m-v==1&&c(f[v],"string")&&void 0!==h[n])h[n]=f[v];else for(;v<m;++v){if(null!=(u=f[v]))if(l(u))for(var b=0;b<u.length;++b){p(h,u[b]);}else p(h,u);}for(var _ in g){if(y[_]){var A=y[_];typeof A===t?A(h,g[_]):h[i](A,g[_]);}else c(g[_],t)?h[_]=g[_]:h[i](_,g[_]);}return h;}return d[r]={},d[a]=function(t){return d[o](t)&&1===t.nodeType;},d[o]=u,"undefined"!=typeof Proxy&&(d.proxy=new Proxy(d,{get:function get(t,e){return!(e in d)&&(d[e]=d.bind(null,e)),d[e];}})),d;},t.exports=i();},function(t,e,n){"use strict";e.a=r;var i=n(1);function r(t){var e;this.ee=new i.a(),this.connectionKey=t,window.addEventListener("storage",(e=this.ee,function(t){var n=t.key,i=JSON.parse(t.newValue)||{};e.emit(n,i);}));}r.prototype.request=function(t,e,n){var i=this,r=(n||{}).timeout||5e3;return new Promise(function(n,o){var a=Date.now(),s="req_"+a,c=function c(e){e.connectionKey===i.connectionKey&&e.requestKey===s&&(n(e.value),i.off(t,c));};i.on(t,c),setTimeout(function(){o(new Error("TIMEOUT")),i.off(t,c);},r),i.emit(t,{timestamp:a,requestKey:"req_"+a,connectionKey:i.connectionKey,value:e,timeout:r});});},r.prototype.setConnectionKey=function(t){this.connectionKey=t;},r.prototype.getConnectionKey=function(){return this.connectionKey;},r.prototype.listen=function(t,e){var n=this;n.on(t,function(i){if(i.connectionKey===n.connectionKey){var r=Date.now();r-i.timestamp>=i.timeout||n.emit(t,_.assign({},i,{value:e(i),timestamp:r,responseKey:"res_"+r}));}});},r.prototype.on=function(t,e){this.ee.on("_TAB_CH_"+t,e);},r.prototype.off=function(t,e){this.ee.off("_TAB_CH_"+t,e);},r.prototype.emit=function(t,e){localStorage.setItem("_TAB_CH_"+t,JSON.stringify(e));};},function(t,e,n){"use strict";}]),function(){"use strict";var t=window.__module__;this.Brightics=this.Brightics||{};var e=this.Brightics,n=brtc_require("FnUnitUtils");$.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="3.5",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 getList(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 addProblems(t){t&&this.problemList.indexOf(t)<0&&(this.problemList=this.problemList.concat(t));},getProblemsByFid:function getProblemsByFid(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 getProblemsByMid(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 newFnUnit(t){var i=e.VA.Core.Utils.WidgetUtils.getFunctionLibrary(this.type,t),r={fid:e.VA.Core.Utils.IDGenerator.func.id()};if("ifElse"===t)r={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();r={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?r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"dbReader"===t?r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"load"===t?r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"Subflow"===i.defaultFnUnit[FUNCTION_NAME]?r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"if"===t?r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{if:$.extend(!0,i.defaultFnUnit.param.if,{mid:e.VA.Core.Utils.IDGenerator.model.id()}),elseif:[],else:$.extend(!0,i.defaultFnUnit.param.else,{mid:e.VA.Core.Utils.IDGenerator.model.id()})}}:"forLoop"===t?r={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&&(r={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"while",prop:{expression:"${=}","index-variable":""}}});if(i.defaultFnUnit.outputs||i.defaultFnUnit.outData){var c=n.createOutData(this.type,t);$.extend(r,c),"refine"===t?(r.param.functions[0][OUT_DATA]=r[OUT_DATA],r.param.entries=[r.param.functions[0].fid]):"dbReader"===t?(r.param.functions[0][OUT_DATA]=r[OUT_DATA],r.param.functions[0].param={"df-names":[r[OUT_DATA][0]]}):"load"===t?(r.param.functions[0][OUT_DATA]=r[OUT_DATA],r.param.functions[0].param={"df-names":[r[OUT_DATA][0]]},r.param.entries=[r.param.functions[0].fid]):"Subflow"===i.defaultFnUnit[FUNCTION_NAME]&&(r.param.functions[0][OUT_DATA]=r[OUT_DATA],r.param.entries=[r.param.functions[0].fid]);}return $.extend(!0,{"persist-mode":"auto"},i.defaultFnUnit,r);},addFnUnit:function addFnUnit(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 removeFnUnit(t){var e=-1;for(var n in this.functions){var i=this.functions[n];if(i.fid==t){e=n,delete i.parent;break;}}if(e>-1){var r=this.functions[e];return this.functions.splice(e,1),r;}},getFnUnitById:function getFnUnitById(t){for(var e in this.functions){var n=this.functions[e];if(n.fid==t)return n;}},getFnUnitNameById:function getFnUnitNameById(t,e){e=e||this.functions;for(var n in e){var i=e[n];if(i.param&&i.param.functions){var r=this.getFnUnitNameById(t,i.param.functions);if(r)return i.func+"."+r;}if(i.fid==t)return i.func;}},existsFnUnit:function existsFnUnit(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 i in n.param.functions){if(n.param.functions[i].fid==t)return n;}}},getFnUnitByOutTable:function getFnUnitByOutTable(t){for(var e in this.functions){var i=this.functions[e],r=n.getOutTable(i);if($.inArray(t,r)>-1)return i;}},getFnUnitByOutData:function getFnUnitByOutData(t){for(var e in this.functions){var i=this.functions[e],r=n.getOutData(i);if($.inArray(t,r)>-1)return i;}},getLinkUnitById:function getLinkUnitById(t){for(var e in this.links){var n=this.links[e];if(n.kid==t)return n;}},getRoots:function getRoots(t){var e=[],n=this.getPrevious(t);if(0==n.length)e.push(t);else for(var i in n){e=e.concat(this.getRoots(n[i]));}return e;},getParents:function getParents(t){var e=[];for(var n in this.links){var i=this.links[n];i[TARGET_FID]==t&&(e.push(i[SOURCE_FID]),e=e.concat(this.getParents(i[SOURCE_FID])));}return e;},getPrevious:function getPrevious(t){var e=[];for(var n in this.links){var i=this.links[n];i[TARGET_FID]==t&&e.push(i[SOURCE_FID]);}return e;},getPreFnUnitByCondition:function getPreFnUnitByCondition(t,e){var n=this.getPrevious(t);for(var i in n){var r=this.getFnUnitById(n[i]);if(e(r))return r;}},getNext:function getNext(t){var e=[];for(var n in this.links){var i=this.links[n];i[SOURCE_FID]==t&&e.push(i[TARGET_FID]);}return e;},getLeafs:function getLeafs(){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 getConnectedLinkUnits(t){var e=[];for(var n in this.links){var i=this.links[n];i[SOURCE_FID]!=t&&i[TARGET_FID]!=t||e.push(i);}return e;},getParamValue:function getParamValue(t,e){return this.getFnUnitById(t).param[e];},adjustLinks:function adjustLinks(){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 i=this.links[t];(e.indexOf(i[SOURCE_FID]||i["source-fid"])<0||e.indexOf(i[TARGET_FID]||i["target-fid"])<0)&&n.push(i);}for(t in n){this.links.splice(this.links.indexOf(n[t]),1);}},getAllPreviousFnUnitIds:function getAllPreviousFnUnitIds(t){var n=this.getPrevious(t),i=this;return _.unique(n.reduce(function(t,n){var r=i.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var o=i.getAllPreviousFnUnitIds(n);return t.concat(o);}return t.concat(n);},[]));},getAllNextFnUnitIds:function getAllNextFnUnitIds(t){var n=this.getNext(t),i=this;return _.unique(n.reduce(function(t,n){var r=i.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var o=i.getAllNextFnUnitIds(n);return t.concat(o);}return t.concat(n);},[]));},getAllPreviousFnUnits:function getAllPreviousFnUnits(t){var e=this;return this.getAllPreviousFnUnitIds(t).map(function(t){return e.getFnUnitById(t);});},getAllNextFnUnits:function getAllNextFnUnits(t){var e=this;return this.getAllNextFnUnitIds(t).map(function(t){return e.getFnUnitById(t);});},getLinkSourceFnUnits:function getLinkSourceFnUnits(t){var n=this,i=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var r=this.getPrevious(t);return _.unique(r.reduce(function(t,e){return t.concat(n.getLinkSourceFnUnits(e));},[i]),"fid");}return[i];},getLinkTargetFnUnits:function getLinkTargetFnUnits(t){var n=this,i=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var r=this.getNext(t);return _.unique(r.reduce(function(t,e){return t.concat(n.getLinkTargetFnUnits(e));},[i]),"fid");}return[i];}},this.Brightics.VA.Default.analyticsModel={type:"data",sheets:[],param:{},functions:[],links:[],preferences:{},problemList:[],report:{title:"Report",data:[]},inVariableList:function inVariableList(t){return _.findIndex(this.variableRef,function(e){return e.fid===t;});},getVariable:function getVariable(t,e){var n=this.inVariableList(t);if(n>-1)return this.variableRef[n].param[e];},getVariables:function getVariables(t){var e=this.inVariableList(t);if(e>-1)return this.variableRef[e].param;},getParameters:function getParameters(){return this.param;},getParameter:function getParameter(t){return this.param[t];},setParameter:function setParameter(t,e){this.param[t]=e;},addVariableDef:function addVariableDef(t,e){this.variables[t]=$.extend({},e);},removeVariableDef:function removeVariableDef(t){delete this.variables[t];},setVariableDef:function setVariableDef(t,e){this.variables[t]&&(this.variables[t]=$.extend({},e));},addVariable:function addVariable(t,e,n){var i=this.inVariableList(t);if(i>-1)this.variableRef[i].param[e]=n;else{var r={fid:t,param:{}};r.param[e]=n,this.variableRef.push(r);}},setVariable:function setVariable(t,e,n){var i=this.inVariableList(t);i>-1&&this.variableRef[i].param[e]&&(this.variableRef[i].param[e]=n);},removeVariable:function removeVariable(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 setCookie(t,e,n){var i="";if(n){var r=new Date();r.setTime(r.getTime()+24*n*60*60*1e3),i="expires="+r.toUTCString();}document.cookie=t+"="+e+"; "+i;},getCookie:function getCookie(t){for(var e=t+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var r=n[i];" "==r.charAt(0);){r=r.substring(1);}if(0==r.indexOf(e))return r.substring(e.length,r.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 addCache(t,e,n){var i=t+"_"+e;this.schemaCache[i]=n;},removeCache:function removeCache(t,e){if(e){var n=t+"_"+e;delete this.cache[n],delete this.schemaCache[n];}else{var i=[];for(var r in this.cache){0==r.indexOf(t+"_")&&i.push(r);}for(var o in i){delete this.cache[i[o]];}for(var r in i=[],this.schemaCache){0==r.indexOf(t+"_")&&i.push(r);}for(var o in i){delete this.schemaCache[i[o]];}}},isCached:function isCached(t,e){var n=t+"_"+e;return this.cache[n];},clearCache:function clearCache(){this.cache={},this.schemaCache={};},queryTable:function queryTable(t,e,n,i,r,o){var a=t+"_"+e;o=o||{};!0!==r&&this.cache[a]?n(this.cache[a],e):o.publish?(o.destination="publish",this.queryData(t,e,o.offset||0,o.limit||1e3,n,i,o)):this.queryData(t,e,o.offset||0,o.limit||1e3,n,i,o);},queryTableForReport:function queryTableForReport(t,e,n,i,r){var o=t+"_"+e;!0!==r&&this.cache[o]?n(this.cache[o],e):this.queryData(t,e,0,1e3,n,i,"/report");},fetchMore:function fetchMore(t,e,n,i,r){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,i,r);},queryData:function queryData(e,n,i,r,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="+i+"&limit="+r;$.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 getSchemaAsync(e,n,i,r,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),i(t.columns);}).fail(function(t){return a.removeCache(e,n),r([],n,t);});},getSchema:function getSchema(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].columns:void 0;},querySchema:function querySchema(t,e,n,i,r){this.queryTable(t,e,n,i,r);},getSchemaFromData:function getSchemaFromData(t,e){return console.warn("This method is deprecated"),this.getData(t,e);},getData:function getData(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].data:void 0;},getTable:function getTable(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 getListByTags(t){var e=[];for(var n in this){var i=!1,r=this[n].tags;if(r)$.grep(r,function(e){var n=!1;for(var i in t){e.toLowerCase().indexOf(t[i].toLowerCase())>-1&&(n=!0);}return n;}).length>0&&(i=!0,e.push(n));if(!i&&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 getFunction(t){return $.extend(!0,{},this[t]);},extendFunctions:function extendFunctions(t){for(var e={},n={},i=0;i<t.length;i++){n[t[i]]=this[t[i]],$.extend(!0,e,n);}return e;},addFunction:function addFunction(t,e){this[t]=e;},getFunctionViewer:function getFunctionViewer(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;var 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 i(t){this.options=t||{};}i.prototype.initFnUnit=function(){var i=this.options.chartOptions.chart.type,r=n[i],o=t.VA.Core.Functions.Library.getFunction(r).defaultFnUnit;o||(o=$.extend(!0,{},e)),o.fid=t.VA.Core.Utils.IDGenerator.func.id(),this.fnUnit=o;},i.prototype.inputParams=function(){},i.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));}},i.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;},i.prototype.generate=function(){return this.initFnUnit(),this.inputParams(),$.extend(!0,{},this.fnUnit);},t.VA.Core.Utils.FnUnitGenerator=i;}.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 getUserBrowserName(){return window.chrome&&window.chrome.webstore?"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 downloadJsonFile(t,e){var n=this.getUserBrowserName(),i=new Blob([t],{type:"text/json;charset=utf-8;"});if("Internet Explorer"===n)window.navigator.msSaveBlob(i,e+".json");else{var r=URL.createObjectURL(i),o=document.createElement("a");o.setAttribute("href",r),o.setAttribute("download",e+".json"),o.click(),URL.revokeObjectURL(r);}},numberToStringWithComma:function numberToStringWithComma(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");},getTimeDifferenceFromNow:function getTimeDifferenceFromNow(t){var e=new Date(t);return(new Date().getTime()-e.getTime())/36e5;},transferTimestampToDateString:function transferTimestampToDateString(t){var e=function e(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 convertDataTypeForText(t,e){if(void 0===t)return"-";if(-1!==t.indexOf("[")){var n,i=e.replace("[]","");switch(i){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=i;}return"Array("+n+")";}return"map"===t?"Map":e;},convertDataTypeForTitle:function convertDataTypeForTitle(t,e){return void 0===t?"Undefined Type":-1!==t.indexOf("[")?"Array("+e.replace("[]","")+")":e;},getTypes:function getTypes(){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 fetchFromObject(e,n){if(void 0!==e&&void 0!==n)try{var i=e.indexOf("."),r=e.slice(0,i).indexOf(t.USER_INPT_ARR_DELIMETER);if(r>-1){var o=[],a=n[e.substring(0,r)];if(a)for(var s=0;s<a.length;s++){e.indexOf(".")>-1&&o.push(this.fetchFromObject(e.substr(r+4),a[s]));}return o.length>0?o:a;}return i>-1?this.fetchFromObject(e.substr(i+1),n[e.substring(0,i)]):n[e];}catch(t){console.error(e),console.error(t);}},isPC:function isPC(){var t=!0;return["win16","win32","win64","macintel","mac"].indexOf(navigator.platform.toLowerCase())<0&&(t=!1),t;},byteCalculation:function byteCalculation(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 getQueryString(t){return _.map(t,function(t,e){return e+"="+t;}).join("&");},getObjByJsonPath:function getObjByJsonPath(t,e){var n=$.extend(!0,{},t);return Array.isArray(e)?e.reduce(function(t,e,n,i){return t=t&&t[e]?t[e]:void 0;},n):n[e];},removeArrayElement:function removeArrayElement(t,e){_.remove(t,function(t){return e.indexOf(t)>-1;});},dim:function dim(t,n){var i=$((n||{}).appendTo||document.body),r=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 i.append(o),r.then(function(t){return o.remove(),t;}).catch(function(t){throw o.remove(),t;});},progress:function progress(t,e){var n=e||{},i=e.showPercent||!1,r=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>'+r+"</p>"+(i?'<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 run(t,e,n,i,r,o,a){var s="/"+t+"/"+e+"/"+n;this.runStartWithExport(i,s,r,o,a);},runStartWithExport:function runStartWithExport(t,e,n,i,r){this.export(t,e,n,i,r);},doDownload:function doDownload(t,e,n,i,r,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 i&&i();}).fail(r);},progress:function progress(e,n,i){var r={fail:function fail(t){return this.failCallback=t,this;},done:function done(t){return this.doneCallback=t,this;}},o=function o(){var e={url:"api/va/v2/analytics/jobs/"+n,type:"GET",blocking:!1};$.extend(!0,e,i),$.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 i=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,i),r.failCallback&&r.failCallback(n);}catch(t){r.failCallback&&r.failCallback(n);}}else"SUCCESS"===e.status?r.doneCallback&&r.doneCallback():setTimeout(o,3e3);}).fail(function(t){r.failCallback&&r.failCallback(t);});};return setTimeout(o,3e3),r;},unload:function unload(t,e,n,i,r,o){var a=this,s={fail:function fail(t){return this.failCallback=t,this;},done:function done(t){return this.doneCallback=t,this;}},c="va_"+Date.now();r?(r.delimiter||(r.delimiter=","),r["array-delimiter"]||(r["array-delimiter"]=";"),r["key-value-delimiter"]||(r["key-value-delimiter"]=":"),r["quote-delimiter"]||(r["quote-delimiter"]='"')):r={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":[i],delimiter:r.delimiter,"array-delimiter":r["array-delimiter"],"key-value-delimiter":r["key-value-delimiter"],quote:r["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 _export(e,n,i,r,o,a){e=e;var s=i.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 i=document.createElement("a");i.setAttribute("href",encodeURI("api/va/v2/data/download/files/?key="+encodeURIComponent(c)+"&delimiter="+encodeURIComponent(s)+"&filename="+encodeURIComponent(e))),i.setAttribute("download",e),i.setAttribute("id","downloadfile"),i.setAttribute("target","_blank"),$(i)[0].click(),setTimeout(function(){$("#downloadfile").remove();},1e4);}r();}).fail(function(t){o(t);});},download:function download(t,e,n){var i={remotePath:t,localFileName:e},r={url:"api/va/v2/data/download",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(i)};return $.extend(!0,r,n),$.ajax(r).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 exportProject(e,n,i){!function(e,n,i){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;}),i=_.map(n,function(n){return t.VA.Core.Utils.ModelUtils.createModelTree(e.id,n.contents);});return Promise.all(i).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){i(t);});}(e,n,i);}};}.call(this),function(){"use strict";this.Brightics.VA.Core.Utils.FileDao={getFile:function getFile(t,e,n,i){return function(t,e,n){return new Promise(function(i,r){$.ajax(t).done(function(t){e&&"function"==typeof e&&(t&&t.length?e(t[0]):e(t||null)),t&&t.length?i(t[0]):i(t||null);}).fail(function(t){n&&"function"==typeof n&&n(t),r(t);});});}({url:"api/va/v2/ws/projects/"+t+"/files/"+e,type:"GET",contentType:"application/json; charset=utf-8"},n,i);}};}.call(this),function(){"use strict";var t;this.Brightics.VA.Core.Utils.FileVersionDao=(t=function t(_t,e,n){return new Promise(function(i,r){$.ajax(_t).done(function(t){e&&"function"==typeof e&&e(t),i(t);}).fail(function(t){n&&"function"==typeof n&&n(t),r(t);});});},{getFileVersions:function getFileVersions(e,n,i,r){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions",type:"GET",contentType:"application/json; charset=utf-8"},i,r);},getFileVersion:function getFileVersion(e,n,i,r,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+i,type:"GET",contentType:"application/json; charset=utf-8"},r,o);},addFileVersion:function addFileVersion(e,n,i,r,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(i)};return t(a,r,o);},addFileVersionSync:function addFileVersionSync(e,n,i,r,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(i)};return t(a,r,o);},deleteFileVersion:function deleteFileVersion(e,n,i,r,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+i+"/delete",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1},r,o);},updateFileVersion:function updateFileVersion(e,n,i,r,o,a){var s={url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+i+"/update",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1,data:JSON.stringify(r)};return t(s,o,a);},loadFileVersion:function loadFileVersion(e,n,i,r,o){return t({url:"api/va/v2/ws/projects/"+e+"/files/"+n+"/versions/"+i+"/load",type:"POST",contentType:"application/json; charset=utf-8",blocking:!1},r,o);}});}.call(this),function(){"use strict";var t=this.Brightics;var 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 getFnUnit(e){var n=e.chart.type,i={chartOptions:e};return(t.VA.Core.Utils.FnUnitGenerator[n]?new t.VA.Core.Utils.FnUnitGenerator[n](i):new t.VA.Core.Utils.FnUnitGenerator(i)).generate();},convertToChartSource:function convertToChartSource(t,e){var n=e;if("bigDataBoxPlot"===t)for(var i in n.data){n.data[i][1].box=n.data[i][1].box.split(",").map(function(t){return parseFloat(t);});var r=n.data[i][1].outliers;r=""!=r?r.split(",").map(function(t){return parseFloat(t);}):[];}return n.dataType="chartdata",n;},getRenderedData:function getRenderedData(i,r,o,a,s,c){var u=this,l={dataType:"rawdata",columns:[],data:[]},p=function p(t){return t&&"function"==typeof t?t:function(){};},d=p(a),f=p(s),h=p(c),g=function g(t){return{offset:0,limit:t,user:o.user,publish:o.publish};},v=o.mid||i.parent().mid,m=i[IN_DATA];"dummy"===i.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));}(v,m):t.VA.Core.DataQueryTemplate.queryTable(v,m,function(a,s){a.count>=0&&a.count<e?(a.dataType="rawdata",d(a,s)):new Promise(function(e,r){try{if(!o.publish)return r();t.VA.Core.DataQueryTemplate.queryTable(v,n(o.contentUnit.content,i[IN_DATA][0]),function(t,n){return e([t,n]);},function(t,e,n){return r(n);},!0,g(1e5));}catch(t){return r(t);}}).then(function(t){var e=t[0],n=t[1],r=u.convertToChartSource(i.func,e);d(r,n);}).catch(function(){var e={success:function success(e){var n=i[OUT_DATA];t.VA.Core.DataQueryTemplate.queryTable(v,n,function(t,e){var n=u.convertToChartSource(i.func,t);d(n,e);},function(t,e,n){f(t,e,n);},!0,g(1e5)),h(e.result);},fail:function fail(t){f(l,s,t);},catch:function _catch(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),f(l,s,e);}};r.launchUnit(i,{},o,e);});},function(t,e,n){f(t,e,n);},!0,g(e));},getBigDataTargetTid:n,isBigData:function isBigData(n){var i=n,r=i.modelId,o=i.tableId,a=i.user,s=i.isPublish,c=function c(t,e){if(void 0===e)throw new Error(t+" is required");};return c("modelId",r),c("tableId",o),c("user",a),c("isPublish",s),new Promise(function(n,i){t.VA.Core.DataQueryTemplate.queryTable(r,o,function(t,i){return n(t.count>=e);},function(t,e,n){return i(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 i in t){if(e(t[i].param.functions,n),"dataFlow"===t[i].func){var r=t[i].param.mid;t[i].param.mid=n[r]||"DeletedDataFlow";}}}this.Brightics.VA.Core.Utils.ImportUtils={importProject:function importProject(n,i,r,o,a){if(r.length){var s=t.VA.Core.Utils.IDGenerator.project.id(),c=r[0];!function(e,n,i,r,o){var a=new t.VA.Vo.Project();a.setProjectId(e),a.setLabel(n||"untitled"),a.setDescription(i||""),a.setCreator(t.VA.Env.Session.userId),ResourceManager.addProject(a).then(function(){r();}).catch(function(t){o(t);});}(s,n,i,function(){c.versions=c.versions||[];var n=function(e,n){var i={},r=function r(e){_.forEach(e,function(e){e.param.functions&&r(e.param.functions),e.param.mid&&(i[e.param.mid]=i[e.param.mid]||t.VA.Core.Utils.IDGenerator.model.id());});};e&&_.forEach(e,function(e){i[e.id]=i[e.id]||t.VA.Core.Utils.IDGenerator.model.id(),r(e.contents.functions);});n&&_.forEach(n,function(e){i[e.file_id]=i[e.file_id]||t.VA.Core.Utils.IDGenerator.model.id(),r(e.contents.functions);});return i;}(c.files,c.versions);!function(t,n,i){t&&_.forEach(t,function(t){"control"===t.type&&e(t.contents.functions,i);var n=t.id;t.id=i[n],t.contents.mid=i[n];});n&&_.forEach(n,function(t){"control"===t.type&&e(t.contents.functions,i);var n=t.file_id;t.file_id=i[n],t.contents.mid=i[n];});}(c.files,c.versions,n),function(e,n){var i={};e&&_.forEach(e,function(t){i[t.id]=i[t.id]||{version:{}},i[t.id].main=t.contents;});n&&_.forEach(n,function(t){i[t.file_id]=i[t.file_id]||{version:{}},i[t.file_id].version[t.version_id]=t.contents;});var r=t.VA.Core.Utils.ModelUtils.cloneModelsByTree(i);e&&_.forEach(e,function(t){t.contents=r[t.id].main;});n&&_.forEach(n,function(t){t.contents=r[t.file_id].version[t.version_id];});}(c.files,c.versions),function(e,n){var i={};return Promise.all(_.map(n,function(n){var r=new t.VA.Vo.Version(n);return r.setIsManual(!0),t.VA.Dao.VersionDao.addVersion(e,r.getFileId(),r).then(function(t){i[r.getVersionId()]=t.getVersionId();});})).then(function(){return i;});}(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,i,r){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(){i&&"function"==typeof i&&i(e);},function(t){r&&"function"==typeof r&&r(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 isDefaultKeyCode(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 isNotInsertKeyCode(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 type1(t){return new RegExp("^[a-zA-Z0-9_]+$").test(t);},type2:function type2(t){return new RegExp("^[a-zA-Z0-9_\\s]+$").test(t);},type3:function type3(t){return new RegExp("^[a-zA-Z0-9_{}\\$]+$").test(t);},type4:function type4(t){return new RegExp("^[a-zA-Z0-9_\\.]+$").test(t);},type5:function type5(t){return new RegExp("^[0-9_]").test(t);},type6:function type6(t){return new RegExp("^[a-zA-Z ]+$").test(t);},columnNameType:function columnNameType(t){return!new RegExp("^[0-9]+").test(t);},integerType:function integerType(t){return new RegExp("^[0-9]+$").test(t);},startWithSpace:function startWithSpace(t){return new RegExp("^\\s").test(t);},endWithSpace:function endWithSpace(t){return new RegExp("\\s$").test(t);},cronType:function cronType(t){return new RegExp("^[A-Z0-9-?*/,# ]+$").test(t);},rangeType:function rangeType(t){return new RegExp("^[0-9_.-~]+$").test(t);},featureEncodingRangeType:function featureEncodingRangeType(t){return new RegExp("^[0-9_.~]+$").test(t);},fileNameType:function fileNameType(t){return new RegExp("^[a-zA-Z0-9_./@]+$").test(t);},renamefileType:function renamefileType(t){return new RegExp("^[a-zA-Z0-9_.]+$").test(t);}},replaceKoreanToEmpty:function replaceKoreanToEmpty(t){return t.replace(/[ㄱ-ㅎㅏ-ㅣ가-힣]/g,"");},appendValidationCondition:function appendValidationCondition(t){var e=this;if(t.attr("valid-type")){var n=t.attr("valid-type");t.on("paste",function(i){var r=(i.originalEvent.clipboardData||window.clipboardData).getData("Text");if(!e.isValid[n](r)){i.preventDefault();Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"※ This pasted string is NOT allowed."});}}),t.keydown(function(i){if(!e.isDefaultKeyCode(i)){var r,o={Spacebar:" ",Up:"ArrowUp",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight"}[(r=i).key]||r.key;if(e.isValid[n](o)||"Process"!==o){if(!e.isValid[n](o)){i.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 initMessage(){var t=this;$.ajax({url:"api/va/v2/studio/message/en",type:"GET",blocking:!1}).done(function(e){var n={};for(var i in e){n[e[i].code]={message:e[i].message};}t.Message=n;});},initFunctionLabel:function initFunctionLabel(){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 i=e[n];t.FunctionLabel[i.functionName]=t.FunctionLabel[i.functionName]||{},t.FunctionLabel[i.functionName][i.parameter]=i.label;}});},getFunctionLabels:function getFunctionLabels(t,e){var n=[];for(var i in e){this.FunctionLabel[t]&&this.FunctionLabel[t][e[i]]?n.push(this.FunctionLabel[t][e[i]]):"inData"===e[i]?n.push("In Table"):n.push(e[i]);}return n;},getFunctionLabel:function getFunctionLabel(t,e){return this.FunctionLabel[t]&&this.FunctionLabel[t][e]?this.FunctionLabel[t][e]:e;},getMessage:function getMessage(t,e){if(!this.Message||!this.Message[t])return"Please contact administrator! Error: "+t;var n=this.Message[t].message;for(var i in e){n=n.replace("%s",e[i]);}return n;},getReplacedParam:function getReplacedParam(t,e){if("evaluateRankingAlgorithm"==t){return["Precision","NDCG","K-Values"];}},getFunctionLabelAll:function getFunctionLabelAll(){return this.FunctionLabel;}};}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dao,n=brtc_require("ResourceManager"),i=brtc_require("FnUnitUtils");function r(t){var e={fidCache:{},outputCache:{}};for(var n in t){var i=t[n];$.extend(!0,e,o(i));}return e;}function o(e){var n={fidCache:{},outputCache:{}},i=n.fidCache,o=n.outputCache;for(var a in i[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,r(e.param.functions)),n;}function a(e,n,r){var o=r.fidCache,a=r.tidCache,s=function s(){return t.VA.Core.Utils.IDGenerator.table.id();},c=function c(t,e,n){t[e]=t[e]||n;},u=function u(e){c(o,e.fid,t.VA.Core.Utils.IDGenerator.func.id()),_.forEach(i.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 l(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 i=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,n);_.forEach(i,l);});};return l(n),r;}function s(e,n,i){var r=i.fidCache,o=i.tidCache,a=function a(n){for(var s in l(n,o),p(n,o),n.functions){var c=n.functions[s];c.fid=r[c.fid],l(c,o),p(c,o),d(c,o),f(c,r),v(c,o,r),b(c,o),"deeplearning"===n.type&&m(c,r),c.param&&c.param.functions&&a(c.param,i);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,y(t,o));}),n.report=A(n.report,r)),h(n,r);};return a(n),g(e,r),e;}function c(e,n){_.forEach(e,function(e){!function(e,n){var i=n.fidCache,r=n.outputCache;e.fid.startsWith("d")?i[e.fid]=i[e.fid]||t.VA.Core.Utils.IDGenerator.dataSource.id():i[e.fid]=i[e.fid]||t.VA.Core.Utils.IDGenerator.func.id();_.forEach(e.outData,function(e){r[e]=r[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,i=e.outputCache;for(var r in t.functions){var o=t.functions[r];o.fid=n[o.fid],(o=b(o=v(o=f(o=d(o=p(o=l(o,i),i),i),n),i,n),i)).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]=y(t.report.data[a],i);}t.report=A(t.report,n);}return t=g(t=h(t,n),n);}function l(t,e){return _.forEach(e,function(e,n){i.changeData(t,n,e);}),t;}function p(t,e){return _.forEach(e,function(e,n){i.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 i in e.links){var r=e.links[i],o=t.VA.Core.Utils.IDGenerator.link.id();r.kid=o,r[SOURCE_FID]=n[r[SOURCE_FID]],r[TARGET_FID]=n[r[TARGET_FID]];}return e;}function g(t,e){for(var n in t.variableRef){var i=t.variableRef[n].fid;t.variableRef[n].fid=e[i];}return t;}function v(e,n,i){if("outData"===e.func&&"Subflow"===e[FUNCTION_NAME])for(var r in e.param.functions){if("exportData"===e.param.functions[r].func){var o="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();e.param["fs-paths"]=[o],e.param.functions[r]&&(e.param.functions[r].param["input-path"]=o,e.param.functions[r].param["output-path"]=o+".csv");}}return"DataViewer"===e[FUNCTION_NAME]&&(e.param.fid=i[e.param.fid]),e;}function m(t,e){var n=["train_data","validation_data"];if(!t.param)return t;for(var i=0;i<n.length;i++){t.param[n[i]]&&e[t.param[n[i]]]&&(t.param[n[i]]=e[t.param[n[i]]]);}return t;}function y(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 i=Object.keys(t.pages[n].contents);for(var r in i){t.pages[n].contents[i[r]].dataSourceId=e[t.pages[n].contents[i[r]].dataSourceId];}}return t;}this.Brightics.VA.Core.Utils.ModelUtils={extendParent:function extendParent(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 extendMainFunc(e,n){n.getMainModel=function(){return e;},n.isMainModel=function(){return this===this.getMainModel();};var i=t.VA.Core.Utils.NestedFlowUtils.getChildModels(e,n);_.forEach(i,_.partial(this.extendMainFunc.bind(this),e,_));},extendModel:function extendModel(e,n){var i,r=this,o=t.VA.Core.Interface.DefaultModel[e.type];if(o){for(var a in i=n?$.extend(!0,{},o,e):$.extend(!0,e,o),_.forIn(i.innerModels,function(t){r.extendInnerModel(i,t);}),(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(i,i),i;}console.error("Create DefaultModel("+e.type+")!");},extendInnerModel:function extendInnerModel(e,n,i){var r,o=t.VA.Implementation.DataFlow.innerModel;if(o){for(var a in r=i?$.extend(!0,{},o,n):$.extend(!0,n,o),(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(e,r),r;}console.error("Create DefaultModel("+n.type+")!");},exportAsRunnablePromise:function exportAsRunnablePromise(e,i,r){var o=n.getFile(void 0,e.mid).getProjectId();return t.VA.Core.Utils.NestedFlowUtils.makeRunnable(o,i);},exportAsRunnable:function exportAsRunnable(t,e){var n=this,i=this.extendModel(t,!0);for(var r in delete i.FUNC_ID_CHAR,delete i.FUNC_ID_LENGTH,delete i.preferences,delete i.problemList,delete i.sheets,void 0!==e&&e||delete i.report,i.entries=[],i.functions){var o=i.functions[r],a=o.display.label||"";if(o.label=a,delete o.display,o.parent().getPrevious(o.fid).length<1&&i.entries.push(o.fid),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 i.innerModels&&(i.innerModels=_.reduce(_.map(i.innerModels,function(t,e){var i={};return i[e]=n.exportAsRunnable(t),i;}),_.merge,{})),i;},previousFnUnitList:function previousFnUnitList(t,e,n){var i=t.getPrevious(e);for(var r in i){-1==n.indexOf(i[r])&&n.push(i[r]),this.previousFnUnitList(t,i[r],n);}},previousLinks:function previousLinks(t,e,n){for(var i in t.links){var r=t.links[i];r[TARGET_FID]==e&&(n.push(r),this.previousLinks(t,r[SOURCE_FID],n));}},exportAsRunnableForRealTime:function exportAsRunnableForRealTime(t,e,n){var i=this.extendModel(t,!0),r=[];r.push(e.fid),this.previousFnUnitList(i,e.fid,r);var o=[];for(var a in i.functions){for(var s in r){r[s]===i.functions[a].fid&&o.push(i.functions[a]);}}var c=[];for(var u in this.previousLinks(i,e.fid,c),i.functions=o,i.links=c,delete i.FUNC_ID_CHAR,delete i.FUNC_ID_LENGTH,delete i.preferences,delete i.problemList,delete i.sheets,delete i.title,void 0!==n&&n||delete i.report,i.entries=[],i.functions){if(delete(e=i.functions[u]).display,e.parent().getPrevious(e.fid).length<1&&i.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 i;},getModelIds:function t(e,n,i){if("object"!=typeof e)return i;for(var r in e){e.hasOwnProperty(r)&&(r===n&&i.push(e[r]),t(e[r],n,i));}return i;},getModelIdsWithVersion:function t(e,n,i){if("object"!=typeof e)return i;for(var r in e){if(e.hasOwnProperty(r)){if(r===n){var o={};o[r]=e[r],e.hasOwnProperty("version_id")&&(o.version_id=e.version_id),i.push(o);}t(e[r],n,i);}}return i;},exportAsRunnableFileByTree:function exportAsRunnableFileByTree(t,e,n){return this.createModelTree(t,e).then(function(t){return this._exportAsRunnableFileByTree(e,t,n);}.bind(this));},_exportAsRunnableFileByTree:function _exportAsRunnableFileByTree(t,e,n){var i=this.exportAsRunnable(t),r={user:"input_user_id",jid:"input_job_id",main:i.mid,args:n,models:{}};if(r.models[i.mid]=i,"control"===i.type){var o=this.getModelIdsWithVersion(i.functions,"mid",[]);_.forEach(o,function(t){var n=t.version_id?t.mid+"_"+t.version_id:t.mid,i=t.version_id?e[t.mid].version[t.version_id]:e[t.mid].main;r.models[n]=this.exportAsRunnable(i.contents);}.bind(this));}else for(var a in i.gv){var s=i.gv[a];for(var c in s.param){n&&!n[s.param[c]]&&delete s.param[c];}Object.keys(s.param).length<1&&i.gv.splice(a,1);}return r;},createModelTree:function createModelTree(t,e){var n={};return Promise.all(this._createModelTree(t,e,n)).then(function(){return n;});},_createModelTree:function _createModelTree(t,e,i){var r=e.functions,o=function o(t,e,i){return i?n.fetchVersion(t,e,i):n.fetchFile(t,e);},a=function a(t,e,n){return i[e]=i[e]||{version:{}},n?i[e].version[n]=t:i[e].main=t,!0;},s=[];return _.forEach(r,function(e){e.param.functions&&s.push(this._createModelTree(t,e.param.functions,i)),"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 flattenModelTree(t,e){var n=[],i=function i(t,e){return t.getMajorVersion()!==e.getMajorVersion()?e.getMajorVersion()-t.getMajorVersoin():e.getMinorVersion()-t.getMinorVersion();};return _.forOwn(t,function(t){var e=[],r=!1;_.forOwn(t.version,function(t){e.push(t),r=!0;}),e.sort(i),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;}),r?e.push(_.omit(e[0],["version_id","versionTags","versionDescription","majorVersion","minorVersion"])):e.push(t.main.contents),n.push(e);}),_.flatten(n);},getModelArrayByTree:function getModelArrayByTree(e,n,i){var r=t.VA.Core.Utils.ModelUtils.flattenModelTree(e,i);return r.push(n.getContents()),r;},exportAsRunnableFile:function exportAsRunnableFile(e,n,i,r,o){var a=this.exportAsRunnable(e,r),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 i in n){n[i].id==e&&(c.models[e]=u.exportAsRunnable(n[i].contents,r));}c.models[e]&&(r&&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 r&&s.data.length>0&&(c.reports[a.mid]=s),a.gv){var d=a.gv[p];for(var f in d.param){i&&!i[d.param[f]]&&delete d.param[f];}Object.keys(d.param).length<1&&a.gv.splice(p,1);}return c;},fileArrayToModelTree:function fileArrayToModelTree(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 importModels(i,r,o,a){var s={},c={},u={},l=this.cloneModelsByTree(this.fileArrayToModelTree(r));_.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 p(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 r=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"]);r.setContents(o),f.push(e.VersionDao.addVersion(i,r.getFileId(),r).then(function(t){return d[n.version_id]=t.getVersionId(),t;}));});}),Promise.all(f).then(function(){var e=[];return _.forOwn(l,function(r){_.forEach(r.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[r.main.mid]).setProjectId(i).setLabel(u[r.main.mid]).setDescription("").setCreator(t.VA.Env.Session.userId).setContents(r.main);e.push(n.addFile(i,o));}),Promise.all(e).then(function(t){return _.map(t,function(t){return n.fetchVersions(i,t.getFileId());});});});},makeEntries:function makeEntries(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 isControlFunction(t,e){return"data"===(e?e.type:t.parent().type)&&["If","ForLoop","WhileLoop"].indexOf(t[FUNCTION_NAME])>-1;},isEmptyExpression:function isEmptyExpression(t){var e=t||"";return!_.trim(e.substring(3,e.length-1));},deleteEmptyExpression:function deleteEmptyExpression(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;},deleteEmptyArray:function deleteEmptyArray(e,n){if(e.param)for(var i in e.param){if(this.isControlFunction(e,n))this.deleteEmptyExpression(e,n);else if("functions"==i)for(var r in e.param.functions){this.deleteEmptyArray(e.param.functions[r],n||e.parent());}else if(["boolean","number"].some(function(t){return t===typeof e.param[i];})||e.param[i]){var o=e.param[i];if(o.constructor==Array){if(o.length>1)continue;if(o[0]){if(o[0].constructor==Array){if(o[0].length>1)continue;o[0][0]||delete e.param[i];}else o[0]||delete e.param[i];}else if(!o[0]){var a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(i,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[i];}}}else{a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(i,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[i];}}},deleteDisplay:function deleteDisplay(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 i in n){this.deleteDisplay(n[i]);}}},getKeyMapFromModelTree:function getKeyMapFromModelTree(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 cloneModelsByTree(e){var n=this.getKeyMapFromModelTree(e),i={},r=function r(e,n,i){var r=$.extend(!0,{},e);return i&&r.mid&&(r.mid=t.VA.Core.Utils.IDGenerator.model.id()),r=u(r,n);};return _.forOwn(e,function(t,e){i[e]={},t.main&&(i[e].main=r(t.main,n)),t.version&&(i[e].version={},_.forOwn(t.version,function(t,o){i[e].version[o]=r(t,n);}));}),i;},cloneModel:function cloneModel(e){if("data"===e.type)return function(e){var n=_.cloneDeep(e),i={},r=function r(e){i[e]=i[e]||t.VA.Core.Utils.IDGenerator.model.id();},o=function o(t){return i[t];},c=function c(e){_.forEach(e.functions,function(e){"If"===e[FUNCTION_NAME]&&(r(e.param.if.mid),_.forEach(e.param.elseif,function(t){r(t.mid);}),r(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||r(e.param.mid);var i=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(i,c);});};_.forEach(n.innerModels,function(t,e){r(e);});var u=function u(e){_.forEach(e.functions,function(e){var i=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(i,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,r(n.functions));},cloneFnUnit:function cloneFnUnit(t){var e=o(t),n=$.extend(!0,{},t),i=e.fidCache,r=e.outputCache;return n.fid=i[n.fid],n[IN_DATA]&&(n[IN_DATA]=[]),"unload"===n.func&&(n.param["df-names"]=[]),(n=p(n,r)).param=u(n.param,e),n;},carvePersist:function carvePersist(e,n){var i,r=t.VA.SettingStorage.DEFAULT_SETTINGS["common.persist.mode"];i=t.VA.Core.Functions.Library[e.func]?t.VA.Core.Functions.Library[e.func].defaultFnUnit.persist:r;var o=e.parent()["persist-mode"];"user-mode"===r&&("true"===e["persist-mode"]?e.persist=!0:"false"===e["persist-mode"]?e.persist=!1:e.persist="true"===o||"false"!==o),"performance-mode"===r&&(e.persist=void 0!==i&&i),"storage-mode"===r&&(e.persist=void 0===i||i),"Subflow"===e[FUNCTION_NAME]&&e.param.functions.length>0&&(e.param.functions[e.param.functions.length-1].persist=!0);},generateVersionText:function generateVersionText(t){return t.major_version+"."+t.minor_version;},openDocumentationPopup:function openDocumentationPopup(){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 openFunctionReferencePopup(e,n,i){var r,o;if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var a=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===a&&(a=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),a=_.trimRight(a,"/");try{var s=[a,(navigator.language||navigator.userLanguage).toLowerCase(),"ai","v"+(t.VA.Env.CoreVersion||"3.0"),"function_reference",n].join("/");r=window.open(s);}catch(t){r=window.open(a);}}else o="api/va/v2/help/function",n&&(o=o+"/"+n),o=o+"?type="+e+(i?"&context="+i:""),r=window.open(o,"Brightics Help");r.blur();},createCachePersist:function createCachePersist(t,e){return c(t,e);},setKeys:function setKeys(t,e){return u(t,e);},createFileContents:function createFileContents(e,n,i,r){var o=$.extend(!0,{},e);o.mid=n,i&&(o.title=i),r&&(o.description=r);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 v="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();p.param["fs-paths"]=[v],l.param.functions[parseInt(b)+1]&&(l.param.functions[parseInt(b)+1].param["input-path"]=v,l.param.functions[parseInt(b)+1].param["output-path"]=v+".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 y=m[a].contents;for(var b in y){y[b].dataSourceId&&h[y[b].dataSourceId]&&(y[b].dataSourceId=h[y[b].dataSourceId]);}}}return o;},initDefaultModelContents:function initDefaultModelContents(){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 getDefaultModelContents(){return this.defaultModelContents;},createCacheNestedFlow:a,setKeyNestedFlow:s};}.call(this),function(t,e){"use strict";var n=t.Brightics,i=brtc_require("Dao"),r=["df-names"],o=function o(t,n){var i=e.filter(t.links,function(t){return t[SOURCE_FID]===n;});return e.map(i,function(t){return t[TARGET_FID];});},a=function a(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 s(t,n){var i=[],r=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){i.push(r.getInnerModel(t));});}else"forLoop"!==t.func&&"whileLoop"!==t.func||i.push(r.getInnerModel(t.param.mid));}),e.filter(i,e.negate(e.isUndefined));},c=function c(t,n){var i=s(t,n);return e.flatten(i.concat(e.map(i,e.partial(c,t))));},u=function u(t,e){return t+"_"+e;},l=function l(t,n,r){var o={},a={},c=function c(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 d(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?r||(n=u(o,s),a[n]||(a[n]=!0,c.push(i.VersionDao.getVersion(t,o,s).then(l)))):o&&(a[n=o]||(a[n]=!0,c.push(i.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 p(t,n){var i=[];return function(t,n,i){var r=a(n);e.forEach(r,function(e){var n=t.getInnerModel(e);i(n);});}(t,n,function(t){i.push(t);}),i;},d=function d(t,n){var i=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(i,e.negate(e.isUndefined));},f=function f(t,e,i){var o=!1,a={fnUnit:e,ref:{param:{}}},s=Object.keys(e.param);for(var c in s){var u=s[c];r.indexOf(u)>-1&&(o=!0,a.ref.param[u]=i);}if(o)return new n.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(t,a);},h=function h(t,i,r){var o={},a=function a(i,c){o[c]={adj:[],version:i instanceof n.VA.Vo.File?"Current":"v"+i.getVersion()},r&&(o[c].model=i.getContents());var u,l,p,d=(u=i.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,i.mid),i.mid),o;},g=function g(t,n){var i={},r=h(t,n),o=function o(t){i[t]=-1;var n=e.any(r[t].adj,function(t){return!(i[t]||!o(t))||-1===i[t];});return i[t]=1,n;};return o(n.mid);};n.VA.Core.Utils.NestedFlowUtils={getParentModel:function getParentModel(t,n){if(e.has(n,"innerModels"))return n;var i=function i(e){for(var r=s(t,e),o=0;o<r.length;o++){if(r[o].mid===n.mid)return e;var a=i(r[o]);if(a)return a;}};return i(t);},getAdjacencyLists:function getAdjacencyLists(t,n){var i={};return e.forEach(n,function(e){i[e]=o(t,e);}),i;},getAdjacencyList:o,getConnectedFnUnits:function getConnectedFnUnits(t,n){for(var i=function(t,e){var n=function n(i){for(var r=i.functions,o=0;o<r.length;o++){if(r[o].fid===e)return i;}for(var a=s(t,i),c=0;c<a.length;c++){var u=n(a[c]);if(u)return u;}};return n(t);}(t,n.fid),r=o(i,n.fid),a=[],c=i.functions,u=0;u<c.length;u++){e.indexOf(r,c[u].fid)>-1&&a.push(c[u]);}return a;},getSubModels:d,createAdjustOutTableCommand:function createAdjustOutTableCommand(t,i,r,o){for(var a=[],s=r[OUT_DATA].length;s<o;){a.push(new n.VA.Core.Editors.Diagram.Commands.AddOperationCommand(t,{target:r,path:[OUT_DATA,s],value:n.VA.Core.Utils.IDGenerator.table.id()})),s++;}for(var c=function c(t){return function(e){return t!==e;};};s>o;){s--,a.push(new n.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(t,{target:r,path:[OUT_DATA,s]}));for(var u=r[OUT_DATA][s],l=n.VA.Core.Utils.NestedFlowUtils.getConnectedFnUnits(i,r),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 calcNextFnUnitOutTableSize(t,e,n,i){for(var r=d(t,e),o=0,a=0;a<r.length;a++){o=parseInt(Math.max(o,(r[a][OUT_DATA]?r[a][OUT_DATA].length:0)+(n===r[a].mid?i:0)));}return o;},getChildFlows:l,getChildModels:s,makeRunnable:function makeRunnable(t,i){return l(t,i).then(function(t){var r=e.indexBy(c(i,i),"mid"),o=e.cloneDeep(i),a=e.cloneDeep(t);return o.innerModels=r,(a=e.reduce(e.map(a,function(t,e){var i={};return i[e]=n.VA.Core.Utils.ModelUtils.exportAsRunnable(t),i;}),e.merge,{}))[o.mid]=o,{main:o.mid,models:a,version:n.VA.Env.CoreVersion};}).catch(console.error);},getAllSubModelsFromModel:c,getAllSubModelsFromFnUnit:function getAllSubModelsFromFnUnit(t,n){var i=d(t,n);return e.flatten(i.concat(e.map(i,e.partial(c,t))));},getNewActivityCommandOptions:function getNewActivityCommandOptions(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 getFnUnitByCondition(t,n){var i=function i(t){return e.reduce(t.functions,function(t,e){return t||(n(e)?e:i(d(e)));},e.noop());};return i(t);},isProcessFunction:function isProcessFunction(t){return["SetValue","ImportData","ExportData"].indexOf(t[FUNCTION_NAME])>=0;},checkCycle:g,getLocalOutline:function getLocalOutline(t,n,i){var r=function r(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===i};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 i="Else If";return 0===n&&(i="If"),n===a.length-1&&(i="Else"),r(t.getInnerModel(e.mid),i);});}else"ForLoop"!==n[FUNCTION_NAME]&&"WhileLoop"!==n[FUNCTION_NAME]||(o.items=[r(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 r(t,t.title);},getGlobalOutline:function getGlobalOutline(t,e){if(g(t,e))throw new Error("This model contains cycle.");var n=h(t,e,!0),i=function i(t){return{id:t.model.mid,label:t.model.title+" ["+t.version+"]",items:t.adj.map(function(t){return i(n[t]);})};};return i(n[e.mid]);}};}(this,_),function(){"use strict";var t=this.Brightics;t.OptModelManager={isValidOptModel:function isValidOptModel(t){var e=this.isValidObjective(t),n=this.isValidOptFunctions(t);return e&&n;},isValidObjective:function isValidObjective(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 isValidOptFunctions(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 i in t.optFunctions[n].optParam){"true"===t.optFunctions[n].optParam[i].optParamSelected&&(e=!0);}}return e;},renderOptModels:function renderOptModels(e){var n=Studio.getEditorContainer().getActiveModelEditor();if(e||(e=n.diagramEditorPage),e){var i=e.$mainControl.find(".brtc-va-editors-diagram-diagrameditorpage-paper");i.find(".brtc-opt-model-box").remove();var r=n.getEditorInput().getContents().optModels;if(r&&Object.keys(r).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 r){var d,f,h,g,v=r[p].label||"Optimization",m=r[p].optFunctions,y=-1;for(c=0;c<m.length;c++){if(o[m[c].fid]){y=c;break;}}if(-1!=y){d=h=o[m[y].fid].y,f=g=o[m[y].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,C=(t.VA.Env.Diagram.FIGURE_HEIGHT+h-d)*a+7,O=this.isValidOptModel(r[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 "+O+";' +\n                        \"></div>");i.append(I),I.css({top:_,left:A,width:x,height:C});var U=$("\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 "+O+";\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>");U.attr("opt-id",p),U.find(".brtc-opt-model-label").attr("title",v),U.find(".brtc-opt-model-label").text(v),I.append(U),U.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 getOptModels(t,e){var n=Studio.getResourceManager().getFile(t,e).getContents();if(n.optModels){var i=n.optModels;return Object.values(i).sort(function(t,e){return t.createTime<e.createTime?-1:t.createTime>e.createTime?1:0;});}return[];},getOptModel:function getOptModel(t,e,n){var i=Studio.getResourceManager().getFile(t,e).getContents();if(i.optModels&&i.optModels[n]){var r=i.optModels;return $.extend(!0,{},r[n]);}},getTargetOptModelId:function getTargetOptModelId(t,e,n){var i=Studio.getResourceManager().getFile(t,e).getContents();if(i.optModels){var r=i.optModels;for(var o in r){if(r[o].optFunctions)for(var a=r[o].optFunctions,s=0;s<a.length;s++){if(a[s].fid===n)return o;}}}return null;},createNewOptModelCommand:function createNewOptModelCommand(e,n,i,r){for(var o=Studio.getResourceManager().getFile(e,n).getContents(),a=[],s=[],c={},u=0;u<i.length;u++){var l=i[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,r);return new t.VA.Core.Editors.Diagram.Commands.NewOptModelCommand(this,{pid:e,mid:n,optModel:g});},createSetOptModelCommand:function createSetOptModelCommand(e,n,i,r,o){return new t.VA.Core.Editors.Diagram.Commands.SetOptModelCommand(this,{pid:e,mid:n,optId:i,optModel:r,target:o});},createRemoveOptModelCommand:function createRemoveOptModelCommand(e,n,i){return new t.VA.Core.Editors.Diagram.Commands.RemoveOptModelCommand(this,{pid:e,mid:n,optId:i});},newOptModel:function newOptModel(e,n,i){var r=$.extend(!0,[],e);i=i||{};for(var o=t.VA.Core.Utils.IDGenerator.model.id(),a=[],s=0;s<r.length;s++){a.push(r[s].fid);var c=r[s].name;delete r[s].display,delete r[s].func,delete r[s].name,delete r[s].inData,delete r[s].outData,delete r[s].param,delete r[s]["persist-mode"];var u=t.OptFunctions[c];u?(r[s].optSelected=u.optSelected,r[s].optParam=$.extend(!0,{},u.optParam)):(r[s].optSelected="none",r[s].optParam={});}var l;return{optId:o,hash:a.sort().join("_"),label:i.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:r};},addOptModel:function addOptModel(t,e,n){var i=Studio.getResourceManager().getFile(t,e).getContents();i.optModels||(i.optModels={}),i.optModels[n.optId]=$.extend(!0,{},n);},setOptModel:function setOptModel(t,e,n,i){var r=Studio.getResourceManager().getFile(t,e).getContents();if(r.optModels&&r.optModels[n]){var o=r.optModels[n];for(var a in i){i[a].constructor==Array?o[a]=$.extend(!0,[],i[a]):i[a].constructor==Object?o[a]=$.extend(!0,{},i[a]):o[a]=i[a];}}},removeOptModel:function removeOptModel(t,e,n){var i=Studio.getResourceManager().getFile(t,e).getContents();if(i.optModels&&i.optModels[n]){var r=i.optModels[n];return delete i.optModels[n],r;}},buildOptRunnable:function buildOptRunnable(t){var e=function e(t,_e){var n=!0;if("true"!==t.options.activated&&(n=!1),n)for(var i=t.optFunctions,r=0;r<i.length;r++){if(!_e[i[r].fid]){n=!1;break;}}return n;},n=function n(t){for(var e={},n=0;n<t.functions.length;n++){e[t.functions[n].fid]=t.functions[n];}return e;},i=function i(t){var i={},o=n(t),a=t.optModels;for(var s in a){if(a.hasOwnProperty(s)){var c=a[s];e(c,o)&&(i[c.optId]=$.extend(!0,{},c));}}return r(i,o,t.links);},r=function r(t,e,n){for(var i in t){if(t.hasOwnProperty(i)){var r=t[i];o(r),a(r,e),s(r,n),delete r.optFunctions;}}return t;},o=function o(t){t.optSelected={};for(var e=t.optFunctions,n=0;n<e.length;n++){var i=e[n].fid;if("true"===e[n].optSelected)for(var r in t.optSelected[i]={optParam:{}},e[n].optParam){var o=e[n].optParam[r];"true"===o.optParamSelected&&(t.optSelected[i].optParam[r]=$.extend(!0,{},o),delete t.optSelected[i].optParam[r].optParamSelected);}}},a=function a(t,e){t.functions=[];for(var n=t.optFunctions,i=0;i<n.length;i++){var r=n[i].fid;t.functions.push($.extend(!0,{},e[r]));}},s=function s(t,e){t.links=[];for(var n=0;n<e.length;n++){var i=e[n].sourceFid,r=e[n].targetFid;t.hash.indexOf(i)>-1&&t.hash.indexOf(r)>-1&&t.links.push($.extend(!0,{},e[n]));}},c=function c(t,e){var n=[];for(var i in e){n.push({fid:e[i].optId,label:e[i].label,name:"Opt",param:{mid:e[i].optId}});}for(var r=0;r<n.length;r++){t.functions.push(n[r]);}},u=function u(t,e){var i=$.extend(!0,[],t.links),r=t.links,o=n(t),a={},s={},c={};for(var u in e){for(var l=e[u],p=0;p<i.length;p++){var d=i[p].sourceFid,f=i[p].targetFid;c[f]=!1,!(l.hash.indexOf(d)>-1)&&l.hash.indexOf(f)>-1&&(a[i[p].kid]=!0,s[d+"_"+u]||(s[d+"_"+u]=!0,r.push({sourceFid:d,targetFid:u})),r.push({sourceFid:u,targetFid:f}));}for(var h in o){!1!==c[h]&&l.hash.indexOf(h)>-1&&r.push({sourceFid:u,targetFid:h});}}for(p=r.length-1;p>=0;p--){a[r[p].kid]&&r.splice(p,1);}},l=$.extend(!0,{},t),p=l.models;for(var d in p){if(p.hasOwnProperty(d)){var f=p[d],h=i(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 check(t,e){var n=this;_.map(e,function(e){n.validate(e)||n[e](t);});},validate:function validate(t){return!(this[t]&&!this.hasPermission(t));},hasPermission:function hasPermission(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 data_upload_shared(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 showQuickModeling(){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 md(e,n){var i=$('<div class="brtc-va-md-content"></div>');return e.append(i),i.html(t.render(n)),i;},html:function html(t,e){var n=$('<div class="brtc-va-html-content"></div>');return t.append(n),n.append(e),n;},image:function image(t,e){var n=$('<div class="brtc-va-image-content"></div>'),i=$("<img></img>");return t.append(n),n.append(i),i.attr("src",e),n;},chart:function chart(t,e){t.bcharts(e);}};}.call(this),function(){"use strict";var t=this.Brightics;this.Brightics.VA.Core.Utils.RunnableFactory={_create:function _create(e,n){return{main:"",models:{},version:t.VA.Env.CoreVersion};},createForUnit:function createForUnit(e,n,i,r,o){var a=e.parent().type||"data",s=t.VA.Core.Interface.RunnableFactory[a];if(s)return s.createForUnit(e,n,i,r,o);},createForFlow:function createForFlow(e,n,i,r,o){var a=e.type,s=t.VA.Core.Interface.RunnableFactory[a];if(s)return s.createForFlow(e,n,i,r,o);},createForDummy:function createForDummy(e,n,i,r,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 wrap(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")&&(t=t.substring(3,t.length-1)),"${="+t+"}";},strip:function strip(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")?t.substring(3,t.length-1):t;}};}(this),function(){"use strict";var t=function t(_t2){return _.isNull(_t2)||_.isUndefined(_t2)||""===_t2?"":_.isNumber(_t2)?_.isNaN(_t2)||_.isUndefined(_t2)?"":_t2.toString():_t2;},e=function e(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 convertValueByType(t,e,n){},toString:t,toNumber:function toNumber(e){return _.isNull(e)||_.isUndefined(e)||""===e?0:Number(t(Number(e)));},strip:e,wrap:function wrap(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 retrieveWidget(t){return"string"==typeof t?$(t):t;},putWorkspaceRef:function putWorkspaceRef(t,e){this.putData(t,"brtc-va-workspace-body-area-ref",e);},getWorkspaceRef:function getWorkspaceRef(t){var e=t.closest(".brtc-va-workspace-body-area");return this.getData(e,"brtc-va-workspace-body-area-ref");},putStudioRef:function putStudioRef(t,e){this.putData(t,"brtc-studio-ref",e);},getStudioRef:function getStudioRef(t){var e=$(".brtc-va-studio");return this.getData(e,"brtc-studio-ref");},putUdfRef:function putUdfRef(t,e){this.removeUdfRefData(t),this.putData(t,"brtc-udf-ref",e);},getUdfRef:function getUdfRef(t){return this.getData(t,"brtc-udf-ref");},putModelEditorRef:function putModelEditorRef(t,e){this.putEditorRef(t,e);},getModelEditorRef:function getModelEditorRef(t){return this.getEditorRef(t,"brtc-va-editors-modeleditor");},closestModelEditor:function closestModelEditor(t){return this.closestEditor(t,"brtc-va-editors-modeleditor");},putEditorRef:function putEditorRef(t,e){this.putData(t,"brtc-va-editor-ref",e);},getEditorRef:function getEditorRef(t,e){var n=e||"brtc-va-editor",i=this.closestEditor(t,n);return this.getData(i,"brtc-va-editor-ref");},closestEditor:function closestEditor(t,e){return t.closest("."+e);},putData:function putData(t,e,n){t.data(e,n);},getData:function getData(t,e){return t.data(e);},removeUdfRefData:function removeUdfRefData(t){t.removeData("brtc-udf-ref");},isRightClick:function isRightClick(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 getRightClick(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 createPaletteItem(t,e,n){var i,r,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);i=u.label,r=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),i=l,r="brtc-va-fnunit-category-"+p;}return a.attr("title",i),"udf"!==p&&a.attr("context",d).attr("category",p),a.find(".brtc-va-views-palette-fnunit-label").text(i),s&&(i+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),a.attr("title",i),s&&a.addClass("deprecated"),a.addClass(r),t.append(o),this.putData(a,"func",e),a;},createPaletteUDFItem:function createPaletteUDFItem(t,e,n,i){var r,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);r=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),r=p,o="brtc-va-fnunit-category-"+d;}return s.attr("title",r),"udf"!==d&&s.attr("context",f),s.find(".brtc-va-views-palette-fnunit-label").text(r),c&&(r+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),s.attr("title",r),s.find(".brtc-va-views-palette-fnunit-remove-icon").on("click",function(){var e={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:i,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,e);}),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 createPaletteBox(t){var e,n=$('<div class="brtc-va-views-palette-fnunit-content">'),i=$('<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(i);var r=Brightics.VA.Core.Interface.WidgetUtils.data;if(r&&r.createPaletteItem){e=r.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 i.attr("title",t.label),i.find(".brtc-va-views-palette-fnunit-icon").attr("context",a||"scala"),i.find(".brtc-va-views-palette-fnunit-label").text(t.label),i.addClass(e),this.putData(i,"func",t.func),i;},createTableItem:function createTableItem(t,e){var n=$('<div class="brtc-va-views-table-content">'),i=$('<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(i),i.attr("title",e.label),i.find(".brtc-style-views-table-label").text(e.label),t.append(n),i;},createKeyItem:function createKeyItem(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 createDialogContentsArea(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 openConfirmDialog(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!0,contentText:t,close:e});},openConfirmWithOptionDialog:function openConfirmWithOptionDialog(t,e,n,i){this.createCommonConfirmWithOptionDialog($("body"),{title:t,type:"info",isCancel:!0,contentText:e,optionText:n,close:i});},checkAgentStatus:function checkAgentStatus(){return $.ajax({url:"api/va/v2/analytics/agentuser/status",blocking:!1,type:"GET"});},createProgressDialog:function createProgressDialog(t,e){var n,i={OK:!1,Cancel:!0},r=$('<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(r),r.find(".brtc-va-dialogs-body-content-content-text").css("display","none"),r.find(".brtc-va-dialogs-body-content-icon").css("display","none"),(n=r.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 open(){n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){i={OK:!0,Cancel:!1},r.dialog("close");});},close:function close(){r.dialog("destroy"),r.remove(),"function"==typeof e.close&&e.close(i);},focus:function focus(){},keyboardCloseKey:""};return r.dialog(o),r.attr("name",o.title),r;},getBadRequestErrorMessage:function getBadRequestErrorMessage(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 openBadRequestErrorDialog(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 i=this,r=this.createProgressDialog($("body"),{title:"Preparing workspace...",close:e}),o=0,a=function a(){var t=function t(){r.find(".brtc-va-progress").css("display","none"),r.find(".brtc-va-dialogs-body-content-content-text").css("display","block"),r.find(".brtc-va-dialogs-body-content-icon").css("display","block"),r.find(".brtc-va-dialogs-buttonbar-ok").css("display","block");};o++,i.checkAgentStatus().done(function(e){"STOP"===e?o>30?(clearTimeout(i.timer),t()):(clearTimeout(i.timer),i.timer=setTimeout(a,2e3)):(clearTimeout(i.timer),t());}).fail(function(e){clearTimeout(i.timer),t();});};clearTimeout(i.timer),i.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 openErrorDialog(t,e){var n,i,r;"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&&(i=t.errors[0].detailMessage),t.errors[0].contentType&&(r=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:i,detailContentType:r});},500);},openInformationDialog:function openInformationDialog(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!1,contentText:t,close:e});},openQuestionDialog:function openQuestionDialog(t,e){this.createCommonConfirmDialog($("body"),{type:"info",okLabel:"Yes",cancelLabel:"No",isCancel:!0,contentText:t,close:e});},openWarningDialog:function openWarningDialog(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 createCommonConfirmDialog(t,e){var n,i,r,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&&(i=$('<input type="button" class="brtc-va-dialogs-buttonbar-cancel" value="Cancel" />'),a.find(".brtc-va-dialogs-buttonbar").append(i),e.cancelLabel&&i.val(e.cancelLabel)),e.detailText&&(r=$('<input type="button" class="brtc-va-dialogs-buttonbar-detail" value="Detail" />'),a.find(".brtc-va-dialogs-buttonbar").append(r));var s=this,c={theme:Brightics.VA.Env.Theme,width:400,height:210,modal:!0,resizable:!1,cancelButton:i,open:function open(){$(".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&&(i.jqxButton({theme:Brightics.VA.Env.Theme}),i.click(function(){o={OK:!1,Cancel:!0},a.dialog("close");})),e.detailText&&(r.jqxButton({theme:Brightics.VA.Env.Theme}),r.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 close(){a.dialog("destroy"),a.remove(),"function"==typeof e.close&&e.close(o);},focus:function focus(){a.focus();}};return a.dialog(c),a.find(".brtc-va-dialogs-main").css("padding-left","5px"),a.attr("name",c.title),a;},createCommonConfirmWithOptionDialog:function createCommonConfirmWithOptionDialog(t,e){new Brightics.VA.Core.Dialogs.ConfirmWithOptionDialog(t,e);},codeToMessage:function codeToMessage(t){var e;if(t&&Array.isArray(t.errors)){var n="";for(var i in t.errors){(e=t.errors[i].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 convertHTMLSpecialChar(t){return t?t=(t=(t=(t=(t=t.replace(/&/g,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")).replace(/\s/g,"&nbsp;"):t;},adjustCodeMirrorEsc:function adjustCodeMirrorEsc(t){t.on("endCompletion",function(t){window.event instanceof KeyboardEvent&&"keydown"==window.event.type&&"Escape"==window.event.key&&window.event.stopPropagation();});},setValidatorToCodeMirror:function setValidatorToCodeMirror(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 changeCodeMirrorLineToSingle(t,e){var n=this.setValidatorToCodeMirror(e);t.on("beforeChange",function(t,i){var r=i.text.join("").replace(/\n/g,"");i.update(i.from,i.to,[r]);var o="+input"==i.origin&&"object"==typeof i.text&&""==i.text.join(" "),a="setValue"===i.origin||"+delete"===i.origin?void 0:i.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()),i.cancel();if("paste"==i.origin&&"object"==typeof i.text&&i.text.length>1){var u=i.text.join(" ");return i.update(null,null,[u]);}return null;}),t.setSize("100%","27px");},setCodeMirrorMaxLength:function setCodeMirrorMaxLength(t){t.on("beforeChange",function(t,e){var n=t.getOption("maxLength");if(n&&e.update){var i=e.text.join("\n"),r=i.length-(t.indexFromPos(e.to)-t.indexFromPos(e.from));if(r<=0)return $(t.getTextArea()).trigger("hideOverflow"),!0;(r=t.getValue().length+r-n)>0&&($(t.getTextArea()).trigger("showOverflow"),i=i.substr(0,i.length-r),e.update(e.from,e.to,i.split("\n")));}return!0;});},createUDFItem:function createUDFItem(t,e,n,i,r){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(){r();}),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:i,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,e);}),c.addClass(a),t.append(s),this.putData(c,"udf",e),c;},getFunctionLibrary:function getFunctionLibrary(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 createPrivatePolicy(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 updateGridSource(t,e){var n=new $.jqx.dataAdapter(e);t.jqxGrid("source",n),t.jqxGrid("clearfilters"),t.jqxGrid("clearselection"),this.updatePageButton(t);},updatePageButton:function updatePageButton(t){var e=t.jqxGrid("getpaginginformation"),n=t.find(".jqx-grid-pager div[type=button][title=first]"),i=t.find(".jqx-grid-pager div[type=button][title=previous]"),r=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}),i.css("opacity",".3").jqxButton({disabled:!0})):(n.css("opacity","1").jqxButton({disabled:!1}),i.css("opacity","1").jqxButton({disabled:!1})),0===e.pagescount||e.pagenum===e.pagescount-1?(r.css("opacity",".3").jqxButton({disabled:!0}),o.css("opacity",".3").jqxButton({disabled:!0})):(r.css("opacity","1").jqxButton({disabled:!1}),o.css("opacity","1").jqxButton({disabled:!1}));},debounce:function debounce(t,e){return _.debounce(t,e,{maxWait:e});},setTrimInputControlOnFocusout:function setTrimInputControlOnFocusout(t){t.focusout(function(e){var n=t.val(),i=Brightics.VA.Core.Utils.InputValidator.isValid;(i.startWithSpace(n)||i.endWithSpace(n))&&(t.val(n.trim()),Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"This input value is trimmed.",position:"bottom"}));});},convertInequalitySign:function convertInequalitySign(t){return t?t=(t=t.replace(/<=/g,"≤")).replace(/>=/g,"≥"):t;},destroyJqxControl:function destroyJqxControl(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;var e="status",n="success",i="abort",r="fail",o="catch",a="ready",s="pending";function c(t){this.eventTypes=[e,n,i,r,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],i=this.listeners[e];n&&($.isArray(n)?n.forEach(function(t){"function"==typeof t&&i.push(t);}):"function"==typeof n&&i.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(r,t,e);},c.prototype._fireAbort=function(t,e){this._fire(i,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 n(){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,e=brtc_require("FnUnitUtils");function n(){this.jobScheduler={};}n.prototype._generateJobId=function(t){return"va_"+t+"_"+moment(Date.now()).format("YYYYMMDDHHmmssSSS");},n.prototype.launchUnit=function(t,e,n,i){console.error("must implement Function launchUnit");},n.prototype.launchModel=function(t,e,n,i){console.error("must implement Function launchModel");},n.prototype._launch=function(t,e,n,i){console.error("must implement Function _launch");},n.prototype._extendListeners=function(t,e){var n=t;for(var i in e){var r=e[i];r&&($.isArray(r)?r.forEach(function(t){n[i]||(n[i]=[]),n[i].push(t);}):"function"==typeof r&&(n[i]||(n[i]=[]),n[i].push(r)));}},n.prototype.terminate=function(t){var e=this.jobScheduler[t];e&&(e.stop(),delete this.jobScheduler[t]);},n.prototype._getPendingMessage=function(t){return t.pendingStatus||"Pending";},n.prototype._getProcessingMessage=function(e){var n=["BR-0021","BR-0022","BR-0023","BR-0024","BR-0025","BR-0026"];if(e.errorInfo){var i=this._getFailedFuncId(e),r=[];for(var o in e.errorInfo){var a=e.errorInfo[o];if(a.errorCode){var s=Studio.getEditorContainer().getActiveModelEditor().getModel().getFnUnitNameById(i),c=t.VA.Core.Utils.MessageUtils.getFunctionLabels(s,e.errorInfo[o].parameter);if(r.push(t.VA.Core.Utils.MessageUtils.getMessage(e.errorInfo[o].errorCode,c)),e.errorInfo[o].detailMessage&&r.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&&r.push(this.parseFunctionLabel(i,a.message));}return r.join("\n");}return e.message||"";},n.prototype.parseFunctionLabel=function(n,i){if(!n)return i;var r=Studio.getEditorContainer().getActiveModelEditor().getFunctionByFid(n),o=t.VA.Core.Utils.MessageUtils.getFunctionLabelAll()[e.getName(r)];return _.forEach(o,function(t,e){var n=new RegExp(e,"gi");i=i.replace(n,t);}),i;},n.prototype._getProcessingDetailMessage=function(t){if(t.errorInfo){var e=[];for(var n in t.errorInfo){var i=t.errorInfo[n];i.detailMessage&&e.push(i.detailMessage);}return e.join("\n");}return t.detailMessage||"";},n.prototype._getFailedFuncId=function(t){var e=t.processes;for(var n in e){var i=e[n].functions;for(var r in i){if("FAIL"===i[r].status)return i[r].fid;}}},n.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 i=e[t.eventType]-e[n.eventType];return 0==i?t.begin-n.begin:i;}),t){Studio.getInstance().fireDebugEvent(t[n]);}},t.VA.Core.ModelLauncher=n;}.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,i,r){try{var o={catch:[function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);}]};this._extendListeners(o,r),this.launchers[e.type].launchModel(e,n,i,r);}catch(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog("Cannot execute the flow. It contains invalid contents.");}},n.prototype.launchUnit=function(n,i,r,o){var a=n.parent().getMainModel(),s=this,c=(i=i||{},r=r||{},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,i){return e?t:n?t:i?"":void 0;}),v=p.exec(g);if(v&&v.length>0){f=!0;break;}}var m={catch:[function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);}]};this._extendListeners(m,o);var y=function y(t){var e=t?t.args:i;s.launchers[c].launchUnit(n,e,r,m);},b={close:function close(t){t.OK&&y(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 C in n.param.functions){if(x===n.param.functions[C].fid){f=!0;break;}}if(f)break;}if(f){var O=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(O,b);else{var I={};for(var h in a.variables){U=(T=a.variables[h]).type.indexOf("array")>-1&&1==T.value.length?T.value[0]:T.value,_.isUndefined(U)||(I[h]=T.value);}y({OK:!0,args:I});}}else if("etl"===c)new t.VA.Implementation.ETLFlow.Dialogs.LaunchProgressDialog(O,b);else if("true"===t.VA.SettingStorage.getValue("editor.variable.visible"))new t.VA.Core.Dialogs.RunDataDialog(O,b);else{I={};for(var h in a.variables){var U,T=a.variables[h];U=_.isArray(T.value)&&1===T.value.length?T.value[0]:T.value,_.isUndefined(U)||(I[h]=T.value);}y({OK:!0,args:I});}}else setTimeout(function(){t.VA.Core.Utils.WidgetUtils.openErrorDialog("Variables are required to run the function.");},100);}else y();},n.prototype.stopCheckModel=function(){this.launchers.deeplearning.stopCheckModel();},n.prototype._extendListeners=function(t,e){var n=t;for(var i in e){var r=e[i];r&&($.isArray(r)?r.forEach(function(t){n[i]||(n[i]=[]),n[i].push(t);}):"function"==typeof r&&(n[i]||(n[i]=[]),n[i].push(r)));}},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 i in e.functions){var r=e.functions[i],o=t+"_"+r.fid;if(this.labelMap[o]=r.display.label,"Subflow"==r[FUNCTION_NAME]&&r.param.functions.length>0){var a={fid:r.fid,first:r.param.functions[0].fid,last:r.param.functions[r.param.functions.length-1].fid};for(var s in r.param.functions){var c=r.param.functions[s];this.subflowMap[t+"_"+c.fid]=a;}}else r.param.functions&&this._scanFunctions(t,r.param,r.fid);}},e.prototype.createUnitEvent=function(t,e,n,i){var r,o=[];return(r=this._createUnitStartEvent(t,e,n,i))&&o.push(r),(r=this._createUnitEndEvent(t,e,n,i))&&o.push(r),o;},e.prototype._createUnitStartEvent=function(t,e,n,i){if(this.cache[t]&&!(n.fid.indexOf("internal_function")>-1)){var r,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(r=a?o=a.fid:o+"@"+i,"WAIT"!==n.status&&!this.cache[t][r]){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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"PROCESSING"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}}},e.prototype._createUnitEndEvent=function(t,e,n,i){var r,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(r=a?o=a.fid:o+"@"+i,this.cache[t]&&this.cache[t][r]&&"PROCESSING"==this.cache[t][r].event.status&&this.cache[t][r].event.status!=n.status)return this.cache[t][r].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:i};},e.prototype.createProcessEvent=function(t,e,n,i,r,o){var a,s=[];return(a=this._createProcessStartEvent(t,e,n,o,r))&&s.push(a),(a=this._createProcessEndEvent(t,e,n,i,r))&&s.push(a),s;},e.prototype._createProcessStartEvent=function(t,e,n,i,r){if(!(e.indexOf("internal_process")>-1||this.cache[t]&&this.cache[t].begin===n&&"0"==i)){var o={eventType:"BEGIN-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:r,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,i,r){if(this.cache[t]&&this.cache[t].begin===n&&this.cache[t].status!==r)return{eventType:"END-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:r,begin:n,end:i};},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 i in e.functions){var r=e.functions[i],o=t+"_"+r.fid;if(this.labelMap[o]=r.display.label,"Subflow"==r[FUNCTION_NAME]&&r.param.functions.length>0){var a={fid:r.fid,first:r.param.functions[0].fid,last:r.param.functions[r.param.functions.length-1].fid};for(var s in r.param.functions){var c=r.param.functions[s];this.subflowMap[t+"_"+c.fid]=a;}}else r.param.functions&&this._scanFunctions(t,r.param,r.fid);}},e.prototype.createUnitEvent=function(t,e,n,i){var r,o=[];return(r=this._createUnitStartEvent(t,e,n,i))&&o.push(r),(r=this._createUnitEndEvent(t,e,n,i))&&o.push(r),o;},e.prototype._createUnitStartEvent=function(t,e,n,i){if(this.cache[t]&&!(n.fid.indexOf("internal_function")>-1)){var r,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(r=a?o=a.fid:o+"@"+i,"WAIT"!==n.status&&!this.cache[t][r]){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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"PROCESSING"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}if(this.cache[t][r]&&(this.cache[t][r].event.begin!=n.begin||"SUCCESS"==this.cache[t][r].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:i};return n.fid.indexOf("read_alluxio_pagination")>-1?s.label="(read)":n.fid.indexOf("write_alluxio_pagination")>-1&&(s.label="(write)"),this.cache[t][r]={event:s},s;}}},e.prototype._createUnitEndEvent=function(t,e,n,i){var r,o=n.fid,a=this.subflowMap[e+"_"+n.fid];if(r=a?o=a.fid:o+"@"+i,this.cache[t]&&this.cache[t][r]&&"PROCESSING"==this.cache[t][r].event.status&&this.cache[t][r].event.status!=n.status)return this.cache[t][r].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:i};},e.prototype.createProcessEvent=function(t,e,n,i,r,o){var a,s=[];return(a=this._createProcessStartEvent(t,e,n,o))&&s.push(a),(a=this._createProcessEndEvent(t,e,n,i,r))&&s.push(a),s;},e.prototype._createProcessStartEvent=function(t,e,n,i){if(!(e.indexOf("internal_process")>-1||this.cache[t]&&"0"==i)){var r={eventType:"BEGIN-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:"PROCESSING",begin:n};return this.cache[t]={mid:r.mid,status:r.status},r;}},e.prototype._createProcessEndEvent=function(t,e,n,i,r){if(this.cache[t]&&"PROCESSING"==this.cache[t].status&&this.cache[t].status!=r)return{eventType:"END-PROCESS",launchOptions:this.launchOptions,pid:t,mid:e,label:this.labelMap[e],status:r,begin:n,end:i};},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 i={url:n,type:"POST",blocking:!1,contentType:"application/json; charset=utf-8",data:JSON.stringify(t)};return Promise.resolve($.ajax(i)).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 i={url:n,blocking:!1,type:"GET"};return $.ajax(i);},e.prototype._scheduleCheckStatus=function(t,e){var n=this,i=function i(){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(i,3e3)):(n._fireStatus(t),setTimeout(i,3e3));}).fail(n._fireCatch.bind(n));};setTimeout(i,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,i,r){var o={mode:"unit",clazz:t.VA.Implementation.Visual.Clazz,expectedUnitCount:1,originalModels:[{mid:i.mid||e.parent().mid,title:e.parent().title,type:t.VA.Implementation.Visual.Clazz,functions:[$.extend(!0,{},e)],getFnUnitById:function getFnUnitById(){}}],runnable:this._createUnitRunnable(e,n,i)};this._launch(o,i,r);},e.prototype._createUnitRunnable=function(e,n,i){var r=this._generateJobId(e.fid),o=i.user||t.VA.Env.Session.userId,a=t.VA.Core.Utils.RunnableFactory._create(r,o),s=$.extend(!0,{},e);t.VA.Core.Utils.ModelUtils.carvePersist(s,i.persist||!1),t.VA.Core.Utils.ModelUtils.deleteDisplay(s),t.VA.Core.Utils.ModelUtils.deleteEmptyArray(s);var c=i.mid||e.parent().mid;a.main=c,a.models[c]={mid:c,type:"data",functions:[s],links:[],entries:[s.fid]},a.version="3.5";o=i.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,i,r){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,i)},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,i,r);},e.prototype._launch=function(e,n,i){var r=this,o=new t.VA.Implementation.Visual.EventDetector(e),a=function a(t){for(var e in t.processes){var i=t.processes[e],a=i.pid||"pid_undefined",s=i.mid,c=o.createProcessEvent(a,s,i.begin,i.end,i.status);for(var u in i.functions){var l=i.functions[u];"PROCESSING"==l.status&&(r.processingUnit=l),c=c.concat(o.createUnitEvent(a,s,l,u));}for(var p in c){c[p].originalResponse=t;}n.hideDialog||r._fireEvents(c);}},s=function s(t){var i={eventType:"END-JOB",jid:t.jobId,message:t.message,status:t.status,launchOptions:e,originalResponse:t};n.hideDialog||r._fireEvents([i]),delete r.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 i={eventType:"PENDING-JOB",jid:t.jobId,message:r._getPendingMessage(t),status:t.status,launchOptions:e,originalResponse:t};n&&n.hideDialog||r._fireEvents([i]);}(t);}],catch:[function(t){s({jobId:e.runnable.jid,status:"FAIL",exception:t});}]};this._extendListeners(c,i);var u=new t.VA.Implementation.Visual.Job(c);u.start(e.runnable,n).then(function(t){r.jobScheduler[t.result]=u;var i={eventType:"BEGIN-JOB",jid:t.result,status:"WAIT",launchOptions:e};n&&n.hideDialog||r._fireEvents([i]);});},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);