-
Notifications
You must be signed in to change notification settings - Fork 86
/
brightics-va-functions.min.js
2 lines (2 loc) · 191 KB
/
brightics-va-functions.min.js
1
2
/* Brightics VA Build 200427 */
(function(){"use strict";this.Brightics.VA.Core.Functions.Library.unknownFunction={category:"unknown",defaultFnUnit:{func:"unknownFunction",name:"UnknownFunction",inData:[],outData:[],param:{},display:{label:"UnKnow Function",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Unknown Function.",tags:["unknown","undefined"],"in-range":{min:1,max:999},"out-range":{min:1,max:1}}}).call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.setContentsEditable(!0),this.createParamControl()},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={}},e.prototype.fillControlValues=function(){},e.prototype.createParamControl=function(){},t.VA.Core.Functions.Library.unknownFunction.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.RATIO="ratio",t.VA.Core.Validator.BaseValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.BaseValidator.prototype.initRules.call(this),this.addExistFnUnitRule()},e.prototype.addExistFnUnitRule=function(){var t=this;this.addRule(function(e){var o={errorCode:"EF002",messageParam:[e.func]};return t.problemFactory.createProblem(o,e)})},t.VA.Core.Functions.Library.unknownFunction.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.pythonScript={category:"script",defaultFnUnit:{func:"pythonScript",name:"PythonScript",inputs:{inputs:[],models:[],images:[]},outputs:{},param:{script:""},display:{label:"Python Script",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}},version:"3.6",context:"python",meta:{inputs:{type:"table",range:{min:1,max:10}},models:{type:"model",range:{min:1,max:10}},images:{type:"image",range:{min:1,max:10}}}},description:"This function returns value for executed Python Script",tags:["python","script","Python Script"]}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.fillControlValues=function(t){for(var e in this.columnData=this.dataMap&&this.FnUnitUtils.getInTable(this.options.fnUnit)[0]?this.dataMap[this.FnUnitUtils.getInTable(this.options.fnUnit)[0]].columns:[],this.hintList=[],this.FnUnitUtils.getInTable(this.options.fnUnit))this.hintList.push("inputs["+e+"]");for(var e in this.columnData)this.hintList.push(this.columnData[e].name)},e.prototype.getPrimaryOperation=function(){return"brightics.function.script$python_script"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={script:this.renderScript},this.createScriptControl(),this.createOutputsControl()},e.prototype.createOutputsControl=function(){this.$outputsWrapper=this.addPropertyControl("Outputs",function(t){this.createOutputsUnit(t,{alias:"",type:"table"})}),this.$outputsWrapper.find(".brtc-va-editors-sheet-controls-propertycontrol-contents").css("margin-bottom","0");var t=this.$outputsWrapper.find(".brtc-va-editors-sheet-controls-propertycontrol-label");this.addGlobalVariableControl(t,{},"out-alias","Out Alias")},e.prototype.openScriptEditor=function(){var e=this;new t.VA.Core.Dialogs.PythonEditorDialog(e.$mainControl,{title:"Python Script",mode:{name:"python",version:3,singleLineStringErrors:!1},additionalHint:e.hintList,fnUnit:e.options.fnUnit,statement:e.pythonScriptViewer.codeMirror.getValue(),scriptType:"Python",close:function(t){t.OK&&(e.createScriptInputCommand(t),e.redrawQueryStatement(t.param.script),e.renderOutputs())}})},e.prototype.createScriptControl=function(){var e=this;this.addPropertyControl("Script",function(o){var r=$('<textarea class="brtc-va-editors-sheet-controls-sqlcontrol"></textarea>');o.append(r),e.pythonScriptViewer=e.createTextAreaControl(r,{verifier:new t.VA.Core.Verifier.SqlVerifier,mode:{name:"python",version:3,singleLineStringErrors:!1},theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,autofocus:!1,readOnly:"nocursor"}),o.find(".CodeMirror-sizer").css({height:"300px"}),e.pythonScriptViewer.$mainControl.parent().children(".CodeMirror").on("mousedown",function(){$(window).trigger("mousedown"),e.openScriptEditor()})},{mandatory:!0})},e.prototype.redrawQueryStatement=function(t){this.pythonScriptViewer.setValue(t),this.pythonScriptViewer.codeMirror.setSize("100%","100%")},e.prototype.renderScript=function(){var t=this.options.fnUnit.param;t.script||(t.script='#\n# NOTE : Enter "Out Table Alias"\n# ex)\n# inputDataframe = inputs[0]\n# result = inputDataframe\n#\n'),this.redrawQueryStatement(t.script),this.renderOutputs()},e.prototype.createOutputsUnit=function(e,o){var r=this,n=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-out-alias-unit"></div'),a=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input">'),i=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-dropdown"></div');a.css("margin-bottom","5px"),e.append(n),n.append(a),n.append(i);var s={theme:t.VA.Env.Theme,width:"100%",height:"28px",source:[{text:"TABLE",value:"table"},{text:"MODEL",value:"model"},{text:"IMAGE",value:"image"}],displayMember:"text",selectedIndex:0,valueMember:"value",dropDownHeight:70,disabled:!0};this.createInput(a,{height:30},"alias-name"),this.createComboBox(i,s,"alias-type"),a.attr("readonly",!0),i.attr("readonly",!0),a.val(o.alias),i.val(o.type),a.on("click",function(){r.openScriptEditor()}),i.on("click",function(){r.openScriptEditor()})},e.prototype.renderOutputs=function(){var t=this.FnUnitUtils.getOutputs(this.options.fnUnit),e=this.$outputsWrapper.find(".brtc-va-editors-sheet-controls-propertycontrol-contents").empty();if(_.isEmpty(t)){var o={alias:r,type:this.FnUnitUtils.getTypeByTableId(this.options.fnUnit,t[r])};this.createOutputsUnit(e,o)}else for(var r in t){o={alias:r,type:this.FnUnitUtils.getTypeByTableId(this.options.fnUnit,t[r])};this.createOutputsUnit(e,o)}},e.prototype.createScriptInputCommand=function(e){var o=new t.VA.Core.CompoundCommand(this),r={fnUnit:this.options.fnUnit,ref:{param:{}}},n={fnUnit:this.options.fnUnit,ref:{outputs:{},meta:{}}};r.ref.param.script="",e.param.script&&(r.ref.param.script=e.param.script),n.ref.outputs=e.outputs,n.ref.meta=e.meta;var a=new t.VA.Core.Editors.Diagram.Commands.ChangeOutputsCommand(this,n),i=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);o.add(i),o.add(a),this.createReturnDataCommand(o,e),this.executeCommand(o)},e.prototype.renderValidation=function(){for(var t in this.problems)"script"==this.problems[t].param&&this.createValidationContent(this.pythonScriptViewer.$mainControl.parent(),this.problems[t])},t.VA.Core.Functions.Library.pythonScript.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.PARAM_COLUMNS="columns",t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addScriptRule(),this.addOutTableAliasRule()},e.prototype.addScriptRule=function(){var t=this;this.addRule(function(e){var o=[];return""==e.param.script&&o.push(t.problemFactory.createProblem({errorCode:"BR-0033",param:"script",messageParam:["Script"]},e)),o})},e.prototype.addOutTableAliasRule=function(){var t=this;this.addRule(function(e){return t._checkArrayIsEmpty({errorCode:"BR-0033",param:"out-table-alias",messageParam:["Out Table Alias"]},e,e.param["out-table-alias"])})},e.prototype.addLinkRule=function(){var t=this;this.addRule(function(e){return t.checkLinkIsConnected(e)})},e.prototype.checkLinkIsConnected=function(t){var e={errorCode:"EL001",messageParam:[t.display.label]};if(!this._hasPrevious(t))return this.problemFactory.createProblem(e,t)},t.VA.Core.Functions.Library.pythonScript.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library["brightics.function.evaluation$plot_roc_pr_curve"]={category:"evaluation",defaultFnUnit:{context:"python",func:"brightics.function.evaluation$plot_roc_pr_curve",name:"brightics.function.evaluation$plot_roc_pr_curve",tags:["roc","curve","pr","plot"],version:"3.6",inputs:{table:""},outputs:{result:""},meta:{table:{type:"table"},result:{type:"model"}},param:{label_col:"",probability_col:"",pos_label:"",fig_w:"",fig_h:"",group_by:[]},display:{label:"Plot ROC and PR Curves",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Plot ROC Curve and PR Curve."}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={label_col:this.renderLabelCol,probability_col:this.renderProbabilityCol,fig_w:this.renderFigureWidth,fig_h:this.renderFigureHeight,group_by:this.renderGroupBy,pos_label:()=>this.showPosLabel("String"===this.controls.label_col.getInternalType(this.options.fnUnit.param.label_col)||""===this.options.fnUnit.param.label_col)},this.controls={},this.$elements={},this.renderError={},this.createLabelColsControl(),this.createProbabilityColsControl(),this.createPositiveLabelControl(),this.createFigureWidthControl(),this.createFigureHeightControl(),this.createGroupByControl()},e.prototype.renderLabelCol=function(){const t=this.options.fnUnit.param;this.controls.label_col.setSelectedItems([t.label_col])},e.prototype.renderPosLabel=function(t){const e=this.options.fnUnit.param;t?this.controls.pos_label_STR.val(e.pos_label):this.controls.pos_label_NUM.setValue(e.pos_label)},e.prototype.showPosLabel=function(t){this.renderPosLabel(t),t?(this.$elements.pos_label_STR.css("display","unset"),this.$elements.pos_label_NUM.css("display","none")):(this.$elements.pos_label_STR.css("display","none"),this.$elements.pos_label_NUM.css("display","unset"))},e.prototype.renderGroupBy=function(){const t=this.options.fnUnit.param;this.controls.group_by.setSelectedItems(t.group_by)},e.prototype.renderProbabilityCol=function(){const t=this.options.fnUnit.param;this.controls.probability_col.setSelectedItems([t.probability_col])},e.prototype.renderFigureWidth=function(){const t=this.options.fnUnit.param;this.controls.fig_w.setValue(t.fig_w)},e.prototype.renderFigureHeight=function(){const t=this.options.fnUnit.param;this.controls.fig_h.setValue(t.fig_h)},e.prototype.createPositiveLabelControl=function(){this.$elements.pos_label_STR=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input"/>'),this.$elements.pos_label_NUM=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-numberinput"/>'),this.addPropertyControl("Positive Label",t=>{(e=>{t.append(this.$elements.pos_label_STR);const o=this;this.controls[e]=this.createInput(this.$elements.pos_label_STR,{}),this.$elements.pos_label_STR.on("change",function(){if(!o.isInputValueChanged("pos_label",$(this).val()))return;const t=o.createSetParameterValueCommand("pos_label",$(this).val());o.executeCommand(t)})})("pos_label_STR"),(e=>{t.append(this.$elements.pos_label_NUM);this.controls[e]=this.createNumericInput(this.$elements.pos_label_NUM,{numberType:"double"}),this.controls[e].onChange(()=>{let t=this.controls[e].getValue();t=""===t?"":Number(t);const o=this.createSetParameterValueCommand("pos_label",t);this.executeCommand(o)})})("pos_label_NUM")},{mandatory:!1})},e.prototype.createFigureWidthControl=function(){this.$elements.fig_w=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-numberinput"/>'),this.addPropertyControl("Figure Width",t=>{t.append(this.$elements.fig_w);this.controls.fig_w=this.createNumericInput(this.$elements.fig_w,{numberType:"double"}),this.controls.fig_w.onChange(()=>{let t=this.controls.fig_w.getValue();t=""===t?"":Number(t);const e=this.createSetParameterValueCommand("fig_w",t);this.executeCommand(e)})},{mandatory:!1})},e.prototype.createFigureHeightControl=function(){this.$elements.fig_h=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-numberinput"/>'),this.addPropertyControl("Figure Height",t=>{t.append(this.$elements.fig_h);this.controls.fig_h=this.createNumericInput(this.$elements.fig_h,{numberType:"double"}),this.controls.fig_h.onChange(()=>{let t=this.controls.fig_h.getValue();t=""===t?"":Number(t);const e=this.createSetParameterValueCommand("fig_h",t);this.executeCommand(e)})},{mandatory:!1})},e.prototype.createProbabilityColsControl=function(){this.$elements.probability_col=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columnlist"/>'),this.addPropertyControl("Probability Column",t=>{t.append(this.$elements.probability_col);const e={multiple:!1,maxRowCount:"",changed:(t,e)=>{const o=this.createSetParameterValueCommand("probability_col",e.items[0]||"");this.executeCommand(o)}};this.controls.probability_col=this.createColumnList(this.$elements.probability_col,e)},{mandatory:!0})},e.prototype.createLabelColsControl=function(){this.$elements.label_col=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columnlist"/>'),this.addPropertyControl("Label Column",t=>{t.append(this.$elements.label_col);const e={multiple:!1,maxRowCount:"",changed:(t,e)=>{const o="String"===this.controls.label_col.getInternalType(e.items[0]),r=this.options.fnUnit.param.pos_label;let n=o?`${r}`:isNaN(parseFloat(r))?"":parseFloat(r);var a=this.createSetParameterValueInLabelColsCommand([["label_col",e.items[0]||""],["pos_label",n]]);this.executeCommand(a),this.showPosLabel(o)}};this.controls.label_col=this.createColumnList(this.$elements.label_col,e)},{mandatory:!0})},e.prototype.createSetParameterValueInLabelColsCommand=function(e,o=!0){let r={fnUnit:this.options.fnUnit,ref:{param:{}}};return e.forEach(t=>{let[e,n]=t;if(!o&&this.getParam(e)===n)return null;0===n||n||"boolean"==typeof n||(n=""),r.ref.param[e]=n}),new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,r)},e.prototype.createGroupByControl=function(){this.$elements.group_by=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columnlist"/>'),this.addPropertyControl("Group By",t=>{t.append(this.$elements.group_by);const e={multiple:!0,changed:(t,e)=>{const o=this.createSetParameterValueCommand("group_by",e.items||[]);this.executeCommand(o)}};this.controls.group_by=this.createColumnList(this.$elements.group_by,e)},{mandatory:!1})},e.prototype.fillControlValues=function(){const t=this.FnUnitUtils.getInputs(this.options.fnUnit),e=this.dataMap&&t.table?this.dataMap[t.table].columns:[];this.controls.label_col.setItems(e),this.controls.probability_col.setItems(e),this.controls.group_by.setItems(e)},e.prototype.renderValidation=function(){},t.VA.Core.Functions.Library["brightics.function.evaluation$plot_roc_pr_curve"].propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this)},t.VA.Core.Functions.Library["brightics.function.evaluation$plot_roc_pr_curve"].validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.addColumnIfPython={category:"extraction",defaultFnUnit:{func:"addColumnIfPython",name:"brightics.function.extraction$add_expression_column_if",context:"python",version:"3.6",param:{expr_type:"sqlite",new_col:"",conditions:[],values:[],else_value:""},inputs:{table:""},outputs:{out_table:""},meta:{table:{type:"table"},out_table:{type:"table"}},display:{label:"Add Column",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["expr_type","values","else_value"],description:"This function generates a new column based on a given formula.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit)),this.options.isRendered=!0},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.control={},this.createOpenDialogButton()},e.prototype.createOpenDialogButton=function(){var t=this;this.$summaryControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>'),this.addPropertyControl("Add Column",function(e){e.append(t.$summaryControl),t.control.summary=t.createTextArea(t.$summaryControl,{height:"300px",disabled:!0},"brtc-style-textarea"),t.$summaryControl.on("click",function(e){t.openScriptEditor()})},{mandatory:!0})},e.prototype.openScriptEditor=function(){var e=this;new t.VA.Core.Dialogs.FunctionProperties.AddColumnIfDialog(e.$mainControl,{title:"Add Column",fnUnit:e.options.fnUnit,dataProxy:e.options.dataProxy,modelEditor:e.options.modelEditor,close:function(t){if(t.OK){e.setSummaryString(t.param);var o=e.createCommonCommand(t.param);e.executeCommand(o)}}})},e.prototype.renderValues=function(t){this.setSummaryString(this.options.fnUnit.param)},e.prototype.renderValidation=function(){for(var t in this.problems)"add-column"===this.problems[t].param&&this.createValidationContent(this.$summaryControl,this.problems[t])},e.prototype.setSummaryString=function(t){if(t.new_col){var e="";e+="Expression Type: "+t.expr_type+"\n",e+="Column Name: "+t.new_col+"\n\n",t.conditions.forEach(function(o,r){""!=o&&(e+=o+"\n\t=> "+t.values[r]+"\n")}),e+="ELSE \n\t=>"+t.else_value,this.control.summary.val(e)}else this.control.summary.val("New column name is empty")},e.prototype.createCommonCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:e}};return new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},t.VA.Core.Functions.Library.addColumnIfPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addSummaryRequired()},e.prototype.addSummaryRequired=function(){var t=this;this.addRule(function(e){if(this._hasSchema(e)){return t._checkArrayIsEmpty({errorCode:"BR-0033",param:"add-column",messageParam:["Add Column"]},e,e.param.new_col)}})},t.VA.Core.Functions.Library.addColumnIfPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.addColumnPython={category:"extraction",defaultFnUnit:{func:"addColumnPython",name:"brightics.function.extraction$add_expression_column",context:"python",version:"3.6",param:{expr_type:"sqlite",new_cols:[],formulas:[]},inputs:{table:""},outputs:{out_table:""},meta:{table:{type:"table"},out_table:{type:"table"}},display:{label:"Add Function Column",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["expr_type"],description:"This function generates a new column based on a given formula.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={new_cols:this.renderColumnName,expr_type:this.renderExprType,formulas:this.renderExpr},this.control={new_cols:[],expr_type:"",formulas:[]},this.$elements={new_cols:[],expr_type:"",formulas:[]},this.createColumnControl(),this.createExprTypeControl(),this.createExprControl()},e.prototype.createColumnControl=function(){var t=this;this.addPropertyControl("New Column Name",function(e){var o=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input"/>');e.append(o);var r=this.createInput(o,{placeHolder:"Enter value"},"brtc-va-editors-sheet-controls-width-12",{margin:"2px 0"});o.on("change",function(e){if(1!=t.renderFlag){var o=$(this).val();if(!t.isInputValueChanged("new_cols",o))return;t.executeCommonCommand("new_cols",[o])}}),r.setValue=function(t){o.val(t)},t.control.new_cols.push(r),t.$elements.new_cols.push(o)},{mandatory:!0})},e.prototype.createExprTypeControl=function(){var t=this,e=[{label:"SQLite",value:"sqlite"},{label:"Python",value:"python"}];this.addPropertyControl("Expression Type",function(o){var r=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>');o.append(r);var n=this.createDropDownList(r,{placeHolder:"Enter value",source:e});n.on("change",function(){t.executeCommonCommand("expr_type",n.getValue())}),n.setValue=function(t){void 0!==t&&this.jqxDropDownList("selectItem",t)},n.getValue=function(){return this.jqxDropDownList("getSelectedItem").value},t.control.expr_type=n,t.$elements.expr_type=r},{mandatory:!0})},e.prototype.createExprControl=function(){var t=this,e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>'),o=$('<textarea class="brtc-va-editors-sheet-controls-textarea"></textarea>');e.append(o),this.addPropertyControl("Expression",function(r){r.append(e);var n=t.createTextAreaControl(o,{placeholder:"sepal_length + 1",hintOptions:{list:[]}});n.onChange(function(){t.executeCommonCommand("formulas",[n.getValue()])}),t.control.formulas.push(n),t.$elements.formulas.push(o)},{mandatory:!0})},e.prototype.fillControlValues=function(){this.columnData=this.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name});var t=this;this.control.formulas.forEach(function(e){e.codeMirror.options.hintOptions.list=t.columnData.slice()})},e.prototype.renderValues=function(){this.renderColumnName(),this.renderExprType(),this.renderExpr()},e.prototype.renderColumnName=function(){var t=this.options.fnUnit.param.new_cols,e=this;t.forEach(function(t,o){e.control.new_cols[o].setValue(t)})},e.prototype.renderExprType=function(){var t=this.options.fnUnit.param.expr_type;this.control.expr_type.setValue(t)},e.prototype.renderExpr=function(){var t=this.options.fnUnit.param.formulas,e=this;t.forEach(function(t,o){e.control.formulas[o].setValue(t)})},e.prototype.renderValidation=function(){for(var t in this.problems){var e=this.problems[t].paramIndex;"new_cols"===this.problems[t].param&&this.createValidationContent(this.$elements.new_cols[e],this.problems[t]),"formulas"===this.problems[t].param&&this.createValidationContent(this.$elements.formulas[e],this.problems[t])}},e.prototype.executeCommonCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]=o;var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,r);this.executeCommand(n)},t.VA.Core.Functions.Library.addColumnPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addRule(this.columnNameRule),this.addRule(this.columnExprRule)},e.prototype.columnNameRule=function(t){var e=this,o=[];if(this._hasSchema(t)){if($.each(t.param.new_cols,function(r,n){e.isEmptyForString(n)&&o.push(e.problemFactory.createProblem({errorCode:"BR-0033",param:"new_cols",paramIndex:r,messageParam:["New Column Name"]},t))}),0===t.param.new_cols.length){var r={errorCode:"BR-0033",param:"new_cols",paramIndex:0,messageParam:["New Column Name"]};o.push(e.problemFactory.createProblem(r,t))}return o}},e.prototype.columnExprRule=function(t){var e=this,o=[];if(this._hasSchema(t)){if($.each(t.param.formulas,function(r,n){e.isEmptyForString(n)&&o.push(e.problemFactory.createProblem({errorCode:"BR-0033",param:"formulas",paramIndex:r,messageParam:["Expression"]},t))}),0===t.param.formulas.length){var r={errorCode:"BR-0033",param:"formulas",paramIndex:0,messageParam:["Expression"]};o.push(e.problemFactory.createProblem(r,t))}return o}},t.VA.Core.Functions.Library.addColumnPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.addFunctionColumnsPython={category:"extraction",defaultFnUnit:{func:"addFunctionColumnsPython",name:"brightics.function.transform$sql_execute",context:"python",version:"3.6",param:{query:""},inputs:{tables:""},outputs:{out_table:""},meta:{tables:{type:"table"},out_table:{type:"table"}},display:{label:"Add Function Columns",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:[],description:"This function generates a new column based on a given formula.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.getPrimaryOperation=function(){return"brightics.function.extraction$add_function_columns"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.control={CONTROL_SUMMARY:[]},this.createOpenDialogButton()},e.prototype.createOpenDialogButton=function(){var t=this,e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>');this.addPropertyControl("Add Column",function(o){o.append(e),t.control.summary=t.createTextArea(e,{height:"300px",disabled:!0},"brtc-style-textarea"),e.on("click",function(e){t.openScriptEditor()})},{mandatory:!0})},e.prototype.openScriptEditor=function(){var e=this;new t.VA.Core.Dialogs.FunctionProperties.AddColumnDialog(e.$mainControl,{title:"Add Column",fnUnit:e.options.fnUnit,dataProxy:e.options.dataProxy,modelEditor:e.options.modelEditor,columns:e.columnData,additionalHint:e.hintList,close:function(t){if(t.OK){e.setSummaryString(t.param);var o=e.createCommonCommand(t.param);e.executeCommand(o)}}})},e.prototype.setSummaryString=function(t){if(t.query){var e="";e+=t.query.substring(7,t.query.length),this.control.summary.val(e)}else this.control.summary.val("New column name is empty")},e.prototype.createCommonCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:e}};return new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},e.prototype.fillControlValues=function(){var e=this;this.columnData=this.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name}),this.hintList=[];var o={url:"api/va/v3/ws/functions/"+this.options.fnUnit.func,type:"GET",blocking:!1,contentType:"application/json; charset=utf-8"};$.ajax(o).done(function(t){var o=t.hintList;for(var r in o)e.hintList.push(o[r])}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e)})},e.prototype.renderValues=function(){this.setSummaryString(this.options.fnUnit.param)},e.prototype.executeCommonCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]=o;var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,r);this.executeCommand(n)},t.VA.Core.Functions.Library.addFunctionColumnsPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this)},t.VA.Core.Functions.Library.addFunctionColumnsPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.createTablePython={category:"io",defaultFnUnit:{func:"createTablePython",name:"brightics.function.io$create_table",context:"python",version:"3.6",outputs:{out_table:""},meta:{out_table:{type:"table"}},param:{data_array:[[]],type_array:[],col_names:[]},display:{label:"Create Table",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["data_array","type_array","col_names"],description:"This function creates a dataframe with the given input.",tags:["Create Table","CreateTable","Create","Table"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),Studio.getInstance().doValidate(this.options.fnUnit.parent()),this.options.isRendered=!0,this.renderValues()},e.prototype.setContentsEditable=function(t){},e.prototype.getPrimaryOperation=function(){return"brightics.function.io$create_table"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.PARAM_COLUMN_NAMES="col_names",this.PARAM_TYPE_ARRAY="type_array",this.PARAM_DATA_ARRAY="data_array",this.COLUMN_TYPE_DOUBLE="double",this.COLUMN_TYPE_INTEGER="int",this.COLUMN_TYPE_STRING="string",this.COLUMN_TYPE_LABEL={},this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_DOUBLE]="Double",this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_INTEGER]="Integer",this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_STRING]="String",this.COLUMNS_SOURCE=[{label:this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_DOUBLE],value:this.COLUMN_TYPE_DOUBLE},{label:this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_INTEGER],value:this.COLUMN_TYPE_INTEGER},{label:this.COLUMN_TYPE_LABEL[this.COLUMN_TYPE_STRING],value:this.COLUMN_TYPE_STRING}],this.createOpenEditorButton(),this.createColumnsView()},e.prototype.renderValues=function(t){this.renderColumnsView()},e.prototype.createOpenEditorButton=function(){var e=this;this.$editorButtonArea=$('<div class="brtc-va-editors-sheet-editor-button-area"/>'),this.addPropertyControl("Edit",function(o){o.append(e.$editorButtonArea);var r=$('<input class="brtc-va-editors-sheet-panels-properties-button" type="button" value="Open Editor"/>');e.$editorButtonArea.append(r),r.jqxButton({theme:t.VA.Env.Theme,width:"100%",height:25}),r.click(function(o){new t.VA.Core.Dialogs.InputDataFrameEditorDialog($(o.target),{width:1400,height:700,maxWidth:1400,maxHeight:700,title:"Create Table",fnUnit:e.options.fnUnit,context:"python",close:function(t){if(t.OK){var o=$.extend(!0,[],t[e.PARAM_COLUMN_NAMES]),r=$.extend(!0,[],t[e.PARAM_DATA_ARRAY]);e.generateColumnType(o,r),e.executeCommonCommand([e.PARAM_COLUMN_NAMES,e.PARAM_DATA_ARRAY,e.PARAM_TYPE_ARRAY],[o,r,e.typeArray]),e.renderColumnsView()}}})})})},e.prototype.createColumnsView=function(){var t=this;this.$columns=$('<div class="brtc-va-editors-sheet-columns-view brtc-va-editors-sheet-controls-wrapper"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-header-area"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-header"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-header-column">Name</div> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-header-column">Type</div> </div> </div> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-row-area-wrapper"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-row-area"></div> </div> </div></div>'),this.addPropertyControl("Columns",function(e){e.append(t.$columns),t.$rowAreaScrollbarWrapper=t.$columns.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row-area-wrapper"),t.$rowArea=t.$columns.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row-area"),t.$rowAreaScrollbarWrapper.perfectScrollbar()},{mandatory:!0})},e.prototype._createColumnsRow=function(t,e){var o=this,r=this.$rowArea,n=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-row"> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-column"><input class="brtc-va-editors-sheet-columns-table-input"/></div> <div class="brtc-va-editors-sheet-controls-propertycontrol-columns-table-column"><div class="brtc-va-editors-sheet-columns-table-dropdownlist"></div></div></div>');r.append(n);var a=this.createInput(n.find(".brtc-va-editors-sheet-columns-table-input"),{disabled:!0}),i=this.createDropDownList(n.find(".brtc-va-editors-sheet-columns-table-dropdownlist"),{source:this.COLUMNS_SOURCE,displayMember:"label",valueMember:"value"});i.on("change",function(t){if(o.controlsRendered&&"none"!==t.args.type){var e=$(this).parents(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row").prevAll().length,r=$.extend(!0,[],o.options.fnUnit.param[o.PARAM_TYPE_ARRAY]);r[e]=t.args.item.value,o.executeCommonCommand(o.PARAM_TYPE_ARRAY,r)}}),a.val(t),i.val(e)},e.prototype.executeCommonCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};if($.isArray(e)&&$.isArray(o)&&e.length===o.length)for(var n=0;n<e.length;n++)r.ref.param[e[n]]=o[n];else r.ref.param[e]=o;var a=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,r);this.executeCommand(a)},e.prototype.renderValidation=function(){for(var t in this.problems)this.problems[t].param===this.PARAM_COLUMN_NAMES&&this.createValidationContent(this.$columns,this.problems[t])},e.prototype.renderColumnsView=function(){this.controlsRendered=!1;var t,e=this.options.fnUnit.param[this.PARAM_COLUMN_NAMES],o=this.options.fnUnit.param[this.PARAM_TYPE_ARRAY];for(t=0;t<e.length;t++)this._renderColumnsRow(t,e[t],o[t]);for(var r=this.$rowArea.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row").length-1;r>=t;r--){var n=this.$rowArea.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row").eq(r);n.length&&n.remove()}this.$rowAreaScrollbarWrapper.perfectScrollbar("update"),this.controlsRendered=!0},e.prototype._renderColumnsRow=function(t,e,o){if(this.$rowArea.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row").eq(t).length){var r=this.$rowArea.find(".brtc-va-editors-sheet-controls-propertycontrol-columns-table-row").eq(t),n=r.find(".brtc-va-editors-sheet-columns-table-input"),a=r.find(".brtc-va-editors-sheet-columns-table-dropdownlist");n.val()!=e&&n.val(e),a.val()!=o&&a.val(o)}else this._createColumnsRow(e,o)},e.prototype.generateColumnType=function(t,e){this.typeArray=[];var o=this.options.fnUnit.param[this.PARAM_TYPE_ARRAY];for(var r in t)if(o[r])this.typeArray.push(o[r]);else{var n=!1,a=!1,i=!1;for(var s in e){var l=e[s][r];if(""!==l)if(/^[0-9.]+$/.test(l)&&2==l.split(".").length)n=!0;else{if(!/^[0-9]+$/.test(l)){i=!0;break}a=!0}}var c=this.COLUMN_TYPE_STRING;i?this.typeArray.push(this.COLUMN_TYPE_STRING):n?this.typeArray.push(this.COLUMN_TYPE_DOUBLE):a?this.typeArray.push(this.COLUMN_TYPE_INTEGER):this.typeArray.push(c)}},t.VA.Core.Functions.Library.createTablePython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.PARAM_DATA_ARRAY="data_array",this.PARAM_TYPE_ARRAY="type_array",this.PARAM_COLUMN_NAMES="col_names",t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.BaseValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){this.addDataArrayRule(),this.addTypeArrayRule(),this.addColumnNamesRule()},e.prototype.addDataArrayRule=function(){this.addRule(function(t){})},e.prototype.addTypeArrayRule=function(){this.addRule(function(t){})},e.prototype.addColumnNamesRule=function(){var t=this;this.addRule(function(e){var o={errorCode:"BR-0033",param:this.PARAM_COLUMN_NAMES,messageParam:["Columns"]};if(t.isEmptyForArray(e.param[this.PARAM_COLUMN_NAMES]))return t.problemFactory.createProblem(o,e)})},t.VA.Core.Functions.Library.createTablePython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadModel={category:"io",defaultFnUnit:{func:"loadModel",name:"brightics.function.io$load_model",outputs:{model:""},meta:{model:{type:"model"}},param:{path:""},version:"3.6",context:"python",display:{label:"Load Model",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Load Model",mandatory:[],tags:["load","json","model"]}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={path:this.renderPath},this.createPathControl()},e.prototype.createPathControl=function(){var t=this;this.$pathControl=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input" />'),this.$pathControlWrapper=this.addPropertyControl("Path",function(e){e.append(this.$pathControl),t.createInput(t.$pathControl),t.$pathControl.on("change",function(e){t.isInputValueChanged("path",$(this).val())&&t.createInputCommand("path",$(this).val())})})},e.prototype.renderPath=function(){this.$pathControl.val(this.FnUnitUtils.getParam(this.options.fnUnit).path)},e.prototype.fillControlValues=function(){},e.prototype.createInputCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]="",o&&(r.ref.param[e]=o);var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},t.VA.Core.Functions.Library.loadModel.propertiesPanel=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.readFromDb={category:"io",defaultFnUnit:{func:"readFromDb",name:"brightics.function.io$read_from_db",param:{datasource:{metadata:"datasource",datasourceName:""},sql:"SELECT "},meta:{table:{type:"table"}},context:"python",version:"3.6",outputs:{table:""},display:{label:"Read from DB",diagram:{position:{x:20,y:10}},sheet:{out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Read data from database.",mandatory:[],tags:["Load","DB Reader","DB","Reader","unload","hdfs"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.setContentsEditable(!1)},e.prototype.getPrimaryOperation=function(){return"brightics.function.io$read_from_db"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={datasource:this.renderDataSource,sql:this.renderQueryStatement},this.createDataSourceControl(),this.createQueryStatementControl()},e.prototype.createDataSourceControl=function(){var t=this,e=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"datasourceName",type:"string"},{name:"datasourceType",type:"string"}],url:"api/va/v2/datasources?type=RDB"});this.addPropertyControl("Data Source",function(o){t.$dataSourceControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),o.append(t.$dataSourceControl),t.$dataSourceControl.on("bindingComplete",function(e){t.setContentsEditable(!0)}),t.createDropDownList(t.$dataSourceControl,{source:e,displayMember:"datasourceName",valueMember:"datasourceName",placeHolder:"Select DataSource"}),t.$dataSourceControl.on("change",function(e){var o=t.createSetParameterValueCommand("datasource",{metadata:"datasource",datasourceName:t.$dataSourceControl.val()});t.executeCommand(o)})},{mandatory:!0})},e.prototype.createQueryStatementControl=function(){var e=this;this.addPropertyControl("Query Statement",function(o){var r=$('<textarea class="brtc-va-editors-sheet-controls-sqlcontrol"></textarea>');o.append(r),e.sqlEditViewer=e.createTextAreaControl(r,{verifier:new t.VA.Core.Verifier.SqlVerifier,mode:"text/x-sql",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,autofocus:!1,readOnly:"nocursor"}),e.sqlEditViewer.$mainControl.parent().children(".CodeMirror").on("mousedown",function(){new t.VA.Core.Dialogs.DBReaderSqlEditorDialog(e.$mainControl,{mode:"text/x-sql",additionalHint:e.hintList,fnUnit:e.options.fnUnit,statement:e.sqlEditViewer.codeMirror.getValue(),scriptType:"SQL Editor",scriptOnly:!0,close:function(t){if(t.OK){e.redrawQueryStatement(t.queryStatement);var o=e.createSetParameterValueCommand("sql",t.queryStatement,!1);o&&e.executeCommand(o)}},title:"Query Statement"})})},{mandatory:!0})},e.prototype.redrawQueryStatement=function(t){this.sqlEditViewer.setValue(t),this.selectMarker=this.sqlEditViewer.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0}),this.sqlEditViewer.codeMirror.setSize("100%","300px")},e.prototype.renderDataSource=function(){var t=this.options.fnUnit.param.datasource.datasourceName;t?this.$dataSourceControl.jqxDropDownList("val",t):this.$dataSourceControl.jqxDropDownList("clearSelection")},e.prototype.renderQueryStatement=function(){var t=this.options.fnUnit.param.sql;this.redrawQueryStatement(t)},e.prototype.renderValidation=function(){const t={datasourceName:this.$dataSourceControl.parent()};for(let e of this.problems){const o=t[e.param];o&&this.showValidation(o,e)}},t.VA.Core.Functions.Library.readFromDb.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Validator.BaseValidator.call(this,e)}e.prototype=Object.create(t.VA.Core.Validator.BaseValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){this.addDatasourceRule()},e.prototype.addDatasourceRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"datasourceName",messageParam:["Data Source"]},e,e.param.datasource.datasourceName)})},t.VA.Core.Functions.Library.readFromDb.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.readFromS3={category:"io",defaultFnUnit:{func:"readFromS3",name:"brightics.function.io$read_from_s3",outputs:{table:""},meta:{table:{type:"table"}},param:{datasource:{metadata:"s3",datasourceName:""},object_key:""},version:"3.6",context:"python",display:{label:"Read from S3",diagram:{position:{x:20,y:10}},sheet:{out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Read a csv file from Amazon S3.",mandatory:[],tags:["Load","S3","Reader","unload"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this)},e.prototype.getPrimaryOperation=function(){return"brightics.function.io$read_from_s3"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={datasource:this.renderDataSource,object_key:this.renderObjectKey},this.createDataSourceControl(),this.createObjectKeyControl()},e.prototype.createDataSourceControl=function(){var t=this,e=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"datasourceName",type:"string"},{name:"datasourceType",type:"string"}],url:"api/admin/v2/s3"});this.addPropertyControl("Data Source",function(o){t.$dataSourceControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),o.append(t.$dataSourceControl),t.$dataSourceControl.on("bindingComplete",function(e){t.setContentsEditable(!0)}),t.createDropDownList(t.$dataSourceControl,{source:e,displayMember:"datasourceName",valueMember:"datasourceName",placeHolder:"Select DataSource"}),t.$dataSourceControl.on("change",function(e){var o=t.createSetParameterValueCommand("datasource",{metadata:"s3",datasourceName:t.$dataSourceControl.val()});t.executeCommand(o)})},{mandatory:!0})},e.prototype.createObjectKeyControl=function(){var t=this;this.$objectKeyControl=$('<input class="brtc-va-editors-sheet-controls-inputcontrol"/>'),this.addPropertyControl("Object Key",function(e){e.append(t.$objectKeyControl),t.$objectKey=t.createInput(t.$objectKeyControl,{placeHolder:"Enter a Object Key."}),t.$objectKey.on("change",function(){var e=t.createSetParameterValueCommand("object_key",t.$objectKey.val(),!1);e&&t.executeCommand(e)})},{mandatory:!0})},e.prototype.renderObjectKey=function(){var t=this.options.fnUnit.param.object_key;this.$objectKey.val(t)},e.prototype.renderDataSource=function(){var t=this.options.fnUnit.param.datasource.datasourceName;t?this.$dataSourceControl.jqxDropDownList("val",t):this.$dataSourceControl.jqxDropDownList("clearSelection")},e.prototype.renderValidation=function(){const t={datasourceName:this.$dataSourceControl.parent(),object_key:this.$objectKeyControl};for(let e of this.problems){const o=t[e.param];o&&this.showValidation(o,e)}},t.VA.Core.Functions.Library.readFromS3.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Validator.BaseValidator.call(this,e)}e.prototype=Object.create(t.VA.Core.Validator.BaseValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){this.addDatasourceRule(),this.addObjectKeyRule()},e.prototype.addDatasourceRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"datasourceName",messageParam:["Data Source"]},e,e.param.datasource.datasourceName)})},e.prototype.addObjectKeyRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"object_key",messageParam:["Object Key"]},e,e.param.object_key)})},t.VA.Core.Functions.Library.readFromS3.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.unloadModel={category:"io",defaultFnUnit:{func:"unloadModel",name:"brightics.function.io$unload_model",inputs:{in_1:""},outputs:{model:""},meta:{in_1:{type:"model"},model:{type:"model"}},param:{target:"",path:"",linked:{name:"",param:{},outData:[],outputs:{}}},version:"3.6",context:"python",display:{label:"Unload Model",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Export model/ meta data",mandatory:[],tags:["unload","train","model","meta"]}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={target:this.renderTarget,path:this.renderPath},this.createTargetControl(),this.createPathControl()},e.prototype.createTargetControl=function(){var t=this;this.$target=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),this.targetSource=this.FnUnitUtils.getPreviousFnUnits(this.options.fnUnit);this.addPropertyControl("Target",function(e){t.createDropDownList(this.$target,{source:this.targetSource}),e.append(this.$target.parent()),t.$target.on("change",function(){t.isInputValueChanged("target",$(this).val())&&t.createInputCommand("target",$(this).val())})},{mandatory:!0})},e.prototype.createPathControl=function(){var t=this;this.$pathControl=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input" />'),this.$pathControlWrapper=this.addPropertyControl("Path",function(e){e.append(this.$pathControl),t.createInput(t.$pathControl),t.$pathControl.on("change",function(e){t.isInputValueChanged("path",$(this).val())&&t.createInputCommand("path",$(this).val())})})},e.prototype.renderTarget=function(){this.$target.val(this.FnUnitUtils.getParam(this.options.fnUnit).target)},e.prototype.renderPath=function(){this.$pathControl.val(this.FnUnitUtils.getParam(this.options.fnUnit).path)},e.prototype.fillControlValues=function(){},e.prototype.createInputCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]="",o&&(r.ref.param[e]=o);var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},t.VA.Core.Functions.Library.unloadModel.propertiesPanel=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.writeToDb={category:"io",defaultFnUnit:{func:"writeToDb",name:"brightics.function.io$write_to_db",param:{datasource:{metadata:"datasource",datasourceName:""},tableName:"",ifExists:"fail"},meta:{table:{type:"table"}},context:"python",version:"3.6",inputs:{table:""},display:{label:"Write to DB",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Write data to database.",mandatory:[],tags:["Load","DB Reader","DB","Reader","unload","hdfs"],"in-range":{min:1,max:1},"out-range":{min:0,max:0}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.setContentsEditable(!1)},e.prototype.getPrimaryOperation=function(){return"brightics.function.io$write_to_db"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={datasource:this.renderDataSource,tableName:this.renderTableName,ifExists:this.renderIfExists},this.createDataSourceControl(),this.createTableNameControl(),this.createIfExistsControl()},e.prototype.createDataSourceControl=function(){var t=this,e=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"datasourceName",type:"string"},{name:"datasourceType",type:"string"}],url:"api/va/v2/datasources?type=RDB"});this.addPropertyControl("Data Source",function(o){t.$dataSourceControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),o.append(t.$dataSourceControl),t.$dataSourceControl.on("bindingComplete",function(e){t.setContentsEditable(!0)}),t.createDropDownList(t.$dataSourceControl,{source:e,displayMember:"datasourceName",valueMember:"datasourceName",placeHolder:"Select DataSource"}),t.$dataSourceControl.on("change",function(e){var o=t.createSetParameterValueCommand("datasource",{metadata:"datasource",datasourceName:t.$dataSourceControl.val()});t.executeCommand(o)})},{mandatory:!0})},e.prototype.createTableNameControl=function(){var t=this;this.$tableNameControl=$('<input class="brtc-va-editors-sheet-controls-inputcontrol"/>'),this.addPropertyControl("Table Name",function(e){e.append(t.$tableNameControl),t.$tableName=t.createInput(t.$tableNameControl,{placeHolder:"Enter a Table Name."}),t.$tableName.on("change",function(){var e=t.createSetParameterValueCommand("tableName",t.$tableName.val(),!1);e&&t.executeCommand(e)})},{mandatory:!0})},e.prototype.createIfExistsControl=function(){var t=this;this.$IfExistsFailControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton">Fail</div>'),this.$IfExistsReplaceControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton">Replace</div>'),this.$IfExistsAppendControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton">Append</div>');this.addPropertyControl("If Exists",function(e){var o=[t.$IfExistsFailControl,t.$IfExistsReplaceControl,t.$IfExistsAppendControl];e.append(o),o.forEach(e=>{t.createRadioButton(e,{width:"80",groupName:"Group"})}),_.zip(o,["fail","replace","append"]).forEach(([e,o])=>{e.on("checked",e=>{var r=t.createSetParameterValueCommand("ifExists",o);t.executeCommand(r)})})},{mandatory:!0})},e.prototype.renderDataSource=function(){var t=this.options.fnUnit.param.datasource.datasourceName;t?this.$dataSourceControl.jqxDropDownList("val",t):this.$dataSourceControl.jqxDropDownList("clearSelection")},e.prototype.renderTableName=function(){var t=this.options.fnUnit.param.tableName;this.$tableName.val(t)},e.prototype.renderIfExists=function(){var t=this.options.fnUnit.param.ifExists,e={fail:this.$IfExistsFailControl,replace:this.$IfExistsReplaceControl,append:this.$IfExistsAppendControl}[t];e&&e.jqxRadioButton("check")},e.prototype.renderValidation=function(){const t={datasourceName:this.$dataSourceControl.parent(),tableName:this.$tableNameControl};for(let e of this.problems){const o=t[e.param];o&&this.showValidation(o,e)}},t.VA.Core.Functions.Library.writeToDb.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Validator.BaseValidator.call(this,e)}e.prototype=Object.create(t.VA.Core.Validator.BaseValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){this.addDatasourceRule(),this.addTableNameRule()},e.prototype.addDatasourceRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"datasourceName",messageParam:["Data Source"]},e,e.param.datasource.datasourceName)})},e.prototype.addTableNameRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"tableName",messageParam:["Table Name"]},e,e.param.tableName)})},t.VA.Core.Functions.Library.writeToDb.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.writeToS3={category:"io",defaultFnUnit:{func:"writeToS3",name:"brightics.function.io$write_to_s3",inputs:{table:""},meta:{table:{type:"table"}},param:{datasource:{metadata:"s3",datasourceName:""},object_key:""},version:"3.6",context:"python",display:{label:"Write to S3",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Write a csv file to Amazon S3.",mandatory:[],tags:["Load","S3","Reader","unload","write"],"in-range":{min:1,max:1},"out-range":{min:0,max:0}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this)},e.prototype.getPrimaryOperation=function(){return"brightics.function.io$write_to_s3"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={datasource:this.renderDataSource,object_key:this.renderObjectKey},this.createDataSourceControl(),this.createObjectKeyControl()},e.prototype.createDataSourceControl=function(){var t=this,e=new $.jqx.dataAdapter({datatype:"json",datafields:[{name:"datasourceName",type:"string"},{name:"datasourceType",type:"string"}],url:"api/admin/v2/s3"});this.addPropertyControl("Data Source",function(o){t.$dataSourceControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),o.append(t.$dataSourceControl),t.$dataSourceControl.on("bindingComplete",function(e){t.setContentsEditable(!0)}),t.createDropDownList(t.$dataSourceControl,{source:e,displayMember:"datasourceName",valueMember:"datasourceName",placeHolder:"Select DataSource"}),t.$dataSourceControl.on("change",function(e){var o=t.createSetParameterValueCommand("datasource",{metadata:"s3",datasourceName:t.$dataSourceControl.val()});t.executeCommand(o)})},{mandatory:!0})},e.prototype.createObjectKeyControl=function(){var t=this;this.$objectKeyControl=$('<input class="brtc-va-editors-sheet-controls-inputcontrol"/>'),this.addPropertyControl("Object Key",function(e){e.append(t.$objectKeyControl),t.$objectKey=t.createInput(t.$objectKeyControl,{placeHolder:"Enter a Object Key."}),t.$objectKey.on("change",function(){var e=t.createSetParameterValueCommand("object_key",t.$objectKey.val(),!1);e&&t.executeCommand(e)})},{mandatory:!0})},e.prototype.renderObjectKey=function(){var t=this.options.fnUnit.param.object_key;this.$objectKey.val(t)},e.prototype.renderDataSource=function(){var t=this.options.fnUnit.param.datasource.datasourceName;t?this.$dataSourceControl.jqxDropDownList("val",t):this.$dataSourceControl.jqxDropDownList("clearSelection")},e.prototype.renderValidation=function(){const t={datasourceName:this.$dataSourceControl.parent(),object_key:this.$objectKeyControl};for(let e of this.problems){const o=t[e.param];o&&this.showValidation(o,e)}},t.VA.Core.Functions.Library.writeToS3.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(e){t.VA.Core.Validator.BaseValidator.call(this,e)}e.prototype=Object.create(t.VA.Core.Validator.BaseValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){this.addDatasourceRule(),this.addObjectKeyRule()},e.prototype.addDatasourceRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"datasourceName",messageParam:["Data Source"]},e,e.param.datasource.datasourceName)})},e.prototype.addObjectKeyRule=function(){var t=this;this.addRule(function(e){return t._checkStringIsEmpty({errorCode:"BR-0033",param:"object_key",messageParam:["Object Key"]},e,e.param.object_key)})},t.VA.Core.Functions.Library.writeToS3.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.advancedFilterPython={category:"manipulation",defaultFnUnit:{func:"advancedFilterPython",name:"brightics.function.transform$sql_execute",context:"python",version:"3.6",param:{query:""},inputs:{tables:""},outputs:{out_table:""},meta:{tables:{type:"table"},out_table:{type:"table"}},display:{label:"Advanced Filter",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["query"],description:"This function generates a new column based on a given formula.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={query:this.renderExpr},this.control={},this.createExprControl()},e.prototype.createExprControl=function(){var t=this,e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>'),o=$('<textarea class="brtc-va-editors-sheet-controls-textarea"></textarea>');e.append(o),this.addPropertyControl("Expression",function(r){r.append(e);var n=t.createTextAreaControl(o,{placeholder:"sepal_length + 1",hintOptions:{list:[]}});n.onChange(function(){t.executeCommonCommand("query",n.getValue())}),t.control.query=n},{mandatory:!0})},e.prototype.fillControlValues=function(){this.columnData=this.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name}),this.control.query.codeMirror.options.hintOptions.list=this.columnData},e.prototype.renderValues=function(){this.renderExpr()},e.prototype.renderExpr=function(){var t=this.options.fnUnit.param.query;t=t.substr(29,t.length),this.control.query.setValue(t)},e.prototype.renderValidation=function(){},e.prototype.executeCommonCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};o.length?r.ref.param[e]="SELECT * FROM #{DF(0)} WHERE "+o:r.ref.param[e]=o;var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,r);this.executeCommand(n)},t.VA.Core.Functions.Library.advancedFilterPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this)},t.VA.Core.Functions.Library.advancedFilterPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.sortPython={category:"manipulation",defaultFnUnit:{func:"sortPython",name:"brightics.function.manipulation$sort",context:"python",version:"3.6",param:{input_cols:[],is_asc:[],group_by:[]},inputs:{table:""},outputs:{out_table:""},meta:{table:{type:"table"},out_table:{type:"table"}},display:{label:"Sort",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["input_cols","is_asc"],description:"This function generates a new column based on a given formula.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype;function o(t,o){e.constructor.call(this,t,o)}o.prototype=Object.create(e),o.prototype.constructor=o,o.prototype.createControls=function(){e.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},o.prototype.createContentsAreaControls=function(t){e.createContentsAreaControls.call(this,t),this.selectedItems=[],this.changedItems={},this.render={input_cols:this.renderSortRule,is_asc:this.renderSortRule,group_by:this.renderGroupBy},this.createColumnSelector(),this.createSortRuleControl(),this.createGroupByControl()},o.prototype.renderValues=function(t){this.renderSortRule(),this.renderGroupBy()},o.prototype.renderValidation=function(){for(var t in this.problems)"input_cols"===this.problems[t].param&&this.createValidationContent(this.$newRowButtonArea,this.problems[t]),"group_by"===this.problems[t].param&&this.createValidationContent(this.$groupbys.parent(),this.problems[t])},o.prototype.createSortRuleControl=function(){var e=this;this.$sortRuleControl=$('<div class="brtc-va-selectbutton-container"> <button class="brtc-va-editors-sheet-controls-propertycontrol-columnlist-selectbutton">Select Columns</button></div><div class = "brtc-va-editors-sheet-controls-propertycontrol-sort-rule-control"> <div class = "brtc-va-editors-sheet-controls-propertycontrol-row-container"></div> <div class = "brtc-va-editors-sheet-controls-propertycontrol-new-row-button-area"></div></div>'),this.$selectButton=this.$sortRuleControl.find(".brtc-va-editors-sheet-controls-propertycontrol-columnlist-selectbutton"),this.$selectButton.jqxButton({theme:t.VA.Env.Theme,height:"25px"}),this.$selectButton.on("click",function(){e.columnSelector.open(this,e.selectedItems)}),this.$rowContainer=this.$sortRuleControl.find(".brtc-va-editors-sheet-controls-propertycontrol-row-container"),this.$newRowButtonArea=this.$sortRuleControl.find(".brtc-va-editors-sheet-controls-propertycontrol-new-row-button-area"),this.addPropertyControl("Sort Rule",function(t){t.addClass("brtc-va-editors-sheet-controls-propertycontrol-deck"),t.addClass("brtc-va-sort-property"),t.append(e.$sortRuleControl),e.$rowContainer.sortable({axis:"y",handle:".brtc-va-editors-sheet-controls-propertycontrol-hover-drag-element-wrapper",update:function(t,o){e.executeSortRuleCommand(),e.updateIndexNumber()}}),e.createNewSortRuleButton()},{mandatory:!0})},o.prototype.createColumnSelector=function(e){var o=this;this.columnSelector=new t.VA.Core.Editors.Sheet.Controls.ColumnSelector(this.$mainControl,{columnList:this,multiple:!0,changed:function(t,e){if("selectAll"===t)for(var r in o.selectedItems=[],o.$rowContainer.empty(),e){$.inArray(e[r].name,o.selectedItems)<0&&(o.changedItems[e[r].name]="select"),o.createNewSortRuleControl(e[r].name,"ASC"),o.selectedItems.push(e[r].name)}if("unselectAll"===t){for(var r in e){$.inArray(e[r].name,o.selectedItems)>-1&&(o.changedItems[e[r].name]="unselect")}o.selectedItems=[],o.$rowContainer.empty()}"select"===t&&($.inArray(e.name,o.selectedItems)<0&&(o.changedItems[e.name]="select"),o.createNewSortRuleControl(e.name,"ASC"),o.selectedItems.push(e.name));if("unselect"===t){$.inArray(e.name,o.selectedItems)>-1&&(o.changedItems[e.name]="unselect");var n=o.$sortRuleControl.find(".brtc-va-editors-sheet-controls-propertycontrol-row");for(var r in n)if($(n[r]).attr("column")===e.name){n[r].remove();break}for(var a in o.selectedItems)if(o.selectedItems[a]===e.name){o.selectedItems.splice(a,1);break}}if("close"===t){var i=[],s=[];for(var l in o.changedItems)"select"===o.changedItems[l]?i.push(l):s.push(l);(i.length>0||s.length>0)&&(o.executeSortRuleCommand(),o.updateIndexNumber()),o.changedItems={}}}})},o.prototype.createNewSortRuleButton=function(){var t=this,e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-row brtc-va-editors-sheet-controls-propertycontrol-new-row-button"> <div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"></div> <div class="brtc-va-editors-sheet-controls-propertycontrol-button brtc-va-editors-sheet-controls-new-row-toggle-button"><i class="fa fa-sort"></i></div></div>');this.$newRowButtonArea.append(e);var o=e.find(".brtc-va-editors-sheet-controls-propertycontrol-combobox");this.newRowColumnList=this.createColumnList(o,{rowCount:1,multiple:!1,showOpener:"click",removable:!1},"brtc-va-editors-sheet-controls-width-6",{width:"70%",height:"25px","padding-left":"4px","margin-left":"13px"}),this.newRowColumnList.onChange(function(e,o){t.createNewSortRuleControl(o.items[0],"ASC"),t.selectedItems.push(o.items[0]),t.executeSortRuleCommand(),t.newRowColumnList.setSelectedItems([]),t.updateIndexNumber()})},o.prototype.createNewSortRuleControl=function(t,e){var o=this;t=t||"",e=e||"ASC";var r=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-row"> <div class="brtc-va-editors-sheet-controls-propertycontrol-hover-drag-element-wrapper"> <div class="brtc-va-editors-sheet-controls-propertycontrol-hover-drag-element"></div> <div class="brtc-va-editors-sheet-controls-propertycontrol-number"></div> </div> <div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"></div> <div class="brtc-va-editors-sheet-controls-propertycontrol-button brtc-va-editors-sheet-controls-propertycontrol-sort-mode-button"><i class="fa fa-sort"></i></div> <div class="brtc-va-editors-sheet-controls-sort-rule-remove-button"></div></div>');this.$rowContainer.append(r),r.attr("column",t),r.attr("type",this.getColumnType(t)),r.attr("sort-mode",e),r.find(".brtc-va-editors-sheet-controls-propertycontrol-button").attr("title",e);var n=r.find(".brtc-va-editors-sheet-controls-propertycontrol-number"),a=this.$rowContainer.find(".brtc-va-editors-sheet-controls-propertycontrol-row").length+1;n.text(a+""),r.find(".brtc-va-editors-sheet-controls-propertycontrol-hover-drag-element-wrapper").attr("title",a+"");var i=r.find(".brtc-va-editors-sheet-controls-propertycontrol-combobox"),s=this.createColumnList(i,{rowCount:1,multiple:!1,showOpener:"click",removable:!1},"brtc-va-editors-sheet-controls-width-6",{width:"70%",height:"25px"});s.onChange(function(t,e){r.attr("column",e.items[0]),r.attr("type",o.getColumnType(e.items[0])),o.updateSortModeIcon(l,r.attr("sort-mode"),o.getColumnType(e.items[0])),o.executeSortRuleCommand()}),s.setItems(this.columnData),s.setSelectedItems(t?[t]:[]),r.data("columnList",s);var l=r.find(".brtc-va-editors-sheet-controls-propertycontrol-button");l.on("click",function(){var t=$(this).parents(".brtc-va-editors-sheet-controls-propertycontrol-row"),e="ASC"===t.attr("sort-mode")?"DESC":"ASC";t.attr("sort-mode",e),$(this).attr("title",e),o.updateSortModeIcon(l,t.attr("sort-mode"),o.getColumnType(t.attr("column"))),o.executeSortRuleCommand()}),r.find(".brtc-va-editors-sheet-controls-sort-rule-remove-button").click(function(t){var e=$(this).parents(".brtc-va-editors-sheet-controls-propertycontrol-row");for(var r in e.remove(),o.selectedItems)if(o.selectedItems[r]===e.attr("column")){o.selectedItems.splice(r,1);break}o.executeSortRuleCommand(),o.updateIndexNumber()}),this.updateSortModeIcon(l,e,this.getColumnType(t))},o.prototype.fillControlValues=function(){this.columnData=this.getColumnsOfInTable(0,["number","string"]),this.columnSelector.setSource(this.columnData),this.newRowColumnList.setItems(this.columnData),this.groupbyControl.setItems(this.columnData)},o.prototype.renderSortRule=function(){var t=this.options.fnUnit.param.input_cols,e=this.options.fnUnit.param.is_asc;if(e.length&&t.length){var o,r,n,a,i,s,l=this.$rowContainer.find(".brtc-va-editors-sheet-controls-propertycontrol-row"),c=l.length;if(c<t.length){for(i=0;i<c;i++)a=e[i]?"ASC":"DESC",o=l[i],(r=$(o).data("columnList")).setItems(this.columnData),r.setSelectedItems([t[i]]),$(o).attr("column",t[i]),$(o).attr("type",this.getColumnType(t[i])),$(o).attr("sort-mode",a),(n=$(o).find(".brtc-va-editors-sheet-controls-propertycontrol-button")).attr("title",a),this.updateSortModeIcon(n,a,this.getColumnType(t[i]));for(s=c;s<t.length;s++)a=e[s]?"ASC":"DESC",this.createNewSortRuleControl(t[s],a);this.selectedItems=t}else{for(i=0;i<t.length;i++)a=e[i]?"ASC":"DESC",o=l[i],(r=$(o).data("columnList")).setItems(this.columnData),r.setSelectedItems([t[i]]),$(o).attr("column",t[i]),$(o).attr("type",this.getColumnType(t[i])),$(o).attr("sort-mode",a),(n=$(o).find(".brtc-va-editors-sheet-controls-propertycontrol-button")).attr("title",a),this.updateSortModeIcon(n,a,this.getColumnType(t[i]));for(s=t.length;s<c;s++)(o=l[s]).remove()}}else this.$rowContainer.empty();this.updateIndexNumber()},o.prototype.renderGroupBy=function(){var t=this.options.fnUnit.param.group_by;this.groupbyControl.setSelectedItems(t)},o.prototype.createGroupByControl=function(){var t=this;this.$groupbys=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-groupbylist"/>'),this.addPropertyControl("Group By",function(e){e.append(t.$groupbys);t.groupbyControl=t.createColumnList(t.$groupbys,{rowCount:3,multiple:!0}),t.groupbyControl.onChange(function(){t.executeGroupByCommand()})})},o.prototype.executeGroupByCommand=function(){var e={fnUnit:this.options.fnUnit,ref:{param:{}}};e.ref.param.group_by=[];var o=this.groupbyControl.getSelectedItems();o&&(e.ref.param.group_by=o);var r=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,e);this.executeCommand(r)},o.prototype.executeSortRuleCommand=function(){var e={fnUnit:this.options.fnUnit,ref:{param:{}}};e.ref.param.input_cols=[],e.ref.param.is_asc=[],this.$rowContainer.find(".brtc-va-editors-sheet-controls-propertycontrol-row").each(function(t,o){e.ref.param.input_cols.push($(this).attr("column"));var r="ASC"==$(this).attr("sort-mode");e.ref.param.is_asc.push(r)});var o=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,e);this.executeCommand(o)},o.prototype.updateIndexNumber=function(){this.$rowContainer.find(".brtc-va-editors-sheet-controls-propertycontrol-row").each(function(t,e){var o=Number(t)+1+"";$(e).find(".brtc-va-editors-sheet-controls-propertycontrol-hover-drag-element-wrapper").attr("title",o),$(e).find(".brtc-va-editors-sheet-controls-propertycontrol-number").text(o)})},o.prototype.updateSortModeIcon=function(t,e,o){var r;t.find("i").removeClass(),"string"===o?(r="fa fa-sort-alpha-"+e.toLowerCase(),t.find("i").addClass(r)):"number"===o||"date"===o?(r="fa fa-sort-numeric-"+e.toLowerCase(),t.find("i").addClass(r)):(r="fa fa-sort",t.find("i").addClass(r))},o.prototype.getColumnType=function(t){return this.columnData.find(function(e){return e.name==t}).type},t.VA.Core.Functions.Library.sortPython.propertiesPanel=o}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Validator.SingleInputValidator.prototype;function o(){e.constructor.call(this)}o.prototype=Object.create(e),o.prototype.constructor=o,o.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addColumnsRule(),this.addGroupByRule()},o.prototype.addColumnsRule=function(){var t=this;this.addRule(function(e){return t.checkColumnIsEmpty(e,"input_cols",e.param.input_cols,"Sort Rule")}),this.addRule(function(e){return t.checkColumnExists(e,"input_cols",$.unique($.extend(!0,[],e.param.input_cols)))})},o.prototype.addGroupByRule=function(){var t=this;this.addRule(function(e){return t.checkColumnExists(e,"group_by",e.param.group_by)}),this.addRule(function(e){if(t._hasSchema(e)){var o=t.getArrayConflicted(e.param.group_by,e.param.input_cols);return t.createProblemForConflicted(o,"group_by","Group By","Columns",e)}})},t.VA.Core.Functions.Library.sortPython.validator=o}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.queryExecutorPython={category:"script",defaultFnUnit:{func:"queryExecutorPython",name:"brightics.function.transform$sql_execute",context:"python",version:"3.6",param:{query:"SELECT "},inputs:{tables:[]},outputs:{out_table:""},meta:{tables:{type:"table",range:{min:1,max:10}},out_table:{type:"table"}},display:{label:"Query Executor",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"This function returns value for executed SQL Query.",tags:["SQL Executor","SQLExecutor","SQL","Query","Preprocessing","Filter","Missing Values","Manipulation","Column Extraction","Table Schema Transform","Query Executor"],"in-range":{min:1,max:8},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.BasePanel.prototype.createContentsAreaControls.call(this,e),this.FnUnitInputs=brtc_require("FnUnitInputs"),this.PARAM_FULL_QUERY="query",this.render={query:this.renderQueryStatement},this.createSelectControl(),this.customizeElementClass()},e.prototype.fillControlValues=function(){var e=this;for(var o in this.columnData=this.dataMap&&this.FnUnitUtils.getInTable(this.options.fnUnit)[0]?this.dataMap[this.FnUnitUtils.getInTable(this.options.fnUnit)[0]].columns:[],this.hintList=[],this.FnUnitUtils.getInTable(this.options.fnUnit))this.hintList.push("#{DF("+o+")}");for(var o in this.columnData)this.hintList.push(this.columnData[o].name);var r={url:"api/va/v3/ws/functions/"+this.options.fnUnit.func,type:"GET",blocking:!1,contentType:"application/json; charset=utf-8"};$.ajax(r).done(function(t){var o=t.hintList;for(var r in o)e.hintList.push(o[r])}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e)})},e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.PARAM_FULL_QUERY="query",this.render={query:this.renderQueryStatement},this.createSelectControl(),this.customizeElementClass()},e.prototype.createSelectControl=function(){var e=this;this.addPropertyControl("SQL",function(o){var r=$('<textarea class="brtc-va-editors-sheet-controls-sqlcontrol"></textarea>');o.append(r),e.sqlEditViewer=e.createTextAreaControl(r,{verifier:new t.VA.Core.Verifier.SqlVerifier,mode:"text/x-sql",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,autofocus:!1,readOnly:"nocursor"}),e.sqlEditViewer.$mainControl.parent().children(".CodeMirror").on("mousedown",function(){$(window).trigger("mousedown"),new t.VA.Core.Dialogs.SqlEditorDialog(e.$mainControl,{title:"SQL",window:{width:1400,height:700,minWidth:700,minHeight:400,maxWidth:1400,maxHeight:700,resizable:!0},mode:"text/x-sql",additionalHint:e.hintList,fnUnit:e.options.fnUnit,statement:e.sqlEditViewer.codeMirror.getValue(),tables:e.getInputTables(),scriptType:"SQL Editor",close:function(t){if(t.OK){e.redrawQueryStatement(t.queryStatement);var o=e.createQueryStatementCommand(t.queryStatement);e.executeCommand(o)}}})})},{mandatory:!0})},e.prototype.getInputTables=function(){var t=this.options.fnUnit.parent(),e=this.options.fnUnit.fid,o=[],r=t.getPrevious(e);for(var n in r){var a=t.getFnUnitById(r[n]);for(var i in a[OUT_DATA]){var s={name:a[OUT_DATA][i],label:"Out of "+a.display.label,columns:[]};a[OUT_DATA].length>1&&(s.label=parseInt(i)+1+"th "+s.label),this.dataMap[s.name]&&(s.columns=this.dataMap[s.name].columns),o.push(s);break}}return o},e.prototype.renderQueryStatement=function(){var t=this.options.fnUnit.param[this.PARAM_FULL_QUERY];this.redrawQueryStatement(t)},e.prototype.renderAliasNames=function(){},e.prototype.redrawQueryStatement=function(t){this.sqlEditViewer.setValue(t),this.selectMarker=this.sqlEditViewer.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0}),this.sqlEditViewer.codeMirror.setSize("100%","100%")},e.prototype.customizeElementClass=function(){this.$mainControl.find(".brtc-va-editors-sheet-panels-basepanel-contents-area").addClass("flex");this.$mainControl.find(".brtc-va-editors-sheet-controls-propertycontrol").addClass("sql").find(".brtc-va-editors-sheet-controls-propertycontrol-contents").addClass("sql-contents").find(".brtc-va-editors-sheet-controls-wrapper").addClass("sql-wrapper")},e.prototype.createQueryStatementCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:{}}};return o.ref.param[this.PARAM_FULL_QUERY]=e,new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},e.prototype.renderValidation=function(){for(var t in this.problems)"query"==this.problems[t].param&&this.createValidationContent(this.scalaScriptViewer.$mainControl.parent(),this.problems[t])},t.VA.Core.Functions.Library.queryExecutorPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.PARAM_COLUMNS="columns",t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addColumnsRule()},e.prototype.addColumnsRule=function(){var t=this;this.addRule(function(e){var o=[];return""==e.param.script&&o.push(t.problemFactory.createProblem({errorCode:"BR-0033",param:"script",messageParam:["Script"]},e)),o})},e.prototype.addLinkRule=function(){var t=this;this.addRule(function(e){return t.checkLinkIsConnected(e)})},e.prototype.checkLinkIsConnected=function(t){var e={errorCode:"EL001",messageParam:[t.display.label]};if(!this._hasPrevious(t))return this.problemFactory.createProblem(e,t)},e=e,t.VA.Core.Functions.Library.queryExecutorPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.queryExecutorPython2={category:"script",defaultFnUnit:{func:"queryExecutorPython2",name:"brightics.function.transform$sql_execute2",context:"python",version:"3.6",param:{query:"SELECT "},inputs:{tables:[]},outputs:{out_table:""},meta:{tables:{type:"table",range:{min:1,max:10}},out_table:{type:"table"}},display:{label:"Fast Query Executor",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"This function returns value for executed SQL Query.",tags:["SQL Executor","SQLExecutor","SQL","Query","Preprocessing","Filter","Missing Values","Manipulation","Column Extraction","Table Schema Transform","Query Executor"],"in-range":{min:1,max:8},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.BasePanel.prototype.createContentsAreaControls.call(this,e),this.FnUnitInputs=brtc_require("FnUnitInputs"),this.PARAM_FULL_QUERY="query",this.render={query:this.renderQueryStatement},this.createSelectControl(),this.customizeElementClass()},e.prototype.fillControlValues=function(){var e=this;for(var o in this.columnData=this.dataMap&&this.FnUnitUtils.getInTable(this.options.fnUnit)[0]?this.dataMap[this.FnUnitUtils.getInTable(this.options.fnUnit)[0]].columns:[],this.hintList=[],this.FnUnitUtils.getInTable(this.options.fnUnit))this.hintList.push("#{DF("+o+")}");for(var o in this.columnData)this.hintList.push(this.columnData[o].name);var r={url:"api/va/v3/ws/functions/"+this.options.fnUnit.func,type:"GET",blocking:!1,contentType:"application/json; charset=utf-8"};$.ajax(r).done(function(t){var o=t.hintList;for(var r in o)e.hintList.push(o[r])}).fail(function(e){t.VA.Core.Utils.WidgetUtils.openBadRequestErrorDialog(e)})},e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.PARAM_FULL_QUERY="query",this.render={query:this.renderQueryStatement},this.createSelectControl(),this.customizeElementClass()},e.prototype.createSelectControl=function(){var e=this;this.addPropertyControl("SQL",function(o){var r=$('<textarea class="brtc-va-editors-sheet-controls-sqlcontrol"></textarea>');o.append(r),e.sqlEditViewer=e.createTextAreaControl(r,{verifier:new t.VA.Core.Verifier.SqlVerifier,mode:"text/x-sql",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!0,autofocus:!1,readOnly:"nocursor"}),e.sqlEditViewer.$mainControl.parent().children(".CodeMirror").on("mousedown",function(){$(window).trigger("mousedown"),new t.VA.Core.Dialogs.SqlEditorDialog(e.$mainControl,{title:"SQL",window:{width:1400,height:700,minWidth:700,minHeight:400,maxWidth:1400,maxHeight:700,resizable:!0},mode:"text/x-sql",additionalHint:e.hintList,fnUnit:e.options.fnUnit,statement:e.sqlEditViewer.codeMirror.getValue(),tables:e.getInputTables(),scriptType:"SQL Editor",close:function(t){if(t.OK){e.redrawQueryStatement(t.queryStatement);var o=e.createQueryStatementCommand(t.queryStatement);e.executeCommand(o)}}})})},{mandatory:!0})},e.prototype.getInputTables=function(){var t=this.options.fnUnit.parent(),e=this.options.fnUnit.fid,o=[],r=t.getPrevious(e);for(var n in r){var a=t.getFnUnitById(r[n]);for(var i in a[OUT_DATA]){var s={name:a[OUT_DATA][i],label:"Out of "+a.display.label,columns:[]};a[OUT_DATA].length>1&&(s.label=parseInt(i)+1+"th "+s.label),this.dataMap[s.name]&&(s.columns=this.dataMap[s.name].columns),o.push(s);break}}return o},e.prototype.renderQueryStatement=function(){var t=this.options.fnUnit.param[this.PARAM_FULL_QUERY];this.redrawQueryStatement(t)},e.prototype.renderAliasNames=function(){},e.prototype.redrawQueryStatement=function(t){this.sqlEditViewer.setValue(t),this.selectMarker=this.sqlEditViewer.codeMirror.markText({line:0,ch:0},{line:0,ch:7},{readOnly:!0,inclusiveLeft:!0,atomic:!0}),this.sqlEditViewer.codeMirror.setSize("100%","100%")},e.prototype.customizeElementClass=function(){this.$mainControl.find(".brtc-va-editors-sheet-panels-basepanel-contents-area").addClass("flex");this.$mainControl.find(".brtc-va-editors-sheet-controls-propertycontrol").addClass("sql").find(".brtc-va-editors-sheet-controls-propertycontrol-contents").addClass("sql-contents").find(".brtc-va-editors-sheet-controls-wrapper").addClass("sql-wrapper")},e.prototype.createQueryStatementCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:{}}};return o.ref.param[this.PARAM_FULL_QUERY]=e,new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},e.prototype.renderValidation=function(){for(var t in this.problems)"query"==this.problems[t].param&&this.createValidationContent(this.scalaScriptViewer.$mainControl.parent(),this.problems[t])},t.VA.Core.Functions.Library.queryExecutorPython2.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.PARAM_COLUMNS="columns",t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addColumnsRule()},e.prototype.addColumnsRule=function(){var t=this;this.addRule(function(e){var o=[];return""==e.param.script&&o.push(t.problemFactory.createProblem({errorCode:"BR-0033",param:"script",messageParam:["Script"]},e)),o})},e.prototype.addLinkRule=function(){var t=this;this.addRule(function(e){return t.checkLinkIsConnected(e)})},e.prototype.checkLinkIsConnected=function(t){var e={errorCode:"EL001",messageParam:[t.display.label]};if(!this._hasPrevious(t))return this.problemFactory.createProblem(e,t)},e=e,t.VA.Core.Functions.Library.queryExecutorPython2.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library["brightics.function.transform$get_table"]={category:"transform",defaultFnUnit:{func:"brightics.function.transform$get_table",name:"brightics.function.transform$get_table",context:"python",version:"3.6",param:{key_list:[],index_column:!1,index_column_name:""},inputs:{model:""},outputs:{table:""},meta:{model:{type:"model"},table:{type:"table"}},display:{label:"Get Table",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["key_list","index_column"],description:"Generate a table from a table element contained in some json object.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype;function o(t,o){e.constructor.call(this,t,o)}o.prototype=Object.create(e),o.prototype.constructor=o,o.prototype.createControls=function(){e.createControls.call(this),this.setContentsEditable(!1)},o.prototype.createContentsAreaControls=function(t){e.createContentsAreaControls.call(this,t),this.tableInModelList=[],this.render={group_name:this.renderGroupNameControl,key_list:this.renderKeyControl,index_column:this.renderIndexColumn,index_column_name:this.renderIndexColumnName},this.createIndexColumnControl(),this.createIndexColumnNameControl();var o=this,r=this.FnUnitUtils.getInModel(this.options.fnUnit);this.options.dataProxy.requestDataForce(r,function(t){o.model=t,o.model._grouped_data&&o.createGroupedControl(),o.createKeyControl()},()=>{this.model&&this.model._grouped_data&&this.createGroupedControl(),this.createKeyControl()})},o.prototype.createGroupedControl=function(){var e=this;this.$groupControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>');var o=Object.keys(this.model._grouped_data.data).map(t=>({label:t,value:t}));o.splice(0,0,{label:"All",value:"all"}),this.addPropertyControl("Group Name",function(r){r.append(e.$groupControl),e.createDropDownList(this.$groupControl,{source:o,placeHolder:"Select Group Name"}),e.$groupControl.on("change",function(){var o=e.$groupControl.jqxDropDownList("getSelectedItem")?e.$groupControl.jqxDropDownList("getSelectedItem").value:"";if(e.options.isRendered){const n="all"===o?e.getFirstGroupKey():o;e.$keyControl.jqxDropDownList({source:e.tableInModelList.filter(t=>t.startsWith("_grouped_data.data."+n)).map(t=>({label:t.replace(/(.*\.)/,""),value:t}))}),e.$keyControl.jqxDropDownList("clearSelection");var r=new t.VA.Core.CompoundCommand(e);r.add(e.createCommonCommand("group_only","all"!==o)),r.add(e.createCommonCommand("group_name",o)),r.add(e.createCommonCommand("key_list",[])),e.executeCommand(r)}})},{mandatory:!0,appendIndex:1})},o.prototype.createKeyControl=function(){var e=this;this.$keyControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>');var o=[];if(this.model){if(this.tableInModelList=[],this.deepFilterTable(this.model,""),this.$groupControl){var r=this.options.fnUnit.param.group_name;!r&&this.options.fnUnit.param.key_list.length>2&&"_grouped_data"===this.options.fnUnit.param.key_list[0]&&(r=this.options.fnUnit.param.key_list[2]),r="all"===r?this.getFirstGroupKey():r,o=r?this.tableInModelList.filter(t=>t.startsWith("_grouped_data.data."+r)):[]}else o=this.tableInModelList;o=o.map(t=>({label:t.replace(/(.*\.)/,""),value:t}))}this.addPropertyControl("Key",function(r){r.append(e.$keyControl),e.$keyControl.on("bindingComplete",function(t){e.options.isRendered||e.setContentsEditable(!0)}),e.createDropDownList(this.$keyControl,{source:o,placeHolder:"Select Key"}),e.$keyControl.on("change",function(){var o=e.$keyControl.jqxDropDownList("getSelectedItem")?e.$keyControl.jqxDropDownList("getSelectedItem").value:"",r=new t.VA.Core.CompoundCommand(e);e.$groupControl||r.add(e.createCommonCommand("group_only",!1)),r.add(e.createCommonCommand("group_name","","RemoveFnUnitParameterCommand")),r.add(e.createCommonCommand("key_list",o.split("."))),e.executeCommand(r)})},{mandatory:!0,appendIndex:this.$groupControl?2:1})},o.prototype.createIndexColumnControl=function(){var t=this;this.$indexColumnControl=$('<div class="brtc-va-editors-sheet-controls-radio-group"/>'),this.addPropertyControl("Index Column",function(e){e.append(t.$indexColumnControl),t.createRadioButtonControl(t.$indexColumnControl,"True","true","index_column"),t.createRadioButtonControl(t.$indexColumnControl,"False","false","index_column")},{mendatory:!0})},o.prototype.createIndexColumnNameControl=function(){var t=this;this.$indexColumnNameControl=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input"/>'),this.$indexColumnNameControlWrapper=this.addPropertyControl("Index Column Name",function(e){e.append(t.$indexColumnNameControl);t.createInput(t.$indexColumnNameControl,{placeHolder:"index"}),t.$indexColumnNameControl.on("change",function(e){if(t.isInputValueChanged("index_column_name",$(this).val())){var o=t.createCommonCommand("index_column_name",$(this).val());t.executeCommand(o)}})},{mandatory:!1})},o.prototype.createRadioButtonControl=function(t,e,o,r){var n=this,a=$('<div class="brtc-va-editors-sheet-controls-radiocontrol">'+e+"</div>");t.append(a);this.createRadioButton(a,{groupName:r},"brtc-va-editors-sheet-controls-width-12"),a.attr("value",o),t[e]=a,a.on("checked",function(t){var e="true"===$(t.target).attr("value");e?n.$indexColumnNameControlWrapper.show():(n.$indexColumnNameControl.val(""),n.$indexColumnNameControlWrapper.hide());var o=n.createCommonCommand(r,e);n.executeCommand(o)}),t[e]=a},o.prototype.deepFilterTable=function(t,e){var o=Object.keys(t),r={};"table"===t.type&&(r=t,this.tableInModelList.push(e)),""!==e&&(e+=".");var n=this;return o.filter(function(e){return"object"==typeof t[e]&&null!==t[e]&&!Array.isArray(t[e])}).forEach(function(o){r[o]=n.deepFilterTable(t[o],e+o)}),r},o.prototype.getFirstGroupKey=function(){return this.model&&this.model._grouped_data&&Object.keys(this.model._grouped_data.group_key_dict).length>0?Object.keys(this.model._grouped_data.group_key_dict)[0]:null},o.prototype.createCommonCommand=function(e,o,r){r=r||"SetFnUnitParameterValueCommand";var n={};n[e]=o;var a={fnUnit:this.options.fnUnit,ref:{param:n}};return new t.VA.Core.Editors.Diagram.Commands[r](this,a)},o.prototype.renderGroupNameControl=function(){if(this.$groupControl){var t=this.options.fnUnit.param;void 0===t.group_name||""===t.group_name?void 0!==t.key_list&&t.key_list.length>2&&"_grouped_data"===t.key_list[0]?t.group_only?this.$groupControl.jqxDropDownList("selectItem",t.key_list[2]):this.$groupControl.jqxDropDownList("selectIndex",0):this.$groupControl.jqxDropDownList("selectIndex",-1):this.$groupControl.jqxDropDownList("selectItem",t.group_name)}},o.prototype.renderKeyControl=function(){if(this.$keyControl){var t=this.options.fnUnit.param;void 0===t.key_list||0===t.key_list.length?this.$keyControl.jqxDropDownList("selectIndex",-1):this.$keyControl.jqxDropDownList("selectItem",t.key_list.join("."))}},o.prototype.renderIndexColumn=function(){var t=this.options.fnUnit.param.index_column;!0===t?(t="True",this.$indexColumnNameControlWrapper.show()):(t="False",this.$indexColumnNameControl.val(""),this.$indexColumnNameControlWrapper.hide()),t&&$(this.$indexColumnControl[t]).jqxRadioButton({checked:!0})},o.prototype.renderIndexColumnName=function(){var t=this.options.fnUnit.param.index_column_name;this.$indexColumnNameControl.val(t||"")},t.VA.Core.Functions.Library["brightics.function.transform$get_table"].propertiesPanel=o}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.merge={category:"transform",defaultFnUnit:{context:"python",func:"merge",name:"brightics.function.transform$join",version:"3.6",inputs:{left_table:"",right_table:""},outputs:{table:""},meta:{left_table:{type:"table"},right_table:{type:"table"},table:{type:"table"}},param:{left_on:[],right_on:[],how:"outer",lsuffix:"",rsuffix:"",sort:"false"},display:{label:"Join",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Merge DataFrame objects by performing a database-style join operation by columns.",tags:["join","left","right","inner","outer","merge"]}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit))},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.options.joinTypes=["outer","left","right","inner","left_exclude","right_exclude"],this.render={how:this.renderJoinTypeValue,left_on:this.renderLeftOn,right_on:this.renderRightOn,lsuffix:this.renderLsuffix,rsuffix:this.renderRsuffix,sort:this.renderSort},this.renderError={left_on:this.renderErrorLeftOn,right_on:this.renderErrorRightOn},this.createJoinTypeControl(),this.createLeftOnControl(),this.createRightOnControl(),this.createLsuffixControl(),this.createRsuffixControl(),this.createSortControl()},e.prototype.createLeftOnControl=function(t){var e=this;this.$leftOnColumns=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columnlist"/>'),this.addPropertyControl("Left Keys",function(t){t.append(this.$leftOnColumns);var o={rowCount:3,multiple:!0,changed:function(t,o){e.createColumnListCommand("left_on",o.items)},added:function(t){},removed:function(t){}};e.leftColumnsControl=e.createColumnList(e.$leftOnColumns,o)},{mandatory:!0})},e.prototype.createRightOnControl=function(t){var e=this;this.$rightOnColumns=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columnlist"/>'),this.addPropertyControl("Right Keys",function(t){t.append(this.$rightOnColumns);var o={rowCount:3,multiple:!0,changed:function(t,o){e.createColumnListCommand("right_on",o.items)},added:function(t){},removed:function(t){}};e.rightColumnsControl=e.createColumnList(e.$rightOnColumns,o)},{mandatory:!0})},e.prototype.createJoinTypeControl=function(e){var o=this;this.$joinTypeControl=$('<ul class="brtc-va-editors-sheet-panels-properties-joinproperties-buttoncontainer"><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "outer" title="Full Outer Join"/></div></li><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "leftouter" title="Left Join"/></div></li><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "rightouter" title="Right Join"/></div></li><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "inner" title="Inner Join"/></div></li><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "leftexcluding" title="Left Excluding Join"/></div></li><li> <div class="join-type"> <div class="brtc-va-editors-sheet-panels-properties-joinproperties-icon" type = "rightexcluding" title="Right Excluding Join"/></div></li> </ul>'),this.addPropertyControl("Join Type",function(t){t.append(this.$joinTypeControl)},{mandatory:!0}),this.$joinTypeControl.jqxButtonGroup({mode:"radio",theme:t.VA.Env.Theme}),this.$joinTypeControl.jqxButtonGroup("setSelection",0),this.$joinTypeControl.on("selected",function(e){var r=e.args.button,n=new t.VA.Core.CompoundCommand(o,{});o.$joinTypeControl.find(".brtc-va-editors-sheet-panels-properties-joinproperties-icon").removeClass("brtc-va-editors-sheet-panels-properties-joinproperties-icon-selected"),r.find(".brtc-va-editors-sheet-panels-properties-joinproperties-icon").addClass("brtc-va-editors-sheet-panels-properties-joinproperties-icon-selected");var a=$(r[0]).find('[type="leftexcluding"]'),i=$(r[0]).find('[type="rightexcluding"]');"leftexcluding"===a.attr("type")?(n.add(o.createJoinTypeCommand()),o.executeCommand(n)):"rightexcluding"===i.attr("type")?(n.add(o.createJoinTypeCommand()),o.executeCommand(n)):o.executeCommand(o.createJoinTypeCommand())})},e.prototype.createLsuffixControl=function(t){var e=this;this.$lsuffixControl=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input" valid-type="type1"/>'),this.$lsuffixControlWrapper=this.addPropertyControl("Left Suffix",function(t){t.append(this.$lsuffixControl),e.createInput(e.$lsuffixControl,{placeHolder:"_left"}),e.$lsuffixControl.on("change",function(t){e.isInputValueChanged("lsuffix",$(this).val())&&e.createInputCommand("lsuffix",$(this).val())})})},e.prototype.createRsuffixControl=function(t){var e=this;this.$rsuffixControl=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-input" valid-type="type1"/>'),this.$rsuffixControlWrapper=this.addPropertyControl("Right Suffix",function(t){t.append(this.$rsuffixControl),e.createInput(e.$rsuffixControl,{placeHolder:"_right"}),e.$rsuffixControl.on("change",function(t){e.isInputValueChanged("rsuffix",$(this).val())&&e.createInputCommand("rsuffix",$(this).val())})})},e.prototype.createSortControl=function(t){var e=this;this.$sortTrueControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton">True</div>'),this.$sortFalseControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton">False</div>');this.addPropertyControl("Sort",function(t){t.append(this.$sortTrueControl).append(this.$sortFalseControl),e.createRadioButton(e.$sortTrueControl,{width:"80",groupName:"Group"}),e.createRadioButton(e.$sortFalseControl,{width:"80",groupName:"Group"}),e.$sortTrueControl.on("checked",function(t){e.createRadioButtonCommand("sort","true")}),e.$sortFalseControl.on("checked",function(t){e.createRadioButtonCommand("sort","false")})})},e.prototype.fillControlValues=function(t){var e,o,r=this.FnUnitUtils.getInputs(this.options.fnUnit);e=this.dataMap&&r.left_table?this.dataMap[r.left_table].columns:[],o=this.dataMap&&r.right_table?this.dataMap[r.right_table].columns:[],this.leftColumnsControl.setItems(e),this.rightColumnsControl.setItems(o),this.$sortFalseControl.jqxRadioButton("check")},e.prototype.renderJoinTypeValue=function(){var t=this.options.fnUnit.param.how;this.$joinTypeControl.jqxButtonGroup("setSelection",this.options.joinTypes.indexOf(t))},e.prototype.renderLeftOn=function(){var t=this.options.fnUnit.param;this.leftColumnsControl.setSelectedItems(t.left_on)},e.prototype.renderRightOn=function(){var t=this.options.fnUnit.param;this.rightColumnsControl.setSelectedItems(t.right_on)},e.prototype.renderLsuffix=function(){this.$lsuffixControl.val(this.options.fnUnit.param.lsuffix||"")},e.prototype.renderRsuffix=function(){this.$rsuffixControl.val(this.options.fnUnit.param.rsuffix||"")},e.prototype.renderSort=function(){var t=this.options.fnUnit.param;void 0===t.sort?this.$sortFalseControl.jqxRadioButton("check"):("true"===t.sort&&this.$sortTrueControl.jqxRadioButton("check"),"false"===t.sort&&this.$sortFalseControl.jqxRadioButton("check"))},e.prototype.renderValidation=function(){if(this.problems.length>0)for(var t in this.problems)"left_on"===this.problems[t].param&&this.createValidationContent(this.$leftOnColumns,this.problems[t]),"right_on"===this.problems[t].param&&this.createValidationContent(this.$rightOnColumns,this.problems[t])},e.prototype.renderErrorLeftOn=function(t){this.createValidationContent(this.$leftOnColumns,t)},e.prototype.renderErrorRightOn=function(t){this.createValidationContent(this.$rightOnColumns,t)},e.prototype.createColumnListCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]=[],o&&(r.ref.param[e]=o);var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},e.prototype.createNumericInputCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]="",o&&(r.ref.param[e]=o);var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},e.prototype.createRadioButtonCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]=o;var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},e.prototype.createInputCommand=function(e,o){var r={fnUnit:this.options.fnUnit,ref:{param:{}}};r.ref.param[e]="",o&&(r.ref.param[e]=o);var n=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,r);this.executeCommand(n)},e.prototype.createColumnsCommand=function(){var e=this.leftColumnsControl.getSelectedItems(),o=this.rightColumnsControl.getSelectedItems();return 0===e.length&&(e[0]=""),0===o.length&&(o[0]=""),new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,{fnUnit:this.options.fnUnit,ref:{param:{columns:[e,o]}}})},e.prototype.createJoinTypeCommand=function(){var e=this.options.joinTypes[this.$joinTypeControl.jqxButtonGroup("getSelection")]||"inner";return new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,{fnUnit:this.options.fnUnit,ref:{param:{how:e}}})},t.VA.Core.Functions.Library.merge.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){this.PARAM_LEFT_ON="left_on",this.PARAM_RIGHT_ON="right_on",t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addLeftOnRule(),this.addRightOnRule()},e.prototype.addLeftOnRule=function(){var t=this;this.addRule(function(e){return t.checkColumnIsEmpty(e,t.PARAM_LEFT_ON,e.param[t.PARAM_LEFT_ON],"Left Columns")})},e.prototype.addRightOnRule=function(){var t=this;this.addRule(function(e){return t.checkColumnIsEmpty(e,t.PARAM_RIGHT_ON,e.param[t.PARAM_RIGHT_ON],"Right Columns")})},t.VA.Core.Functions.Library.merge.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.selectColumnPython={category:"transform",defaultFnUnit:{func:"selectColumnPython",name:"brightics.function.transform$select_column",context:"python",version:"3.6",param:{input_cols:[],output_cols:[],output_types:[]},inputs:{table:""},outputs:{out_table:""},meta:{table:{type:"table"},out_table:{type:"table"}},display:{label:"Select Column",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["output_cols","output_types"],description:"This function creates a dataframe with the given input.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit)),this.options.isRendered=!0},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.control={},this.createOpenDialogButton()},e.prototype.createOpenDialogButton=function(){var t=this;this.$summaryControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>'),this.$selectedColumnProp=this.addPropertyControl("Selected Column",function(e){e.append(t.$summaryControl),t.control.summary=t.createTextArea(t.$summaryControl,{height:"300px",disabled:!0},"brtc-style-textarea"),t.$summaryControl.on("click",function(e){t.openScriptEditor()})},{mandatory:!0})},e.prototype.openScriptEditor=function(){var e=this;new t.VA.Core.Dialogs.FunctionProperties.SelectColumnDialog(e.$mainControl,{title:"Select Column",fnUnit:e.options.fnUnit,dataProxy:e.options.dataProxy,modelEditor:e.options.modelEditor,close:function(t){if(t.OK){e.setSummaryString(t.param);var o=e.createCommonCommand(t.param);e.executeCommand(o)}}})},e.prototype.renderValues=function(t){this.setSummaryString(this.options.fnUnit.param)},e.prototype.renderValidation=function(){for(var t in this.problems)"selected-column"===this.problems[t].param&&this.createValidationContent(this.$summaryControl,this.problems[t])},e.prototype.setSummaryString=function(t){if(t.input_cols){const e=_.zip(t.input_cols,t.output_cols,t.output_types).map(([t,e,o])=>[t,` Alias: ${e},`,` Type: ${o}`,""].join("\n")).join("\n");this.control.summary.val(e)}},e.prototype.createCommonCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:e}};return new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},t.VA.Core.Functions.Library.selectColumnPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addSelectedColumnRequired()},e.prototype.addSelectedColumnRequired=function(){var t=this;this.addRule(function(e){if(this._hasSchema(e)){return t._checkArrayIsEmpty({errorCode:"BR-0033",param:"selected-column",messageParam:["Selected Column"]},e,e.param.input_cols)}})},t.VA.Core.Functions.Library.selectColumnPython.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.simpleFilterPython={category:"transform",defaultFnUnit:{func:"simpleFilterPython",name:"brightics.function.manipulation$simple_filter",context:"python",version:"3.6",param:{main_operator:"and",input_cols:[],operators:[],operands:[]},inputs:{table:""},outputs:{out_table:""},meta:{table:{type:"table"},out_table:{type:"table"}},display:{label:"Filter",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},mandatory:["main_operator","input_cols","operators","operands"],description:"This function creates a dataframe with the given input.",tags:["Python"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.FnUnitUtils.getInTable(this.options.fnUnit)),this.options.isRendered=!0},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.control={},this.createOpenDialogButton()},e.prototype.createOpenDialogButton=function(){var t=this;this.$summaryControl=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-textareacontrol"/>'),this.addPropertyControl("Condition",function(e){e.append(t.$summaryControl),t.control.summary=t.createTextArea(t.$summaryControl,{height:"300px",disabled:!0},"brtc-style-textarea"),t.$summaryControl.on("click",function(e){t.openScriptEditor()})},{mandatory:!0})},e.prototype.openScriptEditor=function(){var e=this;new t.VA.Core.Dialogs.FunctionProperties.SimpleFilterDialog(e.$mainControl,{title:"Filter",fnUnit:e.options.fnUnit,dataProxy:e.options.dataProxy,modelEditor:e.options.modelEditor,close:function(t){if(t.OK){e.setSummaryString(t.param);var o=e.createCommonCommand(t.param);e.executeCommand(o)}}})},e.prototype.renderValues=function(t){this.setSummaryString(this.options.fnUnit.param)},e.prototype.renderValidation=function(){},e.prototype.setSummaryString=function(t){if(t.input_cols){var e=t.main_operator,o="";t.input_cols.forEach(function(r,n,a){o+=r+" "+t.operators[n]+" "+t.operands[n]+"\n",n!=a.length-1&&(o+="\t"+e+"\n")}),this.control.summary.val(o)}},e.prototype.createCommonCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:e}};return new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,o)},t.VA.Core.Functions.Library.simpleFilterPython.propertiesPanel=e}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addSummaryRequired()},e.prototype.addSummaryRequired=function(){var t=this;this.addRule(function(e){if(this._hasSchema(e)){return t._checkArrayIsEmpty({errorCode:"BR-0033",param:"filter",messageParam:["Filter"]},e,e.param.input_cols)}})},t.VA.Core.Functions.Library.simpleFilterPython.validator=e}.call(this),function(){"use strict";var t=this,e=t.Brightics,o=e.VA.Core.Dialogs.PropertiesPanelDialog.prototype;function r(t,e){o.constructor.call(this,t,e)}r.prototype=Object.create(o),r.prototype.constructor=r,r.prototype.createContentsAreaControls=function(t){this.createAddColumnInfoControl(),this.createAddButtonControl()},r.prototype.renderValues=function(){this.renderAddColumn()},r.prototype.createAddColumnInfoControl=function(){this.$columnInfoArea=$('<div class="brtc-va-refine-addcolumn-newcolumn-container"></div>'),this.popupProperty.$contentsArea.append(this.$columnInfoArea),this.$columnInfoArea.sortable({axis:"y",helper:function(t,e){var o=$(e).clone();return o.css("position","absolute"),o.get(0)},containment:".brtc-va-refine-addcolumn-newcolumn-container",handle:".brtc-va-refine-addcolumn-newcolumn-sort",stop:function(t,e){}}),this.$columnInfoArea.disableSelection(),this.popupProperty.$contentsArea.perfectScrollbar(),this.popupProperty.$contentsArea.perfectScrollbar("update")},r.prototype.createAddButtonControl=function(){var t=this,o=$('<input type="button" class="brtc-va-conditional-update-property add-else-if-button" value="+ Add New Column"/>');this.popupProperty.$contentsArea.append(o),o.jqxButton({theme:e.VA.Env.Theme,width:"100%",height:25}),o.click(function(){t.createNewColumnItem()})},r.prototype.createNewColumnItem=function(o,r){var n=$('<div class="brtc-va-refine-addcolumn-newcolumn-item"> <div class="brtc-va-refine-addcolumn-newcolumn-sort"><i class="fa fa-bars"></i></div> <input type="text" class="brtc-va-refine-addcolumn-newcolumn-name" valid-type="type1"/> <div class="brtc-va-refine-addcolumn-newcolumn-assignor">=</div> <textarea class="brtc-va-refine-addcolumn-newcolumn-value"></textarea> <div class="brtc-va-refine-addcolumn-newcolumn-remove"></div></div>');this.$columnInfoArea.append(n),n.find(".brtc-va-refine-addcolumn-newcolumn-name").jqxInput({theme:e.VA.Env.Theme,placeHolder:"Enter name",width:"122px",height:27}),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(n.find(".brtc-va-refine-addcolumn-newcolumn-name")),o&&n.find(".brtc-va-refine-addcolumn-newcolumn-name").val(o);var a=$.map(this.options.columns,function(t,e){return t}),i=CodeMirror.fromTextArea(n.find(".brtc-va-refine-addcolumn-newcolumn-value")[0],{mode:"text/x-sql",theme:"default",indentWithTabs:!0,smartIndent:!0,lineNumbers:!1,matchBrackets:!1,scrollbarStyle:"null",extraKeys:{"Ctrl-Space":"autocomplete"},hintOptions:{list:this.options.additionalHint.concat(a,["ROUND()","MAX()","MIN()","SUM()","AVG()","OVER()","NVL()","CONCAT()","LPAD()","LTRIM()","RPAD()","RTRIM()","SUBSTR()","SUBSTRING()","FROM_UNIXTIME()","YEAR()","MONTH()","WEEKOFYEAR()"])}});i.setSize("calc(100% - 200px)",n.find(".brtc-va-refine-addcolumn-newcolumn-name").height()),e.VA.Core.Utils.WidgetUtils.adjustCodeMirrorEsc(i),i.on("beforeChange",function(t,e){var o=e.text.join("").replace(/\n/g,"");return e.update&&e.update(e.from,e.to,[o]),!0}),r&&i.setValue(r),n.find(".brtc-va-refine-addcolumn-newcolumn-name").on("change",function(t){}),i.on("change",function(t){}),n.find(".brtc-va-refine-addcolumn-newcolumn-remove").click(function(){$(this).closest(".brtc-va-refine-addcolumn-newcolumn-item").remove()})},r.prototype.createSelect=function(){var t=this.$mainControl.find(".brtc-va-refine-addcolumn-newcolumn-item"),e="SELECT *",o=0;return $.each(t,function(r,n){o<t.length&&(e+=", \n",o++);var a=$(t[r]).find(".brtc-va-refine-addcolumn-newcolumn-name").val(),i=$(t[r]).find(".CodeMirror")[0].CodeMirror.getValue();e+=i+" as `"+a+"`"}),{query:e+="\nFROM #{DF(0)}"}},r.prototype.handleOkClicked=function(){this.dialogResult.param=this.createSelect(),e.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)},r.prototype.fillControlValues=function(){this.columnData=this.popupProperty.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name})},r.prototype.renderAddColumn=function(){if(this.options.fnUnit.param){var t=this.options.fnUnit.param.query.split("\n");t[t.length-1].endsWith("FROM #{DF(0)}")&&t.splice(t.length-1,1),t[0].startsWith("SELECT *")&&t.splice(0,1);for(var e=0;e<t.length;e++){var o=t[e].lastIndexOf(" as "),r=t[e].substring(0,o).trim(),n=t[e].substring(o+4).trim();","==(n=n.replace(/`/gi,"")).slice(-1)&&(n=n.substring(0,n.length-1)),this.createNewColumnItem(n,r)}}else this.createNewColumnItem()},r.prototype.checkValidation=function(){var t=this,e=this.$mainControl.find(".brtc-va-refine-addcolumn-newcolumn-item"),o=[];$.each(e,function(r,n){var a=$(e[r]).find(".brtc-va-refine-addcolumn-newcolumn-name").val(),i=$(e[r]).find(".CodeMirror")[0].CodeMirror.getValue();if(""===a&&""===i)t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:r,param:"New column name",messageParam:["New column name","Value"]}));else if(""===a)t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:r,param:"New column name",messageParam:["New column name"]}));else if($.inArray(a,o)>-1){var s="New column name(s) - '"+a+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:r,param:"New column name",messageParam:[s]}))}else if($.inArray(a,$.map(t.options.columns,function(t){return t.name}))>-1){s="New column name(s) - '"+a+"' already exist.";t.addProblem(t.createProblem({errorCode:"BR-0100",paramIndex:r,param:"New column name",messageParam:[s]}))}else""===i&&t.addProblem(t.createProblem({errorCode:"BR-0033",paramIndex:r,param:"Value",messageParam:["Value"]})),o.push(a)}),this.renderValidation()},r.prototype.renderValidation=function(){var t=this;$.each(this.problems,function(e,o){var r=t.$mainControl.find(".brtc-va-refine-addcolumn-newcolumn-item");"BR-0033"==o.code?t.createValidationContent($(r[o.paramIndex]),o):t.createValidationContent($(r[o.paramIndex]),o,"New column name"==o.param?$(r[o.paramIndex]).find(".brtc-va-refine-addcolumn-newcolumn-name"):$(r[o.paramIndex]).find(".CodeMirror")),t.$mainControl.find(".brtc-va-refine-step-validation-tooltip").css({width:"465px","margin-left":"30px"})})},e.VA.Core.Dialogs.FunctionProperties.AddColumnDialog=r}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Dialogs.PropertiesPanelDialog.prototype;function o(t,o){e.constructor.call(this,t,o)}o.prototype=Object.create(e),o.prototype.constructor=o,o.prototype.createContentsAreaControls=function(t){this.control={conditions:[],values:[]},this.createColumnInfoControl(),this.createConditionControl()},o.prototype.renderValues=function(){this.renderColumnName(),this.renderColumnType(),this.renderExprType(),this.renderCondition()},o.prototype.createColumnInfoControl=function(){this.$columnInfoArea=$('<div class="brtc-va-editors-sheet-controls-propertycontrol direction-row"></div>'),this.popupProperty.$contentsArea.append(this.$columnInfoArea),this.createColumnNameControl(),this.createColumnTypeControl(),this.createExprTypeControl()},o.prototype.createColumnNameControl=function(){var t=this;this.popupProperty.addPropertyControl("New Column Name",function(e){t.control.new_col=t.createInput(e,{key:"new_col",label:"New Column Name",widgetOption:{height:"29px"}})},{mandatory:!0,propertyControlParent:t.$columnInfoArea})},o.prototype.createExprTypeControl=function(){var t=this,e=[{label:"SQLite",value:"sqlite"},{label:"Python",value:"python"}],o=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>');this.popupProperty.addPropertyControl("Expression Type",function(r){r.append(o),t.control.expr_type=t.createDropDownList(o,{widgetOption:{source:e,selectedIndex:0,displayMember:"label",valueMember:"value"}})},{mandatory:!0,propertyControlParent:t.$columnInfoArea})},o.prototype.createColumnTypeControl=function(){var t=this,e=[{label:"String",value:"string"},{label:"Number",value:"number"}],o=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>');this.popupProperty.addPropertyControl("New Column Type",function(r){r.append(o),t.control.column_type=t.createDropDownList(o,{widgetOption:{source:e,selectedIndex:0,displayMember:"label",valueMember:"value"}})},{mandatory:!0,propertyControlParent:t.$columnInfoArea})};o.prototype.createConditionControl=function(){var t=this;this.$ifArea=$("<div>"),this.popupProperty.addPropertyControl("Condition",function(e){t.$deckTarget=e,e.append(t.$ifArea),t.createAddButton()},{mandatory:!0}),this.bindConditionControl()},o.prototype.createAddButton=function(){var e=this,o=$('<input type="button" class="brtc-va-conditional-update-property add-else-if-button" value="+ Add Else if"/>');this.$deckTarget.append(o),o.jqxButton({theme:t.VA.Env.Theme,width:"100%",height:25}),o.click(function(){e.createDeckControl("IF")})},o.prototype.bindConditionControl=function(){var t=this;this.control.control_condition={},this.control.control_condition.setValue=function(e,o,r){if(e.length>0&&o.length>0){for(var n=0;n<e.length;n++)t.createDeckControl("IF"),t.control.conditions[n].setValue(e[n]),t.control.values[n].setValue(o[n]);t.createDeckControl("ELSE"),t.control.else_value.setValue(r)}else t.createDeckControl("IF"),t.createDeckControl("ELSE")},this.control.control_condition.getValue=function(){var e=[],o=[],r=t.control.else_value.getValue(),n=t.control.column_type.getValue();return"number"==n&&(r=Number(r)),t.control.values.forEach(function(r,a){e.push(t.control.conditions[a].getValue()),"number"==n?o.push(Number(r.getValue())):o.push(r.getValue())}),{conditions:e,values:o,else_value:r}}},o.prototype.createDeckControl=function(t){var e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-deck"/>');e.addClass("brtc-style-display-flex"),"IF"===t?(this.$ifArea.append(e),this.createRemoveButton(e),this.createExprControl(e,t),this.createValueControl(e,t)):(this.$deckTarget.append(e),this.createValueControl(e,t))},o.prototype.createRemoveButton=function(t){var e=$('<div class ="brtc-va-editors-sheet-controls-propertycontrol-deck-remove"></div>');t.append(e);var o=this;e.click(function(t){var e=$(this).closest(".brtc-va-editors-sheet-controls-propertycontrol-deck"),r=e.index();r>-1&&(o.control.conditions.splice(r,1),o.control.values.splice(r,1)),e.remove(),t.stopPropagation()})},o.prototype.createExprControl=function(t,e){var o=this.createTextArea(t,{widgetOption:{placeholder:"Condition Expression",height:"29px",scrollbarStyle:"null",lineWrapping:!0},addClass:"brtc-style-flex-2"});"IF"===e&&""!=this.control.new_col.getValue()&&o.codeMirror.focus(),t.find(".brtc-va-editors-sheet-controls-propertycontrol-textareacontrol").css({"max-width":"336px"}),this.control.conditions.push(o)},o.prototype.createValueControl=function(t,e){var o=this.createInput(t,{addClass:"brtc-style-flex-1",widgetOption:{height:"29px"}});"IF"===e?this.control.values.push(o):this.control.else_value=o},o.prototype.getControlValue=function(){return $.extend(!0,{},{new_col:this.control.new_col.getValue(),expr_type:this.control.expr_type.getValue()},this.control.control_condition.getValue())},o.prototype.handleOkClicked=function(){this.dialogResult.param=this.getControlValue(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)},o.prototype.fillControlValues=function(){this.columnData=this.popupProperty.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name})},o.prototype.renderColumnName=function(){var t=this.options.fnUnit.param.new_col;this.control.new_col.setValue(t),this.control.new_col.closest(".brtc-va-editors-sheet-controls-propertycontrol").css({"flex-grow":2})},o.prototype.renderColumnType=function(){var t=this.options.fnUnit.param.values;t&&"number"==typeof t[0]&&this.control.column_type.setValue("number"),this.control.column_type.closest(".brtc-va-editors-sheet-controls-propertycontrol").css({"flex-grow":1})},o.prototype.renderExprType=function(){var t=this.options.fnUnit.param.expr_type;this.control.expr_type.setValue(t),this.control.expr_type.closest(".brtc-va-editors-sheet-controls-propertycontrol").css({"flex-grow":1})},o.prototype.renderCondition=function(){var t=this.options.fnUnit.param.conditions,e=this.options.fnUnit.param.values,o=this.options.fnUnit.param.else_value;this.control.control_condition.setValue(t,e,o)},o.prototype.renderValidation=function(){},t.VA.Core.Dialogs.FunctionProperties.AddColumnIfDialog=o}.call(this),function(){"use strict";var t=this,e=t.Brightics,o=e.VA.Core.Dialogs.PropertiesPanelDialog.prototype;const r="output_cols",n="output_types",a=[{label:"String",value:"string",internalType:"String"},{label:"Int",value:"int",internalType:"Integer"},{label:"Long",value:"long",internalType:"Long"},{label:"Double",value:"double",internalType:"Double"},{label:"Boolean",value:"boolean",internalType:"Boolean"}];function i(t,e){o.constructor.call(this,t,e)}i.prototype=Object.create(o),i.prototype.constructor=i,i.prototype.createContentsAreaControls=function(t){this.control={check:[],input_cols:[],[r]:[],[n]:[]},this.createConditionControl()},i.prototype.renderValues=function(){this.renderCondition()},i.prototype.createConditionControl=function(){var t=this;this.$deckTarget=$('<div class="brtc-style-display-flex brtc-style-flex-direction-column"/>'),this.popupProperty.addPropertyControl("Condition",function(e){e.append(t.$deckTarget),t.createHeader()},{mandatory:!0}),this.bindConditionControl()},i.prototype.createHeader=function(){$('<div class="brtc-va-selectcolumn-column-item"/>').addClass("brtc-style-flex-center");var t=$('<div class="brtc-va-selectcolumn-header brtc-style-flex-center-text"> <div class="brtc-va-selectcolumn-header-check"></div> <div class="brtc-va-selectcolumn-header-label name">Name</div> <div class="brtc-va-selectcolumn-header-label alias">New Name </div> <div class="brtc-va-selectcolumn-header-type">Type </div></div>');this.$deckTarget.append(t);var e=this,o=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-checkbox"/>');t.find(".brtc-va-selectcolumn-header-check").append(o),this.popupProperty.createCheckBox(o,{width:23,height:27,checked:!0}).on("click",function(t){var o=$(e.$deckTarget.find(".brtc-va-editors-sheet-controls-propertycontrol-checkbox"));$(this).val()?e._selectAllItem(o):(e._unSelectAllItem(o),e.$okButton.jqxButton({disabled:!0}))})},i.prototype._selectAllItem=function(t){for(var e=1;e<t.length;e++)$(t[e]).jqxCheckBox({checked:!0})},i.prototype._unSelectAllItem=function(t){for(var e=1;e<t.length;e++)$(t[e]).jqxCheckBox({checked:!1})},i.prototype.createDeckControl=function(t){var e=$('<div class="brtc-va-selectcolumn-column-item"/>');e.addClass("brtc-style-flex-center");var o=t.check;this.createCheckBoxControl(e,o),this.$deckTarget.sortable({axis:"y",helper:function(t,e){var o=$(e).clone();return o.css("position","absolute"),o.get(0)},items:".brtc-va-selectcolumn-column-item",cancel:".brtc-va-selectcolumn-column-item.sort-disabled",handle:".brtc-va-selectcolumn-column-sort"},"refreshPositions"),this.$deckTarget.append(e),this.createSortControl(e),this.createColumnControl(e,o),this.createAliasControl(e,o),this.createTypeControl(e,o),this.createResetControl(e,t)},i.prototype.createCheckBoxControl=function(t,e){var o=this,r=this.createCheckBox(t,{widgetOption:{checked:e},checkedFunc:function(){var t=$(this).closest(".brtc-va-selectcolumn-column-item");t.removeClass("sort-disabled"),o.control.conditions.setEnable(t),o.setAllCheckBoxCondition()},uncheckedFunc:function(){var t=$(this).closest(".brtc-va-selectcolumn-column-item");t.addClass("sort-disabled"),o.control.conditions.setDisable(t),o.setAllCheckBoxCondition();for(var e=0,r=0;r<o.control.check.length;r++)!1===o.control.check[r].getValue()&&e++;r===e&&o.$okButton.jqxButton({disabled:!0})}});this.control.check.push(r)},i.prototype.setAllCheckBoxCondition=function(){for(var t=!0,e=0;e<this.control.check.length;e++)if(!1===this.control.check[e].getValue()){t=!1;break}t?$(this.$deckTarget.find(".brtc-va-editors-sheet-controls-propertycontrol-checkbox")[0]).jqxCheckBox({checked:!0}):$(this.$deckTarget.find(".brtc-va-editors-sheet-controls-propertycontrol-checkbox")[0]).jqxCheckBox({checked:!1})},i.prototype.createSortControl=function(t){var e=$('<div class="brtc-va-selectcolumn-column-sort"><i class="fa fa-bars"></i></div>');t.append(e)},i.prototype.createColumnControl=function(t){this.control.input_cols.push(this.createInput(t,{widgetOption:{disabled:!0},addClass:"column-name"}))},i.prototype.createAliasControl=function(e,o){const r=this.createInput(e,{widgetOption:{disabled:!o},addClass:"column-alias"});r.attr("valid-type","type1"),this.control.output_cols.push(r),t.Brightics.VA.Core.Utils.InputValidator.appendValidationCondition(this._getAlias(e))},i.prototype._getColumnType=function(t){var e=a.find(({internalType:e})=>e===t);return e?e.value:t},i.prototype.createTypeControl=function(t,e){this.control[n].push(this.createDropDownList(t,{widgetOption:{source:a,width:"80px",disabled:!e,displayMember:"label",valueMember:"value"},addClass:"column-type"}))},i.prototype.createResetControl=function(t,e){var o=$('\n <div class="brtc-va-selectcolumn-column-reset-wrapper">\n <div class="brtc-va-selectcolumn-column-reset" title="Reset"></div>\n </div>\n ');t.append(o);var a=this;o.on("click",function(){var t=$(this).parent();a._getItemValue(t,"check")&&(a._resetItem(t,r,e.output_cols),a._resetItem(t,n,e[n]))})},i.prototype.bindConditionControl=function(){var t=this;this.control.conditions={},this.control.conditions.setValue=function(e){var o=[],a=0,i=e.input_cols.length>0;t.columnData.forEach(function(s){e.input_cols.includes(s.name)?(o.push({check:!0,input_cols:e.input_cols[a],[r]:e.output_cols[a],[n]:e[n][a]}),a++):o.push({check:!i,input_cols:s.name,[r]:s.name,[n]:t._getColumnType(s.internalType)})}),o.forEach(function(e,o){t.createDeckControl(e),t.control.input_cols[o].setValue(e.input_cols),t.control.output_cols[o].setValue(e.output_cols),t.control[n][o].setValue(e[n])}),t.setAllCheckBoxCondition()},this.control.conditions.getValue=function(){for(var e=[],o=[],a=[],i=t.$deckTarget.find(".brtc-va-selectcolumn-column-item"),s=0;s<i.length;s++){var l=$(i[s]);t._getItemValue(l,"check")&&(e.push(t._getItemValue(l,"input_cols")),o.push(t._getItemValue(l,r)),a.push(t._getItemValue(l,n)))}return{input_cols:e,[r]:o,[n]:a}},this.control.conditions.setDisable=function(e){if(e)t._disableItem(e,r,!0),t._disableItem(e,n,!0);else{for(var o=t.control.check.length,a=0;a<o;a++)t.control.check[a].setValue(!1);t.$okButton.jqxButton({disabled:!0})}},this.control.conditions.setEnable=function(e){if(e)t._disableItem(e,r,!1),t._disableItem(e,n,!1);else for(var o=t.control.check.length,a=0;a<o;a++)t.control.check[a].setValue(!0);t.$okButton.jqxButton({disabled:!1})}},i.prototype._getColumn=function(t){return t.find(".column-name .brtc-va-editors-sheet-controls-propertycontrol-input")},i.prototype._getAlias=function(t){return t.find(".column-alias .brtc-va-editors-sheet-controls-propertycontrol-input")},i.prototype._getType=function(t){return t.find(".column-type .brtc-va-editors-sheet-controls-propertycontrol-combobox")},i.prototype._getCheckBox=function(t){return t.find(".brtc-va-editors-sheet-controls-propertycontrol-checkbox")},i.prototype._disableItem=function(t,e,o){e==r?this._getAlias(t).jqxInput({disabled:o}):e==n&&this._getType(t).jqxDropDownList({disabled:o})},i.prototype._resetItem=function(t,e,o){e==r?this._getAlias(t).val(o):e==n&&this._getType(t).val(o)},i.prototype._getItemValue=function(t,e){return"input_cols"==e?this._getColumn(t).val():e==r?this._getAlias(t).val():e==n?this._getType(t).val():"check"==e?this._getCheckBox(t).val():void 0},i.prototype.getControlValue=function(){return $.extend(!0,{},this.control.conditions.getValue())},i.prototype.handleOkClicked=function(){this.dialogResult.param=this.getControlValue(),e.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)},i.prototype.fillControlValues=function(){this.columnData=this.popupProperty.getColumnsOfInTable(0,["number","string"])},i.prototype.renderCondition=function(){var t=this.options.fnUnit.param;this.control.conditions.setValue(t)},i.prototype.renderValidation=function(){},e.VA.Core.Dialogs.FunctionProperties.SelectColumnDialog=i}.call(this),function(){"use strict";var t=this.Brightics,e=t.VA.Core.Dialogs.PropertiesPanelDialog.prototype;function o(t,o){e.constructor.call(this,t,o)}o.prototype=Object.create(e),o.prototype.constructor=o,o.prototype.createContentsAreaControls=function(t){this.control={input_cols:[],operators:[],operands:[]},this.createConditionControl()},o.prototype.renderValues=function(){this.renderCondition()},o.prototype.createConditionControl=function(){var t=this;this.operandSource={string:[{label:"==",value:"=="},{label:"!=",value:"!="},{label:"In",value:"in"},{label:"Not In",value:"not in"},{label:"Starts With",value:"starts with"},{label:"Ends With",value:"ends with"},{label:"Contain",value:"contain"},{label:"Not Contain",value:"not contain"}],number:[{label:"==",value:"=="},{label:"!=",value:"!="},{label:"<",value:"<"},{label:"<=",value:"<="},{label:">",value:">"},{label:">=",value:">="},{label:"In",value:"in"},{label:"Not In",value:"notIn"}]},this.$deckArea=$("<div>"),this.popupProperty.addPropertyControl("Condition",function(e){t.$deckTarget=e,t.createAndOrControl(),e.append(t.$deckArea)},{mandatory:!0}),this.createAddButton(),this.bindConditionControl()},o.prototype.createAndOrControl=function(){var t=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-input-and"></div>');t.css("height","30px"),this.$deckTarget.append(t);var e=[{label:"And",value:"and"},{label:"Or",value:"or"}];this.control.main_operator=this.createRadioButton(t,{widgetOption:{width:"60"},value:e[0].value,key:"main_operator",source:e,addCSS:{float:"left"}})},o.prototype.createDeckControl=function(){var t=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-deck"/>');t.addClass("brtc-style-display-flex"),this.$deckArea.append(t),this.createRemoveButton(t),this.createColumnControl(t),this.createOperatorControl(t),this.createOperandControl(t)},o.prototype.createRemoveButton=function(t){var e=$('<div class ="brtc-va-editors-sheet-controls-propertycontrol-deck-remove"></div>');t.append(e);var o=this;e.click(function(t){var e=$(this).closest(".brtc-va-editors-sheet-controls-propertycontrol-deck"),r=e.index();r>-1&&(o.control.input_cols.splice(r,1),o.control.operators.splice(r,1),o.control.operands.splice(r,1)),e.remove(),t.stopPropagation()})},o.prototype.createColumnControl=function(t){var e=this,o={rowCount:1,multiple:!1,height:27,changed:function(t,o){var r="";for(var n in e.columnObjectData)if(e.columnObjectData[n].name===o.items[0]){r=e.columnObjectData[n].type;break}var a=this.renderedItems[this.selectedItems[0]].closest(".brtc-va-editors-sheet-controls-propertycontrol-deck").index();e.control.operators[a].jqxDropDownList({disabled:!1,source:e.operandSource[r]})}},r=this.createColumnList(t,{widgetOption:o,addClass:"brtc-style-flex-2"});r.setItems(this.columnObjectData),this.control.input_cols.push(r)},o.prototype.createOperatorControl=function(t){this.control.operators.push(this.createDropDownList(t,{widgetOption:{source:this.operandSource.number,placeHolder:"",height:"27px !important"},addCSS:{width:"20%"}}))},o.prototype.createOperandControl=function(t){var e=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-input-condition-operand brtc-style-flex-2"/>');t.append(e),this.control.operands.push(e),e.getValue=function(){return e.stringControl.val()},this.createOperandStringControl(e)},o.prototype.createOperandTypeControl=function(e){var o=this,r=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-operandtype brtc-va-editors-sheet-controls-wrapper"/>');r.css({height:"29px","margin-left":"4px"}),e.append(r);var n=$('<button type="button" name="column" class="brtc-va-editors-sheet-panels-propertycontrol-button">Column</button>');r.append(n);var a=$('<button type="button" name="value" class="brtc-va-editors-sheet-panels-propertycontrol-button">Value</button>');r.append(a.css("border-left","none")),n.jqxButton({theme:t.VA.Env.Theme,width:"50%",height:"100%"}),a.jqxButton({theme:t.VA.Env.Theme,width:"50%",height:"100%"}),n.click(function(){o.operandTypeEvent(e,"column")}),a.click(function(){o.operandTypeEvent(e,"string")}),e.operandType=r},o.prototype.createOperandColumnControl=function(t){var e=this,o=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-columncontrol brtc-va-editors-sheet-controls-width-10"/>');o.css({width:"192px","margin-left":"2px"});var r=$('<span class="brtc-va-editors-sheet-controls-propertycontrol-columncontrol-remove"> <i class="fa fa-minus-circle"></i></span>');t.append(o).append(r),r.click(function(o){var r=t.columnControl.getSelectedItems();e.operandTypeEvent(t,"type"),t.columnControl.removeColumnUnit(r[0])});var n=this.createColumnList(o,{widgetOption:{rowCount:1,multiple:!1,showOpener:"click",removable:!0,sort:"ascending",height:27}});t.append(n),n.setItems(this.columnObjectData),t.columnControl=n,t.columnControlRemove=r},o.prototype.createOperandStringControl=function(t){var e=this,o=$('<input type="text" class="brtc-va-editors-sheet-controls-propertycontrol-stringinputcontrol brtc-va-editors-sheet-controls-width-10"/>');o.css({height:"23px","margin-left":"4px","padding-left":"5px","padding-right":"5px"});var r=$('<span class="brtc-va-editors-sheet-controls-propertycontrol-stringinputcontrol-remove"> <i class="fa fa-minus-circle"></i></span>');t.append(o).append(r),r.click(function(o){var r=t.stringControl.val();e.operandTypeEvent(t,"type"),""!=r&&t.stringControl.val("")}),this.createInput(o,{widgetOption:{}}),t.stringControl=o,t.stringControlRemove=r},o.prototype.operandTypeEvent=function(t,e){"column"==e?(t.operandType.css({display:"none"}),t.columnControl.$parent.css({display:"block"}),t.stringControl.css({display:"none"}),t.columnControlRemove.css({display:"block"}),t.stringControlRemove.css({display:"none"})):"string"==e?(t.operandType.css({display:"none"}),t.columnControl.$parent.css({display:"none"}),t.stringControl.css({display:"block"}),t.columnControlRemove.css({display:"none"}),t.stringControlRemove.css({display:"block"})):(t.operandType.css({display:"block"}),t.columnControl.$parent.css({display:"none"}),t.stringControl.css({display:"none"}),t.columnControlRemove.css({display:"none"}),t.stringControlRemove.css({display:"none"}))},o.prototype.createAddButton=function(){var t=$('<input type="button" class="brtc-va-editors-sheet-controls-propertycontrol-addbutton" value="+ Add Condition"/>');this.$deckTarget.append(t);var e=this.popupProperty.createButton(t,{width:"100%",height:25}),o=this;e.click(function(){o.createDeckControl()})},o.prototype.bindConditionControl=function(){var t=this;this.control.conditions={},this.control.conditions.setValue=function(e){var o=e.main_operator,r=e.input_cols,n=e.operators,a=e.operands;if(t.control.main_operator.setValue(o),n.length>0)for(var i=0;i<n.length;i++){t.createDeckControl();var s="number";for(var l in t.columnObjectData)if(t.columnObjectData[l].name===r[i]){s=t.columnObjectData[l].type;break}t.control.operators[i].jqxDropDownList({disabled:!1,source:t.operandSource[s],selectedIndex:0}),t.control.input_cols[i].setValue([r[i]]),t.control.operators[i].setValue(n[i]),null!=a[i]&&a[i].length,t.control.operands[i].stringControl.val(a[i])}else t.createDeckControl()},this.control.conditions.getValue=function(){return{main_operator:t.control.main_operator.getValue(),input_cols:t.control.input_cols.map(function(t){return t.getValue()[0]}),operators:t.control.operators.map(function(t){return t.getValue()}),operands:t.control.operands.map(function(t){return t.getValue()})}}},o.prototype.getControlValue=function(){return $.extend(!0,{},this.control.conditions.getValue())},o.prototype.handleOkClicked=function(){this.dialogResult.param=this.getControlValue(),t.VA.Dialogs.Dialog.prototype.handleOkClicked.call(this)},o.prototype.fillControlValues=function(){this.columnObjectData=this.popupProperty.getColumnsOfInTable(0,["number","string"]),this.columnData=this.popupProperty.getColumnsOfInTable(0,["number","string"]).map(function(t){return t.name})},o.prototype.renderCondition=function(){if(this.control)var t=this.options.fnUnit.param;this.control.conditions.setValue(t)},o.prototype.renderValidation=function(){},t.VA.Core.Dialogs.FunctionProperties.SimpleFilterDialog=o}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.flow={category:"control",defaultFnUnit:{func:"flow",name:"Flow",inData:[],outData:[],param:{mid:"",versionId:"",variables:{}},display:{label:"Flow",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"This function calls the Data Model",tags:["sub"],mandatory:["mid"],"in-range":{min:1,max:10},"out-range":{min:0,max:10}}}.call(this),function(){"use strict";var t=this.Brightics,e=brtc_require("Dao"),o={label:"Current",value:""};function r(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}r.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),r.prototype.constructor=r,r.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},r.prototype.createIntableControl=function(){var t=this;if(void 0!==this.options.fnUnit[IN_DATA]){var e=this.getFunctionDef()["in-range"].min||1;this.$intableControl=$('<div class="brtc-va-editors-sheet-controls-property-in-table-control-columnlist"/>'),this.addPropertyInTableControl("In Table",function(o){o.append(t.$intableControl);var r={fnUnit:t.options.fnUnit,editor:t.options.modelEditor,minRow:e};e>1&&(r.rowHeaderType="number"),this._intableControlOption&&$.extend(!0,r,this._intableControlOption),t._intableControl=t.createInTableList(t.$intableControl,r)})}},r.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={},this.render.mid=this.renderModelIdControl,this.render.versionId=this.renderVersionIDControl,this.render.variables=this.renderVariablesControl,this.$elements={},this.controls={},this.projectId=this.options.modelEditor.getEditorInput().getProjectId(),this.createModelIdControl(),this.createVersionIDControl(),this.createInputTableControl(),this.createReturnTableControl(),this.createVariablesControl()},r.prototype.createModelIdControl=function(r){var n=this;n.$elements.mid=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),n.$elements.sync=$(crel("button",{class:"brtc-va-editors-sheet-controls-propertycontrol-button"},"Refresh")).click(function(){n.executeCommand(n.createModelSyncCommand(n.$elements.mid.val())),n.renderTableSync(),n.renderInputTableControl(),n.renderReturnTableControl(),n.renderVariablesControl()}),n.addPropertyControl("Model",function(r){n.$cont=$(crel("div",{class:"brtc-style-display-flex brtc-style-flex-wrap"})),r.append(n.$cont),n.$cont.append(n.$elements.mid),n.$cont.append(n.$elements.sync),n.fileList=[];var a=Studio.getResourceManager().getFiles(n.projectId);$.each(a,function(t,e){"data"==e.data.type&&e.data.id!=n.options.modelEditor.options.editorInput.getFileId()&&n.fileList.push({label:_.escape(e.data.label),value:e.data.id})});var i={source:n.fileList,dropDownHeight:150,displayMember:"label",valueMember:"id",width:167};n.controls.mid=n.createDropDownList(n.$elements.mid,i),n.controls.sync=n.createButton(n.$elements.sync,{width:80,height:27}),n.controls.mid.on("change",function(r){if(n.isInputValueChanged("mid",r.args.item.value)){var a=r.args.item.value;n.cached=!1;var i={};i.mid=a,i.versionId="";var s=new t.VA.Core.CompoundCommand(n,{label:"Change FnUnit Properties"}),l=n.createSetFnUnitCommand({param:i});n.$elements.versionId.val(""),s.add(l),s.add(n.createModelSyncCommand(a)),n.executeCommand(s),n.renderInputTableControl(),n.renderReturnTableControl(),n.renderVariablesControl(n.getParam("variables")),n.fileVersionList=[o],e.VersionDao.getVersionsForced(n.projectId,a,function(t){t.sort(function(t,e){return t.compareToByVersion(e)}),$.each(t,function(t,e){n.fileVersionList.push({label:e.getVersion(),value:e.getVersionId()})})}),n.controls.versionId.jqxDropDownList({source:n.fileVersionList,dropDownHeight:n.calcDropdownHeight(n.fileVersionList.length,25)})}})},{mandatory:!0})},r.prototype.createVersionIDControl=function(r){var n=this;n.$elements.versionId=$('<div class="brtc-va-editors-sheet-controls-propertycontrol-combobox"/>'),n.addPropertyControl("Version",function(r){r.append(n.$elements.versionId),n.fileVersionList=[o];var a=n.options.fnUnit.param.mid;n.projectId&&a&&e.VersionDao.getVersionsForced(n.projectId,a,function(t){n.fileVersionList=[o],t.sort(function(t,e){return t.compareToByVersion(e)}),$.each(t,function(t,e){n.fileVersionList.push({label:e.getVersion(),value:e.getVersionId()})})});var i={source:n.fileVersionList,displayMember:"label",valueMember:"value",autoDropDownHeight:!1,height:"25px",dropDownHeight:n.calcDropdownHeight(n.fileVersionList.length,25)};n.controls.versionId=n.createDropDownList(n.$elements.versionId,i),n.controls.versionId.on("change",function(e){var o=n.options.fnUnit.param.mid,r=e.args.item.value;if(n.getFnUnit().param.versionId!==e.args.item.value){n.cached=!1;var a=[],i={},s=n.getRenderedModel(o,r);s&&(a=s.getContents()[OUT_DATA],i=s.getContents().variables);var l={fnUnit:n.options.fnUnit,ref:{param:{}}},c={fnUnit:n.options.fnUnit,ref:{outData:[]}},p=n._calcVariables(n.getParam("variables"),i);l.ref.param.versionId=r,l.ref.param.variables=p,c.ref[OUT_DATA]=n.generateNewOutDataList(a),n.renderVariablesControl(p),n.renderInputTableControl(),n.renderReturnTableControl();var u=new t.VA.Core.CompoundCommand(n,{label:"Change FnUnit Properties"}),d=new t.VA.Core.Editors.Diagram.Commands.NewOutTableCommand(n,c),h=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(n,l);u.add(h),u.add(d),n.executeCommand(u)}})},{mandatory:!1})},r.prototype.generateNewOutDataList=function(e){if(!e)return[];for(var o=_.clone(this.FnUnitUtils.getOutTable(this.options.fnUnit));o.length<e.length;)o.push(t.VA.Core.Utils.IDGenerator.table.id());for(;o.length>e.length;)o.pop();return o},r.prototype.getVersionInputData=function(){return this.version.getContents()[IN_DATA]||[]},r.prototype.getInputData=function(){var t;return(t=this.getRenderedModel())&&t.getContents()[IN_DATA]||[]},r.prototype.getVersionReturnData=function(){return this.version.getContents()[OUT_DATA]||[]},r.prototype.getReturnData=function(){var t;return(t=this.getRenderedModel())&&t.getContents()[OUT_DATA]||[]},r.prototype.getFnUnitByTableId=function(e){var o=this,r=this.getRenderedModel().getContents(),n=function(a){for(var i=a.functions,s=0;s<i.length;s++){var l=i[s];if(_.indexOf(o.FnUnitUtils.getOutTable(l),e)>-1)return l;for(var c=t.VA.Core.Utils.NestedFlowUtils.getSubModels(r,l),p=0;p<c.length;p++){var u=c[p],d=n(u);if(d)return d}}};return n(r)},r.prototype.createSelectedTableElements=function(t,e){var o=this,r=[];return _.forEach(e,function(e){var n=o.getFnUnitByTableId(e);n&&r.push(o.createSelectedItem(t,n,e))}),r},r.prototype.createSelectedItem=function(t,e,o){var r=this.createItem(e,o);return this.wrapSelectedItem(t,r)},r.prototype.createItem=function(e,o){var r=$(crel("div",{class:"brtc-va-editors-sheet-controls-dataselector-item"})),n=t.VA.Core.Utils.WidgetUtils.createPaletteItem(r,e.func,"data");n.find(".brtc-va-views-palette-fnunit-label").text(this.getTableItemLabel(e,o)),n.css("cursor","auto"),r.attr("tid",o),r.attr("fid",e.fid);var a=this.FnUnitUtils.getOutTable(e).indexOf(o);return r.attr("index",a),n.addClass("item"),r},r.prototype.getTableItemLabel=function(t,e){var o=this.FnUnitUtils.getOutTable(t).length,r=this.FnUnitUtils.getOutTable(t).indexOf(e),n=t.display.label,a=t.display.label+"-"+(r+1);return o>1?a:n},r.prototype.wrapSelectedItem=function(t,e){var o=$(crel("div",{class:"brtc-style-flex-center",style:"padding-left: 10px"}));e.attr("tid"),e.attr("fid");o.append(e),t.append(o)},r.prototype.createInputTableControl=function(t){this.$inputTableContainer=$('<div class="brtc-va-editors-sheet-panels-properties-flowproperties-input-table-container"></div>'),this.addPropertyControl("Input Table (Read Only)",function(t){t.append(this.$inputTableContainer)})},r.prototype.createReturnTableControl=function(t){this.$returnTableContainer=$('<div class="brtc-va-editors-sheet-panels-properties-flowproperties-return-table-container"></div>'),this.addPropertyControl("Return Table (Read Only)",function(t){t.append(this.$returnTableContainer)})},r.prototype.createVariablesControl=function(e){var o=this;this.$container=$('<div class="brtc-va-editors-sheet-panels-properties-flowproperties-variable-container"></div>'),this.addPropertyControl("Variables",function(e){e.append(this.$container),this.variableControl=new t.VA.Core.Views.SetVariable(this.$container,{width:"100%",height:"calc(100% - 30px)",editor:this.options.modelEditor,isFixedVariable:!0,isNormalType:!0,onChange:function(t,e){o.createOnChangeCommand(t,e)}})})},r.prototype.renderModelIdControl=function(t){var e=this.options.fnUnit.param.mid;e?this.$elements.mid.val(e):this.$elements.mid.jqxDropDownList("clearSelection"),this.renderTableSync()},r.prototype.renderVersionIDControl=function(t){var e=this.options.fnUnit.param.versionId,r=this.options.fnUnit.param.mid,n=!!Studio.getResourceManager().getFile(this.projectId,r);r&&e?n?(this.$elements.versionId.val(this.getRenderedModel().getVersionId()),this.renderInputTableControl(),this.renderReturnTableControl(),this.renderVariablesControl()):(this.$elements.versionId.jqxDropDownList({source:[o]}),this.$elements.versionId.val(""),this.renderInputTableControl(),this.renderReturnTableControl(),this.renderVariablesControl()):(this.$elements.versionId.val(""),this.renderInputTableControl(),this.renderReturnTableControl(),this.renderVariablesControl()),this.renderTableSync()},r.prototype.renderVariablesControl=function(t){var e=t||this.options.fnUnit.param.variables,o=[];for(var r in e)o.push({name:r,type:e[r].type,value:e[r].value});this.variableControl.renderValues(o)},r.prototype.renderInputTableControl=function(){this.$inputTableContainer.empty(),this.createSelectedTableElements(this.$inputTableContainer,this.getInputData())},r.prototype.renderReturnTableControl=function(){this.$returnTableContainer.empty(),this.createSelectedTableElements(this.$returnTableContainer,this.getReturnData())},r.prototype.renderValidation=function(){for(var t in this.problems)"mid"===this.problems[t].param&&this.createValidationContent(this.$cont,this.problems[t]),"versionId"===this.problems[t].param&&this.createValidationContent(this.$elements.versionId,this.problems[t])},r.prototype.createOnRemoveCommand=function(e){var o=e.name,r=this.options.fnUnit.param.variables,n=[];for(var a in r)r[a].name!==o&&n.push(r[a]);var i={fnUnit:this.options.fnUnit,ref:{param:{variables:n}}},s=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,i);this.executeCommand(s)},r.prototype.createOnChangeCommand=function(e,o){var r=e.name,n=this.options.fnUnit.param.variables,a={};for(var i in n)i!==r?a[i]=n[i]:(a[i]={},a[i].type=o.type,a[i].value=o.param.value);var s={fnUnit:this.options.fnUnit,ref:{param:{variables:a}}},l=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,s);this.executeCommand(l)},r.prototype.calcDropdownHeight=function(t,e){return Math.min(e*t,150)+"px"},r.prototype.refreshModels=function(){var t=this,e=_.chain(Studio.getResourceManager().getFiles(this.projectId)).filter(function(e){return"data"===e.getType()&&e.getFileId()!==t.getEditor().getEditorInput().getFileId()}).map(function(t){return{label:_.escape(t.getLabel()),value:t.getFileId()}}).value();this.$elements.mid.jqxDropDownList({source:e,dropDownHeight:this.calcDropdownHeight(e.length,25)})},r.prototype.refreshVersions=function(){var t=this,r=this.projectId,n=this.getFnUnit().param.mid;!!Studio.getResourceManager().getFile(r,n)?e.VersionDao.getVersionsForced(r,n,function(e){var r=[o].concat(_.map(e,function(t){return{label:t.getVersion(),value:t.getVersionId()}}));t.$elements.versionId.jqxDropDownList({source:r,dropDownHeight:t.calcDropdownHeight(r.length,25)})}):(this.$elements.versionId.jqxDropDownList({source:[o],dropDownHeight:this.calcDropdownHeight(0,25)}),this.$elements.versionId.val(""))},r.prototype.renderTableSync=function(){var t,e,o=this.getFnUnit().param.mid,r=this.getFnUnit().param.versionId,n=Studio.getResourceManager().getFile(this.projectId,o),a=n?n.getContents():void 0,i=o&&!r&&a&&(t=a.variables,e=this.getParam("variables"),!(0===_.xor(_.keys(t),_.keys(e)).length)||a[OUT_DATA].length!==this.FnUnitUtils.getOutTable(this.getFnUnit()).length);this.$elements.sync.jqxButton({disabled:!i})},r.prototype.refresh=function(){this.refreshModels(),this.refreshVersions(),this.renderTableSync(),this.renderInputTableControl(),this.renderReturnTableControl(),this.renderVariablesControl(this.getParam("variables")),this.getFnUnit().hasOwnProperty("parent")&&Studio.getInstance().doValidate(this.getModel())},r.prototype.createOutTableSyncCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{outData:[]}},r=Studio.getResourceManager().getFile(this.projectId,e);return o.ref[OUT_DATA]=this.generateNewOutDataList(r.getContents()[OUT_DATA]),new t.VA.Core.Editors.Diagram.Commands.NewOutTableCommand(this,o)},r.prototype.createInTableSyncCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{inData:[]}},r=Studio.getResourceManager().getFile(this.projectId,e).getContents();return o.ref[IN_DATA]=_.take(this.options.fnUnit[IN_DATA],parseInt(Math.min(r[IN_DATA].length,this.options.fnUnit[IN_DATA].length))),new t.VA.Core.Editors.Diagram.Commands.ChangeIntableCommand(this,o)},r.prototype._calcVariables=function(t,e){return Object.keys(e).reduce(function(o,r){return o[r]=_.cloneDeep(_.has(t,r)?t[r]:e[r]),o},{})},r.prototype.createVariablesSyncCommand=function(e){var o={fnUnit:this.options.fnUnit,ref:{param:[]}},r=Studio.getResourceManager().getFile(this.projectId,e).getContents(),n=this.getParam("variables"),a=r.variables,i=this._calcVariables(n,a);return o.ref.param.variables=i,new t.VA.Core.Editors.Diagram.Commands.SetFnUnitCommand(this,o)},r.prototype.createModelSyncCommand=function(e){var o=new t.VA.Core.CompoundCommand(this,{label:"Refresh Flow"});return o.add(this.createOutTableSyncCommand(e)),o.add(this.createVariablesSyncCommand(e)),o},r.prototype.getRenderedModel=function(t,o){if(this.cached)return this.cached;var r=this,n=this.projectId,a=_.isUndefined(t)?this.getParam("mid"):t,i=_.isUndefined(o)?this.getParam("versionId"):o;return a&&i?e.VersionDao.getVersionForced(n,a,i,function(t){r.cached=t}):a&&(r.cached=Studio.getResourceManager().getFile(n,a)),this.cached},t.VA.Core.Functions.Library.flow.propertiesPanel=r}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addModelRule(),this.addModelIdRule(),this.addVersionIdRule(),this.addSyncTableRule()},e.prototype.addLinkRule=function(){},e.prototype.addInTableRule=function(){},e.prototype.addModelRule=function(){var t=function(t){if(!t)return!0;var e=Studio.getResourceManager().getFile(void 0,t);return!_.isUndefined(e)};this.addRule(function(e){if(t(e.param.mid))return[];return this.problemFactory.createProblem({errorCode:"EI001",param:"mid"},e)}),this.addRule(function(e){if(t(e.param.mid))return[];return this.problemFactory.createProblem({errorCode:"EI001",param:"versionId"},e)})},e.prototype.addModelIdRule=function(t){var e=this;this.addRule(function(t){return e._checkStringIsEmpty({errorCode:"BR-0033",param:"mid",messageParam:["Model"]},t,t.param.mid)})},e.prototype.addVersionIdRule=function(t){},e.prototype.addSyncTableRule=function(t){this.addRule(function(t){var e,o,r=t.param.mid,n=t.param.versionId,a=Studio.getResourceManager().getFile(this.projectId,r),i=a?a.getContents():void 0;if(r&&!n&&i&&(e=i.variables,o=t.param.variables,!(0===_.xor(_.keys(e),_.keys(o)).length)||i[OUT_DATA].length!==_this.FnUnitUtils.getOutTable(t).length)){return this.problemFactory.createProblem({errorCode:"EI002",param:"mid"},t)}})},t.VA.Core.Functions.Library.flow.validator=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.forLoop={category:"control",defaultFnUnit:{func:"forLoop",name:"ForLoop",inData:[],outData:[],param:{mid:"",type:"count",prop:{start:"",end:"","index-variable":""}},display:{label:"For Loop",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"This functions that perform iterations while satisfying the condition",tags:["loop","for","condition"],"in-range":{min:1,max:10},"out-range":{min:0,max:10}}}.call(this),function(){"use strict";var t=this.Brightics,e=this.__module__.ObjectUtils.get;function o(e,o){this.tempIdArray=[],t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.call(this,e,o)}o.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype),o.prototype.constructor=o,o.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},o.prototype.handleSetFnUnitCommand=function(t){this.options.fnUnit.fid!=t.options.fnUnit.fid||"UNDO"!==t.event.type&&"REDO"!==t.event.type||(this.renderPersistButton(),this.renderValues(t))},o.prototype.handleChangeOutTableCommand=function(t){},o.prototype.handleSetFnUnitParameterValueCommand=function(t){this.options.fnUnit.fid!=t.options.fnUnit.fid||"UNDO"!==t.event.type&&"REDO"!==t.event.type||this.renderValues(t)},o.prototype.handleGlobalVariableCommand=function(t){},o.prototype.createIntableControl=function(){var t=this;if(void 0!==this.options.fnUnit[IN_DATA]){var e=this.getFunctionDef()["in-range"].min||1;this.$intableControl=$('<div class="brtc-va-editors-sheet-controls-property-in-table-control-columnlist"/>'),this.addPropertyInTableControl("In Table",function(o){o.append(t.$intableControl);var r={fnUnit:t.options.fnUnit,editor:t.options.modelEditor,minRow:e};e>1&&(r.rowHeaderType="number"),this._intableControlOption&&$.extend(!0,r,this._intableControlOption),t._intableControl=t.createInTableList(t.$intableControl,r)})}},o.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.validationArea={count:{},collection:{}},this.template=[{label:"Count",paramValue:"count",controls:[{label:"Start",paramKey:"start",type:"expression",mandatory:!0},{label:"End",paramKey:"end",type:"expression",mandatory:!0},{label:"Index Variable",paramKey:"index-variable",type:"variable"}]},{label:"Collection",paramValue:"collection",controls:[{label:"Collection",paramKey:"collection",type:"expression",mandatory:!0},{label:"Element Variable",paramKey:"element-variable",type:"variable"},{label:"Index Variable",paramKey:"index-variable",type:"variable"}]}],this.prvVal={},this.createLoopControls(),this.renderLoopControls(this.options.fnUnit.param.type)},o.prototype.renderValidation=function(){var t=this;_.forEach(this.problems,function(e){if(e.param.indexOf("/")>-1){var o=e.param.split("/"),r=t.getValidationArea(o[0],o[1]);t.createValidationContent(r,e)}})},o.prototype.renderOperationValues=function(t){this.renderLoopControls(this.options.fnUnit.param.type)},o.prototype.renderRadioButton=function(){var t=this.options.fnUnit.param.type;if(void 0!==t){for(var e=0;e<this.template.length;e++)if(t===this.template[e].paramValue){this.template[e].$radio.jqxRadioButton("check");break}}else this.template[0].$radio.jqxRadioButton("check")},o.prototype.createLoopControls=function(){var e=this.template,o=this,r=this.options.fnUnit;this.addPropertyControl("Loop Type",function(n){_.forEach(e,function(e){e.$radio=o.createRadioButton($('<div class="brtc-va-editors-sheet-controls-propertycontrol-radiobutton-looptype">'+e.label+"</div>"),{groupName:"loop-type",checked:e.paramValue===o.options.fnUnit.param.type}),n.append(e.$radio),e.$radio.on("checked",function(e){return function(){if(r.param.type!==e.paramValue){var n=new t.VA.Core.CompoundCommand(o,{label:"Change FnUnit Properties"});n.add(new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(o,{fnUnit:r,path:["param","type"],value:e.paramValue}));var a={};_.forEach(e.controls,function(t){a[t.paramKey]=""}),n.add(new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(o,{fnUnit:r,path:["param","prop"],value:a})),o.executeCommand(n),o.renderLoopControls(e.paramValue)}}}(e))})},{mandatory:!0}),_.forEach(e,function(t){_.forEach(t.controls,function(e){e.$el=o.addPropertyControl(e.label,function(r){var n=$(crel("textarea"));r.append(n),e.$input=o.getInputByType(e.type,n,e.paramKey),o.validationArea[t.paramValue][e.paramKey]=r},{mandatory:e.mandatory}),e.$el.hide()})})},o.prototype.getInputByType=function(o,r,n){var a=this,i=["param","prop",n],s=function(o){var r=o||"";if((e(a.options.fnUnit,i)||"")!==r){var n={fnUnit:a.options.fnUnit,label:"Change FnUnit Properties",path:i,value:r},s=new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(a,n);a.executeCommand(s)}};return"expression"===o?a.createCodeMirror(r,{placeholder:"Expression",width:"100%"},!0,s):"variable"===o?a.createCodeMirror(r,{placeholder:"Enter Variable",width:"100%"},!1,s):void 0},o.prototype.renderLoopControls=function(t){var e=this;this.prvVal={};var o=_.findIndex(this.template,function(e){return e.paramValue===t});if(-1===o)return!1;_.forEach(this.template,function(t){_.forEach(t.controls,function(t){return t.$el.hide()})});var r=this.template[o].controls;_.forEach(r,function(t){t.$el.show(),t.$input.setValue(e.options.fnUnit.param.prop[t.paramKey])}),this.template[o].$radio.jqxRadioButton("check")},o.prototype.bindRemoveButtonClickListener=function(e,o,r){var n=this;e.click(function(e){var a={fnUnit:n.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o()},i=new t.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(n,a);n.executeCommand(i),r&&r()})},o.prototype.bindAddButtonClickListener=function(e,o,r,n){var a=this;e.click(function(e){var i={fnUnit:a.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o(),value:r},s=new t.VA.Core.Editors.Diagram.Commands.AddOperationCommand(a,i);a.executeCommand(s),n&&n()})},o.prototype.createCodeMirror=function(e,o,r,n){var a,i,s=_.merge({},{mode:"brtc-control",scrollbarStyle:"null",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0},o),l=CodeMirror.fromTextArea(e[0],s),c=this,p=(a=r,i=l,{setValue:function(t){var e=function(t,e){var o=_.isUndefined(t)?"":t;return e&&c.test(o)?o.substring(3,o.length-1):o}(t,a);i.setValue(e)},getValue:function(){var t=i.getValue();return a?"${="+t+"}":t},refresh:function(){i.refresh()}});return t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(l),l.on("blur",function(t,e){t.state.focused&&n(p.getValue())}),p},o.prototype.test=function(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")},o.prototype.getValidationArea=function(t,e){return this.validationArea[t][e]},t.VA.Core.Functions.Library.forLoop.propertiesPanel=o}.call(this),function(t){"use strict";var e=t.Brightics,o={count:[{prop:"start",type:"expression",msg:"Start"},{prop:"end",type:"expression",msg:"End"}],collection:[{prop:"collection",type:"expression",msg:"Collection"}]};function r(){e.VA.Core.Validator.SingleInputValidator.call(this)}r.prototype=Object.create(e.VA.Core.Validator.SingleInputValidator.prototype),r.prototype.constructor=r,r.prototype.initRules=function(){e.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addForLoopRule()},r.prototype.addLinkRule=function(){},r.prototype.addInTableRule=function(){},r.prototype.addForLoopRule=function(){var t=this;this.addRule(function(e){var r=e.param,n=o[r.type];return _.chain(n).map(function(o){if(t.isEmpty(r,o))return t.problemFactory.createProblem(function(t,e){return{errorCode:"BR-0033",param:t.join("/"),messageParam:[e]}}([r.type,o.prop],o.msg),e)}).compact().value()})},r.prototype.isEmpty=function(t,e){var o=t.prop[e.prop];return"expression"===e.type?this.isEmptyExpression(o):this.isEmptyVariable(o)},r.prototype.isEmptyVariable=function(t){return!_.trim(t)},r.prototype.isEmptyExpression=function(t){var e=t.substring(3,t.length-1);return!_.trim(e)},e.VA.Core.Functions.Library.forLoop.validator=r}(this,Brightics),function(){"use strict";this.Brightics.VA.Core.Functions.Library.if={category:"control",defaultFnUnit:{func:"if",name:"If",inData:[],outData:[],param:{if:{expression:"${=true}",mid:""},elseif:[],else:{mid:""}},display:{label:"Condition",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"This function that executes a branch based on a condition",tags:["if","else if","else","condition"],"in-range":{min:1,max:10},"out-range":{min:0,max:10}}}.call(this),function(){"use strict";var t=this.Brightics,e=this.__module__.ObjectUtils.get;function o(e,o){this.tempIdArray=[],t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.call(this,e,o)}o.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype),o.prototype.constructor=o,o.prototype.handleSetFnUnitCommand=function(t){this.options.fnUnit.fid!=t.options.fnUnit.fid||"UNDO"!==t.event.type&&"REDO"!==t.event.type||(this.renderPersistButton(),this.renderValues(t))},o.prototype.handleChangeOutTableCommand=function(t){},o.prototype.handleSetFnUnitParameterValueCommand=function(t){this.options.fnUnit.fid!=t.options.fnUnit.fid||"UNDO"!==t.event.type&&"REDO"!==t.event.type||this.renderValues(t)},o.prototype.handleGlobalVariableCommand=function(t){},o.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},o.prototype.createIntableControl=function(){var t=this;if(void 0!==this.options.fnUnit[IN_DATA]){var e=this.getFunctionDef()["in-range"].min||1;this.$intableControl=$('<div class="brtc-va-editors-sheet-controls-property-in-table-control-columnlist"/>'),this.addPropertyInTableControl("In Table",function(o){o.append(t.$intableControl);var r={fnUnit:t.options.fnUnit,editor:t.options.modelEditor,minRow:e};e>1&&(r.rowHeaderType="number"),this._intableControlOption&&$.extend(!0,r,this._intableControlOption),t._intableControl=t.createInTableList(t.$intableControl,r)})}},o.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.createIfControl(),this.createElseIfArea(),this.createElseIfAddButton(),this.renderIfValue(),this.renderElseIfValue()},o.prototype.renderOperationValues=function(t){this.renderIfValue(),this.renderElseIfValue()},o.prototype.fillControlValues=function(){},o.prototype.renderValidation=function(){var t=this,e=$(".brtc-va-editors-sheet-controls-else-if-wrapper");_.forEach(this.problems,function(o){if("if"===o.param)t.createValidationContent(t.$ifControlWrapper,o);else if(o.param.indexOf("_")>-1){var r=o.param.split("_")[1],n=$(e[r]);t.createValidationContent(n,o)}})},o.prototype.createIfControl=function(){var t=this;this.addPropertyControl("If",function(e){t.$ifControl=$(crel("textarea")),e.append(t.$ifControl),t.$input=t.getInputByType("expression",t.$ifControl,"expression","if"),t.$ifControlWrapper=e},{mandatory:!0})},o.prototype.createElseIfArea=function(){this.$elseIfInputArea=$(crel("div")),this.$contentsArea.append(this.$elseIfInputArea)},o.prototype.createElseIfAddButton=function(){var t=this;t.$elseIfAddButton=t.createBarButton($(crel("input",{class:"brtc-va-editors-sheet-controls-propertycontrol-columnlist",type:"button",value:"+ Add Else If"}))),t.$elseIfAddButton.css({"margin-top":"5px"}),t.$contentsArea.append(t.$elseIfAddButton),t.$elseIfAddButton.click(function(e){var o=t.newElseIf();t.createElseIfControl(o.path,o.mid)})},o.prototype.createElseIfControl=function(t,o){var r=this,n=function(t){var o=e(r.options.fnUnit,["param","elseif"]);return _.findIndex(o,function(e){return e.mid===t})};this.addPropertyControl("Else If",function(a){a.addClass("brtc-va-editors-sheet-controls-propertycontrol-deck"),a.addClass("brtc-va-editors-sheet-controls-else-if-wrapper");var i=r.createElseIfRow(t,o);a.append(i),r.$elseIfInput.setValue(e(r.options.fnUnit,["param","elseif"].concat([n(o),"expression"]))),r.createElseIfRemoveButton(a,o)},{propertyControlParent:r.$elseIfInputArea,mandatory:!0})},o.prototype.createElseIfRemoveButton=function(t,e){var o=this,r=t.siblings(".brtc-va-editors-sheet-controls-propertycontrol-label"),n=$('<div class="brtc-va-if-property remove-else-if-button brtc-va-editors-sheet-controls-propertycontrol-deck-remove"></div>');r.append(n),n.click(function(t){o.deleteElseIf(e),$(this).parents(".brtc-va-editors-sheet-controls-propertycontrol").remove(),t.stopPropagation()})},o.prototype.createElseIfRow=function(t,o){var r=this,n=function(o){var n=e(r.options.fnUnit,t);return _.findIndex(n,function(t){return t.mid===o})};r.$elseIf=$(crel("div")),r.$elseIfControl=$(crel("textarea")),r.$elseIf.append(r.$elseIfControl),r.$elseIfInput=r.getInputByType("expression",r.$elseIfControl,"expression","elseif",t.concat([n(o),"expression"]));var a=$(crel("div",r.$elseIf[0]));return a.css({height:"25px","margin-bottom":"10px"}),a},o.prototype.newElseIf=function(){var e=this.options.fnUnit,o=t.VA.Core.Utils.IDGenerator.model.id(),r={expression:"${=true}",mid:o},n=["param","elseif"],a={fnUnit:e,path:n.concat(e.param.elseif.length),value:r},i=new t.VA.Core.Editors.Diagram.Commands.AddOperationCommand(this,a),s=new t.VA.Core.Editors.Diagram.Commands.NewActivityCommand(this,{fnUnit:e,mid:o,type:"if",conditionType:"elseif"}),l=e.parent().getMainModel(),c=e[IN_DATA],p=new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(this,{target:l.getInnerModels(),path:[o,IN_DATA],value:c}),u=new t.VA.Core.CompoundCommand(this,{label:"Add Condition"});return u.add(i),u.add(s),u.add(p),this.executeCommand(u),{path:n,mid:o}},o.prototype.deleteElseIf=function(e){var o=this.options.fnUnit,r=new t.VA.Core.CompoundCommand(this,{label:"Remove Condition"}),n=new t.VA.Core.Editors.Diagram.Commands.RemoveActivityCommand(this,{mid:e}),a=_.findIndex(o.param.elseif,function(t){return t.mid==e});if(-1==a)return!1;var i=["param","elseif",a],s=new t.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(this,{fnUnit:o,path:i});return r.add(n),r.add(s),this.executeCommand(r),!0},o.prototype.renderIfValue=function(){var t=this.options.fnUnit;this.$input.setValue(t.param.if.expression)},o.prototype.renderElseIfValue=function(){this.$elseIfInputArea.empty();var t,e=this.options.fnUnit.param.elseif;for(t=0;t<e.length;t++)this.createElseIfControl(["param","elseif"],e[t].mid)},o.prototype.bindRemoveButtonClickListener=function(e,o,r){var n=this;e.click(function(e){var a={fnUnit:n.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o()},i=new t.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(n,a);n.executeCommand(i),r&&r()})},o.prototype.bindAddButtonClickListener=function(e,o,r,n){var a=this;e.click(function(e){var i={fnUnit:a.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o(),value:r},s=new t.VA.Core.Editors.Diagram.Commands.AddOperationCommand(a,i);a.executeCommand(s),n&&n()})},o.prototype.getInputByType=function(o,r,n,a,i){var s=this,l=["param",a,n];i&&(l=i);var c=function(o){var r=o||"";if((e(s.options.fnUnit,l)||"")!==r){var n={fnUnit:s.options.fnUnit,label:"Change FnUnit Properties",path:l,value:r},a=new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(s,n);s.executeCommand(a)}};return"expression"===o?s.createCodeMirror(r,{placeholder:"Expression",width:"100%"},!0,c):"variable"===o?s.createCodeMirror(r,{placeholder:"Enter Variable",width:"100%"},!1,c):void 0},o.prototype.createCodeMirror=function(e,o,r,n){var a,i=_.merge({},{mode:"brtc-control",scrollbarStyle:"null",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0},o),s=CodeMirror.fromTextArea(e[0],i),l=(a=s,{setValue:function(t){var e=function(t){var e=_.isUndefined(t)?"${=}":t;return _.startsWith(e,"${=")&&_.endsWith(e,"}")||(e="${="+e+"}"),e.substring(3,e.length-1)}(t);a.setValue(e)},getValue:function(){return"${="+a.getValue()+"}"},refresh:function(){a.refresh()}});return t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(s),s.on("blur",function(){n(l.getValue())}),l},t.VA.Core.Functions.Library.if.propertiesPanel=o}.call(this),function(t){"use strict";var e=t.Brightics;function o(){e.VA.Core.Validator.SingleInputValidator.call(this)}o.prototype=Object.create(e.VA.Core.Validator.SingleInputValidator.prototype),o.prototype.constructor=o,o.prototype.initRules=function(){e.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addConditionRule()},o.prototype.addLinkRule=function(){},o.prototype.addInTableRule=function(){},o.prototype.addConditionRule=function(){var t=this,e=function(t,e){return{errorCode:"BR-0033",param:t.join("_"),messageParam:[e]}};this.addRule(function(o){var r=o.param;return[].concat(function(r){if(t.isEmptyExpression(r))return t.problemFactory.createProblem(e(["if"],"If"),o)}(r.if.expression)).concat(_.chain(r.elseif).map("expression").map(function(r,n){if(t.isEmptyExpression(r))return t.problemFactory.createProblem(e(["elseif",n],"Else If"),o)}).compact().value())})},o.prototype.isEmptyExpression=function(t){var e=t.substring(3,t.length-1);return!_.trim(e)},e.VA.Core.Functions.Library.if.validator=o}(this,Brightics),function(){"use strict";this.Brightics.VA.Core.Functions.Library.whileLoop={category:"control",defaultFnUnit:{func:"whileLoop",name:"WhileLoop",inData:[],outData:[],param:{mid:"",type:"while",prop:{expression:"","index-variable":""}},display:{label:"While Loop",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Functions that perform iterations while satisfying the condition",tags:["while","loop","condition"],"in-range":{min:1,max:10},"out-range":{min:0,max:10}}}.call(this),function(){"use strict";var t=this.Brightics,e=this.__module__.ObjectUtils.get;function o(e,o){this.tempIdArray=[],t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.call(this,e,o)}o.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype),o.prototype.constructor=o,o.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},o.prototype.createIntableControl=function(){var t=this;if(void 0!==this.options.fnUnit[IN_DATA]){var e=this.getFunctionDef()["in-range"].min||1;this.$intableControl=$('<div class="brtc-va-editors-sheet-controls-property-in-table-control-columnlist"/>'),this.addPropertyInTableControl("In Table",function(o){o.append(t.$intableControl);var r={fnUnit:t.options.fnUnit,editor:t.options.modelEditor,minRow:e};e>1&&(r.rowHeaderType="number"),this._intableControlOption&&$.extend(!0,r,this._intableControlOption),t._intableControl=t.createInTableList(t.$intableControl,r)})}},o.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.InnerPropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.validationArea={while:{}},this.template=[{label:"While",paramValue:"while",controls:[{label:"Expression",paramKey:"expression",type:"expression",mandatory:!0},{label:"Index Variable",paramKey:"index-variable",type:"variable",mandatory:!1}]}],this.prvVal={},this.createLoopControls(),this.renderLoopControls(this.options.fnUnit.param.type)},o.prototype.renderOperationValues=function(t){this.renderLoopControls(this.options.fnUnit.param.type)},o.prototype.createLoopControls=function(){var t=this.template,e=this;_.forEach(t,function(t){_.forEach(t.controls,function(o){o.$el=e.addPropertyControl(o.label,function(r){var n=$(crel("textarea"));r.append(n),o.$input=e.getInputByType(o.type,n,o.paramKey),e.validationArea[t.paramValue][o.paramKey]=r},{mandatory:o.mandatory}),o.$el.hide()})})},o.prototype.getInputByType=function(o,r,n){var a=this,i=["param","prop",n],s=function(o){var r=o||"";if((e(a.options.fnUnit,i)||"")!==r){var n={fnUnit:a.options.fnUnit,label:"Change FnUnit Properties",path:i,value:r},s=new t.VA.Core.Editors.Diagram.Commands.UpdateOperationCommand(a,n);a.executeCommand(s)}};return"expression"===o?a.createCodeMirror(r,{placeholder:"Expression",width:"100%"},!0,s):"variable"===o?a.createCodeMirror(r,{placeholder:"Enter Variable",width:"100%"},!1,s):void 0},o.prototype.renderLoopControls=function(t){var e=this;this.prvVal={};var o=_.findIndex(this.template,function(e){return e.paramValue===t});if(-1===o)return!1;_.forEach(this.template,function(t){_.forEach(t.controls,function(t){return t.$el.hide()})});var r=this.template[o].controls;_.forEach(r,function(t){t.$el.show(),t.$input.setValue(e.options.fnUnit.param.prop[t.paramKey])})},o.prototype.bindRemoveButtonClickListener=function(e,o,r){var n=this;e.click(function(e){var a={fnUnit:n.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o()},i=new t.VA.Core.Editors.Diagram.Commands.RemoveOperationCommand(n,a);n.executeCommand(i),r&&r()})},o.prototype.bindAddButtonClickListener=function(e,o,r,n){var a=this;e.click(function(e){var i={fnUnit:a.options.fnUnit,label:"Change FnUnit Properties",path:o instanceof Array?o:o(),value:r},s=new t.VA.Core.Editors.Diagram.Commands.AddOperationCommand(a,i);a.executeCommand(s),n&&n()})},o.prototype.fillControlValues=function(){},o.prototype.createCodeMirror=function(e,o,r,n){var a,i,s=_.merge({},{mode:"brtc-control",scrollbarStyle:"null",lineWrapping:!1,matchBrackets:!1,extraKeys:{"Ctrl-Space":"autocomplete",Tab:!1,"Shift-Tab":!1},showTrailingSpace:!0},o),l=CodeMirror.fromTextArea(e[0],s),c=this,p=(a=r,i=l,{setValue:function(t){var e=function(t,e){var o=_.isUndefined(t)?"":t;return e&&c.test(o)?o.substring(3,o.length-1):o}(t,a);i.setValue(e)},getValue:function(){var t=i.getValue();return a?"${="+t+"}":t},refresh:function(){i.refresh()}});return t.VA.Core.Utils.WidgetUtils.changeCodeMirrorLineToSingle(l),l.on("blur",function(t,e){t.state.focused&&n(p.getValue())}),p},o.prototype.test=function(t){return _.startsWith(t,"${=")&&_.endsWith(t,"}")},o.prototype.renderValidation=function(){var t=this;_.forEach(this.problems,function(e){if(e.param.indexOf("/")>-1){var o=e.param.split("/"),r=t.getValidationArea(o[0],o[1]);t.createValidationContent(r,e)}})},o.prototype.getValidationArea=function(t,e){return this.validationArea[t][e]},t.VA.Core.Functions.Library.whileLoop.propertiesPanel=o}.call(this),function(){"use strict";var t=this.Brightics,e={while:[{prop:"expression",type:"expression",msg:"Expression"}]};function o(){t.VA.Core.Validator.SingleInputValidator.call(this)}o.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),o.prototype.constructor=o,o.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this),this.addWhileLoopRule()},o.prototype.addLinkRule=function(){},o.prototype.checkLinkIsConnected=function(t){var e={errorCode:"EL001",messageParam:[t.display.label]};if(!this._hasPrevious(t))return this.problemFactory.createProblem(e,t)},o.prototype.addWhileLoopRule=function(){var t=this;this.addRule(function(o){var r=o.param,n=e[r.type];return _.chain(n).map(function(e){if(t.isEmpty(r,e))return t.problemFactory.createProblem(function(t,e){return{errorCode:"BR-0033",param:t.join("/"),messageParam:[e]}}([r.type,e.prop],e.msg),o)}).compact().value()})},o.prototype.isEmpty=function(t,e){var o=t.prop[e.prop];return"expression"===e.type?this.isEmptyExpression(o):this.isEmptyVariable(o)},o.prototype.isEmptyVariable=function(t){return!_.trim(t)},o.prototype.isEmptyExpression=function(t){var e=t.substring(3,t.length-1);return!_.trim(e)},t.VA.Core.Functions.Library.whileLoop.validator=o}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.setValue={category:"process",defaultFnUnit:{func:"setValue",name:"SetValue",inData:[],outData:[],param:{variables:[]},display:{label:"Set Value",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"Set variable value.",tags:["set","setvalue","value"],mandatory:["variables"],"in-range":{min:1,max:20},"out-range":{min:0,max:10}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={variables:this.renderVariables},this.createVariablesControl()},e.prototype.createVariablesControl=function(){var e=this;this.$container=$('<div class="brtc-va-editors-sheet-panels-properties-setvariable-variable-container"></div>'),this.addPropertyControl("Variables",function(o){o.append(this.$container),this.variableControl=new t.VA.Core.Views.SetVariable(this.$container,{width:"100%",height:"calc(100% - 30px)",editor:this.options.modelEditor,onAdd:function(t){e.createOnAddCommand(t)},onRemove:function(t){e.createOnRemoveCommand(t)},onChange:function(t,o){e.createOnChangeCommand(t,o)}})})},e.prototype.renderVariables=function(){this.variableControl.renderValues(this.options.fnUnit.param.variables)},e.prototype.fillControlValues=function(){},e.prototype.createOnRemoveCommand=function(e){var o=e.name,r=this.options.fnUnit.param.variables,n=[];for(var a in r)r[a].name!==o&&n.push(r[a]);var i={fnUnit:this.options.fnUnit,ref:{param:{variables:n}}},s=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,i);this.executeCommand(s)},e.prototype.createOnChangeCommand=function(e,o){var r=e.name,n=this.options.fnUnit.param.variables,a=[];for(var i in this.updateMode(o),this.updateParam(o),n)n[i].name!==r?a.push(n[i]):a.push(o);var s={fnUnit:this.options.fnUnit,ref:{param:{variables:a}}},l=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,s);this.executeCommand(l)},e.prototype.createOnAddCommand=function(e){var o=$.extend(!0,[],e),r=$.extend(!0,[],this.options.fnUnit.param.variables);this.updateMode(o),this.updateParam(o),r.push(e);var n={fnUnit:this.options.fnUnit,ref:{param:{variables:r}}},a=new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,n);this.executeCommand(a)},e.prototype.updateMode=function(t){t.mode="value"},e.prototype.updateParam=function(t){var e=$.extend(t.value);t.param={},t.param.value=e,delete t.value},t.VA.Core.Functions.Library.setValue.propertiesPanel=e}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadFromAlluxio={category:"io",defaultFnUnit:{func:"loadFromAlluxio",name:"Subflow",outData:[],param:{functions:[{fid:"",func:"load",name:"InOutData",outData:[],param:{"io-mode":"read","fs-type":"alluxiocsv","df-names":[],"fs-paths":[]},persist:!0}],links:[]},display:{label:"Load From Local",charts:[{chart:{type:"table"}}]},persist:!0},description:"Load data from Repository.",mandatory:["fs-paths"],tags:["Load From Repository"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadFromHdfs={category:"io",defaultFnUnit:{func:"loadFromHdfs",name:"Subflow",outData:[],param:{functions:[{fid:"",func:"load",name:"InOutData",outData:[],param:{"io-mode":"read","fs-type":"alluxiocsv","df-names":[],"fs-paths":[]},persist:!0}],links:[]},display:{label:"Load From Hdfs"},persist:!0},description:"Load data from Hdfs.",mandatory:["fs-paths"],tags:["Load From Hdfs"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadFromLocal={category:"io",defaultFnUnit:{func:"loadFromLocal",name:"Subflow",outData:[],param:{functions:[{fid:"",func:"load",name:"InOutData",outData:[],param:{"io-mode":"read","fs-type":"alluxiocsv","df-names":[],"fs-paths":[]},persist:!0}],links:[]},display:{label:"Load From Local"},persist:!0},description:"Load data from Local.",mandatory:["fs-paths"],tags:["Load From Local"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadFromRdb={category:"io",defaultFnUnit:{func:"loadFromRdb",name:"Subflow",outData:[],param:{functions:[{fid:"",func:"load",name:"InOutData",outData:[],param:{"io-mode":"read","fs-type":"alluxiocsv","df-names":[],"fs-paths":[]},persist:!0}],links:[]},display:{label:"Load From Local"},persist:!0},description:"Load data from RDB.",mandatory:["fs-paths"],tags:["Load From RDB"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.loadFromStaging={category:"io",defaultFnUnit:{func:"loadFromStaging",name:"Empty",param:{modelId:"",tableId:""},display:{label:"Load From Staging"}},description:"Load data from staging.",mandatory:["fs-paths"],tags:["Load From Staging"],"in-range":{min:0,max:0},"out-range":{min:1,max:1}}}.call(this),function(){"use strict";var t=this.Brightics;function e(e,o){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.call(this,e,o)}function o(){t.VA.Core.Validator.SingleInputValidator.call(this)}t.VA.Core.Functions.Library.pythonRefine={category:"transform",defaultFnUnit:{func:"pythonRefine",name:"Subflow",inData:[],outData:[],param:{functions:[{func:"pythonScript",name:"PythonScript",param:{script:"result = inputs[0]","out-table-alias":["result"]}}],links:[]},display:{label:"Refine Data",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}},context:"python"},description:"This function is used to refine data: cleaning it; transforming it; and extending it.",tags:["Add Function Column","AddFunctionColumn","Add Column","Extraction","Preprocessing","Transform","Refine","Refine Data"],"in-range":{min:1,max:1},"out-range":{min:1,max:1}},e.prototype=Object.create(t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype),e.prototype.constructor=e,e.prototype.createControls=function(){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createControls.call(this),this.retrieveTableInfo(this.options.fnUnit[IN_DATA])},e.prototype.getPrimaryOperation=function(){return"RefineData"},e.prototype.createContentsAreaControls=function(e){t.VA.Core.Editors.Sheet.Panels.PropertiesPanel.prototype.createContentsAreaControls.call(this,e),this.render={a:this.renderSubflowControl},this.createStepControl()},e.prototype.renderValues=function(t){this.renderSubflowControl()},e.prototype.renderSubflowControl=function(){var e=this;this.$stepDisplayDiv.empty();for(var o=0;o<this.options.fnUnit.param.functions.length;o++){var r=this.options.fnUnit.param.functions[o];if(void 0!==r.func&&"pythonScript"!==r.func)var n=$('<div class="brtc-va-refine-step"> <div class="brtc-va-refine-step-header"> <div class="brtc-va-refine-step-label" id="'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r.fid)+'">'+t.VA.Core.Utils.WidgetUtils.convertHTMLSpecialChar(r.display.label)+" </div> </div></div>");if(e.$stepDisplayDiv.append(n),this.options.fnUnit.param.functions.length>0&&"pythonScript"!==r.func)n.find(".brtc-va-refine-step-header").click(function(o){var r=$(this).parents(".brtc-va-refine-step").prevAll(".brtc-va-refine-step").length;new t.VA.Core.Dialogs.RefineDialog($(o.target),{stepIdx:r,fnUnit:e.options.fnUnit,dataProxy:e.options.dataProxy,columns:$.extend(!0,[],e.columnNameArray),close:function(t){if(t.OK){var o=e.createSubflowCommand(t.param);e.executeCommand(o),e.renderSubflowControl(),e.callFunction()}}})})}},e.prototype.fillControlValues=function(){this.columnNameArray=[],this.columnNameArray=this.dataMap&&this.options.fnUnit[IN_DATA][0]?this.dataMap[this.options.fnUnit[IN_DATA][0]].columns:[]},e.prototype.createStepControl=function(){var t=this;this.$stepContainer=$('<div class="brtc-va-editors-sheet-refine-step-container"/>'),this.$stepDisplayDiv=$('<div class="btrc-va-editors-sheet-refine-step-div"/>'),this.addPropertyControl("Step",function(e){e.append(t.$stepDisplayDiv),e.append(t.$stepContainer),t.createBrowseControl(t.$stepContainer)},{mandatory:!1})},e.prototype.createBrowseControl=function(e){var o=this,r=$('<input class="brtc-va-editors-sheet-panels-properties-anovaproperties-column-add-key-condition" type="button" value="Edit"/>');e.append(r),r.jqxButton({theme:t.VA.Env.Theme,width:"100%",height:25}),r.click(function(e){new t.VA.Core.Dialogs.RefineDialog($(e.target),{fnUnit:o.options.fnUnit,dataProxy:o.options.dataProxy,columns:$.extend(!0,[],o.columnNameArray),context:"python",close:function(t){if(t.OK){var e=o.createSubflowCommand(t.param);o.executeCommand(e),o.renderSubflowControl()}}})})},e.prototype.createSubflowCommand=function(e){e.functions.length?this.options.fnUnit.param.functions[this.options.fnUnit.param.functions.length-1][IN_DATA]=e.functions[e.functions.length-1][OUT_DATA]:this.options.fnUnit.param.functions[this.options.fnUnit.param.functions.length-1][IN_DATA]=this.options.fnUnit[IN_DATA],e.functions.push(this.options.fnUnit.param.functions[this.options.fnUnit.param.functions.length-1]);for(var o=[],r=0;r<e.functions.length-1;r++){var n={kid:t.VA.Core.Utils.IDGenerator.link.id(),sourceFid:e.functions[r].fid,targetFid:e.functions[r+1].fid};o.push(n)}var a={fnUnit:this.options.fnUnit,ref:{param:{functions:$.extend(!0,[],e.functions),links:$.extend(!0,[],o)}}};return a.ref.param.functions&&a.ref.param.functions.length>0&&(a.ref.param.entries=[a.ref.param.functions[0].fid]),new t.VA.Core.Editors.Diagram.Commands.SetFnUnitParameterValueCommand(this,a)},t.VA.Core.Functions.Library.pythonRefine.propertiesPanel=e,o.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),o.prototype.constructor=o,o.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this)},t.VA.Core.Functions.Library.pythonRefine.validator=o}.call(this),function(){"use strict";this.Brightics.VA.Core.Functions.Library.dataViewer={category:"brightics",defaultFnUnit:{func:"dataViewer",name:"DataViewer",outData:[],param:{mid:"",fid:""},skip:!0,display:{label:"",diagram:{position:{x:20,y:10}},sheet:{in:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]},out:{partial:[{panel:[],layout:{}}],full:[{panel:[],layout:{}}]}}}},description:"",tags:[],"in-range":{min:0,max:0},"out-range":{min:1,max:10}}}.call(this),function(){"use strict";var t=this.Brightics;function e(){t.VA.Core.Validator.SingleInputValidator.call(this)}e.prototype=Object.create(t.VA.Core.Validator.SingleInputValidator.prototype),e.prototype.constructor=e,e.prototype.initRules=function(){t.VA.Core.Validator.SingleInputValidator.prototype.initRules.call(this)},e.prototype.addLinkRule=function(){var t=this;this.addRule(function(e){return t.checkLinkIsConnected(e)})},e.prototype.checkLinkIsConnected=function(t){var e={errorCode:"EL001",messageParam:[t.display.label]},o=(Studio.getEditorContainer().getActiveModelEditor().getModel(),Studio.getEditorContainer().getActiveModelEditor().getActiveModel());for(var r in t.outData)if(o.inData.indexOf(t.outData[r])<0)return this.problemFactory.createProblem(e,t)},t.VA.Core.Functions.Library.dataViewer.validator=e}.call(this);