diff --git a/web/admin/dist/data.js b/web/admin/dist/data.js index 9ced4d1f..cf004f6f 100644 --- a/web/admin/dist/data.js +++ b/web/admin/dist/data.js @@ -1,2 +1,2 @@ -!function e(t,a,l){function i(o,r){if(!a[o]){if(!t[o]){var s="function"==typeof require&&require;if(!r&&s)return s(o,!0);if(n)return n(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[o]={exports:{}};t[o][0].call(u.exports,(function(e){return i(t[o][1][e]||e)}),u,u.exports,e,t,a,l)}return a[o].exports}for(var n="function"==typeof require&&require,o=0;o
#_name_# #_delete_##_edit_#
Title: #_title_#
Type: #_type_#
Sample: #_sampleValue_#
 #_help_#
',validation:"none","custom-validate-function":function(e){var t={};return t.params=e,t.valid=!0,"Reference"===e.type?"NULL"===e.dependOn?(t.message="If the type is Reference this field should referring another object",t.valid=!1):null!=dependOnField&&"NULL"!==dependOnField||(t.message="If the type is Reference then 'Depends On Field' can not be empty",t.valid=!1):"Normal"===e.type&&("NULL"!==e.dependOn?(t.message="If the type is Reference this field should not refer another object",t.valid=!1):null!=dependOnField&&"NULL"!==dependOnField||(t.message="If the type is Reference then 'Depends On Field' should be empty",t.valid=!1)),t}}]]}},{key:"getActionButtonsHtml",value:function(e,t){var a='
_edit__download__clone__delete_
';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace("_download_",'')).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"downloadTemplate",value:function(e){var t={t:this.table,sa:"downloadTemplate",mod:"admin=data"};t.req=JSON.stringify({id:e});var a=modJs.getCustomActionUrl("ca",t);window.open(a,"_blank")}}]),a}(i.default),m=function(e){c(a,e);var t=d(a);function a(){return o(this,a),t.apply(this,arguments)}return s(a,[{key:"getDataMapping",value:function(){return["id","name","data_import_definition","status"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Data Import Definition"},{sTitle:"Status"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["data_import_definition",{label:"Data Import Definitions",type:"select","remote-source":["DataImport","id","name"]}],["file",{label:"File to Import",type:"fileupload",validation:"",filetypes:"csv,txt"}],["details",{label:"Last Export Result",type:"textarea",validation:"none"}]]}},{key:"getActionButtonsHtml",value:function(e,t){var a='
_edit__process__clone__delete_
';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_",""),a=(a=(a=(a="Not Processed"===t[3]?a.replace("_process_",''):a.replace("_process_","")).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"process",value:function(e){var t={id:e},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="processSuccessCallBack",l.callBackFail="processFailCallBack",this.customAction("processDataFile","admin=data",a,l)}},{key:"processSuccessCallBack",value:function(e){this.showMessage("Success","File imported successfully."),this.get([])}},{key:"processFailCallBack",value:function(e){this.showMessage("Error","File import unsuccessful. Result:".concat(e))}}]),a}(i.default);t.exports={DataImportAdapter:p,DataImportFileAdapter:m}},{"../../../api/AdapterBase":4}],3:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var a=0;a0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var r=0;r
')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
'.concat(e,"
")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
'}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,r="",s=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,s)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u');s.attr("id",r),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var a,l=this.templates.formTemplate,i="",n=this.getFormFields(),o=0;o')).attr("id",c):a=$("#".concat(this.getTableName(),"Form")),a.html(l),a.find(".datefield").datepicker({viewMode:2}),a.find(".timefield").datetimepicker({language:"en",pickDate:!1}),a.find(".datetimefield").datetimepicker({language:"en"}),a.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(a.attr("id")," .tinymce"),height:"400"}),a.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&a.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),a.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),a.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),a.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,l.id),l)void 0!==(n=l[u])&&null!=n&&"string"==typeof n&&(n=n.replace(/(?:\r\n|\r|\n)/g,"
    ")),a=a.replace("#_".concat(u,"_#"),n);void 0!==t[1].render&&null!=t[1].render&&(a=a.replace("#_renderFunction_#",t[1].render(l))),(i=$(a)).attr("fieldId","".concat(t[0],"_div")),s.append(i)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var a=this.templates.datagroupTemplate,l="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var n=0;n');r.attr("id",o),r.html(a),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),r,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var a=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[l])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;l=e.params}var n=$("#".concat(t[0])).val();""===n&&(n="[]");var o=JSON.parse(n);l.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(l),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),n=JSON.stringify(o);var r=this.dataGroupToHtml(n,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(r),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(n),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var a="";try{for(var l=e.split(" "),i=0,n=0;nt?(a+="".concat(l[n],"
    "),i=0):a+="".concat(l[n]," ")}catch(e){}return a}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var a=$(e.target);if(!/html|body/i.test(a.offsetParent()[0].tagName)){var l=e.pageY-a.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(l,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,a=[],l=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var n=JSON.parse(i);l.each((function(){for(var e in t=$(this).attr("id"),n)if(n[e].id===t){a.push(n[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(a))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,a=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var n=e[1]["custom-validate-function"].apply(this,[l]);if(!n.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(n.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;l=n.params}if(this.doCustomFilterValidation(l)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var r=JSON.parse(o),s={},c=-1,u=[],d=0;d=a&&(a=parseInt(t,10)+1)}return a}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i=[],n=0;n")}catch(e){}if(void 0!==a[i][1].formatter&&a[i][1].formatter&&$.isFunction(a[i][1].formatter))try{l=a[i][1].formatter(l)}catch(e){}$("".concat(t," #").concat(a[i][0])).html(l)}else if("fileupload"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&""!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).attr("val",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).show(),$("".concat(t," #").concat(a[i][0],"_download")).show(),$("".concat(t," #").concat(a[i][0],"_remove")).show()),!0===a[i][1].readonly&&$("".concat(t," #").concat(a[i][0],"_upload")).remove();else if("select"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]);else if("select2"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).select2("val",e[a[i][0]]);else if("select2multi"===a[i][1].type){void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL");var c=[];if(void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]])try{c=JSON.parse(e[a[i][0]])}catch(e){}$("".concat(t," #").concat(a[i][0])).select2("val",c);var u=$("".concat(t," #").concat(a[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(a[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(a[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===a[i][1].type)try{var d=this.dataGroupToHtml(e[a[i][0]],a[i]);$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]),$("".concat(t," #").concat(a[i][0],"_div")).html(""),$("".concat(t," #").concat(a[i][0],"_div")).append(d),this.makeDataGroupSortable(a[i],$("".concat(t," #").concat(a[i][0],"_div_inner")))}catch(e){}else if("signature"===a[i][1].type)""===e[a[i][0]]&&void 0===e[a[i][0]]&&null==e[a[i][0]]||$("".concat(t," #").concat(a[i][0])).data("signaturePad").fromDataURL(e[a[i][0]]);else if("simplemde"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).data("simplemde").value(e[a[i][0]]);else if("code"===a[i][1].type){var h=$("".concat(t," #").concat(a[i][0])).data("codemirror");h&&h.getDoc().setValue(e[a[i][0]])}else $("".concat(t," #").concat(a[i][0])).val(e[a[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var a=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)a=a.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var l="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);a=a.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[l],e))}}else if("colorpick"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,a=(a=a.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),a=(a=void 0!==e[1].filetypes&&null!=e[1].filetypes?a.replace(/_filetypes_/g,e[1].filetypes):a.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return a=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?a.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):a.replace(/_validation_/g,""),a=void 0!==e[1].help&&null!==e[1].help?(a=a.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(a=a.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),a=void 0!==e[1].placeholder&&null!==e[1].placeholder?a.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):a.replace(/_placeholder_/g,""),a=void 0!==e[1].mask&&null!==e[1].mask?a.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):a.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var a="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push(e[i]);!0===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var a="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push([i,e[i]]);"true"===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__delete__clone_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l="",i=e;i>0;--i)l+=a[Math.round(Math.random()*(a.length-1))];return l+t.getTime()}},{key:"checkFileType",value:function(e,t){var a=document.getElementById(e),l="";return a.value.lastIndexOf(".")>0&&(l=a.value.substring(a.value.lastIndexOf(".")+1,a.value.length)),l=l.toLowerCase(),!(t.split(",").indexOf(l)<0&&(a.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),a=t.toGMTString();return(t-new Date(a.substring(0,a.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var a in e)t+=''.replace("__val__",a).replace("__text__",e[a]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,a,l=0;l
    #_name_# #_delete_##_edit_#
    Title: #_title_#
    Type: #_type_#
    Sample: #_sampleValue_#
     #_help_#
    ',validation:"none","custom-validate-function":function(e){var t={};return t.params=e,t.valid=!0,"Reference"===e.type?"NULL"===e.dependOn?(t.message="If the type is Reference this field should referring another object",t.valid=!1):null!=dependOnField&&"NULL"!==dependOnField||(t.message="If the type is Reference then 'Depends On Field' can not be empty",t.valid=!1):"Normal"===e.type&&("NULL"!==e.dependOn?(t.message="If the type is Reference this field should not refer another object",t.valid=!1):null!=dependOnField&&"NULL"!==dependOnField||(t.message="If the type is Reference then 'Depends On Field' should be empty",t.valid=!1)),t}}]]}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__download__clone__delete_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace("_download_",'')).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"downloadTemplate",value:function(e){var t={t:this.table,sa:"downloadTemplate",mod:"admin=data"};t.req=JSON.stringify({id:e});var a=modJs.getCustomActionUrl("ca",t);window.open(a,"_blank")}}]),a}(i.default),m=function(e){c(a,e);var t=d(a);function a(){return o(this,a),t.apply(this,arguments)}return s(a,[{key:"getDataMapping",value:function(){return["id","name","data_import_definition","status"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Data Import Definition"},{sTitle:"Status"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["data_import_definition",{label:"Data Import Definitions",type:"select","remote-source":["DataImport","id","name"]}],["file",{label:"File to Import",type:"fileupload",validation:"",filetypes:"csv,txt"}],["details",{label:"Last Export Result",type:"textarea",validation:"none"}]]}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__process__clone__delete_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_",""),a=(a=(a=(a="Not Processed"===t[3]?a.replace("_process_",''):a.replace("_process_","")).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"process",value:function(e){var t={id:e},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="processSuccessCallBack",l.callBackFail="processFailCallBack",this.customAction("processDataFile","admin=data",a,l)}},{key:"processSuccessCallBack",value:function(e){this.showMessage("Success","File imported successfully."),this.get([])}},{key:"processFailCallBack",value:function(e){this.showMessage("Error","File import unsuccessful. Result:".concat(e))}}]),a}(i.default);t.exports={DataImportAdapter:p,DataImportFileAdapter:m}},{"../../../api/AdapterBase":4}],3:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var a=0;a0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var r=0;r
    ')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
    '.concat(e,"
    ")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,r="",s=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,s)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u');s.attr("id",r),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var a,l=this.templates.formTemplate,i="",n=this.getFormFields(),o=0;o')).attr("id",c):a=$("#".concat(this.getTableName(),"Form")),a.html(l),a.find(".datefield").datepicker({viewMode:2}),a.find(".timefield").datetimepicker({language:"en",pickDate:!1}),a.find(".datetimefield").datetimepicker({language:"en"}),a.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(a.attr("id")," .tinymce"),height:"400"}),a.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&a.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),a.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),a.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),a.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,l.id),l)void 0!==(n=l[u])&&null!=n&&"string"==typeof n&&(n=n.replace(/(?:\r\n|\r|\n)/g,"
    ")),a=a.replace("#_".concat(u,"_#"),n);void 0!==t[1].render&&null!=t[1].render&&(a=a.replace("#_renderFunction_#",t[1].render(l))),(i=$(a)).attr("fieldId","".concat(t[0],"_div")),s.append(i)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var a=this.templates.datagroupTemplate,l="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var n=0;n');r.attr("id",o),r.html(a),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),r,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var a=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[l])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;l=e.params}var n=$("#".concat(t[0])).val();""===n&&(n="[]");var o=JSON.parse(n);l.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(l),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),n=JSON.stringify(o);var r=this.dataGroupToHtml(n,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(r),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(n),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var a="";try{for(var l=e.split(" "),i=0,n=0;nt?(a+="".concat(l[n],"
    "),i=0):a+="".concat(l[n]," ")}catch(e){}return a}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var a=$(e.target);if(!/html|body/i.test(a.offsetParent()[0].tagName)){var l=e.pageY-a.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(l,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,a=[],l=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var n=JSON.parse(i);l.each((function(){for(var e in t=$(this).attr("id"),n)if(n[e].id===t){a.push(n[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(a))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,a=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var n=e[1]["custom-validate-function"].apply(this,[l]);if(!n.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(n.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;l=n.params}if(this.doCustomFilterValidation(l)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var r=JSON.parse(o),s={},c=-1,u=[],d=0;d=a&&(a=parseInt(t,10)+1)}return a}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i=[],n=0;n")}catch(e){}if(void 0!==a[i][1].formatter&&a[i][1].formatter&&$.isFunction(a[i][1].formatter))try{l=a[i][1].formatter(l)}catch(e){}$("".concat(t," #").concat(a[i][0])).html(l)}else if("fileupload"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&""!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).attr("val",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).show(),$("".concat(t," #").concat(a[i][0],"_download")).show(),$("".concat(t," #").concat(a[i][0],"_remove")).show()),!0===a[i][1].readonly&&$("".concat(t," #").concat(a[i][0],"_upload")).remove();else if("select"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]);else if("select2"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).select2("val",e[a[i][0]]);else if("select2multi"===a[i][1].type){void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL");var c=[];if(void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]])try{c=JSON.parse(e[a[i][0]])}catch(e){}$("".concat(t," #").concat(a[i][0])).select2("val",c);var u=$("".concat(t," #").concat(a[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(a[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(a[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===a[i][1].type)try{var d=this.dataGroupToHtml(e[a[i][0]],a[i]);$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]),$("".concat(t," #").concat(a[i][0],"_div")).html(""),$("".concat(t," #").concat(a[i][0],"_div")).append(d),this.makeDataGroupSortable(a[i],$("".concat(t," #").concat(a[i][0],"_div_inner")))}catch(e){}else if("signature"===a[i][1].type)""===e[a[i][0]]&&void 0===e[a[i][0]]&&null==e[a[i][0]]||$("".concat(t," #").concat(a[i][0])).data("signaturePad").fromDataURL(e[a[i][0]]);else if("simplemde"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).data("simplemde").value(e[a[i][0]]);else if("code"===a[i][1].type){var h=$("".concat(t," #").concat(a[i][0])).data("codemirror");h&&h.getDoc().setValue(e[a[i][0]])}else $("".concat(t," #").concat(a[i][0])).val(e[a[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var a=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)a=a.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var l="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);a=a.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[l],e))}}else if("colorpick"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,a=(a=a.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),a=(a=void 0!==e[1].filetypes&&null!=e[1].filetypes?a.replace(/_filetypes_/g,e[1].filetypes):a.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return a=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?a.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):a.replace(/_validation_/g,""),a=void 0!==e[1].help&&null!==e[1].help?(a=a.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(a=a.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),a=void 0!==e[1].placeholder&&null!==e[1].placeholder?a.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):a.replace(/_placeholder_/g,""),a=void 0!==e[1].mask&&null!==e[1].mask?a.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):a.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var a="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push(e[i]);!0===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var a="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push([i,e[i]]);"true"===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__delete__clone_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l="",i=e;i>0;--i)l+=a[Math.round(Math.random()*(a.length-1))];return l+t.getTime()}},{key:"checkFileType",value:function(e,t){var a=document.getElementById(e),l="";return a.value.lastIndexOf(".")>0&&(l=a.value.substring(a.value.lastIndexOf(".")+1,a.value.length)),l=l.toLowerCase(),!(t.split(",").indexOf(l)<0&&(a.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),a=t.toGMTString();return(t-new Date(a.substring(0,a.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var a in e)t+=''.replace("__val__",a).replace("__text__",e[a]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,a,l=0;l')+this.gt("Skills")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    ').concat(nl2br(e[3]),"

    "))}}]),a}(i.default),y=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","education_id","institute","date_start","date_end"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Qualification"},{sTitle:"Institute"},{sTitle:"Start Date"},{sTitle:"Completed On"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["education_id",{label:"Qualification",type:"select2","allow-null":!1,"remote-source":["Education","id","name"]}],["institute",{label:"Institute",type:"text",validation:""}],["date_start",{label:"Start Date",type:"date",validation:"none"}],["date_end",{label:"Completed On",type:"date",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Education")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[4]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}var i="";try{i=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}return $('
    '.concat(e[2]).concat(t).concat(a,'

    Start: ').concat(l,'

    Completed: ').concat(i,'

    ')+' Institute: '.concat(e[3],"

    "))}}]),a}(i.default),b=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","certification_id","institute","date_start","date_end"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Certification"},{sTitle:"Institute"},{sTitle:"Granted On"},{sTitle:"Valid Thru"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["certification_id",{label:"Certification",type:"select2","allow-null":!1,"remote-source":["Certification","id","name"]}],["institute",{label:"Institute",type:"text",validation:""}],["date_start",{label:"Granted On",type:"date",validation:"none"}],["date_end",{label:"Valid Thru",type:"date",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Certifications")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[4]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}var i="";try{i=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}return $('
    '.concat(e[2]).concat(t).concat(a,'

    Granted On: ').concat(l,'

    Valid Thru: ').concat(i,'

    Institute: ').concat(e[3],"

    "))}}]),a}(i.default),v=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","language_id","reading","speaking","writing","understanding"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Language"},{sTitle:"Reading"},{sTitle:"Speaking"},{sTitle:"Writing"},{sTitle:"Understanding"}]}},{key:"getFormFields",value:function(){var e=[["Elementary Proficiency","Elementary Proficiency"],["Limited Working Proficiency","Limited Working Proficiency"],["Professional Working Proficiency","Professional Working Proficiency"],["Full Professional Proficiency","Full Professional Proficiency"],["Native or Bilingual Proficiency","Native or Bilingual Proficiency"]];return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["language_id",{label:"Language",type:"select2","allow-null":!1,"remote-source":["Language","id","name"]}],["reading",{label:"Reading",type:"select",source:e}],["speaking",{label:"Speaking",type:"select",source:e}],["writing",{label:"Writing",type:"select",source:e}],["understanding",{label:"Understanding",type:"select",source:e}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Languages")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Reading: ').concat(e[3],'

    Speaking: ').concat(e[4],'

    Writing: ').concat(e[5],'

    Understanding: ').concat(e[6],"

    "))}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(i.default),g=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","name","relationship","dob","id_number"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Name"},{sTitle:"Relationship"},{sTitle:"Date of Birth"},{sTitle:"Id Number"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["relationship",{label:"Relationship",type:"select",source:[["Child","Child"],["Spouse","Spouse"],["Parent","Parent"],["Other","Other"]]}],["dob",{label:"Date of Birth",type:"date",validation:""}],["id_number",{label:"Id Number",type:"text",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Dependents")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Relationship: ').concat(e[3],'

    Name: ').concat(e[2],"

    "))}}]),a}(i.default),_=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","name","relationship","home_phone","work_phone","mobile_phone"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Name"},{sTitle:"Relationship"},{sTitle:"Home Phone"},{sTitle:"Work Phone"},{sTitle:"Mobile Phone"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["relationship",{label:"Relationship",type:"text",validation:"none"}],["home_phone",{label:"Home Phone",type:"text",validation:"none"}],["work_phone",{label:"Work Phone",type:"text",validation:"none"}],["mobile_phone",{label:"Mobile Phone",type:"text",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Emergency Contacts")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Relationship: ').concat(e[3],'

    Name: ').concat(e[2],'

    Home Phone: ').concat(e[4],'

    Mobile Phone: ').concat(e[6],"

    "))}}]),a}(i.default),k=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","document","details","date_added","valid_until","status","attachment"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Document"},{sTitle:"Details"},{sTitle:"Date Added"},{sTitle:"Status"},{sTitle:"Attachment",bVisible:!1}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["document",{label:"Document",type:"select2","remote-source":["Document","id","name"]}],["date_added",{label:"Date Added",type:"date",validation:""}],["valid_until",{label:"Valid Until",type:"date",validation:"none"}],["status",{label:"Status",type:"select",source:[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],["details",{label:"Details",type:"textarea",validation:"none"}],["attachment",{label:"Attachment",type:"fileupload",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Documents")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log(e.message)}var i='');return $('
    '.concat(e[2]).concat(i).concat(t).concat(a,'

    ').concat(nl2br(e[3]),'

    Expire On: ').concat(l,"

    "))}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(i.default),S=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(l.default),w=function(e){u(a,e);var t=p(a);function a(e,l,i,n){var o;return s(this,a),(o=t.call(this,e,l,i,n)).fieldNameMap={},o.hiddenFields={},o.tableFields={},o.formOnlyFields={},o}return c(a,[{key:"setFieldNameMap",value:function(e){for(var t,a=0;a'.replace("_img_",t)}return t}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"getTableFields",value:function(){return["id","image","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"]}},{key:"getDataMapping",value:function(){for(var e=this.getTableFields(),t=[],a=0;a
    #_delete_##_edit_#Date: #_date_#
    #_note_#
    ',validation:"none","sort-function":function(e,t){return Date.parse(e.date).getTime()");return a=(a=a.replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"getHelpLink",value:function(){return"https://thilinah.gitbooks.io/icehrm-guide/content/employee-information-setup.html"}},{key:"saveSuccessItemCallback",value:function(e){this.lastSavedEmployee=e,null===this.currentId&&$("#createUserModel").modal("show")}},{key:"closeCreateUser",value:function(){$("#createUserModel").modal("hide")}},{key:"createUser",value:function(){var e={};e.employee=this.lastSavedEmployee.id,e.user_level="Employee",e.email=this.lastSavedEmployee.work_email,e.username=this.lastSavedEmployee.work_email.split("@")[0],top.location.href=this.getCustomUrl("?g=admin&n=users&m=admin_Admin&action=new&object=".concat(Base64.encodeURI(JSON.stringify(e))))}},{key:"deleteEmployee",value:function(e){if(confirm("Are you sure you want to archive this employee? Data for this employee will be saved to an archive table. But you will not be able to covert the archived employee data into a normal employee.")){var t=[];t.callBackData=[],t.callBackSuccess="deleteEmployeeSuccessCallback",t.callBackFail="deleteEmployeeFailCallback",this.customAction("deleteEmployee","admin=employees",JSON.stringify({id:e}),t)}}},{key:"deleteEmployeeSuccessCallback",value:function(e){this.showMessage("Delete Success","Employee deleted. You can find archived information for this employee in Archived Employees tab"),this.get([])}},{key:"deleteEmployeeFailCallback",value:function(e){this.showMessage("Error occurred while deleting Employee",e)}},{key:"terminateEmployee",value:function(e){if(confirm("Are you sure you want to terminate this employee contract? You will still be able to access all details of this employee.")){var t={};t.id=e;var a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="terminateEmployeeSuccessCallback",l.callBackFail="terminateEmployeeFailCallback",this.customAction("terminateEmployee","admin=employees",a,l)}}},{key:"terminateEmployeeSuccessCallback",value:function(e){this.showMessage("Success","Employee contract terminated. You can find terminated employee information under Terminated Employees menu."),this.get([])}},{key:"terminateEmployeeFailCallback",value:function(e){this.showMessage("Error occured while terminating Employee",e)}},{key:"activateEmployee",value:function(e){if(confirm("Are you sure you want to re-activate this employee contract?")){var t={};t.id=e;var a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="activateEmployeeSuccessCallback",l.callBackFail="activateEmployeeFailCallback",this.customAction("activateEmployee","admin=employees",a,l)}}},{key:"activateEmployeeSuccessCallback",value:function(e){this.showMessage("Success","Employee contract re-activated."),this.get([])}},{key:"activateEmployeeFailCallback",value:function(e){this.showMessage("Error occurred while activating Employee",e)}},{key:"view",value:function(e){this.currentId=e;var t={id:e,map:JSON.stringify(this.getSourceMapping())},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="renderEmployee",l.callBackFail="viewFailCallBack",this.customAction("get","modules=employees",a,l)}},{key:"viewFailCallBack",value:function(e){this.showMessage("Error","Error Occured while retriving candidate")}},{key:"renderEmployee",value:function(e){var t,a=this.getFormFields();e[1],e[1],e[2];e=e[0],this.currentEmployee=e;for(var l=this.getCustomTemplate("myDetails.html"),i=0;i";if($("#".concat(this.getTableName()," #subordinates")).html(o),$("#".concat(this.getTableName()," #name")).html("".concat(e.first_name," ").concat(e.last_name)),this.currentUserId=e.id,$("#".concat(this.getTableName()," #profile_image_").concat(e.id)).attr("src",e.image),void 0!==e.customFields&&null!==e.customFields&&Object.keys(e.customFields).length>0){var r;for(var c in e.customFields){e.customFields[c][1]||(e.customFields[c][1]=this.gt("Other Details"));var u=e.customFields[c][1].toLocaleLowerCase();if(u=u.replace(" ","_"),$("#cont_".concat(u)).length<=0){var d='

    #_section.name_#

    ';d=(d=d.replace("#_section_#",u)).replace("#_section.name_#",e.customFields[c][1]),$("#customFieldsCont").append($(d))}r=(r='
    ').replace("#_label_#",c),r="fileupload"===e.customFields[c][2]?r.replace("#_value_#","")):r.replace("#_value_#",e.customFields[c][0]),$("#cont_".concat(u)).append($(r))}}else $("#customFieldsCont").remove();for(var p in this.cancel(),this.isModuleInstalled("admin","documents")||$("#tabDocuments").remove(),window.modJs=this,modJs.subModJsList=[],modJs.subModJsList.tabEmployeeSkillSubTab=new h("EmployeeSkill","EmployeeSkillSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeSkillSubTab.parent=this,modJs.subModJsList.tabEmployeeEducationSubTab=new y("EmployeeEducation","EmployeeEducationSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeEducationSubTab.parent=this,modJs.subModJsList.tabEmployeeCertificationSubTab=new b("EmployeeCertification","EmployeeCertificationSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeCertificationSubTab.parent=this,modJs.subModJsList.tabEmployeeLanguageSubTab=new v("EmployeeLanguage","EmployeeLanguageSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeLanguageSubTab.parent=this,modJs.subModJsList.tabEmployeeDependentSubTab=new g("EmployeeDependent","EmployeeDependentSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeDependentSubTab.parent=this,modJs.subModJsList.tabEmployeeEmergencyContactSubTab=new _("EmergencyContact","EmployeeEmergencyContactSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.parent=this,this.isModuleInstalled("admin","documents")&&(modJs.subModJsList.tabEmployeeDocumentSubTab=new k("EmployeeDocument","EmployeeDocumentSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeDocumentSubTab.parent=this),modJs.subModJsList)modJs.subModJsList.hasOwnProperty(p)&&(modJs.subModJsList[p].setTranslationsSubModules(this.translations),modJs.subModJsList[p].setPermissions(this.permissions),modJs.subModJsList[p].setFieldTemplates(this.fieldTemplates),modJs.subModJsList[p].setTemplates(this.templates),modJs.subModJsList[p].setCustomTemplates(this.customTemplates),modJs.subModJsList[p].setEmailTemplates(this.emailTemplates),modJs.subModJsList[p].setUser(this.user),modJs.subModJsList[p].initFieldMasterData(),modJs.subModJsList[p].setBaseUrl(this.baseUrl),modJs.subModJsList[p].setCurrentProfile(this.currentProfile),modJs.subModJsList[p].setInstanceId(this.instanceId),modJs.subModJsList[p].setGoogleAnalytics(ga),modJs.subModJsList[p].setNoJSONRequests(this.noJSONRequests));modJs.subModJsList.tabEmployeeSkillSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeSkillSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeSkillSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeSkillSubTab.get([]),modJs.subModJsList.tabEmployeeEducationSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeEducationSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeEducationSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeEducationSubTab.get([]),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeCertificationSubTab.get([]),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeLanguageSubTab.get([]),modJs.subModJsList.tabEmployeeDependentSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeDependentSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeDependentSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeDependentSubTab.get([]),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.get([]),this.isModuleInstalled("admin","documents")&&(modJs.subModJsList.tabEmployeeDocumentSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeDocumentSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeDocumentSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeDocumentSubTab.get([])),$("#subModTab a").off().on("click",(function(e){e.preventDefault(),$(this).tab("show")}))}},{key:"deleteProfileImage",value:function(e){var t={id:e},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="modEmployeeDeleteProfileImageCallBack",l.callBackFail="modEmployeeDeleteProfileImageCallBack",this.customAction("deleteProfileImage","modules=employees",a,l)}},{key:"modEmployeeDeleteProfileImageCallBack",value:function(e){}}]),a}(S),E=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","image","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID"},{sTitle:"",bSortable:!1},{sTitle:"Employee Number"},{sTitle:"First Name"},{sTitle:"Last Name"},{sTitle:"Mobile"},{sTitle:"Department"},{sTitle:"Gender"},{sTitle:"Supervisor"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden",validation:""}],["employee_id",{label:"Employee Number",type:"text",validation:""}],["first_name",{label:"First Name",type:"text",validation:""}],["middle_name",{label:"Middle Name",type:"text",validation:"none"}],["last_name",{label:"Last Name",type:"text",validation:""}],["nationality",{label:"Nationality",type:"select2","remote-source":["Nationality","id","name"]}],["birthday",{label:"Date of Birth",type:"date",validation:""}],["gender",{label:"Gender",type:"select",source:[["Male","Male"],["Female","Female"],["Divers","Divers"]]}],["marital_status",{label:"Marital Status",type:"select",source:[["Married","Married"],["Single","Single"],["Divorced","Divorced"],["Widowed","Widowed"],["Other","Other"]]}],["ssn_num",{label:"SSN/NRIC",type:"text",validation:"none"}],["nic_num",{label:"NIC",type:"text",validation:"none"}],["other_id",{label:"Other ID",type:"text",validation:"none"}],["driving_license",{label:"Driving License No",type:"text",validation:"none"}],["employment_status",{label:"Employment Status",type:"select2","remote-source":["EmploymentStatus","id","name"]}],["job_title",{label:"Job Title",type:"select2","remote-source":["JobTitle","id","name"]}],["pay_grade",{label:"Pay Grade",type:"select2","allow-null":!0,"remote-source":["PayGrade","id","name"]}],["work_station_id",{label:"Work Station Id",type:"text",validation:"none"}],["address1",{label:"Address Line 1",type:"text",validation:"none"}],["address2",{label:"Address Line 2",type:"text",validation:"none"}],["city",{label:"City",type:"text",validation:"none"}],["country",{label:"Country",type:"select2","remote-source":["Country","code","name"]}],["province",{label:"Province",type:"select2","allow-null":!0,"remote-source":["Province","id","name"]}],["postal_code",{label:"Postal/Zip Code",type:"text",validation:"none"}],["home_phone",{label:"Home Phone",type:"text",validation:"none"}],["mobile_phone",{label:"Mobile Phone",type:"text",validation:"none"}],["work_phone",{label:"Work Phone",type:"text",validation:"none"}],["work_email",{label:"Work Email",type:"text",validation:"emailOrEmpty"}],["private_email",{label:"Private Email",type:"text",validation:"emailOrEmpty"}],["joined_date",{label:"Joined Date",type:"date",validation:""}],["confirmation_date",{label:"Confirmation Date",type:"date",validation:"none"}],["termination_date",{label:"Termination Date",type:"date",validation:"none"}],["department",{label:"Department",type:"select2","remote-source":["CompanyStructure","id","title"]}],["supervisor",{label:"Supervisor",type:"select2","allow-null":!0,"remote-source":["Employee","id","first_name+last_name"]}],["notes",{label:"Notes",type:"datagroup",form:[["note",{label:"Note",type:"textarea",validation:""}]],html:'
    #_delete_##_edit_#Date: #_date_#
    #_note_#
    ',validation:"none","sort-function":function(e,t){return Date.parse(e.date).getTime()';return a=(a=(a=a.replace(/_id_/g,e)).replace(/_attachment_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(l.default);t.exports={EmployeeAdapter:w,TerminatedEmployeeAdapter:E,ArchivedEmployeeAdapter:T,EmployeeSkillAdapter:D,EmployeeEducationAdapter:F,EmployeeCertificationAdapter:M,EmployeeLanguageAdapter:A,EmployeeDependentAdapter:C,EmergencyContactAdapter:J,EmployeeImmigrationAdapter:N,EmployeeSubSkillsAdapter:h,EmployeeSubEducationAdapter:y,EmployeeSubCertificationAdapter:b,EmployeeSubLanguageAdapter:v,EmployeeSubDependentAdapter:g,EmployeeSubEmergencyContactAdapter:_,EmployeeSubDocumentAdapter:k,EmployeeDocumentAdapter:B}},{"../../../api/AdapterBase":4,"../../../api/SubAdapterBase":7}],3:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var a=0;a0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var s=0;s')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
    '.concat(e,"
    ")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,s="",r=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,r)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u');r.attr("id",s),r.html(t),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.showDomElement("Edit",r,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var a,l=this.templates.formTemplate,i="",n=this.getFormFields(),o=0;o')).attr("id",c):a=$("#".concat(this.getTableName(),"Form")),a.html(l),a.find(".datefield").datepicker({viewMode:2}),a.find(".timefield").datetimepicker({language:"en",pickDate:!1}),a.find(".datetimefield").datetimepicker({language:"en"}),a.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(a.attr("id")," .tinymce"),height:"400"}),a.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&a.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),a.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),a.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),a.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,l.id),l)void 0!==(n=l[u])&&null!=n&&"string"==typeof n&&(n=n.replace(/(?:\r\n|\r|\n)/g,"
    ")),a=a.replace("#_".concat(u,"_#"),n);void 0!==t[1].render&&null!=t[1].render&&(a=a.replace("#_renderFunction_#",t[1].render(l))),(i=$(a)).attr("fieldId","".concat(t[0],"_div")),r.append(i)}return r}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var a=this.templates.datagroupTemplate,l="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var n=0;n');s.attr("id",o),s.html(a),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),s,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var a=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[l])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;l=e.params}var n=$("#".concat(t[0])).val();""===n&&(n="[]");var o=JSON.parse(n);l.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(l),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),n=JSON.stringify(o);var s=this.dataGroupToHtml(n,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(s),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(n),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var a="";try{for(var l=e.split(" "),i=0,n=0;nt?(a+="".concat(l[n],"
    "),i=0):a+="".concat(l[n]," ")}catch(e){}return a}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var a=$(e.target);if(!/html|body/i.test(a.offsetParent()[0].tagName)){var l=e.pageY-a.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(l,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,a=[],l=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var n=JSON.parse(i);l.each((function(){for(var e in t=$(this).attr("id"),n)if(n[e].id===t){a.push(n[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(a))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,a=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var n=e[1]["custom-validate-function"].apply(this,[l]);if(!n.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(n.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;l=n.params}if(this.doCustomFilterValidation(l)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var s=JSON.parse(o),r={},c=-1,u=[],d=0;d=a&&(a=parseInt(t,10)+1)}return a}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i=[],n=0;n")}catch(e){}if(void 0!==a[i][1].formatter&&a[i][1].formatter&&$.isFunction(a[i][1].formatter))try{l=a[i][1].formatter(l)}catch(e){}$("".concat(t," #").concat(a[i][0])).html(l)}else if("fileupload"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&""!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).attr("val",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).show(),$("".concat(t," #").concat(a[i][0],"_download")).show(),$("".concat(t," #").concat(a[i][0],"_remove")).show()),!0===a[i][1].readonly&&$("".concat(t," #").concat(a[i][0],"_upload")).remove();else if("select"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]);else if("select2"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).select2("val",e[a[i][0]]);else if("select2multi"===a[i][1].type){void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL");var c=[];if(void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]])try{c=JSON.parse(e[a[i][0]])}catch(e){}$("".concat(t," #").concat(a[i][0])).select2("val",c);var u=$("".concat(t," #").concat(a[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(a[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(a[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===a[i][1].type)try{var d=this.dataGroupToHtml(e[a[i][0]],a[i]);$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]),$("".concat(t," #").concat(a[i][0],"_div")).html(""),$("".concat(t," #").concat(a[i][0],"_div")).append(d),this.makeDataGroupSortable(a[i],$("".concat(t," #").concat(a[i][0],"_div_inner")))}catch(e){}else if("signature"===a[i][1].type)""===e[a[i][0]]&&void 0===e[a[i][0]]&&null==e[a[i][0]]||$("".concat(t," #").concat(a[i][0])).data("signaturePad").fromDataURL(e[a[i][0]]);else if("simplemde"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).data("simplemde").value(e[a[i][0]]);else if("code"===a[i][1].type){var p=$("".concat(t," #").concat(a[i][0])).data("codemirror");p&&p.getDoc().setValue(e[a[i][0]])}else $("".concat(t," #").concat(a[i][0])).val(e[a[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var a=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)a=a.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var l="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);a=a.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[l],e))}}else if("colorpick"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,a=(a=a.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),a=(a=void 0!==e[1].filetypes&&null!=e[1].filetypes?a.replace(/_filetypes_/g,e[1].filetypes):a.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return a=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?a.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):a.replace(/_validation_/g,""),a=void 0!==e[1].help&&null!==e[1].help?(a=a.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(a=a.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),a=void 0!==e[1].placeholder&&null!==e[1].placeholder?a.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):a.replace(/_placeholder_/g,""),a=void 0!==e[1].mask&&null!==e[1].mask?a.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):a.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var a="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push(e[i]);!0===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=r=(r=r.replace("_id_",o)).replace("_val_",this.gt(s))}return a}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var a="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push([i,e[i]]);"true"===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=r=(r=r.replace("_id_",o)).replace("_val_",this.gt(s))}return a}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__delete__clone_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l="",i=e;i>0;--i)l+=a[Math.round(Math.random()*(a.length-1))];return l+t.getTime()}},{key:"checkFileType",value:function(e,t){var a=document.getElementById(e),l="";return a.value.lastIndexOf(".")>0&&(l=a.value.substring(a.value.lastIndexOf(".")+1,a.value.length)),l=l.toLowerCase(),!(t.split(",").indexOf(l)<0&&(a.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),a=t.toGMTString();return(t-new Date(a.substring(0,a.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var a in e)t+=''.replace("__val__",a).replace("__text__",e[a]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,a,l=0;l
  • '),s=''),r=$('
    '),c=this.getSubHeader();if(r.append(c),0===n.length)r.append(''.concat(this.getNoDataMessage(),""));else for(var u=0;u

    '.concat(this.getSubHeaderTitle(),"

    "))}}])&&o(t.prototype,a),l&&o(t,l),c}(((l=e("./AdapterBase"))&&l.__esModule?l:{default:l}).default);a.default=d},{"./AdapterBase":4}]},{},[1]); +!function e(t,a,l){function i(o,s){if(!a[o]){if(!t[o]){var r="function"==typeof require&&require;if(!s&&r)return r(o,!0);if(n)return n(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[o]={exports:{}};t[o][0].call(u.exports,(function(e){return i(t[o][1][e]||e)}),u,u.exports,e,t,a,l)}return a[o].exports}for(var n="function"==typeof require&&require,o=0;o')+this.gt("Skills")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    ').concat(nl2br(e[3]),"

    "))}}]),a}(i.default),y=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","education_id","institute","date_start","date_end"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Qualification"},{sTitle:"Institute"},{sTitle:"Start Date"},{sTitle:"Completed On"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["education_id",{label:"Qualification",type:"select2","allow-null":!1,"remote-source":["Education","id","name"]}],["institute",{label:"Institute",type:"text",validation:""}],["date_start",{label:"Start Date",type:"date",validation:"none"}],["date_end",{label:"Completed On",type:"date",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Education")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[4]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}var i="";try{i=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}return $('
    '.concat(e[2]).concat(t).concat(a,'

    Start: ').concat(l,'

    Completed: ').concat(i,'

    ')+' Institute: '.concat(e[3],"

    "))}}]),a}(i.default),b=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","certification_id","institute","date_start","date_end"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Certification"},{sTitle:"Institute"},{sTitle:"Granted On"},{sTitle:"Valid Thru"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["certification_id",{label:"Certification",type:"select2","allow-null":!1,"remote-source":["Certification","id","name"]}],["institute",{label:"Institute",type:"text",validation:""}],["date_start",{label:"Granted On",type:"date",validation:"none"}],["date_end",{label:"Valid Thru",type:"date",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Certifications")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[4]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}var i="";try{i=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log("Error:".concat(e.message))}return $('
    '.concat(e[2]).concat(t).concat(a,'

    Granted On: ').concat(l,'

    Valid Thru: ').concat(i,'

    Institute: ').concat(e[3],"

    "))}}]),a}(i.default),v=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","language_id","reading","speaking","writing","understanding"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Language"},{sTitle:"Reading"},{sTitle:"Speaking"},{sTitle:"Writing"},{sTitle:"Understanding"}]}},{key:"getFormFields",value:function(){var e=[["Elementary Proficiency","Elementary Proficiency"],["Limited Working Proficiency","Limited Working Proficiency"],["Professional Working Proficiency","Professional Working Proficiency"],["Full Professional Proficiency","Full Professional Proficiency"],["Native or Bilingual Proficiency","Native or Bilingual Proficiency"]];return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["language_id",{label:"Language",type:"select2","allow-null":!1,"remote-source":["Language","id","name"]}],["reading",{label:"Reading",type:"select",source:e}],["speaking",{label:"Speaking",type:"select",source:e}],["writing",{label:"Writing",type:"select",source:e}],["understanding",{label:"Understanding",type:"select",source:e}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Languages")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Reading: ').concat(e[3],'

    Speaking: ').concat(e[4],'

    Writing: ').concat(e[5],'

    Understanding: ').concat(e[6],"

    "))}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(i.default),g=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","name","relationship","dob","id_number"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Name"},{sTitle:"Relationship"},{sTitle:"Date of Birth"},{sTitle:"Id Number"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["relationship",{label:"Relationship",type:"select",source:[["Child","Child"],["Spouse","Spouse"],["Parent","Parent"],["Other","Other"]]}],["dob",{label:"Date of Birth",type:"date",validation:""}],["id_number",{label:"Id Number",type:"text",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Dependents")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Relationship: ').concat(e[3],'

    Name: ').concat(e[2],"

    "))}}]),a}(i.default),_=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","name","relationship","home_phone","work_phone","mobile_phone"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Name"},{sTitle:"Relationship"},{sTitle:"Home Phone"},{sTitle:"Work Phone"},{sTitle:"Mobile Phone"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["relationship",{label:"Relationship",type:"text",validation:"none"}],["home_phone",{label:"Home Phone",type:"text",validation:"none"}],["work_phone",{label:"Work Phone",type:"text",validation:"none"}],["mobile_phone",{label:"Mobile Phone",type:"text",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Emergency Contacts")}},{key:"getSubItemHtml",value:function(e,t,a){return $('
    '.concat(e[2]).concat(t).concat(a,'

    Relationship: ').concat(e[3],'

    Name: ').concat(e[2],'

    Home Phone: ').concat(e[4],'

    Mobile Phone: ').concat(e[6],"

    "))}}]),a}(i.default),k=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","employee","document","details","date_added","valid_until","status","attachment"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Document"},{sTitle:"Details"},{sTitle:"Date Added"},{sTitle:"Status"},{sTitle:"Attachment",bVisible:!1}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"hidden"}],["document",{label:"Document",type:"select2","remote-source":["Document","id","name"]}],["date_added",{label:"Date Added",type:"date",validation:""}],["valid_until",{label:"Valid Until",type:"date",validation:"none"}],["status",{label:"Status",type:"select",source:[["Active","Active"],["Inactive","Inactive"],["Draft","Draft"]]}],["details",{label:"Details",type:"textarea",validation:"none"}],["attachment",{label:"Attachment",type:"fileupload",validation:"none"}]]}},{key:"forceInjectValuesBeforeSave",value:function(e){return e.employee=this.parent.currentId,e}},{key:"getSubHeaderTitle",value:function(){return'')+this.gt("Documents")}},{key:"getSubItemHtml",value:function(e,t,a){var l="";try{l=Date.parse(e[5]).toString("MMM d, yyyy")}catch(e){console.log(e.message)}var i='');return $('
    '.concat(e[2]).concat(i).concat(t).concat(a,'

    ').concat(nl2br(e[3]),'

    Expire On: ').concat(l,"

    "))}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(i.default),S=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(l.default),w=function(e){u(a,e);var t=p(a);function a(e,l,i,n){var o;return s(this,a),(o=t.call(this,e,l,i,n)).fieldNameMap={},o.hiddenFields={},o.tableFields={},o.formOnlyFields={},o}return c(a,[{key:"setFieldNameMap",value:function(e){for(var t,a=0;a'.replace("_img_",t)}return t}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"getTableFields",value:function(){return["id","image","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"]}},{key:"getDataMapping",value:function(){for(var e=this.getTableFields(),t=[],a=0;a
    #_delete_##_edit_#Date: #_date_#
    #_note_#
    ',validation:"none","sort-function":function(e,t){return Date.parse(e.date).getTime()");return a=(a=a.replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"getHelpLink",value:function(){return"https://thilinah.gitbooks.io/icehrm-guide/content/employee-information-setup.html"}},{key:"saveSuccessItemCallback",value:function(e){this.lastSavedEmployee=e,null===this.currentId&&$("#createUserModel").modal("show")}},{key:"closeCreateUser",value:function(){$("#createUserModel").modal("hide")}},{key:"createUser",value:function(){var e={};e.employee=this.lastSavedEmployee.id,e.user_level="Employee",e.email=this.lastSavedEmployee.work_email,e.username=this.lastSavedEmployee.work_email.split("@")[0],top.location.href=this.getCustomUrl("?g=admin&n=users&m=admin_Admin&action=new&object=".concat(Base64.encodeURI(JSON.stringify(e))))}},{key:"deleteEmployee",value:function(e){if(confirm("Are you sure you want to archive this employee? Data for this employee will be saved to an archive table. But you will not be able to covert the archived employee data into a normal employee.")){var t=[];t.callBackData=[],t.callBackSuccess="deleteEmployeeSuccessCallback",t.callBackFail="deleteEmployeeFailCallback",this.customAction("deleteEmployee","admin=employees",JSON.stringify({id:e}),t)}}},{key:"deleteEmployeeSuccessCallback",value:function(e){this.showMessage("Delete Success","Employee deleted. You can find archived information for this employee in Archived Employees tab"),this.get([])}},{key:"deleteEmployeeFailCallback",value:function(e){this.showMessage("Error occurred while deleting Employee",e)}},{key:"terminateEmployee",value:function(e){if(confirm("Are you sure you want to terminate this employee contract? You will still be able to access all details of this employee.")){var t={};t.id=e;var a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="terminateEmployeeSuccessCallback",l.callBackFail="terminateEmployeeFailCallback",this.customAction("terminateEmployee","admin=employees",a,l)}}},{key:"terminateEmployeeSuccessCallback",value:function(e){this.showMessage("Success","Employee contract terminated. You can find terminated employee information under Terminated Employees menu."),this.get([])}},{key:"terminateEmployeeFailCallback",value:function(e){this.showMessage("Error occured while terminating Employee",e)}},{key:"activateEmployee",value:function(e){if(confirm("Are you sure you want to re-activate this employee contract?")){var t={};t.id=e;var a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="activateEmployeeSuccessCallback",l.callBackFail="activateEmployeeFailCallback",this.customAction("activateEmployee","admin=employees",a,l)}}},{key:"activateEmployeeSuccessCallback",value:function(e){this.showMessage("Success","Employee contract re-activated."),this.get([])}},{key:"activateEmployeeFailCallback",value:function(e){this.showMessage("Error occurred while activating Employee",e)}},{key:"view",value:function(e){this.currentId=e;var t={id:e,map:JSON.stringify(this.getSourceMapping())},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="renderEmployee",l.callBackFail="viewFailCallBack",this.customAction("get","modules=employees",a,l)}},{key:"viewFailCallBack",value:function(e){this.showMessage("Error","Error Occured while retriving candidate")}},{key:"renderEmployee",value:function(e){var t,a=this.getFormFields();e[1],e[1],e[2];e=e[0],this.currentEmployee=e;for(var l=this.getCustomTemplate("myDetails.html"),i=0;i";if($("#".concat(this.getTableName()," #subordinates")).html(o),$("#".concat(this.getTableName()," #name")).html("".concat(e.first_name," ").concat(e.last_name)),this.currentUserId=e.id,$("#".concat(this.getTableName()," #profile_image_").concat(e.id)).attr("src",e.image),void 0!==e.customFields&&null!==e.customFields&&Object.keys(e.customFields).length>0){var r;for(var c in e.customFields){e.customFields[c][1]||(e.customFields[c][1]=this.gt("Other Details"));var u=e.customFields[c][1].toLocaleLowerCase();if(u=u.replace(" ","_"),$("#cont_".concat(u)).length<=0){var d='

    #_section.name_#

    ';d=(d=d.replace("#_section_#",u)).replace("#_section.name_#",e.customFields[c][1]),$("#customFieldsCont").append($(d))}r=(r='
    ').replace("#_label_#",c),r="fileupload"===e.customFields[c][2]?r.replace("#_value_#","")):r.replace("#_value_#",e.customFields[c][0]),$("#cont_".concat(u)).append($(r))}}else $("#customFieldsCont").remove();for(var p in this.cancel(),this.isModuleInstalled("admin","documents")||$("#tabDocuments").remove(),window.modJs=this,modJs.subModJsList=[],modJs.subModJsList.tabEmployeeSkillSubTab=new h("EmployeeSkill","EmployeeSkillSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeSkillSubTab.parent=this,modJs.subModJsList.tabEmployeeEducationSubTab=new y("EmployeeEducation","EmployeeEducationSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeEducationSubTab.parent=this,modJs.subModJsList.tabEmployeeCertificationSubTab=new b("EmployeeCertification","EmployeeCertificationSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeCertificationSubTab.parent=this,modJs.subModJsList.tabEmployeeLanguageSubTab=new v("EmployeeLanguage","EmployeeLanguageSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeLanguageSubTab.parent=this,modJs.subModJsList.tabEmployeeDependentSubTab=new g("EmployeeDependent","EmployeeDependentSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeDependentSubTab.parent=this,modJs.subModJsList.tabEmployeeEmergencyContactSubTab=new _("EmergencyContact","EmployeeEmergencyContactSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.parent=this,this.isModuleInstalled("admin","documents")&&(modJs.subModJsList.tabEmployeeDocumentSubTab=new k("EmployeeDocument","EmployeeDocumentSubTab",{employee:e.id}),modJs.subModJsList.tabEmployeeDocumentSubTab.parent=this),modJs.subModJsList)modJs.subModJsList.hasOwnProperty(p)&&(modJs.subModJsList[p].setTranslationsSubModules(this.translations),modJs.subModJsList[p].setPermissions(this.permissions),modJs.subModJsList[p].setFieldTemplates(this.fieldTemplates),modJs.subModJsList[p].setTemplates(this.templates),modJs.subModJsList[p].setCustomTemplates(this.customTemplates),modJs.subModJsList[p].setEmailTemplates(this.emailTemplates),modJs.subModJsList[p].setUser(this.user),modJs.subModJsList[p].initFieldMasterData(),modJs.subModJsList[p].setBaseUrl(this.baseUrl),modJs.subModJsList[p].setCurrentProfile(this.currentProfile),modJs.subModJsList[p].setInstanceId(this.instanceId),modJs.subModJsList[p].setGoogleAnalytics(ga),modJs.subModJsList[p].setNoJSONRequests(this.noJSONRequests));modJs.subModJsList.tabEmployeeSkillSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeSkillSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeSkillSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeSkillSubTab.get([]),modJs.subModJsList.tabEmployeeEducationSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeEducationSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeEducationSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeEducationSubTab.get([]),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeCertificationSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeCertificationSubTab.get([]),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeLanguageSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeLanguageSubTab.get([]),modJs.subModJsList.tabEmployeeDependentSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeDependentSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeDependentSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeDependentSubTab.get([]),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeEmergencyContactSubTab.get([]),this.isModuleInstalled("admin","documents")&&(modJs.subModJsList.tabEmployeeDocumentSubTab.setShowFormOnPopup(!0),modJs.subModJsList.tabEmployeeDocumentSubTab.setShowAddNew(!1),modJs.subModJsList.tabEmployeeDocumentSubTab.setShowCancel(!1),modJs.subModJsList.tabEmployeeDocumentSubTab.get([])),$("#subModTab a").off().on("click",(function(e){e.preventDefault(),$(this).tab("show")}))}},{key:"deleteProfileImage",value:function(e){var t={id:e},a=JSON.stringify(t),l=[];l.callBackData=[],l.callBackSuccess="modEmployeeDeleteProfileImageCallBack",l.callBackFail="modEmployeeDeleteProfileImageCallBack",this.customAction("deleteProfileImage","modules=employees",a,l)}},{key:"modEmployeeDeleteProfileImageCallBack",value:function(e){}}]),a}(S),E=function(e){u(a,e);var t=p(a);function a(){return s(this,a),t.apply(this,arguments)}return c(a,[{key:"getDataMapping",value:function(){return["id","image","employee_id","first_name","last_name","mobile_phone","department","gender","supervisor"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID"},{sTitle:"",bSortable:!1},{sTitle:"Employee Number"},{sTitle:"First Name"},{sTitle:"Last Name"},{sTitle:"Mobile"},{sTitle:"Department"},{sTitle:"Gender"},{sTitle:"Supervisor"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden",validation:""}],["employee_id",{label:"Employee Number",type:"text",validation:""}],["first_name",{label:"First Name",type:"text",validation:""}],["middle_name",{label:"Middle Name",type:"text",validation:"none"}],["last_name",{label:"Last Name",type:"text",validation:""}],["nationality",{label:"Nationality",type:"select2","remote-source":["Nationality","id","name"]}],["birthday",{label:"Date of Birth",type:"date",validation:""}],["gender",{label:"Gender",type:"select",source:[["Male","Male"],["Female","Female"],["Divers","Divers"]]}],["marital_status",{label:"Marital Status",type:"select",source:[["Married","Married"],["Single","Single"],["Divorced","Divorced"],["Widowed","Widowed"],["Other","Other"]]}],["ssn_num",{label:"SSN/NRIC",type:"text",validation:"none"}],["nic_num",{label:"NIC",type:"text",validation:"none"}],["other_id",{label:"Other ID",type:"text",validation:"none"}],["driving_license",{label:"Driving License No",type:"text",validation:"none"}],["employment_status",{label:"Employment Status",type:"select2","remote-source":["EmploymentStatus","id","name"]}],["job_title",{label:"Job Title",type:"select2","remote-source":["JobTitle","id","name"]}],["pay_grade",{label:"Pay Grade",type:"select2","allow-null":!0,"remote-source":["PayGrade","id","name"]}],["work_station_id",{label:"Work Station Id",type:"text",validation:"none"}],["address1",{label:"Address Line 1",type:"text",validation:"none"}],["address2",{label:"Address Line 2",type:"text",validation:"none"}],["city",{label:"City",type:"text",validation:"none"}],["country",{label:"Country",type:"select2","remote-source":["Country","code","name"]}],["province",{label:"Province",type:"select2","allow-null":!0,"remote-source":["Province","id","name"]}],["postal_code",{label:"Postal/Zip Code",type:"text",validation:"none"}],["home_phone",{label:"Home Phone",type:"text",validation:"none"}],["mobile_phone",{label:"Mobile Phone",type:"text",validation:"none"}],["work_phone",{label:"Work Phone",type:"text",validation:"none"}],["work_email",{label:"Work Email",type:"text",validation:"emailOrEmpty"}],["private_email",{label:"Private Email",type:"text",validation:"emailOrEmpty"}],["joined_date",{label:"Joined Date",type:"date",validation:""}],["confirmation_date",{label:"Confirmation Date",type:"date",validation:"none"}],["termination_date",{label:"Termination Date",type:"date",validation:"none"}],["department",{label:"Department",type:"select2","remote-source":["CompanyStructure","id","title"]}],["supervisor",{label:"Supervisor",type:"select2","allow-null":!0,"remote-source":["Employee","id","first_name+last_name"]}],["notes",{label:"Notes",type:"datagroup",form:[["note",{label:"Note",type:"textarea",validation:""}]],html:'
    #_delete_##_edit_#Date: #_date_#
    #_note_#
    ',validation:"none","sort-function":function(e,t){return Date.parse(e.date).getTime()';return a=(a=(a=a.replace(/_id_/g,e)).replace(/_attachment_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"isSubProfileTable",value:function(){return"Admin"!==this.user.user_level&&"Restricted Admin"!==this.user.user_level}}]),a}(l.default);t.exports={EmployeeAdapter:w,TerminatedEmployeeAdapter:E,ArchivedEmployeeAdapter:T,EmployeeSkillAdapter:D,EmployeeEducationAdapter:F,EmployeeCertificationAdapter:M,EmployeeLanguageAdapter:A,EmployeeDependentAdapter:C,EmergencyContactAdapter:J,EmployeeImmigrationAdapter:N,EmployeeSubSkillsAdapter:h,EmployeeSubEducationAdapter:y,EmployeeSubCertificationAdapter:b,EmployeeSubLanguageAdapter:v,EmployeeSubDependentAdapter:g,EmployeeSubEmergencyContactAdapter:_,EmployeeSubDocumentAdapter:k,EmployeeDocumentAdapter:B}},{"../../../api/AdapterBase":4,"../../../api/SubAdapterBase":7}],3:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var a=0;a0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var s=0;s')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
    '.concat(e,"
    ")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,s="",r=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,r)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u');r.attr("id",s),r.html(t),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.showDomElement("Edit",r,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var a,l=this.templates.formTemplate,i="",n=this.getFormFields(),o=0;o')).attr("id",c):a=$("#".concat(this.getTableName(),"Form")),a.html(l),a.find(".datefield").datepicker({viewMode:2}),a.find(".timefield").datetimepicker({language:"en",pickDate:!1}),a.find(".datetimefield").datetimepicker({language:"en"}),a.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(a.attr("id")," .tinymce"),height:"400"}),a.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&a.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),a.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),a.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),a.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,l.id),l)void 0!==(n=l[u])&&null!=n&&"string"==typeof n&&(n=n.replace(/(?:\r\n|\r|\n)/g,"
    ")),a=a.replace("#_".concat(u,"_#"),n);void 0!==t[1].render&&null!=t[1].render&&(a=a.replace("#_renderFunction_#",t[1].render(l))),(i=$(a)).attr("fieldId","".concat(t[0],"_div")),r.append(i)}return r}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var a=this.templates.datagroupTemplate,l="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var n=0;n');s.attr("id",o),s.html(a),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),s,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var a=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[l])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;l=e.params}var n=$("#".concat(t[0])).val();""===n&&(n="[]");var o=JSON.parse(n);l.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(l),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),n=JSON.stringify(o);var s=this.dataGroupToHtml(n,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(s),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(n),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var a="";try{for(var l=e.split(" "),i=0,n=0;nt?(a+="".concat(l[n],"
    "),i=0):a+="".concat(l[n]," ")}catch(e){}return a}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var a=$(e.target);if(!/html|body/i.test(a.offsetParent()[0].tagName)){var l=e.pageY-a.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(l,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,a=[],l=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var n=JSON.parse(i);l.each((function(){for(var e in t=$(this).attr("id"),n)if(n[e].id===t){a.push(n[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(a))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,a=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var n=e[1]["custom-validate-function"].apply(this,[l]);if(!n.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(n.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;l=n.params}if(this.doCustomFilterValidation(l)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var s=JSON.parse(o),r={},c=-1,u=[],d=0;d=a&&(a=parseInt(t,10)+1)}return a}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i=[],n=0;n")}catch(e){}if(void 0!==a[i][1].formatter&&a[i][1].formatter&&$.isFunction(a[i][1].formatter))try{l=a[i][1].formatter(l)}catch(e){}$("".concat(t," #").concat(a[i][0])).html(l)}else if("fileupload"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&""!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).attr("val",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).show(),$("".concat(t," #").concat(a[i][0],"_download")).show(),$("".concat(t," #").concat(a[i][0],"_remove")).show()),!0===a[i][1].readonly&&$("".concat(t," #").concat(a[i][0],"_upload")).remove();else if("select"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]);else if("select2"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).select2("val",e[a[i][0]]);else if("select2multi"===a[i][1].type){void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL");var c=[];if(void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]])try{c=JSON.parse(e[a[i][0]])}catch(e){}$("".concat(t," #").concat(a[i][0])).select2("val",c);var u=$("".concat(t," #").concat(a[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(a[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(a[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===a[i][1].type)try{var d=this.dataGroupToHtml(e[a[i][0]],a[i]);$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]),$("".concat(t," #").concat(a[i][0],"_div")).html(""),$("".concat(t," #").concat(a[i][0],"_div")).append(d),this.makeDataGroupSortable(a[i],$("".concat(t," #").concat(a[i][0],"_div_inner")))}catch(e){}else if("signature"===a[i][1].type)""===e[a[i][0]]&&void 0===e[a[i][0]]&&null==e[a[i][0]]||$("".concat(t," #").concat(a[i][0])).data("signaturePad").fromDataURL(e[a[i][0]]);else if("simplemde"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).data("simplemde").value(e[a[i][0]]);else if("code"===a[i][1].type){var p=$("".concat(t," #").concat(a[i][0])).data("codemirror");p&&p.getDoc().setValue(e[a[i][0]])}else $("".concat(t," #").concat(a[i][0])).val(e[a[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var a=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)a=a.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var l="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);a=a.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[l],e))}}else if("colorpick"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,a=(a=a.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),a=(a=void 0!==e[1].filetypes&&null!=e[1].filetypes?a.replace(/_filetypes_/g,e[1].filetypes):a.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return a=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?a.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):a.replace(/_validation_/g,""),a=void 0!==e[1].help&&null!==e[1].help?(a=a.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(a=a.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),a=void 0!==e[1].placeholder&&null!==e[1].placeholder?a.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):a.replace(/_placeholder_/g,""),a=void 0!==e[1].mask&&null!==e[1].mask?a.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):a.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var a="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push(e[i]);!0===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=r=(r=r.replace("_id_",o)).replace("_val_",this.gt(s))}return a}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var a="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='"):a+='');var l=[];for(var i in e)l.push([i,e[i]]);"true"===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n_val_';a+=r=(r=r.replace("_id_",o)).replace("_val_",this.gt(s))}return a}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var a='
    _edit__delete__clone_
    ';return a=this.showAddNew?a.replace("_clone_",''):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",''):a.replace("_delete_",""),a=(a=(a=this.showEdit?a.replace("_edit_",''):a.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l="",i=e;i>0;--i)l+=a[Math.round(Math.random()*(a.length-1))];return l+t.getTime()}},{key:"checkFileType",value:function(e,t){var a=document.getElementById(e),l="";return a.value.lastIndexOf(".")>0&&(l=a.value.substring(a.value.lastIndexOf(".")+1,a.value.length)),l=l.toLowerCase(),!(t.split(",").indexOf(l)<0&&(a.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),a=t.toGMTString();return(t-new Date(a.substring(0,a.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var a in e)t+=''.replace("__val__",a).replace("__text__",e[a]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,a,l=0;l
  • '),s=''),r=$('
    '),c=this.getSubHeader();if(r.append(c),0===n.length)r.append(''.concat(this.getNoDataMessage(),""));else for(var u=0;u

    '.concat(this.getSubHeaderTitle(),"

    "))}}])&&o(t.prototype,a),l&&o(t,l),c}(((l=e("./AdapterBase"))&&l.__esModule?l:{default:l}).default);a.default=d},{"./AdapterBase":4}]},{},[1]); //# sourceMappingURL=employees.js.map diff --git a/web/admin/dist/payroll.js b/web/admin/dist/payroll.js index 19eca37b..22c14d74 100644 --- a/web/admin/dist/payroll.js +++ b/web/admin/dist/payroll.js @@ -1,2 +1,2 @@ -!function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a')).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"getActionButtonHeader",value:function(){return{sTitle:'',sClass:"center"}}}]),n}(r.default),y=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","pay_period","department","date_start","date_end","status"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Pay Frequency"},{sTitle:"Department"},{sTitle:"Date Start"},{sTitle:"Date End"},{sTitle:"Status"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text"}],["pay_period",{label:"Pay Frequency",type:"select","remote-source":["PayFrequency","id","name"],sort:"none"}],["deduction_group",{label:"Payroll Group",type:"select","remote-source":["DeductionGroup","id","name"],sort:"none"}],["payslipTemplate",{label:"Payslip Template",type:"select","remote-source":["PayslipTemplate","id","name"]}],["department",{label:"Department",type:"select2","remote-source":["CompanyStructure","id","title"],sort:"none"}],["date_start",{label:"Start Date",type:"date",validation:""}],["date_end",{label:"End Date",type:"date",validation:""}],["columns",{label:"Payroll Columns",type:"select2multi","remote-source":["PayrollColumn","id","name"]}],["status",{label:"Status",type:"select",source:[["Draft","Draft"],["Completed","Completed"]],sort:"none"}]]}},{key:"postRenderForm",value:function(e,t){null!=e&&void 0!==e&&void 0!==e.id&&null!=e.id&&(t.find("#pay_period").attr("disabled","disabled"),t.find("#department").attr("disabled","disabled"))}},{key:"process",value:function(e,t){modJs=modJsList.tabPayrollData,modJs.setCurrentPayroll(e),$("#Payroll").hide(),$("#PayrollData").show(),$("#PayrollDataButtons").show(),"Completed"===t?($(".completeBtnTable").hide(),$(".saveBtnTable").hide()):($(".completeBtnTable").show(),$(".saveBtnTable").show()),modJs.get([])}},{key:"getActionButtonsHtml",value:function(e,t){var n='
    _edit__process__clone__delete_
    ';return n=this.showAddNew?n.replace("_clone_",''):n.replace("_clone_",""),n=this.showDelete?n.replace("_delete_",''):n.replace("_delete_",""),n=(n=(n=(n=(n=this.showEdit?n.replace("_edit_",''):n.replace("_edit_","")).replace("_process_",'')).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"get",value:function(e){$("#PayrollData").hide(),$("#PayrollForm").hide(),$("#PayrollDataButtons").hide(),$("#Payroll").show(),modJsList.tabPayrollData.setCurrentPayroll(null),u(m(n.prototype),"get",this).call(this,e)}},{key:"getHelpLink",value:function(){return"https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management"}}]),n}(r.default),b=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var a;return l(this,n),(a=t.call(this,e,r,i,o)).cellDataUpdates={},a.payrollId=null,a}return c(n,[{key:"validateCellValue",value:function(e,t,n){return modJs.addCellDataUpdate(e.data("colId"),e.data("rowId"),n),!0}},{key:"setCurrentPayroll",value:function(e){this.payrollId=e}},{key:"addAdditionalRequestData",value:function(e,t){return("updateData"===e||"updateAllData"===e||"getAllData"===e)&&(t.payrollId=this.payrollId),t}},{key:"modifyCSVHeader",value:function(e){return e.unshift(""),e}},{key:"getCSVData",value:function(){for(var e="",t=0;t#_delete_##_edit_#
    #_renderFunction_#
    ',validation:"none",render:function(e){return"Variable:".concat(e.name)}}],["function_type",{label:"Function Type",type:"select",source:[["Advanced","Advanced"],["Simple","Simple"]]}],["calculation_function",{label:"Function",type:"code",validation:"none"}]]}},{key:"getFilters",value:function(){return[["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!1,"remote-source":["DeductionGroup","id","name"]}]]}},{key:"getHelpLink",value:function(){return"https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management"}}]),n}(r.default),k=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!0},{sTitle:"Name"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["columns",{label:"Payroll Columns",type:"select2multi","remote-source":["PayrollColumn","id","name"]}]]}}]),n}(r.default),x=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","employee","pay_frequency","deduction_group","currency"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Pay Frequency"},{sTitle:"Payroll Group"},{sTitle:"Currency"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"select2","remote-source":["Employee","id","first_name+last_name"]}],["pay_frequency",{label:"Pay Frequency",type:"select2","remote-source":["PayFrequency","id","name"]}],["currency",{label:"Currency",type:"select2","remote-source":["CurrencyType","id","code"]}],["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!0,"null-label":"None","remote-source":["DeductionGroup","id","name"]}],["deduction_exemptions",{label:"Calculation Exemptions",type:"select2multi","remote-source":["Deduction","id","name"],validation:"none"}],["deduction_allowed",{label:"Calculations Assigned",type:"select2multi","remote-source":["Deduction","id","name"],validation:"none"}]]}},{key:"getFilters",value:function(){return[["employee",{label:"Employee",type:"select2","remote-source":["Employee","id","first_name+last_name"]}]]}}]),n}(r.default),C=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","deduction_group"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Payroll Group"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["componentType",{label:"Salary Component Type",type:"select2multi","allow-null":!0,"remote-source":["SalaryComponentType","id","name"]}],["component",{label:"Salary Component",type:"select2multi","allow-null":!0,"remote-source":["SalaryComponent","id","name"]}],["payrollColumn",{label:"Payroll Report Column",type:"select2","allow-null":!0,"remote-source":["PayrollColumn","id","name"]}],["rangeAmounts",{label:"Calculation Process",type:"datagroup",form:[["lowerCondition",{label:"Lower Limit Condition",type:"select",source:[["No Lower Limit","No Lower Limit"],["gt","Greater than"],["gte","Greater than or Equal"]]}],["lowerLimit",{label:"Lower Limit",type:"text",validation:"float"}],["upperCondition",{label:"Upper Limit Condition",type:"select",source:[["No Upper Limit","No Upper Limit"],["lt","Less than"],["lte","Less than or Equal"]]}],["upperLimit",{label:"Upper Limit",type:"text",validation:"float"}],["amount",{label:"Value",type:"text",validation:""}]],html:'
    #_delete_##_edit_#
    #_renderFunction_#
    ',validation:"none","custom-validate-function":function(e){var t={valid:!0};return"No Lower Limit"===e.lowerCondition&&(e.lowerLimit=0),"No Upper Limit"===e.upperCondition&&(e.upperLimit=0),t.params=e,t},render:function(e){var t="",n=function(e){var t={gt:">",gte:">=",lt:"<",lte:"<="};return t[e]};return"No Lower Limit"!==e.lowerCondition&&(t+="".concat(e.lowerLimit," ").concat(n(e.lowerCondition)," ")),"No Upper Limit"!==e.upperCondition&&(t+=" and ",t+="".concat(n(e.upperCondition)," ").concat(e.upperLimit," ")),""===t?"Deduction is ".concat(e.amount," for all ranges"):"If salary component ".concat(t," deduction is ").concat(e.amount)}}],["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!1,"remote-source":["DeductionGroup","id","name"]}]]}}]),n}(r.default),S=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","description"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Details"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["description",{label:"Details",type:"textarea",validation:"none"}]]}},{key:"getActionButtonsHtml",value:function(e){var t='
    ';return t=(t=t.replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"deletePayrollGroup",value:function(e){if(confirm("Are you sure you want to delete this payroll group? Deleting the payroll group will delete all the Payroll columns and Saved calculations attached to this Payroll Group")){var t={};t.id=e;var n=JSON.stringify(t),r=[];r.callBackData=[],r.callBackSuccess="deletePayrollGroupSuccessCallback",r.callBackFail="deletePayrollGroupFailCallback",this.customAction("deletePayrollGroup","admin=payroll",n,r)}}},{key:"deletePayrollGroupSuccessCallback",value:function(e){this.showMessage("Success","Payroll Group Deleted "),this.get([])}},{key:"deletePayrollGroupFailCallback",value:function(e){this.showMessage("Error occured while deleting Payroll Group",e)}}]),n}(r.default),T=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["data",{label:"Payslip Fields",type:"datagroup",form:[["type",{label:"Type",type:"select",sort:"none",source:[["Payroll Column","Payroll Column"],["Text","Text"],["Company Name","Company Name"],["Company Logo","Company Logo"],["Separators","Separators"]]}],["payrollColumn",{label:"Payroll Column",type:"select2",sort:"none","allow-null":!0,"null-label":"None","remote-source":["PayrollColumn","id","name"]}],["label",{label:"Label",type:"text",validation:"none"}],["text",{label:"Text",type:"textarea",validation:"none"}],["status",{label:"Status",type:"select",sort:"none",source:[["Show","Show"],["Hide","Hide"]]}]],html:'
    #_delete_##_edit_#
    #_type_# #_label_#
    #_text_#
    ',validation:"none","custom-validate-function":function(e){var t={valid:!0};return"Payroll Column"===e.type?"NULL"===e.payrollColumn&&(t.valid=!1,t.message="Please select payroll column"):e.payrollColumn="NULL","Text"===e.type&&""===e.text&&(t.valid=!1,t.message="Text can not be empty"),t.params=e,t}}]]}}]),n}(r.default);t.exports={PaydayAdapter:g,PayrollAdapter:y,PayrollDataAdapter:b,PayrollColumnAdapter:w,PayrollColumnTemplateAdapter:k,PayrollEmployeeAdapter:x,DeductionAdapter:C,DeductionGroupAdapter:S,PayslipTemplateAdapter:T}},{"../../../api/AdapterBase":4,"../../../api/TableEditAdapter":7,codemirror:10,"codemirror/addon/display/autorefresh":8,"codemirror/addon/edit/closebrackets":9,"codemirror/mode/javascript/javascript":11}],3:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var n=localStorage.getItem(e);return void 0!==n&&null!=n&&""!==n?void 0===(t=JSON.parse(n))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var n=JSON.stringify(t);return localStorage.setItem(e,n),n}}])&&r(t.prototype,n),i&&r(t,i),e}();n.default=i},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./ModuleBase")),i=o(e("../api-common/RequestCache"));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n0}},o=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=n,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,r),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,n,o;return t=e,n=[{key:"clearError",value:function(e,t){var n=e.attr("id");$("#".concat(this.formId," #field_").concat(n)).removeClass("error"),$("#".concat(this.formId," #help_").concat(n)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var n=e.attr("id"),r=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(n)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(n)).html(i):void 0===r||null==r||""===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Required"):"float"===r||"number"===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Number required"):"email"===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(n)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var n=function(e){var n=null,r=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(r,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),o=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(o,t.inputTypes)>=0){if(e.hasClass("uploadInput"))n=e.attr("val");else if("radio"===o||"checkbox"===o)n=$("input[name='".concat(r,"']:checked")).val();else if(e.hasClass("select2Field"))n=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var a=$("#".concat(t.formId," #").concat(i)).select2("data");n=[];for(var l=0;l')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
    '.concat(e,"
    ")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var n in t)t[n].sTitle=this.gt(t[n].sTitle);var r,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var o=0;o")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(n)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=this,a="";a=i?"#plainMessageModel":"#messageModel",$(a).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=n?($(a).modal({show:!0}),$(a).on("hidden.bs.modal",(function(){n.apply(o,r),$(".modal-backdrop").remove()}))):$(a).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,n,r,i){var o=this,a="";a=i?"#dataMessageModel":"#messageModel",$(a).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=n?($(a).modal({show:!0}),$(a).on("hidden.bs.modal",(function(){n.apply(o,r),$(".modal-backdrop").remove()}))):$(a).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var n=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();r=this.forceInjectValuesBeforeSave(r);var o=this.doCustomValidation(r);if(null==o){this.csrfRequired&&(r.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var a=$("#".concat(this.getTableName(),"_submit #id")).val();null!=a&&void 0!==a&&""!==a&&(r.id=a),r=this.makeEmptyDateFieldsNull(r),this.add(r,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(o),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var n in t)t.hasOwnProperty(n)&&"NULL"===t[n]&&delete t[n];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,n,r,i,o,a,l="",s=this.getFilters();for(var c in null==r&&(r=[]),e)if(e.hasOwnProperty(c)){if(o="",a=null,"select"===(r=this.getMetaFieldValues(c,s)).type||"select2"===r.type){if(void 0!==r["remote-source"]&&null!=r["remote-source"])t=r["remote-source"],"NULL"===e[c]?o=void 0!==r["null-label"]&&null!=r["null-label"]?r["null-label"]:"Not Selected":a=o=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(n=r.source[0],"NULL"===e[c])o=void 0!==r["null-label"]&&null!=r["null-label"]?r["null-label"]:"Not Selected";else for(var u=0;u');s.attr("id",l),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var n,r=this.templates.formTemplate,i="",o=this.getFormFields(),a=0;a')).attr("id",c):n=$("#".concat(this.getTableName(),"Form")),n.html(r),n.find(".datefield").datepicker({viewMode:2}),n.find(".timefield").datetimepicker({language:"en",pickDate:!1}),n.find(".datetimefield").datetimepicker({language:"en"}),n.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(n.attr("id")," .tinymce"),height:"400"}),n.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&n.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),n.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),n.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),n.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,r.id),r)void 0!==(o=r[u])&&null!=o&&"string"==typeof o&&(o=o.replace(/(?:\r\n|\r|\n)/g,"
    ")),n=n.replace("#_".concat(u,"_#"),o);void 0!==t[1].render&&null!=t[1].render&&(n=n.replace("#_renderFunction_#",t[1].render(r))),(i=$(n)).attr("fieldId","".concat(t[0],"_div")),s.append(i)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var n=this.templates.datagroupTemplate,r="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var o=0;o');l.attr("id",a),l.html(n),l.find(".datefield").datepicker({viewMode:2}),l.find(".timefield").datetimepicker({language:"en",pickDate:!1}),l.find(".datetimefield").datetimepicker({language:"en"}),l.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(l.attr("id")," .tinymce"),height:"400"}),l.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),l.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),l.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),l,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var n=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[r])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;r=e.params}var o=$("#".concat(t[0])).val();""===o&&(o="[]");var a=JSON.parse(o);r.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(a)),a.push(r),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&a.sort(t[1]["sort-function"]),o=JSON.stringify(a);var l=this.dataGroupToHtml(o,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(l),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(o),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var n="";try{for(var r=e.split(" "),i=0,o=0;ot?(n+="".concat(r[o],"
    "),i=0):n+="".concat(r[o]," ")}catch(e){}return n}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var n=$(e.target);if(!/html|body/i.test(n.offsetParent()[0].tagName)){var r=e.pageY-n.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(r,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,n=[],r=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var o=JSON.parse(i);r.each((function(){for(var e in t=$(this).attr("id"),o)if(o[e].id===t){n.push(o[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(n))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,n=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var o=e[1]["custom-validate-function"].apply(this,[r]);if(!o.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(o.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;r=o.params}if(this.doCustomFilterValidation(r)){var a=$("#".concat(e[0])).val();""===a&&(a="[]");for(var l=JSON.parse(a),s={},c=-1,u=[],d=0;d=n&&(n=parseInt(t,10)+1)}return n}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),n=$("#".concat(t)).val(),r=JSON.parse(n),i=[],o=0;o")}catch(e){}if(void 0!==n[i][1].formatter&&n[i][1].formatter&&$.isFunction(n[i][1].formatter))try{r=n[i][1].formatter(r)}catch(e){}$("".concat(t," #").concat(n[i][0])).html(r)}else if("fileupload"===n[i][1].type)null!=e[n[i][0]]&&void 0!==e[n[i][0]]&&""!==e[n[i][0]]&&($("".concat(t," #").concat(n[i][0])).html(e[n[i][0]]),$("".concat(t," #").concat(n[i][0])).attr("val",e[n[i][0]]),$("".concat(t," #").concat(n[i][0])).show(),$("".concat(t," #").concat(n[i][0],"_download")).show(),$("".concat(t," #").concat(n[i][0],"_remove")).show()),!0===n[i][1].readonly&&$("".concat(t," #").concat(n[i][0],"_upload")).remove();else if("select"===n[i][1].type)void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL"),$("".concat(t," #").concat(n[i][0])).val(e[n[i][0]]);else if("select2"===n[i][1].type)void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL"),$("".concat(t," #").concat(n[i][0])).select2("val",e[n[i][0]]);else if("select2multi"===n[i][1].type){void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL");var c=[];if(void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]])try{c=JSON.parse(e[n[i][0]])}catch(e){}$("".concat(t," #").concat(n[i][0])).select2("val",c);var u=$("".concat(t," #").concat(n[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(n[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(n[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===n[i][1].type)try{var d=this.dataGroupToHtml(e[n[i][0]],n[i]);$("".concat(t," #").concat(n[i][0])).val(e[n[i][0]]),$("".concat(t," #").concat(n[i][0],"_div")).html(""),$("".concat(t," #").concat(n[i][0],"_div")).append(d),this.makeDataGroupSortable(n[i],$("".concat(t," #").concat(n[i][0],"_div_inner")))}catch(e){}else if("signature"===n[i][1].type)""===e[n[i][0]]&&void 0===e[n[i][0]]&&null==e[n[i][0]]||$("".concat(t," #").concat(n[i][0])).data("signaturePad").fromDataURL(e[n[i][0]]);else if("simplemde"===n[i][1].type)$("".concat(t," #").concat(n[i][0])).data("simplemde").value(e[n[i][0]]);else if("code"===n[i][1].type){var f=$("".concat(t," #").concat(n[i][0])).data("codemirror");f&&f.getDoc().setValue(e[n[i][0]])}else $("".concat(t," #").concat(n[i][0])).val(e[n[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var n=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)n=n.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var r="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);n=n.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[r],e))}}else if("colorpick"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,n=(n=n.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),n=(n=void 0!==e[1].filetypes&&null!=e[1].filetypes?n.replace(/_filetypes_/g,e[1].filetypes):n.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return n=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?n.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):n.replace(/_validation_/g,""),n=void 0!==e[1].help&&null!==e[1].help?(n=n.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(n=n.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),n=void 0!==e[1].placeholder&&null!==e[1].placeholder?n.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):n.replace(/_placeholder_/g,""),n=void 0!==e[1].mask&&null!==e[1].mask?n.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):n.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var n="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?n+='"):n+='');var r=[];for(var i in e)r.push(e[i]);!0===t[1].sort&&r.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var o=0;o_val_';n+=s=(s=s.replace("_id_",a)).replace("_val_",this.gt(l))}return n}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var n="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?n+='"):n+='');var r=[];for(var i in e)r.push([i,e[i]]);"true"===t[1].sort&&r.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var o=0;o_val_';n+=s=(s=s.replace("_id_",a)).replace("_val_",this.gt(l))}return n}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var n='
    _edit__delete__clone_
    ';return n=this.showAddNew?n.replace("_clone_",''):n.replace("_clone_",""),n=this.showDelete?n.replace("_delete_",''):n.replace("_delete_",""),n=(n=(n=this.showEdit?n.replace("_edit_",''):n.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="",i=e;i>0;--i)r+=n[Math.round(Math.random()*(n.length-1))];return r+t.getTime()}},{key:"checkFileType",value:function(e,t){var n=document.getElementById(e),r="";return n.value.lastIndexOf(".")>0&&(r=n.value.substring(n.value.lastIndexOf(".")+1,n.value.length)),r=r.toLowerCase(),!(t.split(",").indexOf(r)<0&&(n.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),n=t.toGMTString();return(t-new Date(n.substring(0,n.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var n in e)t+=''.replace("__val__",n).replace("__text__",e[n]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,n,r=0;r
    ');var o=$("#".concat(e," .dataTables_paginate .active a")).html(),a=0;void 0!==o&&null!=o&&(a=15*parseInt(o,10)-15),$("#".concat(e)).html(t);var l={oLanguage:{sLengthMenu:"_MENU_ records per page"},aaData:n,aoColumns:r,bSort:!1,iDisplayLength:15,iDisplayStart:a},s=this.getCustomTableParams();$.extend(l,s),$("#".concat(e," #grid")).dataTable(l),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$("#".concat(e," #grid")).editableTableWidget(),$("#".concat(e," #grid .editcell")).on("validate",(function(e,t){return modJs.validateCellValue($(this),e,t)})),this.afterCreateTable(e)}},{key:"afterCreateTable",value:function(e){}},{key:"addCellDataUpdate",value:function(e,t,n){this.cellDataUpdates["".concat(e,"=").concat(t)]=[e,t,n]}},{key:"addAdditionalRequestData",value:function(e,t){return t}},{key:"sendCellDataUpdates",value:function(){var e=this.cellDataUpdates;e.rowTable=this.rowTable,e.columnTable=this.columnTable,e.valueTable=this.valueTable,e=this.addAdditionalRequestData("updateData",e);var t=JSON.stringify(e),n=[];n.callBackData=[],n.callBackSuccess="updateDataSuccessCallBack",n.callBackFail="updateDataFailCallBack",this.showLoader(),this.customAction("updateData",this.modulePath,t,n)}},{key:"updateDataSuccessCallBack",value:function(e,t){this.hideLoader(),modJs.cellDataUpdates={},modJs.get()}},{key:"updateDataFailCallBack",value:function(e,t){this.hideLoader()}},{key:"sendAllCellDataUpdates",value:function(){var e=this.cellDataUpdates;e.rowTable=this.rowTable,e.columnTable=this.columnTable,e.valueTable=this.valueTable,e=this.addAdditionalRequestData("updateAllData",e);var t=JSON.stringify(e),n=[];n.callBackData=[],n.callBackSuccess="updateDataAllSuccessCallBack",n.callBackFail="updateDataAllFailCallBack",this.showLoader(),this.customAction("updateAllData",this.modulePath,t,n)}},{key:"updateDataAllSuccessCallBack",value:function(e,t){this.hideLoader(),modJs.cellDataUpdates={},modJs.getAllData(!0)}},{key:"updateDataAllFailCallBack",value:function(e,t){this.hideLoader()}},{key:"showActionButtons",value:function(){return!1}}])&&o(t.prototype,n),r&&o(t,r),s}(((r=e("./AdapterBase"))&&r.__esModule?r:{default:r}).default);n.default=u},{"./AdapterBase":4}],8:[function(e,t,n){var r;r=function(e){"use strict";function t(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,(function(n,r){n.state.autoRefresh&&(t(0,n.state.autoRefresh),n.state.autoRefresh=null),r&&0==n.display.wrapper.offsetHeight&&function(n,r){function i(){n.display.wrapper.offsetHeight?(t(0,r),n.display.lastWrapHeight!=n.display.wrapper.clientHeight&&n.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},e.on(window,"mouseup",r.hurry),e.on(window,"keyup",r.hurry)}(n,n.state.autoRefresh={delay:r.delay||250})}))},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}],9:[function(e,t,n){var r;r=function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,a){a&&a!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))}));var i={Backspace:function(t){var i=l(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var o=r(i,"pairs"),a=t.listSelections(),c=0;c=0;c--){var d=a[c].head;t.replaceRange("",n(d.line,d.ch-1),n(d.line,d.ch+1),"+delete")}},Enter:function(t){var n=l(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),a=0;a1&&f.indexOf(i)>=0&&t.getRange(n(b.line,b.ch-2),b)==i+i){if(b.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(b.line,b.ch-2))))return e.Pass;g="addFour"}else if(h){var k=0==b.ch?" ":t.getRange(n(b.line,b.ch-1),b);if(e.isWordChar(w)||k==i||e.isWordChar(k))return e.Pass;g="both"}else{if(!m||!(0===w.length||/\s/.test(w)||d.indexOf(w)>-1))return e.Pass;g="both"}else g=h&&c(t,b)?"both":f.indexOf(i)>=0&&t.getRange(b,n(b.line,b.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=g)return e.Pass}else u=g}var x=s%2?a.charAt(s-1):i,C=s%2?i:a.charAt(s+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var i=t.getSelections();for(r=0;r0,{anchor:new n(o.anchor.line,o.anchor.ch+(a?-1:1)),head:new n(o.head.line,o.head.ch+(a?1:-1))});t.setSelections(i)}else"both"==u?(t.replaceSelection(x+C,null),t.triggerElectric(x+C),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(x+x+x+x,"before"),t.execCommand("goCharRight"));var o,a}))}(i,t)}}function l(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function s(e,t){var r=e.getRange(n(t.line,t.ch-1),n(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(n(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}o(t.pairs+"`")},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}],10:[function(e,t,n){var r,i;r=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),m=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),g=m||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),k=d&&e.match(/Version\/(\d*\.\d*)/);k&&(k=Number(k[1])),k&&k>=15&&(d=!1,s=!0);var x=y&&(c||d&&(null==k||k<12.11)),C=n||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T,L=function(e,t){var n=e.className,r=S(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function _(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function M(e,t){return _(e).appendChild(t)}function D(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}m?E=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(E=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};function H(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var V=[""];function J(e){for(;V.length<=e;)V.push(q(V)+" ");return V[e]}function q(e){return e[e.length-1]}function K(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Q(e))||t.test(e):Q(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ne.test(e)}function ie(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var ae=null;function le(e,t,n){var r;ae=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ae=i)}return null!=r?r:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,l){var s="ltr"==l?"L":"R";if(0==a.length||"ltr"==l&&!e.test(a))return!1;for(var c,u=a.length,d=[],f=0;f-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var n=fe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function ye(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ke(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function xe(e){be(e),we(e)}function Ce(e){return e.target||e.srcElement}function Se(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Te,Le,_e=function(){if(a&&l<9)return!1;var e=D("div");return"draggable"in e||"dragDrop"in e}();function Me(e){if(null==Te){var t=D("span","​");M(e,D("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Te=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=Te?D("span","​"):D("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function De(e){if(null!=Le)return Le;var t=M(e,document.createTextNode("AخA")),n=T(t,0,1).getBoundingClientRect(),r=T(t,1,2).getBoundingClientRect();return _(e),!(!n||n.left==n.right)&&(Le=r.right-n.right<3)}var Ne,Ae=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Fe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Oe="oncopy"in(Ne=D("div"))||(Ne.setAttribute("oncopy","return;"),"function"==typeof Ne.oncopy),Pe=null,Ee={},Be={};function $e(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ee[e]=t}function Ie(e){if("string"==typeof e&&Be.hasOwnProperty(e))e=Be[e];else if(e&&"string"==typeof e.name&&Be.hasOwnProperty(e.name)){var t=Be[e.name];"string"==typeof t&&(t={name:t}),(e=X(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ie("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ie("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Re(e,t){t=Ie(t);var n=Ee[t.name];if(!n)return Re(e,"text/plain");var r=n(e,t);if(He.hasOwnProperty(t.name)){var i=He[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var He={};function We(e,t){$(t,He.hasOwnProperty(e)?He[e]:He[e]={})}function ze(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function je(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ve(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?et(n,Ve(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,Ve(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,n,r){var i=[e.state.modeGen],o={};wt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var a=n.state,l=function(r){n.baseTokens=i;var l=e.state.overlays[r],s=1,c=0;n.state=!0,wt(e,t.text,l.mode,n,(function(e,t){for(var n=s;ce&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&ze(e.doc.mode,r.state),o=dt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ut(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Ve(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return l;var u=I(s.text,null,e.options.tabSize);(null==i||r>u)&&(i=l-1,r=u)}return i}(e,t,n),a=o>r.first&&Ve(r,o-1).stateAfter,l=a?ut.fromSaved(r,a,o):new ut(r,Ue(r.mode),o);return r.iter(o,t,(function(n){pt(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,n){return t instanceof ct?new ut(e,ze(e.mode,t.state),n,t.lookAhead):new ut(e,ze(e.mode,t),n)},ut.prototype.save=function(e){var t=!1!==e?ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var gt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function yt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=Ve(a,(t=lt(a,t)).line),c=ht(e,t.line,n),u=new Ge(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pose.options.maxHighlightLength?(l=!1,a&&pt(e,t,r,d.pos),d.pos=t.length,s=null):s=bt(vt(n,d,r.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c=t:o.to>t);(r||(r=[])).push(new Ct(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var b=0;bt)&&(!n||Ft(n,o.marker)<0)&&(n=o.marker)}return n}function $t(e,t,n,r,i){var o=Ve(e,t),a=xt&&o.markedSpans;if(a)for(var l=0;l=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.to,n)>=0:tt(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.from,r)<=0:tt(c.from,r)<0)))return!0}}}function It(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function Rt(e,t){var n=Ve(e,t),r=It(n);return n==r?t:Ye(r)}function Ht(e,t){if(t>e.lastLine())return t;var n,r=Ve(e,t);if(!Wt(e,r))return t;for(;n=Et(r);)r=n.find(1,!0).line;return Ye(r)+1}function Wt(e,t){var n=xt&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Vt=function(e,t,n){this.text=e,Dt(this,t),this.height=n?n(this):1};function Jt(e){e.parent=null,Mt(e)}Vt.prototype.lineNo=function(){return Ye(this)},ye(Vt);var qt={},Kt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Kt:qt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=N("span",null,null,s?"padding-right: .1px":null),r={pre:N("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Qt,De(e.display.measure)&&(a=ce(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,ft(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=P(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=P(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Me(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=P(r.pre.className,r.textClass||"")),r}function Zt(e){var t=D("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,s){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;ic&&d.from<=c);f++);if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,v="",g=0;;){if(g==p){s=c=u=l="",f=null,d=null,g=1/0;for(var y=[],b=void 0,w=0;wp||x.collapsed&&k.to==p&&k.from==p)){if(null!=k.to&&k.to!=p&&g>k.to&&(g=k.to,c=""),x.className&&(s+=" "+x.className),x.css&&(l=(l?l+";":"")+x.css),x.startStyle&&k.from==p&&(u+=" "+x.startStyle),x.endStyle&&k.to==g&&(b||(b=[])).push(x.endStyle,k.to),x.title&&((f||(f={})).title=x.title),x.attributes)for(var C in x.attributes)(f||(f={}))[C]=x.attributes[C];x.collapsed&&(!d||Ft(d.marker,x)<0)&&(d=k)}else k.from>p&&g>k.from&&(g=k.from)}if(b)for(var S=0;S=h)break;for(var L=Math.min(h,g);;){if(v){var _=p+v.length;if(!d){var M=_>L?v.slice(0,L-p):v;t.addToken(t,M,a?a+s:s,u,p+M.length==g?c:"",l,f)}if(_>=L){v=v.slice(L-p),p=L;break}p=_,u=""}v=i.slice(o,o=n[m++]),a=Yt(n[m++],t.cm.options)}}else for(var D=1;Dn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Nn(e,t,n,r){return On(e,Fn(e,t),n,r)}function An(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Bn(t.map,n,r),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){for(;c&&re(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var h;c>0&&(d=r="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==r?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!c&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+ir(e.display),top:p.top,bottom:p.bottom}:En}for(var m=i.top-t.rect.top,v=i.bottom-t.rect.top,g=(m+v)/2,y=t.view.measure.heights,b=0;bt)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(r=e[c+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==s-l)for(;c=0&&(n=e[i]).left==n.right;i--);return n}function In(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(s=r.text.length,c="before"):s<=0&&(s=0,c="after"),!l)return a("before"==c?s-1:s,"before"==c);function u(e,t,n){return a(n?e-1:e,1==l[t].level!=n)}var d=le(l,s,c),f=ae,h=u(s,d,"before"==c);return null!=f&&(h.other=u(s,f,"before"!=c)),h}function qn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch);var r=Ve(e.doc,t.line),i=jt(r)+Cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Kn(e,t,n,r,i){var o=et(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Yn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Kn(r.first,0,null,-1,-1);var i=Xe(r,n),o=r.first+r.size-1;if(i>o)return Kn(r.first+r.size-1,Ve(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Ve(r,i);;){var l=er(e,a,i,t,n),s=Bt(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=Ve(r,i=c.line)}}function Xn(e,t,n,r){r-=jn(t);var i=t.text.length,o=oe((function(t){return On(e,n,t-1).bottom<=r}),i,0);return{begin:o,end:i=oe((function(t){return On(e,n,t).top>r}),o,i)}}function Zn(e,t,n,r){return n||(n=Fn(e,t)),Xn(e,t,n,Un(e,t,On(e,n,r),"line").top)}function Qn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=jt(t);var o=Fn(e,t),a=jn(t),l=0,s=t.text.length,c=!0,u=ce(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?nr:tr)(e,t,n,o,u,r,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,v=oe((function(t){var n=On(e,o,t);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,m=n),!0)}),l,s),g=!1;if(m){var y=r-m.left=w.bottom?1:0}return Kn(n,v=ie(t.text,v,1),h,g,r-f)}function tr(e,t,n,r,i,o,a){var l=oe((function(l){var s=i[l],c=1!=s.level;return Qn(Jn(e,et(n,c?s.to:s.from,c?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[l];if(l>0){var c=1!=s.level,u=Jn(e,et(n,c?s.from:s.to,c?"after":"before"),"line",t,r);Qn(u,o,a,!0)&&u.top>a&&(s=i[l-1])}return s}function nr(e,t,n,r,i,o,a){var l=Xn(e,t,r,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f=c||h.to<=s)){var p=On(e,r,1!=h.level?Math.min(c,h.to)-1:Math.max(s,h.from)).right,m=pm)&&(u=h,d=m)}}return u||(u=i[i.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pn){Pn=D("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(D("br"));Pn.appendChild(document.createTextNode("x"))}M(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),_(e.measure),n||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=D("span","xxxxxxxxxx"),n=D("pre",[t],"CodeMirror-line-like");M(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ar(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ar(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function lr(e){var t=rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(i){if(Wt(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)xt&&Rt(e.doc,t)i.viewFrom?hr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)hr(e);else if(t<=i.viewFrom){var o=pr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):hr(e)}else if(n>=i.viewTo){var a=pr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hr(e)}else{var l=pr(e,t,t,-1),s=pr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(on(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):hr(e)}var c=i.externalMeasured;c&&(n=i.lineN&&t=r.viewTo)){var o=r.view[ur(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pr(e,t,n,r){var i,o=ur(e,t),a=e.display.view;if(!xt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Rt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function mr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||l.to().linet||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(m,n||0,null==r?f:r,(function(e,t,i,d){var v="ltr"==i,g=h(e,v?"left":"right"),y=h(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==f,k=0==d,x=!m||d==m.length-1;if(y.top-g.top<=3){var C=(c?w:b)&&x,S=(c?b:w)&&k?l:(v?g:y).left,T=C?s:(v?y:g).right;u(S,g.top,T-S,g.bottom)}else{var L,_,M,D;v?(L=c&&b&&k?l:g.left,_=c?s:p(e,i,"before"),M=c?l:p(t,i,"after"),D=c&&w&&x?s:y.right):(L=c?p(e,i,"before"):l,_=!c&&b&&k?s:g.right,M=!c&&w&&x?l:y.left,D=c?p(t,i,"after"):s),u(L,g.top,_-L,g.bottom),g.bottom0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function xr(e){e.state.focused||(e.display.input.focus(),Sr(e))}function Cr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Tr(e))}),100)}function Sr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),kr(e))}function Tr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Lr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||f<-.005)&&(Ke(i.line,s),_r(i.line),i.rest))for(var h=0;he.display.sizerWidth){var p=Math.ceil(c/ir(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function _r(e){if(e.widgets)for(var t=0;t=a&&(o=Xe(t,jt(Ve(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Dr(e,t){var n=e.display,r=rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Mn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Sn(n),s=t.topl-r;if(t.topi+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=_n(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.leftf+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function Nr(e,t){null!=t&&(Or(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Ar(e){Or(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fr(e,t,n){null==t&&null==n||Or(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Or(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pr(e,qn(e,t.from),qn(e,t.to),t.margin))}function Pr(e,t,n,r){var i=Dr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Fr(e,i.scrollLeft,i.scrollTop)}function Er(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||si(e,{top:t}),Br(e,t,!0),n&&si(e),ri(e,100))}function Br(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function $r(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ir(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Sn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Rr=function(e,t,n){this.cm=n;var r=this.vert=D("div",[D("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=D("div",[D("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),de(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Rr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Rr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Rr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Hr=function(){};function Wr(e,t){t||(t=Ir(e));var n=e.display.barWidth,r=e.display.barHeight;zr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Lr(e),zr(e,Ir(e)),n=e.display.barWidth,r=e.display.barHeight}function zr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Hr.prototype.update=function(){return{bottom:0,right:0}},Hr.prototype.setScrollLeft=function(){},Hr.prototype.setScrollTop=function(){},Hr.prototype.clear=function(){};var jr={native:Rr,null:Hr};function Ur(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new jr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?$r(e,t):Er(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var Gr=0;function Vr(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Gr},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Jr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Kr(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Yr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Lr(t),e.barMeasure=Ir(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Nn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-_n(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Xr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=D("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Cn(e.display))+"px;\n height: "+(t.bottom-t.top+Ln(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Jn(e,t),s=n&&n!=t?Jn(e,n):l,c=Dr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Er(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&($r(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ht(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?ze(t.mode,r.state):null,s=dt(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&fn)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Qr(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mr(e))return!1;fi(e)&&(hr(e),t.dims=or(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),xt&&(o=Rt(e.doc,o),a=Ht(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,ur(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=jt(Ve(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=mr(e);if(!l&&0==c&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=F();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&A(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return c>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var c=r.view,u=r.viewFrom,d=0;d-1&&(h=!1),un(e,f,u,n)),h&&(_(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Qe(e.options,u)))),a=f.node.nextSibling}else{var p=gn(e,f,u,n);o.insertBefore(p,a)}u+=f.size}for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=F()&&(e.activeElt.focus(),e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(u),_(n.cursorDiv),_(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function li(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=_n(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Sn(e.display)-Mn(e),n.top)}),t.visible=Mr(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ai(e,t);r=!1){Lr(e);var i=Ir(e);vr(e),Wr(e,i),ui(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var n=new oi(e,t);if(ai(e,n)){Lr(e),li(e,n);var r=Ir(e);vr(e),Wr(e,r),ui(e,r),n.finish()}}function ci(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ui(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ln(e)+"px"}function di(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;al.clientWidth,u=l.scrollHeight>l.clientHeight;if(i&&c||o&&u){if(o&&y&&s)e:for(var f=t.target,h=a.view;f!=l;f=f.parentNode)for(var p=0;p=0&&tt(e,r.to())<=0)return n}return-1};var Ci=function(e,t){this.anchor=e,this.head=t};function Si(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return tt(e.from(),t.from())})),n=H(t,i);for(var o=1;o0:s>=0){var c=ot(l.from(),a.from()),u=it(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Ci(d?u:c,d?c:u))}}return new xi(t,n)}function Ti(e,t){return new xi([new Ci(e,t||e)],0)}function Li(e){return e.text?et(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function _i(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Li(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Li(t).ch-t.to.ch),et(n,r)}function Mi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}sn(e,"change",e,t)}function Pi(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;al-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ri(e.done),q(e.done)):e.done.length&&!q(e.done).ranges?q(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),q(e.done)):void 0}(i,i.lastOp==r)))a=q(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Li(t):o.changes.push(Ii(e,t));else{var s=q(i.done);for(s&&s.ranges||zi(e.sel,i.done),o={changes:[Ii(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function Wi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,q(i.done),t))?i.done[i.done.length-1]=t:zi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Ri(i.undone)}function zi(e,t){var n=q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ji(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ui(e){if(!e)return null;for(var t,n=0;n-1&&(q(l)[d]=c[d],delete c[d])}}}return r}function Ji(e,t,n,r){if(r){var i=e.anchor;if(n){var o=tt(t,i)<0;o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new Ci(i,t)}return new Ci(n||t,t)}function qi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new xi([Ji(e.sel.primary(),t,n,i)],0),r)}function Ki(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(pe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),f=void 0;if((r<0?u:c)&&(d=ao(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=tt(d,n))&&(r<0?f<0:f>0))return io(e,d,t,r,i)}var h=s.find(r<0?-1:1);return(r<0?c:u)&&(h=ao(e,h,r,h.line==t.line?o:null)),h?io(e,h,t,r,i):null}}return t}function oo(e,t,n,r,i){var o=r||1,a=io(e,t,n,o,i)||!i&&io(e,t,n,o,!0)||io(e,t,n,-o,i)||!i&&io(e,t,n,-o,!0);return a||(e.cantEdit=!0,et(e.first,0))}function ao(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:n>0&&t.ch==(r||Ve(e,t.line)).text.length?t.line0)){var u=[s,1],d=tt(c.from,l.from),f=tt(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)uo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Mi(e,t);Hi(e,t,n,e.cm?e.cm.curOp.id:NaN),po(e,t,n,Lt(e,t));var r=[];Pi(e,(function(e,n){n||-1!=H(r,e.history)||(yo(e.history,t),r.push(e.history)),po(e,t,null,Lt(e,t))}))}}function fo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c=0;--h){var p=f(h);if(p)return p.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new xi(K(e.sel.ranges,(function(e){return new Ci(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:et(o,Ve(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Je(e,t.from,t.to),n||(n=Mi(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=Ye(It(Ve(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Oi(r,t,n,lr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=Ut(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=Ve(e,r).stateAfter;if(i&&(!(i instanceof ct)||r+i.lookAhead1||!(this.children[0]instanceof wo))){var l=[];this.collapse(l),this.children=[new wo(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if($t(e,t.line,t,n,o)||t.line!=n.line&&$t(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");xt=!0}o.addToHistory&&Hi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,(function(e){c&&o.collapsed&&!c.options.lineWrapping&&It(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Ke(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Ct(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){Wt(e,t)&&Ke(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(kt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)dr(c,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=n.line;u++)fr(c,u,"text");o.atomic&&no(c.doc),sn(c,"markerAdded",c,o)}return o}To.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Vr(e),ge(this,"clear")){var n=this.find();n&&sn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&dr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&no(e.doc)),e&&sn(e,"markerCleared",e,this,r,i),t&&Jr(e),this.parent&&this.parent.clear()}},To.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)co(this,r[s]);l?Zi(this,l):this.cm&&Ar(this.cm)})),undo:ni((function(){fo(this,"undo")})),redo:ni((function(){fo(this,"redo")})),undoSelection:ni((function(){fo(this,"undo",!0)})),redoSelection:ni((function(){fo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n})),lt(this,et(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var u=e.dataTransfer.getData("Text");if(u){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),eo(t.doc,Ti(n,n)),d)for(var f=0;f=0;t--)mo(e.doc,"",r[t].from,r[t].to,"+delete");Ar(e)}))}function Zo(e,t,n){var r=ie(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Qo(e,t,n){var r=Zo(e,t.ch,n);return null==r?null:new et(t.line,r,n<0?"after":"before")}function ea(e,t,n,r,i){if(e){var o=ce(n,t.doc.direction);if(o){var a,l=i<0?q(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=Fn(t,n);a=i<0?n.text.length-1:0;var u=On(t,c,a).top;a=oe((function(e){return On(t,c,e).top==u}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Zo(n,a,1))}else a=i<0?l.to:l.from;return new et(r,a,s)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}jo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},jo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},jo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},jo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},jo.default=y?jo.macDefault:jo.pcDefault;var ta={selectAll:lo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),z)},killLine:function(e){return Xo(e,(function(t){if(t.empty()){var n=Ve(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Ve(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ci(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Qr(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(tt((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,c=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,he(i.wrapper.ownerDocument,"mouseup",c),he(i.wrapper.ownerDocument,"mousemove",u),he(i.scroller,"dragstart",d),he(i.scroller,"drop",c),o||(be(t),r.addNew||qi(e.doc,n,null,null,r.extend),s||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()}),20):i.input.focus())})),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",c),de(i.wrapper.ownerDocument,"mousemove",u),de(i.scroller,"dragstart",d),de(i.scroller,"drop",c),Cr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;be(t);var a,l,s=o.sel,c=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),a=l>-1?c[l]:new Ci(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new Ci(n,n)),n=cr(e,t,!0,!0),l=-1;else{var u=ga(e,n,r.unit);a=r.extend?Ji(a,u.anchor,u.head,r.extend):u}r.addNew?-1==l?(l=c.length,Qi(o,Si(e,c.concat([a]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==r.unit&&!r.extend?(Qi(o,Si(e,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Yi(o,l,a,j):(l=0,Qi(o,new xi([a],0),j),s=o.sel);var d=n;function f(t){if(0!=tt(d,t))if(d=t,"rectangle"==r.unit){for(var i=[],c=e.options.tabSize,u=I(Ve(o,n.line).text,n.ch,c),f=I(Ve(o,t.line).text,t.ch,c),h=Math.min(u,f),p=Math.max(u,f),m=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=v;m++){var g=Ve(o,m).text,y=G(g,h,c);h==p?i.push(new Ci(et(m,y),et(m,y))):g.length>y&&i.push(new Ci(et(m,y),et(m,G(g,p,c))))}i.length||i.push(new Ci(n,n)),Qi(o,Si(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,k=ga(e,t,r.unit),x=w.anchor;tt(k.anchor,x)>0?(b=k.head,x=ot(w.from(),k.anchor)):(b=k.anchor,x=it(w.to(),k.head));var C=s.ranges.slice(0);C[l]=function(e,t){var n=t.anchor,r=t.head,i=Ve(e.doc,n.line);if(0==tt(n,r)&&n.sticky==r.sticky)return t;var o=ce(i);if(!o)return t;var a=le(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,c=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(o,r.ch,r.sticky),d=u-a||(r.ch-n.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:d>0}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new Ci(new et(n.line,p,m),r)}(e,new Ci(lt(o,x),b)),Qi(o,Si(e,C,l),j)}}var h=i.wrapper.getBoundingClientRect(),p=0;function m(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),he(i.wrapper.ownerDocument,"mousemove",v),he(i.wrapper.ownerDocument,"mouseup",g),o.history.lastSelOrigin=null}var v=ei(e,(function(t){0!==t.buttons&&Se(t)?function t(n){var a=++p,l=cr(e,n,!0,"rectangle"==r.unit);if(l)if(0!=tt(l,d)){e.curOp.focus=F(),f(l);var s=Mr(i,o);(l.line>=s.to||l.lineh.bottom?20:0;c&&setTimeout(ei(e,(function(){p==a&&(i.scroller.scrollTop+=c,t(n))})),50)}}(t):m(t)})),g=ei(e,m);e.state.selectingText=g,de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",g)}(e,r,t,o)}(t,r,o,e):Ce(e)==n.scroller&&be(e):2==i?(r&&qi(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(C?t.display.input.onContextMenu(e):Cr(t)))}}function ga(e,t,n){if("char"==n)return new Ci(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ci(et(t.line,0),lt(e.doc,et(t.line+1,0)));var r=n(e,t);return new Ci(r.from,r.to)}function ya(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&be(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!ge(e,n))return ke(t);o-=l.top-a.viewOffset;for(var s=0;s=i)return pe(e,n,e,Xe(e.doc,o),e.display.gutterSpecs[s].className,t),ke(t)}}function ba(e,t){return ya(e,t,"gutterClick",!0)}function wa(e,t){xn(e.display,t)||function(e,t){return!!ge(e,"gutterContextMenu")&&ya(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function ka(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hn(e)}ma.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button};var xa={toString:function(){return"CodeMirror.Init"}},Ca={},Sa={};function Ta(e,t,n){if(!t!=!(n&&n!=xa)){var r=e.display.dragFunctions,i=t?de:he;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function La(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Gt(e)),sr(e),dr(e),Hn(e),setTimeout((function(){return Wr(e)}),100)}function _a(e,t){var n=this;if(!(this instanceof _a))return new _a(e,t);this.options=t=t?$(t):{},$(Ca,t,!1);var r=t.value;"string"==typeof r?r=new Ao(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _a.inputStyles[t.inputStyle](this),o=this.display=new vi(e,r,i,t);for(var c in o.wrapper.CodeMirror=this,ka(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ur(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!g&&o.input.focus(),a&&l<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;de(t.scroller,"mousedown",ei(e,va)),de(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!me(e,t)){var n=cr(e,t);if(n&&!ba(e,t)&&!xn(e.display,t)){be(t);var r=e.findWordAt(n);qi(e.doc,r.anchor,r.head)}}})):function(t){return me(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return wa(e,t)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}de(t.scroller,"touchstart",(function(i){if(!me(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ba(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!xn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,l=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new Ci(l,l):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(l):new Ci(et(l.line,0),lt(e.doc,et(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),be(n)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),$r(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return ki(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return ki(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||xe(t)},over:function(t){me(e,t)||(function(e,t){var n=cr(e,t);if(n){var r=document.createDocumentFragment();yr(e,n,r),e.display.dragCursor||(e.display.dragCursor=D("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,r)}}(e,t),xe(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Fo<100))xe(t);else if(!me(e,t)&&!xn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var n=D("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Oo),leave:function(t){me(e,t)||Po(e)}};var s=t.input.getField();de(s,"keyup",(function(t){return da.call(e,t)})),de(s,"keydown",ei(e,ua)),de(s,"keypress",ei(e,fa)),de(s,"focus",(function(t){return Sr(e,t)})),de(s,"blur",(function(t){return Tr(e,t)}))}(this),$o(),Vr(this),this.curOp.forceUpdate=!0,Ei(this,r),t.autofocus&&!g||this.hasFocus()?setTimeout(B(Sr,this),20):Tr(this),Sa)Sa.hasOwnProperty(c)&&Sa[c](n,t[c],xa);fi(this),t.finishInit&&t.finishInit(this);for(var u=0;u150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?I(Ve(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(fa,s=Ae(t),c=null;if(l&&r.ranges.length>1)if(Na&&Na.text.join("\n")==t){if(r.ranges.length%Na.text.length==0){c=[];for(var u=0;u=0;f--){var h=r.ranges[f],p=h.from(),m=h.to();h.empty()&&(n&&n>0?p=et(p.line,p.ch-n):e.state.overwrite&&!l?m=et(m.line,Math.min(Ve(o,m.line).text.length,m.ch+q(s).length)):l&&Na&&Na.lineWise&&Na.text.join("\n")==t&&(p=m=et(p.line,0)));var v={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};co(e.doc,v),sn(e,"inputRead",e,v)}t&&!l&&Pa(e,t),Ar(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Oa(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Qr(t,(function(){return Fa(t,n,0,null,"paste")})),!0}function Pa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Da(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Ve(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Da(e,i.head.line,"smart"));a&&sn(e,"electricInput",e,i.head.line)}}}function Ea(e){for(var t=[],n=[],r=0;r=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=le(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&f>=u.begin)){var h=d?"before":"after";return new et(n.line,f,h)}}var p=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,s(e,1),"before"):new et(n.line,e,"after")};e>=0&&e0==(1!=a.level),c=l?r.begin:s(r.end,-1);if(a.from<=c&&c0?u.end:s(u.begin,-1);return null==v||r>0&&v==t.text.length||!(m=p(r>0?0:i.length-1,r,c(v)))?null:m}(e.cm,l,t,n):Qo(l,t,n))){if(r||(a=t.line+n)=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(l=Ve(e,a))))return!1;t=ea(i,e.cm,l,t.line,n)}else t=o;return!0}if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var c=null,u="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||s(!f);f=!1){var h=l.text.charAt(t.ch)||"\n",p=ee(h,d)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||f||p||(p="s"),c&&c!=p){n<0&&(n=1,s(),t.sticky="after");break}if(p&&(c=p),n>0&&!s(!f))break}var m=oo(e,t,o,a,!0);return nt(o,m)&&(m.hitSide=!0),m}function Ra(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*rr(e.display),3);i=(n>0?t.bottom:t.top)+n*c}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Yn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ha=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wa(e,t){var n=An(e,t.line);if(!n||n.hidden)return null;var r=Ve(e.doc,t.line),i=Dn(n,r,t.line),o=ce(r,e.doc.direction),a="left";o&&(a=le(o,t.ch)%2?"right":"left");var l=Bn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function za(e,t){return t&&(e.bad=!0),e}function ja(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return za(e.clipPos(et(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Wa(t,i)||{node:s[0].measure.map[2],offset:0},u=o.liner.firstLine()&&(a=et(a.line-1,Ve(r.doc,a.line-1).length)),l.ch==Ve(r.doc,l.line).text.length&&l.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(e=ur(r,a.line))?(t=Ye(i.view[0].line),n=i.view[0].node):(t=Ye(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,c,u=ur(r,l.line);if(u==i.view.length-1?(s=i.viewTo-1,c=i.lineDiv.lastChild):(s=Ye(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function u(e){e&&(c(),o+=e)}function d(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void u(n);var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(et(r,0),et(i+1,0),(v=+f,function(e){return e.id==v}));return void(h.length&&(o=h[0].find(0))&&u(Je(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&c();for(var m=0;m1&&f.length>1;)if(q(d)==q(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],v=f[0],g=Math.min(m.length,v.length);ha.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var k=et(t,h),x=et(s,f.length?q(f).length-p:0);return d.length>1||d[0]||tt(k,x)?(mo(r.doc,d,k,x,"+input"),!0):void 0},Ha.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ha.prototype.reset=function(){this.forceCompositionEnd()},Ha.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ha.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Ha.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Qr(this.cm,(function(){return dr(e.cm)}))},Ha.prototype.setUneditable=function(e){e.contentEditable="false"},Ha.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Fa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ha.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ha.prototype.onContextMenu=function(){},Ha.prototype.resetPosition=function(){},Ha.prototype.needsContentAttribute=!0;var Ga=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Ga.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!me(r,e)){if(r.somethingSelected())Aa({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Ea(r);Aa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,z):(n.prevInput="",i.value=t.text.join("\n"),E(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),de(i,"paste",(function(e){me(r,e)||Oa(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!xn(e,t)&&!me(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){xn(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Ga.prototype.createField=function(e){this.wrapper=$a(),this.textarea=this.wrapper.firstChild},Ga.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=gr(e);if(e.options.moveInputWithCursor){var i=Jn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ga.prototype.showSelection=function(e){var t=this.cm.display;M(t.cursorDiv,e.cursors),M(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ga.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&E(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Ga.prototype.getField=function(){return this.textarea},Ga.prototype.supportsTouch=function(){return!1},Ga.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ga.prototype.blur=function(){this.textarea.blur()},Ga.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ga.prototype.receivedFocus=function(){this.slowPoll()},Ga.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Ga.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Ga.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Fe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(r.length,i.length);s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Ga.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ga.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Ga.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=cr(n,e),c=r.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Qi)(n.doc,Ti(o),z);var u,f=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=window.scrollY),r.input.focus(),s&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=g,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&v(),C){xe(e);var m=function(){he(window,"mouseup",m),setTimeout(g,20)};de(window,"mouseup",m)}else setTimeout(g,50)}function v(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function g(){if(t.contextMenuPending==g&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=f,a&&l<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&l<9)&&v();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(n,lo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Ga.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ga.prototype.setUneditable=function(){},Ga.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=xa&&i(e,t,n)}:i)}e.defineOption=n,e.Init=xa,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Ni(e)}),!0),n("indentUnit",2,Ni,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Ai(e),Hn(e),dr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(et(r,o))}r++}));for(var i=n.length-1;i>=0;i--)mo(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=xa&&e.refresh()})),n("specialCharPlaceholder",Zt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",g?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){ka(e),mi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Yo(t),i=n!=xa&&Yo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,La,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),mi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Wr(e)}),!0),n("scrollbarStyle","native",(function(e){Ur(e),Wr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),mi(e)}),!0),n("firstLineNumber",1,mi,!0),n("lineNumberFormatter",(function(e){return e}),mi,!0),n("showCursorWhenSelecting",!1,vr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Tr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Ta),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vr,!0),n("singleCursorHeightPerLine",!0,vr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ai,!0),n("addModeClass",!1,Ai,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Ai,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(_a),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ei(this,t[e])(this,n,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Yo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Da(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Ar(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s0&&Yi(this.doc,r,new Ci(o,c[r].to()),z)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=ft(this,Ve(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(e=o,i=!0),r=Ve(this.doc,e)}else r=e;return Un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-jt(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l,s=this.display,c=(e=Jn(this,lt(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r)c=e.top;else if("above"==r||"near"==r){var d=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(c=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(o=this,a={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(l=Dr(o,a)).scrollTop&&Er(o,l.scrollTop),null!=l.scrollLeft&&$r(o,l.scrollLeft))},triggerOnKeyDown:ti(ua),triggerOnKeyPress:ti(fa),triggerOnKeyUp:da,triggerOnMouseDown:ti(va),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:ti((function(e){Pa(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a0&&a(t.charAt(n-1));)--n;for(;r.5)&&sr(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Ei(this,e),Hn(this),this.display.input.reset(),Fr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(_a);var Va="iter insert remove copy getEditor constructor".split(" ");for(var Ja in Ao.prototype)Ao.prototype.hasOwnProperty(Ja)&&H(Va,Ja)<0&&(_a.prototype[Ja]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ao.prototype[Ja]));return ye(Ao),_a.inputStyles={textarea:Ga,contenteditable:Ha},_a.defineMode=function(e){_a.defaults.mode||"null"==e||(_a.defaults.mode=e),$e.apply(this,arguments)},_a.defineMIME=function(e,t){Be[e]=t},_a.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),_a.defineMIME("text/plain","null"),_a.defineExtension=function(e,t){_a.prototype[e]=t},_a.defineDocExtension=function(e,t){Ao.prototype[e]=t},_a.fromTextArea=function(e,t){if((t=t?$(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(de(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=_a((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return l},function(e){e.off=he,e.on=de,e.wheelEventPixels=wi,e.Doc=Ao,e.splitLines=Ae,e.countColumn=I,e.findColumn=G,e.isWordChar=Q,e.Pass=W,e.signal=pe,e.Line=Vt,e.changeEnd=Li,e.scrollbarModel=jr,e.Pos=et,e.cmpPos=tt,e.modes=Ee,e.mimeModes=Be,e.resolveMode=Ie,e.getMode=Re,e.modeExtensions=He,e.extendMode=We,e.copyState=ze,e.startState=Ue,e.innerMode=je,e.commands=ta,e.keyMap=jo,e.keyName=Ko,e.isModifierKey=Jo,e.lookupKey=Vo,e.normalizeKeyMap=Go,e.StringStream=Ge,e.SharedTextMarker=_o,e.TextMarker=To,e.LineWidget=xo,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=xe,e.addClass=O,e.contains=A,e.rmClass=L,e.keyNames=Ro}(_a),_a.version="5.49.2",_a},"object"==typeof n&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define(i):r.CodeMirror=i()},{}],11:[function(e,t,n){var r;r=function(e){"use strict";e.defineMode("javascript",(function(t,n){var r,i,o=t.indentUnit,a=n.statementIndent,l=n.jsonld,s=n.json||l,c=n.typescript,u=n.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:e("new"),delete:r,void:r,throw:r,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:r,export:e("export"),import:e("import"),extends:r,await:r}}(),f=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e,t,n){return r=e,i=n,t}function m(e,t){var n,r=e.next();if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){var r,i=!1;if(l&&"@"==e.peek()&&e.match(h))return t.tokenize=m,p("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r;return i||(t.tokenize=m),p("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if("."==r&&e.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return p(r);if("="==r&&e.eat(">"))return p("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if("/"==r)return e.eat("*")?(t.tokenize=v,v(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):Je(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()));if("`"==r)return t.tokenize=g,g(e,t);if("#"==r)return e.skipToEnd(),p("error","error");if("<"==r&&e.match("!--")||"-"==r&&e.match("->"))return e.skipToEnd(),p("comment","comment");if(f.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),p("operator","operator",e.current());if(u.test(r)){e.eatWhile(u);var i=e.current();if("."!=t.lastType){if(d.propertyIsEnumerable(i)){var o=d[i];return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function v(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=m;break}r="*"==n}return p("comment","comment")}function g(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=m;break}r=!r&&"\\"==n}return p("quasi","string-2",e.current())}function y(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(c){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,a=n-1;a>=0;--a){var l=e.string.charAt(a),s="([{}])".indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(u.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function w(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function k(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return!0}var x={state:null,column:null,marked:null,cc:null};function C(){for(var e=arguments.length-1;e>=0;e--)x.cc.push(arguments[e])}function S(){return C.apply(null,arguments),!0}function T(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function L(e){var t=x.state;if(x.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,n){if(n){if(n.block){var r=e(t,n.prev);return r?r==n.prev?n:new M(r,n.vars,!0):null}return T(t,n.vars)?n:new M(n.prev,new D(t,n.vars),!1)}return null}(e,t.context);if(null!=r)return void(t.context=r)}else if(!T(e,t.localVars))return void(t.localVars=new D(e,t.localVars));n.globalVars&&!T(e,t.globalVars)&&(t.globalVars=new D(e,t.globalVars))}function _(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function M(e,t,n){this.prev=e,this.vars=t,this.block=n}function D(e,t){this.name=e,this.next=t}var N=new D("this",new D("arguments",null));function A(){x.state.context=new M(x.state.context,x.state.localVars,!1),x.state.localVars=N}function F(){x.state.context=new M(x.state.context,x.state.localVars,!0),x.state.localVars=null}function O(){x.state.localVars=x.state.context.vars,x.state.context=x.state.context.prev}function P(e,t){var n=function(){var n=x.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new w(r,x.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function E(){var e=x.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function B(e){return function t(n){return n==e?S():";"==e||"}"==n||")"==n||"]"==n?C():S(t)}}function $(e,t){return"var"==e?S(P("vardef",t),ye,B(";"),E):"keyword a"==e?S(P("form"),W,$,E):"keyword b"==e?S(P("form"),$,E):"keyword d"==e?x.stream.match(/^\s*$/,!1)?S():S(P("stat"),j,B(";"),E):"debugger"==e?S(B(";")):"{"==e?S(P("}"),F,oe,E,O):";"==e?S():"if"==e?("else"==x.state.lexical.info&&x.state.cc[x.state.cc.length-1]==E&&x.state.cc.pop()(),S(P("form"),W,$,E,Se)):"function"==e?S(Me):"for"==e?S(P("form"),Te,$,E):"class"==e||c&&"interface"==t?(x.marked="keyword",S(P("form","class"==e?e:t),Oe,E)):"variable"==e?c&&"declare"==t?(x.marked="keyword",S($)):c&&("module"==t||"enum"==t||"type"==t)&&x.stream.match(/^\s*\w/,!1)?(x.marked="keyword","enum"==t?S(Ge):"type"==t?S(Ne,B("operator"),ue,B(";")):S(P("form"),be,B("{"),P("}"),oe,E,E)):c&&"namespace"==t?(x.marked="keyword",S(P("form"),R,$,E)):c&&"abstract"==t?(x.marked="keyword",S($)):S(P("stat"),Z):"switch"==e?S(P("form"),W,B("{"),P("}","switch"),F,oe,E,E,O):"case"==e?S(R,B(":")):"default"==e?S(B(":")):"catch"==e?S(P("form"),A,I,$,E,O):"export"==e?S(P("stat"),$e,E):"import"==e?S(P("stat"),Re,E):"async"==e?S($):"@"==t?S(R,$):C(P("stat"),R,B(";"),E)}function I(e){if("("==e)return S(Ae,B(")"))}function R(e,t){return z(e,t,!1)}function H(e,t){return z(e,t,!0)}function W(e){return"("!=e?C():S(P(")"),R,B(")"),E)}function z(e,t,n){if(x.state.fatArrowAt==x.stream.start){var r=n?K:q;if("("==e)return S(A,P(")"),re(Ae,")"),E,B("=>"),r,O);if("variable"==e)return C(A,be,B("=>"),r,O)}var i=n?G:U;return b.hasOwnProperty(e)?S(i):"function"==e?S(Me,i):"class"==e||c&&"interface"==t?(x.marked="keyword",S(P("form"),Fe,E)):"keyword c"==e||"async"==e?S(n?H:R):"("==e?S(P(")"),j,B(")"),E,i):"operator"==e||"spread"==e?S(n?H:R):"["==e?S(P("]"),Ue,E,i):"{"==e?ie(ee,"}",null,i):"quasi"==e?C(V,i):"new"==e?S(function(e){return function(t){return"."==t?S(e?X:Y):"variable"==t&&c?S(me,e?G:U):C(e?H:R)}}(n)):"import"==e?S(R):S()}function j(e){return e.match(/[;\}\)\],]/)?C():C(R)}function U(e,t){return","==e?S(R):G(e,t,!1)}function G(e,t,n){var r=0==n?U:G,i=0==n?R:H;return"=>"==e?S(A,n?K:q,O):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?S(r):c&&"<"==t&&x.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?S(P(">"),re(ue,">"),E,r):"?"==t?S(R,B(":"),i):S(i):"quasi"==e?C(V,r):";"!=e?"("==e?ie(H,")","call",r):"."==e?S(Q,r):"["==e?S(P("]"),j,B("]"),E,r):c&&"as"==t?(x.marked="keyword",S(ue,r)):"regexp"==e?(x.state.lastType=x.marked="operator",x.stream.backUp(x.stream.pos-x.stream.start-1),S(i)):void 0:void 0}function V(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?S(V):S(R,J)}function J(e){if("}"==e)return x.marked="string-2",x.state.tokenize=g,S(V)}function q(e){return y(x.stream,x.state),C("{"==e?$:R)}function K(e){return y(x.stream,x.state),C("{"==e?$:H)}function Y(e,t){if("target"==t)return x.marked="keyword",S(U)}function X(e,t){if("target"==t)return x.marked="keyword",S(G)}function Z(e){return":"==e?S(E,$):C(U,B(";"),E)}function Q(e){if("variable"==e)return x.marked="property",S()}function ee(e,t){return"async"==e?(x.marked="property",S(ee)):"variable"==e||"keyword"==x.style?(x.marked="property","get"==t||"set"==t?S(te):(c&&x.state.fatArrowAt==x.stream.start&&(n=x.stream.match(/^\s*:\s*/,!1))&&(x.state.fatArrowAt=x.stream.pos+n[0].length),S(ne))):"number"==e||"string"==e?(x.marked=l?"property":x.style+" property",S(ne)):"jsonld-keyword"==e?S(ne):c&&_(t)?(x.marked="keyword",S(ee)):"["==e?S(R,ae,B("]"),ne):"spread"==e?S(H,ne):"*"==t?(x.marked="keyword",S(ee)):":"==e?C(ne):void 0;var n}function te(e){return"variable"!=e?C(ne):(x.marked="property",S(Me))}function ne(e){return":"==e?S(H):"("==e?C(Me):void 0}function re(e,t,n){function r(i,o){if(n?n.indexOf(i)>-1:","==i){var a=x.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),S((function(n,r){return n==t||r==t?C():C(e)}),r)}return i==t||o==t?S():n&&n.indexOf(";")>-1?C(e):S(B(t))}return function(n,i){return n==t||i==t?S():C(e,r)}}function ie(e,t,n){for(var r=3;r"),ue):void 0}function de(e){if("=>"==e)return S(ue)}function fe(e,t){return"variable"==e||"keyword"==x.style?(x.marked="property",S(fe)):"?"==t||"number"==e||"string"==e?S(fe):":"==e?S(ue):"["==e?S(B("variable"),le,B("]"),fe):"("==e?C(De,fe):void 0}function he(e,t){return"variable"==e&&x.stream.match(/^\s*[?:]/,!1)||"?"==t?S(he):":"==e?S(ue):"spread"==e?S(he):C(ue)}function pe(e,t){return"<"==t?S(P(">"),re(ue,">"),E,pe):"|"==t||"."==e||"&"==t?S(ue):"["==e?S(ue,B("]"),pe):"extends"==t||"implements"==t?(x.marked="keyword",S(ue)):"?"==t?S(ue,B(":"),ue):void 0}function me(e,t){if("<"==t)return S(P(">"),re(ue,">"),E,pe)}function ve(){return C(ue,ge)}function ge(e,t){if("="==t)return S(ue)}function ye(e,t){return"enum"==t?(x.marked="keyword",S(Ge)):C(be,ae,xe,Ce)}function be(e,t){return c&&_(t)?(x.marked="keyword",S(be)):"variable"==e?(L(t),S()):"spread"==e?S(be):"["==e?ie(ke,"]"):"{"==e?ie(we,"}"):void 0}function we(e,t){return"variable"!=e||x.stream.match(/^\s*:/,!1)?("variable"==e&&(x.marked="property"),"spread"==e?S(be):"}"==e?C():"["==e?S(R,B("]"),B(":"),we):S(B(":"),be,xe)):(L(t),S(xe))}function ke(){return C(be,xe)}function xe(e,t){if("="==t)return S(H)}function Ce(e){if(","==e)return S(ye)}function Se(e,t){if("keyword b"==e&&"else"==t)return S(P("form","else"),$,E)}function Te(e,t){return"await"==t?S(Te):"("==e?S(P(")"),Le,E):void 0}function Le(e){return"var"==e?S(ye,_e):"variable"==e?S(_e):C(_e)}function _e(e,t){return")"==e?S():";"==e?S(_e):"in"==t||"of"==t?(x.marked="keyword",S(R,_e)):C(R,_e)}function Me(e,t){return"*"==t?(x.marked="keyword",S(Me)):"variable"==e?(L(t),S(Me)):"("==e?S(A,P(")"),re(Ae,")"),E,se,$,O):c&&"<"==t?S(P(">"),re(ve,">"),E,Me):void 0}function De(e,t){return"*"==t?(x.marked="keyword",S(De)):"variable"==e?(L(t),S(De)):"("==e?S(A,P(")"),re(Ae,")"),E,se,O):c&&"<"==t?S(P(">"),re(ve,">"),E,De):void 0}function Ne(e,t){return"keyword"==e||"variable"==e?(x.marked="type",S(Ne)):"<"==t?S(P(">"),re(ve,">"),E):void 0}function Ae(e,t){return"@"==t&&S(R,Ae),"spread"==e?S(Ae):c&&_(t)?(x.marked="keyword",S(Ae)):c&&"this"==e?S(ae,xe):C(be,ae,xe)}function Fe(e,t){return"variable"==e?Oe(e,t):Pe(e,t)}function Oe(e,t){if("variable"==e)return L(t),S(Pe)}function Pe(e,t){return"<"==t?S(P(">"),re(ve,">"),E,Pe):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(x.marked="keyword"),S(c?ue:R,Pe)):"{"==e?S(P("}"),Ee,E):void 0}function Ee(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&_(t))&&x.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(x.marked="keyword",S(Ee)):"variable"==e||"keyword"==x.style?(x.marked="property",S(c?Be:Me,Ee)):"number"==e||"string"==e?S(c?Be:Me,Ee):"["==e?S(R,ae,B("]"),c?Be:Me,Ee):"*"==t?(x.marked="keyword",S(Ee)):c&&"("==e?C(De,Ee):";"==e||","==e?S(Ee):"}"==e?S():"@"==t?S(R,Ee):void 0}function Be(e,t){if("?"==t)return S(Be);if(":"==e)return S(ue,xe);if("="==t)return S(H);var n=x.state.lexical.prev;return C(n&&"interface"==n.info?De:Me)}function $e(e,t){return"*"==t?(x.marked="keyword",S(je,B(";"))):"default"==t?(x.marked="keyword",S(R,B(";"))):"{"==e?S(re(Ie,"}"),je,B(";")):C($)}function Ie(e,t){return"as"==t?(x.marked="keyword",S(B("variable"))):"variable"==e?C(H,Ie):void 0}function Re(e){return"string"==e?S():"("==e?C(R):C(He,We,je)}function He(e,t){return"{"==e?ie(He,"}"):("variable"==e&&L(t),"*"==t&&(x.marked="keyword"),S(ze))}function We(e){if(","==e)return S(He,We)}function ze(e,t){if("as"==t)return x.marked="keyword",S(He)}function je(e,t){if("from"==t)return x.marked="keyword",S(R)}function Ue(e){return"]"==e?S():C(re(H,"]"))}function Ge(){return C(P("form"),be,B("{"),P("}"),re(Ve,"}"),E,E)}function Ve(){return C(be,xe)}function Je(e,t,n){return t.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return O.lex=!0,E.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new w((e||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&new M(null,null,!1),indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),y(e,t)),t.tokenize!=v&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==r?n:(t.lastType="operator"!=r||"++"!=i&&"--"!=i?r:"incdec",function(e,t,n,r,i){var o=e.cc;for(x.state=e,x.stream=i,x.marked=null,x.cc=o,x.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?R:$)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return x.marked?x.marked:"variable"==n&&k(e,r)?"variable-2":t}}(t,n,r,i,e))},indent:function(t,r){if(t.tokenize==v)return e.Pass;if(t.tokenize!=m)return 0;var i,l=r&&r.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(r))for(var c=t.cc.length-1;c>=0;--c){var u=t.cc[c];if(u==E)s=s.prev;else if(u!=Se)break}for(;("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==U||i==G)&&!/^[,\.=+\-*:?[\(]/.test(r));)s=s.prev;a&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var d=s.type,h=l==d;return"vardef"==d?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==d&&"{"==l?s.indented:"form"==d?s.indented+o:"stat"==d?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?a||o:0):"switch"!=s.info||h||0==n.doubleIndentSwitch?s.align?s.column+(h?0:1):s.indented+(h?0:o):s.indented+(/^(?:case|default)\b/.test(r)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:Je,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=R&&t!=H||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}]},{},[1]); +!function e(t,n,r){function i(a,l){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!l&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a')).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"getActionButtonHeader",value:function(){return{sTitle:'',sClass:"center"}}}]),n}(r.default),y=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","pay_period","department","date_start","date_end","status"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Pay Frequency"},{sTitle:"Department"},{sTitle:"Date Start"},{sTitle:"Date End"},{sTitle:"Status"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text"}],["pay_period",{label:"Pay Frequency",type:"select","remote-source":["PayFrequency","id","name"],sort:"none"}],["deduction_group",{label:"Payroll Group",type:"select","remote-source":["DeductionGroup","id","name"],sort:"none"}],["payslipTemplate",{label:"Payslip Template",type:"select","remote-source":["PayslipTemplate","id","name"]}],["department",{label:"Department",type:"select2","remote-source":["CompanyStructure","id","title"],sort:"none"}],["date_start",{label:"Start Date",type:"date",validation:""}],["date_end",{label:"End Date",type:"date",validation:""}],["columns",{label:"Payroll Columns",type:"select2multi","remote-source":["PayrollColumn","id","name"]}],["status",{label:"Status",type:"select",source:[["Draft","Draft"],["Completed","Completed"]],sort:"none"}]]}},{key:"postRenderForm",value:function(e,t){null!=e&&void 0!==e&&void 0!==e.id&&null!=e.id&&(t.find("#pay_period").attr("disabled","disabled"),t.find("#department").attr("disabled","disabled"))}},{key:"process",value:function(e,t){modJs=modJsList.tabPayrollData,modJs.setCurrentPayroll(e),$("#Payroll").hide(),$("#PayrollData").show(),$("#PayrollDataButtons").show(),"Completed"===t?($(".completeBtnTable").hide(),$(".saveBtnTable").hide()):($(".completeBtnTable").show(),$(".saveBtnTable").show()),modJs.get([])}},{key:"getActionButtonsHtml",value:function(e,t){var n='
    _edit__process__clone__delete_
    ';return n=this.showAddNew?n.replace("_clone_",''):n.replace("_clone_",""),n=this.showDelete?n.replace("_delete_",''):n.replace("_delete_",""),n=(n=(n=(n=(n=this.showEdit?n.replace("_edit_",''):n.replace("_edit_","")).replace("_process_",'')).replace(/_id_/g,e)).replace(/_status_/g,t[6])).replace(/_BASE_/g,this.baseUrl)}},{key:"get",value:function(e){$("#PayrollData").hide(),$("#PayrollForm").hide(),$("#PayrollDataButtons").hide(),$("#Payroll").show(),modJsList.tabPayrollData.setCurrentPayroll(null),u(m(n.prototype),"get",this).call(this,e)}},{key:"getHelpLink",value:function(){return"https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management"}}]),n}(r.default),b=function(e){d(n,e);var t=h(n);function n(e,r,i,o){var a;return l(this,n),(a=t.call(this,e,r,i,o)).cellDataUpdates={},a.payrollId=null,a}return c(n,[{key:"validateCellValue",value:function(e,t,n){return modJs.addCellDataUpdate(e.data("colId"),e.data("rowId"),n),!0}},{key:"setCurrentPayroll",value:function(e){this.payrollId=e}},{key:"addAdditionalRequestData",value:function(e,t){return("updateData"===e||"updateAllData"===e||"getAllData"===e)&&(t.payrollId=this.payrollId),t}},{key:"modifyCSVHeader",value:function(e){return e.unshift(""),e}},{key:"getCSVData",value:function(){for(var e="",t=0;t#_delete_##_edit_#
    #_renderFunction_#
    ',validation:"none",render:function(e){return"Variable:".concat(e.name)}}],["function_type",{label:"Function Type",type:"select",source:[["Advanced","Advanced"],["Simple","Simple"]]}],["calculation_function",{label:"Function",type:"code",validation:"none"}]]}},{key:"getFilters",value:function(){return[["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!1,"remote-source":["DeductionGroup","id","name"]}]]}},{key:"getHelpLink",value:function(){return"https://icehrm.gitbook.io/icehrm/payroll-and-expenses/payroll-management"}}]),n}(r.default),k=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!0},{sTitle:"Name"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["columns",{label:"Payroll Columns",type:"select2multi","remote-source":["PayrollColumn","id","name"]}]]}}]),n}(r.default),x=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","employee","pay_frequency","deduction_group","currency"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Employee"},{sTitle:"Pay Frequency"},{sTitle:"Payroll Group"},{sTitle:"Currency"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["employee",{label:"Employee",type:"select2","remote-source":["Employee","id","first_name+last_name"]}],["pay_frequency",{label:"Pay Frequency",type:"select2","remote-source":["PayFrequency","id","name"]}],["currency",{label:"Currency",type:"select2","remote-source":["CurrencyType","id","code"]}],["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!0,"null-label":"None","remote-source":["DeductionGroup","id","name"]}],["deduction_exemptions",{label:"Calculation Exemptions",type:"select2multi","remote-source":["Deduction","id","name"],validation:"none"}],["deduction_allowed",{label:"Calculations Assigned",type:"select2multi","remote-source":["Deduction","id","name"],validation:"none"}]]}},{key:"getFilters",value:function(){return[["employee",{label:"Employee",type:"select2","remote-source":["Employee","id","first_name+last_name"]}]]}}]),n}(r.default),C=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","deduction_group"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Payroll Group"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["componentType",{label:"Salary Component Type",type:"select2multi","allow-null":!0,"remote-source":["SalaryComponentType","id","name"]}],["component",{label:"Salary Component",type:"select2multi","allow-null":!0,"remote-source":["SalaryComponent","id","name"]}],["payrollColumn",{label:"Payroll Report Column",type:"select2","allow-null":!0,"remote-source":["PayrollColumn","id","name"]}],["rangeAmounts",{label:"Calculation Process",type:"datagroup",form:[["lowerCondition",{label:"Lower Limit Condition",type:"select",source:[["No Lower Limit","No Lower Limit"],["gt","Greater than"],["gte","Greater than or Equal"]]}],["lowerLimit",{label:"Lower Limit",type:"text",validation:"float"}],["upperCondition",{label:"Upper Limit Condition",type:"select",source:[["No Upper Limit","No Upper Limit"],["lt","Less than"],["lte","Less than or Equal"]]}],["upperLimit",{label:"Upper Limit",type:"text",validation:"float"}],["amount",{label:"Value",type:"text",validation:""}]],html:'
    #_delete_##_edit_#
    #_renderFunction_#
    ',validation:"none","custom-validate-function":function(e){var t={valid:!0};return"No Lower Limit"===e.lowerCondition&&(e.lowerLimit=0),"No Upper Limit"===e.upperCondition&&(e.upperLimit=0),t.params=e,t},render:function(e){var t="",n=function(e){var t={gt:">",gte:">=",lt:"<",lte:"<="};return t[e]};return"No Lower Limit"!==e.lowerCondition&&(t+="".concat(e.lowerLimit," ").concat(n(e.lowerCondition)," ")),"No Upper Limit"!==e.upperCondition&&(t+=" and ",t+="".concat(n(e.upperCondition)," ").concat(e.upperLimit," ")),""===t?"Deduction is ".concat(e.amount," for all ranges"):"If salary component ".concat(t," deduction is ").concat(e.amount)}}],["deduction_group",{label:"Payroll Group",type:"select2","allow-null":!1,"remote-source":["DeductionGroup","id","name"]}]]}}]),n}(r.default),S=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name","description"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Details"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["description",{label:"Details",type:"textarea",validation:"none"}]]}},{key:"getActionButtonsHtml",value:function(e){var t='
    ';return t=(t=t.replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"deletePayrollGroup",value:function(e){if(confirm("Are you sure you want to delete this payroll group? Deleting the payroll group will delete all the Payroll columns and Saved calculations attached to this Payroll Group")){var t={};t.id=e;var n=JSON.stringify(t),r=[];r.callBackData=[],r.callBackSuccess="deletePayrollGroupSuccessCallback",r.callBackFail="deletePayrollGroupFailCallback",this.customAction("deletePayrollGroup","admin=payroll",n,r)}}},{key:"deletePayrollGroupSuccessCallback",value:function(e){this.showMessage("Success","Payroll Group Deleted "),this.get([])}},{key:"deletePayrollGroupFailCallback",value:function(e){this.showMessage("Error occured while deleting Payroll Group",e)}}]),n}(r.default),T=function(e){d(n,e);var t=h(n);function n(){return l(this,n),t.apply(this,arguments)}return c(n,[{key:"getDataMapping",value:function(){return["id","name"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"}]}},{key:"getFormFields",value:function(){return[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text",validation:""}],["data",{label:"Payslip Fields",type:"datagroup",form:[["type",{label:"Type",type:"select",sort:"none",source:[["Payroll Column","Payroll Column"],["Text","Text"],["Company Name","Company Name"],["Company Logo","Company Logo"],["Separators","Separators"]]}],["payrollColumn",{label:"Payroll Column",type:"select2",sort:"none","allow-null":!0,"null-label":"None","remote-source":["PayrollColumn","id","name"]}],["label",{label:"Label",type:"text",validation:"none"}],["text",{label:"Text",type:"textarea",validation:"none"}],["status",{label:"Status",type:"select",sort:"none",source:[["Show","Show"],["Hide","Hide"]]}]],html:'
    #_delete_##_edit_#
    #_type_# #_label_#
    #_text_#
    ',validation:"none","custom-validate-function":function(e){var t={valid:!0};return"Payroll Column"===e.type?"NULL"===e.payrollColumn&&(t.valid=!1,t.message="Please select payroll column"):e.payrollColumn="NULL","Text"===e.type&&""===e.text&&(t.valid=!1,t.message="Text can not be empty"),t.params=e,t}}]]}}]),n}(r.default);t.exports={PaydayAdapter:g,PayrollAdapter:y,PayrollDataAdapter:b,PayrollColumnAdapter:w,PayrollColumnTemplateAdapter:k,PayrollEmployeeAdapter:x,DeductionAdapter:C,DeductionGroupAdapter:S,PayslipTemplateAdapter:T}},{"../../../api/AdapterBase":4,"../../../api/TableEditAdapter":7,codemirror:10,"codemirror/addon/display/autorefresh":8,"codemirror/addon/edit/closebrackets":9,"codemirror/mode/javascript/javascript":11}],3:[function(e,t,n){"use strict";function r(e,t){for(var n=0;n0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var n=localStorage.getItem(e);return void 0!==n&&null!=n&&""!==n?void 0===(t=JSON.parse(n))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var n=JSON.stringify(t);return localStorage.setItem(e,n),n}}])&&r(t.prototype,n),i&&r(t,i),e}();n.default=i},{}],4:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=o(e("./ModuleBase")),i=o(e("../api-common/RequestCache"));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n0}},o=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=n,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,r),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,n,o;return t=e,n=[{key:"clearError",value:function(e,t){var n=e.attr("id");$("#".concat(this.formId," #field_").concat(n)).removeClass("error"),$("#".concat(this.formId," #help_").concat(n)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var n=e.attr("id"),r=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(n)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(n)).html(i):void 0===r||null==r||""===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Required"):"float"===r||"number"===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Number required"):"email"===r?$("#".concat(this.formId," #help_err_").concat(n)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(n)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var n=function(e){var n=null,r=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(r,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),o=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(o,t.inputTypes)>=0){if(e.hasClass("uploadInput"))n=e.attr("val");else if("radio"===o||"checkbox"===o)n=$("input[name='".concat(r,"']:checked")).val();else if(e.hasClass("select2Field"))n=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var a=$("#".concat(t.formId," #").concat(i)).select2("data");n=[];for(var l=0;l')),null!=this.getFilters()&&(""!==e&&(e+="  "),e+=''),e+="  ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='
    '.concat(e,"
    ")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'
    '}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var n in t)t[n].sTitle=this.gt(t[n].sTitle);var r,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var o=0;o")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(n)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=this,a="";a=i?"#plainMessageModel":"#messageModel",$(a).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=n?($(a).modal({show:!0}),$(a).on("hidden.bs.modal",(function(){n.apply(o,r),$(".modal-backdrop").remove()}))):$(a).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,n,r,i){var o=this,a="";a=i?"#dataMessageModel":"#messageModel",$(a).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=n?($(a).modal({show:!0}),$(a).on("hidden.bs.modal",(function(){n.apply(o,r),$(".modal-backdrop").remove()}))):$(a).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var n=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();r=this.forceInjectValuesBeforeSave(r);var o=this.doCustomValidation(r);if(null==o){this.csrfRequired&&(r.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var a=$("#".concat(this.getTableName(),"_submit #id")).val();null!=a&&void 0!==a&&""!==a&&(r.id=a),r=this.makeEmptyDateFieldsNull(r),this.add(r,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(o),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var n in t)t.hasOwnProperty(n)&&"NULL"===t[n]&&delete t[n];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,n,r,i,o,a,l="",s=this.getFilters();for(var c in null==r&&(r=[]),e)if(e.hasOwnProperty(c)){if(o="",a=null,"select"===(r=this.getMetaFieldValues(c,s)).type||"select2"===r.type){if(void 0!==r["remote-source"]&&null!=r["remote-source"])t=r["remote-source"],"NULL"===e[c]?o=void 0!==r["null-label"]&&null!=r["null-label"]?r["null-label"]:"Not Selected":a=o=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(n=r.source[0],"NULL"===e[c])o=void 0!==r["null-label"]&&null!=r["null-label"]?r["null-label"]:"Not Selected";else for(var u=0;u');s.attr("id",l),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var n,r=this.templates.formTemplate,i="",o=this.getFormFields(),a=0;a')).attr("id",c):n=$("#".concat(this.getTableName(),"Form")),n.html(r),n.find(".datefield").datepicker({viewMode:2}),n.find(".timefield").datetimepicker({language:"en",pickDate:!1}),n.find(".datetimefield").datetimepicker({language:"en"}),n.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(n.attr("id")," .tinymce"),height:"400"}),n.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&n.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),n.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),n.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),n.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d')),c=0;c
  • ')).replace("#_edit_#",'
  • ')).replace(/#_id_#/g,r.id),r)void 0!==(o=r[u])&&null!=o&&"string"==typeof o&&(o=o.replace(/(?:\r\n|\r|\n)/g,"
    ")),n=n.replace("#_".concat(u,"_#"),o);void 0!==t[1].render&&null!=t[1].render&&(n=n.replace("#_renderFunction_#",t[1].render(r))),(i=$(n)).attr("fieldId","".concat(t[0],"_div")),s.append(i)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var n=this.templates.datagroupTemplate,r="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var o=0;o');l.attr("id",a),l.html(n),l.find(".datefield").datepicker({viewMode:2}),l.find(".timefield").datetimepicker({language:"en",pickDate:!1}),l.find(".datetimefield").datetimepicker({language:"en"}),l.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(l.attr("id")," .tinymce"),height:"400"}),l.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),l.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),l.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),n=t.find(".select2-choices").height();t.height(parseInt(n,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),l,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var n=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[r])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;r=e.params}var o=$("#".concat(t[0])).val();""===o&&(o="[]");var a=JSON.parse(o);r.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(a)),a.push(r),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&a.sort(t[1]["sort-function"]),o=JSON.stringify(a);var l=this.dataGroupToHtml(o,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(l),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(o),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var n="";try{for(var r=e.split(" "),i=0,o=0;ot?(n+="".concat(r[o],"
    "),i=0):n+="".concat(r[o]," ")}catch(e){}return n}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var n=$(e.target);if(!/html|body/i.test(n.offsetParent()[0].tagName)){var r=e.pageY-n.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(r,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,n=[],r=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var o=JSON.parse(i);r.each((function(){for(var e in t=$(this).attr("id"),o)if(o[e].id===t){n.push(o[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(n))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,n=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(n.checkValues()){var r=n.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var o=e[1]["custom-validate-function"].apply(this,[r]);if(!o.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(o.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;r=o.params}if(this.doCustomFilterValidation(r)){var a=$("#".concat(e[0])).val();""===a&&(a="[]");for(var l=JSON.parse(a),s={},c=-1,u=[],d=0;d=n&&(n=parseInt(t,10)+1)}return n}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),n=$("#".concat(t)).val(),r=JSON.parse(n),i=[],o=0;o")}catch(e){}if(void 0!==n[i][1].formatter&&n[i][1].formatter&&$.isFunction(n[i][1].formatter))try{r=n[i][1].formatter(r)}catch(e){}$("".concat(t," #").concat(n[i][0])).html(r)}else if("fileupload"===n[i][1].type)null!=e[n[i][0]]&&void 0!==e[n[i][0]]&&""!==e[n[i][0]]&&($("".concat(t," #").concat(n[i][0])).html(e[n[i][0]]),$("".concat(t," #").concat(n[i][0])).attr("val",e[n[i][0]]),$("".concat(t," #").concat(n[i][0])).show(),$("".concat(t," #").concat(n[i][0],"_download")).show(),$("".concat(t," #").concat(n[i][0],"_remove")).show()),!0===n[i][1].readonly&&$("".concat(t," #").concat(n[i][0],"_upload")).remove();else if("select"===n[i][1].type)void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL"),$("".concat(t," #").concat(n[i][0])).val(e[n[i][0]]);else if("select2"===n[i][1].type)void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL"),$("".concat(t," #").concat(n[i][0])).select2("val",e[n[i][0]]);else if("select2multi"===n[i][1].type){void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]]||(e[n[i][0]]="NULL");var c=[];if(void 0!==e[n[i][0]]&&null!=e[n[i][0]]&&""!==e[n[i][0]])try{c=JSON.parse(e[n[i][0]])}catch(e){}$("".concat(t," #").concat(n[i][0])).select2("val",c);var u=$("".concat(t," #").concat(n[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(n[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(n[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===n[i][1].type)try{var d=this.dataGroupToHtml(e[n[i][0]],n[i]);$("".concat(t," #").concat(n[i][0])).val(e[n[i][0]]),$("".concat(t," #").concat(n[i][0],"_div")).html(""),$("".concat(t," #").concat(n[i][0],"_div")).append(d),this.makeDataGroupSortable(n[i],$("".concat(t," #").concat(n[i][0],"_div_inner")))}catch(e){}else if("signature"===n[i][1].type)""===e[n[i][0]]&&void 0===e[n[i][0]]&&null==e[n[i][0]]||$("".concat(t," #").concat(n[i][0])).data("signaturePad").fromDataURL(e[n[i][0]]);else if("simplemde"===n[i][1].type)$("".concat(t," #").concat(n[i][0])).data("simplemde").value(e[n[i][0]]);else if("code"===n[i][1].type){var f=$("".concat(t," #").concat(n[i][0])).data("codemirror");f&&f.getDoc().setValue(e[n[i][0]])}else $("".concat(t," #").concat(n[i][0])).val(e[n[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var n=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'*'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)n=n.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var r="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);n=n.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[r],e))}}else if("colorpick"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,n=(n=n.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),n=(n=void 0!==e[1].filetypes&&null!=e[1].filetypes?n.replace(/_filetypes_/g,e[1].filetypes):n.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,n=(n=n.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return n=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?n.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):n.replace(/_validation_/g,""),n=void 0!==e[1].help&&null!==e[1].help?(n=n.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(n=n.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),n=void 0!==e[1].placeholder&&null!==e[1].placeholder?n.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):n.replace(/_placeholder_/g,""),n=void 0!==e[1].mask&&null!==e[1].mask?n.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):n.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var n="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?n+='"):n+='');var r=[];for(var i in e)r.push(e[i]);!0===t[1].sort&&r.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var o=0;o_val_';n+=s=(s=s.replace("_id_",a)).replace("_val_",this.gt(l))}return n}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var n="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?n+='"):n+='');var r=[];for(var i in e)r.push([i,e[i]]);"true"===t[1].sort&&r.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var o=0;o_val_';n+=s=(s=s.replace("_id_",a)).replace("_val_",this.gt(l))}return n}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var n='
    _edit__delete__clone_
    ';return n=this.showAddNew?n.replace("_clone_",''):n.replace("_clone_",""),n=this.showDelete?n.replace("_delete_",''):n.replace("_delete_",""),n=(n=(n=this.showEdit?n.replace("_edit_",''):n.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",r="",i=e;i>0;--i)r+=n[Math.round(Math.random()*(n.length-1))];return r+t.getTime()}},{key:"checkFileType",value:function(e,t){var n=document.getElementById(e),r="";return n.value.lastIndexOf(".")>0&&(r=n.value.substring(n.value.lastIndexOf(".")+1,n.value.length)),r=r.toLowerCase(),!(t.split(",").indexOf(r)<0&&(n.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),n=t.toGMTString();return(t-new Date(n.substring(0,n.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var n in e)t+=''.replace("__val__",n).replace("__text__",e[n]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,n,r=0;r
    ');var o=$("#".concat(e," .dataTables_paginate .active a")).html(),a=0;void 0!==o&&null!=o&&(a=15*parseInt(o,10)-15),$("#".concat(e)).html(t);var l={oLanguage:{sLengthMenu:"_MENU_ records per page"},aaData:n,aoColumns:r,bSort:!1,iDisplayLength:15,iDisplayStart:a},s=this.getCustomTableParams();$.extend(l,s),$("#".concat(e," #grid")).dataTable(l),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$("#".concat(e," #grid")).editableTableWidget(),$("#".concat(e," #grid .editcell")).on("validate",(function(e,t){return modJs.validateCellValue($(this),e,t)})),this.afterCreateTable(e)}},{key:"afterCreateTable",value:function(e){}},{key:"addCellDataUpdate",value:function(e,t,n){this.cellDataUpdates["".concat(e,"=").concat(t)]=[e,t,n]}},{key:"addAdditionalRequestData",value:function(e,t){return t}},{key:"sendCellDataUpdates",value:function(){var e=this.cellDataUpdates;e.rowTable=this.rowTable,e.columnTable=this.columnTable,e.valueTable=this.valueTable,e=this.addAdditionalRequestData("updateData",e);var t=JSON.stringify(e),n=[];n.callBackData=[],n.callBackSuccess="updateDataSuccessCallBack",n.callBackFail="updateDataFailCallBack",this.showLoader(),this.customAction("updateData",this.modulePath,t,n)}},{key:"updateDataSuccessCallBack",value:function(e,t){this.hideLoader(),modJs.cellDataUpdates={},modJs.get()}},{key:"updateDataFailCallBack",value:function(e,t){this.hideLoader()}},{key:"sendAllCellDataUpdates",value:function(){var e=this.cellDataUpdates;e.rowTable=this.rowTable,e.columnTable=this.columnTable,e.valueTable=this.valueTable,e=this.addAdditionalRequestData("updateAllData",e);var t=JSON.stringify(e),n=[];n.callBackData=[],n.callBackSuccess="updateDataAllSuccessCallBack",n.callBackFail="updateDataAllFailCallBack",this.showLoader(),this.customAction("updateAllData",this.modulePath,t,n)}},{key:"updateDataAllSuccessCallBack",value:function(e,t){this.hideLoader(),modJs.cellDataUpdates={},modJs.getAllData(!0)}},{key:"updateDataAllFailCallBack",value:function(e,t){this.hideLoader()}},{key:"showActionButtons",value:function(){return!1}}])&&o(t.prototype,n),r&&o(t,r),s}(((r=e("./AdapterBase"))&&r.__esModule?r:{default:r}).default);n.default=u},{"./AdapterBase":4}],8:[function(e,t,n){var r;r=function(e){"use strict";function t(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,(function(n,r){n.state.autoRefresh&&(t(0,n.state.autoRefresh),n.state.autoRefresh=null),r&&0==n.display.wrapper.offsetHeight&&function(n,r){function i(){n.display.wrapper.offsetHeight?(t(0,r),n.display.lastWrapHeight!=n.display.wrapper.clientHeight&&n.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},e.on(window,"mouseup",r.hurry),e.on(window,"keyup",r.hurry)}(n,n.state.autoRefresh={delay:r.delay||250})}))},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}],9:[function(e,t,n){var r;r=function(e){var t={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},n=e.Pos;function r(e,n){return"pairs"==n&&"string"==typeof e?e:"object"==typeof e&&null!=e[n]?e[n]:t[n]}e.defineOption("autoCloseBrackets",!1,(function(t,n,a){a&&a!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),n&&(o(r(n,"pairs")),t.state.closeBrackets=n,t.addKeyMap(i))}));var i={Backspace:function(t){var i=l(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var o=r(i,"pairs"),a=t.listSelections(),c=0;c=0;c--){var d=a[c].head;t.replaceRange("",n(d.line,d.ch-1),n(d.line,d.ch+1),"+delete")}},Enter:function(t){var n=l(t),i=n&&r(n,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var o=t.listSelections(),a=0;a1&&f.indexOf(i)>=0&&t.getRange(n(b.line,b.ch-2),b)==i+i){if(b.ch>2&&/\bstring/.test(t.getTokenTypeAt(n(b.line,b.ch-2))))return e.Pass;g="addFour"}else if(h){var k=0==b.ch?" ":t.getRange(n(b.line,b.ch-1),b);if(e.isWordChar(w)||k==i||e.isWordChar(k))return e.Pass;g="both"}else{if(!m||!(0===w.length||/\s/.test(w)||d.indexOf(w)>-1))return e.Pass;g="both"}else g=h&&c(t,b)?"both":f.indexOf(i)>=0&&t.getRange(b,n(b.line,b.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=g)return e.Pass}else u=g}var x=s%2?a.charAt(s-1):i,C=s%2?i:a.charAt(s+1);t.operation((function(){if("skip"==u)t.execCommand("goCharRight");else if("skipThree"==u)for(var r=0;r<3;r++)t.execCommand("goCharRight");else if("surround"==u){var i=t.getSelections();for(r=0;r0,{anchor:new n(o.anchor.line,o.anchor.ch+(a?-1:1)),head:new n(o.head.line,o.head.ch+(a?1:-1))});t.setSelections(i)}else"both"==u?(t.replaceSelection(x+C,null),t.triggerElectric(x+C),t.execCommand("goCharLeft")):"addFour"==u&&(t.replaceSelection(x+x+x+x,"before"),t.execCommand("goCharRight"));var o,a}))}(i,t)}}function l(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function s(e,t){var r=e.getRange(n(t.line,t.ch-1),n(t.line,t.ch+1));return 2==r.length?r:null}function c(e,t){var r=e.getTokenAt(n(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}o(t.pairs+"`")},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}],10:[function(e,t,n){var r,i;r=this,i=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),c=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),d=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),m=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),g=m||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),k=d&&e.match(/Version\/(\d*\.\d*)/);k&&(k=Number(k[1])),k&&k>=15&&(d=!1,s=!0);var x=y&&(c||d&&(null==k||k<12.11)),C=n||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var T,L=function(e,t){var n=e.className,r=S(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function _(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function M(e,t){return _(e).appendChild(t)}function D(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}}m?E=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(E=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null,this.f=null,this.time=0,this.handler=B(this.onTimeout,this)};function H(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var V=[""];function J(e){for(;V.length<=e;)V.push(q(V)+" ");return V[e]}function q(e){return e[e.length-1]}function K(e,t){for(var n=[],r=0;r"€"&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&Q(e))||t.test(e):Q(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ne.test(e)}function ie(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var ae=null;function le(e,t,n){var r;ae=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ae=i)}return null!=r?r:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,l){var s="ltr"==l?"L":"R";if(0==a.length||"ltr"==l&&!e.test(a))return!1;for(var c,u=a.length,d=[],f=0;f-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var n=fe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function ye(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ke(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function xe(e){be(e),we(e)}function Ce(e){return e.target||e.srcElement}function Se(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Te,Le,_e=function(){if(a&&l<9)return!1;var e=D("div");return"draggable"in e||"dragDrop"in e}();function Me(e){if(null==Te){var t=D("span","​");M(e,D("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Te=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=Te?D("span","​"):D("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function De(e){if(null!=Le)return Le;var t=M(e,document.createTextNode("AخA")),n=T(t,0,1).getBoundingClientRect(),r=T(t,1,2).getBoundingClientRect();return _(e),!(!n||n.left==n.right)&&(Le=r.right-n.right<3)}var Ne,Ae=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Fe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Oe="oncopy"in(Ne=D("div"))||(Ne.setAttribute("oncopy","return;"),"function"==typeof Ne.oncopy),Pe=null,Ee={},Be={};function $e(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Ee[e]=t}function Ie(e){if("string"==typeof e&&Be.hasOwnProperty(e))e=Be[e];else if(e&&"string"==typeof e.name&&Be.hasOwnProperty(e.name)){var t=Be[e.name];"string"==typeof t&&(t={name:t}),(e=X(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ie("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ie("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Re(e,t){t=Ie(t);var n=Ee[t.name];if(!n)return Re(e,"text/plain");var r=n(e,t);if(He.hasOwnProperty(t.name)){var i=He[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var He={};function We(e,t){$(t,He.hasOwnProperty(e)?He[e]:He[e]={})}function ze(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function je(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ue(e,t,n){return!e.startState||e.startState(t,n)}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ve(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?et(n,Ve(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,Ve(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.post},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ct=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function dt(e,t,n,r){var i=[e.state.modeGen],o={};wt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var a=n.state,l=function(r){n.baseTokens=i;var l=e.state.overlays[r],s=1,c=0;n.state=!0,wt(e,t.text,l.mode,n,(function(e,t){for(var n=s;ce&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&ze(e.doc.mode,r.state),o=dt(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ut(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=Ve(o,l-1),c=s.stateAfter;if(c&&(!n||l+(c instanceof ct?c.lookAhead:0)<=o.modeFrontier))return l;var u=I(s.text,null,e.options.tabSize);(null==i||r>u)&&(i=l-1,r=u)}return i}(e,t,n),a=o>r.first&&Ve(r,o-1).stateAfter,l=a?ut.fromSaved(r,a,o):new ut(r,Ue(r.mode),o);return r.iter(o,t,(function(n){pt(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,n){return t instanceof ct?new ut(e,ze(e.mode,t.state),n,t.lookAhead):new ut(e,ze(e.mode,t),n)},ut.prototype.save=function(e){var t=!1!==e?ze(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t};var gt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function yt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=Ve(a,(t=lt(a,t)).line),c=ht(e,t.line,n),u=new Ge(s.text,e.options.tabSize,c);for(r&&(o=[]);(r||u.pose.options.maxHighlightLength?(l=!1,a&&pt(e,t,r,d.pos),d.pos=t.length,s=null):s=bt(vt(n,d,r.state,f),o),f){var h=f[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||u!=s){for(;c=t:o.to>t);(r||(r=[])).push(new Ct(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var b=0;bt)&&(!n||Ft(n,o.marker)<0)&&(n=o.marker)}return n}function $t(e,t,n,r,i){var o=Ve(e,t),a=xt&&o.markedSpans;if(a)for(var l=0;l=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.to,n)>=0:tt(c.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(c.from,r)<=0:tt(c.from,r)<0)))return!0}}}function It(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line;return e}function Rt(e,t){var n=Ve(e,t),r=It(n);return n==r?t:Ye(r)}function Ht(e,t){if(t>e.lastLine())return t;var n,r=Ve(e,t);if(!Wt(e,r))return t;for(;n=Et(r);)r=n.find(1,!0).line;return Ye(r)+1}function Wt(e,t){var n=xt&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Vt=function(e,t,n){this.text=e,Dt(this,t),this.height=n?n(this):1};function Jt(e){e.parent=null,Mt(e)}Vt.prototype.lineNo=function(){return Ye(this)},ye(Vt);var qt={},Kt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Kt:qt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Xt(e,t){var n=N("span",null,null,s?"padding-right: .1px":null),r={pre:N("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Qt,De(e.display.measure)&&(a=ce(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,ft(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=P(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=P(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Me(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=P(r.pre.className,r.textClass||"")),r}function Zt(e){var t=D("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,n,r,i,o,s){if(t){var c,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;ic&&d.from<=c);f++);if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,f,h=i.length,p=0,m=1,v="",g=0;;){if(g==p){s=c=u=l="",f=null,d=null,g=1/0;for(var y=[],b=void 0,w=0;wp||x.collapsed&&k.to==p&&k.from==p)){if(null!=k.to&&k.to!=p&&g>k.to&&(g=k.to,c=""),x.className&&(s+=" "+x.className),x.css&&(l=(l?l+";":"")+x.css),x.startStyle&&k.from==p&&(u+=" "+x.startStyle),x.endStyle&&k.to==g&&(b||(b=[])).push(x.endStyle,k.to),x.title&&((f||(f={})).title=x.title),x.attributes)for(var C in x.attributes)(f||(f={}))[C]=x.attributes[C];x.collapsed&&(!d||Ft(d.marker,x)<0)&&(d=k)}else k.from>p&&g>k.from&&(g=k.from)}if(b)for(var S=0;S=h)break;for(var L=Math.min(h,g);;){if(v){var _=p+v.length;if(!d){var M=_>L?v.slice(0,L-p):v;t.addToken(t,M,a?a+s:s,u,p+M.length==g?c:"",l,f)}if(_>=L){v=v.slice(L-p),p=L;break}p=_,u=""}v=i.slice(o,o=n[m++]),a=Yt(n[m++],t.cm.options)}}else for(var D=1;Dn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Nn(e,t,n,r){return On(e,Fn(e,t),n,r)}function An(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Bn(t.map,n,r),s=o.node,c=o.start,u=o.end,d=o.collapse;if(3==s.nodeType){for(var f=0;f<4;f++){for(;c&&re(t.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var h;c>0&&(d=r="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==r?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!c&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+ir(e.display),top:p.top,bottom:p.bottom}:En}for(var m=i.top-t.rect.top,v=i.bottom-t.rect.top,g=(m+v)/2,y=t.view.measure.heights,b=0;bt)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(r=e[c+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)r=e[2+(c-=3)],a="left";if("right"==n&&i==s-l)for(;c=0&&(n=e[i]).left==n.right;i--);return n}function In(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(s=r.text.length,c="before"):s<=0&&(s=0,c="after"),!l)return a("before"==c?s-1:s,"before"==c);function u(e,t,n){return a(n?e-1:e,1==l[t].level!=n)}var d=le(l,s,c),f=ae,h=u(s,d,"before"==c);return null!=f&&(h.other=u(s,f,"before"!=c)),h}function qn(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch);var r=Ve(e.doc,t.line),i=jt(r)+Cn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Kn(e,t,n,r,i){var o=et(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Yn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return Kn(r.first,0,null,-1,-1);var i=Xe(r,n),o=r.first+r.size-1;if(i>o)return Kn(r.first+r.size-1,Ve(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Ve(r,i);;){var l=er(e,a,i,t,n),s=Bt(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var c=s.find(1);if(c.line==i)return c;a=Ve(r,i=c.line)}}function Xn(e,t,n,r){r-=jn(t);var i=t.text.length,o=oe((function(t){return On(e,n,t-1).bottom<=r}),i,0);return{begin:o,end:i=oe((function(t){return On(e,n,t).top>r}),o,i)}}function Zn(e,t,n,r){return n||(n=Fn(e,t)),Xn(e,t,n,Un(e,t,On(e,n,r),"line").top)}function Qn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=jt(t);var o=Fn(e,t),a=jn(t),l=0,s=t.text.length,c=!0,u=ce(t,e.doc.direction);if(u){var d=(e.options.lineWrapping?nr:tr)(e,t,n,o,u,r,i);l=(c=1!=d.level)?d.from:d.to-1,s=c?d.to:d.from-1}var f,h,p=null,m=null,v=oe((function(t){var n=On(e,o,t);return n.top+=a,n.bottom+=a,!!Qn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,m=n),!0)}),l,s),g=!1;if(m){var y=r-m.left=w.bottom?1:0}return Kn(n,v=ie(t.text,v,1),h,g,r-f)}function tr(e,t,n,r,i,o,a){var l=oe((function(l){var s=i[l],c=1!=s.level;return Qn(Jn(e,et(n,c?s.to:s.from,c?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[l];if(l>0){var c=1!=s.level,u=Jn(e,et(n,c?s.from:s.to,c?"after":"before"),"line",t,r);Qn(u,o,a,!0)&&u.top>a&&(s=i[l-1])}return s}function nr(e,t,n,r,i,o,a){var l=Xn(e,t,r,a),s=l.begin,c=l.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,d=null,f=0;f=c||h.to<=s)){var p=On(e,r,1!=h.level?Math.min(c,h.to)-1:Math.max(s,h.from)).right,m=pm)&&(u=h,d=m)}}return u||(u=i[i.length-1]),u.fromc&&(u={from:u.from,to:c,level:u.level}),u}function rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Pn){Pn=D("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Pn.appendChild(document.createTextNode("x")),Pn.appendChild(D("br"));Pn.appendChild(document.createTextNode("x"))}M(e.measure,Pn);var n=Pn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),_(e.measure),n||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=D("span","xxxxxxxxxx"),n=D("pre",[t],"CodeMirror-line-like");M(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ar(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ar(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function lr(e){var t=rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(i){if(Wt(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)xt&&Rt(e.doc,t)i.viewFrom?hr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)hr(e);else if(t<=i.viewFrom){var o=pr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):hr(e)}else if(n>=i.viewTo){var a=pr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hr(e)}else{var l=pr(e,t,t,-1),s=pr(e,n,n+r,1);l&&s?(i.view=i.view.slice(0,l.index).concat(on(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):hr(e)}var c=i.externalMeasured;c&&(n=i.lineN&&t=r.viewTo)){var o=r.view[ur(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==H(a,n)&&a.push(n)}}}function hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pr(e,t,n,r){var i,o=ur(e,t),a=e.display.view;if(!xt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=e.display.viewFrom,s=0;s0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,n+=i}for(;Rt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function mr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||l.to().linet||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(m,n||0,null==r?f:r,(function(e,t,i,d){var v="ltr"==i,g=h(e,v?"left":"right"),y=h(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==f,k=0==d,x=!m||d==m.length-1;if(y.top-g.top<=3){var C=(c?w:b)&&x,S=(c?b:w)&&k?l:(v?g:y).left,T=C?s:(v?y:g).right;u(S,g.top,T-S,g.bottom)}else{var L,_,M,D;v?(L=c&&b&&k?l:g.left,_=c?s:p(e,i,"before"),M=c?l:p(t,i,"after"),D=c&&w&&x?s:y.right):(L=c?p(e,i,"before"):l,_=!c&&b&&k?s:g.right,M=!c&&w&&x?l:y.left,D=c?p(t,i,"after"):s),u(L,g.top,_-L,g.bottom),g.bottom0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function xr(e){e.state.focused||(e.display.input.focus(),Sr(e))}function Cr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Tr(e))}),100)}function Sr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,O(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),kr(e))}function Tr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Lr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||f<-.005)&&(Ke(i.line,s),_r(i.line),i.rest))for(var h=0;he.display.sizerWidth){var p=Math.ceil(c/ir(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function _r(e){if(e.widgets)for(var t=0;t=a&&(o=Xe(t,jt(Ve(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Dr(e,t){var n=e.display,r=rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Mn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Sn(n),s=t.topl-r;if(t.topi+o){var u=Math.min(t.top,(c?l:t.bottom)-o);u!=i&&(a.scrollTop=u)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,f=_n(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>f;return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.leftf+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function Nr(e,t){null!=t&&(Or(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Ar(e){Or(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fr(e,t,n){null==t&&null==n||Or(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Or(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Pr(e,qn(e,t.from),qn(e,t.to),t.margin))}function Pr(e,t,n,r){var i=Dr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Fr(e,i.scrollLeft,i.scrollTop)}function Er(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||si(e,{top:t}),Br(e,t,!0),n&&si(e),ri(e,100))}function Br(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function $r(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ir(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Sn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ln(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Rr=function(e,t,n){this.cm=n;var r=this.vert=D("div",[D("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=D("div",[D("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),de(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Rr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Rr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Rr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Rr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Hr=function(){};function Wr(e,t){t||(t=Ir(e));var n=e.display.barWidth,r=e.display.barHeight;zr(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Lr(e),zr(e,Ir(e)),n=e.display.barWidth,r=e.display.barHeight}function zr(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Hr.prototype.update=function(){return{bottom:0,right:0}},Hr.prototype.setScrollLeft=function(){},Hr.prototype.setScrollTop=function(){},Hr.prototype.clear=function(){};var jr={native:Rr,null:Hr};function Ur(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&L(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new jr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?$r(e,t):Er(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var Gr=0;function Vr(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Gr},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Jr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Kr(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Yr(e){var t=e.cm,n=t.display;e.updatedDisplay&&Lr(t),e.barMeasure=Ir(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Nn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ln(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-_n(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Xr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=D("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Cn(e.display))+"px;\n height: "+(t.bottom-t.top+Ln(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=Jn(e,t),s=n&&n!=t?Jn(e,n):l,c=Dr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),u=e.doc.scrollTop,d=e.doc.scrollLeft;if(null!=c.scrollTop&&(Er(e,c.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=c.scrollLeft&&($r(e,c.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ht(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?ze(t.mode,r.state):null,s=dt(e,o,r,!0);l&&(r.state=l),o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&fn)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Qr(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mr(e))return!1;fi(e)&&(hr(e),t.dims=or(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),xt&&(o=Rt(e.doc,o),a=Ht(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,ur(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=jt(Ve(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var c=mr(e);if(!l&&0==c&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=F();if(!t||!A(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&A(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return c>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function l(t){var n=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var c=r.view,u=r.viewFrom,d=0;d-1&&(h=!1),un(e,f,u,n)),h&&(_(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Qe(e.options,u)))),a=f.node.nextSibling}else{var p=gn(e,f,u,n);o.insertBefore(p,a)}u+=f.size}for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=F()&&(e.activeElt.focus(),e.anchorNode&&A(document.body,e.anchorNode)&&A(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(u),_(n.cursorDiv),_(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function li(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=_n(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Sn(e.display)-Mn(e),n.top)}),t.visible=Mr(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ai(e,t);r=!1){Lr(e);var i=Ir(e);vr(e),Wr(e,i),ui(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var n=new oi(e,t);if(ai(e,n)){Lr(e),li(e,n);var r=Ir(e);vr(e),Wr(e,r),ui(e,r),n.finish()}}function ci(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ui(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ln(e)+"px"}function di(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;al.clientWidth,u=l.scrollHeight>l.clientHeight;if(i&&c||o&&u){if(o&&y&&s)e:for(var f=t.target,h=a.view;f!=l;f=f.parentNode)for(var p=0;p=0&&tt(e,r.to())<=0)return n}return-1};var Ci=function(e,t){this.anchor=e,this.head=t};function Si(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return tt(e.from(),t.from())})),n=H(t,i);for(var o=1;o0:s>=0){var c=ot(l.from(),a.from()),u=it(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head;o<=n&&--n,t.splice(--o,2,new Ci(d?u:c,d?c:u))}}return new xi(t,n)}function Ti(e,t){return new xi([new Ci(e,t||e)],0)}function Li(e){return e.text?et(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function _i(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return Li(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Li(t).ch-t.to.ch),et(n,r)}function Mi(e,t){for(var n=[],r=0;r1&&e.remove(l.line+1,p-1),e.insert(l.line+1,g)}sn(e,"change",e,t)}function Pi(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;al-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ri(e.done),q(e.done)):e.done.length&&!q(e.done).ranges?q(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),q(e.done)):void 0}(i,i.lastOp==r)))a=q(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Li(t):o.changes.push(Ii(e,t));else{var s=q(i.done);for(s&&s.ranges||zi(e.sel,i.done),o={changes:[Ii(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function Wi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,q(i.done),t))?i.done[i.done.length-1]=t:zi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Ri(i.undone)}function zi(e,t){var n=q(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ji(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ui(e){if(!e)return null;for(var t,n=0;n-1&&(q(l)[d]=c[d],delete c[d])}}}return r}function Ji(e,t,n,r){if(r){var i=e.anchor;if(n){var o=tt(t,i)<0;o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new Ci(i,t)}return new Ci(n||t,t)}function qi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new xi([Ji(e.sel.primary(),t,n,i)],0),r)}function Ki(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:l.to>t.ch))){if(i&&(pe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var d=s.find(r<0?1:-1),f=void 0;if((r<0?u:c)&&(d=ao(e,d,-r,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=tt(d,n))&&(r<0?f<0:f>0))return io(e,d,t,r,i)}var h=s.find(r<0?-1:1);return(r<0?c:u)&&(h=ao(e,h,r,h.line==t.line?o:null)),h?io(e,h,t,r,i):null}}return t}function oo(e,t,n,r,i){var o=r||1,a=io(e,t,n,o,i)||!i&&io(e,t,n,o,!0)||io(e,t,n,-o,i)||!i&&io(e,t,n,-o,!0);return a||(e.cantEdit=!0,et(e.first,0))}function ao(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:n>0&&t.ch==(r||Ve(e,t.line)).text.length?t.line0)){var u=[s,1],d=tt(c.from,l.from),f=tt(c.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)uo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Mi(e,t);Hi(e,t,n,e.cm?e.cm.curOp.id:NaN),po(e,t,n,Lt(e,t));var r=[];Pi(e,(function(e,n){n||-1!=H(r,e.history)||(yo(e.history,t),r.push(e.history)),po(e,t,null,Lt(e,t))}))}}function fo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,c=0;c=0;--h){var p=f(h);if(p)return p.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new xi(K(e.sel.ranges,(function(e){return new Ci(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:et(o,Ve(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Je(e,t.from,t.to),n||(n=Mi(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=Ye(It(Ve(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Oi(r,t,n,lr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=Ut(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=Ve(e,r).stateAfter;if(i&&(!(i instanceof ct)||r+i.lookAhead1||!(this.children[0]instanceof wo))){var l=[];this.collapse(l),this.children=[new wo(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,l=a;l10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if($t(e,t.line,t,n,o)||t.line!=n.line&&$t(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");xt=!0}o.addToHistory&&Hi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,(function(e){c&&o.collapsed&&!c.options.lineWrapping&&It(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Ke(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Ct(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){Wt(e,t)&&Ke(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(kt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)dr(c,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=n.line;u++)fr(c,u,"text");o.atomic&&no(c.doc),sn(c,"markerAdded",c,o)}return o}To.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Vr(e),ge(this,"clear")){var n=this.find();n&&sn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=c,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&dr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&no(e.doc)),e&&sn(e,"markerCleared",e,this,r,i),t&&Jr(e),this.parent&&this.parent.clear()}},To.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)co(this,r[s]);l?Zi(this,l):this.cm&&Ar(this.cm)})),undo:ni((function(){fo(this,"undo")})),redo:ni((function(){fo(this,"redo")})),undoSelection:ni((function(){fo(this,"undo",!0)})),redoSelection:ni((function(){fo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var l=0;l=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n})),lt(this,et(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var u=e.dataTransfer.getData("Text");if(u){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),eo(t.doc,Ti(n,n)),d)for(var f=0;f=0;t--)mo(e.doc,"",r[t].from,r[t].to,"+delete");Ar(e)}))}function Zo(e,t,n){var r=ie(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Qo(e,t,n){var r=Zo(e,t.ch,n);return null==r?null:new et(t.line,r,n<0?"after":"before")}function ea(e,t,n,r,i){if(e){var o=ce(n,t.doc.direction);if(o){var a,l=i<0?q(o):o[0],s=i<0==(1==l.level)?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=Fn(t,n);a=i<0?n.text.length-1:0;var u=On(t,c,a).top;a=oe((function(e){return On(t,c,e).top==u}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Zo(n,a,1))}else a=i<0?l.to:l.from;return new et(r,a,s)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}jo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},jo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},jo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},jo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},jo.default=y?jo.macDefault:jo.pcDefault;var ta={selectAll:lo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),z)},killLine:function(e){return Xo(e,(function(t){if(t.empty()){var n=Ve(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Ve(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}n.push(new Ci(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Qr(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(tt((i=c.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,c=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,he(i.wrapper.ownerDocument,"mouseup",c),he(i.wrapper.ownerDocument,"mousemove",u),he(i.scroller,"dragstart",d),he(i.scroller,"drop",c),o||(be(t),r.addNew||qi(e.doc,n,null,null,r.extend),s||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()}),20):i.input.focus())})),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",c),de(i.wrapper.ownerDocument,"mousemove",u),de(i.scroller,"dragstart",d),de(i.scroller,"drop",c),Cr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;be(t);var a,l,s=o.sel,c=s.ranges;if(r.addNew&&!r.extend?(l=o.sel.contains(n),a=l>-1?c[l]:new Ci(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new Ci(n,n)),n=cr(e,t,!0,!0),l=-1;else{var u=ga(e,n,r.unit);a=r.extend?Ji(a,u.anchor,u.head,r.extend):u}r.addNew?-1==l?(l=c.length,Qi(o,Si(e,c.concat([a]),l),{scroll:!1,origin:"*mouse"})):c.length>1&&c[l].empty()&&"char"==r.unit&&!r.extend?(Qi(o,Si(e,c.slice(0,l).concat(c.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Yi(o,l,a,j):(l=0,Qi(o,new xi([a],0),j),s=o.sel);var d=n;function f(t){if(0!=tt(d,t))if(d=t,"rectangle"==r.unit){for(var i=[],c=e.options.tabSize,u=I(Ve(o,n.line).text,n.ch,c),f=I(Ve(o,t.line).text,t.ch,c),h=Math.min(u,f),p=Math.max(u,f),m=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=v;m++){var g=Ve(o,m).text,y=G(g,h,c);h==p?i.push(new Ci(et(m,y),et(m,y))):g.length>y&&i.push(new Ci(et(m,y),et(m,G(g,p,c))))}i.length||i.push(new Ci(n,n)),Qi(o,Si(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,k=ga(e,t,r.unit),x=w.anchor;tt(k.anchor,x)>0?(b=k.head,x=ot(w.from(),k.anchor)):(b=k.anchor,x=it(w.to(),k.head));var C=s.ranges.slice(0);C[l]=function(e,t){var n=t.anchor,r=t.head,i=Ve(e.doc,n.line);if(0==tt(n,r)&&n.sticky==r.sticky)return t;var o=ce(i);if(!o)return t;var a=le(o,n.ch,n.sticky),l=o[a];if(l.from!=n.ch&&l.to!=n.ch)return t;var s,c=a+(l.from==n.ch==(1!=l.level)?0:1);if(0==c||c==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=le(o,r.ch,r.sticky),d=u-a||(r.ch-n.ch)*(1==l.level?-1:1);s=u==c-1||u==c?d<0:d>0}var f=o[c+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,m=h?"after":"before";return n.ch==p&&n.sticky==m?t:new Ci(new et(n.line,p,m),r)}(e,new Ci(lt(o,x),b)),Qi(o,Si(e,C,l),j)}}var h=i.wrapper.getBoundingClientRect(),p=0;function m(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),he(i.wrapper.ownerDocument,"mousemove",v),he(i.wrapper.ownerDocument,"mouseup",g),o.history.lastSelOrigin=null}var v=ei(e,(function(t){0!==t.buttons&&Se(t)?function t(n){var a=++p,l=cr(e,n,!0,"rectangle"==r.unit);if(l)if(0!=tt(l,d)){e.curOp.focus=F(),f(l);var s=Mr(i,o);(l.line>=s.to||l.lineh.bottom?20:0;c&&setTimeout(ei(e,(function(){p==a&&(i.scroller.scrollTop+=c,t(n))})),50)}}(t):m(t)})),g=ei(e,m);e.state.selectingText=g,de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",g)}(e,r,t,o)}(t,r,o,e):Ce(e)==n.scroller&&be(e):2==i?(r&&qi(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(C?t.display.input.onContextMenu(e):Cr(t)))}}function ga(e,t,n){if("char"==n)return new Ci(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ci(et(t.line,0),lt(e.doc,et(t.line+1,0)));var r=n(e,t);return new Ci(r.from,r.to)}function ya(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&be(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!ge(e,n))return ke(t);o-=l.top-a.viewOffset;for(var s=0;s=i)return pe(e,n,e,Xe(e.doc,o),e.display.gutterSpecs[s].className,t),ke(t)}}function ba(e,t){return ya(e,t,"gutterClick",!0)}function wa(e,t){xn(e.display,t)||function(e,t){return!!ge(e,"gutterContextMenu")&&ya(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}function ka(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hn(e)}ma.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button};var xa={toString:function(){return"CodeMirror.Init"}},Ca={},Sa={};function Ta(e,t,n){if(!t!=!(n&&n!=xa)){var r=e.display.dragFunctions,i=t?de:he;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function La(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Gt(e)),sr(e),dr(e),Hn(e),setTimeout((function(){return Wr(e)}),100)}function _a(e,t){var n=this;if(!(this instanceof _a))return new _a(e,t);this.options=t=t?$(t):{},$(Ca,t,!1);var r=t.value;"string"==typeof r?r=new Ao(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _a.inputStyles[t.inputStyle](this),o=this.display=new vi(e,r,i,t);for(var c in o.wrapper.CodeMirror=this,ka(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ur(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!g&&o.input.focus(),a&&l<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;de(t.scroller,"mousedown",ei(e,va)),de(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!me(e,t)){var n=cr(e,t);if(n&&!ba(e,t)&&!xn(e.display,t)){be(t);var r=e.findWordAt(n);qi(e.doc,r.anchor,r.head)}}})):function(t){return me(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return wa(e,t)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}de(t.scroller,"touchstart",(function(i){if(!me(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ba(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!xn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,l=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new Ci(l,l):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(l):new Ci(et(l.line,0),lt(e.doc,et(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),be(n)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Er(e,t.scroller.scrollTop),$r(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return ki(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return ki(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||xe(t)},over:function(t){me(e,t)||(function(e,t){var n=cr(e,t);if(n){var r=document.createDocumentFragment();yr(e,n,r),e.display.dragCursor||(e.display.dragCursor=D("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,r)}}(e,t),xe(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Fo<100))xe(t);else if(!me(e,t)&&!xn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var n=D("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Oo),leave:function(t){me(e,t)||Po(e)}};var s=t.input.getField();de(s,"keyup",(function(t){return da.call(e,t)})),de(s,"keydown",ei(e,ua)),de(s,"keypress",ei(e,fa)),de(s,"focus",(function(t){return Sr(e,t)})),de(s,"blur",(function(t){return Tr(e,t)}))}(this),$o(),Vr(this),this.curOp.forceUpdate=!0,Ei(this,r),t.autofocus&&!g||this.hasFocus()?setTimeout(B(Sr,this),20):Tr(this),Sa)Sa.hasOwnProperty(c)&&Sa[c](n,t[c],xa);fi(this),t.finishInit&&t.finishInit(this);for(var u=0;u150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?I(Ve(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)f+=a,d+="\t";if(fa,s=Ae(t),c=null;if(l&&r.ranges.length>1)if(Na&&Na.text.join("\n")==t){if(r.ranges.length%Na.text.length==0){c=[];for(var u=0;u=0;f--){var h=r.ranges[f],p=h.from(),m=h.to();h.empty()&&(n&&n>0?p=et(p.line,p.ch-n):e.state.overwrite&&!l?m=et(m.line,Math.min(Ve(o,m.line).text.length,m.ch+q(s).length)):l&&Na&&Na.lineWise&&Na.text.join("\n")==t&&(p=m=et(p.line,0)));var v={from:p,to:m,text:c?c[f%c.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};co(e.doc,v),sn(e,"inputRead",e,v)}t&&!l&&Pa(e,t),Ar(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Oa(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Qr(t,(function(){return Fa(t,n,0,null,"paste")})),!0}function Pa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Da(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Ve(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Da(e,i.head.line,"smart"));a&&sn(e,"electricInput",e,i.head.line)}}}function Ea(e){for(var t=[],n=[],r=0;r=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=le(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&f>=u.begin)){var h=d?"before":"after";return new et(n.line,f,h)}}var p=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,s(e,1),"before"):new et(n.line,e,"after")};e>=0&&e0==(1!=a.level),c=l?r.begin:s(r.end,-1);if(a.from<=c&&c0?u.end:s(u.begin,-1);return null==v||r>0&&v==t.text.length||!(m=p(r>0?0:i.length-1,r,c(v)))?null:m}(e.cm,l,t,n):Qo(l,t,n))){if(r||(a=t.line+n)=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(l=Ve(e,a))))return!1;t=ea(i,e.cm,l,t.line,n)}else t=o;return!0}if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var c=null,u="group"==r,d=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(n<0)||s(!f);f=!1){var h=l.text.charAt(t.ch)||"\n",p=ee(h,d)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||f||p||(p="s"),c&&c!=p){n<0&&(n=1,s(),t.sticky="after");break}if(p&&(c=p),n>0&&!s(!f))break}var m=oo(e,t,o,a,!0);return nt(o,m)&&(m.hitSide=!0),m}function Ra(e,t,n,r){var i,o,a=e.doc,l=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(s-.5*rr(e.display),3);i=(n>0?t.bottom:t.top)+n*c}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Yn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Ha=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Wa(e,t){var n=An(e,t.line);if(!n||n.hidden)return null;var r=Ve(e.doc,t.line),i=Dn(n,r,t.line),o=ce(r,e.doc.direction),a="left";o&&(a=le(o,t.ch)%2?"right":"left");var l=Bn(i.map,t.ch,a);return l.offset="right"==l.collapse?l.end:l.start,l}function za(e,t){return t&&(e.bad=!0),e}function ja(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return za(e.clipPos(et(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Wa(t,i)||{node:s[0].measure.map[2],offset:0},u=o.liner.firstLine()&&(a=et(a.line-1,Ve(r.doc,a.line-1).length)),l.ch==Ve(r.doc,l.line).text.length&&l.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(e=ur(r,a.line))?(t=Ye(i.view[0].line),n=i.view[0].node):(t=Ye(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,c,u=ur(r,l.line);if(u==i.view.length-1?(s=i.viewTo-1,c=i.lineDiv.lastChild):(s=Ye(i.view[u+1].line)-1,c=i.view[u+1].node.previousSibling),!n)return!1;for(var d=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function u(e){e&&(c(),o+=e)}function d(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void u(n);var o,f=t.getAttribute("cm-marker");if(f){var h=e.findMarks(et(r,0),et(i+1,0),(v=+f,function(e){return e.id==v}));return void(h.length&&(o=h[0].find(0))&&u(Je(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&c();for(var m=0;m1&&f.length>1;)if(q(d)==q(f))d.pop(),f.pop(),s--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),t++}for(var h=0,p=0,m=d[0],v=f[0],g=Math.min(m.length,v.length);ha.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"");var k=et(t,h),x=et(s,f.length?q(f).length-p:0);return d.length>1||d[0]||tt(k,x)?(mo(r.doc,d,k,x,"+input"),!0):void 0},Ha.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ha.prototype.reset=function(){this.forceCompositionEnd()},Ha.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ha.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Ha.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Qr(this.cm,(function(){return dr(e.cm)}))},Ha.prototype.setUneditable=function(e){e.contentEditable="false"},Ha.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Fa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ha.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ha.prototype.onContextMenu=function(){},Ha.prototype.resetPosition=function(){},Ha.prototype.needsContentAttribute=!0;var Ga=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Ga.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!me(r,e)){if(r.somethingSelected())Aa({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Ea(r);Aa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,z):(n.prevInput="",i.value=t.text.join("\n"),E(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),de(i,"paste",(function(e){me(r,e)||Oa(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!xn(e,t)&&!me(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){xn(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Ga.prototype.createField=function(e){this.wrapper=$a(),this.textarea=this.wrapper.firstChild},Ga.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=gr(e);if(e.options.moveInputWithCursor){var i=Jn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ga.prototype.showSelection=function(e){var t=this.cm.display;M(t.cursorDiv,e.cursors),M(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ga.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&E(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Ga.prototype.getField=function(){return this.textarea},Ga.prototype.supportsTouch=function(){return!1},Ga.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ga.prototype.blur=function(){this.textarea.blur()},Ga.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ga.prototype.receivedFocus=function(){this.slowPoll()},Ga.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Ga.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Ga.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Fe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,c=Math.min(r.length,i.length);s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Ga.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ga.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Ga.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=cr(n,e),c=r.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Qi)(n.doc,Ti(o),z);var u,f=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=window.scrollY),r.input.focus(),s&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=g,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&v(),C){xe(e);var m=function(){he(window,"mouseup",m),setTimeout(g,20)};de(window,"mouseup",m)}else setTimeout(g,50)}function v(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function g(){if(t.contextMenuPending==g&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=f,a&&l<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),null!=i.selectionStart)){(!a||a&&l<9)&&v();var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(n,lo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(o,200)}}},Ga.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ga.prototype.setUneditable=function(){},Ga.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=xa&&i(e,t,n)}:i)}e.defineOption=n,e.Init=xa,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Ni(e)}),!0),n("indentUnit",2,Ni,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Ai(e),Hn(e),dr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(et(r,o))}r++}));for(var i=n.length-1;i>=0;i--)mo(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=xa&&e.refresh()})),n("specialCharPlaceholder",Zt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",g?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){ka(e),mi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Yo(t),i=n!=xa&&Yo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,La,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),mi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Wr(e)}),!0),n("scrollbarStyle","native",(function(e){Ur(e),Wr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),mi(e)}),!0),n("firstLineNumber",1,mi,!0),n("lineNumberFormatter",(function(e){return e}),mi,!0),n("showCursorWhenSelecting",!1,vr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Tr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Ta),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vr,!0),n("singleCursorHeightPerLine",!0,vr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ai,!0),n("addModeClass",!1,Ai,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Ai,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(_a),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ei(this,t[e])(this,n,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Yo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Da(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Ar(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s0&&Yi(this.doc,r,new Ci(o,c[r].to()),z)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e);var t,n=ft(this,Ve(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(e=o,i=!0),r=Ve(this.doc,e)}else r=e;return Un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-jt(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l,s=this.display,c=(e=Jn(this,lt(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),s.sizer.appendChild(t),"over"==r)c=e.top;else if("above"==r||"near"==r){var d=Math.max(s.wrapper.clientHeight,this.doc.height),f=Math.max(s.sizer.clientWidth,s.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>d)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=d&&(c=e.bottom),u+t.offsetWidth>f&&(u=f-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=s.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(s.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),n&&(o=this,a={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(l=Dr(o,a)).scrollTop&&Er(o,l.scrollTop),null!=l.scrollLeft&&$r(o,l.scrollLeft))},triggerOnKeyDown:ti(ua),triggerOnKeyPress:ti(fa),triggerOnKeyUp:da,triggerOnMouseDown:ti(va),execCommand:function(e){if(ta.hasOwnProperty(e))return ta[e].call(null,this)},triggerElectric:ti((function(e){Pa(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=lt(this.doc,e),a=0;a0&&a(t.charAt(n-1));)--n;for(;r.5)&&sr(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Ei(this,e),Hn(this),this.display.input.reset(),Fr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(_a);var Va="iter insert remove copy getEditor constructor".split(" ");for(var Ja in Ao.prototype)Ao.prototype.hasOwnProperty(Ja)&&H(Va,Ja)<0&&(_a.prototype[Ja]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ao.prototype[Ja]));return ye(Ao),_a.inputStyles={textarea:Ga,contenteditable:Ha},_a.defineMode=function(e){_a.defaults.mode||"null"==e||(_a.defaults.mode=e),$e.apply(this,arguments)},_a.defineMIME=function(e,t){Be[e]=t},_a.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),_a.defineMIME("text/plain","null"),_a.defineExtension=function(e,t){_a.prototype[e]=t},_a.defineDocExtension=function(e,t){Ao.prototype[e]=t},_a.fromTextArea=function(e,t){if((t=t?$(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=l.getValue()}var i;if(e.form&&(de(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=_a((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return l},function(e){e.off=he,e.on=de,e.wheelEventPixels=wi,e.Doc=Ao,e.splitLines=Ae,e.countColumn=I,e.findColumn=G,e.isWordChar=Q,e.Pass=W,e.signal=pe,e.Line=Vt,e.changeEnd=Li,e.scrollbarModel=jr,e.Pos=et,e.cmpPos=tt,e.modes=Ee,e.mimeModes=Be,e.resolveMode=Ie,e.getMode=Re,e.modeExtensions=He,e.extendMode=We,e.copyState=ze,e.startState=Ue,e.innerMode=je,e.commands=ta,e.keyMap=jo,e.keyName=Ko,e.isModifierKey=Jo,e.lookupKey=Vo,e.normalizeKeyMap=Go,e.StringStream=Ge,e.SharedTextMarker=_o,e.TextMarker=To,e.LineWidget=xo,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=xe,e.addClass=O,e.contains=A,e.rmClass=L,e.keyNames=Ro}(_a),_a.version="5.49.2",_a},"object"==typeof n&&void 0!==t?t.exports=i():"function"==typeof define&&define.amd?define(i):r.CodeMirror=i()},{}],11:[function(e,t,n){var r;r=function(e){"use strict";e.defineMode("javascript",(function(t,n){var r,i,o=t.indentUnit,a=n.statementIndent,l=n.jsonld,s=n.json||l,c=n.typescript,u=n.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),n=e("keyword b"),r=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:n,do:n,try:n,finally:n,return:i,break:i,continue:i,new:e("new"),delete:r,void:r,throw:r,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:r,export:e("export"),import:e("import"),extends:r,await:r}}(),f=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e,t,n){return r=e,i=n,t}function m(e,t){var n,r=e.next();if('"'==r||"'"==r)return t.tokenize=(n=r,function(e,t){var r,i=!1;if(l&&"@"==e.peek()&&e.match(h))return t.tokenize=m,p("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r;return i||(t.tokenize=m),p("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return p("number","number");if("."==r&&e.match(".."))return p("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return p(r);if("="==r&&e.eat(">"))return p("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number");if("/"==r)return e.eat("*")?(t.tokenize=v,v(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):Je(e,t,1)?(function(e){for(var t,n=!1,r=!1;null!=(t=e.next());){if(!n){if("/"==t&&!r)return;"["==t?r=!0:r&&"]"==t&&(r=!1)}n=!n&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()));if("`"==r)return t.tokenize=g,g(e,t);if("#"==r)return e.skipToEnd(),p("error","error");if("<"==r&&e.match("!--")||"-"==r&&e.match("->"))return e.skipToEnd(),p("comment","comment");if(f.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),p("operator","operator",e.current());if(u.test(r)){e.eatWhile(u);var i=e.current();if("."!=t.lastType){if(d.propertyIsEnumerable(i)){var o=d[i];return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function v(e,t){for(var n,r=!1;n=e.next();){if("/"==n&&r){t.tokenize=m;break}r="*"==n}return p("comment","comment")}function g(e,t){for(var n,r=!1;null!=(n=e.next());){if(!r&&("`"==n||"$"==n&&e.eat("{"))){t.tokenize=m;break}r=!r&&"\\"==n}return p("quasi","string-2",e.current())}function y(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var n=e.string.indexOf("=>",e.start);if(!(n<0)){if(c){var r=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,n));r&&(n=r.index)}for(var i=0,o=!1,a=n-1;a>=0;--a){var l=e.string.charAt(a),s="([{}])".indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(u.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function w(e,t,n,r,i,o){this.indented=e,this.column=t,this.type=n,this.prev=i,this.info=o,null!=r&&(this.align=r)}function k(e,t){for(var n=e.localVars;n;n=n.next)if(n.name==t)return!0;for(var r=e.context;r;r=r.prev)for(n=r.vars;n;n=n.next)if(n.name==t)return!0}var x={state:null,column:null,marked:null,cc:null};function C(){for(var e=arguments.length-1;e>=0;e--)x.cc.push(arguments[e])}function S(){return C.apply(null,arguments),!0}function T(e,t){for(var n=t;n;n=n.next)if(n.name==e)return!0;return!1}function L(e){var t=x.state;if(x.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,n){if(n){if(n.block){var r=e(t,n.prev);return r?r==n.prev?n:new M(r,n.vars,!0):null}return T(t,n.vars)?n:new M(n.prev,new D(t,n.vars),!1)}return null}(e,t.context);if(null!=r)return void(t.context=r)}else if(!T(e,t.localVars))return void(t.localVars=new D(e,t.localVars));n.globalVars&&!T(e,t.globalVars)&&(t.globalVars=new D(e,t.globalVars))}function _(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function M(e,t,n){this.prev=e,this.vars=t,this.block=n}function D(e,t){this.name=e,this.next=t}var N=new D("this",new D("arguments",null));function A(){x.state.context=new M(x.state.context,x.state.localVars,!1),x.state.localVars=N}function F(){x.state.context=new M(x.state.context,x.state.localVars,!0),x.state.localVars=null}function O(){x.state.localVars=x.state.context.vars,x.state.context=x.state.context.prev}function P(e,t){var n=function(){var n=x.state,r=n.indented;if("stat"==n.lexical.type)r=n.lexical.indented;else for(var i=n.lexical;i&&")"==i.type&&i.align;i=i.prev)r=i.indented;n.lexical=new w(r,x.stream.column(),e,null,n.lexical,t)};return n.lex=!0,n}function E(){var e=x.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function B(e){return function t(n){return n==e?S():";"==e||"}"==n||")"==n||"]"==n?C():S(t)}}function $(e,t){return"var"==e?S(P("vardef",t),ye,B(";"),E):"keyword a"==e?S(P("form"),W,$,E):"keyword b"==e?S(P("form"),$,E):"keyword d"==e?x.stream.match(/^\s*$/,!1)?S():S(P("stat"),j,B(";"),E):"debugger"==e?S(B(";")):"{"==e?S(P("}"),F,oe,E,O):";"==e?S():"if"==e?("else"==x.state.lexical.info&&x.state.cc[x.state.cc.length-1]==E&&x.state.cc.pop()(),S(P("form"),W,$,E,Se)):"function"==e?S(Me):"for"==e?S(P("form"),Te,$,E):"class"==e||c&&"interface"==t?(x.marked="keyword",S(P("form","class"==e?e:t),Oe,E)):"variable"==e?c&&"declare"==t?(x.marked="keyword",S($)):c&&("module"==t||"enum"==t||"type"==t)&&x.stream.match(/^\s*\w/,!1)?(x.marked="keyword","enum"==t?S(Ge):"type"==t?S(Ne,B("operator"),ue,B(";")):S(P("form"),be,B("{"),P("}"),oe,E,E)):c&&"namespace"==t?(x.marked="keyword",S(P("form"),R,$,E)):c&&"abstract"==t?(x.marked="keyword",S($)):S(P("stat"),Z):"switch"==e?S(P("form"),W,B("{"),P("}","switch"),F,oe,E,E,O):"case"==e?S(R,B(":")):"default"==e?S(B(":")):"catch"==e?S(P("form"),A,I,$,E,O):"export"==e?S(P("stat"),$e,E):"import"==e?S(P("stat"),Re,E):"async"==e?S($):"@"==t?S(R,$):C(P("stat"),R,B(";"),E)}function I(e){if("("==e)return S(Ae,B(")"))}function R(e,t){return z(e,t,!1)}function H(e,t){return z(e,t,!0)}function W(e){return"("!=e?C():S(P(")"),R,B(")"),E)}function z(e,t,n){if(x.state.fatArrowAt==x.stream.start){var r=n?K:q;if("("==e)return S(A,P(")"),re(Ae,")"),E,B("=>"),r,O);if("variable"==e)return C(A,be,B("=>"),r,O)}var i=n?G:U;return b.hasOwnProperty(e)?S(i):"function"==e?S(Me,i):"class"==e||c&&"interface"==t?(x.marked="keyword",S(P("form"),Fe,E)):"keyword c"==e||"async"==e?S(n?H:R):"("==e?S(P(")"),j,B(")"),E,i):"operator"==e||"spread"==e?S(n?H:R):"["==e?S(P("]"),Ue,E,i):"{"==e?ie(ee,"}",null,i):"quasi"==e?C(V,i):"new"==e?S(function(e){return function(t){return"."==t?S(e?X:Y):"variable"==t&&c?S(me,e?G:U):C(e?H:R)}}(n)):"import"==e?S(R):S()}function j(e){return e.match(/[;\}\)\],]/)?C():C(R)}function U(e,t){return","==e?S(R):G(e,t,!1)}function G(e,t,n){var r=0==n?U:G,i=0==n?R:H;return"=>"==e?S(A,n?K:q,O):"operator"==e?/\+\+|--/.test(t)||c&&"!"==t?S(r):c&&"<"==t&&x.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?S(P(">"),re(ue,">"),E,r):"?"==t?S(R,B(":"),i):S(i):"quasi"==e?C(V,r):";"!=e?"("==e?ie(H,")","call",r):"."==e?S(Q,r):"["==e?S(P("]"),j,B("]"),E,r):c&&"as"==t?(x.marked="keyword",S(ue,r)):"regexp"==e?(x.state.lastType=x.marked="operator",x.stream.backUp(x.stream.pos-x.stream.start-1),S(i)):void 0:void 0}function V(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?S(V):S(R,J)}function J(e){if("}"==e)return x.marked="string-2",x.state.tokenize=g,S(V)}function q(e){return y(x.stream,x.state),C("{"==e?$:R)}function K(e){return y(x.stream,x.state),C("{"==e?$:H)}function Y(e,t){if("target"==t)return x.marked="keyword",S(U)}function X(e,t){if("target"==t)return x.marked="keyword",S(G)}function Z(e){return":"==e?S(E,$):C(U,B(";"),E)}function Q(e){if("variable"==e)return x.marked="property",S()}function ee(e,t){return"async"==e?(x.marked="property",S(ee)):"variable"==e||"keyword"==x.style?(x.marked="property","get"==t||"set"==t?S(te):(c&&x.state.fatArrowAt==x.stream.start&&(n=x.stream.match(/^\s*:\s*/,!1))&&(x.state.fatArrowAt=x.stream.pos+n[0].length),S(ne))):"number"==e||"string"==e?(x.marked=l?"property":x.style+" property",S(ne)):"jsonld-keyword"==e?S(ne):c&&_(t)?(x.marked="keyword",S(ee)):"["==e?S(R,ae,B("]"),ne):"spread"==e?S(H,ne):"*"==t?(x.marked="keyword",S(ee)):":"==e?C(ne):void 0;var n}function te(e){return"variable"!=e?C(ne):(x.marked="property",S(Me))}function ne(e){return":"==e?S(H):"("==e?C(Me):void 0}function re(e,t,n){function r(i,o){if(n?n.indexOf(i)>-1:","==i){var a=x.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),S((function(n,r){return n==t||r==t?C():C(e)}),r)}return i==t||o==t?S():n&&n.indexOf(";")>-1?C(e):S(B(t))}return function(n,i){return n==t||i==t?S():C(e,r)}}function ie(e,t,n){for(var r=3;r"),ue):void 0}function de(e){if("=>"==e)return S(ue)}function fe(e,t){return"variable"==e||"keyword"==x.style?(x.marked="property",S(fe)):"?"==t||"number"==e||"string"==e?S(fe):":"==e?S(ue):"["==e?S(B("variable"),le,B("]"),fe):"("==e?C(De,fe):void 0}function he(e,t){return"variable"==e&&x.stream.match(/^\s*[?:]/,!1)||"?"==t?S(he):":"==e?S(ue):"spread"==e?S(he):C(ue)}function pe(e,t){return"<"==t?S(P(">"),re(ue,">"),E,pe):"|"==t||"."==e||"&"==t?S(ue):"["==e?S(ue,B("]"),pe):"extends"==t||"implements"==t?(x.marked="keyword",S(ue)):"?"==t?S(ue,B(":"),ue):void 0}function me(e,t){if("<"==t)return S(P(">"),re(ue,">"),E,pe)}function ve(){return C(ue,ge)}function ge(e,t){if("="==t)return S(ue)}function ye(e,t){return"enum"==t?(x.marked="keyword",S(Ge)):C(be,ae,xe,Ce)}function be(e,t){return c&&_(t)?(x.marked="keyword",S(be)):"variable"==e?(L(t),S()):"spread"==e?S(be):"["==e?ie(ke,"]"):"{"==e?ie(we,"}"):void 0}function we(e,t){return"variable"!=e||x.stream.match(/^\s*:/,!1)?("variable"==e&&(x.marked="property"),"spread"==e?S(be):"}"==e?C():"["==e?S(R,B("]"),B(":"),we):S(B(":"),be,xe)):(L(t),S(xe))}function ke(){return C(be,xe)}function xe(e,t){if("="==t)return S(H)}function Ce(e){if(","==e)return S(ye)}function Se(e,t){if("keyword b"==e&&"else"==t)return S(P("form","else"),$,E)}function Te(e,t){return"await"==t?S(Te):"("==e?S(P(")"),Le,E):void 0}function Le(e){return"var"==e?S(ye,_e):"variable"==e?S(_e):C(_e)}function _e(e,t){return")"==e?S():";"==e?S(_e):"in"==t||"of"==t?(x.marked="keyword",S(R,_e)):C(R,_e)}function Me(e,t){return"*"==t?(x.marked="keyword",S(Me)):"variable"==e?(L(t),S(Me)):"("==e?S(A,P(")"),re(Ae,")"),E,se,$,O):c&&"<"==t?S(P(">"),re(ve,">"),E,Me):void 0}function De(e,t){return"*"==t?(x.marked="keyword",S(De)):"variable"==e?(L(t),S(De)):"("==e?S(A,P(")"),re(Ae,")"),E,se,O):c&&"<"==t?S(P(">"),re(ve,">"),E,De):void 0}function Ne(e,t){return"keyword"==e||"variable"==e?(x.marked="type",S(Ne)):"<"==t?S(P(">"),re(ve,">"),E):void 0}function Ae(e,t){return"@"==t&&S(R,Ae),"spread"==e?S(Ae):c&&_(t)?(x.marked="keyword",S(Ae)):c&&"this"==e?S(ae,xe):C(be,ae,xe)}function Fe(e,t){return"variable"==e?Oe(e,t):Pe(e,t)}function Oe(e,t){if("variable"==e)return L(t),S(Pe)}function Pe(e,t){return"<"==t?S(P(">"),re(ve,">"),E,Pe):"extends"==t||"implements"==t||c&&","==e?("implements"==t&&(x.marked="keyword"),S(c?ue:R,Pe)):"{"==e?S(P("}"),Ee,E):void 0}function Ee(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||c&&_(t))&&x.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(x.marked="keyword",S(Ee)):"variable"==e||"keyword"==x.style?(x.marked="property",S(c?Be:Me,Ee)):"number"==e||"string"==e?S(c?Be:Me,Ee):"["==e?S(R,ae,B("]"),c?Be:Me,Ee):"*"==t?(x.marked="keyword",S(Ee)):c&&"("==e?C(De,Ee):";"==e||","==e?S(Ee):"}"==e?S():"@"==t?S(R,Ee):void 0}function Be(e,t){if("?"==t)return S(Be);if(":"==e)return S(ue,xe);if("="==t)return S(H);var n=x.state.lexical.prev;return C(n&&"interface"==n.info?De:Me)}function $e(e,t){return"*"==t?(x.marked="keyword",S(je,B(";"))):"default"==t?(x.marked="keyword",S(R,B(";"))):"{"==e?S(re(Ie,"}"),je,B(";")):C($)}function Ie(e,t){return"as"==t?(x.marked="keyword",S(B("variable"))):"variable"==e?C(H,Ie):void 0}function Re(e){return"string"==e?S():"("==e?C(R):C(He,We,je)}function He(e,t){return"{"==e?ie(He,"}"):("variable"==e&&L(t),"*"==t&&(x.marked="keyword"),S(ze))}function We(e){if(","==e)return S(He,We)}function ze(e,t){if("as"==t)return x.marked="keyword",S(He)}function je(e,t){if("from"==t)return x.marked="keyword",S(R)}function Ue(e){return"]"==e?S():C(re(H,"]"))}function Ge(){return C(P("form"),be,B("{"),P("}"),re(Ve,"}"),E,E)}function Ve(){return C(be,xe)}function Je(e,t,n){return t.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(n||0)))}return O.lex=!0,E.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new w((e||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&new M(null,null,!1),indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),y(e,t)),t.tokenize!=v&&e.eatSpace())return null;var n=t.tokenize(e,t);return"comment"==r?n:(t.lastType="operator"!=r||"++"!=i&&"--"!=i?r:"incdec",function(e,t,n,r,i){var o=e.cc;for(x.state=e,x.stream=i,x.marked=null,x.cc=o,x.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?R:$)(n,r)){for(;o.length&&o[o.length-1].lex;)o.pop()();return x.marked?x.marked:"variable"==n&&k(e,r)?"variable-2":t}}(t,n,r,i,e))},indent:function(t,r){if(t.tokenize==v)return e.Pass;if(t.tokenize!=m)return 0;var i,l=r&&r.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(r))for(var c=t.cc.length-1;c>=0;--c){var u=t.cc[c];if(u==E)s=s.prev;else if(u!=Se)break}for(;("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==U||i==G)&&!/^[,\.=+\-*:?[\(]/.test(r));)s=s.prev;a&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var d=s.type,h=l==d;return"vardef"==d?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==d&&"{"==l?s.indented:"form"==d?s.indented+o:"stat"==d?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?a||o:0):"switch"!=s.info||h||0==n.doubleIndentSwitch?s.align?s.column+(h?0:1):s.indented+(h?0:o):s.indented+(/^(?:case|default)\b/.test(r)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:Je,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=R&&t!=H||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})},"object"==typeof n&&"object"==typeof t?r(e("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)},{"../../lib/codemirror":10}]},{},[1]); //# sourceMappingURL=payroll.js.map diff --git a/web/admin/src/data/lib.js b/web/admin/src/data/lib.js index bc16e997..c7f74ff0 100644 --- a/web/admin/src/data/lib.js +++ b/web/admin/src/data/lib.js @@ -188,7 +188,7 @@ class DataImportAdapter extends AdapterBase { const deleteButton = ''; const cloneButton = ''; - let html = '
    _edit__download__clone__delete_
    '; + let html = '
    _edit__download__clone__delete_
    '; if (this.showAddNew) { @@ -268,7 +268,7 @@ class DataImportFileAdapter extends AdapterBase { const deleteButton = ''; const cloneButton = ''; - let html = '
    _edit__process__clone__delete_
    '; + let html = '
    _edit__process__clone__delete_
    '; if (this.showAddNew) { diff --git a/web/admin/src/employees/lib.js b/web/admin/src/employees/lib.js index ab67cebe..c5e286f1 100644 --- a/web/admin/src/employees/lib.js +++ b/web/admin/src/employees/lib.js @@ -749,7 +749,7 @@ class EmployeeAdapter extends SubProfileEnabledAdapterBase { deleteBtn = ''; } // eslint-disable-next-line max-len - let html = `
    + let html = `
    @@ -1218,7 +1218,7 @@ class TerminatedEmployeeAdapter extends EmployeeAdapter { getActionButtonsHtml(id) { // eslint-disable-next-line max-len - let html = `
    + let html = `
    @@ -1303,7 +1303,7 @@ class ArchivedEmployeeAdapter extends SubProfileEnabledAdapterBase { getActionButtonsHtml(id) { // eslint-disable-next-line max-len - let html = '
    '; + let html = '
    '; html = html.replace(/_id_/g, id); html = html.replace(/_BASE_/g, this.baseUrl); return html; diff --git a/web/admin/src/payroll/lib.js b/web/admin/src/payroll/lib.js index 7193bd59..752271a2 100644 --- a/web/admin/src/payroll/lib.js +++ b/web/admin/src/payroll/lib.js @@ -56,7 +56,7 @@ class PaydayAdapter extends AdapterBase { getActionButtonsHtml(id, data) { const editButton = ''; - let html = '
    _edit_
    '; + let html = '
    _edit_
    '; html = html.replace('_edit_', editButton); html = html.replace(/_id_/g, id); @@ -160,7 +160,7 @@ class PayrollAdapter extends AdapterBase { const deleteButton = ''; const cloneButton = ''; - let html = '
    _edit__process__clone__delete_
    '; + let html = '
    _edit__process__clone__delete_
    '; if (this.showAddNew) {