diff --git a/va-server/visual-analytics/public/js/va/brightics-va-ajax.min.js b/va-server/visual-analytics/public/js/va/brightics-va-ajax.min.js index b22fa1c2e..1249ac3b9 100644 --- a/va-server/visual-analytics/public/js/va/brightics-va-ajax.min.js +++ b/va-server/visual-analytics/public/js/va/brightics-va-ajax.min.js @@ -1,2 +1,2 @@ -/* Brightics VA Build 200424 */ +/* Brightics VA Build 200427 */ $.ajaxSetup({beforeSend:function(e,s){if(s&&s.blocking){var r={open:function(e,s){this.$el=$('
'),$("body").append(this.$el)},close:function(e,s,r){this.$el.remove()}};r.open(),e.done(r.close.bind(r)),e.fail(r.close.bind(r))}},error:function(e,s,r){var o={errors:[{message:"Sorry! An unexpected error occurred. Please contact administrator.",code:400,contentType:e.getResponseHeader("Content-Type")}]};401==e.status?($(window).unbind("beforeunload"),o={errors:[{message:"The session has expired and the last operation was not applied. Please login again to continue.",code:401}]},Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o,function(){window.location.href="/"})):403===e.status?(o.errors[0].code=403,e.responseJSON&&e.responseJSON.errors?(o=e.responseJSON).errors[0].contentType=e.getResponseHeader("Content-Type"):(o.errors[0].message="Maximum file length exceeded.",o.errors[0].detailMessage=e.responseText),Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o)):400!==e.status&&(o.errors[0].code=e.status,e.responseJSON&&e.responseJSON.errors?(o=e.responseJSON).errors[0].contentType=e.getResponseHeader("Content-Type"):e.responseText&&(o.errors[0].detailMessage=e.responseText),Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o))}}); \ No newline at end of file diff --git a/va-server/visual-analytics/public/js/va/brightics-va-commons.min.js b/va-server/visual-analytics/public/js/va/brightics-va-commons.min.js index 73ab102ca..768dcb325 100644 --- a/va-server/visual-analytics/public/js/va/brightics-va-commons.min.js +++ b/va-server/visual-analytics/public/js/va/brightics-va-commons.min.js @@ -1 +1,2 @@ -/* Brightics VA Build 200424 */!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports;}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r});},n.n=function(t){var e=t&&t.__esModule?function(){return t.default;}:function(){return t;};return n.d(e,"a",e),e;},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e);},n.p="",n(n.s=29);}([function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var r=function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t;};},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(31);function i(t){}n.n(r)()(i.prototype);},function(t,e,n){"use strict";n.d(e,"a",function(){return i;}),n.d(e,"b",function(){return o;}),n.d(e,"c",function(){return a;});var r=function r(t){return Promise.resolve($.ajax(t));},i=function i(t){return r({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 r(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 r(n);};},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.CORE_VERSION="3.6";},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(1);function i(t,e){r.a.call(this),this.$el=t,this.options=e;}i.prototype=Object.create(r.a.prototype),i.prototype.constructor=i,i.prototype.getParent=function(){return this.$el;},i.prototype.getOptions=function(){return this.options;},i.prototype.render=function(){throw new Error("not implemented");},i.prototype.destroy=function(){};},function(t,e,n){"use strict";var r=n(39)();t.exports=function(t){return t!==r&&null!==t;};},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var r=n(16),i=n(7),o=n(0);function a(t){this.data=t||{},this.data.update_time&&(this.data.update_time=new Date(moment(this.data.update_time).format())),this.data.create_time&&(this.data.create_time=new Date(moment(this.data.create_time).format())),this.data.contents?(Object(r.a)(this.data),Object(r.c)(this.data.contents)):this.data.contents={};}Object(o.a)(a,i.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(r.a)(this.data),Object(r.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 r(){}n.d(e,"a",function(){return r;}),r.prototype.equals=function(t){throw new Error("not implemented");},r.prototype.getHashCode=function(){throw new Error("not implemented");},r.prototype.toJSON=function(){throw new Error("not implemented");},r.prototype.getResourceName=function(){throw new Error("not implemented");};},function(t,e,n){"use strict";function r(){this.map={},this.chk={};}n.d(e,"a",function(){return r;}),r.prototype.set=function(t,e){this.map[t]=e,this.chk[t]=!0;},r.prototype.get=function(t){return this.map[t];},r.prototype.remove=function(t){var e=this.map[t];return this.chk[t]=!1,delete this.map[t],e;},r.prototype.has=function(t){return this.chk[t];},r.prototype.toArray=function(){return _.toArray(this.map);},r.prototype.toJSON=function(){return this.map;};},function(t,e,n){"use strict";n.d(e,"b",function(){return r;}),n.d(e,"a",function(){return i;});var r=function r(t){return _.reduce(t,function(t,e){return t.then(function(t){return e(t);});},Promise.resolve());},i=function i(t){return Promise.all(_.map(t,function(t){return t();}));};},function(t,e,n){"use strict";var r=n(18),i=n(6),o=n(20),a=n(62);n.d(e,"c",function(){return r.a;}),n.d(e,"a",function(){return i.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 i;});var r=n(4);function i(t,e){r.a.call(this,t,e);}i.prototype=Object.create(r.a.prototype),i.prototype.constructor=i,i.prototype.update=function(t){throw new Error("not implemented");};},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(11);function i(t,e){r.a.call(this,t,e),this.listeners={},this.jqxOptions=this._brtcOptions2jqxOptions(this.options),this.keyIndex=0;}i.prototype=Object.create(r.a.prototype),i.prototype.constructor=i,i.prototype.update=function(t){this.source.localdata=t,this.$content.jqxGrid("updatebounddata"),this.options.selectable&&this.$content.jqxGrid("clearselection");},i.prototype.render=function(){return this.$template=$(['
','
','
',"
","
","
"].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;},i.prototype.destroy=function(){this.$content.jqxGrid("destroy");},i.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;},i.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;},i.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));},i.prototype._getDefaultHeaderRenderer=function(){return function(t){return'
'+_.escape(t)+"
";};},i.prototype._getDefaultDataRenderer=function(t,e){var n=[this._getAlignClass(e)].join(" ");return function(e,r,i){return this._wrap("
"+_.escape(this._format(i,t))+"
",n);}.bind(this);},i.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"];},i.prototype._getGenerativeRenderer=function(t,e){var n=[this._getAlignClass(t)].join(" ");return function(t,r,i){var o=e(t,i);return this._wrap(this._getHtmlWithEventHandler(o,t),n);}.bind(this);},i.prototype._getHtmlWithEventHandler=function(t,e){var n=this.source.localdata[e],r=e,i=function(t){var e=$._data(t,"events");_.forOwn(e,function(e,i){var o=this._genHandlerKey();this.listeners[i]=this.listeners[i]||{},this.listeners[i][o]={fn:function fn(t){_.forEach(e,function(e){e.handler(t);});},data:n,index:r},t.setAttribute(i+"__key__",o);}.bind(this));}.bind(this),o=function o(t){var e=t.children;i(t),_.forEach(e,function(t){i(t),o(t);});};return o(t[0]),t[0].outerHTML;},i.prototype._wrap=function(t,e){return['
',t,"
"].join("");},i.prototype._format=function(t,e){var n=t||"";return"date"==(e||"string")&&n?moment(n).format("YYYY-MM-DD HH:mm:ss"):n;},i.prototype._genHandlerKey=function(){return parseInt(++this.keyIndex);},i.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));},i.prototype._registerAllListeners=function(t){var e=this.$content;_.forEach(["mousedown","click","change","dblclick","keydown","keyup"],function(n){e.on(n,function(e){e.preventDefault(),e.stopPropagation();var r=n+"__key__",i=(e.originalEvent||e.args.originalEvent).target.getAttribute(r);return t[n]&&t[n][i]&&(e.cancel=!0,e.data=t[n][i].data,e.index=t[n][i].index,t[n][i].fn(e)),!1;});});},i.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 i;});var r=n(4);function i(t,e){r.a.call(this,t,e);}i.prototype=Object.create(r.a.prototype),i.prototype.constructor=i,i.prototype.setItems=function(t){throw new Error("not implemented");},i.prototype.getItems=function(){throw new Error("not implemented");},i.prototype.getSelectedItem=function(){throw new Error("not implemented");},i.prototype.isSelected=function(){throw new Error("not implemented");},i.prototype.isOpened=function(){throw new Error("not implemented");},i.prototype.open=function(){throw new Error("not implemented");},i.prototype.close=function(){throw new Error("not implemented");},i.prototype.enable=function(){throw new Error("not implemented");},i.prototype.disable=function(){throw new Error("not implemented");};},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(13);function i(t,e){r.a.call(this,t,e),this.jqxOptions=this._brtcOptions2jqxOptions(e),this._initEventListener();}i.prototype=Object.create(r.a.prototype),i.prototype.constructor=i,i.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));},i.prototype._getAutoDropDownHeight=function(t){return!(t.itemHeight*t.source.length>t.dropDownHeight);},i.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;},i.prototype._getRenderer=function(t){return t||function(t){return t;};},i.prototype._getRenderedData=function(t){return _.map(t,this.renderer);},i.prototype.render=function(){return this.$el.jqxDropDownList(this.jqxOptions),this;},i.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;},i.prototype.getItems=function(){return this.data;},i.prototype.getSelectedItem=function(){if(!this.isSelected())throw new Error("not selected");return this.data[this.$el.jqxDropDownList("selectedIndex")];},i.prototype.isSelected=function(){return this.$el.jqxDropDownList("selectedIndex")>-1;},i.prototype.isOpened=function(){return this.$el.jqxDropDownList("isOpened");},i.prototype.open=function(){return this.$el.jqxDropDownList("open"),this;},i.prototype.close=function(){return this.$el.jqxDropDownList("close"),this;},i.prototype.enable=function(){return this.$el.jqxDropDownList({disabled:!1}),this;},i.prototype.disable=function(){return this.$el.jqxDropDownList({disabled:!0}),this;},i.prototype.focus=function(){return this.$el.jqxDropDownList("focus"),this;};},function(t,e,n){"use strict";n.d(e,"a",function(){return f;});var r=n(2),i=n(6),o=n(49),a=n.n(o);var _ref=_,s=_ref.map,c=_ref.compact,l=_ref.first,u=_ref.flow,p=function p(t){try{return new i.a(t);}catch(t){return void console.warn("Some files are ignored.");}},d=function d(t){return c(s(t,p));},h=u(l,p);var f={getFiles:function getFiles(t){var e="api/va/v2/ws/projects/"+t+"/files";return Object(r.a)(e).then(d);},getFile:function getFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e;return Object(r.a)(n).then(function(t){return t.length?h(t):null;});},addFile:function addFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files";return Object(r.b)(n,e.toJSON());},updateFile:function updateFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e.getFileId()+"/update";return Object(r.b)(n,e.toJSON()).then(h);},updateFileSync:function updateFileSync(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e.getFileId()+"/update";return Object(r.c)(n,e.toJSON()).then(h);},deleteFile:function deleteFile(t,e){var n="api/va/v2/ws/projects/"+t+"/files/"+e+"/delete";return Object(r.b)(n);},saveFileSync:function saveFileSync(t,e,n){var i="api/va/v2/ws/projects/"+t+"/files/"+e.getFileId()+"/save",o=function(t){return JSON.parse(JSON.stringify(t));}(e.getContents()),s=Object.assign(_.omit(e.toJSON(),"contents"),{modelDiff:n,hash:a()(o,{respectFunctionProperties:!1,respectFunctionNames:!1,respectType:!1})});return Object(r.c)(i,s).then(l);}};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;}),n.d(e,"b",function(){return i;}),n.d(e,"c",function(){return a;});var r=function r(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());},i=function i(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 r=n(2),i=n(18),o=function o(t){return new i.a(t);},a=function a(t){return _.map(t,o);},s={getProjects:function getProjects(){return Object(r.a)("api/va/v2/ws/projects").then(a);},getProject:function getProject(t){var e="api/va/v2/ws/projects/"+t;return Object(r.a)(e).then(function(t){return o(t[0]);});},addProject:function addProject(t){return Object(r.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(r.b)(e,t.toJSON()).then(o);},deleteProject:function deleteProject(t){var e="api/va/v2/ws/projects/"+t+"/delete";return Object(r.b)(e);}};},function(t,e,n){"use strict";n.d(e,"a",function(){return o;});var r=n(7),i=n(0);function o(t){this.data=t||{};}Object(i.a)(o,r.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(moment(this.data.update_time).format());},o.prototype.setUpdateTime=function(t){return this.data.update_time=t,this;},o.prototype.getCreateTime=function(){return new Date(moment(this.data.create_time).format());},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 r=n(2),i=n(6),o=n(20),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(r.a)(n).then(s);},getVersion:function getVersion(t,e,n){var i="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n;return Object(r.a)(i).then(a);},addVersion:function addVersion(t,e,n){var i="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions";return Object(r.b)(i,n.toJSON(!0)).then(a);},updateVersion:function updateVersion(t,e,n){var i="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n.getVersionId()+"/update";return Object(r.b)(i,n);},loadVersion:function loadVersion(t,e,n){var o="api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n+"/load";return Object(r.b)(o).then(function(t){if(t.length)return e=t[0],new i.a(e);var e;});},getVersionsForced:function getVersionsForced(t,e,n,r){var i={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions",contentType:"application/json; charset=utf-8"};return $.ajax(i).done(function(t){if(n&&"function"==typeof n)return n(s(t));}).fail(function(t){if(r&&"function"==typeof r)return r(t);});},getVersionForced:function getVersionForced(t,e,n,r,i){var o={type:"GET",blocking:!0,async:!1,url:"api/va/v2/ws/projects/"+t+"/files/"+e+"/versions/"+n,contentType:"application/json; charset=utf-8"};return $.ajax(o).done(function(t){if(r&&"function"==typeof r)return r(a(t));}).fail(function(t){if(i&&"function"==typeof i)return i(t);});}};},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var r=n(7),i=n(0),o=n(16);function a(t){this.data=t||{},this.data.contents?(Object(o.b)(this.data),Object(o.c)(this.data.contents)):this.data.contents={};}Object(i.a)(a,r.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(moment(this.data.update_time).format());},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(moment(this.data.create_time).format());},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 r=n(8),i=n(22),o=n(23);n.d(e,"a",function(){return r.a;}),n.d(e,"b",function(){return i.a;}),n.d(e,"c",function(){return o.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var r=n(23),i=n(1),o=n(0);function a(){this.__root=new r.a();}Object(o.a)(a,i.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 r=n(8),i=n(1),o=n(0);function a(t,e){i.a.call(this),this.key=t,this.data=e,this.__parentNode=this,this.__childrenNodes=[],this.__childrenMap=new r.a();}Object(o.a)(a,i.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 r=n(1),i=n(17),o=n(15),a=n(19),s=n(0),c=n(21),l=n(22),u=n(51),p=n(58),d={ADD:"project:add",CHANGE:"project:change",DELETE:"project:delete"},h={ADD:"file:add",CHANGE:"file:change",DELETE:"file:delete"},f={ADD:"version:add",CHANGE:"version:change",DELETE:"version:delete"};function g(){r.a.call(this),this.projectTree=new l.a();}Object(s.a)(g,r.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)),r=new c.a(),i=[];return Object(u.a)(n,function(t){r.set(t.getHashCode(),t);}),Object(u.a)(e,function(t){var e=t.getHashCode();r.has(e)?(r.get(e).equals(t)||i.push({type:"change",data:t}),r.remove(e)):i.push({type:"add",data:t});}),Object(u.a)(r.toArray(),function(t){i.push({type:"delete",data:t});}),i;},g.prototype._syncProject=function(t){var e=this;Object(u.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(u.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(u.a)(t,function(t){var n=t.data,r=e.projectTree.getProjectNodeByFileId(n.getFileId()).getData().getProjectId();"add"==t.type&&e._addVersion(r,n.getFileId(),n),"change"==t.type&&e._updateVersion(r,n.getFileId(),n);});},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(h.CHANGE,e),e;},g.prototype._addFile=function(t,e){return this.projectTree.addFile(t,e),this.emit(h.ADD,e),e;},g.prototype._deleteFile=function(t,e){var n=this.projectTree.deleteFile(t,e);return this.emit(h.DELETE,n),n;},g.prototype._updateVersion=function(t,e,n){return this.projectTree.updateVersion(t,e,n),this.emit(f.CHANGE,n),n;},g.prototype._addVersion=function(t,e,n){return this.projectTree.addVersion(t,e,n),this.emit(f.ADD,n),n;},g.prototype._deleteVersion=function(t,e,n){var r=this.projectTree.addVersion(t,e,n);return this.emit(f.DELETE,r),r;},g.prototype.fetchProject=function(t){var e=this;return i.a.getProject(t).then(function(n){var r=e.projectTree.getProject(t);return e._syncProject(e._getResourceDiff([r],[n])),n;}).catch(function(t){throw console.error(t),new Error("failed to fetch project");});},g.prototype.fetchProjects=function(){var t=this;return i.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 r=e.projectTree.getFiles(t);return e._syncFile(e._getResourceDiff([r],n)),n;});},g.prototype.fetchFile=function(t,e){var n=this;return o.a.getFile(t,e).then(function(r){var i=n.projectTree.getFile(t,e);return n._syncFile(n._getResourceDiff([i],[r])),r;}).catch(function(t){throw new Error("filed to fetch file");});},g.prototype.fetchVersions=function(t,e){var n=this;return a.a.getVersions(t,e).then(function(t){var r=n.projectTree.getProjectNodeByFileId(e).getData().getProjectId(),i=n.projectTree.getVersions(r,e);return n._syncVersion(n._getResourceDiff([i],t)),t;}).catch(function(t){throw new Error("failed to fetch versions");});},g.prototype.fetchVersion=function(t,e,n){var r=this;return a.a.getVersion(t,e,n).then(function(i){var o=r.projectTree.getVersion(t,e,n);return r._syncVersion(r._getResourceDiff([o],[i])),i;}).catch(function(t){throw new Error("filed to fetch version");});},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 i.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 i.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 i.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(r,i){o.a.updateFileSync(t,e).then(function(i){e.setEventKey(i.getEventKey()),e.setUpdateTime(i.getUpdateTime()),n._updateFile(t,e),r([null,e]);}).catch(function(t){console.error(t),r([t,e]);});});}),this.lastQuery;},g.prototype.saveFile=function(t,e,n){var _this=this;return this.lastQuery=this.lastQuery||Promise.resolve(),this.lastQuery=this.lastQuery.then(function(){return o.a.saveFileSync(t,e,n).then(function(n){if(n){var _r=n.event_key,_i=n.update_time;return e.setEventKey(_r),e.setUpdateTime(_i),_this._updateFile(t,e),e;}return new Promise(function(n){o.a.updateFileSync(t,e).then(function(r){e.setEventKey(r.getEventKey()),e.setUpdateTime(r.getUpdateTime()),_this._updateFile(t,e),n([null,e]);}).catch(function(t){console.error(t),n([t,e]);});});}).catch(function(t){throw console.error(t),t;});}),this.lastQuery;},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 r=this;return a.a.addVersion(t,e,n).then(function(n){return r._addVersion(t,e,n),n;}).catch(function(t){throw console.error(t),t;});},g.prototype.updateVersion=function(t,e,n){var r=this;return a.a.updateVersion(t,e,n).then(function(){return r._updateVersion(t,e,n),n;}).catch(function(t){throw console.error(t),t;});},g.prototype.loadVersion=function(t,e,n){var r=this;return a.a.loadVersion(t,e,n).then(function(e){return r._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 u;});var r=n(1),i=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 l(){r.a.call(this);}Object(i.a)(l,r.a),l.prototype.getMeta=function(t){return t.meta?t.meta:void 0;},l.prototype.getVersion=function(t){return t.version?t.version:"1.0";},l.prototype._getVersionPath=function(t){var e=this.getVersion(t);return c[e];},l.prototype._getPath=function(t,e,n){var r=this._getVersionPath(t);return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(r,[e,n]);},l.prototype.getInputs=function(t){var e=this._getPath(t,"in","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},l.prototype.getOutputs=function(t){var e=this._getPath(t,"out","data");return Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},l.prototype.getInputsToObject=function(t){if(!t)return{};var e={},n=this.getInputs(t);if(this.hasMeta(t))for(var r in n){e[n[r]]=r;}else{var i=this.getLabel(t);for(var o in n){e[n[o]]="["+o+"]"+i;}}return e;},l.prototype.getOutputsToObject=function(t){if(!t)return{};var e={},n=this.getOutputs(t);if(this.hasMeta(t))for(var r in n){if(Array.isArray(n[r]))for(var i in n[r]){e[n[r][i]]=r;}else e[n[r]]=r;}else{var o=this.getLabel(t);for(var i in n){e[n[i]]="["+i+"]"+o;}}return e;},l.prototype.getInData=function(t,e){var n=[],r=this.getMeta(t),i=this.getInputs(t);if(r)for(var a in i){i[a]&&(e?r[a].type===e&&(n=n.concat(i[a])):n=n.concat(i[a]));}else e?e===o&&(n=i):n=i;return n;},l.prototype.getOutData=function(t,e){var n=[],r=this.getMeta(t),i=this.getOutputs(t);if(r)for(var a in i){i[a]&&(e?r[a].type===e&&(n=n.concat(i[a])):n=n.concat(i[a]));}else e?e===o&&(n=i):n=i;return n;},l.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||[])]));},l.prototype.getAllData=function(t){return _.union(this.getInData(t),this.getOutData(t),this._getData(t));},l.prototype.getData=function(t,e){return"in"===e?this.getInData(t):this.getOutData(t);},l.prototype.getInputTypes=function(t){var e=this.getMeta(t);if(!e)return[o];var n=[],r=this.getInputs(t);for(var i in r){n.indexOf(e[i].type)<0&&n.push(e[i].type);}return n;},l.prototype.getOutputTypes=function(t){var e=this.getMeta(t);if(!e)return[o];var n=[],r=this.getOutputs(t);for(var i in r){n.indexOf(e[i].type)<0&&n.push(e[i].type);}return n;},l.prototype.getTypes=function(t,e){return"in"===e?this.getInputTypes(t):this.getOutputTypes(t);},l.prototype.getKeyByTableId=function(t,e){if(!t)return"";if(!this.getMeta(t))return"";var n=_.assign({},this.getInputs(t),this.getOutputs(t));for(var r in n){if(n[r].indexOf(e)>-1)return r;}},l.prototype.getTypeByTableId=function(t,e){if(!t)return"";var n=this.getMeta(t);if(!n)return o;var r=_.assign({},this.getInputs(t),this.getOutputs(t));for(var i in r){if(r[i].indexOf(e)>-1)return n[i].type;}return"";},l.prototype.getTypeByKey=function(t,e){if(!t)return"";var n=this.getMeta(t);return n?n[e].type:o;},l.prototype.getInTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r){r[i]&&n[i].type===o&&r[i]&&(e=e.concat(r[i]));}}else e=t[IN_DATA];return e;},l.prototype.getInTableByKeys=function(t,e){var n=[],r=this.getMeta(t);if(r){var i,a=this.getInputs(t);for(var _t=0;_t=0;},l.prototype.isSkip=function(t){return t.skip&&_.isEqual(t.skip,!0);},l.prototype.getDefinition=function(t,e){return Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary(t,e);},l.prototype.isExist=function(t,e){var n=this.getOutData(t),r=this.getInData(e);return _.forEach(n,function(t){_.forEach(r,function(e){if(t===e)return!0;});}),!1;},l.prototype.isConnectable=function(t,e){var n=this.getDefinition("data",t.func),r=this.getDefinition("data",e.func);if(n["connectable-functions"]){if(n["connectable-functions"].indexOf(e.func)<0)return!1;}else if(r["acceptable-functions"]&&r["acceptable-functions"].indexOf(t.func)<0)return!1;var i=this.getOutputTypes(t),o=this.getInputTypes(e),a=0;for(var s in i){var c=i[s];o.indexOf(c)>-1&&a++;}if(0===a)return!1;var l=this.getInRange(e),u=0;for(var p in l){var d=l[p].max;this.getInData(e,p).length-1&&this.addInData(e,s,i[s]);}},l.prototype.disconnect=function(t,e){var n=this.getOutData(t),r={table:[],model:[],image:[]};for(var i in n){var o=n[i];r[a=this.getTypeByTableId(t,o)].push(o);}for(var a in r){0!==r[a].length&&this.removeInData(e,a,r[a]);}},l.prototype.addInData=function(t,e,n){var r=this;if(0!==n.length)if(e===o){if(this.getMeta(t)){var i=this.getInputs(t);_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}else t[IN_DATA].push(n[0]);}else if("model"===e){i=this.getInputs(t);_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}else if("image"===e){i=this.getInputs(t);_.forEach(i,function(i,o){_.isArray(i)&&_.isEqual(e,r.getTypeByKey(t,o))?t.inputs[o]=_.union([],i,n):_.isEmpty(i)&&_.isEqual(e,r.getTypeByKey(t,o))&&_.isEmpty(r.getKeyByTableId(t,n[0]))&&(t.inputs[o]=n[0]);});}},l.prototype.removeInData=function(t,e,n){if(0!==n.length){n=Array.isArray(n)?n:[n];this.getMeta(t)?_.forEach(this.getInputs(t),function(e,r){_.forEach(n,function(n){_.isArray(e)&&_.indexOf(e,n)>-1?(_.remove(e,function(t){return t==n;}),t.inputs[r]=e):_.isEqual(e,n)&&(t.inputs[r]="");});}):Brightics.VA.Core.Utils.CommonUtils.removeArrayElement(t[IN_DATA],n);}},l.prototype.createOutData=function(t,e){var n=this.getDefinition("data",e),r=$.extend(!0,{},n.defaultFnUnit),i={};if(r.meta)for(var o in i.outputs=r.outputs,i.outputs){Array.isArray(i.outputs[o])?i.outputs[o].push(Brightics.VA.Core.Utils.IDGenerator.table.id()):i.outputs[o]=Brightics.VA.Core.Utils.IDGenerator.table.id();}else{i[OUT_DATA]=r[OUT_DATA];for(var a=n["out-range"],s=0;s-1;},l.prototype.changeData=function(t,e,n){if(this.hasMeta(t)){var r=this.getInputs(t),i=this.getOutputs(t);_.forEach(r,function(r,i){_.isEqual(r,e)&&(t.inputs[i]=n);}),_.forEach(i,function(r,i){_.isEqual(r,e)&&(t.outputs[i]=n);});var o=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(r,i){_.isEqual(r,e)&&(t.inData[i]=n);}),_.forEach(t.outData,function(r,i){_.isEqual(r,e)&&(t.outData[i]=n);});},l.prototype.isDustNode=function(t){return["brightics"].indexOf(this.getCategory(t))>-1;},l.prototype.isBluffNode=function(t){return!(t.inData||t.outData||t.inputs||t.outputs);},l.prototype.isInputtable=function(t){return this.getTotalInRangeCount(t).min>0||this.isBluffNode(t);},l.prototype.isOutputtable=function(t){return!Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func)["out-node"];},l.prototype.isSkippable=function(t){return this.isBluffNode(t)||this.isProcessFunction(t);},l.prototype.isAvailable=function(t){var e=this.getFunc(t);return!_.isUndefined(Brightics.VA.Core.Interface.Functions.data[e]);},l.prototype.isThirdPartyFunction=function(t){return["DataFrameExportForTableau","DataFrameExportForMSTR","DataFrameExportForQlikSense"].indexOf(t[FUNCTION_NAME])>=0;};var u=new l();},function(t,e,n){"use strict";var r=function r(t){for(var e,n=t||16,r="",i=0;i-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 r=n(12),i=n(14),o={createListControl:function createListControl(t,e){return new r.a(t,e);},createDropdownControl:function createDropdownControl(t,e){return new i.a(t,e);}};},function(t,e,n){"use strict";var r=n(15),i=n(17),o=n(19),a=n(50);n.d(e,"b",function(){return r.a;}),n.d(e,"c",function(){return i.a;}),n.d(e,"d",function(){return o.a;}),n.d(e,"a",function(){return a.a;});},function(t,e,n){var r,i;i=function i(){return function t(e,n,i){function o(s,c){if(!n[s]){if(!e[s]){if(!c&&"function"==typeof r&&r)return r(s,!0);if(a)return a(s,!0);throw new Error("Cannot find module '"+s+"'");}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n||t);},l,l.exports,t,e,n,i);}return n[s].exports;}for(var a="function"==typeof r&&r,s=0;s=0)return this.dispatch("[CIRCULAR:"+s+"]");if(n.push(e),void 0!==o&&o.isBuffer&&o.isBuffer(e))return r("buffer:"),r(e);if("object"===a||"function"===a){var c=Object.keys(e);t.unorderedObjects&&(c=c.sort()),!1===t.respectType||f(e)||c.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(c=c.filter(function(e){return!t.excludeKeys(e);})),r("object:"+c.length+":");var l=this;return c.forEach(function(n){l.dispatch(n),r(":"),t.excludeValues||l.dispatch(e[n]),r(",");});}if(!this["_"+a]){if(t.ignoreUnknown)return r("["+a+"]");throw new Error('Unknown object type "'+a+'"');}this["_"+a](e);},_array:function _array(e,i){i=void 0!==i?i:!1!==t.unorderedArrays;var o=this;if(r("array:"+e.length+":"),!i||e.length<=1)return e.forEach(function(t){return o.dispatch(t);});var a=[],s=e.map(function(e){var r=new v(),i=n.slice();return g(t,r,i).dispatch(e),a=a.concat(i.slice(n.length)),r.read().toString();});return n=n.concat(a),s.sort(),this._array(s,!1);},_date:function _date(t){return r("date:"+t.toJSON());},_symbol:function _symbol(t){return r("symbol:"+t.toString());},_error:function _error(t){return r("error:"+t.toString());},_boolean:function _boolean(t){return r("bool:"+t.toString());},_string:function _string(t){r("string:"+t.length+":"),r(t.toString());},_function:function _function(e){r("fn:"),f(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==t.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),t.respectFunctionProperties&&this._object(e);},_number:function _number(t){return r("number:"+t.toString());},_xml:function _xml(t){return r("xml:"+t.toString());},_null:function _null(){return r("Null");},_undefined:function _undefined(){return r("Undefined");},_regexp:function _regexp(t){return r("regex:"+t.toString());},_uint8array:function _uint8array(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t));},_uint8clampedarray:function _uint8clampedarray(t){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t));},_int8array:function _int8array(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t));},_uint16array:function _uint16array(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t));},_int16array:function _int16array(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t));},_uint32array:function _uint32array(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t));},_int32array:function _int32array(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t));},_float32array:function _float32array(t){return r("float32array:"),this.dispatch(Array.prototype.slice.call(t));},_float64array:function _float64array(t){return r("float64array:"),this.dispatch(Array.prototype.slice.call(t));},_arraybuffer:function _arraybuffer(t){return r("arraybuffer:"),this.dispatch(new Uint8Array(t));},_url:function _url(t){return r("url:"+t.toString());},_map:function _map(e){r("map:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets);},_set:function _set(e){r("set:");var n=Array.from(e);return this._array(n,!1!==t.unorderedSets);},_blob:function _blob(){if(t.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');},_domwindow:function _domwindow(){return r("domwindow");},_process:function _process(){return r("process");},_timer:function _timer(){return r("timer");},_pipe:function _pipe(){return r("pipe");},_tcp:function _tcp(){return r("tcp");},_udp:function _udp(){return r("udp");},_tty:function _tty(){return r("tty");},_statwatcher:function _statwatcher(){return r("statwatcher");},_securecontext:function _securecontext(){return r("securecontext");},_connection:function _connection(){return r("connection");},_zlib:function _zlib(){return r("zlib");},_context:function _context(){return r("context");},_nodescript:function _nodescript(){return r("nodescript");},_httpparser:function _httpparser(){return r("httpparser");},_dataview:function _dataview(){return r("dataview");},_signal:function _signal(){return r("signal");},_fsevent:function _fsevent(){return r("fsevent");},_tlswrap:function _tlswrap(){return r("tlswrap");}};}function v(){return{buf:"",write:function write(t){this.buf+=t;},end:function end(t){this.buf+=t;},read:function read(){return this.buf;}};}var y=t("crypto");(n=e.exports=d).sha1=function(t){return d(t);},n.keys=function(t){return d(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"});},n.MD5=function(t){return d(t,{algorithm:"md5",encoding:"hex"});},n.keysMD5=function(t){return d(t,{algorithm:"md5",encoding:"hex",excludeValues:!0});};var m=y.getHashes?y.getHashes().slice():["sha1","md5"];m.push("passthrough");var b=["buffer","hex","binary","base64"];n.writeToStream=function(t,e,n){return void 0===n&&(n=e,e={}),g(e=h(t,e),n).dispatch(t);};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_e8180ef5.js","/");},{buffer:3,crypto:5,lYpoI2:10}],2:[function(t,e,n){(function(t,e,r,i,o,a,s,c,l){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===r||e===c?62:e===i||e===l?63:e0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;c="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,l=new n(3*t.length/4-c),a=c>0?t.length-4:t.length;var p=0;for(i=0,o=0;i>16),r((65280&s)>>8),r(255&s);}return 2===c?r(255&(s=e(t.charAt(i))<<2|e(t.charAt(i+1))>>4)):1===c&&(r((s=e(t.charAt(i))<<10|e(t.charAt(i+1))<<4|e(t.charAt(i+2))>>2)>>8&255),r(255&s)),l;},t.fromByteArray=function(t){function e(t){return u.charAt(t);}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t);}var r,i,o,a=t.length%3,s="";for(r=0,o=t.length-a;r>2),s+=e(i<<4&63),s+="==";break;case 2:s+=e((i=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="=";}return s;};}(void 0===n?this.base64js={}:n);}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib");},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,a,s,c,l,u){function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,o,a,s=typeof t;if("base64"===e&&"string"===s)for(t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"");}(t);t.length%4!=0;){t+="=";}if("number"===s)r=V(t);else if("string"===s)r=i.byteLength(t,e);else{if("object"!==s)throw new Error("First argument needs to be a number, array or string.");r=V(t.length);}if(i._useTypedArrays?o=i._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(function(t){return F(t)||i.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length;}(t))for(a=0;ao&&(r=o):r=o;var a=e.length;P(a%2==0,"Invalid hex string"),r>a/2&&(r=a/2);for(var s=0;s>8,r=e%256,i.push(r),i.push(n);}return i;}(e),t,n,r);}function v(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i=o))return n?(i=t[e],e+1=o))return n?(e+2>>0)):(e+1>>0),i;}function b(t,e,n,r){if(r||(P("boolean"==typeof n,"missing or invalid endian"),P(null!=e,"missing offset"),P(e+1=t.length)){var i=y(t,e,n,!0);return 32768&i?-1*(65535-i+1):i;}}function C(t,e,n,r){if(r||(P("boolean"==typeof n,"missing or invalid endian"),P(null!=e,"missing offset"),P(e+3=t.length)){var i=m(t,e,n,!0);return 2147483648&i?-1*(4294967295-i+1):i;}}function w(t,e,n,r){return r||(P("boolean"==typeof n,"missing or invalid endian"),P(e+3=o))for(var a=0,s=Math.min(o-n,2);a>>8*(r?a:1-a);}}function A(t,e,n,r,i){i||(P(null!=e,"missing value"),P("boolean"==typeof r,"missing or invalid endian"),P(null!=n,"missing offset"),P(n+3=o))for(var a=0,s=Math.min(o-n,4);a>>8*(r?a:3-a)&255;}}function x(t,e,n,r,i){i||(P(null!=e,"missing value"),P("boolean"==typeof r,"missing or invalid endian"),P(null!=n,"missing offset"),P(n+1=t.length||I(t,e>=0?e:65535+e+1,n,r,i);}function T(t,e,n,r,i){i||(P(null!=e,"missing value"),P("boolean"==typeof r,"missing or invalid endian"),P(null!=n,"missing offset"),P(n+3=t.length||A(t,e>=0?e:4294967295+e+1,n,r,i);}function $(t,e,n,r,i){i||(P(null!=e,"missing value"),P("boolean"==typeof r,"missing or invalid endian"),P(null!=n,"missing offset"),P(n+3=t.length||R.write(t,e,n,r,23,4);}function D(t,e,n,r,i){i||(P(null!=e,"missing value"),P("boolean"==typeof r,"missing or invalid endian"),P(null!=n,"missing offset"),P(n+7=t.length||R.write(t,e,n,r,52,8);}function E(t,e,n){return"number"!=typeof t?n:(t=~~t)>=e?e:t>=0?t:(t+=e)>=0?t:0;}function V(t){return(t=~~Math.ceil(+t))<0?0:t;}function F(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t);})(t);}function O(t){return t<16?"0"+t.toString(16):t.toString(16);}function j(t){for(var e=[],n=0;n=55296&&r<=57343&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;a=e.length||i>=t.length);i++){e[i+n]=t[i];}return i;}function S(t){try{return decodeURIComponent(t);}catch(t){return String.fromCharCode(65533);}}function k(t,e){P("number"==typeof t,"cannot write a non-number as a number"),P(t>=0,"specified a negative value for writing an unsigned value"),P(t<=e,"value is larger than maximum value for type"),P(Math.floor(t)===t,"value has a fractional component");}function N(t,e,n){P("number"==typeof t,"cannot write a non-number as a number"),P(t<=e,"value larger than maximum allowed value"),P(t>=n,"value smaller than minimum allowed value"),P(Math.floor(t)===t,"value has a fractional component");}function M(t,e,n){P("number"==typeof t,"cannot write a non-number as a number"),P(t<=e,"value larger than maximum allowed value"),P(t>=n,"value smaller than minimum allowed value");}function P(t,e){if(!t)throw new Error(e||"Failed assertion");}var L=t("base64-js"),R=t("ieee754");n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42;},42===e.foo()&&"function"==typeof e.subarray;}catch(t){return!1;}}(),i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1;}},i.isBuffer=function(t){return!(null==t||!t._isBuffer);},i.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=j(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=U(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding");}return n;},i.concat=function(t,e){if(P(F(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new i(0);if(1===t.length)return t[0];var n;if("number"!=typeof e)for(e=0,n=0;na&&(n=a):n=a,r=String(r||"utf8").toLowerCase()){case"hex":o=p(this,t,e,n);break;case"utf8":case"utf-8":o=d(this,t,e,n);break;case"ascii":o=h(this,t,e,n);break;case"binary":o=function(t,e,n,r){return h(t,e,n,r);}(this,t,e,n);break;case"base64":o=f(this,t,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":o=g(this,t,e,n);break;default:throw new Error("Unknown encoding");}return o;},i.prototype.toString=function(t,e,n){var r,i=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):n=i.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o=n,"sourceEnd < sourceStart"),P(e>=0&&e=0&&n=0&&r<=o.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),t.length-e=this.length))return this[t];},i.prototype.readUInt16LE=function(t,e){return y(this,t,!0,e);},i.prototype.readUInt16BE=function(t,e){return y(this,t,!1,e);},i.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e);},i.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e);},i.prototype.readInt8=function(t,e){if(e||(P(null!=t,"missing offset"),P(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t];},i.prototype.readInt16LE=function(t,e){return b(this,t,!0,e);},i.prototype.readInt16BE=function(t,e){return b(this,t,!1,e);},i.prototype.readInt32LE=function(t,e){return C(this,t,!0,e);},i.prototype.readInt32BE=function(t,e){return C(this,t,!1,e);},i.prototype.readFloatLE=function(t,e){return w(this,t,!0,e);},i.prototype.readFloatBE=function(t,e){return w(this,t,!1,e);},i.prototype.readDoubleLE=function(t,e){return _(this,t,!0,e);},i.prototype.readDoubleBE=function(t,e){return _(this,t,!1,e);},i.prototype.writeUInt8=function(t,e,n){n||(P(null!=t,"missing value"),P(null!=e,"missing offset"),P(e=this.length||(this[e]=t);},i.prototype.writeUInt16LE=function(t,e,n){I(this,t,e,!0,n);},i.prototype.writeUInt16BE=function(t,e,n){I(this,t,e,!1,n);},i.prototype.writeUInt32LE=function(t,e,n){A(this,t,e,!0,n);},i.prototype.writeUInt32BE=function(t,e,n){A(this,t,e,!1,n);},i.prototype.writeInt8=function(t,e,n){n||(P(null!=t,"missing value"),P(null!=e,"missing offset"),P(e=this.length||(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n));},i.prototype.writeInt16LE=function(t,e,n){x(this,t,e,!0,n);},i.prototype.writeInt16BE=function(t,e,n){x(this,t,e,!1,n);},i.prototype.writeInt32LE=function(t,e,n){T(this,t,e,!0,n);},i.prototype.writeInt32BE=function(t,e,n){T(this,t,e,!1,n);},i.prototype.writeFloatLE=function(t,e,n){$(this,t,e,!0,n);},i.prototype.writeFloatBE=function(t,e,n){$(this,t,e,!1,n);},i.prototype.writeDoubleLE=function(t,e,n){D(this,t,e,!0,n);},i.prototype.writeDoubleBE=function(t,e,n){D(this,t,e,!1,n);},i.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),"string"==typeof t&&(t=t.charCodeAt(0)),P("number"==typeof t&&!isNaN(t),"value is not a number"),P(n>=e,"end < start"),n!==e&&0!==this.length){P(e>=0&&e=0&&n<=this.length,"end out of bounds");for(var r=e;r";},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;ey?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a>>32-e;}(y(y(e,t),y(r,o)),i),n);}function h(t,e,n,r,i,o,a){return d(e&n|~e&r,t,e,i,o,a);}function f(t,e,n,r,i,o,a){return d(e&r|n&~r,t,e,i,o,a);}function g(t,e,n,r,i,o,a){return d(e^n^r,t,e,i,o,a);}function v(t,e,n,r,i,o,a){return d(n^(e|~r),t,e,i,o,a);}function y(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n;}var m=t("./helpers");e.exports=function(t){return m.hash(t,p,16);};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,n){(function(t,n,r,i,o,a,s,c,l){!function(){var t,n;t=function t(_t2){for(var e,n=new Array(_t2),r=0;r<_t2;r++){0==(3&r)&&(e=4294967296*Math.random()),n[r]=e>>>((3&r)<<3)&255;}return n;},this.crypto&&crypto.getRandomValues&&(n=function n(t){var e=new Uint8Array(t);return crypto.getRandomValues(e),e;}),e.exports=n||t;}();}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{buffer:3,lYpoI2:10}],8:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){function p(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n=Array(80),r=1732584193,i=-271733879,o=-1732584194,a=271733878,s=-1009589776,c=0;c>16)+(e>>16)+(n>>16)<<16|65535&n;}function g(t,e){return t<>>32-e;}var v=t("./helpers");e.exports=function(t){return v.hash(t,p,20,!0);};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){var p=t("./helpers"),d=function d(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n;},h=function h(t,e){return t>>>e|t<<32-e;},f=function f(t,e){return t>>>e;},g=function g(t,e,n){return t&e^~t&n;},v=function v(t,e,n){return t&e^t&n^e&n;},y=function y(t){return h(t,2)^h(t,13)^h(t,22);},m=function m(t){return h(t,6)^h(t,11)^h(t,25);},b=function b(t){return h(t,7)^h(t,18)^f(t,3);},C=function C(t){return h(t,17)^h(t,19)^f(t,10);},w=function w(t,e){var n,r,i,o,a,s,c,l,u,p,h=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),f=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),w=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var _=0;_0)&&n.shift()();},!0),function(t){n.push(t),window.postMessage("process-tick","*");};}return function(t){setTimeout(t,0);};}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=u,t.addListener=u,t.once=u,t.off=u,t.removeListener=u,t.removeAllListeners=u,t.emit=u,t.binding=function(t){throw new Error("process.binding is not supported");},t.cwd=function(){return"/";},t.chdir=function(t){throw new Error("process.chdir is not supported");};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process");},{buffer:3,lYpoI2:10}],11:[function(t,e,n){(function(t,e,r,i,o,a,s,c,l){n.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,c=(1<>1,u=-7,p=n?i-1:0,d=n?-1:1,h=t[e+p];for(p+=d,o=h&(1<<-u)-1,h>>=-u,u+=s;u>0;o=256*o+t[e+p],p+=d,u-=8){;}for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+t[e+p],p+=d,u-=8){;}if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),o-=l;}return(h?-1:1)*a*Math.pow(2,o-r);},n.write=function(t,e,n,r,i,o){var a,s,c,l=8*o-i-1,u=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),(e+=a+p>=1?d/c:d*Math.pow(2,1-p))*c>=2&&(a++,c/=2),a+p>=u?(s=0,a=u):a+p>=1?(s=(e*c-1)*Math.pow(2,i),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[n+h]=255&s,h+=f,s/=256,i-=8){;}for(a=a<0;t[n+h]=255&a,h+=f,a/=256,l-=8){;}t[n+h-f]|=128*g;};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754");},{buffer:3,lYpoI2:10}]},{},[1])(1);},t.exports=i();},function(t,e,n){"use strict";n.d(e,"a",function(){return o;});var r=n(2),i=function i(t){var e="api/admin/v2/s3/"+t;return Object(r.a)(e);},o={DB:{getDbTypes:function getDbTypes(){return Object(r.a)("api/admin/v2/datasources/dbtype");},getDatasources:function getDatasources(){return Object(r.a)("api/admin/v2/datasources");},getDatasource:function getDatasource(t){var e="api/admin/v2/datasources/"+t;return Object(r.a)(e);},addDatasource:function addDatasource(t){var e="api/admin/v2/datasources/"+t.datasourceName;return Object(r.b)(e,t);},updateDatasource:function updateDatasource(t){var e="api/admin/v2/datasources/"+t.datasourceName+"/update";return Object(r.b)(e,t);},deleteDatasource:function deleteDatasource(t){var e="api/admin/v2/datasources/"+t+"/delete";return Object(r.b)(e);}},Cloud:{getS3s:function getS3s(){return Object(r.a)("api/admin/v2/s3");},getS3:i,addS3:function addS3(t){var e="api/admin/v2/s3/"+t.datasourceName;return i(t.datasourceName).then(function(n){if(n)throw{errors:[{code:500,message:"Datasource name already exists."}]};return Object(r.b)(e,t);});},updateS3:function updateS3(t){var e="api/admin/v2/s3/"+t.datasourceName+"/update";return Object(r.b)(e,t);},deleteS3:function deleteS3(t){var e="api/admin/v2/s3/"+t+"/delete";return Object(r.b)(e);}}};},function(t,e,n){"use strict";n(0),n(2),n(9);var r=n(52);n.d(e,"a",function(){return r.a;});},function(t,e,n){"use strict";n(53),n(54);var r=n(55);n(56),n(57);n.d(e,"a",function(){return r.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 r;});var r=function r(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 r(){this.validateVersion={3.5:this.validateVersion3_5,3.6:this.validateVersion3_5};}n.d(e,"a",function(){return i;}),r.prototype.getValidateFunction=function(t){var e=this.validateVersion[t];return e||this.validateLegacy;},r.prototype.validate=function(t,e){return this.getValidateFunction(t.version)(t,e);},r.prototype.validateLegacy=function(t,e){var n="Invalid Model File.",r="",i=["data","control","visual","deeplearning"];"Report"===e&&(n="Invalid Report File.");try{if(t instanceof Array){var o=[];for(var a in t){if(void 0===t[a].mid||-1===i.indexOf(t[a].type)){r=n;break;}"visual"===t[a].type&&o.push(t[a]);}"Report"===e&&0===o.length?r=n:"Model"===e&&o.length>0&&(r=n);}else void 0===t.mid?r=t.jid?"Runnable Model File.":n:"Report"===e&&"visual"!==t.type||"Model"===e&&"visual"===t.type?r=n:-1===i.indexOf(t.type)&&(r=n);return r;}catch(t){return"Invalid Model(.json) File.";}},r.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 i=new r();},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var r=n(25);var i={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){r.a.hasMeta(t.fnUnit)?this.DATA_TYPE="object":this.DATA_TYPE="array";},o.prototype.getPrevFnUnitByTableId=function(t,e){var n=r.a.getPreviousFnUnits(t);for(var i in n){var o=n[i];if(r.a.getOutData(o).indexOf(e)>-1)return o;}},o.prototype.empty=function(t){t.appendTo.empty();},o.prototype.createLayout=function(t){var e=$('
');e.attr("autoArrange",t.autoArrange||!1);var n=$('
');e.append(n),t.appendTo.append(e);},o.prototype.createInputs=function(t){var e=this,n=r.a.getInputs(t.fnUnit);if(r.a.hasMeta(t.fnUnit))_.forEach(n,function(n,i){var o={type:r.a.getTypeByKey(t.fnUnit,i),tableId:n,key:i,fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!1};e.createInputUnit(o);});else{var i=r.a.getInRange(t.fnUnit).table.max;r.a.isFlexibleFunction(t.fnUnit)&&(i=r.a.getInTable(t.fnUnit).length);for(var o=0;o-1)return n[i];}}},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=$('
'),r=$('
'),i=$('
'),o=$('
');return n.append(r).append(i),i.append(o),r.find(".icon").attr("type",e),r.find(".brtc-label").text(t),n;},o.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('
'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").addClass("brtc-style-ellipsis"),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},o.prototype.createKeyItem=function(t){var e=$('
'),n=$('
'),r=$('
');return e.append(n).append(r),r.text(t.key),r.attr("title",t.key),n.append(this.createTypeIcon(t.type)),e;},o.prototype.createTypeIcon=function(t){return $('
').attr("type",t);},o.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('
'+e+"
");return n.append(o),i||this.createDropEvent(o,r),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 r=n.draggable,o=e.getMainArea($(this)),a=r.text(),s=e.validate(r,$(this));_.isEmpty(s)?(e.removeActivateClass($(this)),e.removeHoverClass($(this)),e.switchData(r,$(this)),e.handleChange($(this))):e.handleError(o,i[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)),r=t.closest("li").attr("table-id");for(var i in n){if(_.isEqual(n[i],r))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"),r=n.clone(),i=e.closest(".brtc-style-controls-inputselector-box-wrapper").find(".brtc-style-controls-inputselector-box-contents"),o=i.clone();return i.replaceWith(r),n.replaceWith(o),this.registerRemoveEvent(r.find(".brtc-va-tools-sidebar-variable-remove")),this.registerRemoveEvent(o.find(".brtc-va-tools-sidebar-variable-remove")),this.isEmptyBox(r)?this.disableDragEvent(r):this.enableDragEvent(r),this.isEmptyBox(o)?this.disableDragEvent(o):this.enableDragEvent(o),o;}var a=t.closest("li").attr("key"),s=t.closest("li").attr("label"),c=t.closest("li").attr("type"),l=t.closest("li").attr("func"),u=t.closest("li").attr("table-id"),p=this.createFuncItem({label:s,func:l,type:c,tableId:u}),d=this.createKeyItem({key:a,type:c}),h=e.closest(".brtc-style-controls-inputselector-box-wrapper"),f=h.find(".brtc-style-controls-inputselector-box-contents"),g=f.find(".brtc-va-editors-sheet-controls-inputselector-item"),v=f.find(".brtc-style-controls-inputselector-box-key-wrapper"),y=f.find(".brtc-va-fnunit-input-empty"),m=f.find(".brtc-va-tools-sidebar-variable-remove");y.hide(),e.show(),v.show(),m.show(),this.registerRemoveEvent(m),g.replaceWith(p),v.replaceWith(d),this.enableDragEvent(p),this.createDropEvent(h);},o.prototype.createRemoveButton=function(t){return $('');},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"),r=n.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=n.find(".brtc-style-controls-inputselector-box-key-wrapper"),o=n.find(".brtc-va-fnunit-input-empty");n.find(".brtc-va-tools-sidebar-variable-remove").hide(),i.hide(),r.hide(),o.show(),e.disableDragEvent(n),"true"===t.attr("autoArrange")&&e.autoArrange(n),e.handleRemove(t);});},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(),i=n.getPrevious(r.a.getId(t));return _.forEach(i,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),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o;}),n;},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 r(){}n.d(e,"a",function(){return i;}),r.prototype.create=function(t){return this.createUnit(t);},r.prototype.createUnit=function(t){var e=t.key,n=t.tableId,r=t.type,i=t.label,o=t.func,a=this.createBox(e);a.attr("key",e),a.attr("type",r),a.attr("label",i),a.attr("func",o),a.attr("table-id",n);var s=a.find(".brtc-style-controls-inputselector-box-contents"),c=s.find(".brtc-style-controls-inputselector-box-contents-figure"),l=s.find(".brtc-style-controls-inputselector-box-key"),u=this.createFuncItem({label:i,func:o,type:r,tableId:n}),p=this.createKeyItem({key:e,type:r});this.createRemoveButton();return c.append(u),l.append(p),a;},r.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);},r.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=FnUnitUtils.getPreviousFnUnits(t);for(var r in n){var i=FnUnitUtils.getOutData(n[r]);if(i&&i.indexOf(e)>-1)return n[r];}}},r.prototype.createBox=function(t){return this.createBoxWrapper(t);},r.prototype.createBoxWrapper=function(t){var e=$('
');e.css("width","100%"),e.css("height","55px");var n=$('
'),r=$('
');return e.append(n),n.append(r),e;},r.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('
'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},r.prototype.createKeyItem=function(t){var e=$('
'),n=$('
'),r=$('
');return e.append(n).append(r),r.text(t.key),n.append(this.createTypeIcon()),e;},r.prototype.createTypeIcon=function(){return $('
');},r.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('
'+e+"
");return n.append(o),i||this.createDropEvent(o,r),o;},r.prototype.getDropFuncTarget=function(t){return 1==t.find(".brtc-va-views-palette-fnunit").length?t.find(".brtc-va-views-palette-fnunit"):t;},r.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 r=e.getDropFuncTarget($(this));r.removeClass("brtc-style-droppable-active"),r.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 r=n.draggable,i=e.getDropFuncTarget($(this)),o=e.getMainArea($(this));i.removeClass("brtc-style-droppable-active"),i.removeClass("brtc-style-droppable-hover"),e.switchData(r,$(this));var a=e.getItems(o);o.trigger("change",[a]);}});},r.prototype.switchData=function(t,e){var n=t.closest("li").attr("key"),r=t.closest("li").attr("label"),i=t.closest("li").attr("type"),o=t.closest("li").attr("func"),a=t.closest("li").attr("table-id"),s=this.createFuncItem({label:r,func:o,type:i,tableId:a}),c=this.createKeyItem({key:n,type:i}),l=(e.hasClass("brtc-style-controls-inputselector-empty-fnunit"),e.closest(".brtc-style-controls-inputselector-box-wrapper")),u=l.find(".brtc-style-controls-inputselector-box-contents"),p=u.find(".brtc-va-editors-sheet-controls-inputselector-item"),d=u.find(".brtc-style-controls-inputselector-box-key-wrapper"),h=u.find(".brtc-va-fnunit-input-empty"),f=u.find(".brtc-va-tools-sidebar-variable-remove");h.hide(),e.show(),d.show(),f.show(),p.replaceWith(s),d.replaceWith(c),this.createDropEvent(l);},r.prototype.createRemoveButton=function(){var t=this,e=$('');return e.click(function(){var e=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),n=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.find(".brtc-style-controls-inputselector-box-key-wrapper"),i=e.find(".brtc-va-fnunit-input-empty");e.find(".brtc-va-tools-sidebar-variable-remove").hide(),r.hide(),n.hide(),i.show(),t.handleRemove($(this));}),e;},r.prototype.handleRemove=function(t){this.getMainArea(t).trigger("change",[this.getItems(t)]);},r.prototype.getPreviousFnUnits=function(t){var e=[],n=t.parent(),r=n.getPrevious(FnUnitUtils.getId(t));return _.forEach(r,function(t){e.push(n.getFnUnitById(t));}),e;},r.prototype.getMainArea=function(t){return t.closest(".brtc-va-editors-sheet-controls-input-list")||t;},r.prototype.getItems=function(t){var e=this.getMainArea(t).find(".brtc-style-controls-inputselector-box-wrapper"),n={};return _.forEach(e,function(t){var e=$(t),r=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),i=e.attr("key"),o=r.is(":visible")?r.attr("table-id"):"";n[i]=o;}),n;},r.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 i=new r();},function(t,e,n){"use strict";function r(){this.init();}n.d(e,"a",function(){return i;}),r.prototype.init=function(){this.board={};},r.prototype.add=function(t,e,n){this.board[t]={status:e,message:n};},r.prototype.remove=function(t){delete this.board[t];},r.prototype.get=function(t){return this.board[t];},r.prototype.refresh=function(){this.init();},r.prototype.show=function(t,e){this.get(t)&&e.attr("title",this.get(t).message);};var i=new r();},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var r={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 r=n(64);n.d(e,"a",function(){return r.a;});},function(t,e,n){"use strict";n.d(e,"a",function(){return g;});var r=n(10),i=n(24),o=n(8),a=n(9),s=n(27),c=n(28),l=n(65),u=n(26),p=n.n(u),d=n(3);var h={},f=[r.c,r.a,r.d];_.forEach(f,function(t){h[t.prototype.getResourceName()]={_constructor:t};});var g=new(/*#__PURE__*/function(){function _class(){}var _proto=_class.prototype;_proto.exportProject=function exportProject(t){var _this2=this;return i.a.fetchProject(t).then(function(e){return i.a.fetchFiles(t).then(function(e){return _this2._collectResources(e,t,!0);}).then(function(t){return _this2._exportProjectFromResources(e,t);});}).catch(function(t){console.error(t);});};_proto._collectResources=function _collectResources(t,e,n){var _this3=this;var r=_.isArray(t)?t:[t];return Promise.all(_.map(r,function(t){return n?_this3._getDependentResources(t,e):[t];})).then(function(t){return _this3._makeUnique(_.flatten(t));}).then(function(t){return _this3._appendMissedFiles(t,e);});};_proto.exportJSON=function exportJSON(t,e,n){return i.a.fetchFile(e,t).then(_.bind(this._collectResources,this,_,e,n)).then(_.bind(this._exportFilesFromResources,this)).catch(console.error);};_proto.exportJSONs=function exportJSONs(t,e,n){return Promise.all(_.map(t,_.bind(this.exportJSON,this,_,e,n))).catch(console.error);};_proto._exportFilesFromResources=function _exportFilesFromResources(t,e){return new c.a(t).toJSON();};_proto._exportProjectFromResources=function _exportProjectFromResources(t,e){return new s.a(t,e).toJSON();};_proto._appendMissedFiles=function _appendMissedFiles(t,e){return this._getMissedFile(t,e).then(function(e){return t.concat(e);});};_proto._traverseParamFunctions=function _traverseParamFunctions(t,e){var _this4=this;_.forEach(t,function(t){t.param.functions&&_this4._traverseParamFunctions(t.param.functions,e),e(t);});};_proto._getDependentResources=function _getDependentResources(t,e){var n=t.getContents(),r=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(!r.has(t.param.versionId))return i.a.fetchVersion(e,t.param.mid,t.param.versionId).then(function(e){return r.set(t.param.versionId,e),s(e);}).catch(_.noop);}else if(t.param.mid&&!r.has(t.param.mid))return i.a.fetchFile(e,t.param.mid).then(function(e){return r.set(t.param.mid,e),s(e);}).catch(_.noop);}else if("loadFromStaging"===t.func&&t.param.modelId&&!r.has(t.param.model))return i.a.fetchFile(e,t.param.modelId).then(function(e){return r.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(r.toArray()).concat([t]);});};_proto._makeUnique=function _makeUnique(t){var e=new o.a();return _.forEach(t,function(t){e.set(t.getHashCode(),t);}),e.toArray();};_proto._getMissedFile=function _getMissedFile(t,e){var n=new o.a();_.forEach(t,function(t){t instanceof r.a&&n.set(t.getFileId(),t);});var a=new o.a();return _.forEach(t,function(t){t instanceof r.d&&!n.has(t.getFileId())&&!a.has(t.getFileId())&&a.set(t.getFileId(),t.getFileId());}),Promise.all(_.map(a.toArray(),function(t){return i.a.fetchFile(e,t);}));};_proto._jsons2resource=function _jsons2resource(t){return _.map(t,function(t){return new(0,h[t.type]._constructor)(t.data);});};_proto._importResources=function _importResources(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 r.c)throw new Error("unexpected data");t instanceof r.a&&s.push(function(){return i.a.addFile(e,t);}),t instanceof r.d&&(t.setIsManual(!0),c.push(function(){return i.a.addVersion(e,t.getFileId(),t);}));});var l=function l(t){return function(){return Object(a.a)(t);};};return Object(a.b)([l([]),l(s),l(c)]);};_proto.checkPreviousFileSpec=function checkPreviousFileSpec(t){var e=!0;return"project"===t.type&&(e=!1),_.has(t,"version")&&(e=!1),e;};_proto.importJSONs=function importJSONs(t,e){var _this5=this;return function(t){return Promise.all(_.map(t,function(t){return"files"!==t.type?_this5.checkPreviousFileSpec(t)?l.a.convertFilesSpec(t,t.version):Promise.reject(new Error("invalid export file spec")):t.version!==d.CORE_VERSION?l.a.convertFilesSpec(t,t.version):t;}));}(t).then(function(t){return _.map(t,function(t){return _this5._jsons2resource(t.data);});}).then(_.flatten).then(this._makeUnique.bind(this)).then(function(t){return _this5._importResources(t,e);});};_proto.importJSON=function importJSON(t,e){return this.importJSONs([t],e);};_proto._collectVersionId=function _collectVersionId(t){var e=new o.a();return _.forEach(t,function(t){t instanceof r.d&&(e.has(t.getVersionId())||e.set(t.getVersionId(),p.a.version.id()));}),e;};_proto._collectModelId=function _collectModelId(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 r.a||t instanceof r.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;};_proto._remapProjectId=function _remapProjectId(t,e){_.forEach(t,function(t){t instanceof r.a&&t.setProjectId(e);});};_proto._remapFileAndVersionId=function _remapFileAndVersionId(t,e,n){var i=function i(t,r){_.forEach(r.functions,function(r){"Flow"===r[FUNCTION_NAME]&&(r.param.mid&&(r.param.mid=e.get(r.param.mid)||r.param.mid),r.param.versionId&&(r.param.versionId=n.get(r.param.versionId)||r.param.versionId)),"DataViewer"===r[FUNCTION_NAME]&&(r.param.mid=e.get(r.param.mid)),"If"===r[FUNCTION_NAME]&&(r.param.if.mid=e.get(r.param.if.mid)||r.param.if.mid,_.forEach(r.param.elseif,function(t){t.mid=e.get(t.mid)||t.mid;}),r.param.else.mid=e.get(r.param.else.mid)||r.param.else.mid),"ForLoop"!==r[FUNCTION_NAME]&&"WhileLoop"!==r[FUNCTION_NAME]||(r.param.mid=e.get(r.param.mid)||r.param.mid);var o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,r);_.forEach(o,_.partial(i,t,_));});};_.forEach(t,function(t){if(t instanceof r.a||t instanceof r.d){t.setFileId(e.get(t.getFileId())),t.getContents().mid=t.getFileId(),t instanceof r.d&&(t.setVersionId(n.get(t.getVersionId())),t.getContents().version_id=t.getVersionId()),t instanceof r.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 r={};return t.mid=e.get(n)||n,r[t.mid]=t,r;}),_.merge,{});_o.innerModels=_a,i(_o,_o);}});};_proto._changePrevKeys=function _changePrevKeys(t){var e={fidCache:{},tidCache:{}};_.forEach(t,function(t){if(t instanceof r.a||t instanceof r.d){var _n2=t.getContents();Brightics.VA.Core.Utils.ModelUtils.createCacheNestedFlow(_n2,_n2,e);}}),_.forEach(t,function(t){if(t instanceof r.a||t instanceof r.d){var _n3=t.getContents(),_r2=Brightics.VA.Core.Utils.ModelUtils.setKeyNestedFlow(_n3,_n3,e);t.setContents(_r2);}});};_proto.preprocessProjectJson=function preprocessProjectJson(t){return"project"===t.type&&t.version===d.CORE_VERSION?Promise.resolve(t):l.a.convertProjectSpec(t,t.version);};_proto.importProject=function importProject(t){return this.preprocessProjectJson(t).then(function(t){var _this6=this;var e=new r.c(t.data),n=p.a.project.id();e.setProjectId(n);var o=this._jsons2resource(t.children);return i.a.addProject(e).then(function(){return i.a.fetchProject(n);}).then(function(t){return _this6._importResources(o,n);}).then(function(){return n;}).catch(function(t){console.error(t);});}.bind(this));};_proto.validateExportedProjectSpec=function validateExportedProjectSpec(t){try{return this.preprocessProjectJson(t);}catch(t){return Promise.reject(t);}};_proto.duplicateFile=function duplicateFile(t,e,n,r,i,o){var _this7=this;return this.exportJSON(t,e,r).then(function(e){var r=_.cloneDeep(e);return function(e){e.data=_.map(e.data,function(e){return"file"===e.type&&e.data.id===t?e.data.label=o:e.data.label+="_"+i,e;});}(r),_this7.importJSON(r,n);}).catch(function(t){console.error(t);});};_proto.calcTableIdLinks=function calcTableIdLinks(t){var e=[],n=function n(t,r){_.forEach(r.functions,function(i){"DataViewer"===i[FUNCTION_NAME]&&_.forEach(i[OUT_DATA],function(t){e.push({source:["",Brightics.VA.Env.Session.userId,i.param.mid,i[OUT_DATA]].join("/"),alias:["",Brightics.VA.Env.Session.userId,r.mid,i[OUT_DATA]].join("/")});});var o=Brightics.VA.Core.Utils.NestedFlowUtils.getSubModels(t,i);_.forEach(o,_.partial(n,t,_));});};return _.forEach(t,function(t){if(t instanceof r.a||t instanceof r.d){var _e=t.getContents();n(_e,_e);}}),e;};return _class;}())();},function(t,e,n){"use strict";n.d(e,"a",function(){return a;});var r=n(10),i=n(28),o=n(27);var a=function(){var t=function t(_t3,e){var n=$.ajax({url:"api/va/v2/convert/store",type:"POST",data:JSON.stringify({contents:_t3,version:e}),contentType:"application/json; charset=utf-8"});return Promise.resolve(n).then(function(t){return t.contents;}).catch(function(e){throw e.responseJSON.errors[0].mid=_t3.mid,e;});},e=function e(t){return new r.a(t);},n=function n(t){return new r.d(t);};return{convertFilesSpec:function convertFilesSpec(o,a){var s=function s(t){return t.data.map(_.property("data"));},c=a?s(o).map(_.property("contents")):_.isArray(o)?o:[o];return Promise.all(_.map(c,function(e){return t(e,a);})).then(function(t){var c=a?function(t){return _.zip(s(o),t).map(function(_ref2){var t=_ref2[0],r=_ref2[1];return(r.version_id?n:e)(Object.assign({},t,{contents:r}));});}:function(t){return t.map(function(t){return(t.version_id?function(t){var e=new r.d().setVersionId(t.version_id).setFileId(t.mid).setLabel(t.title).setTags(t.versionTags).setDescription(t.versionDescription).setType(t.type).setMajorVersion(_.has(t,"majorVersion")?t.majorVersion:t.major_version).setMinorVersion(_.has(t,"minorVersion")?t.minorVersion:t.minor_version).setCreator(Brightics.VA.Env.Session.userId).setIsManual(!0);return e.setContents(_.omit(t,["versionId","versionTags","versionDescription","majorVersion","minorVersion"])),e;}:function(t){return new r.a().setFileId(t.mid).setLabel(t.title).setDescription("").setCreator(Brightics.VA.Env.Session.userId).setContents(t);})(t);});};return new i.a(c(t)).toJSON();});},convertProjectSpec:function convertProjectSpec(i,a){var _ref3=function(){if(!a){var _t4=function _t4(t){return _.merge({contents:{gv:[]}},t);};return[i[0].files.map(_t4),i[0].versions.map(_t4),new r.c(_.omit(i[0],["files","versions"]))];}var _$partition$map=_.partition(i.children,_.matchesProperty("type","file")).map(function(t){return t.map(_.property("data"));}),t=_$partition$map[0],e=_$partition$map[1];return[t,e,new r.c(i.data)];}(),s=_ref3[0],c=_ref3[1],l=_ref3[2],u=function u(e){return function(n){return(r=n,t(r.contents,a).then(function(t){return _.assign({},r,{contents:t});})).then(e);var r;};};return Promise.all([].concat(_.map(s,u(e)),_.map(c,u(n)))).then(function(t){return new o.a(l,t).toJSON();});}};}();},function(t,e,n){"use strict";n.d(e,"b",function(){return r;}),n.d(e,"d",function(){return o;}),n.d(e,"a",function(){return a;}),n.d(e,"c",function(){return s;});var r=function r(t,e){return e instanceof Array?function(t,e){try{for(var n=-1,r=e.length,i=t;++n=r.timeout||n.emit(t,_.assign({},r,{value:e(r),timestamp:i,responseKey:"res_"+i}));}});},i.prototype.on=function(t,e){this.ee.on("_TAB_CH_"+t,e);},i.prototype.off=function(t,e){this.ee.off("_TAB_CH_"+t,e);},i.prototype.emit=function(t,e){localStorage.setItem("_TAB_CH_"+t,JSON.stringify(e));};},function(t,e,n){"use strict";n.d(e,"a",function(){return r;});var r={integertype:{type:"number",internalType:"Integer"},longtype:{type:"number",internalType:"Long"},doubletype:{type:"number",internalType:"Double"},booleantype:{type:"string",internalType:"Boolean"},stringtype:{type:"string",internalType:"String"},"arraytype(doubletype)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype)":{type:"number[]",internalType:"Long[]"},"arraytype(booleantype)":{type:"string[]",internalType:"Boolean[]"},"arraytype(stringtype)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype)":{type:"byte[]",internalType:"Byte[]"},"arraytype(doubletype,true)":{type:"number[]",internalType:"Double[]"},"arraytype(longtype,true)":{type:"number[]",internalType:"Long[]"},"arraytype(stringtype,true)":{type:"string[]",internalType:"String[]"},"arraytype(bytetype,true)":{type:"byte[]",internalType:"Byte[]"},"maptype(integertype,doubletype)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype)":{type:"map",internalType:"Map(String,Double)"},"maptype(integertype,doubletype,true)":{type:"map",internalType:"Map(Integer,Double)"},"maptype(stringtype,doubletype,true)":{type:"map",internalType:"Map(String,Double)"},"maptype(stringtype,stringtype,true)":{type:"map",internalType:"Map(String,String)"},timestamptype:{type:"date",internalType:"Date"},timestamp:{type:"date",internalType:"Date"},date:{type:"date",internalType:"Date"},string:{type:"string",internalType:"String"},double:{type:"number",internalType:"Double"},boolean:{type:"string",internalType:"Boolean"},long:{type:"number",internalType:"Long"},int:{type:"number",internalType:"Integer"},integer:{type:"number",internalType:"Integer"},"array(string)":{type:"string[]",internalType:"String[]"},"array(double)":{type:"number[]",internalType:"Double[]"},"array(long)":{type:"number[]",internalType:"Long[]"},"array(int)":{type:"number[]",internalType:"Integer[]"},"array(integer)":{type:"number[]",internalType:"Integer[]"},"map(integer,double)":{type:"map",internalType:"Map(Integer,Double)"},"map(string,double)":{type:"map",internalType:"Map(String,Double)"},"map(int,double)":{type:"map",internalType:"Map(Integer,Double)"},tinyint:{type:"byte",internalType:"Byte"},float:{type:"number",internalType:"Float"},bigint:{type:"number",internalType:"Long"},smallint:{type:"short",internalType:"Short"},"array":{type:"string[]",internalType:"String[]"},"array":{type:"number[]",internalType:"Double[]"},"array":{type:"number[]",internalType:"Long[]"},"array":{type:"number[]",internalType:"Integer[]"},"array":{type:"number[]",internalType:"Integer[]"},"array":{type:"byte[]",internalType:"Byte[]"},"map":{type:"map",internalType:"Map(Integer,Double)"},"map":{type:"map",internalType:"Map(String,Double)"},"map":{type:"map",internalType:"Map(Integer,Double)"}};},function(t,e,n){"use strict";e.a=function(t,e){return o(a(t),a(e));};var r="__brtc__model__sync__";function i(t,e){var n={};return n[t]=e,n;}function o(t,e){var _ref4;if(t===e)return{};var n=_.isArray(t),a=_.isArray(e);if(n&&a)return function(t,e){var n=Math.max(t.length,e.length);return _.range(n).reduce(function(n,a){var _i2,_i3;if(!_.has(t,a))return _.merge(n,i(a,(_i2={},_i2[r]=!0,_i2.action="add",_i2.val=e[a],_i2)));if(!_.has(e,a))return _.merge(n,i(a,(_i3={},_i3[r]=!0,_i3.action="remove",_i3)));var s=o(t[a],e[a]);return _.isObject(s)&&_.isEmpty(s)?n:_.merge(n,i(a,s));},{});}(t,e);if(n||a||!_.isObject(t)||!_.isObject(e))return _ref4={},_ref4[r]=!0,_ref4.action="update",_ref4.val=e,_ref4;var s=_.union(_.keys(t),_.keys(e));return _.reduce(s,function(n,a){var _i4,_i5;if(!_.has(t,a))return _.merge(n,i(a,(_i4={},_i4[r]=!0,_i4.action="add",_i4.val=e[a],_i4)));if(!_.has(e,a))return _.merge(n,i(a,(_i5={},_i5[r]=!0,_i5.action="remove",_i5)));var s=o(t[a],e[a]);return _.isObject(s)&&_.isEmpty(s)?n:_.merge(n,i(a,s));},{});}function a(t){return _.reduce(t,function(t,e,n){return _.isFunction(e)?t:(t[n]=e,t);},{});}}]),function(){"use strict";var t=window.__module__;this.Brightics=this.Brightics||{};var e=this.Brightics,n=brtc_require("FnUnitUtils"),r=brtc_require("ENV");$.extend(!0,this.Brightics,{VA:{Core:{Interface:{Clazz:{},Label:{},Editor:{},ModelLayoutManager:{},Toolbar:{},SideBarManager:{},RightSideBarAdapter:{},LeftSideBarAdapter:{},Validator:{},Launcher:{},LauncherDialog:{},Functions:{},WidgetUtils:{},DefaultModel:{},ProjectContextMenuList:{},Clipboard:{},RunnableFactory:{},AddonFunctionUtil:{}},Components:{Base:{}},Controls:{},Default:{},Dialogs:{FunctionProperties:{},RefineSteps:{}},Editors:{Diagram:{Commands:{ControlEditor:{}}},Sheet:{Controls:{Optimization:{}},Commands:{},Panels:{Properties:{}}}},Functions:{Library:{}},Shapes:{},Tools:{MenuBar:{},Adapter:{},Manager:{},ModelMigrator:{Executor:{},RuleList:{}}},Utils:{},Views:{Pages:{}},Widget:{Controls:{}},Wizards:{Pages:{}},Validator:{},AddonFunctionManager:{}},Implementation:{},Window:{Utils:{}},Controls:t.Controls,Dao:t.Dao,DataStructures:t.DataStructures,Default:{},Dialogs:{},Setting:{Registry:{},Implement:{}},Env:{Session:{},Recommend:{}},Utils:{},Views:{},Workspace:{},Log:{},EventEmitter:t.EventEmitter,ClassUtils:t.ClassUtils,Vo:t.Vo},Admin:{},COMMUNITY:{}}),this.Brightics.VA.Core.Utils.IDGenerator=t.IDGenerator,this.Brightics.VA.Env.Theme="office",this.Brightics.VA.Env.CoreVersion=r.CORE_VERSION,this.Brightics.VA.Env.Diagram={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:40},this.Brightics.VA.Env.DiagramInit={PAPER_MARGIN_TOP:20,PAPER_MARGIN_LEFT:20,FIGURE_WIDTH:195,FIGURE_HEIGHT:60,GAP_WIDTH:55,GAP_HEIGHT:20},this.Brightics.VA.Env.Multiplicity={Zero:"0",geZero:"0..*",One:"1",geOne:"1..*"},this.Brightics.VA.Env.Recommend.NextChart={load:["table","scatter"],associationRule:["table","network"],bigDataScatter:["scatter","table"],bigDataLine:["line","table"],bigDataBoxPlot:["boxplot","table"],bigDataColumn:["column","table"],bigDataBar:["bar","table"]},this.Brightics.VA.Env.Recommend.Next={data:{default:["load","createTable","brightics.function.io$load13889","brightics.function.io$read_csv97059"],mdReplaceNumber:["mdReplaceString","imputeNumberTypeFillColumn","numericalVariableDerivation"],mdReplaceString:["mdReplaceNumber","imputeStringTypeFillColumn"],numericalVariableDerivation:["conditionalUpdate","conditionalDerivation"],conditionalDerivation:["conditionalUpdate"],conditionFilter:["minmaxFilter","lengthFilter","stringFilter"],lengthFilter:["stringFilter","conditionFilter","minmaxFilter"],minmaxFilter:["conditionFilter","stringFilter","lengthFilter"],stringFilter:["lengthFilter","conditionFilter","minmaxFilter"],imputeNumberTypeFillColumn:["mdReplaceNumber","numericalVariableDerivation"],imputeRemoveLine:["mdReplaceNumber","mdReplaceString"],imputeStringTypeFillColumn:["mdReplaceString"],join:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],changeColumnName:["capitalizeColName"],frequency:["join"],frequencyMat:["join"],statisticSummary:["join"],capitalizeColName:["changeColumnName"],linearRegressionTrain:["linearRegressionPredict"],linearRegressionPredict:["regressionEvaluation"],logisticRegressionTrain:["logisticRegressionPredict"],logisticRegressionPredict:["binaryClassEvaluation"],movingAverage:["ewma"],pivot:["imputeRemoveLine","imputeNumberTypeFillColumn","imputeStringTypeFillColumn"],hierarchicalClustering:["hierarchicalClusteringPostProcess"],timeSeriesTranspose:["timeSeriesDistance"],quantileDiscretizer:["typeCast"],reorganizeTable:["changeColumnName","capitalizeColName"]},realtime:{default:["streamingRead"]},etl:{default:["erdTSum","fabData","ept"]},deeplearning:{default:["dlLoad","conv2D","maxPooling2D"]},getList:function 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 r=e.VA.Core.Utils.WidgetUtils.getFunctionLibrary(this.type,t),i={fid:e.VA.Core.Utils.IDGenerator.func.id()};if("ifElse"===t)i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()},{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}};else if("outData"===t){var o=e.VA.Core.Utils.IDGenerator.func.id(),a=e.VA.Core.Utils.IDGenerator.func.id(),s="/brtc/repo/tmp/"+e.VA.Core.Utils.IDGenerator.file.id();i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:o,param:{"fs-paths":[s]}},{fid:a,param:{"input-path":s,"output-path":s+".csv"}}],links:[{kid:e.VA.Core.Utils.IDGenerator.link.id(),sourceFid:o,targetFid:a}]}};}else"refine"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"dbReader"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"load"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"Subflow"===r.defaultFnUnit[FUNCTION_NAME]?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{functions:[{fid:e.VA.Core.Utils.IDGenerator.func.id()}]}}:"if"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{if:$.extend(!0,r.defaultFnUnit.param.if,{mid:e.VA.Core.Utils.IDGenerator.model.id()}),elseif:[],else:$.extend(!0,r.defaultFnUnit.param.else,{mid:e.VA.Core.Utils.IDGenerator.model.id()})}}:"forLoop"===t?i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"count",prop:{start:"${=}",end:"${=}","index-variable":""}}}:"whileLoop"===t&&(i={fid:e.VA.Core.Utils.IDGenerator.func.id(),param:{mid:e.VA.Core.Utils.IDGenerator.model.id(),type:"while",prop:{expression:"${=}","index-variable":""}}});if(r.defaultFnUnit.outputs||r.defaultFnUnit.outData){var c=n.createOutData(this.type,t);$.extend(i,c),"refine"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid]):"dbReader"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]}):"load"===t?(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.functions[0].param={"df-names":[i[OUT_DATA][0]]},i.param.entries=[i.param.functions[0].fid]):"Subflow"===r.defaultFnUnit[FUNCTION_NAME]&&(i.param.functions[0][OUT_DATA]=i[OUT_DATA],i.param.entries=[i.param.functions[0].fid]);}return $.extend(!0,{"persist-mode":"auto"},r.defaultFnUnit,i);},addFnUnit:function 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 r=this.functions[n];if(r.fid==t){e=n,delete r.parent;break;}}if(e>-1){var i=this.functions[e];return this.functions.splice(e,1),i;}},getFnUnitById:function 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 r=e[n];if(r.param&&r.param.functions){var i=this.getFnUnitNameById(t,r.param.functions);if(i)return r.func+"."+i;}if(r.fid==t)return r.func;}},existsFnUnit:function 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 r in n.param.functions){if(n.param.functions[r].fid==t)return n;}}},getFnUnitByOutTable:function getFnUnitByOutTable(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutTable(r);if($.inArray(t,i)>-1)return r;}},getFnUnitByOutData:function getFnUnitByOutData(t){for(var e in this.functions){var r=this.functions[e],i=n.getOutData(r);if($.inArray(t,i)>-1)return r;}},getLinkUnitById:function 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 r in n){e=e.concat(this.getRoots(n[r]));}return e;},getParents:function getParents(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&(e.push(r[SOURCE_FID]),e=e.concat(this.getParents(r[SOURCE_FID])));}return e;},getPrevious:function getPrevious(t){var e=[];for(var n in this.links){var r=this.links[n];r[TARGET_FID]==t&&e.push(r[SOURCE_FID]);}return e;},getPreFnUnitByCondition:function getPreFnUnitByCondition(t,e){var n=this.getPrevious(t);for(var r in n){var i=this.getFnUnitById(n[r]);if(e(i))return i;}},getNext:function getNext(t){var e=[];for(var n in this.links){var r=this.links[n];r[SOURCE_FID]==t&&e.push(r[TARGET_FID]);}return e;},getLeafs:function 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 r=this.links[n];r[SOURCE_FID]!=t&&r[TARGET_FID]!=t||e.push(r);}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 r=this.links[t];(e.indexOf(r[SOURCE_FID]||r["source-fid"])<0||e.indexOf(r[TARGET_FID]||r["target-fid"])<0)&&n.push(r);}for(t in n){this.links.splice(this.links.indexOf(n[t]),1);}},getAllPreviousFnUnitIds:function getAllPreviousFnUnitIds(t){var n=this.getPrevious(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllPreviousFnUnitIds(n);return t.concat(o);}return t.concat(n);},[]));},getAllNextFnUnitIds:function getAllNextFnUnitIds(t){var n=this.getNext(t),r=this;return _.unique(n.reduce(function(t,n){var i=r.getFnUnitById(n);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(i)){var o=r.getAllNextFnUnitIds(n);return t.concat(o);}return t.concat(n);},[]));},getAllPreviousFnUnits:function 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,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getPrevious(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkSourceFnUnits(e));},[r]),"fid");}return[r];},getLinkTargetFnUnits:function getLinkTargetFnUnits(t){var n=this,r=this.getFnUnitById(t);if(e.VA.Core.Utils.NestedFlowUtils.isProcessFunction(r)){var i=this.getNext(t);return _.unique(i.reduce(function(t,e){return t.concat(n.getLinkTargetFnUnits(e));},[r]),"fid");}return[r];}},this.Brightics.VA.Default.analyticsModel={type:"data",sheets:[],param:{},functions:[],links:[],preferences:{},problemList:[],report:{title:"Report",data:[]},inVariableList:function 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 r=this.inVariableList(t);if(r>-1)this.variableRef[r].param[e]=n;else{var i={fid:t,param:{}};i.param[e]=n,this.variableRef.push(i);}},setVariable:function setVariable(t,e,n){var r=this.inVariableList(t);r>-1&&this.variableRef[r].param[e]&&(this.variableRef[r].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 r="";if(n){var i=new Date();i.setTime(i.getTime()+24*n*60*60*1e3),r="expires="+i.toUTCString();}document.cookie=t+"="+e+"; "+r;},getCookie:function getCookie(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r=0?"Chrome":document.documentMode?"Internet Explorer":!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0?"Opera":"undefined"!=typeof InstallTrigger?"Firefox":Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||"[object SafariRemoteNotification]"===(!window.safari||safari.pushNotification).toString()?"Safari":void 0;},downloadJsonFile:function downloadJsonFile(t,e){var n=this.getUserBrowserName(),r=new Blob([t],{type:"text/json;charset=utf-8;"});if("Internet Explorer"===n)window.navigator.msSaveBlob(r,e+".json");else{var i=URL.createObjectURL(r),o=document.createElement("a");o.setAttribute("href",i),o.setAttribute("download",e+".json"),o.click(),URL.revokeObjectURL(i);}},numberToStringWithComma:function 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,r=e.replace("[]","");switch(r){case"String":n="S";break;case"Integer":n="I";break;case"Long":n="L";break;case"Double":n="Db";break;case"Date":n="Dt";break;case"Boolean":n="Bl";break;case"Byte":n="Bt";break;default:n=r;}return"Array("+n+")";}return"map"===t?"Map":e;},convertDataTypeForTitle:function 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 r=e.indexOf("."),i=e.slice(0,r).indexOf(t.USER_INPT_ARR_DELIMETER);if(i>-1){var o=[],a=n[e.substring(0,i)];if(a)for(var s=0;s-1&&o.push(this.fetchFromObject(e.substr(i+4),a[s]));}return o.length>0?o:a;}return r>-1?this.fetchFromObject(e.substr(r+1),n[e.substring(0,r)]):n[e];}catch(t){console.error(e),console.error(t);}},isPC:function 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=Array.isArray(e)?e.reduce(function(t,e,n,r){return t=t&&t[e]?t[e]:void 0;},t):t[e];return Array.isArray(n)?$.extend(!0,[],n):"object"==typeof n?$.extend(!0,{},n):n;},removeArrayElement:function removeArrayElement(t,e){_.remove(t,function(t){return e.indexOf(t)>-1;});},dim:function dim(t,n){var r=$((n||{}).appendTo||document.body),i=Promise.resolve().then(function(){return"function"==typeof t?t():t;}),o=$(e("div",{class:"brtc-dim"},e("div",{class:"brtc-dim-text brtc-style-apper-1sendond"},e("i",{class:"fa fa-spinner fa-pulse fa-5x fa-fw"}))));return r.append(o),i.then(function(t){return o.remove(),t;}).catch(function(t){throw o.remove(),t;});},progress:function progress(t,e){var n=e||{},r=e.showPercent||!1,i=e.msg||"",o=$(n.appendTo||document.body),a=Promise.resolve().then(function(){return"function"==typeof t?t():t;}),s=$('

'+i+"

"+(r?'

':"")+"
");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";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",r=this.closestEditor(t,n);return this.getData(r,"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 r,i,o=$('
'),a=$('
');o.append(a);var s=!1,c=Brightics.VA.Core.Interface.WidgetUtils[n];if(c&&c.createPaletteItem){var l=c.createPaletteItem(e);r=l.label,i=l.category;}else{var u="",p="",d="scala";void 0===Brightics.VA.Core.Interface.Functions[n][e]?(u="none",p="none"):(u=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.display.label,p=Brightics.VA.Core.Interface.Functions[n][e].category,s=s||Brightics.VA.Core.Interface.Functions[n][e].deprecated,d=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context||d),r=u,i="brtc-va-fnunit-category-"+p;}return a.attr("title",r),"udf"!==p&&a.attr("context",d).attr("category",p),a.find(".brtc-va-views-palette-fnunit-label").text(r),s&&(r+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),a.attr("title",r),s&&a.addClass("deprecated"),a.addClass(i),t.append(o),this.putData(a,"func",e),a;},createPaletteUDFItem:function createPaletteUDFItem(t,e,n,r){var i,o,a=$('
'),s=$('
');a.append(s);var c=!1,l=Brightics.VA.Core.Interface.WidgetUtils[n];if(l&&l.createPaletteItem){var u=l.createPaletteItem(e);i=u.label,o=u.category;}else{var p="",d="",h="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,h=Brightics.VA.Core.Interface.Functions[n][e].defaultFnUnit.context),i=p,o="brtc-va-fnunit-category-"+d;}return s.attr("title",i),"udf"!==d&&s.attr("context",h),s.find(".brtc-va-views-palette-fnunit-label").text(i),c&&(i+="\nDeprecated: "+Brightics.VA.Core.Interface.Functions[n][e]["deprecated-message"]),s.attr("title",i),s.find(".brtc-va-views-palette-fnunit-remove-icon").on("click",function(e){e.stopPropagation();var n={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,n);}),s.find(".brtc-va-views-palette-fnunit-remove-icon").hide(),s.mouseover(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").show();}),s.mouseout(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").hide();}),c&&s.addClass("deprecated"),s.addClass(o),t.append(a),this.putData(s,"func",e),s;},createPaletteBox:function createPaletteBox(t){var e,n=$('
'),r=$('
');n.append(r);var i=Brightics.VA.Core.Interface.WidgetUtils.data;if(i&&i.createPaletteItem){e=i.createPaletteItem(t.func).category;}else{var o="",a="scala";void 0===Brightics.VA.Core.Interface.Functions.data[t.func]?o="none":(o=Brightics.VA.Core.Interface.Functions.data[t.func].category,a=Brightics.VA.Core.Interface.Functions.data[t.func].defaultFnUnit.context),e="brtc-va-fnunit-category-"+o;}return r.attr("title",t.label),r.find(".brtc-va-views-palette-fnunit-icon").attr("context",a||"scala"),r.find(".brtc-va-views-palette-fnunit-label").text(t.label),r.addClass(e),this.putData(r,"func",t.func),r;},createTableItem:function createTableItem(t,e){var n=$('
'),r=$('
'+e.type.substring(0,1)+'
');return n.append(r),r.attr("title",e.label),r.find(".brtc-style-views-table-label").text(e.label),t.append(n),r;},createKeyItem:function createKeyItem(t){var e=$('
'),n=$('
');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=$('
');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,r){this.createCommonConfirmWithOptionDialog($("body"),{title:t,type:"info",isCancel:!0,contentText:e,optionText:n,close:r});},checkAgentStatus:function checkAgentStatus(){return $.ajax({url:"api/va/v2/analytics/agentuser/status",blocking:!1,type:"GET"});},createProgressDialog:function createProgressDialog(t,e){var n,r={OK:!1,Cancel:!0},i=$('
Please try again later.
');t.append(i),i.find(".brtc-va-dialogs-body-content-content-text").css("display","none"),i.find(".brtc-va-dialogs-body-content-icon").css("display","none"),(n=i.find(".brtc-va-dialogs-buttonbar-ok")).css("display","none");var o={theme:Brightics.VA.Env.Theme,width:400,height:280,title:e.title,modal:!0,resizable:!1,showCloseButton:!1,open:function open(){n.jqxButton({theme:Brightics.VA.Env.Theme}),n.click(function(){r={OK:!0,Cancel:!1},i.dialog("close");});},close:function close(){i.dialog("destroy"),i.remove(),"function"==typeof e.close&&e.close(r);},focus:function focus(){},keyboardCloseKey:""};return i.dialog(o),i.attr("name",o.title),i;},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 r=this,i=this.createProgressDialog($("body"),{title:"Preparing workspace...",close:e}),o=0,a=function a(){var t=function t(){i.find(".brtc-va-progress").css("display","none"),i.find(".brtc-va-dialogs-body-content-content-text").css("display","block"),i.find(".brtc-va-dialogs-body-content-icon").css("display","block"),i.find(".brtc-va-dialogs-buttonbar-ok").css("display","block");};o++,r.checkAgentStatus().done(function(e){"STOP"===e?o>30?(clearTimeout(r.timer),t()):(clearTimeout(r.timer),r.timer=setTimeout(a,2e3)):(clearTimeout(r.timer),t());}).fail(function(e){clearTimeout(r.timer),t();});};clearTimeout(r.timer),r.timer=setTimeout(a,2e3);}else n&&n.errors?this.openErrorDialog(n,e):this.openErrorDialog("Sorry! An unexpected error occurred. Please contact administrator.",e);}else"function"==typeof e&&e({OK:!1,Cancel:!0});},openErrorDialog:function openErrorDialog(t,e){var n,r,i;"string"==typeof t?n=this.codeToMessage(t):t.errors&&Array.isArray(t.errors)&&((n=t.errors[0].message)||(n="Sorry! An unexpected error occurred. Please contact administrator."),0==n.indexOf("SparkException:")||0==n.indexOf("NoClassDefFoundError:")?n="Sorry! An unexpected error occurred. Please contact administrator.":0==n.indexOf("Exception:")?n=n.substring(10,msg.length).trim():0==n.indexOf("AnalysisException:")?n=n.substring(18,msg.length).trim():0==n.indexOf("InvalidInputException:")&&(n="Input path does not exist."),n.indexOf("Not allowed condition")>-1&&(n="Can not update. Check schedule status."),t.errors[0].detailMessage&&(r=t.errors[0].detailMessage),t.errors[0].contentType&&(i=t.errors[0].contentType));var o=this;clearTimeout(this.openError),this.openError=setTimeout(function(){o.createCommonConfirmDialog($("body"),{type:"error",isCancel:!1,contentText:n,close:e,detailText:r,detailContentType:i});},500);},openInformationDialog:function 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,r,i,o={OK:!1,Cancel:!0},a=$('
');t.append(a),n=a.find(".brtc-va-dialogs-buttonbar-ok"),e.okLabel&&n.val(e.okLabel),e.isCancel&&(r=$(''),a.find(".brtc-va-dialogs-buttonbar").append(r),e.cancelLabel&&r.val(e.cancelLabel)),e.detailText&&(i=$(''),a.find(".brtc-va-dialogs-buttonbar").append(i));var s=this,c={theme:Brightics.VA.Env.Theme,width:400,height:210,modal:!0,resizable:!1,cancelButton:r,open:function 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&&(r.jqxButton({theme:Brightics.VA.Env.Theme}),r.click(function(){o={OK:!1,Cancel:!0},a.dialog("close");})),e.detailText&&(i.jqxButton({theme:Brightics.VA.Env.Theme}),i.click(function(){if(e.detailContentType&&e.detailContentType.startsWith("text/html")){window.open("/detail-popup","Detail Information",["width=800","height=600","menubar=no","status=no","toolbar=no","location=no"].join(",")).document.write(e.detailText);}else new Brightics.VA.Core.Dialogs.DetailDialog(a,{title:"Detail Information",detailText:e.detailText});}));},close:function 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 r in t.errors){(e=t.errors[r].message)||(e="Sorry! An unexpected error occurred. Please contact administrator."),0==e.indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e.indexOf("Not allowed condition")>-1&&(e="Can not update. Check schedule status."),n+=e+"\n";}return n;}return"string"==typeof t?(0==(e=t).indexOf("SparkException:")||0==e.indexOf("NoClassDefFoundError:")?e="Sorry! An unexpected error occurred. Please contact administrator.":0==e.indexOf("Exception:")?e=e.substring(10,e.length).trim():0==e.indexOf("AnalysisException:")?e=e.substring(18,e.length).trim():0==e.indexOf("InvalidInputException:")&&(e="Input path does not exist."),e):t;},convertHTMLSpecialChar:function convertHTMLSpecialChar(t){return t?t=(t=(t=(t=(t=t.replace(/&/g,"&")).replace(//g,">")).replace(/"/g,""")).replace(/\s/g," "):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,r){var i=r.text.join("").replace(/\n/g,"");r.update(r.from,r.to,[i]);var o="+input"==r.origin&&"object"==typeof r.text&&""==r.text.join(" "),a="setValue"===r.origin||"+delete"===r.origin?void 0:r.text.join("")||"",s=n.isValid(a);if(!s){var c="※ This character( "+(a="\t"===(a=a.length>10?a.substring(0,9)+"...":a)?"Tab":""===a?"Enter":a)+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage($(t.display.lineDiv).closest(".CodeMirror"),{message:c,position:e["valid-message-position"]});}if(o||!s)return t.doc.setCursor(t.getCursor()),r.cancel();if("paste"==r.origin&&"object"==typeof r.text&&r.text.length>1){var l=r.text.join(" ");return r.update(null,null,[l]);}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 r=e.text.join("\n"),i=r.length-(t.indexFromPos(e.to)-t.indexFromPos(e.from));if(i<=0)return $(t.getTextArea()).trigger("hideOverflow"),!0;(i=t.getValue().length+i-n)>0&&($(t.getTextArea()).trigger("showOverflow"),r=r.substr(0,r.length-i),e.update(e.from,e.to,r.split("\n")));}return!0;});},createUDFItem:function createUDFItem(t,e,n,r,i){var o,a,s=$('
'),c=$('
');s.append(c);var l=Brightics.VA.Core.Interface.WidgetUtils[n];if(l&&l.createPaletteItem){var u=l.createPaletteItem(e.id);o=u.label,a=u.category;}else{var p="",d="";Brightics.VA.Core.Interface.Functions[n][e.id],p=e.label,d=" ver"+e.version,o=p,a="brtc-va-fnunit-category-"+"udf";}return c.find(".brtc-va-views-udf-fnunit-open-icon").hide(),c.find(".brtc-va-views-udf-fnunit-remove-icon").hide(),c.attr("title",o),c.find(".brtc-va-views-udf-fnunit-label").text(o),c.find(".brtc-va-views-udf-fnunit-version").text(d),c.find(".brtc-va-views-udf-fnunit-open-icon").on("click",function(){i();}),c.mouseover(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").show(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").show();}),c.mouseout(function(t){$(this).find(".brtc-va-views-udf-fnunit-open-icon").hide(),$(this).find(".brtc-va-views-udf-fnunit-remove-icon").hide();}),c.find(".brtc-va-views-udf-fnunit-remove-icon").on("click",function(){var e={contentText:"These items will be permanently deleted and cannot be recovered. Are you sure?",close:r,isCancel:!0};Brightics.VA.Core.Utils.WidgetUtils.createCommonConfirmDialog(t,e);}),c.addClass(a),t.append(s),this.putData(c,"udf",e),c;},getFunctionLibrary:function 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=$('
Private Policy
');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]"),r=t.find(".jqx-grid-pager div[type=button][title=previous]"),i=t.find(".jqx-grid-pager div[type=button][title=last]"),o=t.find(".jqx-grid-pager div[type=button][title=next]");0===e.pagenum?(n.css("opacity",".3").jqxButton({disabled:!0}),r.css("opacity",".3").jqxButton({disabled:!0})):(n.css("opacity","1").jqxButton({disabled:!1}),r.css("opacity","1").jqxButton({disabled:!1})),0===e.pagescount||e.pagenum===e.pagescount-1?(i.css("opacity",".3").jqxButton({disabled:!0}),o.css("opacity",".3").jqxButton({disabled:!0})):(i.css("opacity","1").jqxButton({disabled:!1}),o.css("opacity","1").jqxButton({disabled:!1}));},debounce:function debounce(t,e){return _.debounce(t,e,{maxWait:e});},setTrimInputControlOnFocusout:function setTrimInputControlOnFocusout(t){t.focusout(function(e){var n=t.val(),r=Brightics.VA.Core.Utils.InputValidator.isValid;(r.startWithSpace(n)||r.endWithSpace(n))&&(t.val(n.trim()),Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"This input value is trimmed.",position:"bottom"}));});},convertInequalitySign:function 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,e=t.VA.Dao,n=brtc_require("ResourceManager"),r=brtc_require("FnUnitUtils");function i(t){var e={fidCache:{},outputCache:{}};for(var n in t){var r=t[n];$.extend(!0,e,o(r));}return e;}function o(e){var n={fidCache:{},outputCache:{}},r=n.fidCache,o=n.outputCache;for(var a in r[e.fid]=t.VA.Core.Utils.IDGenerator.func.id(),e[OUT_DATA]){o[e[OUT_DATA][a]]=t.VA.Core.Utils.IDGenerator.table.id();}return e.param.functions&&$.extend(!0,n,i(e.param.functions)),n;}function a(e,n,i){var o=i.fidCache,a=i.tidCache,s=function s(){return t.VA.Core.Utils.IDGenerator.table.id();},c=function c(t,e,n){t[e]=t[e]||n;},l=function l(e){c(o,e.fid,t.VA.Core.Utils.IDGenerator.func.id()),_.forEach(r.getAllData(e),function(t){c(a,t,s());}),e.param.tableId&&c(a,e.param.tableId,s()),e.param.functions&&_.forEach(e.param.functions,function(t){l(t);});},u=function u(n){_.forEach([IN_DATA,OUT_DATA],function(t){_.forEach(n[t],function(t){c(a,t,s());});}),_.forEach(n.functions,function(n){l(n);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,n);_.forEach(r,u);});};return u(n),i;}function s(e,n,r){var i=r.fidCache,o=r.tidCache,a=function a(n){for(var s in u(n,o),p(n,o),n.functions){var c=n.functions[s];c.fid=i[c.fid],u(c,o),p(c,o),d(c,o),h(c,i),v(c,o,i),b(c,o),"deeplearning"===n.type&&y(c,i),c.param&&c.param.functions&&a(c.param,r);var l=t.VA.Core.Utils.NestedFlowUtils.getSubModels(e,c);_.forEach(l,a);}n.report&&(_.forEach(n.report.data,function(t){t.originData&&t.originData.data&&(t.originData.data.fid=c.fid,m(t,o));}),n.report=C(n.report,i)),f(n,i);};return a(n),g(e,i),e;}function c(e,n){_.forEach(e,function(e){!function(e,n){var r=n.fidCache,i=n.outputCache;e.fid.startsWith("d")?r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.dataSource.id():r[e.fid]=r[e.fid]||t.VA.Core.Utils.IDGenerator.func.id();_.forEach(e.outData,function(e){i[e]=i[e]||t.VA.Core.Utils.IDGenerator.table.id();}),e.param.functions&&c(e.param.functions,n);}(e,n);});}function l(t,e){var n=e.fidCache,r=e.outputCache;for(var i in t.functions){var o=t.functions[i];o.fid=n[o.fid],(o=b(o=v(o=h(o=d(o=p(o=u(o,r),r),r),n),r,n),r)).param&&o.param.functions&&l(o.param,e),"deeplearning"==t.type&&(o=y(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]=m(t.report.data[a],r);}t.report=C(t.report,n);}return t=g(t=f(t,n),n);}function u(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e);}),t;}function p(t,e){return _.forEach(e,function(e,n){r.changeData(t,n,e);}),t;}function d(t,e){if(t.param&&t.param["df-names"])for(var n in t.param["df-names"]){t.param["df-names"][n]=e[t.param["df-names"][n]];}return t;}function h(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 f(e,n){for(var r in e.links){var i=e.links[r],o=t.VA.Core.Utils.IDGenerator.link.id();i.kid=o,i[SOURCE_FID]=n[i[SOURCE_FID]],i[TARGET_FID]=n[i[TARGET_FID]];}return e;}function g(t,e){for(var n in t.variableRef){var r=t.variableRef[n].fid;t.variableRef[n].fid=e[r];}return t;}function v(e,n,r){if("outData"===e.func&&"Subflow"===e[FUNCTION_NAME])for(var i in e.param.functions){if("exportData"===e.param.functions[i].func){var o="/brtc/repo/tmp/"+t.VA.Core.Utils.IDGenerator.file.id();e.param["fs-paths"]=[o],e.param.functions[i]&&(e.param.functions[i].param["input-path"]=o,e.param.functions[i].param["output-path"]=o+".csv");}}return"DataViewer"===e[FUNCTION_NAME]&&(e.param.fid=r[e.param.fid]),e.param.target&&e.param.linked&&e.param.linked.outputs&&(e.param.target=r[e.param.target],e.param.linked.outputs.model=n[e.param.linked.outputs.model]),e.param.variables&&_.forEach(e.param.variables,function(t,r){var i=e.param.variables[r].param.inData;i&&n[i]&&(e.param.variables[r].param.inData=n[i]);}),e;}function y(t,e){var n=["train_data","validation_data"];if(!t.param)return t;for(var r=0;r0)for(var s in o.param.entries||(o.param.entries=[o.param.functions[0].fid]),o.param.functions){var c=o.param.functions[s];a=o.label||"";c.label=a,delete c.display;}}return r.innerModels&&(r.innerModels=_.reduce(_.map(r.innerModels,function(t,e){var r={};return r[e]=n.exportAsRunnable(t),r;}),_.merge,{})),r;},previousFnUnitList:function previousFnUnitList(t,e,n){var r=t.getPrevious(e);for(var i in r){-1==n.indexOf(r[i])&&n.push(r[i]),this.previousFnUnitList(t,r[i],n);}},previousLinks:function previousLinks(t,e,n){for(var r in t.links){var i=t.links[r];i[TARGET_FID]==e&&(n.push(i),this.previousLinks(t,i[SOURCE_FID],n));}},exportAsRunnableForRealTime:function exportAsRunnableForRealTime(t,e,n){var r=this.extendModel(t,!0),i=[];i.push(e.fid),this.previousFnUnitList(r,e.fid,i);var o=[];for(var a in r.functions){for(var s in i){i[s]===r.functions[a].fid&&o.push(r.functions[a]);}}var c=[];for(var l in this.previousLinks(r,e.fid,c),r.functions=o,r.links=c,delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,delete r.title,void 0!==n&&n||delete r.report,r.entries=[],r.functions){if(delete(e=r.functions[l]).display,e.parent().getPrevious(e.fid).length<1&&r.entries.push(e.fid),this.deleteEmptyArray(e),"Subflow"==e[FUNCTION_NAME]&&e.param.functions.length>0)for(var a in e.param.entries||(e.param.entries=[e.param.functions[0].fid]),e.param.functions){delete e.param.functions[a].display;}}return r;},getModelIds:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e){e.hasOwnProperty(i)&&(i===n&&r.push(e[i]),t(e[i],n,r));}return r;},getModelIdsWithVersion:function t(e,n,r){if("object"!=typeof e)return r;for(var i in e){if(e.hasOwnProperty(i)){if(i===n){var o={};o[i]=e[i],e.hasOwnProperty("version_id")&&(o.version_id=e.version_id),r.push(o);}t(e[i],n,r);}}return r;},exportAsRunnableFileByTree:function 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 r=this.exportAsRunnable(t),i={user:"input_user_id",jid:"input_job_id",main:r.mid,args:n,models:{}};if(i.models[r.mid]=r,"control"===r.type){var o=this.getModelIdsWithVersion(r.functions,"mid",[]);_.forEach(o,function(t){var n=t.version_id?t.mid+"_"+t.version_id:t.mid,r=t.version_id?e[t.mid].version[t.version_id]:e[t.mid].main;i.models[n]=this.exportAsRunnable(r.contents);}.bind(this));}else for(var a in r.gv){var s=r.gv[a];for(var c in s.param){n&&!n[s.param[c]]&&delete s.param[c];}Object.keys(s.param).length<1&&r.gv.splice(a,1);}return i;},createModelTree:function createModelTree(t,e){var n={};return Promise.all(this._createModelTree(t,e,n)).then(function(){return n;});},_createModelTree:function _createModelTree(t,e,r){var i=e.functions,o=function o(t,e,r){return r?n.fetchVersion(t,e,r):n.fetchFile(t,e);},a=function a(t,e,n){return r[e]=r[e]||{version:{}},n?r[e].version[n]=t:r[e].main=t,!0;},s=[];return _.forEach(i,function(e){e.param.functions&&s.push(this._createModelTree(t,e.param.functions,r)),"DataFlow"===e[FUNCTION_NAME]&&s.push(o(t,e.param.mid,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected control flow'):a(t,e.param.mid,e.param.version_id);})),void 0!==e.param.modelId&&s.push(o(t,e.param.modelId,e.param.version_id).then(function(t){return void 0===t?Promise.reject('"'+e.display.label+'" dataflow was deleted or format is invalid in selected report model'):a(t,e.param.modelId,e.param.version_id);}));}.bind(this)),_.flatten(s);},flattenModelTree:function flattenModelTree(t,e){var n=[],r=function r(t,e){return t.getMajorVersion()!==e.getMajorVersion()?e.getMajorVersion()-t.getMajorVersoin():e.getMinorVersion()-t.getMinorVersion();};return _.forOwn(t,function(t){var e=[],i=!1;_.forOwn(t.version,function(t){e.push(t),i=!0;}),e.sort(r),e=_.map(e,function(t){var e=_.cloneDeep(t.getContents());return e.versionTags=t.getTags(),e.versionDescription=t.getDescription(),e.majorVersion=t.getMajorVersion(),e.minorVersion=t.getMinorVersion(),e;}),i?e.push(_.omit(e[0],["version_id","versionTags","versionDescription","majorVersion","minorVersion"])):e.push(t.main.contents),n.push(e);}),_.flatten(n);},getModelArrayByTree:function getModelArrayByTree(e,n,r){var i=t.VA.Core.Utils.ModelUtils.flattenModelTree(e,r);return i.push(n.getContents()),i;},exportAsRunnableFile:function exportAsRunnableFile(e,n,r,i,o){var a=this.exportAsRunnable(e,i),s={};void 0!==a.report&&(s=$.extend(!0,{},a.report),delete a.report);var c={main:a.mid,models:{},reports:{},version:t.VA.Env.CoreVersion};if(o&&(c.duration=o),c.models[a.mid]=a,"control"===a.type){var l=this,u=this.getModelIds(a.functions,"mid",[]);$.each(u,function(t,e){for(var r in n){n[r].id==e&&(c.models[e]=l.exportAsRunnable(n[r].contents,i));}c.models[e]&&(i&&c.models[e].report&&c.models[e].report.data.length>0&&(c.reports[e]=$.extend(!0,{},c.models[e].report)),delete c.models[e].report);});}else for(var p in i&&s.data.length>0&&(c.reports[a.mid]=s),a.gv){var d=a.gv[p];for(var h in d.param){r&&!r[d.param[h]]&&delete d.param[h];}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(r,i,o,a){var s={},c={},l={},u=this.cloneModelsByTree(this.fileArrayToModelTree(i));_.forOwn(u,function(e){s[e.main.mid]=t.VA.Core.Utils.IDGenerator.model.id(),l[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={},h=[];return _.forOwn(u,function(n){n.main&&p(n.main.functions),_.forOwn(n.version,function(n){var i=new t.VA.Vo.Version().setFileId(s[n.mid]).setLabel(n.title).setTags(n.versionTags).setDescription(n.versionDescription).setIsManual(!0).setType(n.type).setMajorVersion(n.majorVersion).setMinorVersion(n.minorVersion),o=_.omit(n,["versionId","versionTags","versionDescription","majorVersion","minorVersion"]);i.setContents(o),h.push(e.VersionDao.addVersion(r,i.getFileId(),i).then(function(t){return d[n.version_id]=t.getVersionId(),t;}));});}),Promise.all(h).then(function(){var e=[];return _.forOwn(u,function(i){_.forEach(i.main.functions,function(t){"DataFlow"===t[FUNCTION_NAME]&&t.param.version_id&&(t.param.version_id=d[t.param.version_id]);});var o=new t.VA.Vo.File().setFileId(s[i.main.mid]).setProjectId(r).setLabel(l[i.main.mid]).setDescription("").setCreator(t.VA.Env.Session.userId).setContents(i.main);e.push(n.addFile(r,o));}),Promise.all(e).then(function(t){return _.map(t,function(t){return n.fetchVersions(r,t.getFileId());});});});},makeEntries:function 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;},isEmpty:function isEmpty(t){return _.isUndefined(t)||_.isNull(t)||_.isNaN(t)||(_.isString(t)||_.isArray(t))&&_.isEmpty(t);},deleteEmptyArray:function deleteEmptyArray(e,n){if(e.param)for(var r in e.param){if(this.isControlFunction(e,n))this.deleteEmptyExpression(e,n);else if("functions"==r)for(var i in e.param.functions){this.deleteEmptyArray(e.param.functions[i],n||e.parent());}else if(["boolean","number"].some(function(t){return t===typeof e.param[r];})||e.param[r]){var o=e.param[r];if(_.isArray(o)){if(o.length>1)continue;if(this.isEmpty(o[0])){if(this.isEmpty(o[0])){var a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r];}}else if(_.isArray(o[0])){if(o[0].length>1)continue;this.isEmpty(o[0][0])&&delete e.param[r];}else this.isEmpty(o[0])&&delete e.param[r];}}else{a=n?n.type:e.parent().type;if(t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory&&-1!==$.inArray(r,t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(a,e.func).mandatory))continue;delete e.param[r];}}},deleteDisplay:function 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 r in n){this.deleteDisplay(n[r]);}}},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),r={},i=function i(e,n,r){var i=$.extend(!0,{},e);return r&&i.mid&&(i.mid=t.VA.Core.Utils.IDGenerator.model.id()),i=l(i,n);};return _.forOwn(e,function(t,e){r[e]={},t.main&&(r[e].main=i(t.main,n)),t.version&&(r[e].version={},_.forOwn(t.version,function(t,o){r[e].version[o]=i(t,n);}));}),r;},cloneModel:function cloneModel(e){if("data"===e.type)return function(e){var n=_.cloneDeep(e),r={},i=function i(e){r[e]=r[e]||t.VA.Core.Utils.IDGenerator.model.id();},o=function o(t){return r[t];},c=function c(e){_.forEach(e.functions,function(e){"If"===e[FUNCTION_NAME]&&(i(e.param.if.mid),_.forEach(e.param.elseif,function(t){i(t.mid);}),i(e.param.else.mid)),"ForLoop"!==e[FUNCTION_NAME]&&"WhileLoop"!==e[FUNCTION_NAME]||i(e.param.mid);var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,c);});};_.forEach(n.innerModels,function(t,e){i(e);});var l=function l(e){_.forEach(e.functions,function(e){var r=t.VA.Core.Utils.NestedFlowUtils.getSubModels(n,e);_.forEach(r,l),"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),l(n),n.innerModels=_.reduce(_.map(n.innerModels,function(t){t.mid=o(t.mid);var e={};return e[t.mid]=t,e;}),_.merge,{});var u={fidCache:{},tidCache:{}};return a(n,n,u),s(n,n,u),n;}(this.extendModel(e));var n=$.extend(!0,{},e);return n.mid&&(n.mid=t.VA.Core.Utils.IDGenerator.model.id()),n=l(n,i(n.functions));},cloneFnUnit:function cloneFnUnit(t){var e=o(t),n=$.extend(!0,{},t),r=e.fidCache,i=e.outputCache;return n.fid=r[n.fid],n[IN_DATA]&&(n[IN_DATA]=[]),"unload"===n.func&&(n.param["df-names"]=[]),(n=p(n,i)).param=l(n.param,e),n;},checkAndRemoveOptionalInputs:function checkAndRemoveOptionalInputs(t){t.inputs&&t.meta&&Object.keys(t.inputs).filter(function(e){return""===t.inputs[e]&&t.meta[e]&&t.meta[e].optional;}).forEach(function(e){return delete t.inputs[e];});},carvePersist:function carvePersist(e,n){var r,i=t.VA.SettingStorage.DEFAULT_SETTINGS["common.persist.mode"];r=t.VA.Core.Functions.Library[e.func]?t.VA.Core.Functions.Library[e.func].defaultFnUnit.persist:i;var o=e.parent()["persist-mode"];"user-mode"===i&&("true"===e["persist-mode"]?e.persist=!0:"false"===e["persist-mode"]?e.persist=!1:e.persist="true"===o||"false"!==o),"performance-mode"===i&&(e.persist=void 0!==r&&r),"storage-mode"===i&&(e.persist=void 0===r||r),"Subflow"===e[FUNCTION_NAME]&&e.param.functions.length>0&&(e.param.functions[e.param.functions.length-1].persist=!0);},generateVersionText:function 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,r,i){var o,a;if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var s=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===s&&(s=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),s=_.trimRight(s,"/");try{var c=[s,(navigator.language||navigator.userLanguage).toLowerCase(),"ai","v"+(t.VA.Env.CoreVersion||"3.0"),"function_reference",r||"scala",n].join("/");o=window.open(c);}catch(t){o=window.open(s);}}else a="api/va/v2/help/function",n&&(a=a+"/"+n),a=a+"?type="+e+(r?"&context="+r:"")+(i?"&func="+i:""),o=window.open(a,"Brightics Help");o.blur();},createCachePersist:function createCachePersist(t,e){return c(t,e);},setKeys:function setKeys(t,e){return l(t,e);},createFileContents:function createFileContents(e,n,r,i){var o=$.extend(!0,{},e);o.mid=n,r&&(o.title=r),i&&(o.description=i);var a,s,c,l,u,p,d,h,f={},g={};for(a in o.functions){for(c in f[(u=o.functions[a]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),u[OUT_DATA]){g[u[OUT_DATA][c]]=t.VA.Core.Utils.IDGenerator.table.id();}if("Subflow"===u[FUNCTION_NAME])for(b in u.param.functions){for(l in f[(p=u.param.functions[b]).fid]=t.VA.Core.Utils.IDGenerator.func.id(),p[OUT_DATA]){g[p[OUT_DATA][l]]=t.VA.Core.Utils.IDGenerator.table.id();}}}for(a in o.functions){for(b in(u=o.functions[a]).fid=f[u.fid],u[IN_DATA]){u[IN_DATA][b]=g[u[IN_DATA][b]];}for(b in u[OUT_DATA]){u[OUT_DATA][b]=g[u[OUT_DATA][b]];}if("unload"===u.func)for(b in u.param["df-names"]){u.param["df-names"][b]=g[u.param["df-names"][b]];}if("Subflow"===u[FUNCTION_NAME]){for(b in u.param.entries){u.param.entries[b]=f[u.param.entries[b]];}for(b in u.param.functions){for(s in(p=u.param.functions[b]).fid=f[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],u.param.functions[parseInt(b)+1]&&(u.param.functions[parseInt(b)+1].param["input-path"]=v,u.param.functions[parseInt(b)+1].param["output-path"]=v+".csv");}}for(b in u.param.links){(h=u.param.links[b]).kid=t.VA.Core.Utils.IDGenerator.link.id(),h[SOURCE_FID]=f[h[SOURCE_FID]],h[TARGET_FID]=f[h[TARGET_FID]];}}}for(a in o.links){(d=o.links[a]).kid=t.VA.Core.Utils.IDGenerator.link.id(),d[SOURCE_FID]=f[d[SOURCE_FID]],d[TARGET_FID]=f[d[TARGET_FID]];}if("visual"===o.type){var y=o.report.pages;for(a in y.push({id:t.VA.Core.Utils.IDGenerator.reportPage.id(),contents:{}}),y){var m=y[a].contents;for(var b in m){m[b].dataSourceId&&f[m[b].dataSourceId]&&(m[b].dataSourceId=f[m[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(){"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(r){var i=(r.originalEvent.clipboardData||window.clipboardData).getData("Text");if(!e.isValid[n](i)){r.preventDefault();Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:"※ This pasted string is NOT allowed."});}}),t.keydown(function(r){if(!e.isDefaultKeyCode(r)){var i,o={Spacebar:" ",Up:"ArrowUp",Down:"ArrowDown",Left:"ArrowLeft",Right:"ArrowRight"}[(i=r).key]||i.key;if(e.isValid[n](o)||"Process"!==o){if(!e.isValid[n](o)){r.preventDefault();a="※ This character( "+o+" ) is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a});}}else{var a="※ Korean character is NOT allowed.";Brightics.VA.Core.Widget.Factory.createFadeOutMessage(t,{message:a});var s=e.replaceKoreanToEmpty(t.val());e.replaceKoreanToEmptyTimeout&&clearTimeout(e.replaceKoreanToEmptyTimeout),e.replaceKoreanToEmptyTimeout=setTimeout(function(){t.val(s);},100);}}});}}};}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){try{this.$mainControl=t,this.options=e,this.verifier=e.verifier,this.data=null,this.createControls();}catch(t){console.error(t);}}e.prototype.createControls=function(){this.verifier&&this.verifier.getSyntaxRule();this.initCodeMirror();},e.prototype.initCodeMirror=function(){var e=this,n={mode:this.verifier?this.verifier.getRuleMode():"brtc-default",theme:"default",lineNumbers:!1,lineWrapping:!0,scrollbarStyle:void 0!==e.options.scrollbarStyle?"null":"simple",placeholder:"Enter value",extraKeys:{"Ctrl-Space":"autocomplete"},showTrailingSpace:!0,autoCloseBrackets:!0,matchBrackets:!0},r=$.extend(!0,{},n,this.options);this.codeMirror=CodeMirror.fromTextArea(this.$mainControl[0],r),this.codeMirror.on("focus",function(t,n){e.old=t.getValue();}),this.codeMirror.on("blur",function(t,n){t.getValue()!=e.old&&"function"==typeof e.callback&&e.callback("change",n);}),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror);},e.prototype.getValue=function(){return this.codeMirror.getValue();},e.prototype.setValue=function(t){this.codeMirror.setValue(t);},e.prototype.onChange=function(t){this.callback=t;},e.prototype.getControl=function(){return this.$mainControl;},this.Brightics.VA.Core.Editors.Sheet.Controls.TextAreaControl=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=this.setOptions(e),this.retrieveParent(),this.createControls(),this.createEditorCommands(),this.registerEventListener(),this.setValue(this.options.value),this.navigateFileEnd();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.setOptions=function(t){return $.extend(!0,{},t);},e.prototype.createControls=function(){this.$mainControl=$('
'),this.$parent.append(this.$mainControl),this.editor=ace.edit(this.$mainControl[0]),this.options.mode&&this.editor.session.setMode("ace/mode/"+this.options.mode),this.editor.setTheme("ace/theme/eclipse");var t={enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:10,maxLines:10};this.options.editorOptions&&$.extend(!0,t,this.options.editorOptions),this.editor.setOptions(t),this.editor.setShowPrintMargin(!1),this.editor.$blockScrolling=1/0;},e.prototype.getWrapperDiv=function(){return this.$mainControl;},e.prototype.createEditorCommands=function(){for(var t in this.options.commands){this.editor.commands.addCommand(this.options.commands[t]);}},e.prototype.registerEventListener=function(){for(var t in this.options.events){this.editor.addEventListener(this.options.events[t].name,this.options.events[t].event);}},e.prototype.setValue=function(t){this.editor.setValue(t);},e.prototype.getValue=function(){return this.editor.getValue();},e.prototype.getEditor=function(){return this.editor;},e.prototype.resize=function(){this.editor.resize();},e.prototype.navigateFileEnd=function(){return this.editor.navigateFileEnd();},e.prototype.getCursorPosition=function(){return this.editor.getCursorPosition();},e.prototype.getSession=function(){return this.editor.session;},e.prototype.insert=function(t){this.editor.insert(t);},e.prototype.focus=function(){this.editor.focus();},e.prototype.setHeight=function(t){this.$mainControl.css("height",t);},e.prototype.destroy=function(){this.editor.destroy(),this.$mainControl.remove();},t.VA.Core.Widget.Controls.AceEditorControl=e;}.call(this),function(){"use strict";var t=this.Brightics,e={button:{visible:!0,disabled:!1,checked:!0,on:{label:"ON",value:"on"},off:{label:"OFF",value:"off"}}};function n(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls(),this.setInputValue();}n.prototype.initOptions=function(t){this.options=$.extend(!0,{},e,t),this.variableKey=Object.keys(this.options.variable)[0],this.inputType=this.options.variable[this.variableKey].type,this.variableType=this.options.variable[this.variableKey]["variable-type"],this.variableValue=this.options.variable[this.variableKey].value;},n.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},n.prototype.createControls=function(){var t=this;this.$mainControl=$('
'+this.variableKey+'
'),this.$parent.append(this.$mainControl),this.$mainControl.find(".brtc-va-widget-label").addClass(this.variableType),this.options.mandatory&&this.$mainControl.find(".brtc-va-widget-label").addClass("mandatory"),this.createTypeButtonControl(),this.createContentsArea(),this.$mainControl.find(".brtc-va-widget-remove").on("click",function(){"function"==typeof t.options.onRemoveCallback&&(t.options.onRemoveCallback(t.createFormattedValue()),t.$mainControl.remove());}),"calculation"===this.variableType&&(this.$mainControl.find(".brtc-va-widget-type-button-area").hide(),this.$mainControl.find(".brtc-va-widget-contents-input-control-container").addClass("read-only"));},n.prototype.createTypeButtonControl=function(){var t=this;if(this.$btnArea=this.$mainControl.find(".brtc-va-widget-type-switch-button"),this.options.button.visible){var e,n,r=this.options.button.on.label,i=this.options.button.on.value;this.isArrayValue()?(e="Variable",n="expression"):(e=this.options.button.off.label,n=this.options.button.off.value),this.$btnArea.jqxSwitchButton({height:"100%",width:"100px",thumbSize:"15%",onLabel:r,offLabel:e,checked:this.setSwitchButtonChecked()}),this.inputType=this.$btnArea.val()?i:n,this.$btnArea.on("change",function(e){t.variableValue=t.getInputValue(),t.inputType=t.$btnArea.val()?i:n,t.$contentsArea.empty(),t.createContentsArea(),t.setInputValue(),t.triggerChangeInputValue(!0);});}},n.prototype.setSwitchButtonChecked=function(){var t,e,n=this.options.button.on.value;return e=this.isArrayValue()?"expression":this.options.button.off.value,this.inputType===n?t=!0:this.inputType===e?t=!1:(this.inputType=this.options.button.checked?n:e,t=this.options.button.checked),t;},n.prototype.isArrayValue=function(){return"array"===this.variableType&&this.options.button.visible;},n.prototype.createContentsArea=function(){this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper"),this.isArrayValue()?"expression"!==this.inputType?this.createArrayInputControl():(this.$contentsArea.append($('
')),this.createCodeInputControl(this.$contentsArea.find(".brtc-va-widget-contents-input-control-container"))):this.createSingleInputControl();},n.prototype.createArrayInputControl=function(){if(0===this.variableValue.length)this.createInputControlLayout(0,this.isArrayValue());else if(this.variableValue instanceof Array)for(var t=0;t
'),s=r.find(".brtc-va-widget-contents-input-container");0!==s.length&&s[t]?($(s[t]).after(a),o=!0):r.append(a);var c,l,u=$('
');a.append(u),(t>0||o)&&(l=$('
'),a.append(l),l.click(function(t){i.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"));})),e&&(c=$('
'),a.append(c),c.click(function(t){i.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"));})),this.isArrayValue()?this.createInputControl(u,n):this.createCodeInputControl(u,n);},n.prototype.createInputControl=function(e,n){var r=this,i=$('');e.append(i);var o={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};i.jqxInput(o),n&&i.jqxInput("focus"),i.keydown(function(t){13==t.keyCode&&r.isArrayValue()&&r.handleAddInputControlEvent(i.closest(".brtc-va-widget-contents-input-container"),!0);}),i.focusout(function(t){r.triggerChangeInputValue();});},n.prototype.createCodeInputControl=function(e,n){var r=this,i=$('
');r.append(a),a.find(".brtc-va-refine-addcolumn-newcolumn-name").jqxInput({theme:e.VA.Env.Theme,placeHolder:"Enter name",width:"122px",height:27}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(a.find(".brtc-va-refine-addcolumn-newcolumn-name")),i&&a.find(".brtc-va-refine-addcolumn-newcolumn-name").val(i);var s=$.map(this.options.columns,function(t,e){return t.name;}),l=CodeMirror.fromTextArea(a.find(".brtc-va-refine-addcolumn-newcolumn-value")[0],{mode:"text/x-sql",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!1,scrollbarStyle:"null",extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:[].concat(s,["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"])}});l.setSize("calc(100% - 200px)",a.find(".brtc-va-refine-addcolumn-newcolumn-name").height()),e.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(l),l.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[i]),!0;}),o&&l.setValue(o),a.find(".brtc-va-refine-addcolumn-newcolumn-name").on("change",function(t){n.checkValidation();}),l.on("change",function(t){n.checkValidation();}),a.find(".brtc-va-refine-addcolumn-newcolumn-remove").click(function(){$(this).closest(".brtc-va-refine-addcolumn-newcolumn-item").remove(),n.checkValidation();});},i.prototype.handleOkClicked=function(){if(this.problems.length>0)e.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var t=this.createSelect();this.buildFunctionUnit("Add Column","addColumnByRefine",t,""),e.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},i.prototype.buildFunctionUnit=function(t,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:e.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:t},this.resultFnUnit=r;},i.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},i.prototype.createSelect=function(){var t=this.$mainControl.find(".brtc-va-refine-addcolumn-newcolumn-item"),e="*",i=0;return $.each(t,function(o,n){i-1){var s="New column name(s) - '"+r+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:o,param:"New column name",messageParam:[s]}));}else if($.inArray(r,$.map(t.options.columns,function(t){return t.name;}))>-1){s="New column name(s) - '"+r+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:o,param:"New column name",messageParam:[s]}));}else""===a&&t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:o,param:"Value",messageParam:["Value"]})),i.push(r);}),this.renderValidation();},e.VA.Core.Dialogs.RefineSteps.AddColumnDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Advanced Filter";},e.prototype.createDialogContentsArea=function(t){t.append('
'),this.render(t);},e.prototype.render=function(e){for(var i=this,o={},n=0;n0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please check the query statement.");else{var e=this.getAdditionalQueryString();this.buildFunctionUnit("Advanced Filter","advancedFilter","*",e),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.buildFunctionUnit=function(e,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:t.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:e},this.resultFnUnit=r;},e.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},e.prototype.checkValidation=function(){this.removeValidation();var t=this.cmMarker.find(),e=this.cm.getDoc().lastLine(),i=this.cm.getDoc().getLine(e).length;""===this.cm.getDoc().getRange(t.to,{line:e,ch:i})&&this.addProblem(this.createProblem({errorCode:"BR-0033",paramIndex:0,param:"Filter",messageParam:["Filter statement"]})),this.renderValidation();},e.prototype.renderValidation=function(){var t=this.$mainControl.find(".brtc-va-refine-advanced-filter-container");this.problems.length&&this.createValidationContent($(t),this.problems[0]);},t.VA.Core.Dialogs.RefineSteps.AdvancedFilterDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Change Value";},e.prototype.createDialogContentsArea=function(e){var i=this;e.append('
+ Add New Column
'),this.render(),e.find(".brtc-va-refine-changevalue-addbutton").jqxButton({theme:t.VA.Env.Theme}).click(function(){i.createNewChangeValueItem(),i.checkValidation();}),e.perfectScrollbar(),e.perfectScrollbar("update");},e.prototype.render=function(){if(this.options.param){var t=this.options.param.select.split(" \n");""==t[t.length-1]&&t.splice(t.length-1,1);for(var e=0;e-1){var n=t[e].substring(0,o).trim(),r=t[e].substring(o+4).trim();r=r.replace(/`/gi,""),this.createNewChangeValueItem({name:r,value:n});}}}}else this.createNewChangeValueItem();this.checkValidation();},e.prototype.createNewChangeValueItem=function(e){var i=this,o=this.$mainControl.find(".brtc-va-refine-changevalue-newcolumn-container"),n=$('
=
');o.append(n);var r=$.map(this.options.columns,function(t,e){return t.name;}),a=CodeMirror.fromTextArea(n.find(".brtc-va-refine-changevalue-newcolumn-value")[0],{mode:"brtc-control",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,scrollbarStyle:"null",extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:[].concat(r,["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"])}});a.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[i]),!0;}),a.setSize("calc(100% - 190px)","25px"),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(a);var s=n.find(".brtc-va-refine-changevalue-newcolumn-name");this.data=[],this.data=this.options.columns;var l=this.createColumnList(s,{rowCount:1,multiple:!1,showOpener:"click",removable:!1,fromModal:!0},"brtc-va-editors-sheet-controls-width-3",{height:"25px","padding-left":"4px"});l.setItems(this.data),l.columnSelector.$mainControl.attr("isDialog",!0),s.data("columnList",l),n.find(".brtc-va-refine-changevalue-newcolumn-remove").click(function(){$(this).closest(".brtc-va-refine-changevalue-newcolumn-item").remove(),i.checkValidation();}),l.onChange(function(t,e){i.checkValidation();}),a.on("change",function(t){i.checkValidation();}),e&&(l.setSelectedItems([e.name]),a.setValue(e.value)),s.find(".brtc-va-editors-sheet-controls-columnselector-columncontainer-element-empty").css({width:"100%","margin-left":"0px"}),n.find(".brtc-va-refine-changevalue-newcolumn-assignor").css({"text-align":"left","margin-left":"4px",width:"16px"});},e.prototype.getSelectString=function(){var t=this.$mainControl.find(".brtc-va-refine-changevalue-newcolumn-item"),e="";this.columnNameArray=[],this.validationData=[];var i=this,o=[],n=[];$.each(t,function(r,a){var s=$(t[r]).find(".brtc-va-refine-changevalue-newcolumn-name").data("columnList").getSelectedItems()[0];i.columnNameArray[r]=s;a=$(t[r]).find(".CodeMirror")[0].CodeMirror.getValue();e=a+" as `"+s+"`",o.push(s),n.push(e),i.validationData.push({index:r,column:s,value:a});});var r=$.map(this.data,function(t){return t.name;}),a="";for(var s in r){var l=!1;for(var c in o){if(r[s]===o[c]){a+=n[c],l=!0;break;}}l||(a+="`"+r[s]+"`"),a+=s0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var e=this.getSelectString();this.buildFunctionUnit("Change Value","changeValue",e,""),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.buildFunctionUnit=function(e,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:t.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:e},this.resultFnUnit=r;},e.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},e.prototype.renderValidation=function(){var t=this;$.each(this.problems,function(e,i){var o=t.$mainControl.find(".brtc-va-refine-changevalue-newcolumn-item");"BR-0033"==i.code?t.createValidationContent($(o[i.paramIndex]),i):t.createValidationContent($(o[i.paramIndex]),i,"Select column"==i.param?$(o[i.paramIndex]).find(".brtc-va-refine-changevalue-newcolumn-name"):$(o[i.paramIndex]).find(".CodeMirror")),t.$mainControl.find(".brtc-va-refine-step-validation-tooltip").css("margin-left","8px");});},e.prototype.checkValidation=function(){var t=this,e=this.$mainControl.find(".brtc-va-refine-changevalue-newcolumn-item");this.removeValidation();var i=[];$.each(e,function(o,n){var r=$(e[o]).find(".brtc-va-refine-changevalue-newcolumn-name").data("columnList").getSelectedItems()[0];n=$(e[o]).find(".CodeMirror")[0].CodeMirror.getValue();if(void 0===r&&""===n?t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:o,param:"Select column",messageParam:["Select column","Change value"]})):void 0===r?t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:o,param:"Select column",messageParam:["Select column"]})):""===n&&t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:o,param:"Change value",messageParam:["Change value"]})),r)if($.inArray(r,i)>-1){var a="Select column(s) - '"+r+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:o,param:"Select column",messageParam:[a]}));}else i.push(r);}),this.renderValidation();},e.prototype.destroy=function(){this.destroyColumnSelector(),this.$mainControl.dialog("destroy"),"function"==typeof this.options.close&&this.options.close(this.dialogResult);},t.VA.Core.Dialogs.RefineSteps.ChangeValueDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Group-by";},e.prototype.createDialogContentsArea=function(t){t.append('
'),t.append('
'),this.render(t);},e.prototype.render=function(e){for(var i=this,o={},n=0;n0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please check the query statement.");else{var e=this.getSelectQueryString(),i=this.getAdditionalQueryString();this.buildFunctionUnit("Group By","groupBy",e,i),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.buildFunctionUnit=function(e,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:t.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:e},this.resultFnUnit=r;},e.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},e.prototype.checkValidation=function(){this.removeValidation();var t=this.selectMarker.find(),e=this.selectCM.getDoc().lastLine(),i=this.selectCM.getDoc().getLine(e).length;""===this.selectCM.getDoc().getRange(t.to,{line:e,ch:i})&&this.addProblem(this.createProblem({errorCode:"BR-0033",paramIndex:0,param:"SELECT",messageParam:["SELECT statement"]}));var o=this.groupByMarker.find(),n=this.groupbyCM.getDoc().lastLine(),r=this.groupbyCM.getDoc().getLine(n).length;""===this.groupbyCM.getDoc().getRange(o.to,{line:n,ch:r})&&this.addProblem(this.createProblem({errorCode:"BR-0033",paramIndex:1,param:"GROUP BY",messageParam:["GROUP BY statement"]})),this.renderValidation();},e.prototype.renderValidation=function(){var t=this;$.each(this.problems,function(e,i){var o=t.$mainControl.find(".brtc-va-refine-groupby-container");t.createValidationContent($(o[i.paramIndex]),i);});},t.VA.Core.Dialogs.RefineSteps.GroupByDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Index Column";},e.prototype.createControls=function(){t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.createControls.call(this);this.$mainControl.dialog({height:550,maxHeight:550});},e.prototype.createDialogContentsArea=function(e){var i=this;e.append('
New Column Name
Lag Value
Partition By
Order By
+ Add New Column
'),e.find(".brtc-va-refine-indexcolumn-newcolumn-name").jqxInput({theme:t.VA.Env.Theme,placeHolder:"Enter name",width:295}),e.find(".brtc-va-refine-indexcolumn-newcolumn-name").on("change",function(t){i.checkValidation();});var o=e.find(".brtc-va-refine-indexcolumn-newcolumn-lagvalue-contents");this.$lagValueInput=new t.VA.Core.Widget.Controls.NumericInput(o,{numberType:"int",min:void 0,max:void 0,minus:!1,placeHolder:"Enter value"});var n=e.find(".brtc-va-refine-indexcolumn-group-columns");this.data=[],this.data=this.options.columns;var r=this.createColumnList(n,{maxRowCount:3,multiple:!0,showOpener:"click",removable:!0,fromModal:!0},"",{width:"510px"});r.setItems(this.data),n.data("columnList",r),e.find(".brtc-va-refine-indexcolumn-newcolumn-container").sortable({axis:"y",containment:".brtc-va-refine-indexcolumn-newcolumn-container",helper:function helper(t,e){var i=$(e).clone();return i.css("position","absolute"),i.get(0);},handle:".brtc-va-refine-indexcolumn-column-sort",stop:function stop(t,e){}}),e.find(".brtc-va-refine-indexcolumn-newcolumn-container").disableSelection(),this.render(),e.find(".brtc-va-refine-indexcolumn-addbutton").jqxButton({theme:t.VA.Env.Theme}).click(function(){i.createNewSortItem(),i.checkValidation();}),e.perfectScrollbar(),e.perfectScrollbar("update");},e.prototype.render=function(){var t=this.$mainControl.find(".brtc-va-refine-indexcolumn-group-columns"),e=$(t).data("columnList");if(this.options.param){var i=this.options.param.select.replace(/ \n/gi,"\n").split("\n");if(i[0].startsWith("*, ROW_NUMBER() OVER(")){i.splice(0,1);var o=[];if("PARTITION BY"==i[0]){i.splice(0,1);for(var n=0;n
');i.append(o);var n=o.find(".brtc-va-refine-indexcolumn-column-name"),r=this.createColumnList(n,{rowCount:1,multiple:!1,showOpener:"click",removable:!1,fromModal:!0},"brtc-va-editors-sheet-controls-width-10",{height:"25px","padding-left":"4px"});r.setItems(this.options.columns),r.columnSelector.$mainControl.attr("isDialog",!0),o.data("columnList",r);var a=o.find(".brtc-va-refine-indexcolumn-column-propertycontrol-button");this.createButton(a,{width:"19px",height:"19px"},"",{float:"left","margin-left":"3px"}),a.data("sort-mode","ASC"),a.on("click",function(){var t=r.getSelectedItems(),i=$.grep(e.options.columns,function(e,i){return e.name===t[0];});i&&i.length>0&&("ASC"===a.data("sort-mode")?a.data("sort-mode","DESC"):a.data("sort-mode","ASC"),e.updateSortModeIcon(a,r));}),r.onChange(function(t,i){e.updateSortModeIcon(a,r),e.checkValidation();}),o.find(".brtc-va-refine-indexcolumn-column-remove").click(function(){$(this).closest(".brtc-va-refine-indexcolumn-column-item").remove(),e.checkValidation();}),t&&(r.setSelectedItems([t.name]),a.data("sort-mode",t["sort-mode"]),this.updateSortModeIcon(a,r)),o.find(".brtc-va-refine-indexcolumn-column-sort").css("margin-bottom","5px");},e.prototype.handleOkClicked=function(){if(this.problems.length>0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var e=this.createAdditionalQuery();this.createSQLExecutor("Index Column","indexColumnByRefine",e,""),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.createAdditionalQuery=function(){var t="",e="",i=this.$mainControl.find(".brtc-va-refine-indexcolumn-group-columns"),o=$(i).data("columnList"),n=o.getSelectedItems();n.length&&(e="PARTITION BY\n",$.each(o.getSelectedItems(),function(t,i){e+=i,e+=t0&&(t="ORDER BY\n"),r.each(function(e,i){var o=$(i).data("columnList"),n=$(i).find(".brtc-va-refine-indexcolumn-column-propertycontrol-button"),a=o.getSelectedItems();if(a.length){var s=n.data("sort-mode");t+=a[0]+" "+s,t+=e-1){var r="Select column(s) - '"+o[0]+"' already exist.";e.addProblem(e.createProblem({errorCode:"BR-0100",paramIndex:t,param:"Select column",messageParam:[r]}));}else n.push(o[0]);}else e.addProblem(e.createProblem({errorCode:"BR-0033",paramIndex:t,param:"Select column",messageParam:["Select column"]}));}):this.addProblem(e.createProblem({errorCode:"BR-0033",paramIndex:-1,param:"Column",messageParam:["Column"]})),this.renderValidation();},e.prototype.updateSortModeIcon=function(t,e){var i=e.getSelectedItems(),o=$.grep(this.options.columns,function(t,e){return t.name===i[0];}),n=t.data("sort-mode");if(o&&o.length>0){var r,a=o[0].type;t.find("i").removeClass(),"string"===a?(r="fa fa-sort-alpha-"+n.toLowerCase(),t.find("i").addClass(r)):"number"===a||"date"===a?(r="fa fa-sort-numeric-"+n.toLowerCase(),t.find("i").addClass(r)):(r="fa fa-sort",t.find("i").addClass(r));}},e.prototype.destroy=function(){this.destroyColumnSelector(),this.$mainControl.dialog("destroy"),"function"==typeof this.options.close&&this.options.close(this.dialogResult);},t.VA.Core.Dialogs.RefineSteps.IndexColumnDialog=e;}.call(this),function(){"use strict";var t=this,e=t.Brightics;function i(t,i){e.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,t,i);}i.prototype=Object.create(e.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),i.prototype.constructor=i,i.prototype.getTitle=function(){return"Select Column";},i.prototype.createControls=function(){this.$mainControl=$('
'),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel"),this.$mainControl.find(".brtc-va-refine-step-header-help").css("display","none"),this.$mainControl.find(".brtc-va-refine-step-header-help").click(function(){window.open("api/va/v2/help/function/sqlfunctionhelp","SQL Function Help").blur();});},i.prototype.createDialogContentsArea=function(t){var i=this;t.addClass("brtc-va-dataflow-refine-select-column-dialog"),this.createAliasHelper(t),t.append('
Name
New Name
Type
');var o={theme:e.VA.Env.Theme,title:this.getTitle(),width:600,height:500,maxWidth:600,maxHeight:500,modal:!0,resizable:!1,close:this.destroy.bind(this)};this.$mainControl.dialog(o),this.$headerCheckBox=$(t.find(".brtc-va-refine-selectcolumn-header-check")),this.$headerCheckBox.jqxCheckBox({theme:e.VA.Env.Theme,width:23,height:27,checked:!0}),this.$headerCheckBox.on("checked",function(t){i.checkAllItems("check"),i.$okButton.jqxButton({disabled:!1});}),this.$headerCheckBox.on("unchecked",function(t){i.checkAllItems("uncheck"),i.$okButton.jqxButton({disabled:!0});}),this.render(),t.find(".brtc-va-refine-selectcolumn-contents").sortable({axis:"y",helper:function helper(t,e){var i=$(e).clone();return i.css("position","absolute"),i.get(0);},items:".brtc-va-refine-selectcolumn-column-item",cancel:".brtc-va-refine-selectcolumn-column-item.sort-disabled",handle:".brtc-va-refine-selectcolumn-column-sort",update:function update(t,e){i.checkValidation();}},"refreshPositions"),t.find(".brtc-va-refine-selectcolumn-contents").disableSelection(),t.perfectScrollbar(),t.perfectScrollbar("update"),$(".brtc-va-refine-selectcolumn-column-alias-setting-button").click(function(){$(".brtc-va-refine-selectcolumn-alias-helper").toggleClass("setting-active"),$(this).toggleClass("setting-active");}),$(".brtc-va-refine-selectcolumn-column-alias-reset-wrapper .brtc-va-refine-selectcolumn-column-reset").click(function(){i.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item").each(function(t,e){if($(e).find(".brtc-va-refine-selectcolumn-column-check").val()){var i=$(e).find(".brtc-va-refine-selectcolumn-column-alias");i.val(i.data("default-alias"));}});}),$(".brtc-va-refine-selectcolumn-column-type-reset-wrapper .brtc-va-refine-selectcolumn-column-reset").click(function(){i.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item").each(function(t,e){if($(e).find(".brtc-va-refine-selectcolumn-column-check").val()){var i=$(e).find(".brtc-va-refine-selectcolumn-column-type");i.val(i.data("default-type"));}});}),this.checkValidation();},i.prototype.checkAllItems=function(t){for(var e=this.$mainControl.find(".brtc-va-refine-selectcolumn-column-item"),i=0;i
');n.append(r),r.find(".brtc-va-refine-selectcolumn-column-check").jqxCheckBox({theme:e.VA.Env.Theme,width:23,height:27,checked:i.checked}),r.find(".brtc-va-refine-selectcolumn-column-check").on("checked",function(){r.removeClass("sort-disabled"),r.find(".brtc-va-refine-selectcolumn-column-sort").css({opacity:"",cursor:"pointer"}),r.find(".brtc-va-refine-selectcolumn-column-name").jqxInput({disabled:!1}),r.find(".brtc-va-refine-selectcolumn-column-alias").jqxInput({disabled:!1}),r.find(".brtc-va-refine-selectcolumn-column-type").jqxDropDownList({disabled:!1}),r.find(".brtc-va-refine-selectcolumn-column-reset").css({opacity:"",cursor:"pointer"}),o.checkValidation(),o.$okButton.jqxButton({disabled:!1});}),r.find(".brtc-va-refine-selectcolumn-column-check").on("unchecked",function(){r.addClass("sort-disabled"),r.find(".brtc-va-refine-selectcolumn-column-sort").css({opacity:"0.5",cursor:"default"}),r.find(".brtc-va-refine-selectcolumn-column-name").jqxInput({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-alias").jqxInput({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-type").jqxDropDownList({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-reset").css({opacity:"0.5",cursor:"default"}),o.isUncheckedAllItems(),o.checkValidation();}),r.find(".brtc-va-refine-selectcolumn-column-name").val(i.name),r.find(".brtc-va-refine-selectcolumn-column-name").jqxInput({theme:e.VA.Env.Theme,width:"172px",height:"27px"}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(r.find(".brtc-va-refine-selectcolumn-column-name")),r.find(".brtc-va-refine-selectcolumn-column-name").on("change",function(){o.checkValidation();}),r.find(".brtc-va-refine-selectcolumn-column-alias").data("default-alias",i.alias),r.find(".brtc-va-refine-selectcolumn-column-alias").val(i.alias),r.find(".brtc-va-refine-selectcolumn-column-alias").jqxInput({theme:e.VA.Env.Theme,width:"182px",height:"27px"}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(r.find(".brtc-va-refine-selectcolumn-column-alias")),r.find(".brtc-va-refine-selectcolumn-column-alias").on("change",function(){o.checkValidation();});r.find(".brtc-va-refine-selectcolumn-column-type").jqxDropDownList({theme:e.VA.Env.Theme,source:[{display:"String",value:"string"},{display:"Integer",value:"int"},{display:"Double",value:"double"},{display:"Long",value:"bigint"},{display:"Boolean",value:"boolean"}],width:90,height:25,animationType:"none",openDelay:0,displayMember:"display",valueMember:"value",autoDropDownHeight:!0});var a=r.find(".brtc-va-refine-selectcolumn-column-type").attr("id");$("#listBox"+a).insertBefore(r.closest(".ui-dialog")),i.type?(r.find(".brtc-va-refine-selectcolumn-column-type").data("default-type",i.type),r.find(".brtc-va-refine-selectcolumn-column-type").val(i.type)):r.find(".brtc-va-refine-selectcolumn-column-type").jqxDropDownList({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-reset").on("click",function(){r.find(".brtc-va-refine-selectcolumn-column-check").val()&&(r.find(".brtc-va-refine-selectcolumn-column-type").val(i.type),r.find(".brtc-va-refine-selectcolumn-column-alias").val(i.alias));}),i.checked?(r.find(".brtc-va-refine-selectcolumn-column-sort").css({opacity:"",cursor:"pointer"}),r.find(".brtc-va-refine-selectcolumn-column-reset").css({opacity:"",cursor:"pointer"})):(r.addClass("sort-disabled"),r.find(".brtc-va-refine-selectcolumn-column-sort").css({opacity:"0.5",cursor:"default"}),r.find(".brtc-va-refine-selectcolumn-column-name").jqxInput({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-alias").jqxInput({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-type").jqxDropDownList({disabled:!0}),r.find(".brtc-va-refine-selectcolumn-column-reset").css({opacity:"0.5",cursor:"default"}));},i.prototype.createSelect=function(){var t="",e=this.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),i=[];return e.each(function(t,e){$(e).find(".brtc-va-refine-selectcolumn-column-check").val()&&i.push(e);}),$(i).each(function(e,o){var n=$(o).find(".brtc-va-refine-selectcolumn-column-name"),r=$(o).find(".brtc-va-refine-selectcolumn-column-alias"),a=$(o).find(".brtc-va-refine-selectcolumn-column-type");a.val()?t+="cast(`"+n.val()+"` as "+a.val()+") as `"+r.val()+"`":t+="`"+n.val()+"` as `"+r.val()+"`",t+=e0)e.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var t=this.createSelect();this.buildFunctionUnit("Select Column","selectColumn",t,""),e.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},i.prototype.buildFunctionUnit=function(t,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:e.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:t},this.resultFnUnit=r;},i.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},i.prototype.renderValidation=function(){var t=this,e=this.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item");$.each(this.problems,function(i,o){var n;"Name"===o.param?n=$(e[o.paramIndex]).find(".brtc-va-refine-selectcolumn-column-name"):"Alias"===o.param&&(n=$(e[o.paramIndex]).find(".brtc-va-refine-selectcolumn-column-alias")),t.createValidationContent($(e[o.paramIndex]),o,n),t.$mainControl.find(".brtc-va-refine-step-validation-tooltip").css({width:"465px","margin-left":"45px"});});},i.prototype.checkValidation=function(){var t=this;this.removeValidation();var e=[];for(var i in t.options.columns){e.push(t.options.columns[i].name);}var o=this.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),n=[],r=!1;o.each(function(e,i){if($(i).find(".brtc-va-refine-selectcolumn-column-check").val()){r=!0,""==$(i).find(".brtc-va-refine-selectcolumn-column-name").val()&&t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:e,param:"Name",messageParam:["Name"]}));var o=$(i).find(".brtc-va-refine-selectcolumn-column-alias").val();if(""==o)t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:e,param:"Alias",messageParam:["Alias"]}));else if($.inArray(o,n)>-1){var a="Alias - '"+o+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:e,param:"Alias",messageParam:[a]}));}else n.push(o);}}),r||this.addProblem(t.createProblem({errorCode:"BR-0001",paramIndex:-1,param:"Column",messageParam:["Column"]})),this.renderValidation();},i.prototype.createAliasHelper=function(i){var o=this,n=$('
Alias Setting

');i.append(n);var r=n.find(".brtc-va-refine-selectcolumn-column-fix-input"),a=n.find(".brtc-va-refine-selectcolumn-column-find-input"),s=n.find(".brtc-va-refine-selectcolumn-column-replace-input");r.jqxInput({theme:e.VA.Env.Theme}),a.jqxInput({theme:e.VA.Env.Theme}),s.jqxInput({theme:e.VA.Env.Theme}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(r),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(a),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(s);var l=n.find(".brtc-va-refine-selectcolumn-column-uppercase-button"),c=n.find(".brtc-va-refine-selectcolumn-column-lowercase-button"),d=n.find(".brtc-va-refine-selectcolumn-column-firstuppercase-button"),p=n.find(".brtc-va-refine-selectcolumn-column-prefix-button"),u=n.find(".brtc-va-refine-selectcolumn-column-suffix-button"),h=n.find(".brtc-va-refine-selectcolumn-column-prefix-index-button"),f=n.find(".brtc-va-refine-selectcolumn-column-suffix-index-button"),m=n.find(".brtc-va-refine-selectcolumn-column-replace-button");l.jqxButton({theme:e.VA.Env.Theme}),c.jqxButton({theme:e.VA.Env.Theme}),d.jqxButton({theme:e.VA.Env.Theme}),p.jqxButton({theme:e.VA.Env.Theme}),u.jqxButton({theme:e.VA.Env.Theme}),h.jqxButton({theme:e.VA.Env.Theme}),f.jqxButton({theme:e.VA.Env.Theme}),m.jqxButton({theme:e.VA.Env.Theme}),l.click(function(){o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item").each(function(t,e){if($(e).find(".brtc-va-refine-selectcolumn-column-check").val()){var i=$(e).find(".brtc-va-refine-selectcolumn-column-alias"),o=i.val();i.val(o.toUpperCase());}});}),c.click(function(){o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item").each(function(t,e){if($(e).find(".brtc-va-refine-selectcolumn-column-check").val()){var i=$(e).find(".brtc-va-refine-selectcolumn-column-alias"),o=i.val();i.val(o.toLowerCase());}});}),d.click(function(){o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item").each(function(t,e){if($(e).find(".brtc-va-refine-selectcolumn-column-check").val()){var i=$(e).find(".brtc-va-refine-selectcolumn-column-alias"),o=i.val();i.val(o.charAt(0).toUpperCase()+o.slice(1));}});}),p.click(function(){var t=o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),e=$(".brtc-va-refine-selectcolumn-column-fix-input").val();t.each(function(t,i){if($(i).find(".brtc-va-refine-selectcolumn-column-check").val()){var o=$(i).find(".brtc-va-refine-selectcolumn-column-alias"),n=o.val();o.val(e+n);}});}),u.click(function(){var t=o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),e=$(".brtc-va-refine-selectcolumn-column-fix-input").val();t.each(function(t,i){if($(i).find(".brtc-va-refine-selectcolumn-column-check").val()){var o=$(i).find(".brtc-va-refine-selectcolumn-column-alias"),n=o.val();o.val(n+e);}});}),h.click(function(){var t=o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),e=1;t.each(function(t,i){if($(i).find(".brtc-va-refine-selectcolumn-column-check").val()){var o=$(i).find(".brtc-va-refine-selectcolumn-column-alias"),n=o.val();o.val(e++ +n);}});}),f.click(function(){var t=o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),e=1;t.each(function(t,i){if($(i).find(".brtc-va-refine-selectcolumn-column-check").val()){var o=$(i).find(".brtc-va-refine-selectcolumn-column-alias"),n=o.val();o.val(n+e++);}});}),m.click(function(){var t=o.$mainControl.find(".brtc-va-refine-selectcolumn-contents > .brtc-va-refine-selectcolumn-column-item"),e=$(".brtc-va-refine-selectcolumn-column-find-input").val(),i=$(".brtc-va-refine-selectcolumn-column-replace-input").val();t.each(function(t,o){if($(o).find(".brtc-va-refine-selectcolumn-column-check").val()){var n=$(o).find(".brtc-va-refine-selectcolumn-column-alias"),r=n.val();n.val(r.split(e).join(""+i));}});});},i.prototype.destroy=function(){this.destroyDropDownList(),this.$mainControl.dialog("destroy"),"function"==typeof this.options.close&&this.options.close(this.dialogResult);},i.prototype.destroyDropDownList=function(){var t=$(".brtc-va-refine-selectcolumn-column-type");t.length>0&&t.jqxDropDownList("destroy");},e.VA.Core.Dialogs.RefineSteps.SelectColumnDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Simple Filter";},e.prototype.createDialogContentsArea=function(t){t.append('
'),this.render(),t.perfectScrollbar(),t.perfectScrollbar("update");},e.prototype.parseSql=function(t){var e={},i=t.indexOf(" ");e.name=t.substring(0,i).trim();var o=t.substring(i).trim(),n=o.indexOf(" ");return e.condition=o.substring(0,n).trim(),e.columnValue=o.substring(n).trim(),e;},e.prototype.render=function(){var t,e,i="and";if(this.options.param){var o=this.options.param["additional-query"].split(" \n");for(var n in o){if(o[n].startsWith("WHERE")){var r=o[n].replace("WHERE ","").trim();(t=this.parseSql(r)).name=t.name.replace(/`/gi,"");}else{i=o[n].startsWith("and")?"and":"or";var a=o[n].replace(i,"").trim();(e=this.parseSql(a)).name=e.name.replace(/`/gi,"");}}}this.createColumnItem(t),this.createSimplefilterRadioButton({type:i}),this.createColumnItem(e),this.checkValidation();},e.prototype.createSimplefilterRadioButton=function(e){var i=this.$mainControl.find(".brtc-va-refine-simplefilter-contents"),o=$('
And
Or
');i.append(o),i.find(".brtc-va-dialogs-simplefilter-type-and").jqxRadioButton({checked:"and"==e.type,theme:t.VA.Env.Theme}),i.find(".brtc-va-dialogs-simplefilter-type-or").jqxRadioButton({checked:"or"==e.type,theme:t.VA.Env.Theme});},e.prototype.createColumnItem=function(e){var i=this,o=this.$mainControl.find(".brtc-va-refine-simplefilter-contents"),n=$('
');o.append(n);var r=n.find(".brtc-va-refine-simplefilter-column-name");this.data=[],this.data=this.options.columns;var a=this.createColumnList(r,{rowCount:1,multiple:!1,showOpener:"click",removable:!1,fromModal:!0},"brtc-va-editors-sheet-controls-width-3",{height:"25px","padding-left":"4px"});a.setItems(this.data),r.data("columnList",a);n.find(".brtc-va-refine-simplefilter-condition").jqxDropDownList({theme:t.VA.Env.Theme,source:["","=","<>",">",">=","<","<="],width:150});var s=$.map(this.options.columns,function(t,e){return t.name;}),l=CodeMirror.fromTextArea(n.find(".brtc-va-refine-simplefilter-column-value")[0],{mode:"brtc-control",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,scrollbarStyle:"null",extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:[].concat(s,t.VA.Env.SQLFunctions)}});l.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[i]),!0;}),l.setSize("calc(100% - 310px)","25px"),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(l),l.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[i]),!0;}),e&&(a.setSelectedItems([e.name]),n.find(".brtc-va-refine-simplefilter-condition").val(e.condition),l.setValue(e.columnValue)),a.onChange(function(t,e){i.checkValidation();}),n.find(".brtc-va-refine-simplefilter-condition").on("change",function(){i.checkValidation();}),l.on("change",function(t){i.checkValidation();}),r.find(".brtc-va-editors-sheet-controls-columnselector-columncontainer-element-empty").css({width:"100%","margin-left":"0px"});},e.prototype.getAdditionalQueryString=function(){var t=this.$mainControl.find(".brtc-va-refine-simplefilter-column-item"),e=this.getRadioButtonValue(),i=[];return $.each(t,function(e,o){var n,r=$(t[e]).find(".brtc-va-refine-simplefilter-column-name").data("columnList").getSelectedItems()[0];if(void 0!==r){n=$(t[e]).find(".brtc-va-refine-simplefilter-condition").val();var a=$(t[e]).find(".CodeMirror")[0].CodeMirror.getValue();i[e]="`"+r+"` "+n+" "+a+" ";}}),i[1]?"WHERE "+i[0]+"\n"+e+" "+i[1]:"WHERE "+i[0];},e.prototype.getRadioButtonValue=function(){var t="",e=this.$mainControl.find(".brtc-va-dialogs-simplefilter-type-and"),i=this.$mainControl.find(".brtc-va-dialogs-simplefilter-type-or");return e.jqxRadioButton("checked")?t="and":i.jqxRadioButton("checked")&&(t="or"),t;},e.prototype.handleOkClicked=function(){if(this.problems.length>0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var e=this.getAdditionalQueryString();this.buildFunctionUnit("Simple Filter","simpleFilter","*",e),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.buildFunctionUnit=function(e,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:t.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:e},this.resultFnUnit=r;},e.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},e.prototype.renderValidation=function(){},e.prototype.checkValidation=function(){var t=this;this.removeValidation();var e=this.$mainControl.find(".brtc-va-refine-simplefilter-column-item");$.each(e,function(i,o){var n,r,a=$(e[i]).find(".brtc-va-refine-simplefilter-column-name").data("columnList").getSelectedItems()[0];if(0==i&&null==a)t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:i,param:"Column",messageParam:["Column"]}));else if(0==i||1==i&&null!=a){n=$(e[i]).find(".brtc-va-refine-simplefilter-condition").val(),r=$(e[i]).find(".CodeMirror")[0].CodeMirror.getValue(),""==n?t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:i,param:"Operator",messageParam:["Operator"]})):""==r&&t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:i,param:"Value",messageParam:["Value"]}));}}),this.renderValidation();},e.prototype.destroy=function(){this.destroyColumnSelector(),this.destroyDropDownList(),this.$mainControl.dialog("destroy"),"function"==typeof this.options.close&&this.options.close(this.dialogResult);},e.prototype.destroyDropDownList=function(){var t=$(".brtc-va-refine-simplefilter-condition");t.length>0&&t.jqxDropDownList("destroy");},t.VA.Core.Dialogs.RefineSteps.SimpleFilterDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.RefineSteps.StepDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype),e.prototype.constructor=e,e.prototype.getTitle=function(){return"Sorter";},e.prototype.createDialogContentsArea=function(e){var i=this;e.append('
+ Add New Column
'),e.find(".brtc-va-refine-sortcolumn-newcolumn-container").sortable({axis:"y",containment:".brtc-va-refine-sortcolumn-newcolumn-container",helper:function helper(t,e){var i=$(e).clone();return i.css("position","absolute"),i.get(0);},handle:".brtc-va-refine-sortcolumn-column-sort",stop:function stop(t,e){}}),e.find(".brtc-va-refine-sortcolumn-newcolumn-container").disableSelection(),this.render(),e.find(".brtc-va-refine-sortcolumn-addbutton").jqxButton({theme:t.VA.Env.Theme}).click(function(){i.createNewSortItem(),i.checkValidation();}),e.perfectScrollbar(),e.perfectScrollbar("update");},e.prototype.render=function(){if(this.options.param){var t=this.options.param["additional-query"].replace(/ \n/gi,"\n").split("\n");t[0].startsWith("ORDER BY")&&t.splice(0,1),""==t[t.length-1]&&t.splice(t.length-1,1);for(var e=0;e
');i.append(o);var n=o.find(".brtc-va-refine-sortcolumn-column-name"),r=this.createColumnList(n,{rowCount:1,multiple:!1,showOpener:"click",removable:!1,fromModal:!0},"brtc-va-editors-sheet-controls-width-10",{height:"25px","padding-left":"4px"});r.setItems(this.options.columns),o.data("columnList",r);var a=o.find(".brtc-va-refine-sortcolumn-column-propertycontrol-button");this.createButton(a,{width:"19px",height:"19px"},"",{float:"left","margin-left":"3px"}),a.data("sort-mode","ASC"),a.on("click",function(){var t=r.getSelectedItems(),i=$.grep(e.options.columns,function(e,i){return e.name===t[0];});i&&i.length>0&&("ASC"===a.data("sort-mode")?a.data("sort-mode","DESC"):a.data("sort-mode","ASC"),e.updateSortModeIcon(a,r));}),r.onChange(function(t,i){e.updateSortModeIcon(a,r),e.checkValidation();}),o.find(".brtc-va-refine-sortcolumn-column-remove").click(function(){$(this).closest(".brtc-va-refine-sortcolumn-column-item").remove(),e.checkValidation();}),t&&(r.setSelectedItems([t.name]),a.data("sort-mode",t["sort-mode"]),this.updateSortModeIcon(a,r)),o.find(".brtc-va-refine-sortcolumn-column-sort").css("margin-bottom","5px");},e.prototype.createAdditionalQuery=function(){var t="ORDER BY \n",e=this.$mainControl.find(".brtc-va-refine-sortcolumn-newcolumn-container").find(".brtc-va-refine-sortcolumn-column-item");return e.each(function(i,o){var n=$(o).data("columnList"),r=$(o).find(".brtc-va-refine-sortcolumn-column-propertycontrol-button"),a=n.getSelectedItems();if(a.length){var s=r.data("sort-mode");t+="`"+a[0]+"` "+s,t+=i0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("There is a problem with some values.");else{var e=this.createAdditionalQuery();this.buildFunctionUnit("Sort","sortByRefine","*",e),t.VA.Core.Dialogs.RefineSteps.StepDialog.prototype.handleOkClicked.call(this);}},e.prototype.buildFunctionUnit=function(e,i,o,n){var r=this.DEFAULT_FN_UNIT;r.fid=this.options.fid?this.options.fid:t.VA.Core.Utils.IDGenerator.func.id(),r.func=i,r.name="python"===this.options.context?"PythonScript":"SQLExecutor",r.inData=this.options.in,r.outData=this.options.out,r.param={select:o,"additional-query":n},"python"===this.options.context&&(r.param.script=this.buildScript(o,n),r.param["out-table-alias"]=["result"]),r.display={label:e},this.resultFnUnit=r;},e.prototype.buildScript=function(t,e){var i=this.DEFAULT_SCRIPT,o=t.replace(/\n/g,""),n=e.replace(/\n/g,"");return i=(i=i.replace("${SELECT_SQL}",o)).replace("${ADDITIONAL_QUERY}",n);},e.prototype.renderValidation=function(){var t=this,e=this.$mainControl.find(".brtc-va-refine-sortcolumn-newcolumn-container").find(".brtc-va-refine-sortcolumn-column-item");$.each(this.problems,function(i,o){-1==o.paramIndex||(t.createValidationContent($(e[o.paramIndex]),o),$(e[o.paramIndex]).find(".brtc-va-refine-step-validation-tooltip").css({clear:"",float:"left","margin-top":"0px","margin-bottom":"10px","margin-left":"35px"}));});},e.prototype.checkValidation=function(){var t=this;this.removeValidation();var e=this.$mainControl.find(".brtc-va-refine-sortcolumn-newcolumn-container").find(".brtc-va-refine-sortcolumn-column-item"),i=[];e.length?e.each(function(e,o){var n=$(o).data("columnList").getSelectedItems();if(n.length){if($.inArray(n[0],i)>-1){var r="Select column(s) - '"+n[0]+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:e,param:"Select column",messageParam:[r]}));}else i.push(n[0]);}else t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:e,param:"Select column",messageParam:["Select column"]}));}):this.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:-1,param:"Column",messageParam:["Column"]})),this.renderValidation();},e.prototype.updateSortModeIcon=function(t,e){var i=e.getSelectedItems(),o=$.grep(this.options.columns,function(t,e){return t.name===i[0];}),n=t.data("sort-mode");if(o&&o.length>0){var r,a=o[0].type;t.find("i").removeClass(),"string"===a?(r="fa fa-sort-alpha-"+n.toLowerCase(),t.find("i").addClass(r)):"number"===a||"date"===a?(r="fa fa-sort-numeric-"+n.toLowerCase(),t.find("i").addClass(r)):(r="fa fa-sort",t.find("i").addClass(r));}},e.prototype.destroy=function(){this.destroyColumnSelector(),this.$mainControl.dialog("destroy"),"function"==typeof this.options.close&&this.options.close(this.dialogResult);},t.VA.Core.Dialogs.RefineSteps.SortDialog=e;}.call(this),function(){"use strict";var t=this,e=t.Brightics;function i(t,i){this.dropdownLists=[],e.VA.Dialogs.Dialog.call(this,t,i);}i.prototype=Object.create(e.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype.checkInfo=function(){Studio.getEditorContainer().getActiveModelEditor().checkInfo();},i.prototype._initOptions=function(){e.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=1400,this.dialogOptions.height=700,this.dialogOptions.maxWidth=1400,this.dialogOptions.maxHeight=700;},i.prototype._getInTableLabel=function(t){},i.prototype._getInModelLabel=function(t){},i.prototype._getInImageLabel=function(t){},i.prototype.createInTableAlias=function(t){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInTable(this.options.fnUnit),r=[];for(var _t8 in n){var a=o.getFnUnitByOutData(n[_t8]);_.isEmpty(a)||r.push(a);}for(var _o5 in r){var s=r[_o5],l=this._getInTableLabel(_o5),c=$('
'+l+"
"),d=s.parent().type,p=$('
'),u=e.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutTable(s)[0]),u.addClass("item"),c.append(p),t.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},i.prototype.createInModelAlias=function(t){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInModel(this.options.fnUnit),r=[];for(var _t9 in n){r.push(o.getFnUnitByOutData(n[_t9]));}for(var _o6 in r){var a=r[_o6],s=this._getInModelLabel(_o6),l=$('
'+s+"
"),c=a.parent().type,d=$('
'),p=e.VA.Core.Utils.WidgetUtils.createPaletteItem(d,a.func,c);p.find(".brtc-va-views-palette-fnunit-label").text(a.display.label).attr("variable",s),d.attr("value",this.FnUnitUtils.getOutModel(a)[0]),p.addClass("item"),l.append(d),t.append(l),l.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},i.prototype.createInImageAlias=function(t){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInImage(this.options.fnUnit),r=[];for(var _t10 in n){r.push(o.getFnUnitByOutData(n[_t10]));}for(var _o7 in r){var a=r[_o7],s=this._getInImageLabel(_o7),l=$('
'+s+"
"),c=a.parent().type,d=$('
'),p=e.VA.Core.Utils.WidgetUtils.createPaletteItem(d,a.func,c);p.find(".brtc-va-views-palette-fnunit-label").text(a.display.label).attr("variable",s),d.attr("value",this.FnUnitUtils.getOutImage(a)[0]),p.addClass("item"),l.append(d),t.append(l),l.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},i.prototype.createDialogContentsArea=function(t,e){this.scriptEditorOptions={statement:"",scriptType:"",mode:"",dataMap:{},fnUnit:{},additionalHint:[],maxLength:999999,close:function close(t){}},$.extend(!0,this.scriptEditorOptions,this.options),this.createLayout(),this.renderInfoArea(),this.renderEditorArea(),this.renderResultArea(),this.registerEvent();},i.prototype.destroy=function(){this.dropdownLists.forEach(function(t){t.jqxDropDownList("destroy");}),e.VA.Dialogs.Dialog.prototype.destroy.call(this);},i.prototype.createLayout=function(){this.$contentArea=this.$mainControl.find(".brtc-va-dialogs-contents");var t=!!this.options.scriptOnly&&this.options.scriptOnly,i=this.options.scriptType?this.options.scriptType:"script";this.$editorArea=$('
Up to '+e.VA.Core.Utils.CommonUtils.numberToStringWithComma(this.scriptEditorOptions.maxLength)+" characters can be entered.
"),this.$errorArea=this.$editorArea.find(".brtc-va-dialogs-contents-statement-error"),this.$infoArea=$('
'),this.$contentArea.append(this.$editorArea).append(this.$infoArea),this.$infoArea.perfectScrollbar();var o=this;this.$mainControl.on("resized",function(t){o.$infoArea.perfectScrollbar("update");});},i.prototype.registerEvent=function(){this.$editorArea.find("textarea").bind("showOverflow",function(){$(this).siblings(".brtc-va-dialogs-contents-statement-error").show();}),this.$editorArea.find("textarea").bind("hideOverflow",function(){$(this).siblings(".brtc-va-dialogs-contents-statement-error").hide();});},i.prototype.renderEditorArea=function(){this.codeMirror=CodeMirror.fromTextArea(this.$editorArea.find("textarea")[0],{mode:this.scriptEditorOptions.mode,theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!0,matchBrackets:!0,autofocus:!1,extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:this.scriptEditorOptions.additionalHint}}),e.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror),e.VA.Core.Utils.WidgetUtils.setCodeMirrorMaxLength(this.codeMirror),this.setEditorStatement(this.options.statement),this.codeMirror.setSize("100%","100%"),this.codeMirror.setOption("maxLength",this.scriptEditorOptions.maxLength);},i.prototype.renderResultArea=function(t){},i.prototype.setEditorStatement=function(t){this.codeMirror.setValue(t),this.codeMirror.clearHistory();},i.prototype.renderInfoArea=function(){},i.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,queryStatement:this.codeMirror.getValue()},this.$mainControl.dialog("close");},i.prototype.createDropDownList=function(t,i,o,n){var r=$('
');t.append(r);var a={theme:e.VA.Env.Theme,width:"100%",height:"20px",source:[{text:"TABLE",value:"table"},{text:"MODEL",value:"model"},{text:"IMAGE",value:"image"}],displayMember:"text",selectedIndex:0,valueMember:"value",dropDownHeight:70};r.jqxDropDownList(a),this.dropdownLists.push(r);},i.prototype.createInput=function(i,o,n,r){this.wrapControl(i);var a="";n&&(a=a.concat(" ",n)),i.attr("type")||i.attr("type","text"),i.attr("maxlength")||i.attr("maxlength","100"),this.addClassToWrapper(i,a),this.addCssToWrapper(i,r);var s={theme:e.VA.Env.Theme,height:"25px"};o&&$.extend(s,o),i.jqxInput(s);var l=i.val();i.focus(function(){l=i.val();}),$("svg").on("mousedown",function(){i.val()!==l&&i.is(":focus")&&i.trigger("change");}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(i);},i.prototype.createRadioButton=function(t,i,o,n){this.wrapControl(t);var r="brtc-va-editors-sheet-controls-radiobutton-default";o&&(r=r.concat(" ",o)),this.addClassToWrapper(t,r),this.addCssToWrapper(t,n);var a={theme:e.VA.Env.Theme};return i&&$.extend(a,i),t.jqxRadioButton(a),t;},i.prototype.wrapControl=function(t){var e=$('
');t.wrap(e);},i.prototype.addClassToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.addClass(e);}},i.prototype.addCssToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.css(e);}},e.VA.Core.Dialogs.ScriptEditorDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=600,this.dialogOptions.height=800;},e.prototype.createControls=function(){this.$mainControl=$('
'),this.$titleArea=this.$mainControl.find(".brtc-va-dialogs-title");},e.prototype.initContents=function(){t.VA.Dialogs.Dialog.prototype.initContents.call(this),this.createTitleArea();},e.prototype.createTitleArea=function(){this.createLabel(),this.createHelp(),this.createContext(),this.setLabel();},e.prototype.createLabel=function(){this.$label=$('
'),this.$titleArea.append(this.$label);},e.prototype.createHelp=function(){this.$help=$('
'),this.$titleArea.append(this.$help),this.createHelpPopover();},e.prototype.createContext=function(){var t=this;this.$contenxt=$('
'),this.$titleArea.append(this.$contenxt),this.createPropertiesContextMenu(),this.$contenxt.on("click",function(e){var i=$(window).scrollTop(),o=$(window).scrollLeft(),n=parseInt(e.clientX)+o;$(window).width()-e.clientX<100&&(n-=130);var r=parseInt(e.clientY)+i;r+=5,t.$ctxMenu.jqxMenu("open",n,r),$(window).on("resize",t.ctxMenuCloseHandler);});},e.prototype.setLabel=function(t){t=t||this.options.fnUnit.display.label;this.$label.text(t);},e.prototype.createHelpPopover=function(){var e=this;this.$help.click(function(){var i=e.getPrimaryOperation(),o=e.getFunctionDef().defaultFnUnit.context||"scala",n=e.getFunctionDef().fnUnit.func;"process"===e.getFunctionDef().category&&(o="common"),t.VA.Core.Utils.ModelUtils.openFunctionReferencePopup("data",i,o,n);});},e.prototype.createPropertiesContextMenu=function(){var e=this,i=$('
  • Edit
');this.$titleArea.append(i),this.$ctxMenu=i.jqxMenu({theme:t.VA.Env.Theme,width:"120px",height:"120px",autoOpenPopup:!1,mode:"popup",animationHideDuration:0,animationShowDuration:0}),this.$ctxMenu.on("itemclick",function(i){if("rename"==$(i.args).attr("action")){var o={title:"Edit Function",label:e.options.fnUnit.display.label,description:e.options.fnUnit.display.description||"",close:function close(t){t.OK&&(e.setLabel(t.label),e.options.fnUnit.display.label=t.label,e.options.fnUnit.display.description=t.description);}};new t.VA.Core.Dialogs.EditResourceDialog($(document.body),o);}}),this.ctxMenuCloseHandler=function(){e.$ctxMenu.jqxMenu("close");},this.$ctxMenu.on("closed",function(){$(window).off("resize",e.ctxMenuCloseHandler);});},e.prototype.getPrimaryOperation=function(){var e=this.options.editor.getModel().type;return t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(e,this.options.fnUnit.func).defaultFnUnit.name;},e.prototype.getFunctionDef=function(){var e=this.options.editor.getModel().type;return t.VA.Core.Utils.WidgetUtils.getFunctionLibrary(e,this.options.fnUnit.func);},t.VA.Core.Dialogs.FnUnitDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils;function i(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}i.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=685,this.dialogOptions.height=435,this.projectId=this.options.editorInput.getProjectId(),this.fileId=this.options.editorInput.getFileId();},i.prototype.createDialogContentsArea=function(i){var o=this;i.append('
Schedule Name
Cron Expression
IMMEDIATE
Schedule Owner
Is Active
Dependency Schedule
Model Version
'),this.$scheduleNameInput=i.find(".brtc-va-dialogs-schedule-name-input").jqxInput({theme:t.VA.Env.Theme}),e.InputValidator.appendValidationCondition(this.$scheduleNameInput),t.VA.Core.Utils.WidgetUtils.setTrimInputControlOnFocusout(i.find(".brtc-va-dialogs-schedule-name-input")),this.$cronInput=i.find(".brtc-va-dialogs-schedule-cron-input").jqxInput({theme:t.VA.Env.Theme}),e.InputValidator.appendValidationCondition(this.$cronInput),$(".brtc-va-dialogs-schedule-cron-help").on("click",function(){window.open("cron-expression","Brightics Cron Expression Help");}),this.$chkimmediate=i.find(".brtc-va-dialogs-schedule-cron-checkbox").jqxCheckBox({theme:t.VA.Env.Theme}),this.$chkimmediate.on("change",function(t){1==t.args.checked?o.$cronInput.jqxInput({disabled:!0,value:"IMMEDIATE"}):o.$cronInput.jqxInput({disabled:!1,value:""});}),this.$scheduleOwnerInput=i.find(".brtc-va-dialogs-schedule-owner-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0,value:t.VA.Env.Session.userId}),this.$activeSelector=i.find(".brtc-va-dialogs-schedule-active-selector").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:["Y","N"],selectedIndex:0}),this.$dependencySelector=i.find(".brtc-va-dialogs-schedule-dependency-selector").jqxDropDownList({theme:t.VA.Env.Theme,displayMember:"scheduleName",valueMember:"scheduleId",placeHolder:"Please Choose:",dropDownHeight:300}),this.$modelVersionInput=i.find(".brtc-va-dialogs-schedule-model-version-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0,placeHolder:"Select version"}),this.$loadVersionButton=i.find(".brtc-va-dialogs-model-version-load"),this.$loadVersionButton.jqxButton({theme:t.VA.Env.Theme,width:120,height:27}),this.$loadVersionButton.on("click",function(){o.openSelectVersionDialog();});var n=[];n.push(new Promise(function(i,n){$.ajax({url:"api/admin/v2/schedules",type:"GET",contentType:"application/json; charset=utf-8"}).done(function(t){$.each(t,function(i,o){t[i].scheduleId=e.WidgetUtils.convertHTMLSpecialChar(o.scheduleId);}),o.$dependencySelector.jqxDropDownList({source:t}),o.$dependencySelector.jqxDropDownList("insertAt","",0);}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});})),Promise.all(n).catch(function(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog(e);}).then(function(){}),o.initData();},i.prototype.openSelectVersionDialog=function(){var e=function(t){if(t.OK){var e=t.data;this.$modelVersionInput.val(e.getVersion()),this.versionId=e.getVersionId(),this.versionContents=e.getContents();}}.bind(this);new t.VA.Core.Dialogs.SelectVersionDialog(this.$mainControl,{projectId:this.projectId,fileId:this.fileId,close:e});},i.prototype.initData=function(e){var i=this;i.fileList={};var o=Studio.getResourceManager();o.fetchProjects().then(function(t){return $.each(t,function(t,e){e.getProjectId()===i.options.editorInput.getProjectId()&&(i.projectLabel=e.getLabel());}),i.fileList[i.options.editorInput.getProjectId()]={},o.fetchFiles(i.options.editorInput.getProjectId()).then(function(t){return $.each(t,function(t,e){i.fileList[i.options.editorInput.getProjectId()][e.getFileId()]=e;}),!0;});}).catch(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});},i.prototype.handleOkClicked=function(){var e=this;if(""===e.$scheduleNameInput.val())return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter schedule name."),void $(".brtc-va-dialogs-schedule-name-input").focus();if(""!==e.$modelVersionInput.val()){if(""===_.trim(e.$cronInput.val()))return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter cron expression."),void $(".brtc-va-dialogs-schedule-cron-input").focus();if(!$(".brtc-va-dialogs-schedule-cron-checkbox").jqxCheckBox("checked")&&!new RegExp("^\\s*($|#|\\w+\\s*=|(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[01]?\\d|2[0-3])(?:(?:-|/|\\,)(?:[01]?\\d|2[0-3]))?(?:,(?:[01]?\\d|2[0-3])(?:(?:-|/|\\,)(?:[01]?\\d|2[0-3]))?)*)\\s+(\\?|\\*|(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?(?:,(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?)*)\\s+(\\?|\\*|(?:[1-9]|1[012])(?:(?:-|/|\\,)(?:[1-9]|1[012]))?(?:L|W)?(?:,(?:[1-9]|1[012])(?:(?:-|/|\\,)(?:[1-9]|1[012]))?(?:L|W)?)*|\\?|\\*|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?(?:,(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)*)\\s+(\\?|\\*|(?:[0-6])(?:(?:-|/|\\,|#)(?:[0-6]))?(?:L)?(?:,(?:[0-6])(?:(?:-|/|\\,|#)(?:[0-6]))?(?:L)?)*|\\?|\\*|(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?(?:,(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?)*)(|\\s)+(\\?|\\*|(?:|\\d{4})(?:(?:-|/|\\,)(?:|\\d{4}))?(?:,(?:|\\d{4})(?:(?:-|/|\\,)(?:|\\d{4}))?)*))$").test(e.$cronInput.val()))return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Syntax error in cron expression."),void $(".brtc-va-dialogs-schedule-cron-input").focus();e.modelDBContents=this.options.editorInput.getContents();var i=function i(_i15){_i15.OK&&t.VA.Core.Utils.RunnableFactory.createForFlow(e.versionContents,void 0,void 0,_i15.args).then(function(o){var n=_.merge(o,{duration:_i15.duration});_.forIn(n.models,function(e){_.forEach(e.functions,function(e){t.VA.Core.Utils.ModelUtils.carvePersist(e,!0);});}),delete n.report;var r={scheduleId:t.VA.Core.Utils.IDGenerator.schedule.id(),scheduleName:e.$scheduleNameInput.val(),cronExpression:e.$cronInput.val(),scheduleOwner:t.VA.Env.Session.userId,scheduleType:"JSON",executeContents:JSON.stringify(n),fileId:e.options.editorInput.getLabel(),projectId:e.projectLabel,isActive:e.$activeSelector.val(),modifyUser:t.VA.Env.Session.userId,dependencyId:e.$dependencySelector.val()},a={url:"api/admin/v2/schedules",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify(r),blocking:!0};$.ajax(a).done(function(){t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(e);}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});});};"true"===t.VA.SettingStorage.getValue("editor.variable.visible")&&"data"===e.modelDBContents.type&&e.modelDBContents.hasOwnProperty("variables")&&Object.keys(e.modelDBContents.variables).length>0?new t.VA.Core.Dialogs.RunDataDialog(e.$parent,{close:i,analyticsModel:e.modelDBContents}):i({OK:!0});}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please select model version.");},i.prototype.destroy=function(){this.$activeSelector.jqxDropDownList("destroy"),this.$dependencySelector.jqxDropDownList("destroy"),t.VA.Dialogs.Dialog.prototype.destroy.call(this);},t.VA.Core.Dialogs.AddScheduleDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=400,this.dialogOptions.height=300;},e.prototype.createDialogContentsArea=function(e){e.append('
Template
Name
');var i=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"id"},{name:"label"}],url:"api/va/v2/ws/libraries",async:!0});this.$librarySelector=e.find(".brtc-va-dialogs-add2lib-library-selector").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:i,selectedIndex:0,displayMember:"label",valueMember:"id",width:"calc(100% - 100px)",height:"25px"}),this.$nameInput=e.find(".brtc-va-dialogs-add2lib-library-name-input").jqxInput({theme:t.VA.Env.Theme,placeHolder:"Enter name",width:"calc(100% - 100px)",height:"25px"});},e.prototype.setFocus=function(){this.$nameInput.focus();},e.prototype.handleOkClicked=function(){this.$librarySelector.val()&&this.$nameInput.val().trim()?(this.dialogResult.library=this.$librarySelector.val(),this.dialogResult.label=this.$nameInput.val().trim(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)):t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter template and name.",function(){});},t.VA.Core.Dialogs.AddToLibraryDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils,i=t.VA.Dialogs.Dialog.prototype;function o(t,e){i.constructor.call(this,t,e);}o.prototype=Object.create(i),o.prototype.constructor=o,o.prototype._initOptions=function(){i._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=480,this.dialogOptions.maxHeight=480,this.dialogOptions.title="Update Version",this.options.resourceManager=Studio.getResourceManager(),this.options.file=this.options.resourceManager.getFile(this.options.projectId,this.options.fileId);},o.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-add-version-contents"),t.append('
Update
Major Version (X.o)
Minor Version (o.X)
Name
Description
Tags
'),this.$mainRadiobox=t.find(".brtc-va-dialogs-add-version-major-radio"),this.$subRadiobox=t.find(".brtc-va-dialogs-add-version-minor-radio"),this.createVersionControl(this.$mainRadiobox,this.$subRadiobox),this.createNameControl(t.find(".brtc-va-dialogs-add-version-name-input")),this.createTagsControl(t.find(".brtc-va-dialogs-add-version-tags-input")),this.createDescriptionControl(t.find(".brtc-va-dialogs-add-version-description-container")),this.$mainControl.dialog(this.dialogOptions),this.$tagsControl.focus();},o.prototype.createNameControl=function(e){this.$nameControl=e.jqxInput({disabled:"true",theme:t.VA.Env.Theme}),this.$nameControl.val(this.options.file.getLabel());},o.prototype.createTagsControl=function(e){this.$tagsControl=e.jqxInput({placeHolder:"Enter Tags",theme:t.VA.Env.Theme}),this.$tagsControl.val(this.options.tags);},o.prototype.createDescriptionControl=function(e){var i=this,o={focus:!1,height:155,description:this.options.file.description,okButton:this.$okButton,maxLength:2e3,toolbar:this.options.toolbar};this.noteControl=t.VA.Core.Widget.Factory.noteControl(e,o),this.$mainControl.on("resizing",function(t){i.noteControl.setHeight(i.$mainControl.find(".brtc-va-dialogs-contents").height()-110);});},o.prototype.createVersionControl=function(e,i){e.jqxRadioButton({theme:t.VA.Env.Theme,checked:!1,groupName:"update-version"}),i.jqxRadioButton({theme:t.VA.Env.Theme,checked:!0,groupName:"update-version"});},o.prototype.handleOkClicked=function(){this.debounced=this.debounced||_.debounce(function(){var e=this.noteControl.getCode();"


"===e&&(e="");var o=Studio.getResourceManager().getFile(this.options.projectId,this.options.fileId).getLabel(),n=new t.VA.Vo.Version();n.setVersionId(t.VA.Core.Utils.IDGenerator.version.id()),n.setTags(this.$tagsControl.val()),n.setLabel(o),n.setDescription(e),n.setIsMajor(!!this.$mainRadiobox.jqxRadioButton("checked")),this.options.resourceManager.addVersion(this.options.projectId,this.options.fileId,n).then(i.handleOkClicked.bind(this)).catch(this._onError.bind(this));}.bind(this),300),this.debounced();},o.prototype._onError=function(t){e.WidgetUtils.openBadRequestErrorDialog(t),this.close();},t.VA.Core.Dialogs.AddVersionDialog=o;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=600,this.dialogOptions.height=500;},e.prototype.createDialogContentsArea=function(t){t.append('
Array Delimiter
Key Value Delimiter
Array Start String
Array End String
Map Start String
Map End String
'),this.createInputControls(t.find(".brtc-va-dialogs-delimiter-input")),this.fillInputControls(t.find(".brtc-va-dialogs-delimiter-input"));},e.prototype.createInputControls=function(e){e.jqxInput({theme:t.VA.Env.Theme});},e.prototype.fillInputControls=function(t){for(var e,i,o,n=this.options.delimiters,r=this.options.defaultDelimiter,a=0;a
'),this.createCheckpointGroupControl(t.find(".brtc-va-dialogs-checkpoint-group")),this.createCheckpointControl(t.find(".brtc-va-dialogs-checkpoint-file")),this.init();},e.prototype.init=function(){this.isRendered=!1,this.splitedCheckpointPath=this.splitCheckpointFullPath(this.options.checkpointPath),this.getCheckPointGroupList();},e.prototype.createCheckpointGroupControl=function(e){var i=this,o=$('
Checkpoint Group
');e.append(o),this.$checkpointGroup=o.find(".brtc-va-dialogs-checkpoint-group-dropdownlist"),this.$checkpointGroup.jqxDropDownList({placeHolder:"please choose",displayMember:"name",valueMember:"path",theme:t.VA.Env.Theme,width:"calc(100% - 125px)",height:"25px",openDelay:0}),i.$checkpointGroup.on("change",function(){var t=i.$checkpointGroup.jqxDropDownList("getSelectedItem");i.dialogResult.checkpointPath="",i.getCheckPointList(t.label);});},e.prototype.createCheckpointControl=function(e){var i=this,o=$('
Checkpoint
');e.append(o),this.$checkpoint=o.find(".brtc-va-dialogs-checkpoint-file-dropdownlist"),this.$checkpoint.jqxDropDownList({placeHolder:"please choose",displayMember:"name",valueMember:"path",theme:t.VA.Env.Theme,width:"calc(100% - 125px)",height:"25px",openDelay:0}),i.$checkpoint.on("change",function(){i.dialogResult.checkpointPath=$(this).val();});},e.prototype.getCheckPointGroupList=function(e){var i=this,o={url:"api/va/v2/dl/browse?path=/checkpoint/"+t.VA.Env.Session.userId,type:"GET",blocking:!0,contentType:"application/json; charset=utf-8"};$.ajax(o).done(function(t){var e=i.splitedCheckpointPath.prefix,o=i.splitedCheckpointPath.splitKey,n=i.splitedCheckpointPath.checkpointGroup;i.$checkpointGroup.jqxDropDownList({source:t}),i.isRendered||i.$checkpointGroup.val(e+o+n);});},e.prototype.getCheckPointList=function(e){var i=this,o={url:"api/va/v2/dl/browse?path=/checkpoint/"+t.VA.Env.Session.userId+"/"+e,type:"GET",blocking:!1,contentType:"application/json; charset=utf-8"};$.ajax(o).done(function(t){if(i.$checkpoint.jqxDropDownList("clear"),i.$checkpoint.jqxDropDownList({source:t}),!i.isRendered){var e=i.splitedCheckpointPath.prefix,o=i.splitedCheckpointPath.splitKey,n=i.splitedCheckpointPath.checkpointGroup,r=i.splitedCheckpointPath.checkpoint;i.$checkpoint.val(e+o+n+"/"+r),i.isRendered=!0;}});},e.prototype.splitCheckpointFullPath=function(e){var i=t.VA.Env.Session.userId,o=i+"/",n="",r=[];if(e){var a=e.split(i+"/");n=a[0],r=a[1].split("/");}return{prefix:n,splitKey:o,checkpointGroup:r[0],checkpoint:r[1]};},t.VA.Core.Dialogs.CheckpointBrowserDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){this.$mainControl=$('
'),this.$mainControl.dialog(this.dialogOptions),this.$mainControl.parent().draggable("option","containment",this.$mainControl.closest(".brtc-va-editor"));},e.prototype._initOptions=function(){this.dialogOptions={title:"Function Clipboard",appendTo:this.$parent,position:{my:"left top",at:"left bottom",of:this.$parent.find(".brtc-style-s-editor-toolitem[item-type=clipboard]")},width:400,height:600,maxWidth:400,maxHeight:600,modal:!1,resizable:!1},this.destroyOnClose=!0;},e.prototype.initContents=function(){var e=this.$mainControl.find(".brtc-va-dialogs-body");this.$clipboardList=$('
'),e.append(this.$clipboardList),this.clipboardExplorer=new t.VA.Core.Views.ClipboardExplorer(this.$clipboardList,{height:"100%",modelType:t.VA.Implementation.DataFlow.Clazz,functionList:$.extend(!0,[],this.options.functionList)}),this.$clipboardList.perfectScrollbar();},e.prototype.updateFunctionList=function(t){this.clipboardExplorer.updateFunctionList(t),this.$clipboardList.perfectScrollbar("update");},e.prototype.setEnable=function(t){var e=this.$mainControl.find(".brtc-va-dialogs-body-disable");!0===t&&e.length>0?e.remove():!0!==t&&0===e.length&&this.$mainControl.append('
');},e.prototype.isAlive=function(){return!!this.$mainControl;},t.VA.Core.Dialogs.ClipboardDialog=e;}.call(this),function(t){"use strict";var e=t.Brightics;function i(t,i){e.VA.Dialogs.Dialog.call(this,t,i);var o,n=this;this._close=function(t){t.target.classList.contains("ui-widget-overlay")&&n.close();},$(window).on("mousedown",this._close),this.dialogResult.color=i.color,this.options.onClose&&(this.options.close=(o=this.options.onClose,function(t){t.color&&o(t.color);}));}i.prototype=Object.create(e.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype.createDialogContentsArea=function(t){this.$colorPicker=this.createColorPicker(t);},i.prototype._initOptions=function(){e.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.height="auto",this.dialogOptions.width="auto",this.dialogOptions.title="Color Picker";},i.prototype.createColorPicker=function(t){var e=this,i=$("
");i.jqxColorPicker({height:230,width:275,colorMode:"hue"}),i.jqxColorPicker("setColor",this.options.color),t.append(i);var o=function o(t){return t>=10?String.fromCharCode(t-10+"A".charCodeAt(0)):t.toString();};return i.bind("colorchange",function(t){var i;e.dialogResult.color=(i=t.args.color,"#"+["r","g","b"].map(function(t){var e=parseInt(i[t],10);return[parseInt(e/16,10),e%16].map(o).join("");}).join(""));}),i;},i.prototype.createDialogButtonBar=function(t){var i=this;this.$resetButton=$(''),t.append(this.$resetButton),this.$resetButton.jqxButton({theme:e.VA.Env.Theme}),this.$resetButton.click(function(){i.dialogResult.color=i.options.color,i.$colorPicker.jqxColorPicker("setColor",i.options.color);});},i.prototype.destroy=function(){e.VA.Dialogs.Dialog.prototype.destroy.call(this),$(window).off("mousedown",this._close);},e.VA.Dialogs.ColorPickerDialog=i;}(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=450,this.dialogOptions.height=250;},e.prototype.createDialogContentsArea=function(t){t.append('
'+_.escape(this.options.contentText)+'
'+_.escape(this.options.optionText)+"
"),this.createOptionControl(t.find(".brtc-va-dialogs-contents-option"));},e.prototype.createOptionControl=function(t){this.$includeControl=t.jqxCheckBox({theme:"office",height:25,checked:!0,boxSize:"17px"});},e.prototype.handleOkClicked=function(){this.dialogResult.OPTION=this.$includeControl.jqxCheckBox("val"),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},t.VA.Core.Dialogs.ConfirmWithOptionDialog=e;}.call(this),function(t){var e=t.Brightics;function i(t,i){var o=_.extend({title:"Datasource Management"},i);e.VA.Dialogs.Dialog.call(this,t,o);}i.prototype=Object.create(e.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype._initOptions=function(){e.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=800,this.dialogOptions.height=600;},i.prototype.createDialogContentsArea=function(t){return this.datasourceManagementView=new e.VA.Core.Views.DatasourceManagementView(t),this.datasourceManagementView.getElement();},i.prototype.createDialogButtonBar=function(t){e.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,t),this.$cancelButton.hide(),this.$okButton.val("Close");},i.prototype.destroy=function(){var _e$VA$Dialogs$Dialog$;for(var _len=arguments.length,t=new Array(_len),_key=0;_key<_len;_key++){t[_key]=arguments[_key];}(_e$VA$Dialogs$Dialog$=e.VA.Dialogs.Dialog.prototype.destroy).call.apply(_e$VA$Dialogs$Dialog$,[this].concat(t)),this.datasourceManagementView&&(this.datasourceManagementView.destroy(),this.datasourceManagementView=null);},e.VA.Core.Dialogs.DatasourceManagementDialog=i;}(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.ScriptEditorDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.ScriptEditorDialog.prototype),e.prototype.constructor=e,e.prototype.renderInfoArea=function(){},e.prototype.setEditorStatement=function(t){this.codeMirror.setValue(t),this.codeMirror.clearHistory(),this.selectMarker=this.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0});},t.VA.Core.Dialogs.DBReaderSqlEditorDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i),this.selectedVersion="";}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=480;},e.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-editresourcedialog-contents"),t.append('
Target
Name
Description
'),this.createTargetControl(t.find(".brtc-va-editors-sheet-controls-propertycontrol-input")),this.createNameControl(t.find(".brtc-va-dialogs-editresourcedialog-name-input")),this.createDescriptionControl(t.find(".brtc-va-dialogs-editresourcedialog-description-container")),this.$serverControl.focus();},e.prototype.createTargetControl=function(e){var i={datatype:"json",datafields:[{name:"datasourceName"},{name:"datasourceType"}],url:"api/va/v2/ws/deploy/target",async:!0},o=new $.jqx.dataAdapter(i);o.dataBind(i),this.$serverControl=e.jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,width:"91%",placeHolder:"Choose Target Server",selectedIndex:2,source:o,displayMember:"datasourceName"});},e.prototype.createSelectVersionControl=function(e,i){this.$versionInput=e.jqxInput({theme:t.VA.Env.Theme,placeHolder:"Select version"}),this.$versionButton=i.jqxButton({theme:t.VA.Env.Theme});var o=function(t){this.$versionInput.val(t.getMajorVersion()+"."+t.getMinorVersion()),this.selectedVersion=t.getVersionId();}.bind(this),n=function(){var e=new t.VA.EventEmitter();e.on("select",o),new t.VA.Core.Dialogs.SelectVersionDialog(this.$mainControl,{projectId:this.options.projectId,fileId:this.options.fileId,emitter:e});}.bind(this);this.$versionButton.on("click",n);},e.prototype.createNameControl=function(e){this.$nameControl=e.jqxInput({placeHolder:"Enter name",theme:t.VA.Env.Theme});},e.prototype.createDescriptionControl=function(e){var i=this,o={focus:!1,height:188,okButton:this.$okButton,maxLength:2e3,toolbar:this.options.toolbar,callbacks:{onFocus:function onFocus(){i.$serverControl.jqxDropDownList("isOpened")&&i.$serverControl.jqxDropDownList("close");}}};this.noteControl=t.VA.Core.Widget.Factory.noteControl(e,o),this.$mainControl.on("resizing",function(t){i.noteControl.setHeight(i.$mainControl.find(".brtc-va-dialogs-contents").height()-110);});},e.prototype.handleOkClicked=function(){"Choose Target Server"!=this.$serverControl.val()?""!==this.$nameControl.val().trim()?(this.dialogResult.server=this.$serverControl.val(),this.dialogResult.name=this.$nameControl.val().trim(),this.dialogResult.description=this.noteControl.getCode(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)):t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter name."):t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please choose target server.");},t.VA.Core.Dialogs.DeployModelDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=680,this.dialogOptions.height=540,this.dialogOptions.keyboardCloseKey="",this.dialogOptions.closeOnEscape=!1;},e.prototype.createDialogContentsArea=function(t){t.append(''),this.detailText=CodeMirror.fromTextArea(t.find(".brtc-va-dialogs-launch-progress-logs")[0],{mode:"text/html",theme:"default",lineNumbers:!1,matchBrackets:!0,autofocus:!0,readOnly:!0}),this.detailText.setSize("100%","100%"),this.detailText.setValue(this.options.detailText),this.detailText.focus(),t.css("height","calc(100% - 10px)");},e.prototype.createDialogButtonBar=function(t){t.hide();},t.VA.Core.Dialogs.DetailDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils;function i(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}i.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=685,this.dialogOptions.height=435;},i.prototype.createDialogContentsArea=function(i){var o=this,n=o.options.schedule;i.append('
Schedule Name
Cron Expression
Schedule Owner
Is Active
Dependency Schedule
Model Version
'),this.$scheduleNameInput=i.find(".brtc-va-dialogs-schedule-name-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0}),this.$scheduleNameInput.val(n.scheduleName),this.$cronInput=i.find(".brtc-va-dialogs-schedule-cron-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0}),this.$cronInput.val(n.cronExpression),this.$scheduleOwnerInput=i.find(".brtc-va-dialogs-schedule-owner-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0}),this.$scheduleOwnerInput.val(n.scheduleOwner),this.$activeSelector=i.find(".brtc-va-dialogs-schedule-active-selector").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:["Y","N"],disabled:!0}),this.$activeSelector.val(n.isActive),this.$dependencySelector=i.find(".brtc-va-dialogs-schedule-dependency-selector").jqxDropDownList({theme:t.VA.Env.Theme,displayMember:"scheduleName",valueMember:"scheduleId",dropDownHeight:300,disabled:!0}),this.$modelVersionInput=i.find(".brtc-va-dialogs-schedule-model-version-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0,placeHolder:"Select version"});var r=Studio.getResourceManager().fetchVersions(this.options.editorInput.getProjectId(),this.options.editorInput.getFileId()).then(function(t){var e="",i=o.getVersionInfo(JSON.parse(n.executeContents)).id;return _.forEach(t,function(t){i===t.getVersionId()&&(e=t.getVersion());}),o.$modelVersionInput.val(e),!0;}),a=[];a.push(new Promise(function(i,r){$.ajax({url:"api/admin/v2/schedules",type:"GET",contentType:"application/json; charset=utf-8"}).done(function(t){$.each(t,function(i,o){t[i].scheduleId=e.WidgetUtils.convertHTMLSpecialChar(o.scheduleId);}),o.$dependencySelector.jqxDropDownList({source:t}),o.$dependencySelector.jqxDropDownList("insertAt","",0),o.$dependencySelector.val(n.dependencyId),i();}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),r(e);});})),a.push(r),Promise.all(a).catch(function(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog(e);}).then(function(){});},i.prototype.getVersionInfo=function(t){var e,i=t.models;for(var o in i){e=i[o].version_id;}return{name:"",id:e};},i.prototype.createDialogButtonBar=function(e){this.$editButton=$(''),e.append(this.$editButton),this.$editButton.jqxButton({theme:t.VA.Env.Theme}),this.$editButton.click(this.handleEditClicked.bind(this)),this.$deleteButton=$(''),e.append(this.$deleteButton),this.$deleteButton.jqxButton({theme:t.VA.Env.Theme}),this.$deleteButton.click(this.handleDeleteClicked.bind(this)),this.$cancelButton=$(''),e.append(this.$cancelButton),this.$cancelButton.jqxButton({theme:t.VA.Env.Theme}),this.$cancelButton.click(this.handleCancelClicked.bind(this));},i.prototype.handleEditClicked=function(){var e=this;new t.VA.Core.Dialogs.EditScheduleDialog(e.$parent,{editorInput:e.options.editorInput,schedule:e.options.schedule,close:function close(i){i.OK&&t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(e);},title:"Edit Schedule"});},i.prototype.refreshScheduleData=function(){var e=this;$.ajax({url:"api/admin/v2/schedules/"+e.options.schedule.scheduleId,type:"GET",contentType:"application/json; charset=utf-8",blocking:!0}).done(function(t){t.length>0&&(e.$scheduleNameInput.val(t[0].scheduleName),e.$cronInput.val(t[0].cronExpression),e.$scheduleOwnerInput.val(t[0].scheduleOwner),e.$activeSelector.val(t[0].isActive),e.options.schedule=t[0]);}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});},i.prototype.handleDeleteClicked=function(){this.createDeleteConfirmDialog();},i.prototype.createDeleteConfirmDialog=function(){var e=this,i=e.options.schedule;t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Selected item(s) will be permanently deleted and cannot be recovered. Are you sure?",function(o){o.OK&&$.ajax({url:"api/admin/v2/schedules/"+i.scheduleId+"/delete",type:"POST",data:JSON.stringify(i),contentType:"application/json; charset=utf-8",blocking:!0}).done(function(){t.VA.Core.Utils.WidgetUtils.openInformationDialog("Schedule(s) ( "+i.scheduleName+" ) has been deleted.",function(){t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(e);});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});});},t.VA.Core.Dialogs.DetailScheduleDialog=i;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dialogs.Dialog.prototype;function i(t,i){e.constructor.call(this,t,i);}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype._initOptions=function(){e._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=440,this.dialogOptions.maxHeight=440,this.dialogOptions.title="Version Detail";},i.prototype.createDialogContentsArea=function(e){var i=['
','
',"
","
"].join("\n");this.$self=$(i),e.append(this.$self),this.$detailBody=this.$self.find(".brtc-va-dialogs-version-detail"),this.modelVersionDetail=new t.VA.Core.Components.ModelVersionDetail({$el:this.$detailBody}),this._refreshDetail(),this.$mainControl.dialog(this.dialogOptions);},i.prototype.createDialogButtonBar=function(t){e.createDialogButtonBar.call(this,t),this.$okButton.val("Edit");},i.prototype.handleEditClicked=function(){this.openEditVersionDialog();},i.prototype.handleOkClicked=function(){this.handleEditClicked();},i.prototype._refreshDetail=function(){var e=function(t){this.modelVersionDetail.update(t);}.bind(this);Studio.getResourceManager().fetchVersion(this.options.projectId,this.options.fileId,this.options.versionId).then(e).catch(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),this.$mainControl.dialog("close");}.bind(this));},i.prototype.openEditVersionDialog=function(){var e=function(t){t.OK&&(this.dialogResult.edited=!0);}.bind(this);new t.VA.Core.Dialogs.EditVersionDialog(this.$mainControl,{projectId:this.options.projectId,fileId:this.options.fileId,versionId:this.options.versionId,onEditCallback:this._refreshDetail.bind(this),close:e});},t.VA.Core.Dialogs.DetailVersionDialog=i;}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.DialogPanelProperties={};}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype;function i(t,i){e.constructor.call(this,t,i);}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype.createControls=function(){this.columnControlList=[],this.problemFactory=new t.VA.Core.Validator.ProblemFactory(),this.$mainControl=$('
'),this.$parent.append(this.$mainControl),this.createContentsArea(),this.$mainControl.addClass("dialog-properties"),this.$contentsArea.addClass("dialog-properties");},i.prototype.createContentsAreaControls=function(t){},i.prototype.fillControlValues=function(){this.options.fillControlValues();},i.prototype.getColumnData=function(t){return this.columnData;},i.prototype.registerColumnControl=function(t){this.columnControlList.push(t);},i.prototype.renderValues=function(){this.options.renderValues();},i.prototype._initializePerfectScroll=function(){this.$contentsArea.perfectScrollbar();},i.prototype._updatePerfectScroll=function(){this.$contentsArea.perfectScrollbar("update");},i.prototype.renderProperties=function(){},i.prototype._renderDefaultControl=function(t){var e=this,i=this.options.controlSpec[t];i&&i.params&&i.params.forEach(function(i){e._renderOptControl(e.controls[t][i.attr]);});},i.prototype._renderObjectArrayControl=function(t){var e=this.options.controlSpec[t];e&&e.params&&this._renderOptControl(this.controls[t]);},i.prototype._renderOptControl=function(t){t&&t.renderControl();},i.prototype.getParams=function(){},t.VA.Core.Functions.Library.DialogPanelProperties.propertiesPanel=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this);}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,t.VA.Core.Functions.Library.DialogPanelProperties.validator=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=600,this.dialogOptions.height=300;},e.prototype.createDialogContentsArea=function(t){var e="Include the data flow(s) that belongs to the ";e+="control"===this.options.files[0].type?"control flow.":"report.",t.append('
New name
To project
'+e+"
"),this.createNewNameControl(t.find(".brtc-va-dialogs-duplicate-model-newname-input")),this.createTargetProjectControl(t.find(".brtc-va-dialogs-duplicate-model-targetproject-input")),this.createOptionControl(t.find(".brtc-va-dialogs-duplicate-model-include-dataflow")),this.$nameControl.focus();},e.prototype.createOptionControl=function(t){this.$includeControl=t.jqxCheckBox({theme:"office",height:25,checked:!0,boxSize:"17px"}),"control"!==this.options.files[0].type&&"visual"!==this.options.files[0].type&&this.$includeControl.css("display","none");},e.prototype.createNewNameControl=function(e){this.$nameControl=e.jqxInput({placeHolder:"Enter name",theme:t.VA.Env.Theme}),this.options.files[0]&&this.$nameControl.val(this.options.files[0].getLabel()+"_copy");},e.prototype.createTargetProjectControl=function(e){var i=this,o=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"id"},{name:"label"}],url:"api/va/v2/ws/projects",async:!0},{beforeLoadComplete:function beforeLoadComplete(e){for(var i in e){e[i].originLabel=e[i].label,e[i].label=t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(e[i].label);}}});this.$targetProjectControl=e.jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,placeHolder:"Choose Project",source:o,displayMember:"label",valueMember:"id",itemHeight:30,dropDownWidth:418}),this.$targetProjectControl.on("bindingComplete",function(){if(i.options.files[0]){var t=e.jqxDropDownList("getItemByValue",i.options.files[0].getProjectId());e.jqxDropDownList("selectItem",t);}e.jqxDropDownList("getItems").length>4&&(e.jqxDropDownList("autoDropDownHeight",!1),e.jqxDropDownList("dropDownHeight",120));}).on("select",function(t){var i=t.args;i&&i.item&&e.attr("title",i.item.originalItem.originLabel);});},e.prototype.searchDataFlowFile=function(t,e,i){for(var o in e){e[o].param.functions&&this.searchDataFlowFile(t,e[o].param.functions,i);var n=!1;if("DataFlow"===e[o][FUNCTION_NAME]){for(var r in i){e[o].param.mid===i[r].mid&&(n=!0);}if(!n){var a=Studio.getResourceManager().getFile(t,e[o].param.mid);if(null==a)return'"'+e[o].display.label+'" dataflow was deleted or format is invalid in selected controlflow';i.push(a.contents);}}}},e.prototype.changeModelId=function(t,e){for(var i in e){e[i].param.functions&&this.changeModelId(t,e[i].param.functions),t.oldMid===e[i].param.mid&&(e[i].param.mid=t.newMid);}},e.prototype.handleOkClicked=function(){var e=this.$nameControl.val().trim();if(e.length>80)return t.VA.Core.Utils.WidgetUtils.openErrorDialog('"New Name" should be 80 characters or less.',function(){}),!1;if(!e)return t.VA.Core.Utils.WidgetUtils.openErrorDialog('"New Name" should not be empty or blank.',function(){}),!1;if("control"===this.options.files[0].type&&this.$includeControl.jqxCheckBox("checked")){var i=this.searchDataFlowFile(this.options.files[0].project_id,this.options.files[0].contents.functions,[]);if(i)return t.VA.Core.Utils.WidgetUtils.openErrorDialog(i,function(){}),!1;}var o=this.options.files[0].getProjectId(),n=this.$targetProjectControl.val(),r=this.options.files[0],a=function(){this.dialogResult.projectId=o,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);}.bind(this);Studio.getResourceService().duplicateFile(r.getFileId(),o,n,!0,r.getLabel(),e).then(a).catch(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});},t.VA.Core.Dialogs.DuplicateModelDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=648,this.dialogOptions.height=248;},e.prototype.createDialogContentsArea=function(t){t.append('
Data Source Label:
'),this.createNameControl(t.find(".brtc-va-dialogs-rename-name-input"));},e.prototype.createNameControl=function(e){this.$nameControl=e.jqxInput({placeHolder:"Enter a data source label.",theme:t.VA.Env.Theme}),this.options.name&&this.$nameControl.val(this.options.name);},e.prototype.handleOkClicked=function(){var e=this.$nameControl.val().trim();if(0!=e.length){if("function"==typeof this.options.validate){var i=this.options.validate(e);if(i)return void t.VA.Core.Utils.WidgetUtils.openErrorDialog(i);}this.dialogResult.newName=e,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter data source label.");},t.VA.Core.Dialogs.EditDataSourceAliasDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=440;},e.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-editresourcedialog-contents"),t.append('
Name
Description
'),this.createNameControl(t.find(".brtc-va-dialogs-editresourcedialog-name-input")),this.createDescriptionControl(t.find(".brtc-va-dialogs-editresourcedialog-description-container")),this.$nameControl.focus();},e.prototype.createNameControl=function(e){this.$nameControl=e.jqxInput({placeHolder:"Enter name",theme:t.VA.Env.Theme}),this.$nameControl.val(this.options.label);},e.prototype.createDescriptionControl=function(e){var i=this,o={focus:!1,height:188,description:this.options.description,okButton:this.$okButton,maxLength:2e3,toolbar:this.options.toolbar};this.noteControl=t.VA.Core.Widget.Factory.noteControl(e,o),this.$mainControl.on("resizing",function(t){i.noteControl.setHeight(i.$mainControl.find(".brtc-va-dialogs-contents").height()-110);});},e.prototype.handleOkClicked=function(){if(""!==this.$nameControl.val().trim()){if($("
").append(this.noteControl.getCode()).text().length>2e3)t.VA.Core.Utils.WidgetUtils.openErrorDialog("Description should be less than or equal to 2000 characters.");else{this.dialogResult.label=this.$nameControl.val().trim();var e=this.noteControl.getCode();"


"===e&&(e=""),this.dialogResult.description=e,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);}}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter name.");},t.VA.Core.Dialogs.EditResourceDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils;function i(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}i.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),i.prototype.constructor=i,i.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=685,this.dialogOptions.height=435;},i.prototype.createDialogContentsArea=function(i){var o=this,n=o.options.schedule;i.append('
Schedule Name
Cron Expression
IMMEDIATE
Schedule Owner
Is Active
Dependency Schedule
Model Version
'),this.$scheduleNameInput=i.find(".brtc-va-dialogs-schedule-name-edit-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0}),this.$scheduleNameInput.val(n.scheduleName),e.InputValidator.appendValidationCondition(this.$scheduleNameInput),this.$cronInput=i.find(".brtc-va-dialogs-schedule-cron-edit-input").jqxInput({theme:t.VA.Env.Theme}),this.$cronInput.val(n.cronExpression),e.InputValidator.appendValidationCondition(this.$cronInput),$(".brtc-va-dialogs-schedule-cron-help").on("click",function(){window.open("cron-expression","Brightics Cron Expression Help");}),this.$chkimmediate=i.find(".brtc-va-dialogs-schedule-cron-checkbox").jqxCheckBox({theme:t.VA.Env.Theme}),this.$chkimmediate.on("change",function(t){1==t.args.checked?o.$cronInput.jqxInput({disabled:!0,value:"IMMEDIATE"}):o.$cronInput.jqxInput({disabled:!1,value:""});}),"IMMEDIATE"===n.cronExpression&&(this.$cronInput.jqxInput({disabled:!0}),this.$chkimmediate.jqxCheckBox({checked:!0})),this.$scheduleOwnerInput=i.find(".brtc-va-dialogs-schedule-owner-edit-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0}),this.$scheduleOwnerInput.val(n.scheduleOwner),this.$activeSelector=i.find(".brtc-va-dialogs-schedule-active-edit-selector").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:["Y","N"]}),this.$activeSelector.val(n.isActive),this.$dependencySelector=i.find(".brtc-va-dialogs-schedule-dependency-selector").jqxDropDownList({theme:t.VA.Env.Theme,displayMember:"scheduleName",valueMember:"scheduleId",dropDownHeight:300}),this.$modelVersionInput=i.find(".brtc-va-dialogs-schedule-model-version-input").jqxInput({theme:t.VA.Env.Theme,disabled:!0,placeHolder:"Select version"}),this.$loadVersionButton=i.find(".brtc-va-dialogs-model-version-load"),this.$loadVersionButton.jqxButton({theme:t.VA.Env.Theme,width:120,height:27}),this.$loadVersionButton.on("click",function(){o.openSelectVersionDialog();});var r=Studio.getResourceManager().fetchVersions(this.options.editorInput.getProjectId(),this.options.editorInput.getFileId()).then(function(t){var e="",i=o.getVersionInfo(JSON.parse(n.executeContents)).id;return _.forEach(t,function(t){i===t.getVersionId()&&(e=t.getVersion());}),o.$modelVersionInput.val(e),!0;}),a=[];a.push(new Promise(function(i,r){$.ajax({url:"api/admin/v2/schedules",type:"GET",contentType:"application/json; charset=utf-8"}).done(function(t){$.each(t,function(i,o){t[i].scheduleId=e.WidgetUtils.convertHTMLSpecialChar(o.scheduleId);}),o.$dependencySelector.jqxDropDownList({source:t}),o.$dependencySelector.jqxDropDownList("insertAt","",0),o.$dependencySelector.val(n.dependencyId),i();}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),r(e);});})),a.push(r),Promise.all(a).catch(function(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog(e);}).then(function(){});},i.prototype.getVersionInfo=function(t){var e,i=t.models;for(var o in i){e=i[o].version_id;}return{name:"",id:e};},i.prototype.openSelectVersionDialog=function(){var e=function(t){if(t.OK){var e=t.data;this.$modelVersionInput.val(e.getVersion()),this.versionId=e.getVersion(),this.versionContents=e.getContents();}}.bind(this);new t.VA.Core.Dialogs.SelectVersionDialog(this.$mainControl,{projectId:this.options.editorInput.getProjectId(),fileId:this.options.editorInput.getFileId(),close:e});},i.prototype.addFileVersion=function(t,e){t.versionId=e;},i.prototype.handleOkClicked=function(){var e=this,i=e.options.schedule;if(""===_.trim(e.$scheduleNameInput.val()))return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter schedule name."),void $(".brtc-va-dialogs-schedule-name-edit-input").focus();if(""===_.trim(e.$cronInput.val()))return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter cron expression."),void $(".brtc-va-dialogs-schedule-cron-edit-input").focus();if(!$(".brtc-va-dialogs-schedule-cron-checkbox").jqxCheckBox("checked")&&!new RegExp("^\\s*($|#|\\w+\\s*=|(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?(?:,(?:[0-5]?\\d)(?:(?:-|/|\\,)(?:[0-5]?\\d))?)*)\\s+(\\?|\\*|(?:[01]?\\d|2[0-3])(?:(?:-|/|\\,)(?:[01]?\\d|2[0-3]))?(?:,(?:[01]?\\d|2[0-3])(?:(?:-|/|\\,)(?:[01]?\\d|2[0-3]))?)*)\\s+(\\?|\\*|(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?(?:,(?:0?[1-9]|[12]\\d|3[01])(?:(?:-|/|\\,)(?:0?[1-9]|[12]\\d|3[01]))?)*)\\s+(\\?|\\*|(?:[1-9]|1[012])(?:(?:-|/|\\,)(?:[1-9]|1[012]))?(?:L|W)?(?:,(?:[1-9]|1[012])(?:(?:-|/|\\,)(?:[1-9]|1[012]))?(?:L|W)?)*|\\?|\\*|(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?(?:,(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(?:(?:-)(?:JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)*)\\s+(\\?|\\*|(?:[0-6])(?:(?:-|/|\\,|#)(?:[0-6]))?(?:L)?(?:,(?:[0-6])(?:(?:-|/|\\,|#)(?:[0-6]))?(?:L)?)*|\\?|\\*|(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?(?:,(?:MON|TUE|WED|THU|FRI|SAT|SUN)(?:(?:-)(?:MON|TUE|WED|THU|FRI|SAT|SUN))?)*)(|\\s)+(\\?|\\*|(?:|\\d{4})(?:(?:-|/|\\,)(?:|\\d{4}))?(?:,(?:|\\d{4})(?:(?:-|/|\\,)(?:|\\d{4}))?)*))$").test(e.$cronInput.val()))return t.VA.Core.Utils.WidgetUtils.openInformationDialog("Cron expression syntax error."),void $(".brtc-va-dialogs-schedule-cron-edit-input").focus();var o,n=i.mid,r=i.executeContents;if(this.versionContents){for(var a in(r=$.extend(!0,{},t.VA.Core.Utils.ModelUtils.exportAsRunnableFile(this.versionContents,n,void 0,!0,void 0))).models){for(var s in e.addFileVersion(r.models[a],this.versionId),r.models[a].functions){var l=r.models[a].functions[s];t.VA.Core.Utils.ModelUtils.carvePersist(l,!0);}}void 0!==r.reports&&Object.keys(r.reports).length>0&&(o=$.extend(!0,{},r.reports),delete r.reports),r=JSON.stringify(r);}var c={scheduleId:i.scheduleId,scheduleName:e.$scheduleNameInput.val(),cronExpression:e.$cronInput.val(),scheduleOwner:e.$scheduleOwnerInput.val(),scheduleType:"JSON",executeContents:r,reportContents:void 0!==o?JSON.stringify(o):null,fileId:i.fileId,projectId:i.projectId,isActive:e.$activeSelector.val(),modifyUser:t.VA.Env.Session.userId,dependencyId:e.$dependencySelector.val()},d={url:"api/admin/v2/schedules/"+i.scheduleId+"/update",type:"POST",contentType:"application/json; charset=utf-8",blocking:!0,data:JSON.stringify(c)};$.ajax(d).done(function(){t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(e);}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});},i.prototype.destroy=function(){this.$activeSelector.jqxDropDownList("destroy"),this.$dependencySelector.jqxDropDownList("destroy"),t.VA.Dialogs.Dialog.prototype.destroy.call(this);},t.VA.Core.Dialogs.EditScheduleDialog=i;}.call(this),function(){var t=this.Brightics,e=t.VA.Dialogs.Dialog.prototype;function i(t,i){e.constructor.call(this,t,i);}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype._initOptions=function(){e._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=440,this.dialogOptions.maxHeight=440,this.dialogOptions.title="Edit Version";},i.prototype.createDialogContentsArea=function(t){var e=['
','
','
','
Name
',' ',"
",'
','
Description
','
',"
","
",'
','
Tags
',' ',"
","
","
"].join("\n");t.append(e),this.createLabelControl(t.find(".brtc-va-dialogs-edit-version-name-input")),this.createDescriptionControl(t.find(".brtc-va-dialogs-edit-version-description-input")),this.createTagsControl(t.find(".brtc-va-dialogs-edit-version-tags-input")),this._refreshContents(),this.$mainControl.dialog(this.dialogOptions);},i.prototype.createLabelControl=function(e){this.$labelInput=e.jqxInput({theme:t.VA.Env.Theme,disabled:!0});},i.prototype.createDescriptionControl=function(e){var i=this,o={focus:!1,height:155,description:this.options.description,okButton:this.$okButton,maxLength:2e3,toolbar:this.options.toolbar};this.noteControl=t.VA.Core.Widget.Factory.noteControl(e,o),this.$mainControl.on("resizing",function(t){i.noteControl.setHeight(i.$mainControl.find(".brtc-va-dialogs-contents").height()-110);});},i.prototype.createTagsControl=function(e){this.$tagsControl=e.jqxInput({placeHolder:"Enter Tags",theme:t.VA.Env.Theme});},i.prototype.createDialogButtonBar=function(t){e.createDialogButtonBar.call(this,t),this.$okButton.val("OK");},i.prototype.handleCancelClicked=function(){t.VA.Dialogs.Dialog.prototype.handleCancelClicked.call(this);},i.prototype.handleOkClicked=function(){var t=function(){this.options.onEditCallback(),e.handleOkClicked.call(this);}.bind(this);this.debouncedUpdateFileVersion=this.debouncedUpdateFileVersion||_.debounce(function(){var e=this.noteControl.getCode();"


"===e&&(e=""),this.data.setTags(this.$tagsControl.val()),this.data.setDescription(e),Studio.getResourceManager().updateVersion(this.options.projectId,this.options.fileId,this.data).then(t).catch(this._onError.bind(this));}.bind(this)),this.debouncedUpdateFileVersion();},i.prototype._refreshContents=function(){Studio.getResourceManager().fetchVersion(this.options.projectId,this.options.fileId,this.options.versionId).then(this._fillContents.bind(this)).catch(this._onError.bind(this));},i.prototype._fillContents=function(t){return this.$labelInput.val(t.getLabel()),this.noteControl.setValue(t.getDescription()),this.$tagsControl.val(t.getTags()),this.data=t,!0;},i.prototype._onError=function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),this.$mainControl.dialog("close");},t.VA.Core.Dialogs.EditVersionDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){this.results=$.extend(!0,{},i.param),this.DATA_PARAM={"input-path":{label:"Input Path",type:"code",category:"source",mandatory:!0},"copy-to":{label:"Export To",type:"radio",category:"target"},ip:{label:"IP",type:"code",category:"target",mandatory:!0},port:{label:"Port",category:"target",mandatory:!0},"output-path":{label:"Output Path",type:"code",category:"target",mandatory:!0,placeholder:"ex. /temp/data.csv"},delimiter:{label:"Delimiter",type:"radio",category:"target"},header:{label:"Header",type:"radio",category:"target"},quote:{label:"Quote",type:"radio",category:"target"},"array-delimiter":{label:"Array Delimiter",type:"radio",category:"target"},"array-start-string":{label:"Array Start",type:"radio",category:"target"},"array-end-string":{label:"Array End",type:"radio",category:"target"},"key-value-delimiter":{label:"Key Value",type:"radio",category:"target"},"map-start-string":{label:"Map Start",type:"radio",category:"target"},"map-end-string":{label:"Map End",type:"radio",category:"target"},"null-value":{label:"Null Value",type:"radio",category:"target"},"datasource-name":{label:"Datasource",type:"dropDown",category:"target",mandatory:!0},"table-name":{label:"Table Name",type:"code",category:"target",mandatory:!0},"is-delete":{label:"Overwrite",type:"radio",category:"target"},"is-append":{},"connection-timeout":{label:"Connection Timeout(sec)",type:"number",category:"target",placeholder:"Default: 600",max:3e3},"login-timeout":{label:"Login Timeout(sec)",type:"number",category:"target",placeholder:"Default: 600",max:3e3},"socket-timeout":{label:"Socket Timeout(sec)",type:"number",category:"target",placeholder:"Default: 600",max:3e3},"lock-timeout":{label:"Lock Timeout(sec)",type:"number",category:"target",placeholder:"Default: 600",max:3e3}},this.RADIO_DATA_PARAM={"copy-to":[{label:"Repository",value:"alluxio"},{label:"HDFS",value:"hdfs"},{label:"Relational DB",value:"jdbc"}],delimiter:[{label:"Comma",value:","},{label:"Tab",value:"\t"},{label:"Space",value:" "},{label:"Colon",value:":"},{label:"Semicolon",value:";"},{label:"Other",value:"Other"}],header:[{label:"True",value:"true"},{label:"False",value:"false"}],quote:[{label:"Double Quotation",value:'"'},{label:"Other",value:"Other"}],"array-delimiter":[{label:"Colon",value:":"},{label:"Other",value:"Other"}],"array-start-string":[{label:"Left Square Bracket",value:"["},{label:"Other",value:"Other"}],"array-end-string":[{label:"Right Square Bracket",value:"]"},{label:"Other",value:"Other"}],"key-value-delimiter":[{label:"Equal",value:"="},{label:"Other",value:"Other"}],"map-start-string":[{label:"Left Curly Bracket",value:"{"},{label:"Other",value:"Other"}],"map-end-string":[{label:"Right Curly Bracket",value:"}"},{label:"Other",value:"Other"}],"null-value":[{label:"Empty String",value:""},{label:"Other",value:"Other"}],"is-delete":[{label:"True",value:"true"},{label:"False",value:"false"}]},this.PARAM_VISIBLE={hdfs:["copy-to","input-path","ip","port","output-path","delimiter","header","quote","array-delimiter","array-start-string","array-end-string","key-value-delimiter","map-start-string","map-end-string","null-value","is-delete"],jdbc:["copy-to","datasource-name","input-path","is-delete","table-name","connection-timeout","login-timeout","socket-timeout","lock-timeout","is-append"],alluxio:["copy-to","input-path","output-path","delimiter","header","quote","array-delimiter","array-start-string","array-end-string","key-value-delimiter","map-start-string","map-end-string","null-value","is-delete"]},t.VA.Core.Dialogs.FnUnitDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.FnUnitDialog.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){this.$mainControl=$('
'),this.$titleArea=this.$mainControl.find(".brtc-va-dialogs-title");},e.prototype.createDialogContentsArea=function(t){var e=this;this.$contentsAreaWrapper=$('
'),this.$contentsAreaWrapper.css({width:this.options.width,height:this.options.height}),t.append(this.$contentsAreaWrapper),this.$contentsArea=this.$contentsAreaWrapper.find(".brtc-va-views-properties-pages-contents-area"),this.codeArgumentControlMap={},this.addPropertyControl("Source",function(t){e.variableArea=t,e.createCategoryControl(t,"source");}),this.addPropertyControl("Target",function(t){e.variableArea=t,e.createCategoryControl(t,"target");}),this.setParamControlVisible(e.results["copy-to"]),this.renderValidation(),this.$contentsAreaWrapper.find(".brtc-va-views-properties-pages-contents-area").perfectScrollbar();},e.prototype.renderValidation=function(){this.removeValidation();},e.prototype.removeValidation=function(){this.$mainControl.find(".brtc-va-editors-sheet-panels-validation-tooltip-wrapper").remove(),this.$mainControl.find(".brtc-va-editors-sheet-controls-propertycontrol-label").removeClass("brtc-va-editors-sheet-controls-propertycontrol-label-error"),this.$mainControl.find(".brtc-va-editor-sheet-panels-validation-error").removeClass("brtc-va-editor-sheet-panels-validation-error"),this.$mainControl.find(".brtc-va-editors-sheet-panels-validation-tooltip-wrapper").remove();},e.prototype.createValidationContent=function(t,e,i){var o=$('
'+e.message+"
");t.append(o),t.addClass("brtc-va-editor-sheet-panels-validation-error"),i&&o.css("clear","both"),o.show();},e.prototype.addPropertyControl=function(e,i,o){var n=this,r=$('
');return o&&o.mandatory&&(e="
"+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(e)+'
*
'),this.$contentsArea.append(r),r.jqxExpander({theme:t.VA.Env.Theme,arrowPosition:"left",initContent:function initContent(){"function"==typeof i&&i.call(n,r.find(".brtc-va-views-properties-pages-controls-propertycontrol-contents"),o);}}),r.jqxExpander("setHeaderContent",e),r;},e.prototype.createCategoryControl=function(t,e){for(var i,o,n=Object.keys(this.DATA_PARAM),r=0;r
'+this.DATA_PARAM[o].label+':
')).find(".column-1").addClass(o),this.DATA_PARAM[o].mandatory&&i.find(".column-1").addClass("mandatory"),t.append(i);var a=this.results;"radio"===this.DATA_PARAM[o].type?(this.createRadioArgumentControl(i,o),this.setRadioControlValue(o,a[o]||"")):"code"===this.DATA_PARAM[o].type?(this.createCodeArgumentControl(i,o),this.setCodeControlValue(o,a[o]||"")):"dropDown"===this.DATA_PARAM[o].type?(this.createDropDownArgumentControl(i,o),this.setDropDownControlValue(o,a[o]||"")):"number"===this.DATA_PARAM[o].type?(this.createNumberInputArgumentControl(i,o),this.setNumberInputControlValue(o,a[o]||"")):(this.createInputArgumentControl(i,o),this.setInputControlValue(o,a[o]||""));}}},e.prototype.createRadioArgumentControl=function(e,i){var o=this,n=$('
');e.find(".column-2").append(n);for(var r=0;r');n.append(l),"Other"==s?(l.append('
'),o.createRadioButton(l,i),l.find(".brtc-va-delimiter-input").jqxInput({theme:t.VA.Env.Theme,width:57,height:24}),l.find(".brtc-va-delimiter-input").on("change",function(){o.results[i]=$(this).val(),o.renderValidation();})):(l.text(a),o.createRadioButton(l,i)),l.on("checked",function(t){var e=$(t.target);if("quot"==e.attr("param-value")?o.results[i]='"':o.results[i]=e.attr("param-value"),"Other"==e.attr("param-value")){var n=e.find(".brtc-va-delimiter-input");o.results[i]=n.val();}"copy-from"!==i&&"copy-to"!==i||(o.setParamControlVisible(o.results[i]),o.$mainControl.find(".brtc-va-dialogs-contents").perfectScrollbar("update")),"is-delete"==e.closest(".brtc-va-views-properties-pages-controls-propertycontrol-button").attr("param-key")&&o.setAppendControlVisible(),o.renderValidation();});}if("is-delete"===i){var c=n.find(".brtc-va-editors-sheet-controls-propertycontrol-radiobutton[param-value=false]").parent(),d=$('
Append
');c.append(d),c.addClass("brtc-style-display-flex"),c.addClass("brtc-va-editors-sheet-controls-width-8"),c.addClass("brtc-style-col-7"),c.find(".brtc-va-editors-sheet-controls-propertycontrol-radiobutton[param-value=false]").addClass("brtc-style-col-4-important"),this.createCheckBox(d),d.val(this.results["is-append"]),this.addClassToWrapper(d,"brtc-style-display-flex"),this.addClassToWrapper(d,"brtc-style-line-height-25"),d.parent().prepend($("")),d.parent().append($(" )")),d.parent().removeClass("brtc-va-editors-sheet-controls-wrapper"),d.parent().attr("control-type","is-append"),d.on("change",function(){o.results["is-append"]=$(this).val().toString();});}},e.prototype.setAppendControlVisible=function(){this.$mainControl.find(".brtc-va-views-properties-pages-controls-append").jqxCheckBox("true"==this.results["is-delete"]?"disable":"enable");},e.prototype.setParamControlVisible=function(t){for(var e,i=Object.keys(this.DATA_PARAM),o=this.PARAM_VISIBLE[t],n=0;n=0?e.css("display",""):e.css("display","none"),e.find(".CodeMirror").each(function(t,e){e.CodeMirror.refresh();});}"jdbc"===t?this.$mainControl.find(".column-type").removeClass("mandatory"):this.$mainControl.find(".column-type").addClass("mandatory");},e.prototype.createCodeArgumentControl=function(e,i){var o=this,n=$('
Set a static file path for users repository.
Set a dynamic file path for users repository.
'),this.createRepositoryTree(t.find(".brtc-va-dialogs-repository-browser-tree")),this.createSettingOptionControl(t.find(".brtc-va-dialogs-repository-browser-setting-option")),this.createFilePathControl(t.find(".brtc-va-dialogs-repository-browser-file-input > textarea"));},e.prototype.createRepositoryTree=function(e){var i=this;this.repositoryViewer=new t.VA.Core.Controls.RepositoryViewer(e),this.repositoryViewer.$tree.on("select",function(t){var e=i.repositoryViewer.getSelectedPath();i._setFilePath(e);});},e.prototype.createSettingOptionControl=function(e){var i=this,o=e.find(".brtc-va-dialogs-repository-browser-radio");this.$settingOptionGroup=e,o.jqxRadioButton({theme:t.VA.Env.Theme,groupName:"repository-browser-setting-option"}),o.on("checked",function(){var t=i.repositoryViewer.getSelectedPath()||i.options.filePath;i._setFilePath(t);}),this.options.filePath.match(/\/users\/\$\{sys.user\}\//g)?this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").jqxRadioButton("check"):this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=static]").jqxRadioButton("check"),this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").hide();},e.prototype.createFilePathControl=function(e){this.fileName=CodeMirror.fromTextArea(e[0],{mode:"text",theme:"default",indentWithTabs:!1,smartIndent:!1,lineNumbers:!1,matchBrackets:!0,scrollbarStyle:"null",autofocus:!1}),this.fileName.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update(e.from,e.to,[i]),!0;}),this.fileName.setSize("100%","100%"),this.options.filePath&&this._setFilePath(this.options.filePath);t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.fileName,{"valid-type":"fileNameType","valid-message-position":"bottom"});},e.prototype._setFilePath=function(e){if(e){var i=e.match(/^\/brtc\/repo\/shared\/[^\/]*/),o=e.match(/^\/brtc\/repo\/users\/[^\/]+\/[^\/]*/);if(this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").hide(),i)this.fileName.setValue(e),this.fileName.markText({line:0,ch:0},{line:0,ch:18},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});else if(o){this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").show();var n=0,r=e,a=(r=this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").val()?r.replace(/\/users\/\S*\//g,"/users/${sys.user}/"):r.replace(/\/users\/\$\{sys\.user\}\//g,"/users/"+t.VA.Env.Session.userId+"/")).split("/");this.fileName.setValue(r);for(var s=0;s<5;s++){n+=a[s].length,n++;}this.fileName.markText({line:0,ch:0},{line:0,ch:n},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});}else r=e+"/",r=this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").val()?r.replace(/\/users\/\S*\//g,"/users/${sys.user}/"):r.replace(/\/users\/\$\{sys\.user\}\//g,"/users/"+t.VA.Env.Session.userId+"/"),this.fileName.setValue(r),this.fileName.markText({line:0,ch:0},{line:0,ch:r.length+1},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});}},e.prototype.handleOkClicked=function(){var e=this.fileName.getValue().trim();if(e){for(var i=e.match(/^\/brtc\/repo\/shared\/[^\/]+$/),o=e.match(/^\/brtc\/repo\/users\/[^\/]+\/[^\/]+$/),n=e.match(/^\/brtc\/repo\/users\/\$\{sys\.user\}\/[^\/]+$/),r="",a=0,s=0;s0)return void t.VA.Core.Utils.WidgetUtils.openErrorDialog("Invalid file path.");i||o||n?(this.dialogResult.selectedFile=e,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)):t.VA.Core.Utils.WidgetUtils.openErrorDialog("Invalid file path.");}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("At least one file must be selected.");},t.VA.Core.Dialogs.InputDataPathDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=600,this.dialogOptions.height=700,this.dialogOptions.maxWidth=600,this.dialogOptions.maxHeight=700,this.dialogOptions.create=function(){$(".ui-widget-content").css("border","none");};},e.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-invite-member-contents"),t.append('
Total0
Total0
'),this.createSearchControl(t),this.createUserGrid(t),this.createAuthorityCombo(t),this.createRemoveMemberButton(t),this.createMemberGrid(t);},e.prototype.updateUserCount=function(){if(this.$userGrid){var t=this.$userGrid.jqxGrid("getrows");this.$mainControl.find(".brtc-va-dialogs-invite-member-search-user-label > span:nth-child(2)").text(t.length);}},e.prototype.updateMemberCount=function(){if(this.$memberGrid){var t=this.$memberGrid.jqxGrid("getrows");this.$mainControl.find(".brtc-va-dialogs-invite-member-register-member-label > span:nth-child(2)").text(t.length);}},e.prototype.createSearchControl=function(e){var i=this;this.$searchControl=e.find(".brtc-va-dialogs-invite-member-search").jqxInput({placeHolder:"Search for Name, ID",theme:t.VA.Env.Theme}),this.$searchControl.keypress(function(t){13==t.keyCode&&i.searchUser(i.$searchControl.val());}),this.$searchControl.focus();},e.prototype.searchUser=function(t){var e=this._createUserGridSource();this.$userGrid.jqxGrid("source",e);},e.prototype._createUserGridSource=function(){var t={datatype:"json",datafields:[{name:"name",type:"string"},{name:"id",type:"string"}]};return this.$searchControl.val().trim()?t.url="api/admin/v2/users?pattern="+encodeURIComponent(this.$searchControl.val()):t.localdata=[],new $.jqx.dataAdapter(t);},e.prototype.createUserGrid=function(e){var i=this;e.find(".brtc-va-dialogs-invite-member-search-user-grid").on("bindingcomplete",function(){i.updateUserCount();});var o=this._createUserGridSource();this.$userGrid=e.find(".brtc-va-dialogs-invite-member-search-user-grid").jqxGrid({theme:t.VA.Env.Theme,source:o,width:"100%",rowsheight:25,height:"calc(50% - 80px)",altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,enabletooltips:!0,columns:[{text:"Name",datafield:"name",width:240,cellsrenderer:function cellsrenderer(e,i,o){return'
'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"
";}},{text:"ID",datafield:"id"}]}),this.$userGrid.on("rowclick",function(e){var o=i.$authorityCombo.jqxDropDownList("getSelectedItem"),n=o.value,r=o.label,a=e.args,s=i.$userGrid.jqxGrid("getrowdata",a.rowindex),l={user_name:s.name,user_id:s.id,role_id:n,role_label:r},c=!1,d=!1,p=i.$memberGrid.jqxGrid("getrows");for(var u in p){p[u].user_id==s.id&&(c=!0);}for(var u in i.options.members){i.options.members[u].user_id==s.id&&(d=!0);}c||(d?t.VA.Core.Utils.WidgetUtils.openWarningDialog(s.id+" is invited already.",function(){}):(i.$memberGrid.jqxGrid("addrow",null,l),i.updateMemberCount()));});},e.prototype.createRemoveMemberButton=function(t){var e=this;t.find(".brtc-va-dialogs-invite-member-register-member-remove").click(function(){var t=[],i=e.$memberGrid.jqxGrid("getselectedrowindexes");for(var o in i){var n=e.$memberGrid.jqxGrid("getrowdata",i[o]);t.push(n.uid);}e.$memberGrid.jqxGrid("deleterow",t),e.updateMemberCount();});},e.prototype.createMemberGrid=function(e){var i=this;e.find(".brtc-va-dialogs-invite-member-register-member-grid").on("bindingcomplete",function(){i.updateMemberCount();});var o=new $.jqx.dataAdapter({datatype:"local",datafields:[{name:"user_name",type:"string"},{name:"user_id",type:"string"},{name:"role_id",type:"string"},{name:"role_label",type:"string"}],localdata:[],addrow:function addrow(t,e,i,o){o(!0);},deleterow:function deleterow(t,e){e(!0);}});this.$memberGrid=e.find(".brtc-va-dialogs-invite-member-register-member-grid").jqxGrid({theme:t.VA.Env.Theme,source:o,width:"100%",height:"calc(50% - 80px)",rowsheight:25,altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,selectionmode:"multiplerowsextended",enabletooltips:!0,columns:[{text:"Name",datafield:"user_name",width:240,cellsrenderer:function cellsrenderer(e,i,o){return'
'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"
";}},{text:"ID",datafield:"user_id",width:240},{text:"Authority",datafield:"role_label"}]});},e.prototype.createAuthorityCombo=function(e){this.$authorityCombo=e.find(".brtc-va-dialogs-invite-member-register-member-authority").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:[{id:"role_10002",label:"as Organizer"},{id:"role_10003",label:"as Member"},{id:"role_10004",label:"as Reporter"}],displayMember:"label",valueMember:"id",itemHeight:29,dropDownWidth:118,selectedIndex:1});},e.prototype.handleOkClicked=function(){var e=this,i=this.$memberGrid.jqxGrid("getrows");if(0==i.length)t.VA.Core.Utils.WidgetUtils.openErrorDialog("At least one member must be selected.");else{var o={members:[]};for(var n in i){var r=i[n];o.members.push({user_id:r.user_id,role_id:r.role_id});}var a={url:"api/va/v2/ws/projects/"+e.options.projectId+"/members/invite",type:"POST",contentType:"application/json; charset=utf-8",blocking:!0,data:JSON.stringify(o)};$.ajax(a).done(function(i){t.VA.Core.Utils.WidgetUtils.openInformationDialog("Invited "+i+" members.",function(){t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(e);});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});}},t.VA.Core.Dialogs.InviteMemberDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i),this.terminated=!1;}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=680,this.dialogOptions.height=540,this.dialogOptions.keyboardCloseKey="",this.dialogOptions.closeOnEscape=!1,this.dialogOptions.create=function(){$(".ui-widget-content").css("border-color","#d4d4d4"),$(".ui-dialog-titlebar-close",$(this).parent()).hide();};},e.prototype.createDialogContentsArea=function(e){var i=this;e.parent().parent().addClass("brtc-va-dialogs-launch-progress"),e.addClass("brtc-va-dialogs-launch-progress-contents"),e.append('
Starting...
  • Status
  • Log
'),this.$progressBar=e.find(".brtc-va-dialogs-launch-progress-progressbar").jqxProgressBar({theme:t.VA.Env.Theme,value:3,animationDuration:0}),this.$progressTab=e.find(".brtc-va-dialogs-launch-progress-tab").jqxRibbon({theme:t.VA.Env.Theme,width:"100%",height:"calc(100% - 70px)",position:"bottom",selectionMode:"click",initContent:function initContent(t){0==t?i.$processScrollbar=e.find(".brtc-va-dialogs-launch-progress-processes").perfectScrollbar():1==t&&(i.logMirror=CodeMirror.fromTextArea(e.find(".brtc-va-dialogs-launch-progress-logs")[0],{mode:"text/html",theme:"default",lineNumbers:!1,matchBrackets:!0,autofocus:!1,readOnly:!0}),i.logMirror.setSize("100%","100%"));}}).addClass("brtc-va-dialogs-launch-progress-tab"),this.$progressTab.jqxRibbon("hideAt",1),setTimeout(this._renderTimer.bind(this),500),this.createCloseOptionCheckBox(e);},e.prototype.createDialogButtonBar=function(e){t.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,e),this.$okButton.val("Done"),this.$okButton.css("display","none"),this.$cancelButton.val("Stop Running"),this.createDetailButton(e),this.createDetailOptimizationButton(e);},e.prototype.createDetailButton=function(e){var i=this;this.$detailButton=$(''),e.append(this.$detailButton),this.$detailButton.jqxButton({theme:t.VA.Env.Theme}),this.$detailButton.click(function(){var e="JOB ID: "+i.options.jobId;e+="\n"+(i.errorDetailMessage||i.errorMessage),new t.VA.Core.Dialogs.DetailDialog(i.$mainControl,{title:"Detail Information",detailText:e});}),this.$detailButton.hide();},e.prototype.createDetailOptimizationButton=function(e){var i=this;this.$detailOptButton=$(''),e.append(this.$detailOptButton),this.$detailOptButton.jqxButton({theme:t.VA.Env.Theme}),this.$detailOptButton.click(function(){i.optProgressDialog?i.optProgressDialog.render(i.eventOriginalResponse):i.optProgressDialog=new t.VA.Core.Dialogs.OptProgressDialog(null,{data:i.eventOriginalResponse,close:function close(){i.optProgressDialog=null;}});}),this.$detailOptButton.hide();},e.prototype._showDetailOptimizationButton=function(t){this._getOptimizationData(t)&&(this.eventOriginalResponse=t,this.$detailOptButton.show(),this.optProgressDialog&&this.optProgressDialog.render(this.eventOriginalResponse));},e.prototype._getOptimizationData=function(t){if(t){var e=t.processes;if(!e)return null;for(var i=e.length-1;i>=0;i--){for(var o=e[i].functions,n=o.length-1;n>=0;n--){var r=o[n].optimization;if(r)return r;}}}return null;},e.prototype.createCloseOptionCheckBox=function(e){this.$checkboxDiv=$('
Close the dialog after the process completes successfully.
'),e.append(this.$checkboxDiv),this.$checkboxDiv.jqxCheckBox({theme:t.VA.Env.Theme,checked:t.VA.Env.Session.launchProgressAutoClose}),this.$checkboxDiv.on("change",function(e){var i=e.args.checked;t.VA.Env.Session.launchProgressAutoClose=i;});},e.prototype.progress=function(t){var e;t.jid&&(this.options.jobId=t.jid),"BEGIN-JOB"==t.eventType?this._beginJob(t.status,t.launchOptions.expectedUnitCount):"END-JOB"==t.eventType?this._endJob(t.status,t.message,t.detailMessage):"BEGIN-PROCESS"==t.eventType?(e=t.label||"(default model)",this._beginProcess(t.pid,t.status,e,t.count)):"END-PROCESS"==t.eventType?this._endProcess(t.pid,t.status,t.begin,t.end):"BEGIN-UNIT"==t.eventType?(e=t.label||"(default function)",this._beginUnit(t.pid,t.fid,t.status,e,t.message)):"END-UNIT"==t.eventType?this._endUnit(t.pid,t.fid,t.status,t.begin,t.end,t.message):"UPDATE-UNIT"==t.eventType?this._updateUnit(t.pid,t.fid,t.status,t.begin,t.end,t.message):"PENDING-JOB"===t.eventType&&this._pendingJob(t.status,t.message),this.updateStatus(t),this._updateProgress(t),this._showDetailOptimizationButton(t.originalResponse);},e.prototype.updateStatus=function(t){["END-UNIT"].indexOf(t.eventType)>-1&&Studio.getEditorContainer().getActiveModelEditor().updateStatus(t);},e.prototype.handleCancelClicked=function(){this.dialogResult={OK:!1,Cancel:!0},Studio.getJobExecutor().terminate(this.options.jobId);},e.prototype._pendingJob=function(t,e){var i="0 process, 0 function completed... ("+e+")";this.$mainControl.find(".brtc-va-dialogs-launch-progress-label > span:nth-child(1)").text(i),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label > span:nth-child(1)").attr("title",i);},e.prototype._updateProgress=function(e){this.terminated&&t.VA.Env.Session.launchProgressAutoClose&&"FAIL"!==e.status||(this._updateProgressLabel(e),this._updateProgressBar(e));},e.prototype._updateProgressLabel=function(t){var e=this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="SUCCESS"], .brtc-va-dialogs-launch-progress-proc[status="FAIL"]'),i=this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="SUCCESS"], .brtc-va-dialogs-launch-progress-func[status="FAIL"]'),o=e.length+" process, "+i.length+" function completed...",n="PENDING-JOB"===t.eventType?t.message:"";this.errorMessage&&(o=this.errorMessage),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label > span:nth-child(1)").text(o),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label > span:nth-child(1)").attr("title",o),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label > span:nth-child(3)").text(n);},e.prototype._updateProgressBar=function(){var t=10,e=this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="SUCCESS"]').length;"SUCCESS"==this.$mainControl.find(".brtc-va-dialogs-launch-progress-contents").attr("STATUS")?t=100:(t=85*e/this.expectedUnitCount+10)>95&&(this.expectedUnitCount+=10,t=85*e/this.expectedUnitCount+10);var i=this;clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(function(){i.$progressBar.jqxProgressBar({value:t});},300);},e.prototype._renderTimer=function(){var e=this;if(this.$mainControl&&this.$mainControl.find(".brtc-va-dialogs-launch-progress-elapsed").length&&this.$mainControl.find(".brtc-va-dialogs-launch-progress-elapsed").each(function(t){var i=$(this).attr("begin");i=i?parseInt(i):Date.now();var o=$(this).attr("end");o=o?parseInt(o):Date.now();var n=e._elapsedString(o-i);$(this).text("( "+n+" )");}),0==this.terminated)setTimeout(this._renderTimer.bind(this),500);else if(t.VA.Env.Session.launchProgressAutoClose)return void clearTimeout(this._renderTimer);},e.prototype._elapsedString=function(t){var e=t,i=Math.floor(e/864e5);e-=864e5*i;var o=Math.floor(e/36e5);e-=36e5*o;var n=Math.floor(e/6e4);e-=6e4*n;var r=Math.floor(e/1e3);e-=1e3*r;var a="";return i>0&&(a=i+" day "),o>0&&(a+=o+" hour "),n>0&&(a+=n+" min "),r>0&&(a+=r+" sec"),""==a&&(a="1 sec"),a;},e.prototype._beginJob=function(t,e){this.expectedUnitCount=e,this.$mainControl.find(".brtc-va-dialogs-launch-progress-contents").attr("STATUS",t),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label .brtc-va-dialogs-launch-progress-elapsed").attr("begin",Date.now());},e.prototype._endJob=function(t,e,i){this.$mainControl.find(".brtc-va-dialogs-launch-progress-contents").attr("STATUS",t),this.$mainControl.find(".brtc-va-dialogs-launch-progress-label .brtc-va-dialogs-launch-progress-elapsed").attr("end",Date.now()),this.$mainControl.find(".jqx-window-close-button-background").css("visibility","visible"),this.$okButton.css("display","block"),this.$cancelButton.css("display","none"),"FAIL"===t?(this.errorMessage=e||"",this.errorDetailMessage=i||"",0==this.errorMessage.indexOf("SparkException:")||0==this.errorMessage.indexOf("NoClassDefFoundError:")?this.errorMessage="Sorry! An unexpected error occurred. Please contact administrator.":0==this.errorMessage.indexOf("Exception:")?this.errorMessage="Sorry! An unexpected error occurred. Please contact administrator.":0==this.errorMessage.indexOf("AnalysisException:")?this.errorMessage=this.errorMessage.substring(18,this.errorMessage.length).trim():0==this.errorMessage.indexOf("InvalidInputException:")?this.errorMessage="Input path does not exist.":0==this.errorMessage.indexOf("FileNotFoundException:")?this.errorMessage="Data Source does not exist.":'{"result":"Cannot execute the flow. It contains invalid contents.","resultCode":1100}'==this.errorMessage?this.errorMessage="Cannot execute the flow. It contains invalid contents.":"'condition' is a required parameter.\n'condition' is a required parameter."==this.errorMessage?this.errorMessage="'condition' is a required parameter.":this.errorMessage.startsWith("/home/brightics/brightics/packages/brightics-agent/repo/BRIGHTICS/script")&&this.errorMessage.indexOf("error: not found")>0?this.errorMessage="Script contains invalid contents.":"'in-table' is not of Array[String] type."===this.errorMessage?this.errorMessage="Inputs is required.":"Error: Invalid tid "===this.errorMessage?this.errorMessage="Inputs is required.":"The size of 'fs-paths' must be 1."==this.errorMessage&&(this.errorMessage="'Input Path' is a required parameter."),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="PROCESSING"] > .brtc-va-dialogs-launch-progress-proc-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="PROCESSING"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="PROCESSING"] > .brtc-va-dialogs-launch-progress-func-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="PROCESSING"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="WAIT"] > .brtc-va-dialogs-launch-progress-proc-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="WAIT"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="WAIT"] > .brtc-va-dialogs-launch-progress-func-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="WAIT"]').attr("status",t)):"ABORT"===t?(this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="PROCESSING"] > .brtc-va-dialogs-launch-progress-proc-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="PROCESSING"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="PROCESSING"] > .brtc-va-dialogs-launch-progress-func-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="PROCESSING"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="WAIT"] > .brtc-va-dialogs-launch-progress-proc-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-proc[status="WAIT"]').attr("status",t),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="WAIT"] > .brtc-va-dialogs-launch-progress-func-status').text(this._statusLabel(t)),this.$mainControl.find('.brtc-va-dialogs-launch-progress-func[status="WAIT"]').attr("status",t)):"SUCCESS"===t&&!0===this.$checkboxDiv.val()&&this.handleOkClicked(),this.errorMessage&&this.$detailButton.show(),this.terminated=!0;},e.prototype._beginProcess=function(t,e,i,o){var n=this.$mainControl.find(".brtc-va-dialogs-launch-progress-processes"),r=n.find(".brtc-va-dialogs-launch-progress-proc[id="+t+"]");0==r.length&&((r=$('
')).attr("id",t),n.append(r),r.find(".brtc-va-dialogs-launch-progress-proc-elapsed").attr("begin",Date.now()),r.find(".brtc-va-dialogs-launch-progress-proc-elapsed").removeAttr("end")),"WAIT"===r.attr("status")&&"PROCESSING"===e&&r.find(".brtc-va-dialogs-launch-progress-proc-elapsed").attr("begin",Date.now()),r.attr("status",e);var a=o>1?i+" ("+o+")":i;r.find(".brtc-va-dialogs-launch-progress-proc-label").text(a),r.find(".brtc-va-dialogs-launch-progress-proc-label").attr("title",a),r.find(".brtc-va-dialogs-launch-progress-proc-status").text(this._statusLabel(e)),r.find("> .brtc-va-dialogs-launch-progress-functions").empty();},e.prototype._endProcess=function(t,e,i,o){var n=this.$mainControl.find("#"+t+".brtc-va-dialogs-launch-progress-proc");n.attr("status",e),n.find(".brtc-va-dialogs-launch-progress-proc-status").text(this._statusLabel(e)),n.find(".brtc-va-dialogs-launch-progress-proc-elapsed").attr("begin",i),n.find(".brtc-va-dialogs-launch-progress-proc-elapsed").attr("end",o);},e.prototype._beginUnit=function(t,e,i,o,n){var r=this.$mainControl.find("#"+t+".brtc-va-dialogs-launch-progress-proc > .brtc-va-dialogs-launch-progress-functions"),a=r.find(".brtc-va-dialogs-launch-progress-func[id="+e+"]");0==a.length&&((a=$('
')).attr("id",e),r.append(a),a.find(".brtc-va-dialogs-launch-progress-func-elapsed").attr("begin",Date.now()),a.find(".brtc-va-dialogs-launch-progress-func-elapsed").removeAttr("end")),a.attr("status",i),a.find(".brtc-va-dialogs-launch-progress-func-label").text(o),n&&(a.find(".brtc-va-dialogs-launch-progress-func-loop").text(n),a.find(".brtc-va-dialogs-launch-progress-func-loop").attr("title",n)),a.find(".brtc-va-dialogs-launch-progress-func-label").attr("title",o),a.find(".brtc-va-dialogs-launch-progress-func-status").text(this._statusLabel(i)),this.$processScrollbar.scrollTop(this.$processScrollbar.prop("scrollHeight")),this.$processScrollbar.perfectScrollbar("update");},e.prototype._endUnit=function(t,e,i,o,n,r){var a=this.$mainControl.find("#"+t+".brtc-va-dialogs-launch-progress-proc #"+e+".brtc-va-dialogs-launch-progress-func");a.attr("status",i),a.find(".brtc-va-dialogs-launch-progress-func-status").text(this._statusLabel(i)),r&&(a.find(".brtc-va-dialogs-launch-progress-func-loop").text(r),a.find(".brtc-va-dialogs-launch-progress-func-loop").attr("title",r)),a.find(".brtc-va-dialogs-launch-progress-func-elapsed").attr("begin",o),a.find(".brtc-va-dialogs-launch-progress-func-elapsed").attr("end",n);},e.prototype._updateUnit=function(t,e,i,o,n,r){var a=this.$mainControl.find("#"+t+".brtc-va-dialogs-launch-progress-proc #"+e+".brtc-va-dialogs-launch-progress-func");a.attr("status",i),r&&(a.find(".brtc-va-dialogs-launch-progress-func-loop").text(r),a.find(".brtc-va-dialogs-launch-progress-func-loop").attr("title",r));},e.prototype._statusLabel=function(t){return"wait"==t.toLowerCase()?"Wait":"processing"==t.toLowerCase()?"Running":"success"==t.toLowerCase()?"Success":"fail"==t.toLowerCase()?"Fail":"abort"==t.toLowerCase()?"Abort":t;},t.VA.Core.Dialogs.LaunchProgressDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=700,this.dialogOptions.height=600,this.dialogOptions.maxWidth=700,this.dialogOptions.maxHeight=600;},e.prototype.createSearchControl=function(e){var i=this;this.$searchControl=e.find(".brtc-va-dialogs-member-management-search").jqxInput({placeHolder:"Search for Name, ID",theme:t.VA.Env.Theme}),this.$searchControl.keyup(function(t){i.applySearchFilter(i.$searchControl.val().trim());}),this.$searchControl.on("search",function(){i.applySearchFilter(i.$searchControl.val().trim());});},e.prototype.applySearchFilter=function(t){if(t){var e=new $.jqx.filter(),i=e.createfilter("stringfilter",t,"contains");e.addfilter(1,i);var o=new $.jqx.filter();o.operator="or";var n=e.createfilter("stringfilter",t,"contains");o.addfilter(1,n),this.$memberGrid.jqxGrid("addfilter","user_name",e),this.$memberGrid.jqxGrid("addfilter","user_id",o),this.$memberGrid.jqxGrid("applyfilters");}else this.$memberGrid.jqxGrid("clearfilters");this.$memberGrid.jqxGrid("clearselection");},e.prototype.createInviteButton=function(e){var i=this;this.$inviteButton=e.find(".brtc-va-dialogs-member-management-invite").jqxButton({theme:t.VA.Env.Theme}),this.$inviteButton.click(function(){new t.VA.Core.Dialogs.InviteMemberDialog(e,{members:i.$memberGrid.jqxGrid("getrows"),projectId:i.options.projectId,close:function close(){i.$memberGrid.jqxGrid("updatebounddata"),i.$memberGrid.jqxGrid("clearselection");},title:"Invite Member"});});},e.prototype.createMemberGrid=function(e){var i={datatype:"json",datafields:[{name:"user_name",type:"string"},{name:"user_id",type:"string"},{name:"role_id",type:"string"},{name:"role_category",type:"string"},{name:"role_label",type:"string"},{name:"joined_time",type:"date"}],url:"api/va/v2/ws/projects/"+this.options.projectId+"/members"},o=new $.jqx.dataAdapter(i);this.$memberGrid=e.find(".brtc-va-dialogs-member-management-grid").jqxGrid({theme:t.VA.Env.Theme,source:o,width:"100%",height:"calc(100% - 160px)",altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,columnsheight:34,rowsheight:34,selectionmode:"checkbox",showfiltercolumnbackground:!1,enabletooltips:!0,columns:[{text:"Name",datafield:"user_name",width:120,cellsrenderer:function cellsrenderer(e,i,o){return'
'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"
";}},{text:"ID",datafield:"user_id",width:240},{text:"Authority",datafield:"role_label",width:110},{text:"Joined Date",datafield:"joined_time",cellsformat:"yyyy-MM-dd HH:mm"}]});},e.prototype.createAuthorityCombo=function(e){this.$authorityCombo=e.find(".brtc-va-dialogs-member-management-authority").jqxDropDownList({theme:t.VA.Env.Theme,autoDropDownHeight:!0,source:[{id:"role_10002",label:"as Organizer"},{id:"role_10003",label:"as Member"},{id:"role_10004",label:"as Reporter"}],displayMember:"label",valueMember:"id",itemHeight:29,dropDownWidth:118,selectedIndex:1});},e.prototype.createApplyAuthorityButton=function(e){var i,o=this;this.$applyButton=e.find(".brtc-va-dialogs-member-management-apply-authority").jqxButton({theme:t.VA.Env.Theme}),this.$applyButton.click(function(){var e=o.$memberGrid.jqxGrid("getselectedrowindexes");if(0==e.length)t.VA.Core.Utils.WidgetUtils.openErrorDialog("At least one member must be selected.");else{if(1==e.length&&"role_10001"==(i=o.$memberGrid.jqxGrid("getrowdata",e[0])).role_id)return void t.VA.Core.Utils.WidgetUtils.openErrorDialog("Can not change authority of owner.");var n=o.$authorityCombo.jqxDropDownList("getSelectedItem").value,r={members:[]};for(var a in e){i=o.$memberGrid.jqxGrid("getrowdata",e[a]),r.members.push({user_id:i.user_id,role_id:n});}var s={url:"api/va/v2/ws/projects/"+o.options.projectId+"/members/authority",type:"POST",contentType:"application/json; charset=utf-8",blocking:!0,data:JSON.stringify(r)};$.ajax(s).done(function(e){t.VA.Core.Utils.WidgetUtils.openInformationDialog("Changed "+e+" member's authority.",function(){o.$memberGrid.jqxGrid("updatebounddata"),o.$memberGrid.jqxGrid("clearselection");});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});}});},e.prototype.createWithdrawButton=function(e){var i=this;this.$withdrawButton=e.find(".brtc-va-dialogs-member-management-withdraw").jqxButton({theme:t.VA.Env.Theme}),this.$withdrawButton.click(function(){var e=i.$memberGrid.jqxGrid("getselectedrowindexes");if(0==e.length)t.VA.Core.Utils.WidgetUtils.openErrorDialog("At least one member must be selected.");else{var o;for(var n in e){var r=i.$memberGrid.jqxGrid("getrowdata",e[n]);if("role_10001"==r.role_id)return void t.VA.Core.Utils.WidgetUtils.openErrorDialog("Can not change authority of owner.");r.user_id==t.VA.Env.Session.userId&&(o=!0);}o?t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Are you sure you want to leave the project?",function(t){t.OK&&i.withdraw();}):t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Are you sure you want to withdraw the member(s)?",function(t){t.OK&&i.withdraw();});}});},e.prototype.withdraw=function(){var e={members:[]},i=this,o=this.$memberGrid.jqxGrid("getselectedrowindexes");for(var n in o){var r=this.$memberGrid.jqxGrid("getrowdata",o[n]);e.members.push({user_id:r.user_id,role_id:r.role_id});}var a={url:"api/va/v2/ws/projects/"+i.options.projectId+"/members/withdraw",type:"POST",contentType:"application/json; charset=utf-8",blocking:!0,data:JSON.stringify(e)};$.ajax(a).done(function(o){t.VA.Core.Utils.WidgetUtils.openInformationDialog("Withdraw "+o+" members.",function(){1==e.members.length&&e.members[0].user_id==t.VA.Env.Session.userId?i.handleOkClicked():(i.$memberGrid.jqxGrid("updatebounddata"),i.$memberGrid.jqxGrid("clearselection"));});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});},e.prototype.createDialogContentsArea=function(t){t.append('
'),this.createSearchControl(t),this.createInviteButton(t),this.createMemberGrid(t),this.createAuthorityCombo(t),this.createApplyAuthorityButton(t),this.createWithdrawButton(t);},e.prototype.createDialogButtonBar=function(e){t.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,e),this.$okButton.val("Close"),this.$cancelButton.css({display:"none"});},e.prototype.handleOkClicked=function(){t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},t.VA.Core.Dialogs.MemberManagementDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i),this.addListener();}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype.addListener=function(){var t=this;this.activeModelChangeListener=function(){t.options.getNavigatorData(),t.refresh();},this.options.editor.addActiveModelChangeListener(this.activeModelChangeListener);},e.prototype.removeListener=function(){this.options.editor.removeActiveModelChangeListener(this.activeModelChangeListener);},e.prototype.getTitle=function(){return"Navigator";},e.prototype.createControls=function(){this.$mainControl=$('
');var e=this._configureDialogOption({theme:t.VA.Env.Theme,title:this.getTitle(),position:{my:"left top",at:"left bottom",of:this.$parent.find(".brtc-va-editors-modelinfo-toolbar-dotdotdot")},width:400,height:600,maxWidth:400,maxHeight:600,modal:!1,resizable:!1});this.$mainControl.dialog(e),this.$mainControl.parent().draggable("option","containment",this.$parent),$(".ui-dialog-titlebar.ui-widget-header",$(this).parent()).css("width","calc(100% - 60px) !important");},e.prototype.createDialogContentsArea=function(t){var e=$('
');t.append(e),this.refresh(),t.perfectScrollbar();},e.prototype.createNavigatorItems=function(e){var i=this;this.fnUnits={};var o=this.options.getNavigatorData();0===o.length&&this.close(),e.empty(),e.append(o.map(function(e){var o=e.fnUnit,n=o.fid;i.fnUnits[n]=e.fnUnit;var r=e.mid,a=t.VA.Core.Interface.Functions.data[o.func],s=$('
');return s.attr("fid",n),s.attr("mid",r),s.addClass("brtc-va-fnunit-category-"+a.category),s.find(".brtc-va-dialogs-index-item-label").attr("title",o.display.label),s.find(".brtc-va-dialogs-index-item-label").text(o.display.label),s.find(".brtc-va-dialogs-index-item-func").text(a.defaultFnUnit.display.label),s;})),e.find(".brtc-va-dialogs-index-item").click(function(){var t=$(this).attr("fid"),e=$(this).attr("mid"),o=i.fnUnits[t];i.options.navigate(e,o);});},e.prototype.createDialogButtonBar=function(t){},e.prototype.destroy=function(){this.removeListener(),t.VA.Dialogs.Dialog.prototype.destroy.call(this);},e.prototype.refresh=function(){var t=this.$mainControl.find(".brtc-va-dialogs-navigator-item-container");(t.empty(),this.createNavigatorItems(t),this.$mainControl)&&this.$mainControl.find("brtc-va-dialogs-contents").perfectScrollbar("update");},t.VA.Core.Dialogs.NavigatorDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=980,this.dialogOptions.height=670;},e.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-newfile-contents"),t.parent().parent().find(".ui-dialog-titlebar.ui-widget-header").css("margin-left","26px !important"),this.createModelTypeListArea(t),this.createModelInfoInputArea(t);},e.prototype.createModelTypeListArea=function(e){var i=this,o=$('
'),n=t.VA.Implementation;for(var r in n){if("Report"===i.options.fileType){if("Visual"!==r)continue;}else if("Visual"===r)continue;o.append('
'+n[r].Label+"
");}e.append(o),e.find(".brtc-va-dialogs-modeltype-list-item:first").addClass("brtc-va-dialogs-modeltype-list-item-selected"),e.find(".brtc-va-dialogs-modeltype-list-item").click(function(){$(this).parent().find(".brtc-va-dialogs-modeltype-list-item-selected").removeClass("brtc-va-dialogs-modeltype-list-item-selected"),$(this).addClass("brtc-va-dialogs-modeltype-list-item-selected"),i.renderModelList($(this).attr("model-type"));});},e.prototype.createModelInfoInputArea=function(e){e.append('
Name
Description
Template
'),this.$nameControl=e.find(".brtc-va-dialogs-newfiledialog-name-input"),this.$nameControl.jqxInput({theme:t.VA.Env.Theme}),this.$nameControl.focus();var i=e.find(".brtc-va-dialogs-modeltype-list-item").attr("model-type");this.createDescriptionControl(e.find(".brtc-va-dialogs-newfiledialog-description-container")),this.createTemplate(e.find(".brtc-va-dialogs-newfiledialog-template-list"),i);},e.prototype.renderModelList=function(t){var e=this.$mainControl.find(".brtc-va-dialogs-newfiledialog-template-list"),i=e.parent();e.remove(),i.find(".brtc-va-dialogs-newfiledialog-name-input").focus(),i.append('
'),this.createTemplate(i.find(".brtc-va-dialogs-newfiledialog-template-list"),t);},e.prototype.convertTemplateContents=function(t){var e,i;"deeplearning"!==(t=t).type||_.isEmpty(t.functions)||(_.forEach(t.functions,function(t){"dlLoad"===t.func&&(e=t),"output"===t.func&&(i=t);}),i.param.train_data=e.fid);return t;},e.prototype.createTemplate=function(e,i){var o=this;if(o.$templateContainer=$('
'),e.append(o.$templateContainer),void 0!==i){var n={url:"api/va/v2/studio/templates/"+i,type:"GET",contentType:"application/json; charset=utf-8",blocking:!0};$.ajax(n).done(function(e){e.sort(function(t,e){return"Default"===t.name?-1:"Default"===e.name?1:t.name.localeCompare(e.name);}),e.forEach(function(e,i){var n=t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(e.name),r=$('
'+n+'
'+e.description+"
");"Default"!==n&&r.mouseover(function(){r.find(".brtc-va-dialogs-file-thumbnail.overlay").css({opacity:.6});}).mouseout(function(){r.find(".brtc-va-dialogs-file-thumbnail.overlay").css({opacity:0});}),e.thumbnail&&r.find(".brtc-va-dialogs-file-thumbnail.image").append($('')),0==i&&r.addClass("brtc-va-dialogs-file-thumbnail-selected"),o.$templateContainer.append(r),r.data("contents",e.contents);}),o.$templateContainer.find(".brtc-va-dialogs-file-thumbnail-unit").click(function(t){o.$templateContainer.find(".brtc-va-dialogs-file-thumbnail-selected").removeClass("brtc-va-dialogs-file-thumbnail-selected"),$(this).addClass("brtc-va-dialogs-file-thumbnail-selected"),o.$templateContainer.find(".brtc-va-dialogs-file-thumbnail-selected").find(".overlay"),o.noteControl.setValue(o.$templateContainer.find(".brtc-va-dialogs-file-thumbnail-selected").find(".overlay").text());});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);}),e.perfectScrollbar();}},e.prototype.createDescriptionControl=function(e){var i=this,o={focus:!1,height:120,description:"",okButton:this.$okButton,maxLength:2e3,toolbar:this.options.toolbar};this.noteControl=t.VA.Core.Widget.Factory.noteControl(e,o),this.$mainControl.on("resizing",function(t){i.noteControl.setHeight(i.$mainControl.find(".brtc-va-dialogs-contents").height()-110);});},e.prototype.createFileContents=function(e,i,o){var n=this.$templateContainer.find(".brtc-va-dialogs-file-thumbnail-selected");return 0==n.length&&(n=this.$templateContainer.find(".brtc-va-dialogs-file-thumbnail:nth-child(1)")),this.convertTemplateContents(t.VA.Core.Utils.ModelUtils.createFileContents(n.data("contents"),e,i,o));},e.prototype.handleOkClicked=function(){var e=this,i=this.$mainControl.find(".brtc-va-dialogs-newfiledialog-name-input");if(""!==i.val().trim()){if($(e.noteControl.getCode()).text().length>2e3)t.VA.Core.Utils.WidgetUtils.openErrorDialog("Description should be less than or equal to 2000 characters.");else{var o=t.VA.Core.Utils.IDGenerator.model.id(),n=""===e.noteControl.getCode()?"":e.noteControl.getCode(),r=new t.VA.Vo.File();r.setFileId(o),r.setProjectId(this.options.project.getProjectId()),r.setLabel(i.val()),r.setContents(e.createFileContents(o,i.val())),r.setDescription(n),r.setCreator(t.VA.Env.Session.userId),Studio.getResourceManager().addFile(this.options.project.getProjectId(),r).then(function(t){e.dialogResult={OK:!0,Cancel:!1,selectedFile:t},e.$mainControl.dialog("close");}).catch(function(e){console.error(e),t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);});}}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter name.",function(){e.$nameControl.focus();});},t.VA.Core.Dialogs.NewFileDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.createContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
'),this.$parent.append(this.$mainControl),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e={theme:t.VA.Env.Theme,title:"Note",width:1020,height:690,maxWidth:1020,maxHeight:690,modal:!0,resizable:!1};this.$mainControl.dialog(e);},e.prototype.createContents=function(){this.initContents(this.$mainControl.find(".brtc-va-dialogs-notecontents")),this.createNoteArea(this.$mainControl.find(".brtc-va-dialogs-notecontents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this));},e.prototype.initContents=function(t){},e.prototype.createNoteArea=function(e){var i={height:480,description:this.options.contents,okButton:this.$okButton,maxLength:1e3};this.note=t.VA.Core.Widget.Factory.noteControl(e,i);},e.prototype.handleOkClicked=function(){"function"==typeof this.options.save&&this.options.save(this.note.getCode()),this.$mainControl.dialog("close");},t.VA.Core.Dialogs.NoteDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=760,this.dialogOptions.height=440;},e.prototype.createDialogContentsArea=function(e){var i=$('
Title
Register Date
'+t.VA.Core.Utils.CommonUtils.transferTimestampToDateString(new Date(this.options.noticeData.create_time))+'
Creator
'+this.options.noticeData.creator+'
Content
');i.find(".brtc-va-dialogs-contents-input.notice").attr("title",this.options.noticeData.title).text(this.options.noticeData.title),i.find(".brtc-va-dialogs-contents-input-half.notice.creator").attr("title",this.options.noticeData.creator),e.append(i),e.find(".brtc-va-dialogs-contents-textarea.notice").html(this.options.noticeData.content),$(".brtc-va-dialogs-contents-textarea-wrapper.notice").perfectScrollbar();},e.prototype.createDialogButtonBar=function(e){var i=this;this.$closeButton=$(''),e.append(this.$closeButton),this.$closeButton.jqxButton({theme:t.VA.Env.Theme}),this.$closeButton.on("click",function(t){i.$mainControl.dialog("close"),t.stopPropagation();});},t.VA.Core.Dialogs.NoticeDetailDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=900,this.dialogOptions.height=540,this.dialogOptions.keyboardCloseKey="",this.dialogOptions.closeOnEscape=!1,this.$elements={},this.controls={};},e.prototype.createDialogContentsArea=function(e){var i=this;this.$contentsArea=e;var o={url:"api/va/v2/studio/optcontrol",type:"GET",data:{func:this.options.fnUnit.func,method:this.options.method},contentType:"application/json; charset=utf-8",blocking:!0};this.options.methodType&&(o.data.methodType=this.options.methodType),$.ajax(o).done(function(o){var n={controlSpec:o,fnUnit:i.options.fnUnit,dataProxy:i.options.dataProxy,modelEditor:i.options.modelEditor};i.popupProperty=new t.VA.Core.Functions.Library.optDialogBase.propertiesPanel(e,n);});},e.prototype.handleOkClicked=function(){this.dialogResult.param=this.popupProperty.getParams(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},e.prototype.destroy=function(){this.popupProperty.destroy(),this.$mainControl.dialog("destroy"),this.$mainControl=void 0;},t.VA.Core.Dialogs.OptDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){var o=Studio.getEditorContainer().getActiveModelEditor();e=e||o.$mainControl,(i=i||{}).title="Optimization Progress",t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=1e3,this.dialogOptions.height=600,this.dialogOptions.modal=!1,this.dialogOptions.create=function(){$(".ui-widget-content").css("border-color","#d4d4d4");};},e.prototype.createDialogContentsArea=function(t){var e=$('
');t.append(e),this.createParameterArea(e),this.createObjectiveValueArea(e),this.options.data&&(this.selectedIndex=0,this.render(this.options.data)),t.perfectScrollbar();},e.prototype.createParameterArea=function(t){var e=$('
');t.append(e),this.createHistoryArea(e),this.createBestParamArea(e),this.createTabsArea(e);},e.prototype.createHistoryArea=function(t){this.$historyArea=$('
History
'),t.append(this.$historyArea);},e.prototype.createBestParamArea=function(t){this.$bestParamArea=$('
Best Parameter
'),t.append(this.$bestParamArea);},e.prototype.createTabsArea=function(t){this.$tabsArea=$('
'),t.append(this.$tabsArea);},e.prototype.createObjectiveValueArea=function(t){var e=$('
');t.append(e),this.createObjectiveChartArea(e);},e.prototype.createObjectiveChartArea=function(t){this.$chartArea=$('
Objective Value
'),t.append(this.$chartArea);},e.prototype.createDialogButtonBar=function(e){this.$okButton=$('\n '),e.append(this.$okButton),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this));},e.prototype.handleOkClicked=function(){var e=Studio.getEditorContainer().getActiveModelEditor(),i=e.getEditorInput().getContents(),o=e.getCommandManager(),n=new t.VA.Core.CompoundCommand(this,{label:"Apply best parameters"});this.optimizationData=this.optimizationData||{};var r=this.optimizationData.bestParameter||[];if(r.length){for(var a=0;a=0;i--){for(var o=e[i].functions,n=o.length-1;n>=0;n--){var r=o[n].optimization;if(r)return r;}}return null;},e.prototype.getOptimizationFids=function(t){var e=t.parameter;return _(e).flatten().map("fid").uniq().sortBy().value();},e.prototype._render=function(t){var e=t.parameter,i=t.bestParameter,o=t.objective;this.renderHistory(e),this.renderBestParam(i),this.renderTabs(this.optimizationFids),this.renderObjectiveChart(o);},e.prototype.getFunctionLabel=function(t){var e=Studio.getEditorContainer().getActiveModelEditor().getEditorInput().getContents().getFnUnitById(t);return e?e.display.label:"";},e.prototype.renderTabs=function(t){var e=this,i=this.$tabsArea.find(".brtc-opt-progress-dialog-tabs-wrapper");if(i.find("li").length){var o=i.find("li").toArray().map(function(t){return t.getAttribute("fid");});if(_.isEqual(o,t))return;}i.empty();var n=$('
');i.append(n),n.append("
    "),_.forEach(t,function(t,i){var o=e.getFunctionLabel(t),r=$("
  • ");r.attr({fid:t,title:o}),r.text(o),n.find("ul").append(r),n.append("
    ");}),t.length<=this.selectedIndex&&(this.selectedIndex=0),n.jqxTabs({theme:"office",selectedItem:this.selectedIndex,width:450,position:"bottom",scrollPosition:"both"}),n.on("selected",function(t){var i=t.args.item;e.selectedIndex=i,e.renderHistory(e.optimizationData.parameter),e.renderBestParam(e.optimizationData.bestParameter);});},e.prototype.renderHistory=function(e){var i=this.$historyArea.find(".brtc-opt-progress-dialog-history-grid"),o=this.convertParameter(e),n=new $.jqx.dataAdapter(o),r=this.getColumns(o.datafields);this.historyGrid=i.jqxGrid({theme:t.VA.Env.Theme,width:450,height:270,source:n,columns:r,columnsresize:!0});},e.prototype.renderBestParam=function(e){var i=this.$bestParamArea.find(".brtc-opt-progress-dialog-best-param-grid"),o=this.convertParameter(e),n=new $.jqx.dataAdapter(o),r=this.getColumns(o.datafields,!0);this.bestParameterGrid=i.jqxGrid({theme:t.VA.Env.Theme,width:450,autoheight:!0,source:n,columns:r,columnsresize:!0});},e.prototype.renderObjectiveChart=function(e){var i=this.$chartArea.find(".brtc-opt-progress-dialog-chart-wrapper");this.objectiveValue||(this.objectiveValue=e);var o=this.getChartOptions(e);if(this.chart){var n=!1;this.objectiveValue.length!=e.length&&(this.objectiveValue=e,n=!0),n&&this.chart.setOptions(o);}else i.empty(),this.chart=new t.Chart.BCharts(i,o);},e.prototype.getChartOptions=function(t){var e={chart:{border:"1px #000000 none",background:"rgba(255, 255, 255,1)",animationDuration:1e3,type:"line"},plotOptions:{line:{marker:{symbolSize:7,itemStyle:{normal:{opacity:1}}}}},xAxis:[{selected:[{value:"Index",name:"Index",type:"Integer"}],title:{show:!0,text:"",subtext:"",rotate:0,textStyle:{color:"#000000",fontSize:12,fontFamily:""},subtextStyle:{color:"#000000",fontSize:12,fontFamily:""},left:"50%",bottom:"5px"},axisTick:{show:!0},axisLabel:{show:!0,rotate:0,textStyle:{color:"#000000",fontSize:12,fontFamily:""}},zlevel:1,axisType:null}],yAxis:[{selected:[{value:"Objective",name:"Objective",type:"Double"}],title:{show:!1,text:"",subtext:"",rotate:-90,textStyle:{color:"#000000",fontSize:12,fontFamily:""},subtextStyle:{color:"#000000",fontSize:12,fontFamily:""},left:"8px",top:"50%"},axisTick:{show:!0},axisLabel:{show:!0,rotate:0,textStyle:{color:"#000000",fontSize:12,fontFamily:""}},zlevel:1,axisType:null}]};return e.source={dataType:"local",localData:[{dataType:"rawdata",columns:[{name:"Index",type:"number",internalType:"Integer"},{name:"Objective",type:"number",internalType:"Double"}],data:this.getConvertedObjectiveValue(t)}]},e.toolbar={type:"custom",show:!1},e;},e.prototype.getConvertedObjectiveValue=function(t){for(var e=[],i=0;i"+(i+1)+"
    ";}}];for(var o in t){i.push({text:t[o].name,datafield:t[o].name});}return i;},e.prototype.hide=function(){this.$mainControl.parent().hide();},t.VA.Core.Dialogs.OptProgressDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Dialogs.ScriptEditorDialog.prototype;function i(t,i){e.constructor.call(this,t,i);}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype._initOptions=function(){e._initOptions.call(this),this.controls={},this.columnControlList=[];},i.prototype.createLayout=function(t,i){e.createLayout.call(this),this.$controlWrapper=$('
    '),this.$controlWrapper.css("display","flex"),this.$infoArea.append(this.$controlWrapper);},i.prototype.renderInfoArea=function(t,e){this.createColumnControls(),this.fillControlValues();},i.prototype.createColumnControls=function(e){for(var i=["parameters","constraints-column","objectives-column"],o=0;o'+t+'
    *
    ');var o=$('
    '+t+"
    "),n=$('
    ');return o.append(n),this.$controlWrapper.append(o).append(n),"function"==typeof e&&e.call(this,n),n;},i.prototype.createColumnList=function(e,i){var o=$('
    ');e.wrap(o);var n={placeHolder:"No Columns",multiple:!0,rowCount:1,maxRowCount:5,expand:!1,sort:"none",sortBy:"name",showOpener:"none",removable:!1,defaultType:"-",changed:function changed(t,e){},added:function added(){},removed:function removed(){}};return i&&$.extend(n,i),new t.VA.Core.Editors.Sheet.Controls.ColumnList(e,n);},i.prototype.registerColumnControl=function(t){this.columnControlList.push(t);},i.prototype.fillControlValues=function(){var t=[],e=this;this.options.fnUnit[IN_DATA][0]?this.options.dataProxy.requestSchema(this.options.fnUnit[IN_DATA][0],function(i){if(t=i.columns,e.columnControlList)for(var o=0;o
    ');t.append(e),this.createFunctionsArea(e),this.createObjectiveArea(e),e.append("\n \n "),t.perfectScrollbar();},e.prototype.createFunctionsArea=function(e){var i=this,o=$('
    ');e.append(o);var n=this.options.functions;for(var r in n){!function(e,n){var r=$('
    ');o.append(r);var a=e[n].display.label,s=t.VA.Core.Functions.Library[e[n].func].category;s=s||"io";var l=$("\n
    \n
    \n
    \n
    \n
    \n
    \n ");l.find(".brtc-opt-function-label").text(a),l.attr("title",a),r.append(l);var c=$('
    ');r.append(c);var d=e[n].outData;for(var p in d){!function(t,r){var s=a+"-"+(Number(r)+1),l=t[r],d=$('\n
    \n \n \n
    \n ');i.options.objective.tableName===l&&d.addClass("selected"),d.find("span").text(s),d.attr("title",s),c.append(d),d.click(function(){o.find(".brtc-opt-function-table-label").removeClass("selected"),$(this).addClass("selected"),i.options.objective.fid=e[n].fid,i.options.objective.tableName=l,i.$functionLabelControl.text(a),i.$functionLabelControl.attr("title",a),i.$tableLabelControl.text(s),i.$tableLabelControl.attr("title",s);});}(d,p);}r.jqxExpander({theme:t.VA.Env.Theme,arrowPosition:"left",expanded:!0});}(n,r);}o.perfectScrollbar();},e.prototype.createObjectiveArea=function(t){var e=$('
    ');t.append(e);var i=$('
    ');e.append(i),this.createFunctionLabelControl(i),this.createTableLabelControl(i),this.createRowControl(i),this.createColumnControl(i),this.createSenseControl(i),e.append("\n \n ");},e.prototype.createFunctionLabelControl=function(t){t.append('\n
    \n Function\n *\n
    ');this.$functionLabelControl=$('
    ');var e=this.options.objective.fid,i=Studio.getEditorContainer().getActiveModelEditor().getEditorInput().getContents().getFnUnitById(e);if(i){var o=i.display.label;this.$functionLabelControl.text(o),this.$functionLabelControl.attr("title",o);}else this.options.objective.fid="",this.$functionLabelControl.text("Select objective");t.append(this.$functionLabelControl);},e.prototype.createTableLabelControl=function(t){t.append('\n
    \n Table Name\n *\n
    ');this.$tableLabelControl=$('
    ');var e=this.options.objective.fid,i=Studio.getEditorContainer().getActiveModelEditor().getEditorInput().getContents().getFnUnitById(e);if(i){var o,n=i.display.label,r=this.options.objective.tableName,a=i.outData;for(var s in a){if(a[s]===r){o=n+"-"+(Number(s)+1);break;}}this.$tableLabelControl.text(o),this.$tableLabelControl.attr("title",o);}else this.options.objective.tableName="",this.$tableLabelControl.text("Select objective");t.append(this.$tableLabelControl);},e.prototype.createRowControl=function(e){var i=this;e.append('\n
    \n Row Number\n *\n
    '),this.$rowControlWrapper=$("
    "),e.append(this.$rowControlWrapper);this.$rowControl=new t.VA.Core.Editors.Sheet.Controls.NumericInput(this.$rowControlWrapper,{numberType:"int",min:1,max:9999,minus:!1,placeholder:"Enter row number"});var o=this.options.objective.row;this.$rowControl.setValue(o),this.$rowControl.onChange(function(t){i.options.objective.row=t;});},e.prototype.createColumnControl=function(e){var i=this;e.append('\n
    \n Column Name\n *\n
    '),this.$columnControl=$(''),e.append(this.$columnControl),this.$columnControl.jqxInput({placeHolder:"Enter column name",theme:t.VA.Env.Theme,width:"100%",height:25}),this.$columnControl.val(this.options.objective.column),this.$columnControl.on("change",function(t){var e=$(this).val();i.options.objective.column=e;});},e.prototype.createSenseControl=function(e){var i=this;e.append('\n
    \n Sense\n *\n
    '),this.$senseMax=$('
    Maximize
    '),this.$senseMin=$('
    Minimize
    '),e.append(this.$senseMax),e.append(this.$senseMin);var o="maximize"===this.options.objective.sense.toLowerCase();this.$senseMax.jqxRadioButton({theme:t.VA.Env.Theme,checked:o}),this.$senseMin.jqxRadioButton({theme:t.VA.Env.Theme,checked:!o}),this.$senseMax.on("change",function(t){t.args.checked&&(i.options.objective.sense="maximize");}),this.$senseMin.on("change",function(t){t.args.checked&&(i.options.objective.sense="minimize");});},e.prototype.createDialogButtonBar=function(e){this.$okButton=$(''),e.append(this.$okButton),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this)),this.$cancelButton=$(''),e.append(this.$cancelButton),this.$cancelButton.jqxButton({theme:t.VA.Env.Theme}),this.$cancelButton.click(this.handleCancelClicked.bind(this));},e.prototype.handleOkClicked=function(){if(void 0!==this.$mainControl){if(this.options.objective){if(!this.options.objective.fid||!this.options.objective.tableName)return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please select objective.");if(!this.options.objective.row)return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter row number.");if(!this.options.objective.column)return t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter column name.");}this.dialogResult.OK=!0,this.dialogResult.Cancel=!1,this.dialogResult.objective=$.extend(!0,{},this.options.objective),this.$mainControl.dialog("close");}},e.prototype.render=function(t){var e=this.getOptimizationData(t);e&&(this.$mainControl.parent().show(),this._render(e));},e.prototype.getOptimizationData=function(t){var e=t.processes;if(!e)return null;for(var i=e.length-1;i>=0;i--){for(var o=e[i].functions,n=o.length-1;n>=0;n--){var r=o[n].optimization;if(r)return r;}}return null;},e.prototype._render=function(t){var e=t.parameter,i=t.bestParameter,o=t.objective;this.renderHistory(e),this.renderBestParam(i),this.renderObjectiveChart(o);},e.prototype.renderHistory=function(e){var i=this.$historyArea.find(".brtc-opt-progress-dialog-history-grid"),o=this.convertParamter(e),n=new $.jqx.dataAdapter(o),r=this.getColumns(o.datafields);this.historyGrid=i.jqxGrid({theme:t.VA.Env.Theme,width:450,height:322,source:n,columns:r,columnsresize:!0});},e.prototype.renderBestParam=function(e){var i=this.$bestParamArea.find(".brtc-opt-progress-dialog-best-param-grid"),o=this.convertParamter(e),n=new $.jqx.dataAdapter(o),r=this.getColumns(o.datafields);this.bestParameterGrid=i.jqxGrid({theme:t.VA.Env.Theme,width:450,autoheight:!0,source:n,columns:r,columnsresize:!0});},e.prototype.renderObjectiveChart=function(e){var i=this.$chartArea.find(".brtc-opt-progress-dialog-chart-wrapper");this.objectiveValue||(this.objectiveValue=e);var o=this.getChartOptions(e);if(this.chart){var n=!1;this.objectiveValue.length!=e.length&&(this.objectiveValue=e,n=!0),n&&this.chart.setOptions(o);}else i.empty(),this.chart=new t.Chart.BCharts(i,o);},t.VA.Core.Dialogs.OptSelectObjectiveDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dialogs.Dialog.prototype;function i(t,i){e.constructor.call(this,t,i);}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype._initOptions=function(){e._initOptions.call(this),this.dialogOptions.width=600,this.dialogOptions.height=540,this.dialogOptions.keyboardCloseKey="",this.dialogOptions.closeOnEscape=!1,this.controls={};},i.prototype.createDialogContentsArea=function(e){var i={fnUnit:this.options.fnUnit,dataProxy:this.options.dataProxy,modelEditor:this.options.modelEditor,renderValues:this.renderValues.bind(this),fillControlValues:this.fillControlValues.bind(this)};this.popupProperty=new t.VA.Core.Functions.Library.DialogPanelProperties.propertiesPanel(e,i),this.createContentsAreaControls(this.popupProperty.$contentsArea),this.popupProperty.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit)),this.popupProperty._initializePerfectScroll();},i.prototype.fillControlValues=function(){},i.prototype.renderValues=function(){},i.prototype.handleOkClicked=function(){this.dialogResult.param=this.popupProperty.getParams(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},i.prototype.bindValidation=function(t){},i.prototype.checkValidation=function(t){if(this.removeValidation(t.$target),t.control&&(!t.control.getValue()||$.isEmptyObject(t.control.getValue()))){var e={$target:t.$target,message:this.popupProperty.problemFactory.makeMessage({errorCode:"BR-0033",param:t.$target,messageParam:[t.label]})};this.createValidationContent(e);}},i.prototype.createValidationContent=function(e){var i=$('
    '+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(e.message)+"
    ");e.$target.append(i),e.$target.addClass("brtc-va-editors-sheet-validation-error-dialog"),i.show();},i.prototype.removeValidation=function(t){t.find(".brtc-va-editors-sheet-validation-tooltip-wrapper-dialog").remove(),t.removeClass("brtc-va-editors-sheet-validation-error-dialog");},i.prototype.destroy=function(){this.popupProperty.destroy(),this.$mainControl.dialog("destroy"),this.$mainControl=void 0;},i.prototype.createInput=function(t,e){var i=$('');t.append(i);var o={placeHolder:"Enter value"};e.widgetOption&&(o=$.extend(!0,o,e.widgetOption));var n=e.addClass?e.addClass:"",r=e.addCSS?e.addCSS:"",a=this.popupProperty.createInput(i,o,n,r);return a.setValue=function(t){i.val(t);},a.getValue=function(){return i.val();},a.setDisable=function(){this.jqxInput({disabled:!0});},a.setEnable=function(){this.jqxInput({disabled:!1});},a;},i.prototype.createTextArea=function(t,e){var i=$('
    '),o=$('');i.append(o),t.append(i);var n={placeholder:"sepal_length + 1",extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},autofocus:!1,hintOptions:{list:[]}};e.widgetOption&&(n=$.extend(!0,n,e.widgetOption));var r=e.addClass?e.addClass:" ";i.addClass(r);var a=this.popupProperty.createTextAreaControl(o,n);return a.codeMirror.options.hintOptions.list=this.columnData.slice(),a.codeMirror.setSize("100%",e.widgetOption.height),a;},i.prototype.createDropDownList=function(t,e){var i={source:e&&e.source?e.source:[],selectedIndex:0};e.widgetOption&&(i=$.extend(!0,i,e.widgetOption));var o=e.addClass?e.addClass:"",n=e.addCSS?e.addCSS:"",r=$('
    ');t.append(r);var a=this.popupProperty.createDropDownList(r,i,o,n);return a.setValue=function(t){void 0!==t&&this.jqxDropDownList("selectItem",t);},a.getValue=function(){return this.jqxDropDownList("getSelectedItem").value;},a.setDisable=function(){this.jqxDropDownList({disabled:!0});},a.setEnable=function(){this.jqxDropDownList({disabled:!1});},a;},i.prototype.createRadioButton=function(t,e){var i=this,o=e.key,n=e.source,r={groupName:o};e.widgetOption&&(r=$.extend(!0,r,e.widgetOption));var a=e.addClass?e.addClass:"",s=e.addCSS?e.addCSS:"",l=function(){if(e.value&&n.some(function(t){return t.value==e.value;}))return e.value;}(),c={},d={};return n.forEach(function(e){d[o+"."+e.value]=$('
    '+e.label+"
    "),t.append(d[o+"."+e.value]),c[o+"."+e.value]=i.popupProperty.createRadioButton(d[o+"."+e.value],r,a,s),c[o+"."+e.value].on("checked",function(t){l=e.value;});}),c.getValue=function(){return l;},c.setValue=function(t){d[o+"."+t].jqxRadioButton("check");},c;},i.prototype.createCheckBox=function(t,e){var i=$('
    ');t.append(i);var o={width:23,height:27};e&&e.widgetOption&&(o=$.extend(!0,o,e.widgetOption));var n=this.popupProperty.createCheckBox(i,o);return n.on("checked",e.checkedFunc),n.on("unchecked",e.uncheckedFunc),n.setValue=function(t){t?i.jqxCheckBox("check"):i.jqxCheckBox("uncheck");},n.getValue=function(){return i.val();},n;},i.prototype.createColumnList=function(t,e){var i=$('
    ');t.append(i);var o=this,n={maxRowCount:3,multiple:!0,changed:function changed(){o.bindValidation({mandatory:!0,$target:i,control:a,label:"Column"});}};e&&e.widgetOption&&(n=$.extend(!0,n,e.widgetOption));var r=e.addClass?e.addClass:"",a=this.popupProperty.createColumnList(i,n,r),s=this.popupProperty.getColumnData();return a.setItems(s),a.setValue=function(t){this.setSelectedItems(t),o.bindValidation({mandatory:!0,$target:i,control:a,label:"Column"});},a.getValue=function(){return this.getSelectedItems();},a;},t.VA.Core.Dialogs.PropertiesPanelDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.ScriptEditorDialog.call(this,e,i),this.checkInfo();}e.prototype=Object.create(t.VA.Core.Dialogs.ScriptEditorDialog.prototype),e.prototype.constructor=e,e.prototype.renderInfoArea=function(){this.options.scriptOnly&&!1!==this.options.scriptOnly||(this.renderInputs(this.$infoArea),this.renderOutputs(this.$infoArea));},e.prototype.createInTableAlias=function(e){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInTable(this.options.fnUnit),r=[];for(var a in n){r.push(o.getFnUnitByOutData(n[a]));}for(var a in r){var s=r[a],l="inputs["+a+"]",c=$('
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutTable(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.createInModelAlias=function(e){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInModel(this.options.fnUnit),r=[];for(var a in n){r.push(o.getFnUnitByOutData(n[a]));}for(var a in r){var s=r[a],l="models["+a+"]",c=$('
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutModel(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.createInImageAlias=function(e){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInImage(this.options.fnUnit),r=[];for(var a in n){r.push(o.getFnUnitByOutData(n[a]));}for(var a in r){var s=r[a],l="images["+a+"]",c=$('
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutImage(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.renderEditorArea=function(){this.sendFnunit=$.extend(!0,{},this.options.fnUnit),this.codeMirror=CodeMirror.fromTextArea(this.$editorArea.find("textarea")[0],{mode:this.scriptEditorOptions.mode,theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!0,matchBrackets:!0,autofocus:!1,extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:this.scriptEditorOptions.additionalHint}}),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror),t.VA.Core.Utils.WidgetUtils.setCodeMirrorMaxLength(this.codeMirror),this.setEditorStatement(this.options.statement),this.codeMirror.setSize("100%","100%"),this.codeMirror.setOption("maxLength",this.scriptEditorOptions.maxLength);},e.prototype.renderInputs=function(t){this.$inputs=$('
    '),t.append(this.$inputs),this.renderInTableAlias(this.$inputs),this.renderInModelAlias(this.$inputs),this.renderInImageAlias(this.$inputs);},e.prototype.renderInTableAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Table Variable"});this.createInTableAlias(i),i.perfectScrollbar();},e.prototype.renderInModelAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Model Variable"});this.createInModelAlias(i),i.perfectScrollbar();},e.prototype.renderInImageAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Image Variable"});this.createInImageAlias(i),i.perfectScrollbar();},e.prototype.renderOutputs=function(e){var i=this,o=$('
    ');e.append(o),this.$outputsBody=this.addPropertyControl(o,{label:"Outputs"}),this.$outputsBody.perfectScrollbar(),this.$addButton=$(''),o.find(".brtc-va-dialogs-scalaeditor-alias-header").after(this.$addButton),this.$addButton.jqxButton({theme:t.VA.Env.Theme,width:"100%",height:32}),this.$addButton.click(function(){i.createOutTableAlias(i.$outputsBody,!1),i.$outputsBody.perfectScrollbar("update");}),this.createOutput(i.$outputsBody);},e.prototype.createOutput=function(t){var e=this,i=this.FnUnitUtils.getOutputs(this.options.fnUnit);_.forEach(i,function(i,o){var n=e.createOutTableAlias(t,!1,i),r=e.FnUnitUtils.getTypeByTableId(e.options.fnUnit,i);n.find(".alias input").val(o),n.find(".type .brtc-va-dialogs-scalaeditor-alias-body-outtable-type").val(r);}),t.perfectScrollbar();},e.prototype.createOutTableAlias=function(t,e,i){var o=$('
    ');return t.append(o),this.createInput(o.find(".brtc-va-dialogs-contents-statement-lastline-element-script"),"",e,i),this.createDropDownList(o.find(".brtc-va-dialogs-contents-statement-lastline-element-script-type"),"",e,i),o;},e.prototype.createInput=function(t,e,i,o){var n=this,r=$('
    '),a=r.find("input");t.append(r),a.jqxInput({placeHolder:"Enter alias",height:32,width:"105px",theme:"office"}),a.jqxInput("val",e),""!==a.val()&&null!=a.val()||a.css("border-color","red"),a.focus(),a.on("change",function(){""==$(this).val()?$(this).css("border-color","red"):$(this).css("border-color","#d4d4d4");}),a.keydown(function(t){13==t.keyCode&&n.createOutTableAlias(n.$outputsBody,!1);}),1==i&&""==e&&a.css("border-color","red");var s=r.find(".brtc-va-dialogs-scalaeditor-alias-body-outtable-remove");return s.attr({isMandatory:i}),s.click(function(){var t=$(this).closest(".brtc-va-dialogs-contents-statement-lastline-element-wrapper");t.find(".brtc-va-dialogs-scalaeditor-alias-body-outtable").attr("tableId")&&n.removeSendFnunit(t.attr("tableId")),t.remove(),n.$outputsBody.perfectScrollbar("update");}),a;},e.prototype.removeSendFnunit=function(t){},e.prototype.addPropertyControl=function(t,e){var i=e.label;e.mandatory&&(i='
    '+i+'
    *
    ');var o=$('
    '+i+"
    "),n=$('
    ');return t.append(o).append(n),n;},e.prototype.getTitle=function(){return"Python";},e.prototype.createSendOutputs=function(){},e.prototype.handleOkClicked=function(){if(this.options.scriptOnly||!1===this.options.scriptOnly)this.dialogResult={OK:!0,Cancel:!1,queryStatement:this.codeMirror.getValue()};else{var e=this.$outputsBody.find(".brtc-va-dialogs-contents-statement-lastline-element-wrapper");this.sendFnunit.outputs={},this.sendFnunit.meta={inputs:{type:"table",range:{min:1,max:10}},models:{type:"model",range:{min:1,max:10}},images:{type:"image",range:{min:1,max:10}}};for(var i=0;itrue
    '),this.$falseControl=$('
    false
    '),this.$infoArea.addClass("rscript"),this.$infoArea.append('
    '),this.$columns=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-columnlist"),this.$groupby=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-groupbylist"),this.$stringasfactors=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-stringasfactors"),this.$resultNames=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-resultlist"),this.addPropertyControl("Columns",function(t){t.append(this.$columns);var e={multiple:!0,maxRowCount:3,sort:"none",showOpener:"button",changed:function changed(t,e){i.selectedColumns=e.items,i.renderValidation();}};i.columnsControl=i.createColumnList(i.$columns,e);},{mandatory:!0}),this.addPropertyControl("Group by",function(t){t.append(this.$groupby);var e={multiple:!0,maxRowCount:3,sort:"none",showOpener:"button",changed:function changed(t,e){i.selectedGroupby=e.items,i.renderValidation();}};i.groupbyControl=i.createColumnList(i.$groupby,e);},{mandatory:!1}),this.addPropertyControl("Strings As Factors",function(t){this.$stringasfactors.append(this.$trueControl).append(this.$falseControl),t.append(this.$stringasfactors),i.createRadioButton(i.$trueControl,{width:"80",groupName:"Group"}),i.createRadioButton(i.$falseControl,{width:"80",groupName:"Group"}),i.$trueControl.on("checked",function(){i.selectedFactors="true";}),i.$falseControl.on("checked",function(){i.selectedFactors="false";});},{mandatory:!1}),this.addPropertyControl("Result Columns",function(t){t.append(this.$resultNames),i.resultColumnsControl=i.createResultNameList(i.$resultNames);},{mandatory:!0}),this.fillControlValues(),this.renderValues();},e.prototype.createResultNameList=function(t){var e=this.options.fnUnit.param["result-names"];if(void 0===e)this.createResultControlLayout(0,!0,t);else if(0===e.length)this.createResultControlLayout(0,!0,t);else for(var i=0;i
    '),l=n.find(".brtc-va-rcontents-input-container");0!==l.length&&l[t]?($(l[t]).after(s),a=!0):n.append(s);var c,d,p=$('
    ');s.append(p),e&&(c=$('
    '),s.append(c),c.click(function(t){r.handleAddInputControlEvent($(this).closest(".brtc-va-rcontents-input-container"),n);})),(t>0||a)&&(d=$('
    '),s.append(d),d.click(function(t){r.handleDeleteButtonClick($(this).closest(".brtc-va-rcontents-input-container"));})),this.createInputControl(p,o);},e.prototype.handleAddInputControlEvent=function(t,e,i){var o=t.index();this.createResultControlLayout(o,!0,e,i),this.getInputValue(),this.renderValidation();},e.prototype.handleDeleteButtonClick=function(t){t.remove(),this.getInputValue(),this.renderValidation();},e.prototype.createInputControl=function(e,i){var o,n=this;o=$(''),e.append(o);var r={theme:t.VA.Env.Theme,height:"25px",width:"100%"};o.jqxInput(r),i||o.jqxInput("focus"),o.keydown(function(t){13==t.keyCode&&(n.handleAddInputControlEvent(o.closest(".brtc-va-rcontents-input-container"),!0),n.getInputValue(),n.renderValidation());}),o.focusout(function(t){n.getInputValue(),n.renderValidation();});},e.prototype.getInputValue=function(){var t,e=this.$resultNames.find(".brtc-va-widget-contents-input-control");t=[];for(var i=0;i '+e+"
    ");t.append(n),t.addClass("brtc-va-editor-sheet-panels-validation-error"),i&&n.css("clear","both");var r=t.find(".brtc-va-editors-sheet-controls-columnselector");r.is("div")&&r.data().renderMissingColumns(),n.show();},e.prototype.addPropertyControl=function(e,i,o){var n=this,r=$('
    ');return o?(o.mandatory&&(e="
    "+e+'
    *
    '),n.$infoArea.append(r)):n.$infoArea.append(r),r.jqxExpander({theme:t.VA.Env.Theme,arrowPosition:"left",initContent:function initContent(){"function"==typeof i&&i.call(n,r.find(".brtc-va-editors-sheet-controls-propertycontrol-contents"),o);}}),r.jqxExpander("setHeaderContent",e),r;},e.prototype.createColumnList=function(e,i,o,n){this.wrapControl(e);var r="";o&&(r=r.concat(" ",o)),this.addClassToWrapper(e,r),this.addCssToWrapper(e,n);var a={openerPosition:"bottom",multiple:!0,rowCount:1,maxRowCount:5,expand:!1,sort:"none",sortBy:"name",showOpener:"button",removable:!0,defaultType:"-",changed:function changed(t,e){},added:function added(){},removed:function removed(){}};i&&$.extend(a,i);var s=new t.VA.Core.Editors.Sheet.Controls.ColumnList(e,a);return s.columnSelector.$mainControl.attr("isDialog",!0),s;},e.prototype.wrapControl=function(t){var e=$('
    ');t.wrap(e);},e.prototype.addClassToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.addClass(e);}},e.prototype.addCssToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.css(e);}},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,queryStatement:this.codeMirror.getValue(),columns:this.selectedColumns,groupbys:this.selectedGroupby,factors:this.selectedFactors,resultNames:this.resultColumns},this.$mainControl.dialog("close");},e.prototype.getTitle=function(){return"R";},t.VA.Core.Dialogs.REditorDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=(t.VA.Core.Utils,0),i={addColumnByRefine:{clazz:"AddColumnDialog",validator:"AddColumnValidator"},selectColumn:{clazz:"SelectColumnDialog",validator:"AddColumnValidator"},changeValue:{clazz:"ChangeValueDialog",validator:"AddColumnValidator"},groupBy:{clazz:"GroupByDialog",validator:"AddColumnValidator"},simpleFilter:{clazz:"SimpleFilterDialog",validator:"AddColumnValidator"},advancedFilter:{clazz:"AdvancedFilterDialog",validator:"AddColumnValidator"},sortByRefine:{clazz:"SortDialog",validator:"AddColumnValidator"}};function o(t,i){e=0,this.parentId=t,this.options=i,this.dialogResult={OK:!1,Cancel:!0,param:{functions:$.extend(!0,[],i.fnUnit.param.functions)}},this.dialogResult.param.functions.splice(this.dialogResult.param.functions.length-1,1),this.retrieveParent(),this.createControls(),this.initContents(),this.render();}o.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},o.prototype.createControls=function(){this.$mainControl=$('
    '),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel");var e=this,i={theme:t.VA.Env.Theme,title:"Refine Data",width:1024,height:800,maxWidth:1024,maxHeight:800,modal:!0,resizable:!1,create:function create(){$(".ui-dialog-titlebar-close",$(this).parent()).hide();},close:function close(){e.$mainControl.dialog("destroy"),"function"==typeof e.options.close&&e.options.close(e.dialogResult);}};this.$mainControl.dialog(i);},o.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this)),this.$cancelButton.jqxButton({theme:t.VA.Env.Theme}),this.$cancelButton.click(this.handleCancelClicked.bind(this));},o.prototype.handleOkClicked=function(){var e=this;if(this.$mainControl.find(".brtc-va-refine-step-warning").length>0){t.VA.Core.Utils.WidgetUtils.openConfirmDialog("The steps you need to check exists. Do you want to continue?",function(t){t.OK&&(e.dialogResult.OK=!0,e.dialogResult.Cancel=!1,e.$mainControl.dialog("close"));});}else this.dialogResult.OK=!0,this.dialogResult.Cancel=!1,this.$mainControl.dialog("close");},o.prototype.handleCancelClicked=function(){this.dialogResult.OK=!1,this.dialogResult.Cancel=!0,this.$mainControl.dialog("close");},o.prototype.createDialogContentsArea=function(i){i.append('
    Add Column
    Change Value
    Select Column
    Simple Filter
    Advanced Filter
    Sorter
    Group-by
    Applied Steps
    '),i.find(".brtc-va-refine-step-container-body").perfectScrollbar(),i.find(".brtc-va-refine-step-container-body").perfectScrollbar("update");var o=$('
    Open
    ');o.find(".brtc-va-refine-step-header-open").click(function(){n.refreshData(-1);}),i.find(".brtc-va-refine-step-container-body").append(o),i.find(".brtc-va-dialogs-refine-toolitem").jqxButton({theme:t.VA.Env.Theme});var n=this,r=function r(i){e>=20?t.VA.Core.Utils.WidgetUtils.openErrorDialog("The maximum number of steps that can be added to refine data is 20."):i();};i.find(".brtc-va-dialogs-refine-toolitem-addcolumn").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"addColumnByRefine",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-changevalue").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"changeValue",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-selectcolumn").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"selectColumn",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-simplefilter").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"simpleFilter",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-advancedfilter").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"advancedFilter",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-sorter").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"sortByRefine",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});}),i.find(".brtc-va-dialogs-refine-toolitem-groupby").on("click",function(){r(function(){n.getSchema(function(e){var i={func:"groupBy",in:n.getInput(),out:[t.VA.Core.Utils.IDGenerator.table.id()],columns:$.extend(!0,[],e),close:n.dialogClosed.bind(n),force:!1,context:n.options.context};n.openStepDialog(i);});});});},o.prototype.fillSpreadsheet=function(e,i,o){e.empty();var n=this,r=function r(i){n.$spreadsheet=$('
    '),e.empty(),e.append(n.$spreadsheet);var o={localdata:i.data,datatype:"array",datafields:$.map(i.columns,function(t,e){return{name:"__"+t.name,type:t.type,map:""+e};})},r=$.map(i.columns,function(e,i){var o={text:e.name,datafield:"__"+e.name,width:80};return"date"==e.type?o.cellsformat="yyyy-MM-dd HH:mm:ss:fff":"number"==e.type?(o.cellsformat="d",o.cellsalign="right"):"string"==e.type&&(o.cellsrenderer=function(e,i,o){var n="overflow:hidden; text-overflow:ellipsis; padding-bottom:2px; margin-right: 2px; margin-left: 4px; margin-top: 4px;",r=this.owner.source.records[e][i];if(void 0!==r&&""!==r&&null!==r)return'
    '+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"
    ";var a=this.owner.source._source.localdata[e],s=this.owner.source._source.datafields,l=0;for(var c in s){if(s[c].name===i){l=Number(s[c].map);break;}}return void 0===a[l]?'
    undefined
    ':null===a[l]?'
    null
    ':""===a[l]?'
    ':void 0;}),o;});r.unshift({text:"No",sortable:!1,menu:!1,editable:!1,groupable:!1,draggable:!1,datafield:"",width:40,columntype:"number",renderer:function renderer(t){return'
    '+t+"
    ";},cellsformat:"d",cellsalign:"right",cellclassname:"brtc-va-refine-spreadsheet-rownum-cell",cellsrenderer:function cellsrenderer(t,e,i){return'
    '+(i+1)+"
    ";}});var a=new $.jqx.dataAdapter(o);n.$spreadsheet.jqxGrid({theme:t.VA.Env.Theme,width:"100%",height:"100%",rowsheight:25,source:a,altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,selectionmode:"multiplecellsextended",columns:r}),n.$spreadsheet.on("columnclick",function(t){"No"==t.args.column.text&&$(this).jqxGrid("autoresizecolumns");});},a=function a(i){n.$spreadsheet=$('
    '),e.empty(),e.append(n.$spreadsheet),n.$spreadsheet.jqxGrid({theme:t.VA.Env.Theme,width:"100%",height:"100%",rowsheight:25,altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,selectionmode:"multiplecellsextended"});};o?this.options.dataProxy.requestDataForce(i,r,a):this.options.dataProxy.requestData(i,r,a);},o.prototype.dialogClosed=function(t){t.OK&&this.callFunction(t.FnUnit,t.force);},o.prototype.addStep=function(t){var e=this,i=!0;$.each(e.dialogResult.param.functions,function(o,n){if(n.fid&&n.fid==t.fid)return e.dialogResult.param.functions[o]=$.extend(!0,{},t),void(i=!1);}),i&&(e.appendFnUnit(t),e.appendStep(t));},o.prototype.callFunction=function(e,i){var o=this;e.parent=function(){var t=$.extend(!0,{},o.options.fnUnit.parent());return t.functions=[e],t.links=[],t;};var n=$.extend(!0,{},e);n.param["additional-query"]=e.param["additional-query"],o.addStep(e);var r=$.inArray(e.fid,$.map(o.dialogResult.param.functions,function(t){return t.fid;})),a={success:function success(t){o.refreshData(r,i),o.renderWarningStep(r+1);},catch:function _catch(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog(e),o.refreshData(r,i),o.renderWarningStep(r);}};Studio.getJobExecutor().launchUnit(n,{},{},a);},o.prototype.getInput=function(){return 0==this.$mainControl.find(".brtc-va-refine-step").length?this.options.fnUnit[IN_DATA]:this.dialogResult.param.functions[this.dialogResult.param.functions.length-1][OUT_DATA];},o.prototype.getSchema=function(t,e){var i=[];return 0==this.$mainControl.find(".brtc-va-refine-step").length?(i=this.options.columns,t(i)):void 0!==e?0==e?(i=this.options.columns,t(i)):this.options.dataProxy.requestSchema(this.dialogResult.param.functions[e-1][OUT_DATA][0],function(e){i=e.columns,t(i);},function(t){}):this.options.dataProxy.requestSchema(this.dialogResult.param.functions[this.dialogResult.param.functions.length-1][OUT_DATA][0],function(e){i=e.columns,t(i);},function(t){}),i;},o.prototype.appendFnUnit=function(t){this.dialogResult.param.functions.push(t);},o.prototype.render=function(){var t=this;if(this.dialogResult.param.functions.length){var e=this.dialogResult.param.functions;$.each(e,function(i,o){t.appendStep(e[i]);});}null!=this.options.stepIdx?this.refreshData(this.options.stepIdx):this.refreshData();},o.prototype.refreshData=function(t,e){var i=this.dialogResult.param.functions,o=this.$mainControl.find(".brtc-va-dialogs-refine-left-area");void 0!==t?0==i.length?this.fillSpreadsheet(o,this.options.fnUnit[IN_DATA][0],e):this.fillSpreadsheet(o,-1!==t?i[t][OUT_DATA][0]:this.options.fnUnit[IN_DATA][0],e):0==i.length?this.fillSpreadsheet(o,this.options.fnUnit[IN_DATA][0],e):i[i.length-1].fid?this.fillSpreadsheet(o,i[i.length-1][OUT_DATA][0],e):this.fillSpreadsheet(o,this.options.fnUnit[IN_DATA][0],e),this.renderSelectionStep(t);},o.prototype.appendStep=function(i){var o=this,n=$('
    '+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(i.display.label)+'
    ');n.find(".brtc-va-refine-step-header").click(function(){var t=$(this).parents(".brtc-va-refine-step").prevAll(".brtc-va-refine-step").length;o.refreshData(t);}),n.find(".brtc-va-refine-step-open-button").click(function(t){t.stopPropagation();var e=$(this).parents(".brtc-va-refine-step").prevAll(".brtc-va-refine-step").length,i=o.dialogResult.param.functions[e];o.getSchema(function(t){var e={func:i.func,fid:i.fid,in:i[IN_DATA],out:i[OUT_DATA],columns:$.extend(!0,[],t),close:o.dialogClosed.bind(o),param:i.param,force:!0,context:o.options.context};o.openStepDialog(e);},e);}),this.$mainControl.find(".brtc-va-refine-step-container-body").append(n),n.find(".brtc-va-refine-step-remove-button").click(function(t){t.stopPropagation();var e=$(this).parents(".brtc-va-refine-step"),i=e.prevAll(".brtc-va-refine-step").length;o.removeStep(e),o.removeFnUnit(i),o.refreshData(i-1),o.renderWarningStep(i);}),e++;},o.prototype.renderSelectionStep=function(t){var e=this.$mainControl.find(".brtc-va-refine-step-header"),i=this.$mainControl.find(".brtc-va-refine-step-header-open")[0];$(e).removeClass("brtc-va-refine-step-select"),$(i).removeClass("brtc-va-refine-step-select"),void 0!==t?-1===t?$(i).addClass("brtc-va-refine-step-select"):$(e[t]).addClass("brtc-va-refine-step-select"):$(this.$mainControl.find(".brtc-va-refine-step-header")).last().addClass("brtc-va-refine-step-select");},o.prototype.renderWarningStep=function(t){var e=this.$mainControl.find(".brtc-va-refine-step-header");$(e).removeClass("brtc-va-refine-step-warning");for(var i=t;i
    Name
    '),this.createNameControl(t.find(".brtc-va-dialogs-rename-name-input"));},e.prototype.createNameControl=function(e){this.$nameControl=e.jqxInput({placeHolder:"Enter name",theme:t.VA.Env.Theme}),this.options.name&&this.$nameControl.val(this.options.name),t.VA.Core.Utils.InputValidator.appendValidationCondition(this.$nameControl);},e.prototype.handleOkClicked=function(){var e=this.$nameControl.val().trim();if(0!=e.length){for(var i="",o=0,n=0;n0)t.VA.Core.Utils.WidgetUtils.openErrorDialog("[.] can not use it repeatedly.");else{if("function"==typeof this.options.validate){var r=this.options.validate(e);if(r)return void t.VA.Core.Utils.WidgetUtils.openErrorDialog(r);}this.dialogResult.newName=e,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);}}else t.VA.Core.Utils.WidgetUtils.openErrorDialog("Please enter name.");},t.VA.Core.Dialogs.RenameDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel");var e=this,i={theme:t.VA.Env.Theme,title:"Rename",width:400,height:200,modal:!0,resizable:!1,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}};this.$mainControl.dialog(i);},e.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this)),this.$cancelButton.jqxButton({theme:t.VA.Env.Theme});},e.prototype.createDialogContentsArea=function(e){this.$input=$('
    Set a static path for users repository.
    Set a dynamic path for users repository.
    '),this.createRepositoryTree(t.find(".brtc-va-dialogs-repository-browser-tree")),this.createSettingOptionControl(t.find(".brtc-va-dialogs-repository-browser-setting-option")),this.createFilePathControl(t.find(".brtc-va-dialogs-repository-browser-file-input > textarea"));},e.prototype.createRepositoryTree=function(e){var i=this;this.repositoryViewer=new t.VA.Core.Controls.RepositoryViewer(e),this.repositoryViewer.$tree.on("select",function(t){var e=i.repositoryViewer.getSelectedPath();i._setFilePath(e);});},e.prototype.createSettingOptionControl=function(e){var i=this,o=e.find(".brtc-va-dialogs-repository-browser-radio");this.$settingOptionGroup=e,o.jqxRadioButton({theme:t.VA.Env.Theme,groupName:"repository-browser-setting-option"}),o.on("checked",function(){var t=i.repositoryViewer.getSelectedPath()||i.options.filePath;i._setFilePath(t);}),this.options.filePath.match(/\$\{\=sys.user\}\//g)?this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").jqxRadioButton("check"):this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=static]").jqxRadioButton("check"),this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").hide();},e.prototype.createFilePathControl=function(e){this.fileName=CodeMirror.fromTextArea(e[0],{mode:"text",theme:"default",indentWithTabs:!1,smartIndent:!1,lineNumbers:!1,matchBrackets:!0,scrollbarStyle:"null",autofocus:!1}),this.fileName.on("beforeChange",function(t,e){var i=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[i]),!0;});var i=this;this.fileName.on("change",function(e,o){var n=e.getValue();i.$okButton.jqxButton({disabled:"/shared/"===n||n==="/"+t.VA.Env.Session.userId+"/"||"/shared/upload/"===n||n==="/"+t.VA.Env.Session.userId+"/upload/"||"/${=sys.user}/upload/"===n});}),this.fileName.setSize("100%","100%"),this.options.filePath&&this._setFilePath(this.options.filePath);t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.fileName,{"valid-type":"fileNameType","valid-message-position":"bottom"});},e.prototype._setFilePath=function(e){if(e){var i=e.match(/\/shared\/upload\/[^\/]*/);if(this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").hide(),i)this.fileName.setValue(e),this.fileName.markText({line:0,ch:0},{line:0,ch:15},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});else if(e.startsWith("/"+t.VA.Env.Session.userId+"/upload/")||e.startsWith("/${=sys.user}/upload/")){this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio").show();var o=0,n=e,r=(n=this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").val()?n.replace(/\/\S*\/upload\//g,"/${=sys.user}/upload/"):n.replace(/\/\$\{\=sys\.user\}\/upload\//g,"/"+t.VA.Env.Session.userId+"/upload/")).split("/");this.fileName.setValue(n);for(var a=0;a<3;a++){o+=r[a].length,o++;}this.fileName.markText({line:0,ch:0},{line:0,ch:o},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});}else n=e+"/",this.$settingOptionGroup.find(".brtc-va-dialogs-repository-browser-radio[value=dynamic]").val()&&!n.startsWith("/shared/")?n=n.replace(/\/\S*\/upload\//g,"/${=sys.user}/upload/"):n.startsWith("/shared/")||(n=n.replace(/\/\$\{\=sys\.user\}\/upload\//g,"/"+t.VA.Env.Session.userId+"/upload/")),this.fileName.setValue(n),this.fileName.markText({line:0,ch:0},{line:0,ch:n.length+1},{readOnly:!0,inclusiveLeft:!0,css:"color: #b4b4b4"});}},e.prototype.handleOkClicked=function(){var e=this.fileName.getValue().trim();e?this._isAvailablePath(e)?(this.dialogResult.selectedFile=e,t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)):t.VA.Core.Utils.WidgetUtils.openErrorDialog("Invalid path selected. It should start with '/shared/upload/' or '/{USER_ID}/upload/'."):t.VA.Core.Utils.WidgetUtils.openErrorDialog("At least one file must be selected.");},e.prototype.createDialogButtonBar=function(e){!1!==this.dialogOptions.useButton&&t.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,e);},e.prototype._isAvailablePath=function(t){for(var e=t.match(/^\/shared\/upload\/[^\/]+$/),i=t.match(/[^\/]+\/upload\/[^\/]*/),o=t.match(/^\/\$\{\=sys\.user\}\/[^\/]+$/),n="",r=0,a=0;atrue
    '),this.$falseControl=$('
    false
    '),this.$infoArea.addClass("rscript"),this.$infoArea.append('
    '),this.$columns=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-columnlist"),this.$inputDataframes=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-inputdataframe"),this.$partitionby=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-partitionbylist"),this.$outputDataframes=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-outputdataframelist"),this.$stringasfactors=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-stringasfactors"),this.$scripterrorcol=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-scripterrorcol"),this.$flattenerrorcol=this.$infoArea.find(".brtc-va-dialogs-controls-propertycontrol-flattenerrorcol"),this.addPropertyControl("Columns",function(t){t.append(this.$columns);var e={multiple:!0,maxRowCount:3,sort:"none",showOpener:"button",changed:function changed(t,e){i.selectedColumns=e.items,i.renderValidation();}};i.columnsControl=i.createColumnList(i.$columns,e);},{mandatory:!0}),this.addPropertyControl("Input Dataframe",function(t){t.append(i.$inputDataframes);i.createInput(i.$inputDataframes,{placeHolder:"Input Dataframe"},"brtc-va-editors-sheet-controls-width-12"),i.$inputDataframes.on("change",function(t){i.inputDataframe=$(this).val(),i.renderValidation();});},{mandatory:!0}),this.addPropertyControl("Partition by",function(t){t.append(this.$partitionby);var e={multiple:!0,maxRowCount:3,sort:"none",showOpener:"button",changed:function changed(t,e){i.selectedGroupby=e.items,i.renderValidation();}};i.groupbyControl=i.createColumnList(i.$partitionby,e);},{mandatory:!1}),this.addPropertyControl("Output Dataframe",function(t){t.append(this.$outputDataframes),i.outputDataframe=i.createOutputDataframeList(i.$outputDataframes);},{mandatory:!0}),this.addPropertyControl("Strings As Factors",function(t){this.$stringasfactors.append(this.$trueControl).append(this.$falseControl),t.append(this.$stringasfactors),i.createRadioButton(i.$trueControl,{width:"80",groupName:"Group"}),i.createRadioButton(i.$falseControl,{width:"80",groupName:"Group"}),i.$trueControl.on("checked",function(){i.selectedFactors="true";}),i.$falseControl.on("checked",function(){i.selectedFactors="false";});},{mandatory:!1}),this.addPropertyControl("Script Error Column",function(t){t.append(i.$scripterrorcol);i.createInput(i.$scripterrorcol,{placeHolder:"Script Error Column"},"brtc-va-editors-sheet-controls-width-12"),i.$scripterrorcol.on("change",function(t){i.scriptErrorCol=$(this).val();});},{mandatory:!1}),this.addPropertyControl("Flatten Error Column",function(t){t.append(i.$flattenerrorcol);i.createInput(i.$flattenerrorcol,{placeHolder:"Flatten Error Column"},"brtc-va-editors-sheet-controls-width-12"),i.$flattenerrorcol.on("change",function(t){i.flattenErrorCol=$(this).val();});},{mandatory:!1}),this.fillControlValues(),this.renderValues();},i.prototype.createOutputDataframeList=function(t){var e=this.options.fnUnit.param["output-dataframe"];if(void 0===e)this.createOutputControlLayout(0,!0,t);else if(0===e.length)this.createOutputControlLayout(0,!0,t);else for(var i=0;i
    '),l=n.find(".brtc-va-rcontents-input-container");0!==l.length&&l[t]?($(l[t]).after(s),a=!0):n.append(s);var c,d,p=$('
    ');s.append(p),e&&(c=$('
    '),s.append(c),c.click(function(t){r.handleAddInputControlEvent($(this).closest(".brtc-va-rcontents-input-container"),n),r.$infoArea.perfectScrollbar("update");})),(t>0||a)&&(d=$('
    '),s.append(d),d.click(function(t){r.handleDeleteButtonClick($(this).closest(".brtc-va-rcontents-input-container")),r.$infoArea.perfectScrollbar("update");})),this.createInputControl(p,o);},i.prototype.handleAddInputControlEvent=function(t,e,i){var o=t.index();this.createOutputControlLayout(o,!0,e,i),this.getInputValue(),this.renderValidation();},i.prototype.handleDeleteButtonClick=function(t){t.remove(),this.getInputValue(),this.renderValidation();},i.prototype.createInputControl=function(t,i){var o,n=this;o=$(''),t.append(o);var r={theme:e.VA.Env.Theme,height:"25px",width:"100%"};o.jqxInput(r),i||o.jqxInput("focus"),o.keydown(function(t){13==t.keyCode&&(n.handleAddInputControlEvent(o.closest(".brtc-va-rcontents-input-container"),!0),n.getInputValue(),n.renderValidation());}),o.focusout(function(t){n.getInputValue(),n.renderValidation();});},i.prototype.createInput=function(i,o,n,r){this.wrapControl(i);var a="";n&&(a=a.concat(" ",n)),i.attr("type")||i.attr("type","text"),i.attr("maxlength")||i.attr("maxlength","100"),this.addClassToWrapper(i,a),this.addCssToWrapper(i,r);var s={theme:e.VA.Env.Theme,height:"25px",placeHolder:"Enter value"};o&&$.extend(s,o),i.jqxInput(s);var l=i.val();i.focus(function(){l=i.val();}),$("svg").on("mousedown",function(){i.val()!==l&&i.is(":focus")&&i.trigger("change");});var c=this;return i.on("keydown",function(t){clearTimeout(c.keydownTimeout),c.keydownTimeout=setTimeout(function(){i.is(":focus")&&(i.blur(),i.focus());},1e3);}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(i),i;},i.prototype.getInputValue=function(){var t,e=this.$outputDataframes.find(".brtc-va-widget-contents-input-control");t=[];for(var i=0;i '+e+"
    ");t.append(n),t.addClass("brtc-va-editor-sheet-panels-validation-error"),i&&n.css("clear","both");var r=t.find(".brtc-va-editors-sheet-controls-columnselector");r.is("div")&&r.data().renderMissingColumns(),n.show();},i.prototype.addPropertyControl=function(t,i,o){var n=this,r=$('
    ');return o?(o.mandatory&&(t="
    "+t+'
    *
    '),n.$infoArea.append(r)):n.$infoArea.append(r),r.jqxExpander({theme:e.VA.Env.Theme,arrowPosition:"left",initContent:function initContent(){"function"==typeof i&&i.call(n,r.find(".brtc-va-editors-sheet-controls-propertycontrol-contents"),o);}}),r.jqxExpander("setHeaderContent",t),r;},i.prototype.createColumnList=function(t,i,o,n){this.wrapControl(t);var r="";o&&(r=r.concat(" ",o)),this.addClassToWrapper(t,r),this.addCssToWrapper(t,n);var a={openerPosition:"bottom",multiple:!0,rowCount:1,maxRowCount:5,expand:!1,sort:"none",sortBy:"name",showOpener:"button",removable:!0,defaultType:"-",changed:function changed(t,e){},added:function added(){},removed:function removed(){}};i&&$.extend(a,i);var s=new e.VA.Core.Editors.Sheet.Controls.ColumnList(t,a);return s.columnSelector.$mainControl.attr("isDialog",!0),s;},i.prototype.wrapControl=function(t){var e=$('
    ');t.wrap(e);},i.prototype.addClassToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.addClass(e);}},i.prototype.addCssToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-editors-sheet-controls-wrapper");i&&i.css(e);}},i.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,queryStatement:this.codeMirror.getValue(),columns:this.selectedColumns,partitionBy:this.selectedGroupby,factors:this.selectedFactors,inputDataframe:this.inputDataframe,outputDataframe:this.outputDataframe,scriptErrorCol:this.scriptErrorCol,flattenErrorCol:this.flattenErrorCol},this.$mainControl.dialog("close");},i.prototype.getTitle=function(){return"R";},e.VA.Core.Dialogs.RScriptEditorDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.analyticsModel=this.options.analyticsModel,this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}});},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this));},e.prototype.createDialogContentsArea=function(e){var i,o=this.analyticsModel.variables||[];this.variableControlList=[];for(var n=0;n
    '),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}});},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this));},e.prototype.createDialogContentsArea=function(e){var i,o=this.analyticsModel.variables||{};this.variableControlList=[];for(var n=Object.keys(o),r=0;r
    '),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-dialogs-contents"),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok");var e=this;this.$mainControl.dialog({theme:t.VA.Env.Theme,title:"Variables",width:450,height:630,modal:!0,resizable:!1,draggable:!0,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}});},e.prototype.initContents=function(){this.$mainControl.find(".brtc-va-dialogs-contents").addClass("scrollable"),this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!1}),this.$okButton.click(this.handleOkClicked.bind(this));},e.prototype.createDialogContentsArea=function(e){var i,o=this.analyticsModel["gv-def"]||{};this.variableControlList=[],this.duration={};var n={Duration:{type:"literal",value:"5","variable-type":"string"}},r={button:{visible:!1},variable:n};this.duration=t.VA.Core.Widget.Factory.variableControl(e,r);for(var a=0;a
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutTable(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.createInModelAlias=function(e){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInModel(this.options.fnUnit),r=[];for(var a in n){r.push(o.getFnUnitByOutData(n[a]));}for(var a in r){var s=r[a],l="models("+a+")",c=$('
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutModel(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.createInImageAlias=function(e){var i=this,o=this.options.fnUnit.parent(),n=this.FnUnitUtils.getInImage(this.options.fnUnit),r=[];for(var a in n){r.push(o.getFnUnitByOutData(n[a]));}for(var a in r){var s=r[a],l="images("+a+")",c=$('
    '+l+"
    "),d=s.parent().type,p=$('
    '),u=t.VA.Core.Utils.WidgetUtils.createPaletteItem(p,s.func,d);u.find(".brtc-va-views-palette-fnunit-label").text(s.display.label).attr("variable",l),p.attr("value",this.FnUnitUtils.getOutImage(s)[0]),u.addClass("item"),c.append(p),e.append(c),c.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable"),e=i.codeMirror.getDoc(),o=i.codeMirror.getCursor();e.replaceRange(t,o);});}},e.prototype.renderEditorArea=function(){this.sendFnunit=$.extend(!0,{},this.options.fnUnit),this.codeMirror=CodeMirror.fromTextArea(this.$editorArea.find("textarea")[0],{mode:"text/x-scala",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!0,matchBrackets:!0,autofocus:!1,extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:this.scriptEditorOptions.additionalHint}}),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror),t.VA.Core.Utils.WidgetUtils.setCodeMirrorMaxLength(this.codeMirror),this.setEditorStatement(this.options.statement),this.codeMirror.setSize("100%","100%"),this.codeMirror.setOption("maxLength",this.scriptEditorOptions.maxLength);},e.prototype.renderInputs=function(t){this.$inputs=$('
    '),t.append(this.$inputs),this.renderInTableAlias(this.$inputs),this.renderInModelAlias(this.$inputs);},e.prototype.renderInTableAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Table Variable"});this.createInTableAlias(i),i.perfectScrollbar();},e.prototype.renderInModelAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Model Variable"});this.createInModelAlias(i),i.perfectScrollbar();},e.prototype.renderInImageAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl(e,{label:"In Image Variable"});this.createInImageAlias(i),i.perfectScrollbar();},e.prototype.renderOutputs=function(e){var i=this,o=$('
    ');e.append(o),this.$outputsBody=this.addPropertyControl(o,{label:"Outputs"}),this.$outputsBody.perfectScrollbar(),this.$addButton=$(''),o.find(".brtc-va-dialogs-scalaeditor-alias-header").after(this.$addButton),this.$addButton.jqxButton({theme:t.VA.Env.Theme,width:"100%",height:32}),this.$addButton.click(function(){i.createOutTableAlias(i.$outputsBody,!1),i.$outputsBody.perfectScrollbar("update");}),this.createOutput(i.$outputsBody);},e.prototype.createOutput=function(t){var e=this,i=this.FnUnitUtils.getOutputs(this.options.fnUnit);_.forEach(i,function(i,o){var n=e.createOutTableAlias(t,!1,i),r=e.FnUnitUtils.getTypeByTableId(e.options.fnUnit,i);n.find(".alias input").val(o),n.find(".type .brtc-va-dialogs-scalaeditor-alias-body-outtable-type").val(r);}),t.perfectScrollbar();},e.prototype.createOutTableAlias=function(t,e,i){var o=$('
    ');return t.append(o),this.createInput(o.find(".brtc-va-dialogs-contents-statement-lastline-element-script"),"",e,i),this.createDropDownList(o.find(".brtc-va-dialogs-contents-statement-lastline-element-script-type"),"",e,i),o;},e.prototype.createDropDownList=function(e,i,o,n){var r=$('
    ');e.append(r);var a={theme:t.VA.Env.Theme,width:"100%",height:"20px",source:[{text:"TABLE",value:"table"},{text:"MODEL",value:"model"}],displayMember:"text",selectedIndex:0,valueMember:"value",dropDownHeight:50};r.jqxDropDownList(a);},e.prototype.createInput=function(t,e,i,o){var n=this,r=$('
    '),a=r.find("input");t.append(r),a.jqxInput({placeHolder:"Enter alias",height:32,width:"108px",theme:"office"}),a.jqxInput("val",e),""!==a.val()&&null!=a.val()||a.css("border-color","red"),a.focus(),a.on("change",function(){""==$(this).val()?$(this).css("border-color","red"):$(this).css("border-color","#d4d4d4");}),a.keydown(function(t){13==t.keyCode&&n.createOutTableAlias(n.$outputsBody,!1);}),1==i&&""==e&&a.css("border-color","red");var s=r.find(".brtc-va-dialogs-scalaeditor-alias-body-outtable-remove");return s.attr({isMandatory:i}),s.click(function(){var t=$(this).closest(".brtc-va-dialogs-contents-statement-lastline-element-wrapper");t.find(".brtc-va-dialogs-scalaeditor-alias-body-outtable").attr("tableId")&&n.removeSendFnunit(t.attr("tableId")),t.remove(),n.$outputsBody.perfectScrollbar("update");}),a;},e.prototype.removeSendFnunit=function(t){},e.prototype.addPropertyControl=function(t,e){var i=e.label;e.mandatory&&(i='
    '+i+'
    *
    ');var o=$('
    '+i+"
    "),n=$('
    ');return n.css("height","460px"),t.append(o).append(n),n;},e.prototype.getTitle=function(){return"Scala";},e.prototype.handleOkClicked=function(){if(this.options.scriptOnly||!1===this.options.scriptOnly)this.dialogResult={OK:!0,Cancel:!1,queryStatement:this.codeMirror.getValue()};else{var e=this.$outputsBody.find(".brtc-va-dialogs-contents-statement-lastline-element-wrapper");this.sendFnunit.outputs={},this.sendFnunit.meta={inputs:{type:"table",range:{min:1,max:10}},models:{type:"model",range:{min:1,max:10}}};for(var i=0;i',' ',' ',"
    ",'
    ',"
    "].join("\n");e.append(i),this.$addButton=e.find(".brtc-va-dialogs-schedule-management-add"),this.$deleteButton=e.find(".brtc-va-dialogs-schedule-management-delete"),this.$contentBody=e.find(".brtc-va-dialogs-schedule-management-body");var o=new t.VA.EventEmitter();o.on("row-click",function(t){this.openDetailScheduleDialog(t);}.bind(this)),o.on("row-select",function(t){this._refreshButtonStatus("row-select",t);}.bind(this)),o.on("row-unselect",function(t){this._refreshButtonStatus("row-unselect",t);}.bind(this)),this.scheduleListComponent=new t.VA.Core.Components.ScheduleList({$el:this.$contentBody,emitter:o}),this.createDeleteButton(this.$deleteButton),this.createAddButton(this.$addButton),this._refreshScheduleList();},o.prototype.createDialogButtonBar=function(e){t.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,e),this.$okButton.val("Close"),this.$cancelButton.css({display:"none"});},o.prototype.createAddButton=function(e){e.jqxButton({theme:t.VA.Env.Theme}),e.click(_.debounce(this.openAddScheduleDialog.bind(this)));},o.prototype.openAddScheduleDialog=function(){var e=function(t){t.OK&&this._refreshScheduleList();}.bind(this);new t.VA.Core.Dialogs.AddScheduleDialog(this.$mainControl,{editorInput:this.options.editorInput,close:e,title:"Add Schedule"});},o.prototype.createDeleteButton=function(e){e.jqxButton({theme:t.VA.Env.Theme,disabled:!0}),e.click(_.debounce(this.openDeleteScheduleDialog.bind(this)));},o.prototype.openDeleteScheduleDialog=function(e){var i=function(t){if(t.OK){var e=this.scheduleListComponent.getControl().getSelectedRows(),i=0,o=this;for(var n in e){$.ajax({url:"api/admin/v2/schedules/"+e[n].scheduleId+"/delete",type:"POST",data:JSON.stringify(e[n]),blocking:!0,contentType:"application/json; charset=utf-8"}).done(function(t){t.success&&i++,i===e.length&&o._refreshScheduleList();}).fail(function(t){o._onError(t);});}}}.bind(this);t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Selected item(s) will be permanently deleted and cannot be recovered. Are you sure?",i);},o.prototype.openDetailScheduleDialog=function(e){var i=function(t){t.OK&&this._refreshScheduleList();}.bind(this);new t.VA.Core.Dialogs.DetailScheduleDialog(this.$mainControl,{editorInput:this.options.editorInput,schedule:e,close:i,title:"Schedule Detail"});},o.prototype._refreshScheduleList=function(){var t,e,i;(t={url:"api/admin/v2/schedules",type:"GET",contentType:"application/json; charset=utf-8",blocking:!0},new Promise(function(o,n){$.ajax(t).done(function(t){e&&"function"==typeof e&&e(t),o(t);}).fail(function(t){i&&"function"==typeof i&&i(t),n(t);});})).then(function(t){var e=_.filter(t,function(t){return JSON.parse(t.executeContents).main===this.options.editorInput.getFileId();}.bind(this));e=_.map(e,function(t){var e,i,o=JSON.parse(t.executeContents);for(var n in o.models){e=o.models[n].versionId,i=o.models[n].mid;}return t.versionId=e,t.mid=i,t;}),this.scheduleListComponent.update(e);}.bind(this)).catch(this._onError.bind(this));},o.prototype._refreshButtonStatus=function(t,e){var i=this.scheduleListComponent.getControl().getSelectedRows();this.$deleteButton.jqxButton({disabled:i.length<=0});},o.prototype._onError=function(t){e.WidgetUtils.openBadRequestErrorDialog(t);},o.prototype.destroy=function(){this.scheduleListComponent.destroy(),i.destroy.call(this);},t.VA.Core.Dialogs.ScheduleManagementDialog=o;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=420,this.dialogOptions.height=200;},e.prototype.createDialogContentsArea=function(t){t.append('

    Please be cautious with using scripts because they can cause serious problems to your system.

    '),$(".ui-dialog-titlebar.ui-widget-header").attr("style","border-bottom: none !important;");},e.prototype.getPosition=function(t){},e.prototype.createDialogButtonBar=function(e){var i=$("
    Do not ask me again");e.append(i),i.jqxCheckBox({theme:"office",width:200,height:25,checked:!1,boxSize:"17px",animationShowDelay:0,animationHideDelay:0}),i.on("click",function(){localStorage.setItem("info.script.show",!$(this).val());}),i.css("float","left"),this.$okButton=$(''),e.append(this.$okButton),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.handleOkClicked.bind(this));},t.VA.Core.Dialogs.ScriptInfoDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel");var e=this,i={theme:t.VA.Env.Theme,title:"Select User",width:600,height:470,modal:!0,resizable:!1,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}};this.$mainControl.dialog(i);},e.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme,disabled:!0}),this.$okButton.click(this.sendModelInformation.bind(this));},e.prototype.createDialogContentsArea=function(e){var i=this;e.append('
    Name
    User
    '),e.find(".brtc-va-dialogs-selectuser-name-input").jqxInput({placeHolder:"Search User",theme:t.VA.Env.Theme,height:"23px",width:"250px"}),e.find(".brtc-va-dialogs-selectuser-result-list").perfectScrollbar(),e.find(".brtc-va-dialogs-selectuser-name-input").focus(),e.find(".brtc-va-dialogs-selectuser-name-input").keyup(function(t){var e=t.target.value||"";e.trim(),13===t.keyCode&&""!==e&&i.searchUserByName(e);});},e.prototype.searchUserByName=function(t){var e=this;$.ajax({method:"get",url:"api/admin/v2/users?pattern="+encodeURIComponent(t)+"&name=true",blocking:!0}).done(function(t){e.reset(),e.fillUserList(t);}).fail(function(t){});},e.prototype.reset=function(){this.$mainControl.find(".brtc-va-dialogs-selectuser-result-list").empty(),this.selectedUserId="",this.$okButton.jqxButton({disabled:!0});},e.prototype.createUserListHeader=function(){this.$mainControl.find(".brtc-va-dialogs-selectuser-result-list").append('
    name id email
    ');},e.prototype.fillUserList=function(t){var e,i,o=this.$mainControl.find(".brtc-va-dialogs-selectuser-result-list");if(0===t.length)o.text("Your search did not match any person.");else{this.createUserListHeader(),i=o.find("table");for(var n=0;n '+e.name+" "+e.id+" "+e.email+" "));}this.createUserSelectEvent(i);}},e.prototype.createUserSelectEvent=function(t){for(var e,i=t.find(".brtc-va-dialogs-selectuser-table-tr"),o=this,n=0;n','
    ',"
    ","
    "].join("\n");this.$self=$(i),e.append(this.$self),this.$detailBody=this.$self.find(".brtc-va-dialogs-select-version-detail"),this.modelVersionDetail=new t.VA.Core.Components.ModelVersionDetail({$el:this.$detailBody}),this._refreshDetail();},i.prototype.createDialogButtonBar=function(t){e.createDialogButtonBar.call(this,t),this.$okButton.val("Close"),this.$cancelButton.css({display:"none"});},i.prototype.handleOkClicked=function(){e.handleOkClicked.call(this);},i.prototype._refreshDetail=function(){var e=function(t){this.data=t,this.modelVersionDetail.update(t);}.bind(this);Studio.getResourceManager().fetchVersion(this.options.projectId,this.options.fileId,this.options.versionId).then(e).catch(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),this.$mainControl.dialog("close");}.bind(this));},t.VA.Core.Dialogs.SelectVersionDetailDialog=i;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Dialogs.Dialog.prototype;function i(t,i){e.constructor.call(this,t,i),this.onSelect=i.onSelect,this.emitter=i.emitter;}i.prototype=Object.create(e),i.prototype.constructor=i,i.prototype._initOptions=function(){e._initOptions.call(this),this.dialogOptions.title="Version List",this.dialogOptions.width=1e3,this.dialogOptions.height="auto",this.dialogOptions.maxHeight="auto";},i.prototype.createDialogContentsArea=function(i){var o=['
    ','
    ',"
    ","
    "].join("\n");this.$self=$(o),i.append(this.$self),this.$contentBody=i.find(".brtc-va-dialogs-select-version-list-body");var n=new t.VA.EventEmitter();n.on("select",function(t){this.dialogResult.data=t,e.handleOkClicked.call(this);}.bind(this)),this.modelVersionListComponent=new t.VA.Core.Components.ModelVersionListSelectable({$el:this.$contentBody,emitter:n,projectId:this.options.projectId,fileId:this.options.fileId});},i.prototype.createDialogButtonBar=function(t){e.createDialogButtonBar.call(this,t),this.$okButton.val("Close"),this.$cancelButton.css({display:"none"});},t.VA.Core.Dialogs.SelectVersionDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel");var e=this,i={theme:t.VA.Env.Theme,title:"Set Properties",width:1024,height:600,maxWidth:1024,maxHeight:600,modal:!0,resizable:!1,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}};this.$mainControl.dialog(i);},e.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this.$okButton.jqxButton({theme:t.VA.Env.Theme}),this.$okButton.click(this.performFinish.bind(this)),this.$cancelButton.jqxButton({theme:t.VA.Env.Theme});},e.prototype.createDialogContentsArea=function(e){var i=this;this.$columnGrid=$('
    '),e.append(this.$columnGrid);var o=function o(t,e,_o8,n){var r=!1,a=i.$columnGrid.jqxGrid("getselectedrowindexes");if(a.length>0&&"column"!=e)for(var s in a){t==a[s]&&(r=!0);}return r;};this.$columnGrid.jqxGrid({theme:t.VA.Env.Theme,width:"calc(100% - 2px)",height:"99%",rowsheight:25,filterable:!1,showfiltercolumnbackground:!1,showfiltermenuitems:!0,autoshowfiltericon:!0,altrows:!1,sortable:!0,editable:!0,showsortcolumnbackground:!1,columnsresize:!0,selectionmode:"checkbox",columns:[{text:"Column",datafield:"column",width:"80",cellbeginedit:o},{text:"analyzer",datafield:"analyzer",width:"80",cellbeginedit:o,columntype:"textbox"},{text:"boost",datafield:"boost",width:"80",cellbeginedit:o,columntype:"numberinput",cellsalign:"right",initeditor:function initeditor(t,e,i){i.jqxNumberInput({decimalDigits:0});}},{text:"coerce",datafield:"coerce",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"copyto",datafield:"copyto",width:"80",cellbeginedit:o},{text:"docvalues",datafield:"docvalues",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"dynamic",datafield:"dynamic",width:"80",columntype:"dropdownlist",cellbeginedit:o,initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"enabled",datafield:"enabled",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"fielddata",datafield:"fielddata",width:"80",cellbeginedit:o},{text:"format",datafield:"format",width:"80",cellbeginedit:o},{text:"geohash",datafield:"geohash",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"geohashPrefix",datafield:"geohashprefix",width:"100",columntype:"dropdownlist",cellbeginedit:o,initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"geohashPrecision",datafield:"geohashprecision",width:"100",cellbeginedit:o,columntype:"numberinput",cellsalign:"right",initeditor:function initeditor(t,e,i){i.jqxNumberInput({decimalDigits:0});}},{text:"ignoreAbove",datafield:"ignoreabove",width:"80",cellbeginedit:o,columntype:"numberinput",cellsalign:"right",initeditor:function initeditor(t,e,i){i.jqxNumberInput({decimalDigits:0});}},{ext:"ignoreMalformed",datafield:"ignoremalformed",width:"100",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"includeInAll",datafield:"includeinall",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"index",datafield:"index",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","no","not_analyzed","analyzed"]});}},{text:"indexOptions",datafield:"indexoptions",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","docs","freqs","positions","offsets"]});}},{text:"latLon",datafield:"latlon",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"fields",datafield:"fields",width:"80",cellbeginedit:o},{text:"normsEnabled",datafield:"normsenabled",width:"100",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"normsLoading",datafield:"normsloading",width:"100"},{text:"nullValue",datafield:"nullvalue",width:"80",cellbeginedit:o},{text:"positionIncrementGap",datafield:"positionincrementgap",width:"130",cellbeginedit:o,columntype:"numberinput",cellsalign:"right",initeditor:function initeditor(t,e,i){i.jqxNumberInput({decimalDigits:0});}},{text:"properties",datafield:"properties",width:"80",cellbeginedit:o},{text:"searchanalyzer",datafield:"searchanalyzer",width:"100",cellbeginedit:o},{text:"similarity",datafield:"similarity",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","TF","IDF","BM25"]});}},{text:"store",datafield:"store",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","True","False"]});}},{text:"termvector",datafield:"termvector",width:"80",cellbeginedit:o,columntype:"dropdownlist",initeditor:function initeditor(t,e,i,o,n,r){i.jqxDropDownList({source:["","no","yes","with_positions","with_offsets","with_positions_offsets"]});}}]});var n=[];for(var r in this.options.columns){var a={};for(var s in a.column=this.options.columns[r].name,this.options.fnUnit.param["properties-colums"]){this.options.columns[r].name==this.options.fnUnit.param["properties-colums"][s]&&(a.analyzer=this.options.fnUnit.param["properties-analyzer"][s],a.boost=this.options.fnUnit.param["properties-boost"][s],a.coerce=this.options.fnUnit.param["properties-coerce"][s],a.copyto=this.options.fnUnit.param["properties-copy-to"][s],a.docvalues=this.options.fnUnit.param["properties-doc-values"][s],a.dynamic=this.options.fnUnit.param["properties-dynamic"][s],a.enabled=this.options.fnUnit.param["properties-enabled"][s],a.fielddata=this.options.fnUnit.param["properties-fielddata"][s],a.format=this.options.fnUnit.param["properties-format"][s],a.geohash=this.options.fnUnit.param["properties-geohash"][s],a.geohashprefix=this.options.fnUnit.param["properties-geohash-prefix"][s],a.geohashprecision=this.options.fnUnit.param["properties-geohash-precision"][s],a.ignoreabove=this.options.fnUnit.param["properties-ignore-above"][s],a.ignoremalformed=this.options.fnUnit.param["properties-ignore-malformed"][s],a.includeinall=this.options.fnUnit.param["properties-include-in-all"][s],a.index=this.options.fnUnit.param["properties-index"][s],a.indexoptions=this.options.fnUnit.param["properties-index-options"][s],a.latlon=this.options.fnUnit.param["properties-lat-lon"][s],a.fields=this.options.fnUnit.param["properties-fields"][s],a.normsenabled=this.options.fnUnit.param["properties-norms-enabled"][s],a.normsloading=this.options.fnUnit.param["properties-norms-loading"][s],a.nullvalue=this.options.fnUnit.param["properties-null-value"][s],a.positionincrementgap=this.options.fnUnit.param["properties-position-increment-gap"][s],a.properties=this.options.fnUnit.param["properties-properties"][s],a.searchanalyzer=this.options.fnUnit.param["properties-search-analyzer"][s],a.similarity=this.options.fnUnit.param["properties-similarity"][s],a.store=this.options.fnUnit.param["properties-store"][s],a.termvector=this.options.fnUnit.param["properties-term-vector"][s],i.$columnGrid.jqxGrid("selectrow",parseInt(r)));}n.push(a);}var l={localdata:n,datafields:[{name:"column",type:"string"},{name:"analyzer",type:"string"},{name:"boost",type:"string"},{name:"coerce",type:"string"},{name:"copyto",type:"string"},{name:"docvalues",type:"string"},{name:"dynamic",type:"string"},{name:"enabled",type:"string"},{name:"fielddata",type:"string"},{name:"format",type:"string"},{name:"geohash",type:"string"},{name:"geohashprefix",type:"string"},{name:"geohashprecision",type:"string"},{name:"ignoreabove",type:"string"},{name:"ignoreMalformed",type:"string"},{name:"includeinall",type:"string"},{name:"index",type:"string"},{name:"indexoptions",type:"string"},{name:"latlon",type:"string"},{name:"fields",type:"string"},{name:"normsenabled",type:"string"},{name:"normsloading",type:"string"},{name:"nullvalue",type:"string"},{name:"positionincrementgap",type:"string"},{name:"properties",type:"string"},{name:"searchanalyzer",type:"string"},{name:"similarity",type:"string"},{name:"store",type:"string"}],datatype:"array"},c=new $.jqx.dataAdapter(l);i.$columnGrid.jqxGrid("source",c);},e.prototype.performFinish=function(){var e={fnUnit:this.options.fnUnit,ref:{param:{}}},i=this.$columnGrid.jqxGrid("getselectedrowindexes");for(var o in e.ref.param["properties-colums"]=[],e.ref.param["properties-analyzer"]=[],e.ref.param["properties-boost"]=[],e.ref.param["properties-coerce"]=[],e.ref.param["properties-copy-to"]=[],e.ref.param["properties-doc-values"]=[],e.ref.param["properties-dynamic"]=[],e.ref.param["properties-enabled"]=[],e.ref.param["properties-fielddata"]=[],e.ref.param["properties-format"]=[],e.ref.param["properties-geohash"]=[],e.ref.param["properties-geohash-prefix"]=[],e.ref.param["properties-geohash-precision"]=[],e.ref.param["properties-ignore-above"]=[],e.ref.param["properties-ignore-malformed"]=[],e.ref.param["properties-include-in-all"]=[],e.ref.param["properties-index"]=[],e.ref.param["properties-index-options"]=[],e.ref.param["properties-lat-lon"]=[],e.ref.param["properties-fields"]=[],e.ref.param["properties-norms-enabled"]=[],e.ref.param["properties-norms-loading"]=[],e.ref.param["properties-null-value"]=[],e.ref.param["properties-position-increment-gap"]=[],e.ref.param["properties-properties"]=[],e.ref.param["properties-search-analyzer"]=[],e.ref.param["properties-similarity"]=[],e.ref.param["properties-store"]=[],e.ref.param["properties-term-vector"]=[],i){var n=this.$columnGrid.jqxGrid("getrowdata",i[o]);e.ref.param["properties-colums"].push(n.column),n.analyzer?e.ref.param["properties-analyzer"].push(n.analyzer):e.ref.param["properties-analyzer"].push(""),n.boost?e.ref.param["properties-boost"].push(n.boost):e.ref.param["properties-boost"].push(""),n.coerce?e.ref.param["properties-coerce"].push(n.coerce):e.ref.param["properties-coerce"].push(""),n.copyto?e.ref.param["properties-copy-to"].push(n.copyto):e.ref.param["properties-copy-to"].push(""),n.docvalues?e.ref.param["properties-doc-values"].push(n.docvalues):e.ref.param["properties-doc-values"].push(""),n.dynamic?e.ref.param["properties-dynamic"].push(n.dynamic):e.ref.param["properties-dynamic"].push(""),n.enabled?e.ref.param["properties-enabled"].push(n.enabled):e.ref.param["properties-enabled"].push(""),n.fielddata?e.ref.param["properties-fielddata"].push(n.fielddata):e.ref.param["properties-fielddata"].push(""),n.format?e.ref.param["properties-format"].push(n.format):e.ref.param["properties-format"].push(""),n.geohash?e.ref.param["properties-geohash"].push(n.geohash):e.ref.param["properties-geohash"].push(""),n.geohashprefix?e.ref.param["properties-geohash-prefix"].push(n.geohashprefix):e.ref.param["properties-geohash-prefix"].push(""),n.geohashprecision?e.ref.param["properties-geohash-precision"].push(n.geohashprecision):e.ref.param["properties-geohash-precision"].push(""),n.ignoreabove?e.ref.param["properties-ignore-above"].push(n.ignoreabove):e.ref.param["properties-ignore-above"].push(""),n.ignoremalformed?e.ref.param["properties-ignore-malformed"].push(n.ignoremalformed):e.ref.param["properties-ignore-malformed"].push(""),n.includeinall?e.ref.param["properties-include-in-all"].push(n.includeinall):e.ref.param["properties-include-in-all"].push(""),n.index?e.ref.param["properties-index"].push(n.index):e.ref.param["properties-index"].push(""),n.indexoptions?e.ref.param["properties-index-options"].push(n.indexoptions):e.ref.param["properties-index-options"].push(""),n.latlon?e.ref.param["properties-lat-lon"].push(n.latlon):e.ref.param["properties-lat-lon"].push(""),n.fields?e.ref.param["properties-fields"].push(n.fields):e.ref.param["properties-fields"].push(""),n.normsenabled?e.ref.param["properties-norms-enabled"].push(n.normsenabled):e.ref.param["properties-norms-enabled"].push(""),n.normsloading?e.ref.param["properties-norms-loading"].push(n.normsloading):e.ref.param["properties-norms-loading"].push(""),n.nullvalue?e.ref.param["properties-null-value"].push(n.nullvalue):e.ref.param["properties-null-value"].push(""),n.positionincrementgap?e.ref.param["properties-position-increment-gap"].push(n.positionincrementgap):e.ref.param["properties-position-increment-gap"].push(""),n.properties?e.ref.param["properties-properties"].push(n.properties):e.ref.param["properties-properties"].push(""),n.searchanalyzer?e.ref.param["properties-search-analyzer"].push(n.searchanalyzer):e.ref.param["properties-search-analyzer"].push(""),n.similarity?e.ref.param["properties-similarity"].push(n.similarity):e.ref.param["properties-similarity"].push(""),n.store?e.ref.param["properties-store"].push(n.store):e.ref.param["properties-store"].push(""),n.termvector?e.ref.param["properties-term-vector"].push(n.termvector):e.ref.param["properties-term-vector"].push("");}var r=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,e);this.dialogResult={OK:!0,Cancel:!1,command:r},this.$mainControl.dialog("close");},t.VA.Core.Dialogs.SetPropertiesDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=(t.VA.Core.Utils,{MSG_PANEL_EMPTY:"Select configuration element in the tree to edit its settings",MSG_MENU_EMPTY:"Nothing to show"});var i=Object.keys(t.VA.Setting.Registry);function o(e,i){t.VA.SettingStorage.TEMP={},this.settingPanelList=[],t.VA.Dialogs.Dialog.call(this,e,i);}o.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),o.prototype.constructor=o,o.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=780,this.dialogOptions.height=500;},o.prototype.createDialogContentsArea=function(t){t.addClass("setting");var e=$('
    ');t.append(e),this.createSplitter(t),this.createMenuArea(t.find(".brtc-va-dialogs-menu")),this.createContentArea(t.find(".brtc-va-dialogs-content"));},o.prototype.createSplitter=function(t){t.jqxSplitter({width:null,height:null,resizable:!1,splitBarSize:3,panels:[{size:200,min:200},{min:300}]});},o.prototype.createMenuArea=function(t){var e=$('
    ');t.append(e),this.createFilterControl(t.find(".brtc-va-dialogs-menu-filter")),this.createTreeControl(t.find(".brtc-va-dialogs-menu-tree"));},o.prototype.createTreeControl=function(i){var o=this._generateJSONObject();o&&o.length>0?(o[0].selected=!0,i.removeClass("brtc-va-dialogs-center"),this.settingMenu=i.jqxTree({theme:t.VA.Env.Theme,width:200,source:o})):(this.settingMenu=null,i.addClass("brtc-va-dialogs-center"),i.jqxTree({theme:t.VA.Env.Theme,source:[{label:e.MSG_MENU_EMPTY,disabled:!0}]}));},o.prototype.createFilterControl=function(e){var i=this,o=$('');e.append(o),o.jqxInput({height:29,theme:t.VA.Env.Theme,placeHolder:"Search Item"});var n=function n(t){var e=t.target.value.toLowerCase();i.filterArray=i.getMatchedList(e.trim()),i.filterSelectItem=!0,i.createTreeControl(i.$mainControl.find(".brtc-va-dialogs-menu-tree")),i.settingMenu&&i.settingMenu.jqxTree("selectItem",null),i.createContentArea(i.$mainControl.find(".brtc-va-dialogs-content"));};o.keyup(function(t){n(t);}),o.on("search",function(t){n(t);});},o.prototype.getMatchedList=function(e){return e&&""!==e?$.grep(i,function(i){return t.VA.Setting.Registry[i].Label.toLowerCase().indexOf(e.toLowerCase())>-1;}):null;},o.prototype._generateJSONObject=function(e){var o=this,n=[],r=i.filter(function(i){return e?i.startsWith(e+t.VA.Setting.CONST.KEY_DELIMITER)&&!i.replace(e+".","").includes("."):!i.includes(t.VA.Setting.CONST.KEY_DELIMITER);});if(r&&r.length>0){var a={};r.forEach(function(e){var i=t.VA.Setting.Registry,r=i[e].Label,s=i[e].Key;r&&s&&(a={id:s,label:r,items:o._generateJSONObject(s)},o.filterArray?($.inArray(s,o.filterArray)>-1||a.items.length>0)&&(o.filterSelectItem&&(a.selected=!0,o.filterSelectItem=!1),a.expanded=!0,n.push(a)):n.push(a));});}return n;},o.prototype.createContentArea=function(t){var i=$('
    '),o=function o(){t.addClass("brtc-va-dialogs-center"),t.text(e.MSG_PANEL_EMPTY),i.remove();},n=function n(){t.removeClass("brtc-va-dialogs-center"),t.text(""),t.append(i);};if(this.settingMenu){var r=this,a=r.settingMenu.jqxTree("getSelectedItem");a?(n(),r._attachSettingPanel(t,a)):o(),this.settingMenu.on("select",function(e){if(r.settingMenu){t.text().length>0&&n();var i=e.args,o=r.settingMenu.jqxTree("getItem",i.element);r._attachSettingPanel(t,o);}});}else o();},o.prototype._attachSettingPanel=function(e,i){var o=this._getTreeParent(i,t.VA.Setting.Registry);e.find(".brtc-va-dialogs-content-info").text(o.label);var n=e.find(".brtc-va-dialogs-content-panel");n.empty();var r=new t.VA.Setting.Registry[i.id](n);n.perfectScrollbar(),this.settingPanelList.push(r);},o.prototype._getTreeParent=function(t,e){var i={label:t.label,objStr:t.id};if(t.parentElement){var o=this._getTreeParent(this.settingMenu.jqxTree("getItem",t.parentElement));i.label=o.label+" > "+i.label;}return i;},o.prototype.handleOkClicked=function(){for(var e in this.settingPanelList){this.settingPanelList[e].save();}Studio.getPreference().preferenceChanged(Object.keys(t.VA.SettingStorage.TEMP||{})),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},o.prototype.destroy=function(){this.$mainControl.find(".brtc-va-dialogs-menu-tree").jqxTree("destroy"),this.$mainControl.dialog("destroy"),this.$mainControl=void 0;},t.VA.Core.Dialogs.SettingDialog=o;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){this.parentId=e,this.options=i,this.dialogResult={OK:!1,Cancel:!0,command:new t.VA.Core.CompoundCommand(this,{})},this.analyticsModel=this.options.fnUnit.parent(),this.mainModel=this.analyticsModel.getMainModel(),this.options.param.index>-1&&this.options.fnUnit.param.functions&&(this.options.fnUnit=this.options.fnUnit.param.functions[this.options.param.index]),this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){var e=this;this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$mainControl.dialog({theme:t.VA.Env.Theme,modal:!1,width:200,resizable:!1,showAnimationDuration:50,position:{my:"left top",at:"right top",of:this.$mainControl.parent()},open:function open(){e.$mainControl.parent().find(".ui-dialog-titlebar.ui-widget-header").remove();},close:function close(){$(window).off("mousedown",e.closeHandler),$(window).off("resize",e.closeHandler),"function"==typeof e.options.close&&e.options.close(e.dialogResult);}}),this.closeHandler=function(t){0===e.$mainControl.has(t.target).length&&e.$mainControl.dialog("isOpen")&&e.$mainControl.dialog("close");},$(window).on("mousedown",this.closeHandler),$(window).on("resize",this.closeHandler);},e.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents"));},e.prototype.createDialogContentsArea=function(t){this.$contents=$('
    Set as variable


    Unset variable
    '),t.append(this.$contents),this.createGlobalVariableList(),this.bindSetGlobalVariable(),this.bindUnsetGlobalVariable();},e.prototype.createGlobalVariableList=function(){var e=this;this.variableList=Object.keys(this.getModel().variables);var i=this.getModel().getVariable(this.options.fnUnit.fid,this.options.param.key);for(var o in i?this.$contents.find(".brtc-va-global-variable-set").hide():this.$contents.find(".brtc-va-global-variable-unset").hide(),this.variableList){var n=$('
    Set to '+this.variableList[o]+"
    ");n.attr("title",this.variableList[o]),n.attr("type",this.getModel().variables[this.variableList[o]]["variable-type"]),this.$contents.find(".brtc-va-global-variable-list.element-wrapper").append(n),n.data("variable",this.variableList[o]),i===this.variableList[o]&&n.addClass("set"),n.click(function(){e.dialogResult.OK=!0,e.dialogResult.command.add(new t.VA.Core.Editors.Diagram.Commands.BindVariableCommand(e,{fid:e.options.fnUnit.fid,paramKey:e.options.param.key,variable:$(this).data("variable"),subFnUnitIndex:e.options.param.index})),e.$mainControl.dialog("close");});}this.$contents.find(".brtc-va-global-variable-list").perfectScrollbar();},e.prototype.bindSetGlobalVariable=function(){var e=this;this.$contents.find(".brtc-va-global-variable-set").click(function(){var i=e.options.param.label.toLowerCase().replace(/ /gi,"_"),o=e.options.param.type.toLowerCase().indexOf("array")>-1,n={name:i,type:o?"array[string]":"string",value:o?[""]:""},r=new t.VA.Core.Editors.Diagram.Commands.AddVariableDefCommand(e,{name:n.name,ref:{type:n.type,value:n.value},variable:n});t.VA.Core.Utils.WidgetUtils.getModelEditorRef(e.$parent).getCommandManager().execute(r),e.dialogResult.OK=!0,e.dialogResult.command.add(new t.VA.Core.Editors.Diagram.Commands.BindVariableCommand(e,{fid:e.options.fnUnit.fid,paramKey:e.options.param.key,variable:n.name,subFnUnitIndex:e.options.param.index})),e.$mainControl.dialog("close");});},e.prototype.bindUnsetGlobalVariable=function(){var e=this,i=this.getModel().getVariable(this.options.fnUnit.fid,this.options.param.key);this.$contents.find(".brtc-va-global-variable-unset").click(function(){e.dialogResult.command.add(new t.VA.Core.Editors.Diagram.Commands.UnBindVariableCommand(e,{fid:e.options.fnUnit.fid,paramKey:e.options.param.key,variable:i,subFnUnitIndex:e.options.param.index})),"function"==typeof e.options.remove&&e.options.remove(e.dialogResult),e.$mainControl.dialog("close");});},e.prototype.getModel=function(){return this.mainModel;},t.VA.Core.Dialogs.SettingVariableDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e={dataSelectorWrapper:["brtc-va-editors-sheet-controls-dataselector-contents-wrapper","brtc-va-dialogs-setvariable-dataselector-wrapper"].join(" "),dataSelectorItem:"brtc-va-editors-sheet-controls-dataselector-item"};function i(e,i){t.VA.Core.Dialogs.FnUnitDialog.call(this,e,i);}i.prototype=Object.create(t.VA.Core.Dialogs.FnUnitDialog.prototype),i.prototype.constructor=i,i.prototype.getTitle=function(){return this.options.title;},i.prototype.createControls=function(){this.$mainControl=$('
    '),this.$titleArea=this.$mainControl.find(".brtc-va-dialogs-title");},i.prototype.createDialogContentsArea=function(t){t.append('
    '),this.$headerArea=t.find(".brtc-va-dialogs-control-function-header"),this.$bodyArea=t.find(".brtc-va-dialogs-control-function-body"),this.createVariablesControl(),this.$bodyArea.perfectScrollbar({suppressScrollX:!0});},i.prototype.createDataControl=function(){this.$dataArea.append('
    ');t.VA.Env.Theme,this.createIndataSource();var e=this.$dataArea.find(".brtc-va-dialogs-data-selector"),i=this.createDataSelector();e.append(i),i.perfectScrollbar();},i.prototype.createDataSelectorItem=function(i,o,n){var r=$(crel("div",{class:e.dataSelectorItem})),a=t.VA.Core.Utils.WidgetUtils.createPaletteItem(r,n,"data");return a.find(".brtc-va-views-palette-fnunit-label").text(i),a.addClass("item"),a.attr("tid",o),r.addClass("brtc-va-editors-setvalue-indata-item"),r;},i.prototype.createDataSelectorSource=function(){var t=Studio.getEditorContainer().getActiveModelEditor().getActiveModel();return this.options.fnUnit.inData.map(function(e){var i=t.getFnUnitByOutTable(e);return{label:i.display.label,tid:e,type:i.func};});},i.prototype.createDataSelector=function(){var t=this,i=$(crel("div",{class:e.dataSelectorWrapper})),o=this.createDataSelectorSource(),n="",r=function r(e,i){n&&n.removeClass("selected"),(n=e).addClass("selected"),t.renderData(i);},a=o.map(function(e){var i=t.createDataSelectorItem(e.label,e.tid,e.type);return i.click(function(){r(i,e.tid);}),i;});return i.append(a),a.length>0&&r(a[0]),i;},i.prototype.renderData=function(e){var i=this.$dataArea.find(".brtc-va-dialogs-data-viewer");i.empty();var o=$.extend(!0,{},this.options.fnUnit);this.changeTableInfo(o,e);var n=Studio.getEditorContainer().getActiveModelEditor().getActiveModel().mid,r=new t.VA.Core.Editors.Sheet.DataProxy(i,n);r.reset(),this.panelFactory=Studio.getEditorContainer().getActiveModelEditor().getPanelFactory(),this.inPanel=this.panelFactory.createInDataPanel(i,{width:"100%",height:"100%",modelEditor:Studio.getEditorContainer().getActiveModelEditor(),fnUnit:o,resizable:!0,dataProxy:r});},i.prototype.changeTableInfo=function(t,e){t.inData=[e],t.display.sheet.in.partial[0].panel.length>0&&(t.display.sheet.in.partial[0].panel[0].tableIndexes=[0]);},i.prototype.createIndataSource=function(){var t=Studio.getEditorContainer().getActiveModelEditor().getActiveModel();return this.options.fnUnit.inData.map(function(e){var i=t.getFnUnitByOutTable(e);return{label:i.display.label,tid:e,type:i.func};});},i.prototype.createVariablesControl=function(){var e=this;this.variableControl=new t.VA.Core.Views.SetVariable(this.$bodyArea,{width:"100%",height:"100%",fnUnit:this.options.fnUnit,editor:this.options.editor,onAdd:function onAdd(t){e.onAdd(t);},onRemove:function onRemove(t){e.onRemove(t);},onChange:function onChange(t,i){e.onChange(t,i);}}),this.variableControl.$mainControl.find("input").addClass("brtc-style-minus-20").addClass("brtc-style-padding-right-20"),this.variableControl.$mainControl.find(".brtc-va-tools-sidebar-variable-list").addClass("brtc-style-padding-right-20");var i=[];for(var o in this.options.fnUnit.param.variables){var n=this.options.fnUnit.param.variables[o];i.push({type:n.type,name:n.name,value:"cell"===n.type?n.param:n.param.value});}this.variableControl.renderValues(i);},i.prototype.onRemove=function(t){var e=t.name,i=this.options.fnUnit.param.variables,o=[];for(var n in i){i[n].name!==e&&o.push(i[n]);}this.options.fnUnit.param.variables=o;},i.prototype.onChange=function(t,e){var i=t.name,o=this.options.fnUnit.param.variables,n=[];for(var r in this.updateMode(e),o){o[r].name!==i?n.push(o[r]):n.push(e);}this.options.fnUnit.param.variables=n;},i.prototype.onAdd=function(t){var e=$.extend(!0,{},t),i=$.extend(!0,[],this.options.fnUnit.param.variables);this.updateMode(e),i.push(e),this.options.fnUnit.param.variables=i;},i.prototype.refresh=function(){this.$mainControl.find(".brtc-va-dialogs-index-item-container").empty(),this.$mainControl.perfectScrollbar("update");},i.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,results:{fnUnit:this.options.fnUnit}},this.$mainControl.dialog("close");},i.prototype.handleCancelClicked=function(){this.dialogResult={OK:!1,Cancel:!0},this.$mainControl.dialog("close");},i.prototype.updateMode=function(t){"cell"===t.type?t.mode="cell":t.mode="value";},t.VA.Core.Dialogs.SetValueSettingDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.ScriptEditorDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.ScriptEditorDialog.prototype),e.prototype.createLayout=function(){this.$contentArea=this.$mainControl.find(".brtc-va-dialogs-contents");var e=!!this.options.scriptOnly&&this.options.scriptOnly;this.$editorArea=$('
    Up to '+t.VA.Core.Utils.CommonUtils.numberToStringWithComma(this.scriptEditorOptions.maxLength)+" characters can be entered.
    "),this.$errorArea=this.$editorArea.find(".brtc-va-dialogs-contents-statement-error"),this.$infoArea=$('
    '),this.$resultArea=$('
    '),this.$contentArea.append(this.$editorArea).append(this.$infoArea).append(this.$resultArea),this.$infoArea.perfectScrollbar();var i=this;this.$mainControl.on("resized",function(t){i.$infoArea.perfectScrollbar("update");});},e.prototype.renderInfoArea=function(t,e){this.renderTableAlias(this.$infoArea);},e.prototype.createInTableAlias=function(e){var i=this,o=this.FnUnitUtils.getParent(this.options.fnUnit),n=this.FnUnitUtils.getInTable(this.options.fnUnit),r=[];for(var _t11 in n){r.push(o.getFnUnitByOutTable(n[_t11]));}this.tableAlias=[];for(var _o9 in r){var a=r[_o9],s="#{DF("+_o9+")}";this.tableAlias.push("#{DF("+_o9+")}");var l=$('
    '+s+"
    "),c=a.parent().type,d=$('
    '),p=t.VA.Core.Utils.WidgetUtils.createPaletteItem(d,a.func,c);p.find(".brtc-va-views-palette-fnunit-label").text(a.display.label).attr("variable",s),d.attr("value",this.FnUnitUtils.getOutTable(this.options.fnUnit)),p.addClass("item"),l.append(d),e.append(l),l.find(".brtc-va-views-palette-fnunit").click(function(){var t=$(this).find(".brtc-va-views-palette-fnunit-label").attr("variable");i.codeMirror.setValue(i.codeMirror.getValue()+" "+t),i.selectMarker=i.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0});});}},e.prototype._getInTableLabel=function(t){return"#{DF("+t+")}";},e.prototype.renderTableAlias=function(t){var e=$('
    ');t.append(e);var i=this.addPropertyControl("In Table Variable",e);this.createInTableAlias(i);},e.prototype.addPropertyControl=function(t,e){var i=$('
    '+t+"
    "),o=$('
    ');return e.append(i).append(o),o;},e.prototype.setEditorStatement=function(t){this.codeMirror.setValue(t),this.codeMirror.clearHistory(),this.selectMarker=this.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0});},e.prototype.renderEditorArea=function(){var e=this;this.codeMirror=CodeMirror.fromTextArea(this.$editorArea.find("textarea")[0],{mode:this.scriptEditorOptions.mode,theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!0,matchBrackets:!0,autofocus:!1,extraKeys:{"Ctrl-Space":"autocomplete","Ctrl-Enter":function CtrlEnter(){e.tempFnUnit=$.extend(!0,{},e.options.fnUnit),"queryExecutorPython"===e.tempFnUnit.func?(e.tempFnUnit.outputs.out_table=e.FnUnitUtils.getOutputs(e.options.fnUnit).out_table,e.tempFnUnit.param.query=e.codeMirror.getValue()):(e.tempFnUnit.outData=e.FnUnitUtils.getOutputs(e.options.fnUnit),e.tempFnUnit.param["full-query"]=e.codeMirror.getValue(),e.tempFnUnit.param["alias-names"]=e.tableAlias),Studio.getJobExecutor().launchUnit(e.tempFnUnit,{},{},{catch:function _catch(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);},success:function success(t){e.refreshResult();}});}},hintOptions:{list:this.scriptEditorOptions.additionalHint}}),t.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(this.codeMirror),t.VA.Core.Utils.WidgetUtils.setCodeMirrorMaxLength(this.codeMirror),this.setEditorStatement(this.options.statement),this.codeMirror.setSize("100%","100%"),this.codeMirror.setOption("maxLength",this.scriptEditorOptions.maxLength);},e.prototype.renderResultArea=function(){var t=this,e=$('
    ');e.find(".brtc-va-dialogs-sql-test-button").click(function(){t.handleTestClicked();}),this.$contentArea.find(".brtc-va-dialogs-result").append(e);},e.prototype.handleTestClicked=function(){var e=this;e.tempFnUnit=$.extend(!0,{},e.options.fnUnit),"queryExecutorPython"===e.tempFnUnit.func||"queryExecutorPython2"===e.tempFnUnit.func?(e.tempFnUnit.outputs.out_table=e.FnUnitUtils.getOutputs(e.options.fnUnit).out_table,e.tempFnUnit.param.query=e.codeMirror.getValue()):(e.tempFnUnit.outData=e.FnUnitUtils.getOutputs(e.options.fnUnit),e.tempFnUnit.param["full-query"]=e.codeMirror.getValue(),e.tempFnUnit.param["alias-names"]=e.tableAlias),Studio.getJobExecutor().launchUnit(e.tempFnUnit,{},{},{catch:function _catch(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);},success:function success(t){e.refreshResult(t);}});},e.prototype.refreshResult=function(){var e=this;for(var i in this.$resultPanelContent){this.$resultPanelContent[i].remove();}this.$resultPanelContent={},this.$resultSheet={};var o=this.FnUnitUtils.getOutputs(e.tempFnUnit);o="queryExecutorPython"===e.tempFnUnit.func||"queryExecutorPython2"===e.tempFnUnit.func?o.out_table:o[0],t.VA.Core.DataQueryTemplate.queryData(this.options.fnUnit.parent().mid,o,0,1e3,function(t,i){e.createResultPanelContent(o,t);},function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e);},!1);},e.prototype.createResultPanelContent=function(t,e){this.$resultPanelContent[t]=$('
    '),this.$mainControl.find(".brtc-va-dialogs-result-sql").append(this.$resultPanelContent[t]),this.createResultContents(this.$resultPanelContent[t],t,e);},e.prototype.createResultContents=function(t,e,i){this.$resultSheet[e]=$('
    '),t.append(this.$resultSheet[e]),this.createResultGrid(e,i);},e.prototype.createResultGrid=function(e,i){var o=$('
    ');this.$resultSheet[e].find(".brtc-va-dialogs-result-sql-panel-content-chart-area").append(o);var n={localdata:i.data,datatype:"array",datafields:$.map(i.columns,function(t,e){return{name:"__"+t.name,type:t.type,map:""+e};})},r=$.map(i.columns,function(e,i){var o={text:e.name,datafield:"__"+e.name,width:80};return"date"===e.type?o.cellsformat="yyyy-MM-dd HH:mm:ss:fff":"number"===e.type?(o.cellsformat="d",o.cellsalign="right"):"string"===e.type&&(o.cellsrenderer=function(e,i,o){var n="overflow:hidden; text-overflow:ellipsis; padding-bottom:2px; margin-right: 2px; margin-left: 4px; margin-top: 4px;",r=this.owner.source.records[e][i];if(void 0!==r&&""!==r&&null!==r)return'
    '+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"
    ";var a=this.owner.source._source.localdata[e],s=this.owner.source._source.datafields,l=0;for(var c in s){if(s[c].name===i){l=Number(s[c].map);break;}}return void 0===a[l]?'
    undefined
    ':null===a[l]?'
    null
    ':""===a[l]?'
    ':void 0;}),o;});r.unshift({text:"No",sortable:!1,menu:!1,editable:!1,groupable:!1,draggable:!1,datafield:"",width:40,columntype:"number",renderer:function renderer(t){return'
    '+t+"
    ";},cellsformat:"d",cellsalign:"right",cellclassname:"brtc-va-refine-spreadsheet-rownum-cell",cellsrenderer:function cellsrenderer(t,e,i){return'
    '+(i+1)+"
    ";}});var a=new $.jqx.dataAdapter(n);o.jqxGrid({theme:t.VA.Env.Theme,width:"100%",height:"200",rowsheight:25,source:a,altrows:!1,filterable:!1,sortable:!1,columnsresize:!0,selectionmode:"multiplecellsextended",columns:r}),o.on("columnclick",function(t){"No"===t.args.column.text&&$(this).jqxGrid("autoresizecolumns");});},e.prototype.destroy=function(){t.VA.Dialogs.Dialog.prototype.destroy.call(this);},e.prototype.getTitle=function(){return"SQL";},t.VA.Core.Dialogs.SqlEditorDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0,param:{}},this.retrieveParent(),this.createControls(),this.renderValue();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl),this.$okButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-ok"),this.$cancelButton=this.$mainControl.find(".brtc-va-dialogs-buttonbar-cancel");var e=this,i={theme:t.VA.Env.Theme,title:"Auto Sub Function",width:"800",height:"800",maxWidth:"800",maxHeight:"800",modal:!0,resizable:!1,create:function create(){e.createDialogContentsArea(e.$mainControl.find(".brtc-va-dialogs-contents")),e.$okButton.jqxButton({theme:t.VA.Env.Theme}),e.$okButton.click(e.handleOkClicked.bind(e)),e.$cancelButton.jqxButton({theme:t.VA.Env.Theme}),e.$cancelButton.click(e.handleCancelClicked.bind(e));},close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult);}};this.$mainControl.dialog(i),$(".ui-dialog-titlebar-close",$(this).parent()).hide();},e.prototype.renderValue=function(){for(var t=0;t=1&&this.createControlArrRow(!1,e,o,r),this.controlsArray[e][o][s].val(a[s]);}}else{a="";for(var s in this.options.fnUnit.param[e][o]){a=a+this.options.fnUnit.param[e][o][s]+",";}this.$elements[e][o].val(a.substring(0,a.length-1)||"");}}}},e.prototype.handleOkClicked=function(){this.dialogResult.param=this.getSubFunctionProperty(),this.dialogResult.OK=!0,this.dialogResult.Cancel=!1,this.$mainControl.dialog("close");},e.prototype.handleCancelClicked=function(){this.dialogResult.OK=!1,this.dialogResult.Cancel=!0,this.$mainControl.dialog("close");},e.prototype.getSubFunctionProperty=function(){for(var t={},e=0;e
    ');for(var i=e.find(".brtc-va-dialogs-subfunction-toolbar-area"),o=0;o'+n+"
    "),i.find('.brtc-va-dialogs-subfunction-toolitem[function-name="'+n+'"]').on("click",function(){e.find(".brtc-va-dialogs-area").css("display","none"),e.find('.brtc-va-dialogs-area[function-name="'+event.target.innerText+'"]').css("display","block");});}e.find(".brtc-va-dialogs-subfunction-toolitem").jqxButton({theme:t.VA.Env.Theme}),this.$elements={},this.controls={},this.controlsArray={},this.$propertiesArea=e.find(".brtc-va-dialogs-subfunction-properties-area");for(o=0;o'),this.$contentsArea=t.find(".brtc-va-dialogs-area"),this.$elements[e]={},this.controls[e]={};for(var i=0;i'),r.addPropertyControl(i,function(t){t.append(r.$elements[e][o]),r.controls[e][o]=r.createInput(r.$elements[e][o],n);});},e.prototype.addPropertyControl=function(e,i){var o=this,n=$('
    ');return this.$contentsArea.append(n),n.jqxExpander({theme:t.VA.Env.Theme,arrowPosition:"left",initContent:function initContent(){"function"==typeof i&&i.call(o,n.find(".brtc-va-dialogs-controls-propertycontrol-contents"));}}),n.jqxExpander("setHeaderContent",e),n;},e.prototype.createInput=function(e,i){var o={theme:t.VA.Env.Theme,height:"25px",placeHolder:"Enter value"};return i&&$.extend(o,i),e.jqxInput(o),e;},e.prototype.createControlArrRow=function(t,e,i,o){var n=this,r=$('
    '),a=$('
    '),s=$('
    '),l=$('
    ');r.append(a),t?r.append(s):r.append(l),this.controlsArray[e][i].push(a),this.$elements[e][i].append(r),n.controls[e][i]=n.createDropDownList(a,o,"",{width:"90%",float:"left"}),l.click(function(){var t=l.parents(".brtc-va-dialogs-property-row-content"),o=t.prevAll().length;n.controlsArray[e][i].splice(o,1),t.remove();}),l.hover(function(){$(this).css({color:"#86BFA0"});},function(){$(this).css({color:""});}),s.click(function(){n.createControlArrRow(!1,e,i,o);}),s.hover(function(){$(this).css({color:"#429366"});},function(){$(this).css({color:""});});},e.prototype.createDropDownControl=function(t,e,i,o){var n=this;n.$elements[e][o]=$('
    '),n.addPropertyControl(i,function(t){t.append(n.$elements[e][o]);});},e.prototype.createDropDownList=function(e,i){var o={theme:t.VA.Env.Theme,width:"100%",height:"25px"};return i&&$.extend(o,i),e.jqxDropDownList(o),e;},t.VA.Core.Dialogs.SubFunctionDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils;function i(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.initContents();}i.prototype.retrieveParent=function(){this.$parent=e.WidgetUtils.retrieveWidget(this.parentId);},i.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl);var e=this,i={theme:t.VA.Env.Theme,title:"Select Function",width:800,height:700,modal:!0,resizable:!1,close:function close(){"function"==typeof e.options.close&&e.options.close(_.merge({position:e.options.position},e.dialogResult)),e.$mainControl.dialog("destroy"),e.$mainControl.remove();}};this.$mainControl.dialog(i),$("button.ui-dialog-titlebar-close",$(this).parent()).css("right","1em");},i.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this._removeTitleBottomBorder();},i.prototype._removeTitleBottomBorder=function(){this.$mainControl.prev().css("border","initial");},i.prototype.createDialogContentsArea=function(e){var i=this;e.append('
    • Search Functions
    • All Functions
    '),this.tabControl=t.VA.Core.Widget.Factory.tabControl(e);var o=e.find(".brtc-va-dialogs-selectfnunit-tab-searchfunctions"),n=e.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions");this.createPalette(n,function(){i.createAllFunctionsArea(n),i.createSearchFunctionsArea(o);});},i.prototype.createPalette=function(e,i){this.palette=new t.VA.Core.Views.Palette(e,{width:"100%",height:"100%",draggable:!1,modelType:this.options.modelType,fnClickHandler:this.handleClose.bind(this),refreshCallback:this.refreshSidebar.bind(this),completeCallback:i});},i.prototype.createAllFunctionsArea=function(t,e){t.find(".brtc-va-views-palette").css("height","100%"),t.find(".brtc-va-views-palette-navigator-wrapper").css({height:"calc(100% - 80px)",position:"relative","padding-right":"20px"}).perfectScrollbar(),t.perfectScrollbar();},i.prototype.createSearchFunctionsArea=function(t){this.paletteItems=this.palette.paletteData,this.udfItems=this.palette.udfData,this.createRecommendArea(t),this.createKeywordArea(t),this.createSearchResultArea(t),this.$mainControl.find(".brtc-va-dialogs-selectfnunit-keyword-input").jqxInput("focus");},i.prototype.createRecommendArea=function(e){var i=this,o=this.paletteItems,n=$('
    Recommendations 0
    ');e.append(n);var r=n.find(".brtc-va-dialogs-selectfnunit-recommend-list");var a=function a(t,e){for(var _iterator5=t,_isArray5=Array.isArray(_iterator5),_i16=0,_iterator5=_isArray5?_iterator5:_iterator5[Symbol.iterator]();;){var _ref24;if(_isArray5){if(_i16>=_iterator5.length)break;_ref24=_iterator5[_i16++];}else{_i16=_iterator5.next();if(_i16.done)break;_ref24=_i16.value;}var _ref25=_ref24,_i17=_ref25.functions;for(var _iterator6=_i17,_isArray6=Array.isArray(_iterator6),_i18=0,_iterator6=_isArray6?_iterator6:_iterator6[Symbol.iterator]();;){var _ref26;if(_isArray6){if(_i18>=_iterator6.length)break;_ref26=_iterator6[_i18++];}else{_i18=_iterator6.next();if(_i18.done)break;_ref26=_i18.value;}var _t12=_ref26;if(_t12.func===e)return _t12.visible;}}return!1;};if(r.append($('
    Recommend item does not exist.
    ')),this.options.preFnUnit){r.empty();var _e5=t.VA.Env.Recommend.Next.getList(this.options.preFnUnit.func,this.options.modelType);$.each(_e5,function(t,e){"load"!==e&&a(o,e)&&i.createItem(r,e);});}else{r.empty();var _e6=t.VA.Env.Recommend.Next[this.options.modelType].default;$.each(_e6,function(t,e){a(o,e)&&i.createItem(r,e);});}var s=n.find("#count"),l=r.find(".brtc-va-dialogs-selectfnunit-item").length;s.text(l),r.perfectScrollbar();},i.prototype.createKeywordArea=function(e,i){var o=this,n=$('
    Search functions by the following keywords:
    ');e.append(n);var r=n.find(".brtc-va-dialogs-selectfnunit-keyword-list");for(var a in t.VA.Env.Tags[o.options.modelType]){var s=t.VA.Env.Tags[o.options.modelType][a];if("Prescriptive"!==s){var l=$('
    '+s+"
    ");l.css("cursor","pointer"),r.append(l);}}r.find(".brtc-va-dialogs-selectfnunit-keyword-item").click(function(t){var e=$(this);e.hasClass("selected")?e.removeClass("selected"):e.addClass("selected"),o.refreshResult();}),n.find(".brtc-va-dialogs-selectfnunit-keyword-list").slimscroll({height:"calc(100% - 5px)"});},i.prototype.createSearchResultArea=function(e,i){var o=this,n=$('
    Any other keywords?
    Result 0
    ');e.append(n);var r=n.find(".brtc-va-dialogs-selectfnunit-searchresult-list"),a=n.find(".brtc-va-dialogs-selectfnunit-keyword-input");a.jqxInput({height:29,width:300,theme:t.VA.Env.Theme,placeHolder:"Search Item"}),a.on("keyup search",function(t){o.refreshResult();}),r.perfectScrollbar();},i.prototype.refreshResult=function(){var e=this;setTimeout(function(){var i=e.$mainControl.find(".brtc-va-dialogs-selectfnunit-searchresult-list"),o=e.$mainControl.find(".brtc-va-dialogs-selectfnunit-keyword-input").jqxInput("val").toLowerCase(),n=$.map(e.$mainControl.find(".brtc-va-dialogs-selectfnunit-keyword-item.selected"),function(t){return $(t).text();});o&&n.push(o.trim());var r=0;if(i.empty(),i.scrollTop(0),n.length>0){var a=t.VA.Core.Functions.Library.getListByTags(n,e.options.modelType),s=[];e.paletteItems.reduce(function(t,e){return e.visible?t.concat(e.functions):t;},[]).forEach(function(t){if(t.visible){var e=a.find(function(e){return e===t.func;});e&&s.push(e);}}),s.forEach(function(t){e.createItem(i,t);}),r=s.length;}e.$mainControl.find(".brtc-va-dialogs-selectfnunit-searchresult #count").text(r),i.perfectScrollbar("update");},0);},i.prototype.createItem=function(t,i){var o,n=this,r=$('
    '),a=this.options.modelType,s=e.WidgetUtils.createPaletteItem(r,i,a);try{var l=e.WidgetUtils.getFunctionLibrary(a,i);if("unknownFunction"===l.defaultFnUnit.func)return;var c=l.summary||l.description;return(o=$('
    ')).find("span").attr("title",c).text(c),r.append(o),s.click(function(){n.handleClose.call(n,s);}),t.append(r),r;}catch(t){console.error(t);}},i.prototype.handleClose=function(t){var i=$(t);var o=e.WidgetUtils.getData(i,"func");this.dialogResult={OK:!0,Cancel:!1,func:o},this.$mainControl.dialog("close");},i.prototype.refreshSidebar=function(){var t=Studio.getEditorContainer().getActiveModelEditor();t.getSideBarManager(),t.getSideBarManager()&&t.getSideBarManager().onActivated&&t.getSideBarManager().onActivated();},t.VA.Core.Dialogs.SwitchFnUnitDialog=i;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.options=e,this.dialogResult={OK:!1,Cancel:!0},this.retrieveParent(),this.createControls(),this.initContents();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$parent.append(this.$mainControl);var e=this,i={theme:t.VA.Env.Theme,title:"Insert Unit",width:780,height:700,modal:!0,resizable:!1,close:function close(){"function"==typeof e.options.close&&e.options.close(e.dialogResult),e.$mainControl.dialog("destroy"),e.$mainControl.remove();}};this.$mainControl.dialog(i),this.$mainControl.parent().find(".brtc-va-dialogs-selectfnunit-tab-allfunctions").css("padding-left","14px");},e.prototype.initContents=function(){this.createDialogContentsArea(this.$mainControl.find(".brtc-va-dialogs-contents")),this._removeTitleBottomBorder();},e.prototype._removeTitleBottomBorder=function(){this.$mainControl.prev().css("border","initial");},e.prototype.createDialogContentsArea=function(e){e.append('
    • All Units
    '),e.jqxTabs({theme:t.VA.Env.Theme,width:this.options.width||"100%",position:"top",scrollable:!1});var i=e.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions");this.createAllFunctionsArea(i),i.perfectScrollbar(),e.jqxTabs("focus"),e.find(".jqx-tabs-titleContentWrapper").css("margin-top","4.5px");},e.prototype.createAllFunctionsArea=function(e){var i=this,o={label:"DataFlow",visible:!0,functions:[]};for(var n in i.options.dataFlowList){o.functions.push({func:{func:"dataFlow",category:"DataFlow",label:i.options.dataFlowList[n].getLabel(),mid:i.options.dataFlowList[n].getFileId()},label:i.options.dataFlowList[n].getLabel(),visible:!0});}this.palette=new t.VA.Core.Views.Palette(e,{width:"100%",height:"100%",draggable:!1,modelType:i.options.modelType,additionalGroup:o}),e.find(".brtc-va-views-palette-filter-input").hide(),e.find(".brtc-va-views-palette-navigator").bind("DOMNodeInserted",function(e){$(e.target).hasClass("brtc-va-views-palette-fnunit-list")&&$(e.target).find(".brtc-va-views-palette-fnunit").click(function(e){var o=t.VA.Core.Utils.WidgetUtils.getData($(this),"func"),n={};o&&o.category&&"DataFlow"==o.category?(n.func=o.func,n.mid=o.mid):n.func=o,i.dialogResult={OK:!0,Cancel:!1,unit:n},i.$mainControl.dialog("close");});});},t.VA.Core.Dialogs.SwitchUnitDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Dialogs.Dialog.call(this,e,i);}e.prototype=Object.create(t.VA.Dialogs.Dialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Dialogs.Dialog.prototype._initOptions.call(this),this.dialogOptions.width=500,this.dialogOptions.height=500;},e.prototype.createDialogContentsArea=function(t){t.addClass("brtc-va-dialogs-test-udf-param-contents"),t.append('
    '),this.createInputTableControl(t.find(".brtc-va-dialogs-test-udf-param")),this.createInputVariablesControl(t.find(".brtc-va-dialogs-test-udf-param")),t.perfectScrollbar(),t.perfectScrollbar("update");},e.prototype.createInputTableControl=function(e){var i=this;if(0!==i.options.inputDataCnt){var o=$('
    Input Data
    ');this.inputFsPaths=[];for(var n={},r=0;r
    inputs('+r+")
    ");n[r]=$(''),i.createInput(n[r]),n[r].prop("readonly",!0),a.append(n[r]),n[r].click(function(){var e=this;new t.VA.Core.Dialogs.RepositoryBrowserDialog(i.$mainControl,{filePath:$(e).val(),close:function close(t){t.OK&&t.selectedFile&&i.renderInput($(e),[t.selectedFile]);},resizable:!0,title:"Browse Repository"}).$settingOptionGroup.attr("setting","false");}),this.inputFsPaths.push({index:r,control:n[r],value:""}),o.find(".contents").append(a),e.append(o);}}},e.prototype.renderInput=function(t,e){var i=e[0]||"";t.val(i),t.attr("title",i),this.renderInputSchema(i);},e.prototype.createInputVariablesControl=function(e){if(0!==this.options.inputVariable.length){var i=$('
    Input Variable
    ');for(var o in this.inputVariables=[],this.options.inputVariable){var n=$('
    '+this.options.inputVariable[o].param_name+"
    ");e.append(i);var r="";if("int"===this.options.inputVariable[o].arg_type||"double"===this.options.inputVariable[o].arg_type||"long"===this.options.inputVariable[o].arg_type){r=$('
    ');var a={numberType:this.options.inputVariable[o].arg_type,placeholder:"Enter value"},s=this.createNumberInput(r,a,"",{width:"70%"});n.append(r),i.find(".contents").append(n),this.inputVariables.push({paramName:this.options.inputVariable[o].param_name,paramType:this.options.inputVariable[o].arg_type,control:s,value:""});}else if("string"===this.options.inputVariable[o].arg_type){r=$('');a={placeHolder:"Enter value",width:"70%"};this.createInput(r,a,"",{width:"70%"}),n.append(r),i.find(".contents").append(n),this.inputVariables.push({paramName:this.options.inputVariable[o].param_name,paramType:this.options.inputVariable[o].arg_type,control:r,value:""});}else{r=$(''),n.append(r),i.find(".contents").append(n);var l=new t.VA.Core.Verifier.SqlVerifier(),c={placeholder:'Enter value. \n Ex)Array("a", "b") \n Map("a"->"b")',hintOptions:{list:[]}};c.verifier=l;var d=this.createTextAreaControl(r,c,"",{width:"70%"});r.data("codeMirror",d),d.codeMirror.setSize("100%","50px"),this.inputVariables.push({paramName:this.options.inputVariable[o].param_name,paramType:this.options.inputVariable[o].arg_type,control:d,value:""});}}this.updateCodeMirrorHint();}},e.prototype.updateCodeMirrorHint=function(){for(var t in this.hintList=[],this.hintList=$.extend(!0,this.hintList,CodeMirror.hintWords["text/x-scala"]),this.columnList){for(var e in this.columnList[t]){this.hintList.push(this.columnList[t][e].name);}}for(var t in this.inputVariables){"expression"===this.inputVariables[t].paramType&&(this.inputVariables[t].control.codeMirror.options.hintOptions.list=this.hintList);}},e.prototype.handleOkClicked=function(){this.dialogResult.inputTables=this.getInputTables(),this.dialogResult.inputVariables=this.getInputParams(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this);},e.prototype.getInputTables=function(){for(var t in this.inputFsPaths){this.inputFsPaths[t].value=this.inputFsPaths[t].control.val();}return this.inputFsPaths;},e.prototype.getInputParams=function(){for(var t in this.inputVariables){"int"===this.inputVariables[t].paramType||"double"===this.inputVariables[t].paramType||"long"===this.inputVariables[t].paramType?this.inputVariables[t].value=this.inputVariables[t].control.getValue():"string"===this.inputVariables[t].paramType?this.inputVariables[t].value=this.inputVariables[t].control.val():this.inputVariables[t].value=this.inputVariables[t].control.getValue();}return this.inputVariables;},e.prototype.createDialogButtonBar=function(e){t.VA.Dialogs.Dialog.prototype.createDialogButtonBar.call(this,e),this.$okButton.val("RUN"),this.$cancelButton.css({display:"none"});},e.prototype.wrapControl=function(t){var e=$('
    ');t.wrap(e);},e.prototype.addClassToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-dialog-test-udf-param-controls-wrapper");i&&i.addClass(e);}},e.prototype.addCssToWrapper=function(t,e){if(e){var i=t.parent(".brtc-va-dialog-test-udf-param-controls-wrapper");i&&i.css(e);}},e.prototype.createInput=function(e,i,o,n){this.wrapControl(e);var r="";o&&(r=r.concat(" ",o)),e.attr("type")||e.attr("type","text"),e.attr("maxlength")||e.attr("maxlength","100"),this.addClassToWrapper(e,r),this.addCssToWrapper(e,n);var a={theme:t.VA.Env.Theme,height:"25px"};i&&$.extend(a,i),e.jqxInput(a);var s=e.val();return e.focus(function(){s=e.val();}),$("svg").on("mousedown",function(){e.val()!==s&&e.is(":focus")&&e.trigger("change");}),e;},e.prototype.createNumberInput=function(e,i,o,n){this.wrapControl(e);var r="";return o&&(r=r.concat(" ",o)),this.addClassToWrapper(e,r),this.addCssToWrapper(e,n),new t.VA.Core.Editors.Sheet.Controls.NumericInput(e,i);},e.prototype.createTextAreaControl=function(e,i,o,n){this.wrapControl(e);var r="";return o&&(r=r.concat(" ",o)),this.addClassToWrapper(e,r),this.addCssToWrapper(e,n),e.addClass(r),n&&e.css(n),new t.VA.Core.Editors.Sheet.Controls.TextAreaControl(e,i);},e.prototype.renderInputSchema=function(e){this.columnList={};var i=this;t.VA.RepositoryQueryTemplate.schema(e).done(function(t){i.columnList[e]=t.columns,$.each(i.columnList[e],function(t,e){void 0===e.type?e.type=e.internalType:e.type=e.type;}),i.updateCodeMirrorHint();}).fail(function(t){});},t.VA.Core.Dialogs.TestUDFParamDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){t.VA.Core.Dialogs.FnUnitDialog.call(this,e,i);}e.prototype=Object.create(t.VA.Core.Dialogs.FnUnitDialog.prototype),e.prototype.constructor=e,e.prototype._initOptions=function(){t.VA.Core.Dialogs.FnUnitDialog.prototype._initOptions.call(this),this.dialogOptions.width=450,this.dialogOptions.height=600;},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$titleArea=this.$mainControl.find(".brtc-va-dialogs-title");},e.prototype.createDialogContentsArea=function(t){var e=this;this.$contentsAreaWrapper=$('
    '),this.$contentsAreaWrapper.css({width:this.options.width,height:this.options.height,border:"none"}),t.append(this.$contentsAreaWrapper),this.$contentsArea=this.$contentsAreaWrapper.find(".contents"),this.addPropertyControl("Target",function(t){e.createTargetControl(t);}),this.addPropertyControl("Path",function(t){e.createModelPathControl(t);}).find(".brtc-va-views-properties-pages-controls-propertycontrol-contents").css({border:"none"});},e.prototype.createTargetControl=function(t){this.$target=t;var e=this.FnUnitUtils,i=e.getPreviousFnUnits(this.options.fnUnit).map(function(t){return{label:e.getLabel(t),value:e.getId(t)};});this.createDropDownList(t,{source:i}).val(this.options.fnUnit.param.target);},e.prototype.createModelPathControl=function(t){this.$path=$(''),t.append(this.$path),this.createInput(this.$path).val(this.options.fnUnit.param.path);},e.prototype.addPropertyControl=function(e,i,o){var n=this,r=$('
    ');return this.$contentsArea.append(r),r.jqxExpander({theme:t.VA.Env.Theme,arrowPosition:"left",initContent:function initContent(){"function"==typeof i&&i.call(n,r.find(".brtc-va-views-properties-pages-controls-propertycontrol-contents"),o);}}),r.jqxExpander("setHeaderContent",e),r;},e.prototype.setDropDownControlValue=function(t,e){var i=this.$mainControl.find('.brtc-va-views-properties-pages-controls-propertycontrol-dropdown[param-key="'+t+'"]');i.val()!==e&&i.val(e);},e.prototype.createInput=function(e){return e.jqxInput({theme:t.VA.Env.Theme,width:"100%",height:"30px"});},e.prototype.createDropDownList=function(e,i){return e.jqxDropDownList(_.extend({theme:t.VA.Env.Theme,width:"100%",height:"25px"},i));},e.prototype.setInputControlValue=function(t,e){var i=this.$mainControl.find('.brtc-va-views-properties-pages-controls-propertycontrol-input[param-key="'+t+'"]');i.val()!==e&&i.val(e);},e.prototype.makeInputs=function(t){var e={},i=this.FnUnitUtils;return t&&_.forEach(i.getOutData(t),function(t,i){e[t]=t;}),e;},e.prototype.makeMeta=function(t){var e={},i=this.FnUnitUtils;return t&&_.forEach(i.getOutData(t),function(o,n){var r=i.getTypeByTableId(t,o);e[o]={type:r};}),e.model={type:"model"},e;},e.prototype.makeParam=function(t){var e={};return e.target=this.$target.val(),e.path=this.$path.val(),t&&(e.linked={name:t.name,param:t.param,outData:t.outData,outputs:t.outputs}),e;},e.prototype.getFunctionByFid=function(t){return Studio.getActiveEditor().getFunctionByFid(t);},e.prototype.getTargetTable=function(t){var e={model:"",meta:""},i=this.getFunctionByFid(t);return e.model=this.FnUnitUtils.getTrainModel(i),e.meta=this.FnUnitUtils.getTrainMeta(i),e;},e.prototype.handleOkClicked=function(){var t=$.extend(!0,{},this.options.fnUnit),e=this.getFunctionByFid(this.$target.val());t.param=this.makeParam(e),t.inputs=this.makeInputs(e),t.meta=_.extend(t.meta,this.makeMeta(e)),this.dialogResult={OK:!0,Cancel:!1,results:{fnUnit:t}},this.$mainControl.dialog("close");},t.VA.Core.Dialogs.UnloadModelSettingDialog=e;}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Utils,i=t.VA.Dialogs.Dialog.prototype;function o(t,e){i.constructor.call(this,t,e);}o.prototype=Object.create(i),o.prototype.constructor=o,o.prototype._initOptions=function(){i._initOptions.call(this),this.dialogOptions.title="Version List",this.dialogOptions.width=1e3,this.dialogOptions.height="auto",this.dialogOptions.maxHeight="auto";},o.prototype.createDialogContentsArea=function(e){var i=['
    ','
    ',' ',"
    ",'
    ',"
    ","
    "].join("\n");e.append(i),this.$addBtn=e.find(".brtc-va-dialogs-version-management-add"),this.$contentBody=e.find(".brtc-va-dialogs-version-management-body");var o=new t.VA.EventEmitter();o.on("load",_.debounce(function(t){this.openLoadQuestionDialog(function(e){e.OK&&this.loadFileVersion(t.getFileId(),t.getVersionId());}.bind(this));}.bind(this),300)),o.on("error",_.debounce(function(t){this._onError(t);}.bind(this))),this.modelVersionListComponent=new t.VA.Core.Components.ModelVersionListLoadable({$el:this.$contentBody,emitter:o,projectId:this.options.projectId,fileId:this.options.fileId}),this.createAddButton(this.$addBtn);},o.prototype.createAddButton=function(e){e.jqxButton({theme:t.VA.Env.Theme}),e.click(_.debounce(this.openAddVersionDialog.bind(this)));},o.prototype.openAddVersionDialog=function(){var e=function(t){t.OK&&this.modelVersionListComponent.refreshFileVersionList();}.bind(this);new t.VA.Core.Dialogs.AddVersionDialog(this.$mainControl,{projectId:this.options.projectId,fileId:this.options.fileId,close:e});},o.prototype.openLoadQuestionDialog=function(t){e.WidgetUtils.openQuestionDialog("Current model contents will be overwritten by this version and cannot be recovered. Are you sure?",t);},o.prototype.createDialogButtonBar=function(t){i.createDialogButtonBar.call(this,t),this.$okButton.val("Close"),this.$cancelButton.css({display:"none"});},o.prototype.loadFileVersion=function(t,i){var o=function(){return this.closedEditor=Studio.getEditorContainer().findEditorById(this.options.projectId,t),this.closedEditor&&Studio.getLayoutManager().closeEditor(this.closedEditor.options.editorInput),!0;}.bind(this),n=function(){return this.dialogResult.loadingSuccess=!1,this.$mainControl.dialog("close");}.bind(this),r=function(t){this.updatedFiles=t;}.bind(this),a=function(){Studio.getLayoutManager().openEditor(this.updatedFiles);}.bind(this);Studio.getResourceManager().loadVersion(this.options.projectId,t,i).then(r).then(o).then(function(){return e.WidgetUtils.openInformationDialog("Loading success");}).then(n).then(a).catch(this._onError.bind(this));},o.prototype._onError=function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e),this.$mainControl.dialog("close");},o.prototype.destroy=function(){i.destroy.call(this),this.modelVersionListComponent.destroy();},t.VA.Core.Dialogs.VersionManagementDialog=o;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=$.extend({},e||{showPreviousButton:!0,showNextButton:!0,showFinishButton:!0}),this.retrieveParent(),this.createControls(),this.initPermission();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.initPermission=function(){this.permissions=["data_upload_shared"],this.checkPermission();},e.prototype.checkPermission=function(){t.VA.Core.Utils.PermissionUtils.check(this.$mainControl,this.permissions);},e.prototype.init=function(){$(":focus").blur(),this.options.wizard.$btnPrevious.removeClass("jqx-fill-state-hover").removeClass("jqx-fill-state-hover-office"),this.options.wizard.$btnNext.removeClass("jqx-fill-state-hover").removeClass("jqx-fill-state-hover-office"),this.options.wizard.$btnFinish.removeClass("jqx-fill-state-hover").removeClass("jqx-fill-state-hover-office"),this.options.wizard.$btnPrevious.jqxButton({disabled:!1}),this.options.wizard.$btnNext.jqxButton({disabled:!1}),this.options.wizard.$btnFinish.jqxButton({disabled:!1}),this.$mainControl.find(".preview").find(".contents").perfectScrollbar("update");},e.prototype.createControls=function(){this.$mainControl=$('
    '),this.$mainControl.css({width:this.options.width,height:this.options.height}),this.$parent.append(this.$mainControl),this.$mainControl.addClass(this.options.class),this.$headerControl=this.$mainControl.find(".brtc-va-wizardpage-header"),this.$headerControl.addClass(this.options.class),this.createHeaderArea(this.$headerControl),this.$contentsControl=this.$mainControl.find(".brtc-va-wizardpage-content"),this.$contentsControl.addClass(this.options.class),this.createContentsArea(this.$contentsControl);},e.prototype.createHeaderArea=function(t){},e.prototype.createContentsArea=function(t){},e.prototype.show=function(){this.$mainControl.show();},e.prototype.hide=function(){this.$mainControl.hide();},e.prototype.doFinish=function(t){t();},e.prototype.findActivatedInput=function(t){for(var e in t){if($(t[e]).hasClass("jqx-fill-state-focus"))return $(t[e]);}},e.prototype.destroy=function(){},t.VA.Core.Wizards.Pages.WizardPage=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){this.options=i,this.options.class="downloadloadingpage",t.VA.Core.Wizards.Pages.WizardPage.call(this,e,this.options);}e.prototype=Object.create(t.VA.Core.Wizards.Pages.WizardPage.prototype),e.prototype.constructor=e,e.prototype.init=function(){t.VA.Core.Wizards.Pages.WizardPage.prototype.init.call(this),this.doFinish();},e.prototype.createHeaderArea=function(t){},e.prototype.createContentsArea=function(t){var e=this.options.loadingText||"Preparing...";t.append($('
    '+e+'
    '));},e.prototype.doFinish=function(){var e=this,i=t.VA.Core.Utils.DownLoader,o=this.options.wizard.options.downloaderOptions,n=o.userId,r=o.mid,a=this.options.wizard.result.tid,s=this.options.wizard.result.fileName||o.fileName,l=this.options.wizard.result.delimiters;i.run(n,r,a,s,l,function(){e.options.wizard.$mainControl.dialog("destroy");},function(i){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(i,function(){e.options.wizard.$mainControl.dialog("destroy");});});},t.VA.Core.Wizards.Pages.DownloadLoadingPage=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){this.options=i,this.options.class="selectalluxiodatapage",t.VA.Core.Wizards.Pages.WizardPage.call(this,e,this.options),this.options.wizard.registerEvent("changeData");}e.prototype=Object.create(t.VA.Core.Wizards.Pages.WizardPage.prototype),e.prototype.constructor=e,e.prototype.init=function(){t.VA.Core.Wizards.Pages.WizardPage.prototype.init.call(this),this.options.wizard.$btnPrevious.jqxButton({disabled:!1}),this.options.wizard.$btnFinish.jqxButton({disabled:!0}),this.options.wizard.result.remotePath?this.options.wizard.$btnNext.jqxButton({disabled:!1}):this.options.wizard.$btnNext.jqxButton({disabled:!0}),this.options.wizard.result.data=this.options.wizard.result.data||[];},e.prototype.createHeaderArea=function(t){t.addClass("brtc-va-wizardpage-dataupload"),this.$wizardHeader=$('

    01 Select Data

    02 Set Delimiter

    03 Set Column Data Format

    '),t.append(this.$wizardHeader);},e.prototype.createContentsArea=function(e){e.addClass("brtc-va-wizardpage-dataupload");var i=this;e.append($('
    Select data consisting of delimiter-separated values.
    File:
    Select file to upload
    Add to:
    Shared
    '+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(t.VA.Env.Session.userId)+'
    Data preview
    no data
    '));var o=e.find("#fileselect-remote");e.find("#upload-to-shared-alluxio").jqxRadioButton({theme:t.VA.Env.Theme,height:25,width:100,boxSize:"18px",groupName:"alluxio"}),e.find("#upload-to-userid-alluxio").jqxRadioButton({theme:t.VA.Env.Theme,height:25,width:100,boxSize:"18px",groupName:"alluxio"}),e.find(".brtc-va-radio-button").on("checked",function(t){i.options.wizard.result.uploadTo=this.getAttribute("value");}),e.find("#upload-to-userid-alluxio").jqxRadioButton("check"),o.jqxButton({theme:t.VA.Env.Theme}),o.on("click",function(t){i.handleRemoteFileSelected(t);});},e.prototype.handleRemoteFileSelected=function(e){var i=this;new t.VA.Core.Dialogs.FilePathDialog($(e.target),{close:function close(e){if(e.OK){var o=e.name,n=i.$contentsControl.find(".filename");n.empty(),n.append($(''+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(o)+"")),i.reset(),$.ajax({method:"GET",url:"api/va/v2/data/head?length=20&path="+o,blocking:!0}).done(function(t){i.options.wizard.triggerEvent("changeData",!0),i.updateFileSelectPreview(t),i.refreshButton(!0),i.options.wizard.result.fileName=o.split("/").pop(),i.options.wizard.result.remotePath=o,i.options.wizard.$btnNext.jqxButton({disabled:!1});}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openErrorDialog("File does not exist.",function(){i.refreshButton();}),i.refreshButton();});}}});},e.prototype.updateFileSelectPreview=function(e){var i=e.split("\n"),o=this.$contentsControl.find(".preview.selectdata.alluxio").find(".contents"),n=0;this.options.wizard.result.data=[];for(var r=0;r"+n+"")),o.find(".data-column").append($("
  • "+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(i[r])+"
  • ")),this.options.wizard.result.data.push(i[r]),n++);}o.perfectScrollbar();},e.prototype.reset=function(){var t=this.$parent.find(".preview").find(".contents");this.options.wizard.result.fileName="",this.options.wizard.result.data=[],$("input[type=file]").val(""),t.empty(),t.append($('
      ')),t.append($('
        '));},e.prototype.refreshButton=function(t){},t.VA.Core.Wizards.Pages.SelectAlluxioDataPage=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(e,i){this.options=i,this.options.class="selectdelimiterpage",t.VA.Core.Wizards.Pages.WizardPage.call(this,e,this.options);var o=this;this.options.wizard.registerEvent("changeDelimiter"),this.options.wizard.addEventListener("changeData",function(t,e){e&&(o.options.wizard.result.delimiter=void 0);});}e.prototype=Object.create(t.VA.Core.Wizards.Pages.WizardPage.prototype),e.prototype.constructor=e,e.prototype.init=function(){t.VA.Core.Wizards.Pages.WizardPage.prototype.init.call(this),this.delimiterMap={comma:",",tab:"\t",semicolon:";",colon:":",space:" "},this.options.wizard.$btnPrevious.jqxButton({disabled:!1}),this.options.wizard.$btnFinish.jqxButton({disabled:!0}),this.options.wizard.result.delimiter?this.options.wizard.$btnNext.jqxButton({disabled:!1}):this.options.wizard.$btnNext.jqxButton({disabled:!0}),void 0===this.options.wizard.result.delimiter?this.$mainControl.find(".brtc-va-radio-button[value=comma]").val(!0):this.splitData(this.options.wizard.result.delimiter);},e.prototype.createHeaderArea=function(t){t.addClass("brtc-va-wizardpage-dataupload"),this.$wizardHeader=$('

        01 Select Data

        02 Set Delimiter

        03 Set Column Data Format

        '),t.append(this.$wizardHeader);},e.prototype.createContentsArea=function(e){var i=this;e.append($('
        Choose a delimiter for separating data.
        Delimiters:
        Comma
        Tab
        Space
        Colon
        SemiColon
        0Columns
        ')),e.find(".brtc-va-radio-button").jqxRadioButton({theme:t.VA.Env.Theme,height:25,width:95,boxSize:"18px",groupName:"delimiter"}),e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").jqxInput({theme:t.VA.Env.Theme,width:"70px",height:"24px"}),e.find(".brtc-va-column-delimiter .jqx-radiobutton").on("change",function(t){if(i.options.wizard.triggerEvent("changeDelimiter",!0),"INPUT"==t.target.tagName)i.options.wizard.result.delimiter=e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").val(),i.splitData(i.options.wizard.result.delimiter);else if(t.args.checked){var o=t.target.getAttribute("value");"other"==o?(i.options.wizard.result.delimiter=e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").val(),i.splitData(i.options.wizard.result.delimiter)):(i.options.wizard.result.delimiter=i.delimiterMap[o],i.splitData(i.options.wizard.result.delimiter));}i.options.wizard.result.delimiter&&i.options.wizard.result.data.length>1?(i.options.wizard.$btnNext.jqxButton({disabled:!1}),i.options.wizard.$btnNext.jqxButton({disabled:!1})):i.options.wizard.$btnNext.jqxButton({disabled:!0});}),this.createColumnGrid();},e.prototype.getColumnNameList=function(){var t=[];return this.options.wizard.result.data[0]&&(t=this.options.wizard.result.data[0].split(this.options.wizard.result.delimiter||",")),t;},e.prototype.splitData=function(t){var e=[],i=[];this.options.wizard.result.data[0]&&(e=this.options.wizard.result.data[0].split(t||this.options.wizard.result.delimiter),this.options.wizard.result.data[1]&&(i=this.options.wizard.result.data[1].split(t||this.options.wizard.result.delimiter))),this.setColumnGridData(e,i);},e.prototype.createColumnGrid=function(){var e=this.$mainControl.find(".column-preview .contents .delimiter-table"),i=$('
        ');e.append(i);var o=this._getFormattedGridData([]);this.$grid=i.jqxGrid({theme:t.VA.Env.Theme,width:619,height:265,rowsheight:25,source:o,selectionmode:"none",columnsresize:!0,columns:[{text:"No.",sortable:!1,filterable:!1,editable:!1,groupable:!1,draggable:!1,resizable:!1,datafield:"",columntype:"number",width:50,cellsrenderer:function cellsrenderer(t,e,i){return'
        '+(i+1)+"
        ";}},{text:"Column Name",datafield:"column",cellsrenderer:function cellsrenderer(t,e,i){var o=$('
        ');return o.attr("title",i),o.text(i),$("
        ").append(o.clone()).html();}},{text:"First Data",datafield:"column-data",cellsrenderer:function cellsrenderer(t,e,i){var o=$('
        ');return o.attr("title",i),o.text(i),$("
        ").append(o.clone()).html();}}]});},e.prototype.setColumnGridData=function(t,e){var i=this._getFormattedGridData(t,e);this.$grid.jqxGrid({source:i}),this.$mainControl.find(".column-row-length").text(t.length);},e.prototype._getFormattedGridData=function(t,e){for(var i=[],o=0;o

        Exporting...

        '),e.append(this.$progress),this.$progress.hide(),e.append($('
        Export File
        Select file to upload
        Delimiters
        Comma
        Tab
        Space
        Colon
        SemiColon
        ')),e.css({height:"400px"}),e.find(".brtc-va-radio-button").jqxRadioButton({theme:t.VA.Env.Theme,height:28,width:102,boxSize:"18px",groupName:"delimiter"}),e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").jqxInput({theme:t.VA.Env.Theme,width:77,height:25}),e.find(".brtc-va-column-delimiter .jqx-radiobutton").on("change",function(t){if("INPUT"==t.target.tagName)i.options.wizard.result.delimiter=e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").val();else if(t.args.checked){var o=t.target.getAttribute("value");i.options.wizard.result.delimiter="other"==o?e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").val():i.delimiterMap[o];}i.options.wizard.result.delimiter?i.options.wizard.$btnFinish.jqxButton({disabled:!1}):i.options.wizard.$btnFinish.jqxButton({disabled:!0});}),e.find(".brtc-va-column-delimiter .brtc-va-radio-button[value=other]").on("checked",function(){e.find(".brtc-va-column-delimiter .brtc-va-delimiter-input").jqxInput("focus");}),i.handleExportFileSelected();},e.prototype.handleExportFileSelected=function(){var e=this.options.wizard,i=this.$contentsControl.find(".filename");i.empty(),i.append($(''+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(e.options.name)+""));},e.prototype.doFinish=function(){var e=this;e.progress(!0,"Exporting...");var i=t.VA.Core.Utils.DownLoader;if("local"===this.options.wizard.result.copyFrom){var o=e.options.wizard.options.name,n=e.options.wizard.result.delimiter,r={};r.delimiter=n;var a=e.options.wizard.options.path;i.runStartWithExport(o,a,r,function(){e.progress(!1);},function(i){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(i,function(){e.$parent.parent().dialog("destroy");});});}},e.prototype.progress=function(e,i){var o=this;e?(this.$progress.show(),this.options.wizard.$btnFinish.jqxButton({disabled:e})):(this.$progress.hide(),i?t.VA.Core.Utils.WidgetUtils.openErrorDialog(i,function(){o.$parent.parent().dialog("destroy");}):t.VA.Core.Utils.WidgetUtils.openInformationDialog("Data Export preparation has been successfully completed. File Download will start.",function(){o.$parent.parent().dialog("destroy");})),this.options.wizard.$btnPrevious.jqxButton({disabled:e});},t.VA.Core.Wizards.Pages.SelectExportDelimiterPage=e;}.call(this),function(){"use strict";var t=this.Brightics;var e=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;function i(e,i){this.options=i,this.options.class="SelectExportJdbcPage",t.VA.Core.Wizards.Pages.WizardPage.call(this,e,this.options);}i.prototype=Object.create(t.VA.Core.Wizards.Pages.WizardPage.prototype),i.prototype.constructor=i,i.prototype.init=function(){t.VA.Core.Wizards.Pages.WizardPage.prototype.init.call(this),this.options.wizard.$btnPrevious.jqxButton({disabled:!1}),this.options.wizard.$btnFinish.jqxButton({disabled:!0}),this.$message.text(""),this.options.wizard.result.data=this.options.wizard.result.data||[],this.options.wizard.result.columnType=this.options.wizard.result.columnType||{},this.options.wizard.result.jdbc=this.options.wizard.result.jdbc||{},""!=this.$host.jqxInput("val")&&""!=this.$port.jqxInput("val")&&""!=this.$service.jqxInput("val")&&""!=this.$username.jqxInput("val")&&""!=this.$password.jqxInput("val")&&""!=this.$tablename.jqxInput("val")?this.$contentsControl.find(".connect").jqxButton({disabled:!1}):this.$contentsControl.find(".connect").jqxButton({disabled:!0});},i.prototype.createHeaderArea=function(t){},i.prototype.refreshConnectControl=function(){this.$message.text("");var i=this.$host.val(),o=this.$port.val(),n=this.$contentsControl.find(".connect");""!=i&&""!=o&&""!=this.$service.jqxInput("val")&&""!=this.$username.jqxInput("val")&&""!=this.$password.jqxInput("val")&&""!=this.$tablename.jqxInput("val")?n.jqxButton({disabled:!(e.test(i)&&t.VA.Core.Utils.InputValidator.isValid.integerType(o)&&o<65535)}):n.jqxButton({disabled:!0});},i.prototype.createContentsArea=function(i){t.VA.Core.Wizards.Pages.WizardPage.prototype.createContentsArea.call(this,i);var o=this;this.$progress=$('

        Exporting...

        '),i.append(this.$progress),this.$progress.hide(),i.append($('
        Export File :
        DB Type :
        Host :
        Port :
        Service :
        Username :
        Password :
        Table Name :
        Connection :