text: /*   Brightics VA Build 190731 */!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=30);}([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(32);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(44)();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(17),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(19),i=n(6),o=n(21),a=n(66);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";t.exports=function(t){return null!=t;};},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=$(['<div class="brtc-va-base-list">','  <div class="brtc-va-base-list-wrapper">','    <div class="brtc-va-base-list-content">',"    </div>","  </div>","</div>"].join("\n")),this.$wrapper=this.$template.find(".brtc-va-base-list-wrapper"),this.$wrapper.perfectScrollbar(),this.$content=this.$template.find(".brtc-va-base-list-content"),this._registerAllListeners(this.listeners),this.$content.jqxGrid(this.jqxOptions),this.$el.empty(),this.$el.append(this.$template),this._initEventListeners(),this;},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'<div class="brtc-va-base-list-column-header">'+_.escape(t)+"</div>";};},i.prototype._getDefaultDataRenderer=function(t,e){var n=[this._getAlignClass(e)].join(" ");return function(e,r,i){return this._wrap("<div>"+_.escape(this._format(i,t))+"</div>",n);}.bind(this);},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['<div class="'+e+'">',t,"</div>"].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(14);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(53),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(19),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(21),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(17);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(23),o=n(24);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(24),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(18),o=n(16),a=n(20),s=n(0),c=n(22),l=n(23),u=n(55),p=n(62),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<e.length;_t++){a[i=e[_t]]&&r[i].type===o&&a[i]&&(n=n.concat(a[i]));}}return n;},l.prototype.getOutTable=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){r[i]&&n[i].type===o&&r[i]&&(e=e.concat(r[i]));}}else e=t[OUT_DATA];return e;},l.prototype.getInModel=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===a&&r[i]&&(e=e.concat(r[i]));}}else;return e;},l.prototype.getOutModel=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){r[i]&&n[i].type===a&&r[i]&&(e=e.concat(r[i]));}}else;return e;},l.prototype.getInImage=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===s&&r[i]&&(e=e.concat(r[i]));}}else;return e;},l.prototype.getOutImage=function(t){var e=[],n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){r[i]&&n[i].type===s&&r[i]&&(e=e.concat(r[i]));}}else;return e;},l.prototype.getPreviousFnUnits=function(t){var e=this,n=[],r=this.getParent(t),i=r.getPrevious(t.fid);return _.forEach(i,function(t){var i=r.getFnUnitById(t),o=e.isProcessFunction(i)?r.getAllPreviousFnUnits(i.fid):[i];n=_.union(n,o);}),n;},l.prototype.getLinkedTable=function(t){var e=this,n=[],r=this.getPreviousFnUnits(t);return _.forEach(r,function(t){n=n.concat(e.getOutTable(t));}),n;},l.prototype.getTable=function(t,e){return"in"===e?this.getInTable(t):this.getOutTable(t);},l.prototype.getModel=function(t,e){return"in"===e?this.getInModel(t):this.getOutModel(t);},l.prototype.getImage=function(t,e){return"in"===e?this.getInImage(t):this.getOutImage(t);},l.prototype.hasMeta=function(t){return!!t.meta;},l.prototype.hasInput=function(t){var e=this._getPath(t,"in","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},l.prototype.hasOutput=function(t){var e=this._getPath(t,"out","data");return!!Brightics.VA.Core.Utils.CommonUtils.getObjByJsonPath(t,e);},l.prototype.getInRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getInputs(t);for(var i in r){var a=n[i].type;e[a]||(e[a]={min:0,max:0}),n[i].range?(e[a].min+=n[i].range.min,e[a].max+=n[i].range.max):(e[a].min+=1,e[a].max+=1);}}else{var s=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[o]=s["in-range"];}return e;},l.prototype.getOutRange=function(t){var e={},n=this.getMeta(t);if(n){var r=this.getOutputs(t);for(var i in r){var a=n[i].type;e[a]||(e[a]={min:1,max:1}),n[i].range&&(e[a].min=n[i].range.min,e[a].max=n[i].range.max);}}else{var s=Brightics.VA.Core.Utils.WidgetUtils.getFunctionLibrary("data",t.func);e[o]=s["out-range"];}return e;},l.prototype.getTotalInRangeCount=function(t){var e={min:0,max:0},n=this.getInRange(t);for(var r in n){e.min+=n[r].min,e.max+=n[r].max;}return e;},l.prototype.getTotalOutRangeCount=function(t){var e={min:0,max:0},n=this.getOutRange(t);for(var r in n){e.min+=n[r].min,e.max+=n[r].max;}return e;},l.prototype.getKeyByType=function(t,e,n){var r=this.getMeta(t);if(r){var i="in"===n?this.getInputs(t):this.getOutputs(t);for(var o in i){if(r[o].type===e)return o;}}},l.prototype.isProcessFunction=function(t){return["SetValue","ImportData","ExportData","brightics.function.io$unload_model"].indexOf(t[FUNCTION_NAME])>=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<d&&u++;}return 0!==u;},l.prototype.connect=function(t,e){var n=this.getOutData(t),r=this.getInputTypes(e),i={table:[],model:[],image:[]};for(var o in n){var a=n[o];i[s=this.getTypeByTableId(t,a)].push(a);}for(var s in i){0!==i[s].length&&r.indexOf(s)>-1&&this.addInData(e,s,i[s]);}},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<a.min;s++){i[OUT_DATA].push(Brightics.VA.Core.Utils.IDGenerator.table.id());}}return i;},l.prototype.wrapInputs=function(t){return Array.isArray(t)?{inData:t}:{inputs:t};},l.prototype.clearInData=function(t){if(this.hasInput(t))if(this.getMeta(t))for(var e in t.inputs){var n=Array.isArray(t.inputs[e])?[]:"";t.inputs[e]=n;}else t[IN_DATA]=[];},l.prototype.isArray=function(t){return Array.isArray(t);},l.prototype.getFunc=function(t){return t?t.func:"";},l.prototype.getName=function(t){return t?t.name:"";},l.prototype.getLabel=function(t){return t?t.display.label:"";},l.prototype.getId=function(t){return t?t.fid:"";},l.prototype.getParam=function(t){return t?t.param:{};},l.prototype.getKeyLabel=function(t,e){var n=this.getMeta(t);return _.isEmpty(n)?"":n[e].label?n[e].label:e;},l.prototype.getCategory=function(t){return this.getDefinition("data",t.func).category;},l.prototype.getContext=function(t){return t.context||"scala";},l.prototype.isFlexibleFunction=function(t){return"control"===this.getCategory(t)||"script"===this.getCategory(t)||"rowAppend"===this.getFunc(t);},l.prototype.inputChangable=function(t){return"script"!==this.getCategory(t)&&"rowAppend"!==this.getFunc(t);},l.prototype.getDataPanel=function(t,e){var n=Brightics.VA.Core.Editors.Sheet.Panels.DataPanel;if("out"===e){var r=this.getFunc(t);n=Brightics.VA.Implementation.DataFlow.Functions[r]&&Brightics.VA.Implementation.DataFlow.Functions[r].DataPanel||n;}return n;},l.prototype.getParent=function(t){return"function"==typeof t.parent?t.parent():Studio.getEditorContainer().getActiveModelEditor().getActiveModel();},l.prototype.hasTable=function(t){return this.getTypes(t).indexOf(o)>-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<n;i++){r+=(e="23456789abcdefghjkmnpqrstuvwxyz").charAt(Math.floor(Math.random()*e.length));}return r;},i={project:{id:function id(){return"p"+r(15);}},model:{id:function id(){return"m"+r(15);}},control:{id:function id(){return"c"+r(15);}},func:{id:function id(){return"f"+r(15);}},table:{id:function id(){return"t"+r(15);}},link:{id:function id(){return"k"+r(15);}},template:{id:function id(){return"t"+r(15);}},notice:{id:function id(){return"n"+r(15);}},send:{id:function id(){return"s"+r(39);}},report:{id:function id(t){return"r"+r(t||8);}},schedule:{id:function id(){return"j"+r(15);}},file:{id:function id(){return"f"+r(8);}},reportPage:{id:function id(){return"rp"+r(14);}},reportContent:{id:function id(){return"rc"+r(14);}},dataSource:{id:function id(){return"ds"+r(14);}},udf:{id:function id(t){return"udf_"+t+"_"+r(8);}},uuid:{id:function id(t){return r(t);}},importedFile:{id:function id(t){return"importedFile_"+r(8);}},version:{id:function id(t){return"v"+r(t||15);}}};t.exports=i;},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(3);function i(t,e){this.project={},this.children=[],t&&(this.project=t),e&&e instanceof Array&&(this.children=this.children.concat(e));}i.prototype.toJSON=function(){return{type:"project",data:this.project.toJSON(),children:_.map(this.children,function(t){return{type:t.getResourceName(),data:t.toJSON()};}),version:this.getCoreVersion()};},i.prototype.setProject=function(t){return this.project=t,this;},i.prototype.addFile=function(t){return this.children.add(t),this;},i.prototype.addFiles=function(t){return this.children=this.children.concat(t),this;},i.prototype.getProject=function(){return this.project;},i.prototype.getFiles=function(){return this.children;},i.prototype.getCoreVersion=function(){return r.CORE_VERSION;};},function(t,e,n){"use strict";n.d(e,"a",function(){return i;});var r=n(3);function i(t){this.data=[],t&&(t instanceof Array?this.data=this.data.concat(t):this.data.push(t));}i.prototype.toJSON=function(){return{type:"files",data:_.map(this.data,function(t){return{type:t.getResourceName(),data:t.toJSON(!0)};}),version:this.getCoreVersion()};},i.prototype.addFile=function(t){return this.data.push(t),this;},i.prototype.addFiles=function(t){return this.data=this.data.concat(t),this;},i.prototype.getFiles=function(){return this.data;},i.prototype.getCoreVersion=function(){return r.CORE_VERSION;};},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(31),i=n(52),o=n(22),a=n(25),s=n(26),c=n(63),l=n(64),u=n(65),p=n(1),d=n(10),h=n(0),f=n(27),g=n.n(f),v=n(67),y=n(9),m=n(70),b=n(71),C=n.n(b),w=n(72),I=n(73),A=n(74),x=n(3);window.__module__=window.__module__||{},window.brtc_require=function(t){return window.__module__[t];};var T=function T(t,e){window.__module__[t]=window.__module__[t]||{},window.__module__[t]=e;};T("DataStructures",{HashMap:o.a,ProjectTree:o.b,TreeNode:o.c}),T("Dao",{ProjectDao:i.c,FileDao:i.b,VersionDao:i.d,DatasourceDao:i.a}),T("Controls",r.a),T("ResourceManager",a.a),T("FnUnitUtils",s.a),T("FnUnitInputs",c.a),T("StatusBoard",u.a),T("KeyItems",l.a),T("Vo",{Project:d.c,File:d.a,Version:d.d,PROP_KEY:d.b}),_.forIn(d.b,function(t,e){window[e]=t;}),T("EventEmitter",p.a),T("ClassUtils",{inherits:h.a}),T("IDGenerator",g.a),T("ResourceService",v.a),T("PromiseUtils",{serial:y.b,parallel:y.a}),T("ObjectUtils",{get:m.b,updateProp:m.d,addProp:m.a,removeProp:m.c}),T("_",_),window.crel=C.a,T("crel",C.a),T("TabChannel",w.a),T("DATA_TYPES",I.a),T("modelDiff",A.a),T("ENV",x);},function(t,e,n){"use strict";n.d(e,"a",function(){return l;});var r=n(11),i=n(13),o=n(14),a=n(15),s=n(4),c=n(51),l={Wrapper:{ListWrapper:r.a,JqxListWrapper:i.a,DropdownWrapper:o.a,JqxDropdownWrapper:a.a},Base:s.a,ControlFactory:c.a};},function(t,e,n){"use strict";var r,i,o,a,s,c,l,u=n(33),p=n(50),d=Function.prototype.apply,h=Function.prototype.call,f=Object.create,g=Object.defineProperty,v=Object.defineProperties,y=Object.prototype.hasOwnProperty,m={configurable:!0,enumerable:!1,writable:!0};i=function i(t,e){var _n,i;return p(e),i=this,r.call(this,t,_n=function n(){o.call(i,t,_n),d.call(e,this,arguments);}),_n.__eeOnceListener__=e,this;},s={on:r=function r(t,e){var n;return p(e),y.call(this,"__ee__")?n=this.__ee__:(n=m.value=f(null),g(this,"__ee__",m),m.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this;},once:i,off:o=function o(t,e){var n,r,i,o;if(p(e),!y.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(r=n[t]))for(o=0;i=r[o];++o){i!==e&&i.__eeOnceListener__!==e||(2===r.length?n[t]=r[o?0:1]:r.splice(o,1));}else r!==e&&r.__eeOnceListener__!==e||delete n[t];return this;},emit:a=function a(t){var e,n,r,i,o;if(y.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e){o[e-1]=arguments[e];}for(i=i.slice(),e=0;r=i[e];++e){d.call(r,this,o);}}else switch(arguments.length){case 1:h.call(i,this);break;case 2:h.call(i,this,arguments[1]);break;case 3:h.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),e=1;e<n;++e){o[e-1]=arguments[e];}d.call(i,this,o);}}},c={on:u(r),once:u(i),off:u(o),emit:u(a)},l=v({},c),t.exports=e=function e(t){return null==t?f(l):v(Object(t),c);},e.methods=s;},function(t,e,n){"use strict";var r=n(12),i=n(34),o=n(38),a=n(46),s=n(47);(t.exports=function(t,e){var n,i,c,l,u;return arguments.length<2||"string"!=typeof t?(l=e,e=t,t=null):l=arguments[2],r(t)?(n=s.call(t,"c"),i=s.call(t,"e"),c=s.call(t,"w")):(n=c=!0,i=!1),u={value:e,configurable:n,enumerable:i,writable:c},l?o(a(l),u):u;}).gs=function(t,e,n){var c,l,u,p;return"string"!=typeof t?(u=n,n=e,e=t,t=null):u=arguments[3],r(e)?i(e)?r(n)?i(n)||(u=n,n=void 0):n=void 0:(u=e,e=n=void 0):e=void 0,r(t)?(c=s.call(t,"c"),l=s.call(t,"e")):(c=!0,l=!1),p={get:e,set:n,configurable:c,enumerable:l},u?o(a(u),p):p;};},function(t,e,n){"use strict";var r=n(35),i=/^\s*class[\s{\/}]/,o=Function.prototype.toString;t.exports=function(t){return!!r(t)&&!i.test(o.call(t));};},function(t,e,n){"use strict";var r=n(36);t.exports=function(t){if("function"!=typeof t)return!1;if(!hasOwnProperty.call(t,"length"))return!1;try{if("number"!=typeof t.length)return!1;if("function"!=typeof t.call)return!1;if("function"!=typeof t.apply)return!1;}catch(t){return!1;}return!r(t);};},function(t,e,n){"use strict";var r=n(37);t.exports=function(t){if(!r(t))return!1;try{return!!t.constructor&&t.constructor.prototype===t;}catch(t){return!1;}};},function(t,e,n){"use strict";var r=n(12),i={object:!0,function:!0,undefined:!0};t.exports=function(t){return!!r(t)&&hasOwnProperty.call(i,typeof t);};},function(t,e,n){"use strict";t.exports=n(39)()?Object.assign:n(40);},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy");};},function(t,e,n){"use strict";var r=n(41),i=n(45),o=Math.max;t.exports=function(t,e){var n,a,s,c=o(arguments.length,2);for(t=Object(i(t)),s=function s(r){try{t[r]=e[r];}catch(t){n||(n=t);}},a=1;a<c;++a){e=arguments[a],r(e).forEach(s);}if(void 0!==n)throw n;return t;};},function(t,e,n){"use strict";t.exports=n(42)()?Object.keys:n(43);},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0;}catch(t){return!1;}};},function(t,e,n){"use strict";var r=n(5),i=Object.keys;t.exports=function(t){return i(r(t)?Object(t):t);};},function(t,e,n){"use strict";t.exports=function(){};},function(t,e,n){"use strict";var r=n(5);t.exports=function(t){if(!r(t))throw new TypeError("Cannot use null or undefined");return t;};},function(t,e,n){"use strict";var r=n(5),i=Array.prototype.forEach,o=Object.create;t.exports=function(t){var e=o(null);return i.call(arguments,function(t){r(t)&&function(t,e){var n;for(n in t){e[n]=t[n];}}(Object(t),e);}),e;};},function(t,e,n){"use strict";t.exports=n(48)()?String.prototype.contains:n(49);},function(t,e,n){"use strict";var r="razdwatrzy";t.exports=function(){return"function"==typeof r.contains&&!0===r.contains("dwa")&&!1===r.contains("foo");};},function(t,e,n){"use strict";var r=String.prototype.indexOf;t.exports=function(t){return r.call(this,t,arguments[1])>-1;};},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t;};},function(t,e,n){"use strict";n.d(e,"a",function(){return o;});var r=n(13),i=n(15),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(16),i=n(18),o=n(20),a=n(54);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<i.length;s++){o(i[s]);}return o;}({1:[function(t,e,n){(function(r,i,o,a,s,c,l,u,p){"use strict";function d(t,e){return function(t,e){var n;if(void 0===(n="passthrough"!==e.algorithm?y.createHash(e.algorithm):new v()).write&&(n.write=n.update,n.end=n.update),g(e,n).dispatch(t),n.update||n.end(""),n.digest)return n.digest("buffer"===e.encoding?void 0:e.encoding);var r=n.read();return"buffer"===e.encoding?r:r.toString(e.encoding);}(t,e=h(t,e));}function h(t,e){if((e=e||{}).algorithm=e.algorithm||"sha1",e.encoding=e.encoding||"hex",e.excludeValues=!!e.excludeValues,e.algorithm=e.algorithm.toLowerCase(),e.encoding=e.encoding.toLowerCase(),e.ignoreUnknown=!0===e.ignoreUnknown,e.respectType=!1!==e.respectType,e.respectFunctionNames=!1!==e.respectFunctionNames,e.respectFunctionProperties=!1!==e.respectFunctionProperties,e.unorderedArrays=!0===e.unorderedArrays,e.unorderedSets=!1!==e.unorderedSets,e.unorderedObjects=!1!==e.unorderedObjects,e.replacer=e.replacer||void 0,e.excludeKeys=e.excludeKeys||void 0,void 0===t)throw new Error("Object argument required.");for(var n=0;n<m.length;++n){m[n].toLowerCase()===e.algorithm.toLowerCase()&&(e.algorithm=m[n]);}if(-1===m.indexOf(e.algorithm))throw new Error('Algorithm "'+e.algorithm+'"  not supported. supported values: '+m.join(", "));if(-1===b.indexOf(e.encoding)&&"passthrough"!==e.algorithm)throw new Error('Encoding "'+e.encoding+'"  not supported. supported values: '+b.join(", "));return e;}function f(t){if("function"!=typeof t)return!1;return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(t));}function g(t,e,n){n=n||[];var r=function r(t){return e.update?e.update(t,"utf8"):e.write(t,"utf8");};return{dispatch:function dispatch(e){t.replacer&&(e=t.replacer(e));var n=typeof e;return null===e&&(n="null"),this["_"+n](e);},_object:function _object(e){var i=Object.prototype.toString.call(e),a=/\[object (.*)\]/i.exec(i);a=(a=a?a[1]:"unknown:["+i+"]").toLowerCase();var s;if((s=n.indexOf(e))>=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:e<o?-1:e<o+10?e-o+26+26:e<s+26?e-s:e<a+26?e-a+26:void 0;}var n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="+".charCodeAt(0),i="/".charCodeAt(0),o="0".charCodeAt(0),a="a".charCodeAt(0),s="A".charCodeAt(0),c="-".charCodeAt(0),l="_".charCodeAt(0);t.toByteArray=function(t){function r(t){l[p++]=t;}var i,o,a,s,c,l;if(t.length%4>0)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<a;i+=4,o+=3){r((16711680&(s=e(t.charAt(i))<<18|e(t.charAt(i+1))<<12|e(t.charAt(i+2))<<6|e(t.charAt(i+3))))>>16),r((65280&s)>>8),r(255&s);}return 2===c?r(255&(s=e(t.charAt(i))<<2|e(t.charAt(i+1))>>4)):1===c&&(r((s=e(t.charAt(i))<<10|e(t.charAt(i+1))<<4|e(t.charAt(i+2))>>2)>>8&255),r(255&s)),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<o;r+=3){s+=n(i=(t[r]<<16)+(t[r+1]<<8)+t[r+2]);}switch(a){case 1:s+=e((i=t[t.length-1])>>2),s+=e(i<<4&63),s+="==";break;case 2:s+=e((i=(t[t.length-2]<<8)+t[t.length-1])>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="=";}return s;};}(void 0===n?this.base64js={}:n);}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib");},{buffer:3,lYpoI2:10}],3:[function(t,e,n){(function(e,r,i,o,a,s,c,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;a<r;a++){i.isBuffer(t)?o[a]=t.readUInt8(a):o[a]=t[a];}else if("string"===s)o.write(t,0,e);else if("number"===s&&!i._useTypedArrays&&!n)for(a=0;a<r;a++){o[a]=0;}return o;}function p(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=e.length;P(a%2==0,"Invalid hex string"),r>a/2&&(r=a/2);for(var s=0;s<r;s++){var c=parseInt(e.substr(2*s,2),16);P(!isNaN(c),"Invalid hex string"),t[n+s]=c;}return i._charsWritten=2*s,s;}function d(t,e,n,r){return i._charsWritten=B(j(e),t,n,r);}function h(t,e,n,r){return i._charsWritten=B(function(t){for(var e=[],n=0;n<t.length;n++){e.push(255&t.charCodeAt(n));}return e;}(e),t,n,r);}function f(t,e,n,r){return i._charsWritten=B(U(e),t,n,r);}function g(t,e,n,r){return i._charsWritten=B(function(t){for(var e,n,r,i=[],o=0;o<t.length;o++){e=t.charCodeAt(o),n=e>>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<n;i++){r+=String.fromCharCode(t[i]);}return r;}function y(t,e,n,r){r||(P("boolean"==typeof n,"missing or invalid endian"),P(null!=e,"missing offset"),P(e+1<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(i=t[e],e+1<o&&(i|=t[e+1]<<8)):(i=t[e]<<8,e+1<o&&(i|=t[e+1])),i;}function m(t,e,n,r){r||(P("boolean"==typeof n,"missing or invalid endian"),P(null!=e,"missing offset"),P(e+3<t.length,"Trying to read beyond buffer length"));var i,o=t.length;if(!(e>=o))return n?(e+2<o&&(i=t[e+2]<<16),e+1<o&&(i|=t[e+1]<<8),i|=t[e],e+3<o&&(i+=t[e+3]<<24>>>0)):(e+1<o&&(i=t[e+1]<<16),e+2<o&&(i|=t[e+2]<<8),e+3<o&&(i|=t[e+3]),i+=t[e]<<24>>>0),i;}function b(t,e,n,r){if(r||(P("boolean"==typeof n,"missing or invalid endian"),P(null!=e,"missing offset"),P(e+1<t.length,"Trying to read beyond buffer length")),!(e>=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,"Trying to read beyond buffer length")),!(e>=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<t.length,"Trying to read beyond buffer length")),R.read(t,e,n,23,4);}function _(t,e,n,r){return r||(P("boolean"==typeof n,"missing or invalid endian"),P(e+7<t.length,"Trying to read beyond buffer length")),R.read(t,e,n,52,8);}function I(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,"trying to write beyond buffer length"),k(e,65535));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,2);a<s;a++){t[n+a]=(e&255<<8*(r?a:1-a))>>>8*(r?a:1-a);}}function 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<t.length,"trying to write beyond buffer length"),k(e,4294967295));var o=t.length;if(!(n>=o))for(var a=0,s=Math.min(o-n,4);a<s;a++){t[n+a]=e>>>8*(r?a:3-a)&255;}}function 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,"Trying to write beyond buffer length"),N(e,32767,-32768)),n>=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,"Trying to write beyond buffer length"),N(e,2147483647,-2147483648)),n>=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,"Trying to write beyond buffer length"),M(e,3.4028234663852886e38,-3.4028234663852886e38)),n>=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,"Trying to write beyond buffer length"),M(e,1.7976931348623157e308,-1.7976931348623157e308)),n>=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<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(t.charCodeAt(n));else{var i=n;r>=55296&&r<=57343&&n++;for(var o=encodeURIComponent(t.slice(i,n+1)).substr(1).split("%"),a=0;a<o.length;a++){e.push(parseInt(o[a],16));}}}return e;}function U(t){return L.toByteArray(t);}function B(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);i++){e[i+n]=t[i];}return i;}function 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;n<t.length;n++){e+=t[n].length;}var r=new i(e),o=0;for(n=0;n<t.length;n++){var a=t[n];a.copy(r,o),o+=a.length;}return r;},i.prototype.write=function(t,e,n,r){if(isFinite(e))isFinite(n)||(r=n,n=void 0);else{var i=r;r=e,e=n,n=i;}e=Number(e)||0;var o,a=this.length-e;switch(n?(n=Number(n))>a&&(n=a):n=a,r=String(r||"utf8").toLowerCase()){case"hex":o=p(this,t,e,n);break;case"utf8":case"utf-8":o=d(this,t,e,n);break;case"ascii":o=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;o++){i+=O(t[o]);}return i;}(i,e,n);break;case"utf8":case"utf-8":r=function(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var o=e;o<n;o++){t[o]<=127?(r+=S(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);}return r+S(i);}(i,e,n);break;case"ascii":r=v(i,e,n);break;case"binary":r=function(t,e,n){return v(t,e,n);}(i,e,n);break;case"base64":r=function(t,e,n){return 0===e&&n===t.length?L.fromByteArray(t):L.fromByteArray(t.slice(e,n));}(i,e,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2){i+=String.fromCharCode(r[o]+256*r[o+1]);}return i;}(i,e,n);break;default:throw new Error("Unknown encoding");}return r;},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)};},i.prototype.copy=function(t,e,n,r){var o=this;if(n||(n=0),r||0===r||(r=this.length),e||(e=0),r!==n&&0!==t.length&&0!==o.length){P(r>=n,"sourceEnd < sourceStart"),P(e>=0&&e<t.length,"targetStart out of bounds"),P(n>=0&&n<o.length,"sourceStart out of bounds"),P(r>=0&&r<=o.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var a=r-n;if(a<100||!i._useTypedArrays)for(var s=0;s<a;s++){t[s+e]=this[s+n];}else t._set(this.subarray(n,n+a),e);}},i.prototype.slice=function(t,e){var n=this.length;if(t=E(t,n,0),e=E(e,n,n),i._useTypedArrays)return i._augment(this.subarray(t,e));for(var r=e-t,o=new i(r,void 0,!0),a=0;a<r;a++){o[a]=this[a+t];}return o;},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t);},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e);},i.prototype.readUInt8=function(t,e){if(e||(P(null!=t,"missing offset"),P(t<this.length,"Trying to read beyond buffer length")),!(t>=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,"Trying to read beyond buffer length")),!(t>=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t];},i.prototype.readInt16LE=function(t,e){return b(this,t,!0,e);},i.prototype.readInt16BE=function(t,e){return b(this,t,!1,e);},i.prototype.readInt32LE=function(t,e){return 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,"trying to write beyond buffer length"),k(t,255)),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,"Trying to write beyond buffer length"),N(t,127,-128)),e>=this.length||(t>=0?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n));},i.prototype.writeInt16LE=function(t,e,n){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<this.length,"start out of bounds"),P(n>=0&&n<=this.length,"end out of bounds");for(var r=e;r<n;r++){this[r]=t;}}},i.prototype.inspect=function(){for(var t=[],e=this.length,r=0;r<e;r++){if(t[r]=O(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break;}}return"<Buffer "+t.join(" ")+">";},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e<n;e+=1){t[e]=this[e];}return t.buffer;}throw new Error("Buffer.toArrayBuffer not supported in this browser");};var W=i.prototype;i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=W.get,t.set=W.set,t.write=W.write,t.toString=W.toString,t.toLocaleString=W.toString,t.toJSON=W.toJSON,t.copy=W.copy,t.slice=W.slice,t.readUInt8=W.readUInt8,t.readUInt16LE=W.readUInt16LE,t.readUInt16BE=W.readUInt16BE,t.readUInt32LE=W.readUInt32LE,t.readUInt32BE=W.readUInt32BE,t.readInt8=W.readInt8,t.readInt16LE=W.readInt16LE,t.readInt16BE=W.readInt16BE,t.readInt32LE=W.readInt32LE,t.readInt32BE=W.readInt32BE,t.readFloatLE=W.readFloatLE,t.readFloatBE=W.readFloatBE,t.readDoubleLE=W.readDoubleLE,t.readDoubleBE=W.readDoubleBE,t.writeUInt8=W.writeUInt8,t.writeUInt16LE=W.writeUInt16LE,t.writeUInt16BE=W.writeUInt16BE,t.writeUInt32LE=W.writeUInt32LE,t.writeUInt32BE=W.writeUInt32BE,t.writeInt8=W.writeInt8,t.writeInt16LE=W.writeInt16LE,t.writeInt16BE=W.writeInt16BE,t.writeInt32LE=W.writeInt32LE,t.writeInt32BE=W.writeInt32BE,t.writeFloatLE=W.writeFloatLE,t.writeFloatBE=W.writeFloatBE,t.writeDoubleLE=W.writeDoubleLE,t.writeDoubleBE=W.writeDoubleBE,t.fill=W.fill,t.inspect=W.inspect,t.toArrayBuffer=W.toArrayBuffer,t;};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer");},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){i=t("buffer").Buffer;var p=4,d=new i(p);d.fill(0);var h=8;e.exports={hash:function hash(t,e,n,r){return i.isBuffer(t)||(t=new i(t)),function(t,e,n){for(var r=new i(e),o=n?r.writeInt32BE:r.writeInt32LE,a=0;a<t.length;a++){o.call(r,t[a],4*a,!0);}return r;}(e(function(t,e){if(t.length%p!=0){var n=t.length+(p-t.length%p);t=i.concat([t,d],n);}for(var r=[],o=e?t.readInt32BE:t.readInt32LE,a=0;a<t.length;a+=p){r.push(o.call(t,a));}return r;}(t,r),t.length*h),n,r);}};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{buffer:3,lYpoI2:10}],5:[function(t,e,n){(function(e,r,i,o,a,s,c,l,u){function p(t,e){var n=v[t=t||"sha1"],r=[];return n||d("algorithm:",t,"is not yet supported"),{update:function update(t){return i.isBuffer(t)||(t=new i(t)),r.push(t),t.length,this;},digest:function digest(t){var o=i.concat(r),a=e?function(t,e,n){i.isBuffer(e)||(e=new i(e)),i.isBuffer(n)||(n=new i(n)),e.length>y?e=t(e):e.length<y&&(e=i.concat([e,m],y));for(var r=new i(y),o=new i(y),a=0;a<y;a++){r[a]=54^e[a],o[a]=92^e[a];}var s=t(i.concat([r,n]));return t(i.concat([o,s]));}(n,e,o):n(o);return r=null,t?a.toString(t):a;}};}function d(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"));}i=t("buffer").Buffer;var h=t("./sha"),f=t("./sha256"),g=t("./rng"),v={sha1:h,sha256:f,md5:t("./md5")},y=64,m=new i(y);m.fill(0),n.createHash=function(t){return p(t);},n.createHmac=function(t,e){return p(t,e);},n.randomBytes=function(t,e){if(!e||!e.call)return new i(g(t));try{e.call(this,void 0,new i(g(t)));}catch(t){e(t);}},function(t,e){for(var n in t){e(t[n],n);}}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(t){n[t]=function(){d("sorry,",t,"is not implemented yet");};});}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(t,e,n){(function(n,r,i,o,a,s,c,l,u){function p(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,c=r,l=i,u=o;n=h(n,r,i,o,t[a+0],7,-680876936),o=h(o,n,r,i,t[a+1],12,-389564586),i=h(i,o,n,r,t[a+2],17,606105819),r=h(r,i,o,n,t[a+3],22,-1044525330),n=h(n,r,i,o,t[a+4],7,-176418897),o=h(o,n,r,i,t[a+5],12,1200080426),i=h(i,o,n,r,t[a+6],17,-1473231341),r=h(r,i,o,n,t[a+7],22,-45705983),n=h(n,r,i,o,t[a+8],7,1770035416),o=h(o,n,r,i,t[a+9],12,-1958414417),i=h(i,o,n,r,t[a+10],17,-42063),r=h(r,i,o,n,t[a+11],22,-1990404162),n=h(n,r,i,o,t[a+12],7,1804603682),o=h(o,n,r,i,t[a+13],12,-40341101),i=h(i,o,n,r,t[a+14],17,-1502002290),n=f(n,r=h(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=f(o,n,r,i,t[a+6],9,-1069501632),i=f(i,o,n,r,t[a+11],14,643717713),r=f(r,i,o,n,t[a+0],20,-373897302),n=f(n,r,i,o,t[a+5],5,-701558691),o=f(o,n,r,i,t[a+10],9,38016083),i=f(i,o,n,r,t[a+15],14,-660478335),r=f(r,i,o,n,t[a+4],20,-405537848),n=f(n,r,i,o,t[a+9],5,568446438),o=f(o,n,r,i,t[a+14],9,-1019803690),i=f(i,o,n,r,t[a+3],14,-187363961),r=f(r,i,o,n,t[a+8],20,1163531501),n=f(n,r,i,o,t[a+13],5,-1444681467),o=f(o,n,r,i,t[a+2],9,-51403784),i=f(i,o,n,r,t[a+7],14,1735328473),n=g(n,r=f(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=g(o,n,r,i,t[a+8],11,-2022574463),i=g(i,o,n,r,t[a+11],16,1839030562),r=g(r,i,o,n,t[a+14],23,-35309556),n=g(n,r,i,o,t[a+1],4,-1530992060),o=g(o,n,r,i,t[a+4],11,1272893353),i=g(i,o,n,r,t[a+7],16,-155497632),r=g(r,i,o,n,t[a+10],23,-1094730640),n=g(n,r,i,o,t[a+13],4,681279174),o=g(o,n,r,i,t[a+0],11,-358537222),i=g(i,o,n,r,t[a+3],16,-722521979),r=g(r,i,o,n,t[a+6],23,76029189),n=g(n,r,i,o,t[a+9],4,-640364487),o=g(o,n,r,i,t[a+12],11,-421815835),i=g(i,o,n,r,t[a+15],16,530742520),n=v(n,r=g(r,i,o,n,t[a+2],23,-995338651),i,o,t[a+0],6,-198630844),o=v(o,n,r,i,t[a+7],10,1126891415),i=v(i,o,n,r,t[a+14],15,-1416354905),r=v(r,i,o,n,t[a+5],21,-57434055),n=v(n,r,i,o,t[a+12],6,1700485571),o=v(o,n,r,i,t[a+3],10,-1894986606),i=v(i,o,n,r,t[a+10],15,-1051523),r=v(r,i,o,n,t[a+1],21,-2054922799),n=v(n,r,i,o,t[a+8],6,1873313359),o=v(o,n,r,i,t[a+15],10,-30611744),i=v(i,o,n,r,t[a+6],15,-1560198380),r=v(r,i,o,n,t[a+13],21,1309151649),n=v(n,r,i,o,t[a+4],6,-145523070),o=v(o,n,r,i,t[a+11],10,-1120210379),i=v(i,o,n,r,t[a+2],15,718787259),r=v(r,i,o,n,t[a+9],21,-343485551),n=y(n,s),r=y(r,c),i=y(i,l),o=y(o,u);}return Array(n,r,i,o);}function d(t,e,n,r,i,o){return y(function(t,e){return t<<e|t>>>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<t.length;c+=16){for(var l=r,u=i,p=o,v=a,y=s,m=0;m<80;m++){n[m]=m<16?t[c+m]:g(n[m-3]^n[m-8]^n[m-14]^n[m-16],1);var b=f(f(g(r,5),d(m,i,o,a)),f(f(s,n[m]),h(m)));s=a,a=o,o=g(i,30),i=r,r=b;}r=f(r,l),i=f(i,u),o=f(o,p),a=f(a,v),s=f(s,y);}return Array(r,i,o,a,s);}function d(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r;}function h(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514;}function f(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n;}function g(t,e){return t<<e|t>>>32-e;}var 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;_<t.length;_+=16){n=f[0],r=f[1],i=f[2],o=f[3],a=f[4],s=f[5],c=f[6],l=f[7];for(var I=0;I<64;I++){w[I]=I<16?t[I+_]:d(d(d(C(w[I-2]),w[I-7]),b(w[I-15])),w[I-16]),u=d(d(d(d(l,m(a)),g(a,s,c)),h[I]),w[I]),p=d(y(n),v(n,r,i)),l=c,c=s,s=a,a=d(o,u),o=i,i=r,r=n,n=d(u,p);}f[0]=d(n,f[0]),f[1]=d(r,f[1]),f[2]=d(i,f[2]),f[3]=d(o,f[3]),f[4]=d(a,f[4]),f[5]=d(s,f[5]),f[6]=d(c,f[6]),f[7]=d(l,f[7]);}return f;};e.exports=function(t){return p.hash(t,w,32,!0);};}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify");},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(t,e,n){(function(t,n,r,i,o,a,s,c,l){function u(){}(t=e.exports={}).nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t);};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;(e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)&&n.shift()();},!0),function(t){n.push(t),window.postMessage("process-tick","*");};}return function(t){setTimeout(t,0);};}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=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<<s)-1,l=c>>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<<l)-1,p=u>>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<<i|s,l+=i;l>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(56);n.d(e,"a",function(){return r.a;});},function(t,e,n){"use strict";n(57),n(58);var r=n(59);n(60),n(61);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(26);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=$('<div class="brtc-va-editors-sheet-controls-input-list">   <div class="brtc-va-editors-sheet-controls-input-list-content"/></div>');e.attr("autoArrange",t.autoArrange||!1);var n=$('<div class="brtc-va-editors-sheet-controls-input-list-container"></div>');e.append(n),t.appendTo.append(e);},o.prototype.createInputs=function(t){var e=this,n=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<i;o++){var a={type:"table",tableId:n[o],key:"["+o+"]"+r.a.getLabel(t.fnUnit),fnUnit:t.fnUnit,appendTo:t.appendTo,emptyLabel:t.emptyLabel,readOnly:t.readOnly,autoArrange:!0};e.createInputUnit(a);}}},o.prototype.enableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("enable");},o.prototype.disableDragEvent=function(t){var e=t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper");this.isDraggable(e)&&e.draggable("disable");},o.prototype.isDraggable=function(t){return(t.hasClass("brtc-style-controls-inputselector-box-wrapper")?t:t.closest(".brtc-style-controls-inputselector-box-wrapper")).hasClass("ui-draggable");},o.prototype.createInputUnit=function(t){var e=t.key,n=t.tableId,i=t.type,o=t.fnUnit,a=this.getPrevFnUnitByInTableId(o,n),s=t.readOnly,c=t.autoArrange,l=this.createBox({appendTo:t.appendTo,label:e,type:i});!t.readOnly&&_.isEqual(this.DATA_TYPE,"array")&&(this.createDragEvent(t.appendTo,l),n?this.enableDragEvent(l):this.disableDragEvent(l)),"array"!==this.DATA_TYPE||s||l.css("cursor","move"),l.attr("key",e),l.attr("type",i),l.attr("table-id",n);var u=l.find(".brtc-style-controls-inputselector-box-contents"),p=u.find(".brtc-style-controls-inputselector-box-contents-figure"),d=u.find(".brtc-style-controls-inputselector-box-contents-remove"),h=u.find(".brtc-style-controls-inputselector-box-key");t.appendTo.find(".brtc-va-editors-sheet-controls-input-list-container").append(l),u.append(f);var f=this.createEmptyItem({parent:p,type:i,label:t.emptyLabel,readOnly:s}),g=this.createFuncItem({label:r.a.getLabel(a),func:r.a.getFunc(a),type:r.a.getTypeByTableId(a,n),tableId:n}),v=r.a.getOutputsToObject(a),y=this.createKeyItem({key:v[n],type:i}),m=this.createRemoveButton({autoArrange:c});return p.append(g),h.append(y),s||d.append(m),s||this.createDropEvent(l),n?(f.hide(),g.show(),y.show(),m.show()):(f.show(),g.hide(),y.hide(),m.hide()),this.registerRemoveEvent(m),l;},o.prototype.getPrevFnUnitByInTableId=function(t,e){if(t){var n=r.a.getPreviousFnUnits(t);for(var i in n){var o=r.a.getOutData(n[i]);if(o&&o.indexOf(e)>-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=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-title brtc-style-ellipsis"><div class="icon"></div><div class="brtc-label"></div></div>'),i=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),o=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return n.append(r).append(i),i.append(o),r.find(".icon").attr("type",e),r.find(".brtc-label").text(t),n;},o.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").addClass("brtc-style-ellipsis"),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},o.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-ellipsis brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),r.attr("title",t.key),n.append(this.createTypeIcon(t.type)),e;},o.prototype.createTypeIcon=function(t){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon"></div>').attr("type",t);},o.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty">   <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o;},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 $('<span class="brtc-va-tools-sidebar-variable-remove"></span>');},o.prototype.registerRemoveEvent=function(t){var e=this;t.off("click"),t.click(function(){var t=e.getMainArea($(this)),n=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),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=$('<div class="brtc-style-controls-inputselector-box-wrapper"></div>');e.css("width","100%"),e.css("height","55px");var n=$('<div class="brtc-style-controls-inputselector-box-contents"><div class="brtc-style-controls-inputselector-box-contents-figure"></div><div class="brtc-style-controls-inputselector-box-contents-remove"></div></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key"></div>');return e.append(n),n.append(r),e;},r.prototype.createFuncItem=function(t){var e=t.label,n=t.func,r=t.type,i=t.tableId,o=$('<div class="brtc-va-editors-sheet-controls-inputselector-item"></div>'),a=Brightics.VA.Core.Utils.WidgetUtils.createPaletteBox({func:n,label:e});return o.append(a),a.find(".brtc-va-views-palette-fnunit-label").text(e),o.attr("table-id",i),o.attr("type",r),a.find(".brtc-va-views-palette-fnunit-label").text(e),a.attr("title",e),a.addClass("item"),o;},r.prototype.createKeyItem=function(t){var e=$('<div class="brtc-style-controls-inputselector-box-key-wrapper"></div>'),n=$('<div class="brtc-style-controls-inputselector-box-key-type"></div>'),r=$('<div class="brtc-style-controls-inputselector-box-key-label"></div>');return e.append(n).append(r),r.text(t.key),n.append(this.createTypeIcon()),e;},r.prototype.createTypeIcon=function(){return $('<div class="brtc-style-controls-inputselector-box-key-type-icon" type="table"></div>');},r.prototype.createEmptyItem=function(t){var e=t.label||"Drop Data",n=t.parent,r=t.type,i=t.readOnly,o=$('<div class="brtc-va-fnunit-input-empty">   <div>'+e+"</div></div>");return n.append(o),i||this.createDropEvent(o,r),o;},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=$('<span class="brtc-va-tools-sidebar-variable-remove"></span>');return e.click(function(){var e=$(this).closest(".brtc-style-controls-inputselector-box-wrapper"),n=e.find(".brtc-va-editors-sheet-controls-inputselector-item"),r=e.find(".brtc-style-controls-inputselector-box-key-wrapper"),i=e.find(".brtc-va-fnunit-input-empty");e.find(".brtc-va-tools-sidebar-variable-remove").hide(),r.hide(),n.hide(),i.show(),t.handleRemove($(this));}),e;},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(68);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(25),o=n(8),a=n(9),s=n(28),c=n(29),l=n(69),u=n(27),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(29),o=n(28);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;){i=i[e[n]];}return i;}catch(t){return;}}(t,e):t[e];},i=function i(t){return _.clone(t);},o=function o(t,e,n){for(var r=t,o=-1,a=e.length;++o<a-1;){r=r[e[o]];}var s=i(r[e[e.length-1]]);return r[e[e.length-1]]=i(n),s;},a=function a(t,e,n){for(var r=t,o=-1,a=e.length;++o<a-1;){r=r[e[o]];}Array.isArray(r)?r.splice(e[e.length-1],0,n):r[e[e.length-1]]=i(n);},s=function s(t,e){for(var n=t,r=-1,o=e.length;++r<o-1;){n=n[e[r]];}var a=i(n[e[e.length-1]]);return Array.isArray(n)?n.splice(e[e.length-1],1):delete n[e[e.length-1]],a;};},function(t,e,n){var r;r=function r(){var t="function",e="object",n="textContent",r="setAttribute",i="attrMap",o="isNode",a="isElement",s=typeof document===e?document:{},c=function c(t,e){return typeof t===e;},l=typeof Node===t?function(t){return t instanceof Node;}:function(t){return t&&c(t,e)&&"nodeType"in t&&c(t.ownerDocument,e);},u=function u(t){return t instanceof Array;},p=function p(t,e){u(e)?e.map(function(e){p(t,e);}):(d[o](e)||(e=s.createTextNode(e)),t.appendChild(e));};function d(){var l,h=arguments,f=h[0],g=h[1],v=2,y=h.length,m=d[i];if(f=d[a](f)?f:s.createElement(f),1===y)return f;if((!c(g,e)||d[o](g)||u(g))&&(--v,g=null),y-v==1&&c(h[v],"string")&&void 0!==f[n])f[n]=h[v];else for(;v<y;++v){if(null!=(l=h[v]))if(u(l))for(var b=0;b<l.length;++b){p(f,l[b]);}else p(f,l);}for(var C in g){if(m[C]){var w=m[C];typeof w===t?w(f,g[C]):f[r](w,g[C]);}else c(g[C],t)?f[C]=g[C]:f[r](C,g[C]);}return f;}return d[i]={},d[a]=function(t){return d[o](t)&&1===t.nodeType;},d[o]=l,"undefined"!=typeof Proxy&&(d.proxy=new Proxy(d,{get:function get(t,e){return!(e in d)&&(d[e]=d.bind(null,e)),d[e];}})),d;},t.exports=r();},function(t,e,n){"use strict";e.a=i;var r=n(1);function i(t){var e;this.ee=new r.a(),this.connectionKey=t,window.addEventListener("storage",(e=this.ee,function(t){var n=t.key,r=JSON.parse(t.newValue)||{};e.emit(n,r);}));}i.prototype.request=function(t,e,n){var r=this,i=(n||{}).timeout||5e3;return new Promise(function(n,o){var a=Date.now(),s="req_"+a,c=function c(e){e.connectionKey===r.connectionKey&&e.requestKey===s&&(n(e.value),r.off(t,c));};r.on(t,c),setTimeout(function(){o(new Error("TIMEOUT")),r.off(t,c);},i),r.emit(t,{timestamp:a,requestKey:"req_"+a,connectionKey:r.connectionKey,value:e,timeout:i});});},i.prototype.setConnectionKey=function(t){this.connectionKey=t;},i.prototype.getConnectionKey=function(){return this.connectionKey;},i.prototype.listen=function(t,e){var n=this;n.on(t,function(r){if(r.connectionKey===n.connectionKey){var i=Date.now();i-r.timestamp>=r.timeout||n.emit(t,_.assign({},r,{value:e(r),timestamp:i,responseKey:"res_"+i}));}});},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<string>":{type:"string[]",internalType:"String[]"},"array<double>":{type:"number[]",internalType:"Double[]"},"array<long>":{type:"number[]",internalType:"Long[]"},"array<int>":{type:"number[]",internalType:"Integer[]"},"array<integer>":{type:"number[]",internalType:"Integer[]"},"array<tinyint>":{type:"byte[]",internalType:"Byte[]"},"map<integer,double>":{type:"map",internalType:"Map(Integer,Double)"},"map<string,double>":{type:"map",internalType:"Map(String,Double)"},"map<int,double>":{type:"map",internalType:"Map(Integer,Double)"}};},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<n.length;r++){for(var i=n[r];" "==i.charAt(0);){i=i.substring(1);}if(0==i.indexOf(e))return i.substring(e.length,i.length);}}},this.Brightics.VA.Env.SQLFunctions=["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"],this.Brightics.VA.Env.PersistFalseFunctions=[];}.call(this),function(){"use strict";var t={},e=brtc_require("crel");t.USER_INPT_ARR_DELIMETER="[i]",this.Brightics.VA.Core.Utils.CommonUtils={getUserBrowserName:function getUserBrowserName(){!!window.chrome&&window.chrome.webstore;return window.navigator.userAgent.indexOf("Chrome")>=0?"Chrome":document.documentMode?"Internet Explorer":!!window.opr&&!!opr.addons||!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0?"Opera":"undefined"!=typeof InstallTrigger?"Firefox":Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||"[object SafariRemoteNotification]"===(!window.safari||safari.pushNotification).toString()?"Safari":void 0;},downloadJsonFile:function 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<a.length;s++){e.indexOf(".")>-1&&o.push(this.fetchFromObject(e.substr(i+4),a[s]));}return o.length>0?o:a;}return r>-1?this.fetchFromObject(e.substr(r+1),n[e.substring(0,r)]):n[e];}catch(t){console.error(e),console.error(t);}},isPC:function isPC(){var t=!0;return["win16","win32","win64","macintel","mac"].indexOf(navigator.platform.toLowerCase())<0&&(t=!1),t;},byteCalculation:function byteCalculation(t){t=parseInt(t);var e=["bytes","KB","MB","GB","TB","PB"],n=Math.floor(Math.log(t)/Math.log(1024));return"-Infinity"==n?"0 "+e[0]:(t/Math.pow(1024,Math.floor(n))).toFixed(2)+" "+e[n];},getQueryString:function getQueryString(t){return _.map(t,function(t,e){return e+"="+t;}).join("&");},getObjByJsonPath:function getObjByJsonPath(t,e){var n=$.extend(!0,{},t);return Array.isArray(e)?e.reduce(function(t,e,n,r){return t=t&&t[e]?t[e]:void 0;},n):n[e];},removeArrayElement:function removeArrayElement(t,e){_.remove(t,function(t){return e.indexOf(t)>-1;});},dim:function dim(t,n){var 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=$('   <div class="brtc-va-progress">       <div>           <span class="brtc-va-progress-loading"/>           <p>'+i+"</p>"+(r?'<p class="brtc-va-progress-percent"></p>':"")+"       </div></div>");return s.css("top","0"),s.css("left","0"),o.append(s),a.then(function(t){return s.remove(),t;}).catch(function(t){throw s.remove(),t;});}};}.call(this),function(){"use strict";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=$('<div class="brtc-va-views-palette-fnunit-content">'),a=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable">   <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div>   <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');o.append(a);var s=!1,c=Brightics.VA.Core.Interface.WidgetUtils[n];if(c&&c.createPaletteItem){var 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=$('<div class="brtc-va-views-palette-fnunit-content">'),s=$('<div class="brtc-va-views-palette-fnunit brtc-style-views-palette-fnunit brtc-va-studio-dm-draggable">   <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div>   <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div>   <div class="brtc-va-views-palette-fnunit-remove-icon brtc-style-views-palette-fnunit-remove-icon" title="Delete"></div></div>');a.append(s);var c=!1,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(){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);}),s.find(".brtc-va-views-palette-fnunit-remove-icon").hide(),s.mouseover(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").show();}),s.mouseout(function(t){$(this).find(".brtc-va-views-palette-fnunit-remove-icon").hide();}),c&&s.addClass("deprecated"),s.addClass(o),t.append(a),this.putData(s,"func",e),s;},createPaletteBox:function createPaletteBox(t){var e,n=$('<div class="brtc-va-views-palette-fnunit-content">'),r=$('<div class="brtc-va-views-palette-box-fnunit brtc-va-studio-dm-draggable">   <div class="brtc-va-views-palette-fnunit-icon brtc-style-views-palette-fnunit-icon"></div>   <div class="brtc-va-views-palette-fnunit-label brtc-style-views-palette-fnunit-label"></div></div>');n.append(r);var i=Brightics.VA.Core.Interface.WidgetUtils.data;if(i&&i.createPaletteItem){e=i.createPaletteItem(t.func).category;}else{var o="",a="scala";void 0===Brightics.VA.Core.Interface.Functions.data[t.func]?o="none":(o=Brightics.VA.Core.Interface.Functions.data[t.func].category,a=Brightics.VA.Core.Interface.Functions.data[t.func].defaultFnUnit.context),e="brtc-va-fnunit-category-"+o;}return r.attr("title",t.label),r.find(".brtc-va-views-palette-fnunit-icon").attr("context",a||"scala"),r.find(".brtc-va-views-palette-fnunit-label").text(t.label),r.addClass(e),this.putData(r,"func",t.func),r;},createTableItem:function createTableItem(t,e){var n=$('<div class="brtc-va-views-table-content">'),r=$('<div class="brtc-style-views-table brtc-va-studio-dm-draggable">   <div class="brtc-style-views-table-icon">'+e.type.substring(0,1)+'</div>   <div class="brtc-style-views-table-label"></div></div>');return n.append(r),r.attr("title",e.label),r.find(".brtc-style-views-table-label").text(e.label),t.append(n),r;},createKeyItem:function createKeyItem(t){var e=$('<div class="brtc-va-views-key-content">'),n=$('<div class="brtc-style-views-key">   <div class="brtc-style-views-key-icon"><i></i></div>   <div class="brtc-style-views-key-label"></div></div>');return e.append(n),n.attr("title",t.label),n.find(".brtc-style-views-key-icon").attr(t.type),n.find(".brtc-style-views-key-label").text(t.label),n.find("i").addClass({table:"fa fa-table",model:"fa fa-table",image:"fa fa-table"}[t.type]),e;},createDialogContentsArea:function createDialogContentsArea(t,e){var n=$('<div class="brtc-va-dialogs-body-content">    <span class="brtc-va-dialogs-body-content-icon"></span>    <div class="brtc-va-dialogs-body-content-content-text"><span></span></div></div>');t.append(n),n.find(".brtc-va-dialogs-body-content-icon").attr("alert",e.type),n.find(".brtc-va-dialogs-body-content-content-text span").text(e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").attr("title",e.contentText),n.find(".brtc-va-dialogs-body-content-content-text").innerHeight()>30&&n.find(".brtc-va-dialogs-body-content-content-text").css("line-height","15px");},openConfirmDialog:function openConfirmDialog(t,e){this.createCommonConfirmDialog($("body"),{type:"info",isCancel:!0,contentText:t,close:e});},openConfirmWithOptionDialog:function openConfirmWithOptionDialog(t,e,n,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=$('<div class="brtc-va-dialogs-main">   <div class="brtc-va-dialogs-body">       <div class="brtc-va-progress">           <div style="padding-left: 120px;"><span class="brtc-va-progress-loading"></span></div>       </div>       <div class="brtc-va-dialogs-contents">           <span class="brtc-va-dialogs-body-content-icon" alert="info"></span>           <div class="brtc-va-dialogs-body-content-content-text">Please try again later.</div>       </div>       <div class="brtc-va-dialogs-buttonbar">           <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" />       </div>   </div></div>');t.append(i),i.find(".brtc-va-dialogs-body-content-content-text").css("display","none"),i.find(".brtc-va-dialogs-body-content-icon").css("display","none"),(n=i.find(".brtc-va-dialogs-buttonbar-ok")).css("display","none");var o={theme:Brightics.VA.Env.Theme,width:400,height:280,title:e.title,modal:!0,resizable:!1,showCloseButton:!1,open:function 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=$('<div class="brtc-va-dialogs-main">   <div class="brtc-va-dialogs-body">       <div class="brtc-va-dialogs-contents" style="padding-right: 0 !important; padding-bottom: 10px !important;">       </div>       <div class="brtc-va-dialogs-buttonbar">           <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" />       </div>   </div></div>');t.append(a),n=a.find(".brtc-va-dialogs-buttonbar-ok"),e.okLabel&&n.val(e.okLabel),e.isCancel&&(r=$('<input type="button" class="brtc-va-dialogs-buttonbar-cancel" value="Cancel" />'),a.find(".brtc-va-dialogs-buttonbar").append(r),e.cancelLabel&&r.val(e.cancelLabel)),e.detailText&&(i=$('<input type="button" class="brtc-va-dialogs-buttonbar-detail" value="Detail" />'),a.find(".brtc-va-dialogs-buttonbar").append(i));var s=this,c={theme:Brightics.VA.Env.Theme,width:400,height:210,modal:!0,resizable:!1,cancelButton:r,open:function 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,"&amp;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;")).replace(/"/g,"&quot;")).replace(/\s/g,"&nbsp;"):t;},adjustCodeMirrorEsc:function adjustCodeMirrorEsc(t){t.on("endCompletion",function(t){window.event instanceof KeyboardEvent&&"keydown"==window.event.type&&"Escape"==window.event.key&&window.event.stopPropagation();});},setValidatorToCodeMirror:function setValidatorToCodeMirror(t){var e={};return e.type=void 0===t?"":t["valid-type"],e.isValid=function(t){return!e.type||Brightics.VA.Core.Utils.InputValidator.isValid[e.type](t);},e;},changeCodeMirrorLineToSingle:function changeCodeMirrorLineToSingle(t,e){var n=this.setValidatorToCodeMirror(e);t.on("beforeChange",function(t,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=$('<div class="brtc-va-views-udf-fnunit-content brtc-va-views-udf-type-'+e.type+'">'),c=$('<div class="brtc-va-views-udf-fnunit brtc-style-views-udf-fnunit brtc-va-studio-dm-draggable">   <div class="brtc-va-views-udf-fnunit-icon"></div>   <div class="brtc-va-views-udf-fnunit-label"></div>   <div class="brtc-va-views-udf-fnunit-version"></div>   <div class="brtc-va-views-udf-fnunit-remove-icon brtc-style-udf-fnunit-remove-icon" title="Delete"></div></div>');s.append(c);var 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=$('<div class="brtc-va-widget-utils-private-policy-division">   <span class="brtc-va-widget-utils-private-policy-span">Private Policy</span></div>');t.append(e),e.click(function(){window.open("/private-policy","Brightics Private Policy");});var n=t.find(".brtc-va-workspace-project-list");n&&n.length&&n.css("height","calc(100% - 98px)");},updateGridSource:function updateGridSource(t,e){var n=new $.jqx.dataAdapter(e);t.jqxGrid("source",n),t.jqxGrid("clearfilters"),t.jqxGrid("clearselection"),this.updatePageButton(t);},updatePageButton:function updatePageButton(t){var e=t.jqxGrid("getpaginginformation"),n=t.find(".jqx-grid-pager div[type=button][title=first]"),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;}function y(t,e){var n=["train_data","validation_data"];if(!t.param)return t;for(var r=0;r<n.length;r++){t.param[n[r]]&&e[t.param[n[r]]]&&(t.param[n[r]]=e[t.param[n[r]]]);}return t;}function m(t,e){return t.originData.data.table=e[t.originData.data.table],t;}function b(t,e){return t.param.tableId&&(t.param.tableId=e[t.param.tableId]),t;}function C(t,e){if(t.pages)for(var n in t.pages){var r=Object.keys(t.pages[n].contents);for(var i in r){t.pages[n].contents[r[i]].dataSourceId=e[t.pages[n].contents[r[i]].dataSourceId];}}return t;}this.Brightics.VA.Core.Utils.ModelUtils={extendParent:function extendParent(t,e){if(e.parent=function(){return t;},e.param&&e.param.functions)for(var n in e.param.functions){void 0!==e.param.functions[n].fid&&this.extendParent(e,e.param.functions[n]);}},extendMainFunc:function extendMainFunc(e,n){n.getMainModel=function(){return e;},n.isMainModel=function(){return this===this.getMainModel();};var r=t.VA.Core.Utils.NestedFlowUtils.getChildModels(e,n);_.forEach(r,_.partial(this.extendMainFunc.bind(this),e,_));},extendModel:function extendModel(e,n){var r,i=this,o=t.VA.Core.Interface.DefaultModel[e.type];if(o){for(var a in r=n?$.extend(!0,{},o,e):$.extend(!0,e,o),_.forIn(r.innerModels,function(t){i.extendInnerModel(r,t);}),(r=$.extend(!0,r,t.VA.Default.model)).functions){r.functions[a]&&(this.extendParent(r,r.functions[a]),void 0===r.functions[a]["persist-mode"]&&(r.functions[a]["persist-mode"]="auto"));}return void 0===r["persist-mode"]&&(r["persist-mode"]="auto"),this.extendMainFunc(r,r),r;}console.error("Create DefaultModel("+e.type+")!");},extendInnerModel:function extendInnerModel(e,n,r){var i,o=t.VA.Implementation.DataFlow.innerModel;if(o){for(var a in i=r?$.extend(!0,{},o,n):$.extend(!0,n,o),(i=$.extend(!0,i,t.VA.Default.model)).functions){i.functions[a]&&(this.extendParent(i,i.functions[a]),void 0===i.functions[a]["persist-mode"]&&(i.functions[a]["persist-mode"]="auto"));}return void 0===i["persist-mode"]&&(i["persist-mode"]="auto"),this.extendMainFunc(e,i),i;}console.error("Create DefaultModel("+n.type+")!");},exportAsRunnablePromise:function exportAsRunnablePromise(e,r,i){var o=n.getFile(void 0,e.mid).getProjectId();return t.VA.Core.Utils.NestedFlowUtils.makeRunnable(o,r);},exportAsRunnable:function exportAsRunnable(t,e){var n=this,r=this.extendModel(t,!0);for(var i in delete r.FUNC_ID_CHAR,delete r.FUNC_ID_LENGTH,delete r.preferences,delete r.problemList,delete r.sheets,void 0!==e&&e||delete r.report,r.entries=[],r.functions){var o=r.functions[i],a=o.display.label||"";if(o.label=a,delete o.display,o.parent().getPrevious(o.fid).length<1&&r.entries.push(o.fid),this.carvePersist(o,!0),this.deleteEmptyArray(o),"Subflow"==o[FUNCTION_NAME]&&o.param.functions.length>0)for(var s in o.param.entries||(o.param.entries=[o.param.functions[0].fid]),o.param.functions){var c=o.param.functions[s];a=o.label||"";c.label=a,delete c.display;}}return r.innerModels&&(r.innerModels=_.reduce(_.map(r.innerModels,function(t,e){var r={};return r[e]=n.exportAsRunnable(t),r;}),_.merge,{})),r;},previousFnUnitList:function 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;},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){var i,o;if("true"===t.VA.SettingStorage.getValue("common.document.useonline")){var a=t.VA.SettingStorage.getValue("common.document.onlinedocurl");""===a&&(a=t.VA.SettingStorage.getValue("common.document.onlinedocurl.default")),a=_.trimRight(a,"/");try{var s=[a,(navigator.language||navigator.userLanguage).toLowerCase(),"ai","v"+(t.VA.Env.CoreVersion||"3.0"),"function_reference",r||"scala",n].join("/");i=window.open(s);}catch(t){i=window.open(a);}}else o="api/va/v2/help/function",n&&(o=o+"/"+n),o=o+"?type="+e+(r?"&context="+r:""),i=window.open(o,"Brightics Help");i.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=$('<div class="brtc-va-widget-ace-editor-control"></div>'),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=$('<div class="brtc-va-widget-container">   <div class ="brtc-va-widget-remove" />   <div class="brtc-va-widget-header">       <div class="brtc-va-widget-label">'+this.variableKey+'</div>       <div class="brtc-va-widget-type-button-area"><div class="brtc-va-widget-type-switch-button"></div></div>   </div>   <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),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($('<div class="brtc-va-widget-contents-input-container">   <div class="brtc-va-widget-contents-input-control-container"></div></div>')),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<this.variableValue.length;t++){this.createInputControlLayout(t,this.isArrayValue());}else this.createInputControlLayout(0,this.isArrayValue());this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar();},n.prototype.createSingleInputControl=function(){this.createInputControlLayout(0,!1);},n.prototype.createInputControlLayout=function(t,e,n){var r=this.$contentsArea,i=this,o=!1,a=$('<div class="brtc-va-widget-contents-input-container"></div>'),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=$('<div class="brtc-va-widget-contents-input-control-container"></div>');a.append(u),(t>0||o)&&(l=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),a.append(l),l.click(function(t){i.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"));})),e&&(c=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),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=$('<input type="text" class="brtc-va-widget-contents-input-control"/>');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=$('<textarea  class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={mode:"brtc-control",scrollbarStyle:"null",placeholder:this.options.button.visible?"calculation"==this.inputType?"Enter expression\tex. ${Variable1}+${Variable2}":"Enter value\tex. 1":"Enter variable\tex. ${Variable1}",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0,hintOptions:{list:[]},readOnly:"calculation"===this.variableType};this.codeMirror=CodeMirror.fromTextArea(i[0],o);var a={"valid-message-position":this.options["valid-message-position"],"valid-type":this.options.button.visible?this.isArrayValue&&"expression"===this.inputType?"type3":"":"type3"};t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.codeMirror,a),this.codeMirror.on("blur",function(t,e){r.triggerChangeInputValue();});},n.prototype.handleAddInputControlEvent=function(t,e){var n=t.index();this.createInputControlLayout(n,!0,e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var r=this.$mainControl.parents(".ps-container");r&&r.length&&r.perfectScrollbar("update");},n.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update");},n.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedValue()));}},n.prototype.createFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.variableValue};},n.prototype.getFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.getInputValue()};},n.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()&&"expression"!==this.inputType){t=[];for(var n=0;n<e.length;n++){t.push($(e[n]).val());}}else t=this.codeMirror.getValue();return t;},n.prototype.setVariableType=function(t){this.variableType=t,this.$contentsArea.empty(),this.createContentsArea();},n.prototype.setInputValue=function(t){void 0!==t&&(this.variableValue=t);var e,n=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()&&"expression"!==this.inputType){if(Array.isArray(this.variableValue)){if(n.length>this.variableValue.length)for(e=0;e<n.length;e++){void 0===this.variableValue[e]?$(n[e]).parents(".brtc-va-widget-contents-input-container").remove():$(n[e]).val(this.variableValue[e]||"");}else{for(e=n.length;e<this.variableValue.length;e++){this.createInputControlLayout(e,!0);}for(n=this.$contentsArea.find(".brtc-va-widget-contents-input-control"),e=0;e<n.length;e++){$(n[e]).val(this.variableValue[e]||"");}}}else $(n[0]).val(this.variableValue||"");}else Array.isArray(this.variableValue)?this.codeMirror.setValue(this.variableValue[0]):this.codeMirror.setValue(this.variableValue);},n.prototype.setRemovable=function(t){this.options.removable=t,t?this.$mainControl.find(".brtc-va-widget-remove").addClass("removable"):this.$mainControl.find(".brtc-va-widget-remove").removeClass("removable");},n.prototype.getOptions=function(){return this.options;},this.Brightics.VA.Core.Widget.Controls.ArgumentControl=n;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls();}e.prototype.initOptions=function(t){this.options=t,this._isNumberType="number"===this.options.type;},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-widget-container">   <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),this.$parent.append(this.$mainControl),this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper"),this.createArrayInputControl(this.$contentsArea);},e.prototype.createArrayInputControl=function(){this.createInputControlLayout(0),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar();},e.prototype.createInputControlLayout=function(t){var e=this.$contentsArea,n=this,r=!1,i=$('<div class="brtc-va-widget-contents-input-container"></div>'),o=e.find(".brtc-va-widget-contents-input-container");0!==o.length&&o[t]?($(o[t]).after(i),r=!0):e.append(i);var a,s,c=$('<div class="brtc-va-widget-contents-input-control-container"></div>');i.append(c),(t>0||r)&&(s=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),i.append(s),s.click(function(t){n.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"));})),a=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),i.append(a),a.click(function(t){n.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"));}),this._isNumberType?this.createNumericInputControl(c):this.createInputControl(c);},e.prototype.createNumericInputControl=function(e){var n=this,r={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"double",placeHolder:"Enter value",className:["brtc-va-widget-contents-array-input-control"]};new t.VA.Core.Widget.Controls.NumericInput(e,r).onChange(function(){n.triggerChangeInputValue();});},e.prototype.createInputControl=function(e){var n=this,r=$('<input type="text" class="brtc-va-widget-contents-array-input-control"/>');e.append(r);var i={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};r.jqxInput(i),r.focusout(function(t){n.triggerChangeInputValue();});},e.prototype.handleAddInputControlEvent=function(t){var e=t.index();this.createInputControlLayout(e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var n=this.$mainControl.parents(".ps-container");n&&n.length&&n.perfectScrollbar("update");},e.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update");},e.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this._preValue)||t)&&(this.options.onChangeCallback(e),this._preValue=e);}},e.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control");(t=[]).length=e.length;for(var n=0;n<e.length;n++){var r=this.getValueByType($(e[n]).val());t[n]=r;}return t;},e.prototype.setValue=function(t){this._preValue=t;var e,n=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control");if(n.length>t.length)for(e=0;e<n.length;e++){void 0!==t[e]&&$(n[e]).val(this.getValueByType(t[e])),e>=t.length&&0!==t.length&&$(n[e]).closest(".brtc-va-widget-contents-input-container").remove();}else{for(e=n.length;e<t.length;e++){this.createInputControlLayout(e,!0);}for(n=this.$contentsArea.find(".brtc-va-widget-contents-array-input-control"),e=0;e<n.length;e++){$(n[e]).val(this.getValueByType(t[e]));}}},e.prototype.toString=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?"":_.isNumber(t)?_.isNaN(t)||_.isUndefined(t)?"":t.toString():t;},e.prototype.toNumber=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?null:Number(this.toString(Number(t)));},e.prototype.getValueByType=function(t){return this._isNumberType?this.toNumber(t):this.toString(t);},this.Brightics.VA.Core.Widget.Controls.ArrayInputControl=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.$parent=t,this.options=e;var n=this.getParentOffset(),r=this.getParentSize();this.removePreMessageBox(),this.createMessageBox(n,r),this.notifyMessage();}e.prototype.getParentOffset=function(){return this.$parent.offset();},e.prototype.getParentSize=function(){return{width:this.$parent.width(),height:this.$parent.height()};},e.prototype.removePreMessageBox=function(){var t=$("body").children(".brtc-va-widget-messagebox-container");t.length>0&&t.remove();},e.prototype.removeMessageBoxTimeout=function(){var t=this;setTimeout(function(){var e=$("body").children(".brtc-va-widget-messagebox-container");e.find("div").length>0?t.removeMessageBoxTimeout():e.remove();},1e3);},e.prototype.createMessageBox=function(t,e){this.$messageBox=$('<div class="brtc-va-widget-messagebox-container"></div>'),$("body").append(this.$messageBox),this.messageBoxWidth=this.$messageBox.width(),this.removeMessageBoxTimeout();},e.prototype.getMessageBoxOffset=function(t,e){var n=this.options.position;return"bottom"===n?{top:t.top+e.height+10,left:t.left}:"left"===n?{top:t.top,left:t.left-this.messageBoxWidth-10}:{top:t.top,left:t.left+e.width+10};},e.prototype.notifyMessage=function(){$("<div>"+this.options.message+"</div>").jqxNotification({width:"100%",appendContainer:this.$messageBox,opacity:.9,autoClose:!0,autoOpen:!0,template:"info",theme:"office"});},t.VA.Core.Widget.Controls.FadeOutMessage=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t,e){this.parentId=t,this.defaultOptions={multiple:!0,fileType:["json"]},this.options=$.extend(!0,this.defaultOptions,e),this.files={},this.retrieveParent(),this.createControls();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){this.$mainControl=$('<div class="brtc-va-widget-controls-fileList">   <div class="brtc-va-widget-controls-fileList-toolbar"></div>   <div class="brtc-va-widget-controls-fileList-list-wrapper">       <div class="brtc-va-widget-controls-fileList-list"></div>   </div></div>'),this.$toolbarArea=this.$mainControl.find(".brtc-va-widget-controls-fileList-toolbar"),this.$listArea=this.$mainControl.find(".brtc-va-widget-controls-fileList-list"),this.$mainControl.find(".brtc-va-widget-controls-fileList-list-wrapper").perfectScrollbar(),this.$parent.append(this.$mainControl),this.renderToolbarArea(this.$toolbarArea),this.renderListArea(this.$listArea);},e.prototype.renderToolbarArea=function(t){this.createSumArea(t),this.createDeleteFileButton(t),this.createSelectFileButton(t);},e.prototype.renderListArea=function(e){var n=this;e.append($('<div class="brtc-va-dialogs-publish-management-grid"></div>'));var r=new $.jqx.dataAdapter({localdata:[],datafields:[{name:"name",type:"string"},{name:"size",type:"string"},{name:"lastModifiedDate",type:"date"},{name:"lastModified",type:"timestamp"},{name:"type",type:"string"},{name:"webkitRelativePath",type:"string"},{name:"fileKey",type:"string"}],datatype:"json"});this.$fileListGrid=e.find(".brtc-va-dialogs-publish-management-grid").jqxGrid({theme:t.VA.Env.Theme,width:"100%",height:"calc(100% - 45px)",altrows:!1,filterable:!1,source:r,sortable:!1,columnsresize:!0,selectionmode:"checkbox",showfiltercolumnbackground:!1,rowsheight:53,columns:[{text:"Name",datafield:"name",align:"center",cellclassname:"brtc-grid-cell",cellsrenderer:n.renderer,renderer:n.gridV2Renderer,width:"50%"},{text:"Size",datafield:"size",align:"center",cellclassname:"brtc-grid-cell",cellsrenderer:n.fileSizeRenderer,renderer:n.gridV2Renderer,width:80},{text:"Last Modified Date",datafield:"lastModifiedDate",align:"center",cellclassname:"brtc-grid-cell",renderer:n.gridV2Renderer,cellsalign:"center",cellsformat:"yyyy-MM-dd h:mm:ss"},{text:"fileKey",datafield:"fileKey",hidden:!0},{text:"lastModified",datafield:"lastModified",hidden:!0},{text:"type",datafield:"type",hidden:!0},{text:"webkitRelativePath",datafield:"webkitRelativePath",hidden:!0}]}),this.setGridStyleV2(this.$fileListGrid);var i=function i(){n.$fileListGrid.jqxGrid("getselectedrowindexes").length>0?(n.$deleteButton.jqxButton({disabled:!1}),n.$deleteButton.css("cursor","pointer")):(n.$deleteButton.jqxButton({disabled:!0}),n.$deleteButton.css("cursor","default"));};this.$fileListGrid.on("rowselect",i.bind(n)),this.$fileListGrid.on("rowunselect",i.bind(n));},e.prototype.fileSizeRenderer=function(e,n,r){var i="1.00 KB";return r>1024&&(i=t.VA.Core.Utils.CommonUtils.byteCalculation(r)),'<div index="'+e+'" style="float: right;height:53px;line-height:53px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 15px); ">'+i+"</div>";},e.prototype.renderer=function(t,e,n,r,i,o){var a="",s="float: left;margin-left: 15px;height:53px;line-height:53px;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 15px); ";return o.errorMessage?(s+="color:red;",a=o.errorMessage):a=n,'<div title="'+a+'" fileKey="'+o.fileKey+'" index="'+t+'" style="'+s+'">'+n+"</div>";},e.prototype.gridV2Renderer=function(t){return'<div style="opacity:0.8; font-family: Arial; font-size: 16px; font-weight: bold; text-align: center; color: rgba(0, 0, 0, 0.8);">'+t+"</div>";},e.prototype.setGridStyleV2=function(t){t.addClass("GridStyleV2"),t.css({height:"calc(100% - 35px) !important","margin-top":"15px !important","margin-bottom":"20px !important"}),this.$mainControl.find("input[type=button]").width(100);},e.prototype.createSumArea=function(t){this.$sumArea=$('<div class="brtc-va-widget-controls-fileList-toolbar-sum">   <span>Total<strong class="brtc-va-widget-controls-fileList-toolbar-sum-count">0</strong></span></div>'),t.append(this.$sumArea);},e.prototype.createSelectFileButton=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-fileList-toolbar-selectfile">   <input for="brtc-va-widget-controls-fileList-toolbar-selectfile-button" type="button" id="fileselect-local" value="Select File" />   <input type="file" id="brtc-va-widget-controls-fileList-toolbar-selectfile-file" name="fileToUpload" accept=".json"></div>');e.append(r);var i=r.find("#fileselect-local"),o=r.find("#brtc-va-widget-controls-fileList-toolbar-selectfile-file");this.options.multiple&&o.attr("multiple",!0),o.hide(),i.jqxButton({theme:t.VA.Env.Theme}),i.on("click",function(){o.click();}),o.on("input",function(e){var r=$(this)[0].files;if(n.isJsonFile(r)){var i=n.addFileKey(r),a=n.renderFiles(i);n.$parent.trigger("addFile",[i,a]);}else t.VA.Core.Utils.WidgetUtils.openErrorDialog(".json file can be imported only");o.val(null);});},e.prototype.setTotalCount=function(){this.$sumArea.find(".brtc-va-widget-controls-fileList-toolbar-sum-count").text(this.$fileListGrid.jqxGrid("getRows").length);},e.prototype.addFileKey=function(e){for(var n={},r=0;r<e.length;r++){n[t.VA.Core.Utils.IDGenerator.importedFile.id()]=e[r];}return n;},e.prototype.createDeleteFileButton=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-fileList-toolbar-deletefile">   <input class="brtc-va-widget-controls-fileList-toolbar-deletefile-button" type="button" value="Delete File" /></div>');e.append(r),this.$deleteButton=r.find(".brtc-va-widget-controls-fileList-toolbar-deletefile-button"),this.$deleteButton.jqxButton({theme:t.VA.Env.Theme,disabled:!0}),this.$deleteButton.on("click",function(){for(var t=[],e=n.$fileListGrid.jqxGrid("getselectedrowindexes").sort(function(t,e){return t-e;}),r=e.length-1;r>=0;r--){var i=n.$fileListGrid.jqxGrid("getrowdata",e[r]);t.push(i.fileKey),delete n.files[i.fileKey];var o=n.$fileListGrid.jqxGrid("getrowid",e[r]);n.$fileListGrid.jqxGrid("deleterow",o);}n.$parent.trigger("removeFile",[t]),n.setTotalCount(),n.$deleteButton.jqxButton({disabled:!0});});},e.prototype.makeGridSource=function(t,e){var n=[],r=$.extend(!0,{},e);return r.fileKey=t,this.files[t]=r,n.push(r),n;},e.prototype.equal=function(t,e){return t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified;},e.prototype.renderFiles=function(t){var e={};for(var n in t){var r=!1;for(var i in this.files){if(this.equal(this.files[i],t[n])){e[n]=!0,r=!0;break;}}r||this.$fileListGrid.jqxGrid("addrow",null,this.makeGridSource(n,t[n]));}return this.setTotalCount(),e;},e.prototype.isJsonFile=function(t){for(var e=0;e<t.length;e++){var n=t[e].name.split(".");if(this.options.fileType.indexOf(n[n.length-1])<0)return!1;}return!0;},e.prototype.getFiles=function(){return this.files;},e.prototype.setDisableFile=function(t,e){var n,r=-1,i=this.$fileListGrid.jqxGrid("getRows");for(var o in i){if(i[o].fileKey===t){r=o,(n=i[o]).errorMessage=e;break;}}this.$fileListGrid.jqxGrid("updaterow",r,n);},t.VA.Core.Widget.Controls.FileList=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.options.selectedItems=[],this.options.selectedIndexes=[],this.options.changedItems={},this.options.items=[],this.eventListeners={},this.sortOptions={},this._initEventListeners(),this.retrieveParent(),this.createControls(),this._setSortFunction();}e.prototype._setSortFunction=function(){this.compareFunctionGenerator=function(t,e){return e=e||function(t){return t;},function(n,r){return t(e(n),e(r));};};var t,e=function e(t,_e2){return String(t).localeCompare(String(_e2));},n=(t=this,function(e){return t.options.items[e].item;});this.sortOptions={comp:e,getter:n,sortOnIndex:this.compareFunctionGenerator(e,n),sortOnValue:this.compareFunctionGenerator(e)};},e.prototype._initEventListeners=function(){this.eventListeners={selectAll:this._handleSelectAll.bind(this),unselectAll:this._handleUnselectAll.bind(this),select:this._handleSelect.bind(this),unselect:this._handleUnselect.bind(this),close:this._handleClose.bind(this)};},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControls=function(){var e=this;this.$mainControl=$('<div class="brtc-va-widget-controls-itemlist">   <div class="brtc-va-widget-controls-itemlist-selectbutton-wrapper">       <span class="brtc-va-widget-controls-itemlist-selectcounter counter">0</span>       <span class="brtc-va-widget-controls-itemlist-selectcounter">items selected</span>       <button class="brtc-va-widget-controls-itemlist-clearbutton">Clear</button>       <button class="brtc-va-widget-controls-itemlist-selectbutton">Select</button>   </div>   <div class="brtc-va-widget-controls-itemlist-control" />'),this.$parent.append(this.$mainControl),this.$selectButton=this.$mainControl.find(".brtc-va-widget-controls-itemlist-selectbutton"),this.$selectButton.jqxButton({theme:t.VA.Env.Theme,height:25}),this.$selectButton.on("click",function(){e.openItemSelector();}),this.$clearButton=this.$mainControl.find(".brtc-va-widget-controls-itemlist-clearbutton"),this.$clearButton.jqxButton({theme:t.VA.Env.Theme,height:25}),this.$clearButton.on("click",function(){e.clearSelectedItems();}),this.$itemControl=this.$mainControl.find(".brtc-va-widget-controls-itemlist-control"),this.createItemListControl(this.$itemControl),this.createItemSelector();},e.prototype.createItemListControl=function(e){var n=this,r={localdata:this.options.selectedItems,datatype:"array",beforeprocessing:function beforeprocessing(){r.totalrecords=n.options.selectedItems.length;}},i=new $.jqx.dataAdapter(r);$(e).jqxGrid({width:n.options.width||"100%",theme:t.VA.Env.Theme,height:n.options.height||120,virtualmode:!0,pageable:!1,source:i,rendergridrows:function rendergridrows(t){for(var e={},r=t.startindex;r<t.endindex&&r<n.options.selectedItems.length;++r){e[r]={item:n.options.selectedItems[r]};}return e;},selectionmode:"none",showheader:!1,rowsheight:20,columns:[{text:"Item",datafield:"item",cellsrenderer:function cellsrenderer(t,e,r){if(t<n.options.selectedItems.length)return'<div class="brtc-va-widget-controls-itemselector-itemcontainer-element" row-index="'+t+'">   <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-name" title="'+r+'">'+r+'</span>   <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-remove"></span></div>';},width:"100%",cellsalign:"left"}]}),$(e).jqxGrid("localizestrings",{emptydatastring:" "});},e.prototype.createItemSelector=function(){var e=this;this.options.multiple=!0,this.options.fromModal=!0,this.itemSelector=new t.VA.Core.Widget.Controls.ItemSelector(this.$mainControl,{multiple:e.options.multiple,fromModal:e.options.fromModal,limit:e.options.limit,showDesc:e.options.showDesc,changed:function changed(t,n){e.eventListeners[t]&&"function"==typeof e.eventListeners[t]&&e.eventListeners[t](n);}});},e.prototype._getUniqueItems=function(t,e){for(var n={},r=[],i=0;i<t.length;++i){var o=void 0===e?t[i]:t[i][e];void 0===n[o]&&(n[o]=!0,r.push(t[i]));}return r;},e.prototype.setItems=function(t){this.options.items=this._getUniqueItems(t,"item"),this.itemSelector.setSortOptions(this.sortOptions),this.itemSelector.setSource(this.options.items);},e.prototype.setSelectedItems=function(t){var e=this._getUniqueItems(t||[]);this.options.selectedItems=$.extend(!0,[],e),this.options.selectedItems.sort(this.compareFunctionGenerator(this.sortOptions.comp,function(t){return t.item;})),this.options.selectedIndexes=this.itemSelector.calcSelectedIndexes(this.options.selectedItems),this.refreshControl();},e.prototype.getSelectedItems=function(){return this.options.selectedItems;},e.prototype.refreshControl=function(){var t=this;this.$itemControl.jqxGrid("updatebounddata"),this.$mainControl.find(".brtc-va-widget-controls-itemlist-selectcounter.counter").text(this.options.selectedItems.length),this.$itemControl.find(".jqx-grid-cell").mouseover(function(e){$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").show();$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").unbind("click"),$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").bind("click",function(){var e=$(this).closest(".brtc-va-widget-controls-itemselector-itemcontainer-element").attr("row-index");t.removeItem(e),t.refreshControl();});}),this.$itemControl.find(".jqx-grid-cell").mouseout(function(t){$(this).find(".brtc-va-widget-controls-itemselector-itemcontainer-element-remove").hide();});},e.prototype.clearSelectedItems=function(){this.itemSelector.clearSelectedItems(),this.setSelectedItems([]),this.options.changed("clear",{items:[]});},e.prototype.removeItem=function(t){var e=this.options.selectedItems[t],n=this.options.selectedIndexes[t];this.options.selectedItems.splice(t,1),this.options.selectedIndexes.splice(t,1),this.itemSelector.unselectRow(n),this.options.changed("removed",{added:[],removed:[e],items:this.options.selectedItems});},e.prototype.openItemSelector=function(){this.itemSelector.open(this.$clearButton,this.options.selectedItems,this.options.selectedIndexes);},e.prototype.getSelectorPosition=function(){var t={left:0,top:0};t.left=this.$mainControl.offset().left+this.$mainControl.width()+5,t.top=this.$mainControl.offset().top;var e=document.all?document.body.clientHeight:window.innerHeight,n=this.itemSelector.getHeight();return e-n-10<t.top&&(t.top=e-n-10),t;},e.prototype.isLimited=function(e){return this.options.limit<this.options.selectedItems.length+(e||0)&&(t.VA.Core.Utils.WidgetUtils.openWarningDialog("You are only allowed to select "+this.options.limit+" items."),this.itemSelector.close(),!0);},e.prototype.processing=function(t){this.itemSelector._processing(t);},e.prototype._updateChangedItemOrDelete=function(t,e){void 0!==this.options.changedItems[e]&&this.options.changedItems[e]!==t?delete this.options.changedItems[e]:this.options.changedItems[e]=t;},e.prototype._handleSelectAll=function(t){for(var e=[],n=0,r=0;n<this.options.selectedIndexes.length&&r<t.length&&!this.isLimited(e.length+1);){this.options.selectedIndexes[n]<t[r].id?n++:this.options.selectedIndexes[n]>t[r].id?(this._updateChangedItemOrDelete("select",t[r].value),e.push(t[r]),r++):(n++,r++);}for(;r<t.length&&!this.isLimited(e.length+1);){this._updateChangedItemOrDelete("select",t[r].value),e.push(t[r]),r++;}var i=[],o=[];for(n=0,r=0;n<this.options.selectedIndexes.length&&r<e.length;){this.options.selectedIndexes[n]<e[r].id?(i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++):this.options.selectedIndexes[n]>e[r].id?(i.push(e[r].id),o.push(e[r].value),r++):(i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++,r++);}for(;n<this.options.selectedIndexes.length;){i.push(this.options.selectedIndexes[n]),o.push(this.options.selectedItems[n]),n++;}for(;r<e.length;){i.push(e[r].id),o.push(e[r].value),r++;}this.options.selectedIndexes=i,this.options.selectedItems=o,this.refreshControl();},e.prototype._handleUnselectAll=function(t){for(var e=[],n=[],r=0,i=0;r<this.options.selectedItems.length&&i<t.length;){this.options.selectedIndexes[r]<t[i].id?(e.push(this.options.selectedIndexes[r]),n.push(this.options.selectedItems[r]),r++):this.options.selectedIndexes[r]>t[i].id?i++:(this._updateChangedItemOrDelete("unselect",t[i].value),r++,i++);}for(;r<this.options.selectedItems.length;){e.push(this.options.selectedIndexes[r]),n.push(this.options.selectedItems[r]),r++;}this.options.selectedIndexes=e,this.options.selectedItems=n,this.refreshControl();},e.prototype._handleSelect=function(t){if(!this.isLimited(1)){for(var e=0;e<this.options.selectedItems.length&&this.options.selectedIndexes[e]<t.id;){++e;}e<this.options.selectedItems.length&&this.options.selectedIndexes[e]===t.id||(this.options.selectedIndexes.splice(e,0,t.id),this.options.selectedItems.splice(e,0,t.value),this._updateChangedItemOrDelete("select",t.value),this.refreshControl());}},e.prototype._handleUnselect=function(t){var e=this.options.selectedIndexes.indexOf(t.id);-1!==e&&(this.options.selectedItems.splice(e,1),this.options.selectedIndexes.splice(e,1),this._updateChangedItemOrDelete("unselect",t.value),this.refreshControl());},e.prototype._handleClose=function(t){var e=[],n=[];for(var r in this.options.changedItems){"select"===this.options.changedItems[r]?e.push(r):n.push(r);}(e.length>0||n.length>0)&&this.options.changed("change",{added:e,removed:n,items:this.options.selectedItems}),this.options.changedItems={};},t.VA.Core.Widget.Controls.ItemList=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.sortOptions={},this.initOptions(),this.retrieveParent(),this.createControl();}e.prototype.initOptions=function(){this.options=$.extend(!0,{source:[],width:290,height:320,resizable:!0,fromModal:!1,limit:99999999,showDesc:!1},this.options);},e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.createControl=function(){var e=this;this.$mainControl=$('<div class="brtc-va-widget-controls-itemselector">   <div class="brtc-va-widget-controls-itemselector-header" />   <div class="brtc-va-widget-controls-itemselector-content brtc-style-full brtc-style-display-flex brtc-style-flex-direction-column" /></div>'),this.$parent.append(this.$mainControl);var n=this.$mainControl.find(".brtc-va-widget-controls-itemselector-content");this.createFilter(n),this.createSelectButton(n),this.createItemContainer(n),this.closeHandler=function(t){0===e.$mainControl.closest(".ui-dialog").has(t.target).length&&e.$mainControl.dialog("close");};var r={theme:t.VA.Env.Theme,width:this.options.width,height:this.options.height,resizable:!0,title:"Select Items",autoOpen:!1,modal:!1,showAnimationDuration:50,minHeight:285,minWidth:307,zIndex:this.getHighestZindex(),close:function close(){e.options.fromModal||$(".jqx-window-modal").remove(),$(window).off("mousedown",e.closeHandler),e.options.changed("close",[]);}};this.$mainControl.dialog(r),this.$mainControl.siblings(".ui-dialog-titlebar.ui-widget-header").addClass("brtc-style-itemselector"),this.$mainControl.css("z-index",this.getHighestZindex());},e.prototype.createFilter=function(e){var n=this,r=$('<div class="brtc-va-widget-controls-itemselector-filter-container"></div>');e.append(r),this.$filterControl=$('<input type="search" placeholder="Search Item" />'),r.append(this.$filterControl),this.$filterControl.jqxInput({theme:t.VA.Env.Theme,placeHolder:"Search Item",height:31,minLength:1}),this.$filterControl.on("keyup search",function(t){n.$itemControl.jqxGrid("clearfilters");var e=new $.jqx.filter(),r=e.createfilter("stringfilter",t.target.value,"contains");e.addfilter(1,r),n.$itemControl.jqxGrid("addfilter","item",e),n.$itemControl.jqxGrid("applyfilters");});},e.prototype.createSelectButton=function(e){var n=this,r=$('<div class="brtc-item-check-box-wrapper"></div>');e.append(r),this.$selectAllButton=$('<input type="button" value="Select All" style="width: 100%; float:left; margin-left: 0px;"/>'),this.$clearAllButton=$('<input type="button" value="Unselect All" style="width: 100%; float:left; margin-left: 2px; margin-bottom: 2px;"/>'),r.append(this.$selectAllButton),r.append(this.$clearAllButton),this.$selectAllButton.jqxButton({height:23,width:134,Theme:t.VA.Env.Theme}),this.$clearAllButton.jqxButton({height:23,width:134,Theme:t.VA.Env.Theme}),this.$selectAllButton.on("click",function(){n.selectedAll();}),this.$clearAllButton.on("click",function(){n._processing(!0),n.unSelectedAll(),n._processing(!1);});},e.prototype.createItemContainer=function(e){var n=this,r=$('<div class="brtc-va-progress">     <span class="brtc-va-progress-loading"></span></div><div class="brtc-va-widget-controls-itemselector-itemcontainer-wrapper brtc-style-flex-1">   <div class="brtc-va-widget-controls-itemselector-itemcontrol brtc-style-border-box"></div></div>');e.append(r);var i=function i(t,e,n){return'<div class="brtc-va-widget-controls-itemselector-itemcontainer-element" row-index="'+t+'">   <span class="brtc-va-widget-controls-itemselector-itemcontainer-element-name" title="'+n+'">'+n+"</span></div>";};this.$progress=e.find(".brtc-va-progress"),this.$progress.hide(),this.$itemControl=r.find(".brtc-va-widget-controls-itemselector-itemcontrol");var o=[{text:"Item",datafield:"item",cellsrenderer:i,minwidth:120,cellsalign:"left"}];this.options.showDesc&&(o[0].minwidth=90,o.push({text:"Description",datafield:"description",cellsrenderer:i,width:110,minwidth:90,maxwidth:110,cellsalign:"left"})),this.$itemControl.jqxGrid({width:"100%",theme:t.VA.Env.Theme,height:"100%",pageable:!1,selectionmode:"checkbox",showheader:!1,rowsheight:20,columns:o}),this.$itemControl.on("rowselect",function(t){if(!n.systemEvent){var e=t.args.rowindex;n.options.changed("select",{id:n.invPos[e],value:n.options.source[e].item});}}),this.$itemControl.on("rowunselect",function(t){if(!n.systemEvent){var e=t.args.rowindex;n.options.changed("unselect",{id:n.invPos[e],value:n.options.source[e].item});}});},e.prototype.selectedAll=function(){var t=this;this.systemEvent=!0;var e=this.$itemControl.jqxGrid("getrows");this.chkCnt++;var n=e.map(function(e){var n=void 0!==e.dataindex?e.dataindex:e.boundindex;return t.chk[n]=t.chkCnt,n;}),r=this.pos.filter(function(e){return t.chk[e]===t.chkCnt;}),i=this._getSelectedRowIndexes(),o=r.map(function(e){return{id:t.invPos[e],value:t.options.source[e].item};});this.$itemControl.jqxGrid({selectedrowindexes:this._union(i,n)}),this.$itemControl.jqxGrid("refresh"),this.options.changed("selectAll",o),this.systemEvent=!1;},e.prototype.unSelectedAll=function(){var t=this;this.systemEvent=!0;var e=this.$itemControl.jqxGrid("getrows");this.chkCnt++;var n=e.map(function(e){var n=void 0!==e.dataindex?e.dataindex:e.boundindex;return t.chk[n]=t.chkCnt,n;}),r=this.pos.filter(function(e){return t.chk[e]===t.chkCnt;}).map(function(e){return{id:t.invPos[e],value:t.options.source[e].item};}),i=this._getSelectedRowIndexes();this.$itemControl.jqxGrid({selectedrowindexes:this._difference(i,n)}),this.$itemControl.jqxGrid("refresh"),this.options.changed("unselectAll",r),this.systemEvent=!1;},e.prototype._getSelectedRowIndexes=function(){return this._countingSort(this.$itemControl.jqxGrid("getselectedrowindexes"),this.options.source.length);},e.prototype._preCalculation=function(t){var e=this;this.pos=[],this.invPos=[],this.chk=[],this.chkCnt=0;for(var n=t.length,r=0;r<n;++r){this.pos.push(r),this.invPos.push(-1),this.chk.push(-1);}this.pos.sort(this.sortOptions.sortOnIndex),this.pos.forEach(function(t,n){e.invPos[t]=n;});},e.prototype.setSource=function(t){this.options.source=t,this._preCalculation(t);var e=[{name:"item",type:"string"}];this.options.showDesc&&e.push({name:"description",type:"string"});var n={localdata:this.options.source,datatype:"array",datafields:e},r=new $.jqx.dataAdapter(n);this.$itemControl.jqxGrid({source:r});},e.prototype.getSource=function(){return this.options.source;},e.prototype.calcSelectedIndexes=function(t){for(var e=[],n=0,r=0;n<t.length&&r<this.pos.length;){var i=t[n],o=this.options.source[this.pos[r]].item,a=this.sortOptions.comp(i,o);a<0?n++:a>0?r++:(e.push(r),n++,r++);}return e;},e.prototype.setSelectedItems=function(t,e){var n=this;this._processing(!0),this.systemEvent=!0;var r=e.filter(function(t){return t<n.options.source.length;});this.chkCnt++;var i=r.map(function(t){return n.pos[t];});i.forEach(function(t){n.chk[t]=n.chkCnt;}),i=this._countingSort(i,this.options.source.length),this.$itemControl.jqxGrid({selectedrowindexes:i}),this.$itemControl.jqxGrid("refresh"),this.systemEvent=!1,this._processing(!1);},e.prototype._countingSort=function(t,e){for(var n=[],r=0;r<e;++r){n.push(-1);}return t.forEach(function(t){n[t]=t;}),n.filter(function(t,e){return t===e;});},e.prototype._processing=function(t){t?($(window).off("mousedown",this.closeHandler),this.$progress.show()):($(window).on("mousedown",this.closeHandler),this.$progress.hide());},e.prototype.open=function(t,e,n){this.selectEventFlag=!1,this.systemEvent=!0,this.$itemControl.jqxGrid("clearselection"),this.systemEvent=!1,this.$mainControl.dialog({position:{my:"left top",at:"right+5, top",of:t}}),this.$mainControl.dialog("open"),this.$mainControl.css("z-index",this.getHighestZindex()),$(window).on("mousedown",this.closeHandler);var r=[{name:"item",type:"string"}];this.options.showDesc&&r.push({name:"description",type:"string"});var i={localdata:this.options.source,datatype:"array",datafields:r},o=new $.jqx.dataAdapter(i);this.$itemControl.jqxGrid({source:o}),this.setSelectedItems(e,n);},e.prototype.close=function(){this.$mainControl.dialog("close");},e.prototype.getHighestZindex=function(){for(var t=$("body").children(".jqx-window"),e=0,n=0,r=0;r<t.length;r++){(n=parseInt($(t[r]).css("z-index"))||0)>e&&(e=n);}return e+1;},e.prototype.getHeight=function(){return this.$mainControl.height();},e.prototype.clear=function(){this.systemEvent=!0;for(var t=0;t<this.options.source.length;++t){this.$itemControl.jqxGrid({selectedrowindexes:[]});}this.systemEvent=!1;},e.prototype.clearSelectedItems=function(){this.$itemControl.jqxGrid({selectedrowindexes:[]});},e.prototype.unselectRow=function(t){this.$itemControl.jqxGrid("unselectrow",this.pos[t]);},e.prototype._union=function(t,e){for(var n=0,r=0,i=[];n<t.length&&r<e.length;){t[n]<e[r]?(i.push(t[n]),n++):t[n]>e[r]?(i.push(e[r]),r++):(i.push(t[n]),n++,r++);}for(;n<t.length;){i.push(t[n]),n++;}for(;r<e.length;){i.push(e[r]),r++;}return i;},e.prototype._difference=function(t,e){for(var n=0,r=0,i=[];n<t.length&&r<e.length;){t[n]<e[r]?(i.push(t[n]),n++):t[n]>e[r]?r++:(n++,r++);}for(;n<t.length;){i.push(t[n]),n++;}return i;},e.prototype.setSortOptions=function(t){this.sortOptions=t;},t.VA.Core.Widget.Controls.ItemSelector=e;}.call(this),function(){"use strict";var t=this.Brightics;var e=[["style",["bold","italic","underline","clear"]],["fontsize",["fontsize"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["height",["height"]]];function n(t,e){this.parentId=t,this.options=this.setOptions(e),this.retrieveParent(),this.createControls(),this.createEvents();}n.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},n.prototype.setOptions=function(t){return $.extend(!0,{},t);},n.prototype.createControls=function(){var t=this.options.description||"";if(this.$mainControl=$('<div class="brtc-va-widget-note-control">'+t+"</div>"),this.$parent.append(this.$mainControl),document.createRange)try{document.getSelection().removeAllRanges();}catch(t){document.getSelection().addRange(document.createRange());}this.$mainControl.summernote({focus:void 0===this.options.focus||this.options.focus,toolbar:this.options.toolbar||e,fontSizes:FONT_SIZES,popover:{},height:this.options.height-24,disableDragAndDrop:!0,maximumImageFileSize:1,callbacks:$.extend(!0,{},this.options.callbacks)});},n.prototype.createEvents=function(){this.setRestrictCondition(),this.$mainControl.closest(".ui-dialog").length>0&&this._setStopPropagationMouseDown();},n.prototype.setRestrictCondition=function(){this.options.maxLength&&(this.createMessageArea(),this.createLengthRestriction(),this.createInputRestriction());},n.prototype._setStopPropagationMouseDown=function(){this.$parent.mousedown(function(t){t.stopPropagation();});},n.prototype.createMessageArea=function(){this.$messageArea=$('<div class="brtc-va-widget-note-message"></div>'),this.$parent.append(this.$messageArea),this.$messageArea.text(this.$parent.find(".note-editable").text().length+" / "+this.options.maxLength+" characters");},n.prototype.deleteImageElement=function(){this.$parent.find(".note-editing-area img").remove();},n.prototype.deleteHrefAttribute=function(){this.$parent.find(".note-editing-area a").removeAttr("href");},n.prototype.createLengthRestriction=function(){var t=this;this.$mainControl.on("summernote.change",function(e,n){t.deleteImageElement(),t.deleteHrefAttribute();var r=t.$parent.find(".note-editable").text().length;t.$messageArea.text(r+" / "+t.options.maxLength+" characters"),r>t.options.maxLength?(t.setOkbuttonCondition(!0),t.$messageArea.addClass("error")):(t.setOkbuttonCondition(!1),t.$messageArea.removeClass("error"));});},n.prototype.createInputRestriction=function(){var e=this;this.$mainControl.on("summernote.keydown",function(n,r){e.$parent.find(".note-editable").text().length>e.options.maxLength&&(t.VA.Core.Utils.InputValidator.isNotInsertKeyCode(r)||r.preventDefault());});},n.prototype.setOkbuttonCondition=function(t){this.options.okButton&&this.options.okButton.jqxButton({disabled:t});},n.prototype.getCode=function(){return this.getValue();},n.prototype.setCode=function(t){this.setValue(t);},n.prototype.focus=function(){this.$mainControl.summernote("focus");},n.prototype.isEmpty=function(){return this.$mainControl.summernote("isEmpty");},n.prototype.setHeight=function(t){this.$parent.find(".note-editable.panel-body").css({height:t});},n.prototype.getValue=function(){return this.$mainControl.summernote("code");},n.prototype.setValue=function(t){this.$mainControl.summernote("focus"),this.$mainControl.summernote("code",t||"");},n.prototype.clear=function(){this.$mainControl.summernote("focus"),this.$mainControl.summernote("reset");},n.prototype.destroy=function(){this.$mainControl.summernote("destroy");},t.VA.Core.Widget.Controls.NoteControl=n;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){return this.parentId=t,this.options=this.setOptions(e),this.value="",this.retrieveParent(),this.createControls(),this.createFocusEvent(),this;}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.setOptions=function(t){var e={numberType:"int",min:void 0,max:void 0,minus:!0,placeholder:"Enter value",enterCallback:function enterCallback(){}},n=$.extend(!0,e,t);return"int"==n.numberType?(n.max=n.max?n.max:"1073741824",n.min=n.min?n.min:"-1073741824"):"double"==n.numberType&&(n.max=n.max?n.max:"1073741824",n.min=n.min?n.min:"-1073741824"),n;},e.prototype.createControls=function(){var t=["brtc-va-editors-sheet-controls-numericInput"].concat(this.options.className||[]).join(" ");this.$mainControl=$('<input type="text" class="'+t+'" contenteditable>'),this.$mainControl.attr("placeholder",this.options.placeholder),this.$parent.append(this.$mainControl),this.addKeyEventListener();},e.prototype.setValue=function(t){this.$mainControl.val(t);},e.prototype.getValue=function(){return this.$mainControl.val();},e.prototype.setDisabled=function(t){return this.$mainControl.prop("disabled",t);},e.prototype.onChange=function(t){this.callback=t;},e.prototype.parseToNumber=function(t){return""===t?t:isNaN(t)?"":Number(t);},e.prototype.createFocusEvent=function(){var t=this;this.$mainControl.focus(function(){t.preValue=t.parseToNumber(t.$mainControl.val());}),this._OnNumericInputFocusOut=function(){var e=t.$mainControl.val();+e||t.isZero(e)?(void 0!==t.options.min&&+e<+t.options.min&&t.$mainControl.val(t.options.min),void 0!==t.options.max&&+e>+t.options.max&&t.$mainControl.val(t.options.max)):""===e&&t.options.mandatory&&void 0!==t.options.min&&t.$mainControl.val(t.options.min);},this.$mainControl.focusout(function(){t._OnNumericInputFocusOut();var e=t.parseToNumber(t.$mainControl.val());t.$mainControl.val(e),(e!==t.preValue&&"function"==typeof t.callback||t.options.checkValueChanged)&&t.callback(t.$mainControl.val());}),$("svg").on("mousedown",function(){var e=t.parseToNumber(t.$mainControl.val());t.$mainControl.val(e),e!==t.preValue&&"function"==typeof t.callback&&t.$mainControl.is(":focus")&&t.callback(t.$mainControl.val());});},e.prototype.getControl=function(){return this.$mainControl;},e.prototype.addKeyEventListener=function(){var t=this;this._OnNumericInputKeyDown=function(e){var n=e.which||e.keyCode;if(13===n)return t.options.enterCallback(t.getControl()),e.preventDefault(),!1;if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&n>=65&&n<=90||32==n||13==n)return e.preventDefault(),!1;if(!e.shiftKey&&!e.altKey&&!e.ctrlKey&&n>=48&&n<=57||n>=96&&n<=105||65==e.keyCode&&!0===e.ctrlKey||67==n&&!0===e.ctrlKey||88==n&&!0===e.ctrlKey||n>=35&&n<=39||8==n||9==n||13==n||46==n||45==n)return!0;var r=t.$mainControl.val();return 109==n||189==n?!("-"===r[0]||!t.options.minus):(!(e.shiftKey||e.altKey||e.ctrlKey||190!=n)||188==n||110==n)&&!/[\.,]/.test(r)&&"int"!==t.options.numberType;},this.$mainControl.keydown(this._OnNumericInputKeyDown),this._OnNumericInputKeyUp=function(e){var n=t.$mainControl.val();n&&(n=(n=("-"===n[0]?"-":"")+n.replace(/[^0-9\.]/g,"")).replace(/\.(?=(.*)\.)+/g,""),t.$mainControl.val(n));},this.$mainControl.keyup(this._OnNumericInputKeyUp);},e.prototype.isZero=function(t){return null!=t&&""!=t&&0==+t;},e.prototype.focus=function(){this.$mainControl.focus();},t.VA.Core.Widget.Controls.NumericInput=e;}.call(this),function(){"use strict";var t=this.Brightics;function e(t,e){this.parentId=t,this.options=e,this.retrieveParent(),this.init();}e.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},e.prototype.init=function(){var t=this;for(var e in this.$tabHeaderWrapper=this.$parent.children("ul"),this.$tabHeaders=this.$tabHeaderWrapper.children("li"),this.$tabContents=this.$parent.children("div"),this.$tabHeaderWrapper.addClass("brtc-style-tab-header-wrapper"),this.$tabHeaders.addClass("brtc-va-tab-header").addClass("brtc-style-tab-header"),this.$tabContents.addClass("brtc-style-tab"),this.$tabHeaders){var n=this.$tabHeaders.eq(e),r=n.text();n.html('<div class="brtc-va-tab-header-titlewrapper brtc-style-tab-header-titlewrapper"></div>'),n.find(".brtc-va-tab-header-titlewrapper").text(r);}this.$tabHeaders.eq(0).addClass("selected"),this.$tabContents.eq(0).addClass("selected"),this.$tabHeaders.on("click",function(e){var n=t.$tabHeaders.index(this);t.$tabHeaders.removeClass("selected"),$(this).addClass("selected"),t.$tabContents.removeClass("selected"),t.$tabContents.eq(n).addClass("selected"),t.$parent.trigger("selected",[n]),$("body").hasClass("scroll-always")&&1==n&&t.$parent.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions").perfectScrollbar("update");});},e.prototype.select=function(t){this.$tabHeaders.removeClass("selected"),$(this.$tabHeaders[t||0]).addClass("selected"),this.$tabContents.removeClass("selected"),this.$tabContents.eq(t).addClass("selected"),$("body").hasClass("scroll-always")&&1==t&&this.$parent.find(".brtc-va-dialogs-selectfnunit-tab-allfunctions").perfectScrollbar("update");},t.VA.Core.Widget.Controls.TabControl=e;}.call(this),function(){"use strict";var t=this.Brightics,e=["number","string","array[string]","array[number]"],n=["array[string]","array[number]"],r=["number","array[number]"],i=brtc_require("FnUnitUtils");function o(t,e){this.parentId=t,this.initOptions(e),this.retrieveParent(),this.createControls(),this.setInputValue();}o.prototype.initOptions=function(t){this.options=$.extend(!0,{},t),this.variableKey=Object.keys(this.options.variable)[0],this.variableType=this.options.variable[this.variableKey]["variable-type"],this.inputType=this.getInputType(this.variableType),this.variableValue=this.options.variable[this.variableKey].value;},o.prototype.retrieveParent=function(){this.$parent=t.VA.Core.Utils.WidgetUtils.retrieveWidget(this.parentId);},o.prototype.createControls=function(){var t=this;this.$mainControl=$('<div class="brtc-va-widget-container">   <div class ="brtc-va-widget-remove" />   <div class="brtc-va-widget-label" />   <div class="brtc-va-widget-header" />   <div class="brtc-va-widget-contents"><div class="brtc-va-widget-contents-input-container-wrapper"></div></div></div>'),this.$parent.append(this.$mainControl),this._renderLabel(),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());});},o.prototype._renderLabel=function(){var t=this.$mainControl.find(".brtc-va-widget-label");if(this.options.label){this.options.mandatory&&t.addClass("mandatory"),this.variableType=this.variableType||"";var e=this.variableType.indexOf("array")>=0?"array":this.variableType;t.addClass(e),t.text(this.options.label),t.show();}else t.hide();},o.prototype.isArrayValue=function(){return n.indexOf(this.variableType)>-1;},o.prototype.isCellValue=function(){return"cell"===this.variableType;},o.prototype.createContentsArea=function(){this.$contentsArea=this.$mainControl.find(".brtc-va-widget-contents-input-container-wrapper");var t=this.$mainControl.find(".brtc-va-widget-header");t.hide(),this.isCellValue()?this.createCellInputControl():this.isArrayValue()?(t.show(),this.createArrayInputControl()):this.createSingleInputControl();},o.prototype.createCellInputControl=function(){this.createCellControlLayout();},o.prototype._createArrayInputHeaderArea=function(){var _this8=this;this.$arrayInputHeader&&this.$arrayInputHeader.remove(),this.$arrayInputHeader=$('\n            <div class="brtc-va-widget-contents-array-input-header-area">\n                <div class="brtc-va-widget-contents-array-header-button" current-edit-type="control">Bulk edit</div>\n            </div>');var t=this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button");this.$mainControl.find(".brtc-va-widget-header").append(this.$arrayInputHeader),t.click(function(){"control"===t.attr("current-edit-type")?(_this8._changeControlToBulk(),_this8._changeArrayInputHeaderButton("bulk")):"bulk"===t.attr("current-edit-type")&&(_this8._changeBulkToControl(),_this8._changeArrayInputHeaderButton("control")),_this8.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");});},o.prototype._changeArrayInputHeaderButton=function(t){var e=this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button");"bulk"===t?(e.attr("current-edit-type","bulk"),e.text("Apply"),this.$mainControl.find(".brtc-va-widget-contents").scrollTop(0)):"control"===t&&(e.attr("current-edit-type","control"),e.text("Bulk edit"));},o.prototype._isBulkType=function(){return"bulk"===this.$arrayInputHeader.find(".brtc-va-widget-contents-array-header-button").attr("current-edit-type");},o.prototype._changeControlToBulk=function(){var e=this.getInputValue();this.$contentsArea.empty(),this._bulkAceEditorControl=t.VA.Core.Widget.Factory.aceEditorControl(this.$contentsArea,{value:e.join("\n"),editorOptions:{enableBasicAutocompletion:!1,enableSnippets:!1,enableLiveAutocompletion:!1}});var n=this._bulkAceEditorControl.getSession();n.setOption("indentedSoftWrap",!1),n.setUseWrapMode(!0),n.setWrapLimitRange();},o.prototype._changeBulkToControl=function(){var t=this._getBulkListValue();this.setInputValue(t),this.triggerChangeInputValue(!0),this._destroyBulkAceEditor();},o.prototype._destroyBulkAceEditor=function(){this._bulkAceEditorControl&&(this._bulkAceEditorControl.destroy(),this._bulkAceEditorControl=void 0);},o.prototype.createArrayInputControl=function(){if(this._createArrayInputHeaderArea(),this.variableValue&&0!==this.variableValue.length){if(this.variableValue instanceof Array)for(var t=0;t<this.variableValue.length;t++){this.createInputControlLayout(t,this.isArrayValue());}else this.createInputControlLayout(0,this.isArrayValue());}else this.createInputControlLayout(0,this.isArrayValue());this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar();},o.prototype.createSingleInputControl=function(){this.createInputControlLayout(0,!1);},o.prototype.createCellControlLayout=function(){var t=this.$contentsArea,e=$('<div class="brtc-va-widget-contents-input-container brtc-style-flex-direction-column brtc-style-height-auto brtc-style-align-items-flex-start">   <div class="data-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5">       <div class="brtc-style-width-100 brtc-style-line-height-30">Input Data</div>   </div>   <div class="row-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5">       <div class="brtc-style-width-100 brtc-style-line-height-30">Row Index</div>   </div>   <div class="column-area brtc-style-display-flex brtc-style-col-12 brtc-style-margin-top-5">       <div class="brtc-style-width-100 brtc-style-line-height-30">Column Name</div>   </div></div>');t.append(e);var n=$('<div class="brtc-style-width-minus-100"></div>'),r=$('<div class="brtc-style-width-minus-100"></div>'),i=$('<div class="brtc-style-width-minus-100"></div>'),o=e.find(".data-area"),a=e.find(".row-area"),s=e.find(".column-area");o.append(n),a.append(r),s.append(i),this.createCellControl(n,r,i);},o.prototype.createInputControlLayout=function(t,e,n){var r=this.$contentsArea,i=this,o=!1,a=$('<div class="brtc-va-widget-contents-input-container"></div>'),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=$('<div class="brtc-va-widget-contents-input-control-container"></div>');a.append(u),(t>0||o)&&(l=$('<div class="brtc-va-widget-contents-input-control-delete"></div>'),a.append(l),l.click(function(t){i.handleDeleteButtonClick($(this).closest(".brtc-va-widget-contents-input-container"));})),e&&(c=$('<div class="brtc-va-widget-contents-input-control-add"></div>'),a.append(c),c.click(function(t){i.handleAddInputControlEvent($(this).closest(".brtc-va-widget-contents-input-container"));})),this.isArrayValue()?this.isNumericType()?this.createNumericInputControl(u,n):this.createInputControl(u,n):this.isNumericType()?this.createNumericInputControl(u,n):this.createCodeInputControl(u,n);},o.prototype.createNumericInputControl=function(e,n){var r=this,i={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"double",placeHolder:"Enter value",className:["brtc-va-widget-contents-input-control"],enterCallback:function(t){this.isArrayValue()&&this.handleAddInputControlEvent(t.closest(".brtc-va-widget-contents-input-container"),!0);}.bind(this)},o=new t.VA.Core.Widget.Controls.NumericInput(e,i);o.onChange(function(){r.triggerChangeInputValue(!1);}),n&&o.focus();},o.prototype.createDropDownList=function(e,n){var r={theme:t.VA.Env.Theme,height:"25px",autoDropDownHeight:!0,enableBrowserBoundsDetection:!0,width:"calc(100% - 100px)"};n&&$.extend(r,n),e.jqxDropDownList(r);},o.prototype.createIndataSource=function(){var t=Studio.getEditorContainer().getActiveModelEditor().getActiveModel();return i.getInTable(this.options.fnUnit).map(function(e){var n=t.getFnUnitByOutTable(e);return{label:n.display.label,tid:e,type:n.func};});},o.prototype.createCellControl=function(e,n,r){var i=this;this.$data=e,this.createDropDownList(e,{source:this.createIndataSource(),displayMember:"label",valueMember:"tid"}),e.change(function(){i.triggerChangeCellValue();});var o={theme:t.VA.Env.Theme,height:"25px",width:"100%",numberType:"int",minus:!1,placeholder:"(0 < value)",className:["brtc-va-widget-contents-input-control"]};this.rowInput=new t.VA.Core.Widget.Controls.NumericInput(n,o),this.rowInput.onChange(function(){i.triggerChangeCellValue();}),this.rowInput.focus(),this.$columnControl=$('<input type="text" class="brtc-va-widget-contents-input-control"/>'),r.append(this.$columnControl);var a={theme:t.VA.Env.Theme,height:"25px",width:"100%",placeHolder:"Enter value"};this.$columnControl.jqxInput(a),this.$columnControl.focusout(function(t){i.triggerChangeCellValue();});},o.prototype.createInputControl=function(e,n){var r=this,i=$('<input type="text" class="brtc-va-widget-contents-input-control"/>');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(!1);});},o.prototype.createCodeInputControl=function(e,n){var r=this,i=$('<textarea  class="brtc-va-widget-contents-input-control"/>');e.append(i);var o={mode:this.isLiteralType(this.variableType)?"brtc-system-variable":"brtc-control",scrollbarStyle:"null",placeholder:this.isLiteralType(this.variableType)?"Enter value":"Enter expression",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0,hintOptions:{list:"literal"==this.variableType?["${sys.user}","${sys.date}"]:[]}};this.codeMirror=CodeMirror.fromTextArea(i[0],o);var a={"valid-message-position":this.options["valid-message-position"]};t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(this.codeMirror,a),this.codeMirror.on("blur",function(t,e){r.triggerChangeInputValue(!1);});},o.prototype.handleAddInputControlEvent=function(t,e){var n=t.index();this.createInputControlLayout(n,!0,e),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var r=this.$mainControl.parents(".ps-container");r&&r.length&&r.perfectScrollbar("update");},o.prototype.handleDeleteButtonClick=function(t){t.remove(),this.triggerChangeInputValue(),this.$mainControl.find(".brtc-va-widget-contents").perfectScrollbar("update");var e=this.$mainControl.parents(".ps-container");e&&e.length&&e.perfectScrollbar("update");},o.prototype.triggerChangeInputValue=function(t){if("function"==typeof this.options.onChangeCallback){var e=this.getInputValue();(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedValue()));}},o.prototype.triggerChangeCellValue=function(t){if("function"==typeof this.options.onChangeCallback){var e={inData:this.$data.val(),rowIndex:this.rowInput.getValue(),column:this.$columnControl.val()};(JSON.stringify(e)!==JSON.stringify(this.variableValue)||t)&&(this.variableValue=e,this.options.onChangeCallback(this.createFormattedCellValue()));}},o.prototype.createFormattedCellValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.variableValue};},o.prototype.createFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:this.isLiteralType(this.variableType)?this.variableValue:t.VA.Core.Utils.VariableUtils.wrap(this.variableValue)};},o.prototype.getFormattedValue=function(){return{key:this.variableKey,type:this.inputType,"variable-type":this.variableType,value:"calculation"===this.variableType?t.VA.Core.Utils.VariableUtils.wrap(this.getInputValue()):this.getInputValue()};},o.prototype._getBulkListValue=function(){var _this9=this;var t=[],e=this._bulkAceEditorControl.getValue();return e&&e.split("\n").forEach(function(e){t.push(_this9.getValueByType(e));}),0===t.length&&(t=this.isNumericType()?[0]:[""]),t;},o.prototype.getInputValue=function(){var t,e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isArrayValue()){(t=[]).length=e.length;for(var n=0;n<e.length;n++){var r=this.getValueByType($(e[n]).val());t[n]=r;}}else t=this.isNumericType()?this.getValueByType(e.val()):this.getValueByType(this.codeMirror.getValue());return t;},o.prototype.setVariableType=function(t){this.variableType=t,this.$contentsArea.empty(),this.createContentsArea();},o.prototype.setInputValue=function(t){void 0!==t&&(this.variableValue=t);var e=this.$contentsArea.find(".brtc-va-widget-contents-input-control");if(this.isCellValue())this.rowInput.setValue(this.variableValue.rowIndex),this.$columnControl.val(this.variableValue.column),this.$data.val(this.variableValue.inData);else if(this.isArrayValue()){var n;if(e.length>this.variableValue.length)for(n=0;n<e.length;n++){void 0===this.variableValue[n]?$(e[n]).parents(".brtc-va-widget-contents-input-container").remove():$(e[n]).val(this.getValueByType(this.variableValue[n]));}else{for(n=e.length;n<this.variableValue.length;n++){this.createInputControlLayout(n,!0);}for(e=this.$contentsArea.find(".brtc-va-widget-contents-input-control"),n=0;n<e.length;n++){$(e[n]).val(this.getValueByType(this.variableValue[n]));}}this._destroyBulkAceEditor(),this._changeArrayInputHeaderButton("control");}else Array.isArray(this.variableValue)?this.isNumericType()?e.val(this.getValueByType(this.variableValue[0])):this.codeMirror.setValue(this.getValueByType(this.variableValue[0])):this.isNumericType()?e.val(this.getValueByType(this.variableValue)):this.codeMirror.setValue(this.getValueByType(this.variableValue));},o.prototype.setRemovable=function(t){this.options.removable=t,t?this.$mainControl.find(".brtc-va-widget-remove").addClass("removable"):this.$mainControl.find(".brtc-va-widget-remove").removeClass("removable");},o.prototype.getOptions=function(){return this.options;},o.prototype.isLiteralType=function(t){return e.indexOf(t)>-1;},o.prototype.getInputType=function(t){return this.isLiteralType(t)?"literal":"expression";},o.prototype.isNumericType=function(){return r.indexOf(this.variableType)>-1;},o.prototype.toString=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?"":_.isNumber(t)?_.isNaN(t)||_.isUndefined(t)?"":t.toString():t;},o.prototype.toNumber=function(t){return _.isNull(t)||_.isUndefined(t)||""===t?0:Number(this.toString(Number(t)));},o.prototype.getValueByType=function(e){return this.isNumericType()?this.toNumber(e):this.isLiteralType(this.variableType)?this.toString(e):t.VA.Core.Utils.VariableUtils.strip(e);},this.Brightics.VA.Core.Widget.Controls.VariableControl=o;}.call(this),function(){"use strict";var t=this;t.Brightics.VA.Core.Widget.Factory={variableControl:function variableControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.VariableControl(e,n);},arrayInputControl:function arrayInputControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.ArrayInputControl(e,n);},argumentControl:function argumentControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.ArgumentControl(e,n);},createFadeOutMessage:function createFadeOutMessage(e,n){new t.Brightics.VA.Core.Widget.Controls.FadeOutMessage(e,n);},noteControl:function noteControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.NoteControl(e,n);},numericInputControl:function numericInputControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.NumericInput(e,n);},aceEditorControl:function aceEditorControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.AceEditorControl(e,n);},tabControl:function tabControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.TabControl(e,n);},colorPickerControl:function colorPickerControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.ColorPickerControl(e,n);},opacityControl:function opacityControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.OpacityControl(e,n);},borderControl:function borderControl(e,n){return new t.Brightics.VA.Core.Widget.Controls.BorderControl(e,n);}};}.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=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run">   <div class="brtc-va-dialogs-body">       <div class="brtc-va-dialogs-contents">       </div>       <div class="brtc-va-dialogs-buttonbar">           <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" />       </div>   </div></div>'),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 n,r=this.analyticsModel.variables||{};this.variableControlList=[];for(var i=Object.keys(r),o=0;o<i.length;o++){(n={})[i[o]]={value:r[i[o]].value||"","variable-type":r[i[o]].type||"string"};var a={button:{visible:!1},variable:n,label:i[o]};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,a));}e.perfectScrollbar();},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++){e[(t=this.variableControlList[n].getFormattedValue()).key]=t.value;}return e;},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList()},this.$mainControl.dialog("close");},t.VA.Core.Dialogs.RunDataDialog=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.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=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run">   <div class="brtc-va-dialogs-body">       <div class="brtc-va-dialogs-contents">       </div>       <div class="brtc-va-dialogs-buttonbar">           <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" />       </div>   </div></div>'),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 n,r=this.analyticsModel.variables||[];this.variableControlList=[];for(var i=0;i<r.length;i++){(n={})[r[i].name]={type:"literal",value:r[i].value||"","variable-type":r[i].type};var o={button:{visible:!1},variable:n,label:r[i].name};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,o));}e.perfectScrollbar();},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++){e[(t=this.variableControlList[n].getFormattedValue()).key]=t.value;}return e;},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList()},this.$mainControl.dialog("close");},t.VA.Core.Dialogs.RunControlDialog=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.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=$('<div class="brtc-va-dialogs-main brtc-va-dialogs-run">   <div class="brtc-va-dialogs-body">       <div class="brtc-va-dialogs-contents">       </div>       <div class="brtc-va-dialogs-buttonbar">           <input type="button" class="brtc-va-dialogs-buttonbar-ok" value="OK" />       </div>   </div></div>'),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 n,r=this.analyticsModel["gv-def"]||{};this.variableControlList=[],this.duration={};var i={Duration:{type:"literal",value:"5","variable-type":"string"}},o={button:{visible:!1},variable:i};this.duration=t.VA.Core.Widget.Factory.variableControl(e,o);for(var a=0;a<Object.keys(r).length;a++){(n={})[Object.keys(r)[a]]={type:"literal",value:r[Object.keys(r)[a]].value||"","variable-type":r[Object.keys(r)[a]]["variable-type"]||"string"};var s={button:{visible:!1},variable:n};this.variableControlList.push(t.VA.Core.Widget.Factory.variableControl(e,s));}e.perfectScrollbar();},e.prototype.createVariablesList=function(){for(var t,e={},n=0;n<this.variableControlList.length;n++){("array"==(t=this.variableControlList[n].getFormattedValue())["variable-type"]&&1==t.value.length?t.value[0]:t.value)&&(e[t.key]=t.value);}return e;},e.prototype.handleOkClicked=function(){this.dialogResult={OK:!0,Cancel:!1,args:this.createVariablesList(),duration:this.duration.getFormattedValue().value},this.$mainControl.dialog("close");},t.VA.Core.Dialogs.RunRealTimeDialog=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.Utils;function e(t){this.editorInput=t,this.reportData=t.getContents().report.data||[];}function n(t,e){return t+"-"+e;}function r(t){var e="Title",n=t.title.fnUnitLabel;return null!=n&&(e="["+n+"] "),void 0!==t.title.panelTitle&&(e+=t.title.panelTitle),e;}function i(t){this.$controlArea=t;}e.prototype.addReportData=function(t){var e=this;return new Promise(function(n,r){if(function(t){return t.options.id&&t.options.chartOption&&t.data.mid&&t.data.table;}(t)){var i=e.reportData.push(e.formattedData(t));e.editorInput.getContents().report={data:e.reportData},n(i-1);}else r("Data are not correct");});},e.prototype.openDialog=function(e,n){var r=this;e.dialog({theme:t.VA.Env.Theme,width:950,maxWidth:950,minWidth:950,height:800,minHeight:400,maxHeight:1200,modal:!0,resizable:!1,open:function open(){r.initReportViewer(e),r.render();},keyboardCloseKey:""}),this.$reportWindow.on("close",function(){n(),e.dialog("destroy");});},e.prototype.formattedData=function(t){return{id:t.options.id+"-"+t.options.chartOption.chart.type,type:"Chart",originData:t};},e.prototype.removeReportData=function(t,e){var r=n(t,e);for(var i in this.reportData){if(this.reportData[i].id===r)return void this.removeReportDataByIndex(i);}},e.prototype.initReportViewer=function(t){this.$reportWindow=t,this.initReportWindowToolbar(),this.initReportWindowBody();},e.prototype.initReportWindowToolbar=function(){var t=this;this.$reportWindowBody=this.$reportWindow.find(".brtc-va-editors-modeleditor-report-window-body");var e=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools-container"></div>');this.$reportWindowBody.prepend(e);var n=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-share fa fa-share-alt" title="Publish"></div>'),r=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-add" title="Click to add text"></div>'),i=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-report-all" title="Download Report Image"></div>'),o=$('<div class="brtc-va-editors-modeleditor-report-window-head-tools brtc-va-editors-modeleditor-report-window-head-tools-report-each" title="Download Report Each Element Image"></div>');e.append(i),e.append(o),e.append(r),e.append(n),i.on("click",function(){t.downloadAll();}),o.on("click",function(){t.downloadEachAll();}),n.on("click",function(){t.publishReport();}),r.on("click",function(){t.addReportTextBox();});},e.prototype.publishReport=function(){var e=this;if(this.editorInput.getContents().report.id)this.showPublishInfo();else{this.editorInput.getContents().report.id=t.VA.Core.Utils.IDGenerator.report.id(60);var n={url:"/report",type:"POST",contentType:"application/json; charset=utf-8",data:JSON.stringify({reportId:this.editorInput.getContents().report.id,userId:t.VA.Env.Session.userId,modelId:this.editorInput.id,projectId:this.editorInput.getProjectId()})};$.ajax(n).done(function(){e.showPublishInfo();});}},e.prototype.showPublishInfo=function(){var e=this;$.ajax({url:"/report/publishsite",type:"GET",contentType:"application/json; charset=utf-8"}).done(function(n){var r={title:"Publish Information"};r.window={theme:t.VA.Env.Theme,width:"600px",height:"150px",maxWidth:"600px",maxHeight:"150px",modal:!0,resizable:!1,cancelButton:e.$cancelButton,open:function open(){e.createDialogContentsArea($(this.element).find(".brtc-va-dialogs-contents"),n);}},new t.VA.Core.Dialogs.Dialog(e.$reportWindowBody,r);});},e.prototype.createDialogContentsArea=function(e,n){var r="http://"+n.ip+":"+n.port+"/report?report="+this.editorInput.getContents().report.id;e.append('<div style="width:100%">   <div style="width:10%;float: left">url: </div>   <div style="width:70%;float: left"><input class="brtc-va-widget-contents-input-control" value="'+r+'" readonly></div>   <div style="width:20%;float: left;display: flex;justify-content: center;"><button class="brtc-va-copy-clipboard-button" type="button"">Copy</button></div></div>');var i=e.find(".brtc-va-copy-clipboard-button");i.jqxButton({theme:t.VA.Env.Theme}),i.on("click",function(){window.prompt("Copy to clipboard: Ctrl+C",r);});},e.prototype.initReportWindowBody=function(){this.$reportWindowBody.perfectScrollbar(),this.$reportContentsArea=$('<div class="brtc-va-editors-modeleditor-report-contents-area"></div>'),this.$reportContainer=this.$reportWindow.find(".brtc-va-editors-modeleditor-report-element-container"),this.$reportContainer.append(this.$reportContentsArea),this.pageHandler=new i(this.$reportContentsArea),this.$processingWindow=$('<div><div>Processing ...</div><div><div class="brtc-va-progress"><div><span class="brtc-va-progress-loading"></div></div></div>'),this.$reportContainer.append(this.$processingWindow),$(this.$processingWindow).dialog({width:300,height:200,theme:t.VA.Env.Theme,showCloseButton:!1,autoOpen:!1,modal:!0,resizable:!1,keyboardCloseKey:""});},e.prototype.addReportTextBox=function(){var e=this.reportData.push({id:t.VA.Core.Utils.IDGenerator.report.id()+"-Text",type:"Text",originData:""});this.renderIndexData(e-1);},e.prototype.render=function(){var t=this;$(this.$reportWindow).on("open",function(){t.showProcessingWindow();}),this.clearReport(),this.setReportContentsAreaSize();var e=[];for(var n in e.push(new Promise(function(e,n){$(t.$processingWindow).on("open",function(){e();});})),this.reportData){var r=this.renderIndexData(n);e.push(r);}Promise.all(e).then(function(){t.hideProcessingWindow(),t.convertReportLayout();},function(e){t.hideProcessingWindow();});},e.prototype.renderIndexData=function(t){if(this.reportData[t]){var e=this.renderReportElementBox(this.reportData[t],t);return this.attachReportElementBoxHeaderItems(this.reportData[t],e.elementBox),e.promise;}},e.prototype.clearReport=function(){this.$reportContentsArea.empty();},e.prototype.setReportContentsAreaSize=function(){var t=this.reportData,e=0;this.relativeContentsIndexList=[];for(var n=0;n<t.length;n++){t[n].position?e=Math.max(e,t[n].position.top+t[n].size.height+5):this.relativeContentsIndexList.push(n);}var r=300*this.relativeContentsIndexList.length;this.$reportContentsArea.css("height",e+r);},e.prototype.containsData=function(t,e){var r=n(t,e);for(var i in this.reportData){if(this.reportData[i].id===r)return!0;}return!1;},e.prototype.renderReportElementBox=function(t,e){return"Chart"===t.type?this.renderReportChartBox(t,e):"Text"===t.type?this.renderReportTextBox(t,e):void 0;},e.prototype.renderReportChartBox=function(e,n){var i=$('<div class="brtc-va-editors-modeleditor-report-element" content-type="'+e.type+'">   <div class="brtc-va-editors-modeleditor-report-element-head">       <div class="brtc-va-editors-modeleditor-report-element-head-label" title="'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r(e.originData))+'">'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r(e.originData))+'</div>   </div>   <div class="brtc-va-editors-modeleditor-report-element-body"></div></div>');this.$reportContentsArea.append(i),this.setContentsSizeAndPosition(i,e.size,e.position,n),this.setResizable(i),this.setDraggable(i);var o=e.originData.data.table||e.originData.data.fid,a=!1;if(this.editorInput.getContents().mid&&!this.editorInput.getContents().getFnUnitByOutTable(o)){var s=i.find(".brtc-va-editors-modeleditor-report-element-head-label");s.text("Function has been removed."),s.addClass("function-removed"),a=!0;}var c=new Promise(function(n,r){var o;(o=e.originData.data,new Promise(function(e,n){t.VA.Core.DataQueryTemplate.queryTable(o.mid,o.table||o.fid,function(t){e(t);},function(t){n(t);});})).then(function(t){var r=$.extend({},e.originData.options.chartOption,t);a&&(r.columns=[],r.data=[]),i.find(".brtc-va-editors-modeleditor-report-element-body").BrighticsChart(r),n();},function(t){r(t);});});return{elementBox:i,promise:c};},e.prototype.setContentsSizeAndPosition=function(t,e,n,r){if(e&&n)t.css({position:"absolute",top:n.top,left:n.left,width:e.width,height:e.height});else{var i=this.$reportContentsArea.height(),o=this.relativeContentsIndexList.length,a=this.relativeContentsIndexList.indexOf(parseInt(r));t.css({position:"absolute",top:i-300*(o-a),left:15,width:900,height:290});}},e.prototype.setNewContentsSizeAndPosition=function(t,e){var n=this.$reportContentsArea.height(),r=n;this.pageHandler.increasePageHeight(290),t.css({position:"absolute",top:n,left:15,width:300,height:290}),e.position={top:r,left:15},e.size={width:300,height:290};},e.prototype.renderReportTextBox=function(t,e){var n=$('<div class="brtc-va-editors-modeleditor-report-element" content-type="'+t.type+'">   <div class="brtc-va-editors-modeleditor-report-element-head">       <div class="brtc-va-editors-modeleditor-report-element-head-label"></div>   </div>   <div class="brtc-va-editors-modeleditor-report-element-body">       <div class="brtc-va-editors-modeleditor-report-element-body-contents"></div>   </div></div>');this.$reportContentsArea.append(n),this.setContentsSizeAndPosition(n,t.size,t.position),this.setResizable(n),this.setDraggable(n);var r=n.find("textarea.brtc-va-editors-modeleditor-report-element-body-textarea");return r.val(t.originData),r.on("blur",function(){t.originData=$(this).val().trim();}),n.find(".brtc-va-editors-modeleditor-report-element-body-contents").append(t.originData),{elementBox:n,promise:Promise.resolve()};},e.prototype.setResizable=function(t){var e=this;t.resizable({autoHide:!0,stop:function stop(n,r){var i=r.element.index(),o=r.position,a={width:r.element.outerWidth(),height:r.element.outerHeight()};a=e.configureContentSize(t,o,a),e.setPositionToReportDataByIndex(i,o,a);},resize:function resize(t,n){var r=n.position,i=(n.element.outerWidth(),n.element.outerHeight()),o=r.top+i;e.pageHandler.handlePageHeight(o);},minHeight:80,minWidth:150});},e.prototype.setDraggable=function(t){var e=this;t.draggable({handle:e.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element-head"),stop:function stop(n,r){var i=r.helper.index(),o=r.position,a={width:r.helper.outerWidth(),height:r.helper.outerHeight()};o=e.configureContentPosition(t,o,a),e.setPositionToReportDataByIndex(i,o,a);},drag:function drag(t,n){var r=n.position.top+n.helper.height();e.pageHandler.handlePageHeight(r+10);}});},e.prototype.configureContentSize=function(t,e,n){var r=e.left+n.width,i=this.$reportContentsArea.width();return r>i&&(t.width(i-e.left),n.width=i-e.left),n;},e.prototype.configureContentPosition=function(t,e,n){var r=e.left+n.width,i=this.$reportContentsArea.width();return e.top<5&&(e.top=5),e.left<5&&(e.left=5),r>i&&(e.left=e.left-(r-i)),t.css({top:e.top,left:e.left}),e;},e.prototype.attachReportElementBoxHeaderItems=function(e,n){var r=this,i=n.find(".brtc-va-editors-modeleditor-report-element-head");if("Text"===e.type){var o=$('<div class="brtc-va-editors-modeleditor-report-element-toolbar brtc-va-editors-modeleditor-report-element-toolbar-edit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></div>');i.append(o),o.click(function(){var n=$(this).parents(".brtc-va-editors-modeleditor-report-element"),r=n.find(".brtc-va-editors-modeleditor-report-element-body-contents"),i={contents:r.html(),save:function save(t){e.originData=t,n.attr("content-type","Text"),r.empty(),r.append(t);}};new t.VA.Core.Dialogs.NoteDialog($(this).closest(".brtc-va-editors-modeleditor-report-element-body"),i);}),e.position||this.setNewContentsSizeAndPosition(n,e);}var a=$('<div class="brtc-va-editors-modeleditor-report-element-toolbar brtc-va-editors-modeleditor-report-element-toolbar-remove"></div>');i.append(a),a.click(function(){var e=$(this).parents(".brtc-va-editors-modeleditor-report-element").index();t.VA.Core.Utils.WidgetUtils.openConfirmDialog("Are you sure you want to delete this graph?",function(t){t.OK&&r.removeReportDataByIndex(e);});});},e.prototype.removeReportDataByIndex=function(t){if(t>-1){var e=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element");e.length>t&&e[t].remove(),this.reportData.splice(t,1);}},e.prototype.setPositionToReportDataByIndex=function(t,e,n){this.reportData[t].size=n,this.reportData[t].position=e;},e.prototype.showProcessingWindow=function(){$(this.$processingWindow).dialog("open");},e.prototype.hideProcessingWindow=function(){$(this.$processingWindow).dialog("close");},e.prototype.convertReportLayout=function(){var t=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element");this.pageHandler.setHeight(this.$reportContentsArea.height());for(var e=t.length-1;e>=0;e--){this.convertRelativeToAbsolute(e,$(t[e]));}this.relativeContentsIndexList=[];},e.prototype.convertRelativeToAbsolute=function(t,e){var n,r,i;i=e.position(),n=e.outerHeight(),r=e.outerWidth(),e.css({position:"absolute",width:r,height:n,left:i.left,top:i.top}),this.setPositionToReportDataByIndex(t,i,{width:r,height:n});},e.prototype.downloadAll=function(){this.showProcessingWindow(),this.changeReportCss(!1),html2canvas(this.$reportContainer,{onrendered:function onrendered(t){var e=t.toDataURL("image/png"),n=$("<a>").attr("href",e).attr("download","report.png").appendTo("body");n[0].click(),n.remove();}}),this.changeReportCss(!0),this.hideProcessingWindow();},e.prototype.downloadEachAll=function(){var t=this;this.showProcessingWindow(),this.changeReportCss(!1);var e=this.$reportContentsArea.find(".brtc-va-editors-modeleditor-report-element"),n=0;!function r(){n<e.length?html2canvas(e[n],{onrendered:function onrendered(t){var e=t.toDataURL("image/png"),i=$("<a>").attr("href",e).attr("download","report"+n+".png").appendTo("body");i[0].click(),i.remove(),n++,r();}}):(t.changeReportCss(!0),t.hideProcessingWindow());}();},e.prototype.changeReportCss=function(t){t?(this.$reportWindowBody.perfectScrollbar(),this.$reportWindowBody.css({height:this.reportWindowBodyHeight}),this.$reportWindow.css({height:this.reportWindowHeight,"max-height":this.reportWindowMaxHeight})):(this.$reportWindowBody.perfectScrollbar("destroy"),this.reportWindowBodyHeight=this.$reportWindowBody.css("height"),this.$reportWindowBody.css({height:"auto"}),this.reportWindowHeight=this.$reportWindow.css("height"),this.reportWindowMaxHeight=this.$reportWindow.css("max-height"),this.$reportWindow.css({"max-height":"",height:"auto"}));},i.prototype.setHeight=function(t){this.$controlArea.height(t);},i.prototype.increasePageHeight=function(t){t=t||50;var e=this.$controlArea.height()||0;this.$controlArea.height(e+t);},i.prototype.handlePageHeight=function(t){t+10>this.$controlArea.height()&&this.$controlArea.height(t+10);},t.VA.Core.ReportManager=e;}.call(this),function(){"use strict";var t=this.Brightics;t.VA.Core.DataQueryTemplate={schemaCache:{},cache:{},requested:{},addCache:function addCache(t,e,n){var r=t+"_"+e;this.schemaCache[r]=n;},removeCache:function removeCache(t,e){if(e){var n=t+"_"+e;delete this.cache[n],delete this.schemaCache[n];}else{var r=[];for(var i in this.cache){0==i.indexOf(t+"_")&&r.push(i);}for(var o in r){delete this.cache[r[o]];}for(var i in r=[],this.schemaCache){0==i.indexOf(t+"_")&&r.push(i);}for(var o in r){delete this.schemaCache[r[o]];}}},isCached:function isCached(t,e){var n=t+"_"+e;return this.cache[n];},clearCache:function clearCache(){this.cache={},this.schemaCache={};},queryTable:function queryTable(t,e,n,r,i,o){var a=t+"_"+e;o=o||{};!0!==i&&this.cache[a]?n(this.cache[a],e):o.publish?(o.destination="publish",this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o)):this.queryData(t,e,o.offset||0,o.limit||1e3,n,r,o);},queryTableForReport:function queryTableForReport(t,e,n,r,i){var o=t+"_"+e;!0!==i&&this.cache[o]?n(this.cache[o],e):this.queryData(t,e,0,1e3,n,r,"/report");},fetchMore:function fetchMore(t,e,n,r,i){var o=1e3,a=t+"_"+e;o=this.cache[a]&&this.cache[a].columns&&this.cache[a].data?this.cache[a].data.length+n:n,this.queryData(t,e,0,o,r,i);},queryData:function queryData(e,n,r,i,o,a,s){var c=this,l=e+"_"+n,u=s||{};this.requested[l]||(this.requested[l]=[]),this.requested[l].push({done:o,fail:a});var p=u.user||t.VA.Env.Session.userId,d=(u.destination||"api/va/v2/data")+"/staging/query?user="+p+"&mid="+e+"&tab="+n+"&offset="+r+"&limit="+i;$.get(d).done(function(t){c.addCache(e,n,t),c.requested[l].shift().done(t,n);}).fail(function(t){c.removeCache(e,n);c.requested[l].shift().fail({columns:[],data:[],count:0},n,t);});},getSchemaAsync:function getSchemaAsync(e,n,r,i,o){var a=this,s=(o||{}).user||t.VA.Env.Session.userId,c="api/va/v2/data/staging/query?"+t.VA.Core.Utils.CommonUtils.getQueryString({user:s,mid:e,tab:n,offset:0,limit:1});$.get(c).done(function(t){return a.addCache(e,n,t),r(t.columns);}).fail(function(t){return a.removeCache(e,n),i([],n,t);});},getSchema:function getSchema(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].columns:void 0;},querySchema:function querySchema(t,e,n,r,i){this.queryTable(t,e,n,r,i);},getSchemaFromData:function getSchemaFromData(t,e){return console.warn("This method is deprecated"),this.getData(t,e);},getData:function getData(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n].data:void 0;},getTable:function getTable(t,e){var n=t+"_"+e;return this.schemaCache[n]&&void 0!==e?this.schemaCache[n]:void 0;}};}.call(this);