From 1e28cbf3ba9b1f2038b61b1576a7be1e39e040ce Mon Sep 17 00:00:00 2001 From: Mathieu De Keyzer Date: Tue, 24 Sep 2024 11:21:46 +0200 Subject: [PATCH] fix(admin/filter): remove btn with a2lix_lib (#1017) --- EMS/core-bundle/assets/js/EmsListeners.js | 5 +++-- .../src/Form/Field/FilterOptionsType.php | 4 +++- ...dbea13d.js => app.1976fbfb7302ec783bfc.js} | 2 +- ...e4.js => calendar.56a87d0e5db9d7b347be.js} | 2 +- ...=> criteria-table.c26c7eab524cd3774a37.js} | 2 +- ... => criteria-view.e2995a159602082c2f69.js} | 2 +- ... => edit-revision.4b0ba322dae662a4b4ea.js} | 2 +- ...s => hierarchical.e17a99b559590a2340bd.js} | 2 +- ...8a18f3.js => i18n.09c5b6ee0bd0b8c2f278.js} | 2 +- ... => managed-alias.b1f0e4f1872ecebe22cd.js} | 2 +- ...f0.js => template.63edd994b0b361aa2b95.js} | 2 +- ...s => user-profile.1312835b05dd81812d97.js} | 2 +- .../src/Resources/public/manifest.json | 20 +++++++++---------- .../src/Resources/views/form/fields.html.twig | 11 ++++++++++ 14 files changed, 37 insertions(+), 23 deletions(-) rename EMS/core-bundle/src/Resources/public/js/{app.ab99ac44d017ddbea13d.js => app.1976fbfb7302ec783bfc.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{calendar.33f2617bee514999d2e4.js => calendar.56a87d0e5db9d7b347be.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{criteria-table.5ab460dbfa6883e9196c.js => criteria-table.c26c7eab524cd3774a37.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{criteria-view.9fc87fc7a923f64ba6e7.js => criteria-view.e2995a159602082c2f69.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{edit-revision.5ccda4b17084e023c207.js => edit-revision.4b0ba322dae662a4b4ea.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{hierarchical.331ba5d954f1d61a0b14.js => hierarchical.e17a99b559590a2340bd.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{i18n.b137f005c64ab18a18f3.js => i18n.09c5b6ee0bd0b8c2f278.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{managed-alias.974987636d9e848dc631.js => managed-alias.b1f0e4f1872ecebe22cd.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{template.ba6b739bf07cdc4d8ff0.js => template.63edd994b0b361aa2b95.js} (96%) rename EMS/core-bundle/src/Resources/public/js/{user-profile.2c5173bce299c3bbdca0.js => user-profile.1312835b05dd81812d97.js} (96%) diff --git a/EMS/core-bundle/assets/js/EmsListeners.js b/EMS/core-bundle/assets/js/EmsListeners.js index 9e017e96b..39da134e2 100644 --- a/EMS/core-bundle/assets/js/EmsListeners.js +++ b/EMS/core-bundle/assets/js/EmsListeners.js @@ -756,12 +756,13 @@ export default class EmsListeners { addA2LixLibSfCollection() { jquery(this.target).find('.a2lix_lib_sf_collection').each(function () { + const langRemove = $(this).data('lang-remove') a2lix_lib.sfCollection.init({ collectionsSelector: '#' + $(this).attr('id'), - manageRemoveEntry: true, + manageRemoveEntry: undefined !== langRemove, lang: { add: $(this).data('lang-add'), - remove: $(this).data('lang-remove'), + remove: langRemove ?? '', } }); }); diff --git a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php index f25fdb5c2..ceebcc2d0 100644 --- a/EMS/core-bundle/src/Form/Field/FilterOptionsType.php +++ b/EMS/core-bundle/src/Form/Field/FilterOptionsType.php @@ -184,11 +184,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'attr' => [ 'class' => 'a2lix_lib_sf_collection filter_option fields-to-display-for fields-to-display-for-synonym', 'data-lang-add' => 'Add synonyms', - 'data-lang-remove' => 'X', 'data-entry-remove-class' => 'btn btn-danger', ], 'entry_options' => [ 'label' => false, + 'row_attr' => [ + 'class' => 'input-group filter-container', + ], ], 'allow_add' => true, 'allow_delete' => true, diff --git a/EMS/core-bundle/src/Resources/public/js/app.ab99ac44d017ddbea13d.js b/EMS/core-bundle/src/Resources/public/js/app.1976fbfb7302ec783bfc.js similarity index 96% rename from EMS/core-bundle/src/Resources/public/js/app.ab99ac44d017ddbea13d.js rename to EMS/core-bundle/src/Resources/public/js/app.1976fbfb7302ec783bfc.js index 8f40989b5..90ebe6f56 100644 --- a/EMS/core-bundle/src/Resources/public/js/app.ab99ac44d017ddbea13d.js +++ b/EMS/core-bundle/src/Resources/public/js/app.1976fbfb7302ec783bfc.js @@ -38,7 +38,7 @@ function(t){var e=i,n=e.lib,r=n.WordArray,o=n.Hasher,s=e.algo,a=r.create([0,1,2, * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -!function(t,e,n){"use strict";var i=function(e,n){this.widget="",this.$element=t(e),this.defaultTime=n.defaultTime,this.disableFocus=n.disableFocus,this.disableMousewheel=n.disableMousewheel,this.isOpen=n.isOpen,this.minuteStep=n.minuteStep,this.modalBackdrop=n.modalBackdrop,this.orientation=n.orientation,this.secondStep=n.secondStep,this.snapToStep=n.snapToStep,this.showInputs=n.showInputs,this.showMeridian=n.showMeridian,this.showSeconds=n.showSeconds,this.template=n.template,this.appendWidgetTo=n.appendWidgetTo,this.showWidgetOnAddonClick=n.showWidgetOnAddonClick,this.icons=n.icons,this.maxHours=n.maxHours,this.explicitMode=n.explicitMode,this.handleDocumentClick=function(t){var e=t.data.scope;e.$element.parent().find(t.target).length||e.$widget.is(t.target)||e.$widget.find(t.target).length||e.hideWidget()},this._init()};i.prototype={constructor:i,_init:function(){var e=this;this.showWidgetOnAddonClick&&this.$element.parent().hasClass("input-group")&&this.$element.parent().hasClass("bootstrap-timepicker")?(this.$element.parent(".input-group.bootstrap-timepicker").find(".input-group-addon").on({"click.timepicker":t.proxy(this.showWidget,this)}),this.$element.on({"focus.timepicker":t.proxy(this.highlightUnit,this),"click.timepicker":t.proxy(this.highlightUnit,this),"keydown.timepicker":t.proxy(this.elementKeydown,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)})):this.template?this.$element.on({"focus.timepicker":t.proxy(this.showWidget,this),"click.timepicker":t.proxy(this.showWidget,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)}):this.$element.on({"focus.timepicker":t.proxy(this.highlightUnit,this),"click.timepicker":t.proxy(this.highlightUnit,this),"keydown.timepicker":t.proxy(this.elementKeydown,this),"blur.timepicker":t.proxy(this.blurElement,this),"mousewheel.timepicker DOMMouseScroll.timepicker":t.proxy(this.mousewheel,this)}),!1!==this.template?this.$widget=t(this.getTemplate()).on("click",t.proxy(this.widgetClick,this)):this.$widget=!1,this.showInputs&&!1!==this.$widget&&this.$widget.find("input").each((function(){t(this).on({"click.timepicker":function(){t(this).select()},"keydown.timepicker":t.proxy(e.widgetKeydown,e),"keyup.timepicker":t.proxy(e.widgetKeyup,e)})})),this.setDefaultTime(this.defaultTime)},blurElement:function(){this.highlightedUnit=null,this.updateFromElementVal()},clear:function(){this.hour="",this.minute="",this.second="",this.meridian="",this.$element.val("")},decrementHour:function(){if(this.showMeridian)if(1===this.hour)this.hour=12;else{if(12===this.hour)return this.hour--,this.toggleMeridian();if(0===this.hour)return this.hour=11,this.toggleMeridian();this.hour--}else this.hour<=0?this.hour=this.maxHours-1:this.hour--},decrementMinute:function(t){var e;(e=t?this.minute-t:this.minute-this.minuteStep)<0?(this.decrementHour(),this.minute=e+60):this.minute=e},decrementSecond:function(){var t=this.second-this.secondStep;t<0?(this.decrementMinute(!0),this.second=t+60):this.second=t},elementKeydown:function(t){switch(t.which){case 9:if(t.shiftKey){if("hour"===this.highlightedUnit){this.hideWidget();break}this.highlightPrevUnit()}else{if(this.showMeridian&&"meridian"===this.highlightedUnit||this.showSeconds&&"second"===this.highlightedUnit||!this.showMeridian&&!this.showSeconds&&"minute"===this.highlightedUnit){this.hideWidget();break}this.highlightNextUnit()}t.preventDefault(),this.updateFromElementVal();break;case 27:this.updateFromElementVal();break;case 37:t.preventDefault(),this.highlightPrevUnit(),this.updateFromElementVal();break;case 38:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.incrementHour(),this.highlightHour();break;case"minute":this.incrementMinute(),this.highlightMinute();break;case"second":this.incrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}this.update();break;case 39:t.preventDefault(),this.highlightNextUnit(),this.updateFromElementVal();break;case 40:switch(t.preventDefault(),this.highlightedUnit){case"hour":this.decrementHour(),this.highlightHour();break;case"minute":this.decrementMinute(),this.highlightMinute();break;case"second":this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian()}this.update()}},getCursorPosition:function(){var t=this.$element.get(0);if("selectionStart"in t)return t.selectionStart;if(n.selection){t.focus();var e=n.selection.createRange(),i=n.selection.createRange().text.length;return e.moveStart("character",-t.value.length),e.text.length-i}},getTemplate:function(){var t,e,n,i,r,o;switch(this.showInputs?(e='',n='',i='',r=''):(e='',n='',i='',r=''),o=''+(this.showSeconds?'':"")+(this.showMeridian?'':"")+" "+(this.showSeconds?'":"")+(this.showMeridian?'":"")+''+(this.showSeconds?'':"")+(this.showMeridian?'':"")+"
   
"+e+' :'+n+":'+i+" '+r+"
  
",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),d=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),h=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(h-=n-d)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?h-=l.left-10:l.left+n>r&&(h=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:h,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function d(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&d(e.prototype,n),i&&d(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:d,readOnly:c,maxLines:u,minLines:f,theme:h});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),d=m(t).find(".progress-text"),h=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(d).html("Extracting information from asset..."),m(h).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(d).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),d=i.find(".date"),h=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),d.val(""),h.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new h(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),d=m(t).find(".asset-hash-signature"),h=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),d.empty(),i.val(""),r.val(""),m(h).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),d=e.data("locale"),h=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==d&&(e.locale=d),void 0!==h&&(e.referrerEmsId=h),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new d).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=h(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=h(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=h(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=h(this).attr("data-height");t||(t=400);var n=h(this).attr("data-format-tags");n&&(g.format_tags=n);var i=h(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=h(this).attr("data-content-css");r&&(g.contentsCss=r);var o=h(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=h(this).attr("data-referrer-ems-id");var s=h(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[h(this).attr("id")]&&!1===h(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[h(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:h(this).data("show-meridian"),explicitMode:h(this).data("explicit-mode"),minuteStep:h(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};h(this).unbind("change"),h(this).not(".ignore-ems-update")?e&&h(this).timepicker(t).on("changeTime.timepicker",e):h(this).timepicker(t)})),t.find(".datepicker").each((function(){h(this).unbind("change");var t={format:h(this).attr("data-date-format"),todayBtn:!0,weekStart:h(this).attr("data-week-start"),daysOfWeekHighlighted:h(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:h(this).attr("data-days-of-week-disabled"),todayHighlight:h(this).attr("data-today-highlight")};h(this).attr("data-multidate")&&"false"!==h(this).attr("data-multidate")&&(t.multidate=!0),h(this).datepicker(t),e&&h(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=h(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var d=this.modal.querySelector("form");d&&d.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var h=this.modal.querySelector("#ajax-modal-submit");h&&(h.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function d(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=T(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=h(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=d;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=h(t[o],t,s);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){d.value=t,a(d)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function T(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=h(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var h=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),h.width=u,h.height=f,h.getContext("2d").drawImage(c,0,0,u,f);var p=d(h.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function d(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),d=0;d"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function T(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function C(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){T(o,i,r,s,a,"next",t)}function a(t){T(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,d,h,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,B,t.dataset.sortId),S(this,Y,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,Y,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,d){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

".concat(n," : for ").concat(s[n]," files

");l.style.display="block",l.innerHTML=e,d()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,B)&&n.append("sortId",x(this,B)),x(this,Y)&&n.append("sortOrder",x(this,Y));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=C(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(h=C(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"_getFileHash",value:(d=C(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return d.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=C(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=C(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(h):u.append(U("
    ").append(h)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
      ').concat(e,"
    ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function dt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof h?e:h,o=Object.create(r.prototype),s=new C(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===d)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var d={};function h(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=h.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==ct(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(h).then((function(t){d.value=t,s(d)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;T(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function ht(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){ht(o,i,r,s,a,"next",t)}function a(t){ht(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Tt),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Tt,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Tt,gt(this,Tt).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Tt).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Ct)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Tt).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(dt().mark((function t(e){var n;return dt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(dt().mark((function t(e){var n,i,r=arguments;return dt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
  1. Job #'+e.jobId+"
  2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((d=this.items[n+1])&&d.item.hasClass(_.disabledClass))continue}else if(1===o&&(h=this.items[n-1])&&h.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,d=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){d=s(t(this),o,d)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var h=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:d,name:h})}return a=d+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),d=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),h=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(h-=n-d)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?h-=l.left-10:l.left+n>r&&(h=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:h,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function d(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&d(e.prototype,n),i&&d(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:d,readOnly:c,maxLines:u,minLines:f,theme:h});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),d=m(t).find(".progress-text"),h=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(d).html("Extracting information from asset..."),m(h).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(d).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),d=i.find(".date"),h=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),d.val(""),h.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new h(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),d=m(t).find(".asset-hash-signature"),h=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),d.empty(),i.val(""),r.val(""),m(h).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),d=e.data("locale"),h=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==d&&(e.locale=d),void 0!==h&&(e.referrerEmsId=h),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new d).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=h(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=h(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=h(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=h(this).attr("data-height");t||(t=400);var n=h(this).attr("data-format-tags");n&&(g.format_tags=n);var i=h(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=h(this).attr("data-content-css");r&&(g.contentsCss=r);var o=h(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=h(this).attr("data-referrer-ems-id");var s=h(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[h(this).attr("id")]&&!1===h(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[h(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:h(this).data("show-meridian"),explicitMode:h(this).data("explicit-mode"),minuteStep:h(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};h(this).unbind("change"),h(this).not(".ignore-ems-update")?e&&h(this).timepicker(t).on("changeTime.timepicker",e):h(this).timepicker(t)})),t.find(".datepicker").each((function(){h(this).unbind("change");var t={format:h(this).attr("data-date-format"),todayBtn:!0,weekStart:h(this).attr("data-week-start"),daysOfWeekHighlighted:h(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:h(this).attr("data-days-of-week-disabled"),todayHighlight:h(this).attr("data-today-highlight")};h(this).attr("data-multidate")&&"false"!==h(this).attr("data-multidate")&&(t.multidate=!0),h(this).datepicker(t),e&&h(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=h(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var d=this.modal.querySelector("form");d&&d.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var h=this.modal.querySelector("#ajax-modal-submit");h&&(h.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function d(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=T(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=h(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=d;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=h(t[o],t,s);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){d.value=t,a(d)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function T(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=h(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var h=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),h.width=u,h.height=f,h.getContext("2d").drawImage(c,0,0,u,f);var p=d(h.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function d(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),d=0;d"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function T(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function C(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){T(o,i,r,s,a,"next",t)}function a(t){T(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,d,h,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,B,t.dataset.sortId),S(this,Y,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,Y,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,d){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

    ".concat(n," : for ").concat(s[n]," files

    ");l.style.display="block",l.innerHTML=e,d()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,B)&&n.append("sortId",x(this,B)),x(this,Y)&&n.append("sortOrder",x(this,Y));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=C(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(h=C(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"_getFileHash",value:(d=C(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return d.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=C(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=C(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=C(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(h):u.append(U("
      ").append(h)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
        ').concat(e,"
      ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function dt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof h?e:h,o=Object.create(r.prototype),s=new C(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===d)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var d={};function h(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=h.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==ct(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(h).then((function(t){d.value=t,s(d)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;T(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}function ht(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){ht(o,i,r,s,a,"next",t)}function a(t){ht(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Tt),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Tt,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Tt,gt(this,Tt).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Tt).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Ct)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Tt).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(dt().mark((function t(e){var n;return dt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(dt().mark((function t(e){var n,i,r=arguments;return dt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
    1. Job #'+e.jobId+"
    2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((d=this.items[n+1])&&d.item.hasClass(_.disabledClass))continue}else if(1===o&&(h=this.items[n-1])&&h.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,d=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){d=s(t(this),o,d)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var h=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:d,name:h})}return a=d+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

      ".concat(n," : for ").concat(s[n]," files

      ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
        ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
          ').concat(e,"
        ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
      1. Job #'+e.jobId+"
      2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

        ".concat(n," : for ").concat(s[n]," files

        ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
          ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
            ').concat(e,"
          ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
        1. Job #'+e.jobId+"
        2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

          ".concat(n," : for ").concat(s[n]," files

          ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
            ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
              ').concat(e,"
            ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
          1. Job #'+e.jobId+"
          2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

            ".concat(n," : for ").concat(s[n]," files

            ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
              ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                ').concat(e,"
              ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
            1. Job #'+e.jobId+"
            2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

              ".concat(n," : for ").concat(s[n]," files

              ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                  ').concat(e,"
                ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
              1. Job #'+e.jobId+"
              2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                ".concat(n," : for ").concat(s[n]," files

                ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                  ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                    ').concat(e,"
                  ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                1. Job #'+e.jobId+"
                2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                  ".concat(n," : for ").concat(s[n]," files

                  ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                    ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                      ').concat(e,"
                    ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                  1. Job #'+e.jobId+"
                  2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                    ".concat(n," : for ").concat(s[n]," files

                    ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                      ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                        ').concat(e,"
                      ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                    1. Job #'+e.jobId+"
                    2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                      ".concat(n," : for ").concat(s[n]," files

                      ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                        ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                          ').concat(e,"
                        ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                      1. Job #'+e.jobId+"
                      2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                        ".concat(n," : for ").concat(s[n]," files

                        ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                          ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                            ').concat(e,"
                          ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                        1. Job #'+e.jobId+"
                        2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                          ".concat(n," : for ").concat(s[n]," files

                          ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                            ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                              ').concat(e,"
                            ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                          1. Job #'+e.jobId+"
                          2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                            ".concat(n," : for ").concat(s[n]," files

                            ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                              ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                ').concat(e,"
                              ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                            1. Job #'+e.jobId+"
                            2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                              ".concat(n," : for ").concat(s[n]," files

                              ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                  ').concat(e,"
                                ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                              1. Job #'+e.jobId+"
                              2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                                ".concat(n," : for ").concat(s[n]," files

                                ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                  ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                    ').concat(e,"
                                  ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                                1. Job #'+e.jobId+"
                                2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                                  ".concat(n," : for ").concat(s[n]," files

                                  ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                    ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                      ').concat(e,"
                                    ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                                  1. Job #'+e.jobId+"
                                  2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                                    ".concat(n," : for ").concat(s[n]," files

                                    ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                      ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                        ').concat(e,"
                                      ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                                    1. Job #'+e.jobId+"
                                    2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                                      ".concat(n," : for ").concat(s[n]," files

                                      ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                        ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                          ').concat(e,"
                                        ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                                      1. Job #'+e.jobId+"
                                      2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r '+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+""+e+' :'+n+" "+(this.showSeconds?':'+i+"":"")+(this.showMeridian?' '+r+"":"")+''+(this.showSeconds?' ':"")+(this.showMeridian?' ':"")+"",this.template){case"modal":t='';break;case"dropdown":t='"}return t},getTime:function(){return""===this.hour?"":this.hour+":"+(1===this.minute.toString().length?"0"+this.minute:this.minute)+(this.showSeconds?":"+(1===this.second.toString().length?"0"+this.second:this.second):"")+(this.showMeridian?" "+this.meridian:"")},hideWidget:function(){!1!==this.isOpen&&(this.$element.trigger({type:"hide.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),"modal"===this.template&&this.$widget.modal?this.$widget.modal("hide"):this.$widget.removeClass("open"),t(n).off("mousedown.timepicker, touchend.timepicker",this.handleDocumentClick),this.isOpen=!1,this.$widget.detach())},highlightUnit:function(){this.position=this.getCursorPosition(),this.position>=0&&this.position<=2?this.highlightHour():this.position>=3&&this.position<=5?this.highlightMinute():this.position>=6&&this.position<=8?this.showSeconds?this.highlightSecond():this.highlightMeridian():this.position>=9&&this.position<=11&&this.highlightMeridian()},highlightNextUnit:function(){switch(this.highlightedUnit){case"hour":this.highlightMinute();break;case"minute":this.showSeconds?this.highlightSecond():this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"second":this.showMeridian?this.highlightMeridian():this.highlightHour();break;case"meridian":this.highlightHour()}},highlightPrevUnit:function(){switch(this.highlightedUnit){case"hour":this.showMeridian?this.highlightMeridian():this.showSeconds?this.highlightSecond():this.highlightMinute();break;case"minute":this.highlightHour();break;case"second":this.highlightMinute();break;case"meridian":this.showSeconds?this.highlightSecond():this.highlightMinute()}},highlightHour:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="hour",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(0,1):t.setSelectionRange(0,2)}),0)},highlightMinute:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="minute",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(2,4):t.setSelectionRange(3,5)}),0)},highlightSecond:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="second",t.setSelectionRange&&setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0)},highlightMeridian:function(){var t=this.$element.get(0),e=this;this.highlightedUnit="meridian",t.setSelectionRange&&(this.showSeconds?setTimeout((function(){e.hour<10?t.setSelectionRange(8,10):t.setSelectionRange(9,11)}),0):setTimeout((function(){e.hour<10?t.setSelectionRange(5,7):t.setSelectionRange(6,8)}),0))},incrementHour:function(){if(this.showMeridian){if(11===this.hour)return this.hour++,this.toggleMeridian();12===this.hour&&(this.hour=0)}this.hour!==this.maxHours-1?this.hour++:this.hour=0},incrementMinute:function(t){var e;(e=t?this.minute+t:this.minute+this.minuteStep-this.minute%this.minuteStep)>59?(this.incrementHour(),this.minute=e-60):this.minute=e},incrementSecond:function(){var t=this.second+this.secondStep-this.second%this.secondStep;t>59?(this.incrementMinute(!0),this.second=t-60):this.second=t},mousewheel:function(e){if(!this.disableMousewheel){e.preventDefault(),e.stopPropagation();var n=e.originalEvent.wheelDelta||-e.originalEvent.detail,i=null;switch("mousewheel"===e.type?i=-1*e.originalEvent.wheelDelta:"DOMMouseScroll"===e.type&&(i=40*e.originalEvent.detail),i&&(e.preventDefault(),t(this).scrollTop(i+t(this).scrollTop())),this.highlightedUnit){case"minute":n>0?this.incrementMinute():this.decrementMinute(),this.highlightMinute();break;case"second":n>0?this.incrementSecond():this.decrementSecond(),this.highlightSecond();break;case"meridian":this.toggleMeridian(),this.highlightMeridian();break;default:n>0?this.incrementHour():this.decrementHour(),this.highlightHour()}return!1}},changeToNearestStep:function(t,e){return t%e==0?t:Math.round(t%e/e)?(t+(e-t%e))%60:t-t%e},place:function(){if(!this.isInline){var n=this.$widget.outerWidth(),i=this.$widget.outerHeight(),r=t(e).width(),o=t(e).height(),s=t(e).scrollTop(),a=parseInt(this.$element.parents().filter((function(){return"auto"!==t(this).css("z-index")})).first().css("z-index"),10)+10,l=this.component?this.component.parent().offset():this.$element.offset(),c=this.component?this.component.outerHeight(!0):this.$element.outerHeight(!1),h=this.component?this.component.outerWidth(!0):this.$element.outerWidth(!1),d=l.left,u=l.top;this.$widget.removeClass("timepicker-orient-top timepicker-orient-bottom timepicker-orient-right timepicker-orient-left"),"auto"!==this.orientation.x?(this.$widget.addClass("timepicker-orient-"+this.orientation.x),"right"===this.orientation.x&&(d-=n-h)):(this.$widget.addClass("timepicker-orient-left"),l.left<0?d-=l.left-10:l.left+n>r&&(d=r-n-10));var f,p,m=this.orientation.y;"auto"===m&&(f=-s+l.top-i,p=s+o-(l.top+c+i),m=Math.max(f,p)===p?"top":"bottom"),this.$widget.addClass("timepicker-orient-"+m),"top"===m?u+=c:u-=i+parseInt(this.$widget.css("padding-top"),10),this.$widget.css({top:u,left:d,zIndex:a})}},remove:function(){t("document").off(".timepicker"),this.$widget&&this.$widget.remove(),delete this.$element.data().timepicker},setDefaultTime:function(t){if(this.$element.val())this.updateFromElementVal();else if("current"===t){var e=new Date,n=e.getHours(),i=e.getMinutes(),r=e.getSeconds(),o="AM";0!==r&&60===(r=Math.ceil(e.getSeconds()/this.secondStep)*this.secondStep)&&(i+=1,r=0),0!==i&&60===(i=Math.ceil(e.getMinutes()/this.minuteStep)*this.minuteStep)&&(n+=1,i=0),this.showMeridian&&(0===n?n=12:n>=12?(n>12&&(n-=12),o="PM"):o="AM"),this.hour=n,this.minute=i,this.second=r,this.meridian=o,this.update()}else!1===t?(this.hour=0,this.minute=0,this.second=0,this.meridian="AM"):this.setTime(t)},setTime:function(t,e){if(t){var n,i,r,o,s,a;if("object"==typeof t&&t.getMonth)r=t.getHours(),o=t.getMinutes(),s=t.getSeconds(),this.showMeridian&&(a="AM",r>12&&(a="PM",r%=12),12===r&&(a="PM"));else{if((n=(/a/i.test(t)?1:0)+(/p/i.test(t)?2:0))>2)return void this.clear();if(r=(i=t.replace(/[^0-9\:]/g,"").split(":"))[0]?i[0].toString():i.toString(),this.explicitMode&&r.length>2&&r.length%2!=0)return void this.clear();o=i[1]?i[1].toString():"",s=i[2]?i[2].toString():"",r.length>4&&(s=r.slice(-2),r=r.slice(0,-2)),r.length>2&&(o=r.slice(-2),r=r.slice(0,-2)),o.length>2&&(s=o.slice(-2),o=o.slice(0,-2)),r=parseInt(r,10),o=parseInt(o,10),s=parseInt(s,10),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(s)&&(s=0),s>59&&(s=59),o>59&&(o=59),r>=this.maxHours&&(r=this.maxHours-1),this.showMeridian?(r>12&&(n=2,r-=12),n||(n=1),0===r&&(r=12),a=1===n?"AM":"PM"):r<12&&2===n?r+=12:r>=this.maxHours?r=this.maxHours-1:(r<0||12===r&&1===n)&&(r=0)}this.hour=r,this.snapToStep?(this.minute=this.changeToNearestStep(o,this.minuteStep),this.second=this.changeToNearestStep(s,this.secondStep)):(this.minute=o,this.second=s),this.meridian=a,this.update(e)}else this.clear()},showWidget:function(){this.isOpen||this.$element.is(":disabled")||(this.$widget.appendTo(this.appendWidgetTo),t(n).on("mousedown.timepicker, touchend.timepicker",{scope:this},this.handleDocumentClick),this.$element.trigger({type:"show.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}}),this.place(),this.disableFocus&&this.$element.blur(),""===this.hour&&(this.defaultTime?this.setDefaultTime(this.defaultTime):this.setTime("0:0:0")),"modal"===this.template&&this.$widget.modal?this.$widget.modal("show").on("hidden",t.proxy(this.hideWidget,this)):!1===this.isOpen&&this.$widget.addClass("open"),this.isOpen=!0)},toggleMeridian:function(){this.meridian="AM"===this.meridian?"PM":"AM"},update:function(t){this.updateElement(),t||this.updateWidget(),this.$element.trigger({type:"changeTime.timepicker",time:{value:this.getTime(),hours:this.hour,minutes:this.minute,seconds:this.second,meridian:this.meridian}})},updateElement:function(){this.$element.val(this.getTime()).change()},updateFromElementVal:function(){this.setTime(this.$element.val())},updateWidget:function(){if(!1!==this.$widget){var t=this.hour,e=1===this.minute.toString().length?"0"+this.minute:this.minute,n=1===this.second.toString().length?"0"+this.second:this.second;this.showInputs?(this.$widget.find("input.bootstrap-timepicker-hour").val(t),this.$widget.find("input.bootstrap-timepicker-minute").val(e),this.showSeconds&&this.$widget.find("input.bootstrap-timepicker-second").val(n),this.showMeridian&&this.$widget.find("input.bootstrap-timepicker-meridian").val(this.meridian)):(this.$widget.find("span.bootstrap-timepicker-hour").text(t),this.$widget.find("span.bootstrap-timepicker-minute").text(e),this.showSeconds&&this.$widget.find("span.bootstrap-timepicker-second").text(n),this.showMeridian&&this.$widget.find("span.bootstrap-timepicker-meridian").text(this.meridian))}},updateFromWidgetInputs:function(){if(!1!==this.$widget){var t=this.$widget.find("input.bootstrap-timepicker-hour").val()+":"+this.$widget.find("input.bootstrap-timepicker-minute").val()+(this.showSeconds?":"+this.$widget.find("input.bootstrap-timepicker-second").val():"")+(this.showMeridian?this.$widget.find("input.bootstrap-timepicker-meridian").val():"");this.setTime(t,!0)}},widgetClick:function(e){e.stopPropagation(),e.preventDefault();var n=t(e.target),i=n.closest("a").data("action");i&&this[i](),this.update(),n.is("input")&&n.get(0).setSelectionRange(0,2)},widgetKeydown:function(e){var n=t(e.target),i=n.attr("class").replace("bootstrap-timepicker-","");switch(e.which){case 9:if(e.shiftKey){if("hour"===i)return this.hideWidget()}else if(this.showMeridian&&"meridian"===i||this.showSeconds&&"second"===i||!this.showMeridian&&!this.showSeconds&&"minute"===i)return this.hideWidget();break;case 27:this.hideWidget();break;case 38:switch(e.preventDefault(),i){case"hour":this.incrementHour();break;case"minute":this.incrementMinute();break;case"second":this.incrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2);break;case 40:switch(e.preventDefault(),i){case"hour":this.decrementHour();break;case"minute":this.decrementMinute();break;case"second":this.decrementSecond();break;case"meridian":this.toggleMeridian()}this.setTime(this.getTime()),n.get(0).setSelectionRange(0,2)}},widgetKeyup:function(t){(65===t.which||77===t.which||80===t.which||46===t.which||8===t.which||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105)&&this.updateFromWidgetInputs()}},t.fn.timepicker=function(e){var n=Array.apply(null,arguments);return n.shift(),this.each((function(){var r=t(this),o=r.data("timepicker"),s="object"==typeof e&&e;o||r.data("timepicker",o=new i(this,t.extend({},t.fn.timepicker.defaults,s,t(this).data()))),"string"==typeof e&&o[e].apply(o,n)}))},t.fn.timepicker.defaults={defaultTime:"current",disableFocus:!1,disableMousewheel:!1,isOpen:!1,minuteStep:15,modalBackdrop:!1,orientation:{x:"auto",y:"auto"},secondStep:15,snapToStep:!1,showSeconds:!1,showInputs:!0,showMeridian:!0,template:"dropdown",appendWidgetTo:"body",showWidgetOnAddonClick:!0,icons:{up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},maxHours:24,explicitMode:!1},t.fn.timepicker.Constructor=i,t(n).on("focus.timepicker.data-api click.timepicker.data-api",'[data-provide="timepicker"]',(function(e){var n=t(this);n.data("timepicker")||(e.preventDefault(),n.timepicker())}))}(n(9755),window,document)},4561:function(t,e,n){"use strict";n.d(e,{Z:function(){return y}});var i=n(9755),r=n.n(i),o=n(3239),s=n.n(o),a=n(7361);var l=n(2450),c=n(9755);function h(t,e){for(var n=0;n a");i(r);var o=function(t,e){var n=window.MutationObserver||window.WebKitMutationObserver;if(t&&1===t.nodeType){if(n){var i=new n(e);return i.observe(t,{childList:!0,subtree:!0}),i}window.addEventListener&&(t.addEventListener("DOMNodeInserted",e,!1),t.addEventListener("DOMNodeRemoved",e,!1))}}(n,(function(t){[].forEach.call(t,(function(t){t.addedNodes.length<1||[].forEach.call(t.addedNodes,(function(t){i(t.querySelectorAll("div[data-json] > a"))}))}))}))}))}}])&&h(e.prototype,n),i&&h(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),u=n(300),f=n(3423),p=n(1611),m=n(9755);function g(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v(t,e){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null;if(g(this,t),void 0!==e){this.target=e,this.onChangeCallback=n;var i=m("body");this.initUpload=i.data("init-upload"),this.fileExtract=i.data("file-extract"),this.fileExtractForced=i.data("file-extract-forced"),this.hashAlgo=i.data("hash-algo"),this.addListeners(),new f.Z(e)}else console.log("Impossible to add ems listeners as no target is defined")}var e,n,i;return e=t,n=[{key:"addListeners",value:function(){this.addCheckBoxListeners(),this.addSelect2Listeners(),this.addCollapsibleCollectionListeners(),this.addSortableListListeners(),this.addNestedSortableListeners(),this.addCodeEditorListeners(),this.addRemoveButtonListeners(),this.addObjectPickerListeners(),this.addFieldsToDisplayByValue(),this.addFileUploaderListerners(),this.addA2LixLibSfCollection(),this.addDisabledButtonTreatListeners(),this.addDateRangeListeners(),(0,p.B)(this.target)}},{key:"addFieldsToDisplayByValue",value:function(){for(var t=this.target.getElementsByClassName("fields-to-display-by-input-value"),e=function(e){var n=t[e].closest(".fields-to-display-by-value").getElementsByClassName("fields-to-display-for");t[e].onchange=function(){for(var i=t[e].value,r=0;r0&&(u=l.data("max-lines"));var f=1;l.data("min-lines")&&l.data("min-lines")>0&&(f=l.data("min-lines"));var p=s().edit(a,{mode:h,readOnly:c,maxLines:u,minLines:f,theme:d});p.on("change",(function(t){l.val(p.getValue()),"function"==typeof e.onChangeCallback&&e.onChangeCallback()})),p.commands.addCommands([{name:"fullscreen",bindKey:{win:"F11",mac:"Esc"},exec:function(t){o.hasClass("panel-fullscreen")?(t.setOption("maxLines",u),o.removeClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!1)):(t.setOption("maxLines",1/0),o.addClass("panel-fullscreen"),t.setAutoScrollEditorIntoView(!0)),t.resize()}},{name:"showKeyboardShortcuts",bindKey:{win:"Ctrl-Alt-h",mac:"Command-Alt-h"},exec:function(e){t.getAceConfig().loadModule("ace/ext/keybinding_menu",(function(t){t.init(e),e.showKeyboardShortcuts()}))}}])},o=0;o div",maxLevels:e,expression:/()(.+)/,isTree:n,expandOnHover:700,startCollapsed:!0})})),r()(this.target).find(".reorder-button").on("click",(function(){var t=r()(this).closest("form"),e=t.find(".nested-sortable").nestedSortable("toHierarchy",{startDepthCount:0});t.find("input.reorder-items").val(JSON.stringify(e)).trigger("change")}));var t=".json_menu_editor_fieldtype_widget ";0===r()(this.target).find(t).length&&(t=".mjs-nestedSortable "),r()(this.target).hasClass("mjs-nestedSortable")&&(t=""),r()(this.target).find(t+".button-collapse").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded");m(this).parent().find("> button").attr("aria-expanded",!e);var n=m(this).closest(".collapsible-container");e?n.find("ol").first().show():n.find("ol").first().hide()})),r()(this.target).find(t+".button-collapse-all").click((function(t){t.preventDefault();var e="true"===m(this).attr("aria-expanded"),n=m(this).closest(".collapsible-container");n.find(".button-collapse").attr("aria-expanded",!e),n.find(".button-collapse-all").attr("aria-expanded",!e),e?n.find("ol").not(".not-collapsible").show():n.find("ol").not(".not-collapsible").hide()}))}},{key:"initFilesUploader",value:function(e,n){var i=m(n).closest(".file-uploader-row"),r=i.data("multiple"),o=i.find(".tab-pane.asset-preview-tab"),s=i.find(".tab-pane.asset-upload-tab"),a=i.find(".tab-pane.asset-list-tab > ol");void 0!==r&&(a.removeClass("hidden"),o.addClass("hidden"),s.addClass("hidden"));var l=parseInt(a.attr("data-file-list-index"));a.attr("data-file-list-index",l+e.length);for(var c=0;c1&&void 0!==arguments[1]&&arguments[1],n=this,i=m(t).find(".sha1"),r=m(t).find(".name"),o=m(t).find(".date"),s=m(t).find(".author"),a=m(t).find(".language"),l=m(t).find(".content"),c=m(t).find(".title"),h=m(t).find(".progress-text"),d=m(t).find(".progress-number"),u=m(t).find(".asset-preview-tab"),f=m(t).find(".asset-upload-tab"),p=(e?this.fileExtractForced:this.fileExtract).replace(/__file_identifier__/g,m(i).val()).replace(/__file_name__/g,m(r).val());m(h).html("Extracting information from asset..."),m(d).html(""),f.show(),u.hide(),window.ajaxRequest.get(p).success((function(t){m(o).val(t.date),m(s).val(t.author),m(a).val(t.language),m(l).val(t.content),m(c).val(t.title)})).fail((function(t){if(!t||!Array.isArray(t.warning)||1!==t.warning.length){var e=m("#modal-notifications");m(e.find(".modal-body")).html("Something went wrong while extracting information from file"),e.modal("show")}})).always((function(){m(h).html(""),f.hide(),u.show(),"function"==typeof n.onChangeCallback&&n.onChangeCallback()}))}},{key:"fileDragHover",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"onAssetData",value:function(t,e){var n,i=m(t),r=i.find(".sha1"),o=i.find(".resized-image-hash"),s=void 0!==i.data("meta-fields"),a=i.find(".type"),l=i.find(".name"),c=i.find(".asset-hash-signature"),h=i.find(".date"),d=i.find(".author"),u=i.find(".language"),f=i.find(".content"),p=i.find(".title"),g=i.find(".view-asset-button"),v=i.find(".clear-asset-button"),y=i.find(".asset-preview-tab"),_=i.find(".asset-upload-tab"),b=i.find(".img-responsive");r.val(e.sha1),o.val(null!==(n=e._image_resized_hash)&&void 0!==n?n:""),c.empty().append(e.sha1),a.val(e.mimetype),l.val(e.filename),g.attr("href",e.view_url),b.attr("src",e.preview_url),h.val(""),d.val(""),u.val(""),f.val(""),p.val(""),g.removeClass("disabled"),v.removeClass("disabled"),y.removeClass("hidden"),_.addClass("hidden"),s?this.fileDataExtrator(t):"function"==typeof this.onChangeCallback&&this.onChangeCallback()}},{key:"addFileUploaderListerners",value:function(){var t=r()(this.target),e=this;new d(this.target),t.find(".file-uploader-row").on("updateAssetData",(function(t){e.onAssetData(this,t.originalEvent.detail)})),t.find(".extract-file-info").click((function(){var t=m(this).closest(".modal-content");e.fileDataExtrator(t,!0)})),t.find(".clear-asset-button").click((function(){var t=m(this).closest(".file-uploader-row"),e=m(t).find(".sha1"),n=m(t).find(".resized-image-hash"),i=m(t).find(".type"),r=m(t).find(".name"),o=m(t).find(".progress-bar"),s=m(t).find(".progress-text"),a=m(t).find(".progress-number"),l=m(t).find(".asset-preview-tab"),c=m(t).find(".asset-upload-tab"),h=m(t).find(".asset-hash-signature"),d=m(t).find(".date"),u=m(t).find(".author"),f=m(t).find(".language"),p=m(t).find(".content"),g=m(t).find(".title");return m(t).find(".file-uploader-input").val(""),e.val(""),n.val(""),h.empty(),i.val(""),r.val(""),m(d).val(""),m(u).val(""),m(f).val(""),m(p).val(""),m(g).val(""),m(o).css("width","0%"),m(s).html(""),m(a).html(""),l.addClass("hidden"),c.removeClass("hidden"),m(t).find(".view-asset-button").addClass("disabled"),m(this).addClass("disabled"),!1}));var n=this.target.getElementsByClassName("file-uploader-input");[].forEach.call(n,(function(t){t.onchange=function(){e.initFilesUploader(t.files,t)}})),t.find(".file-uploader-row").each((function(){this.addEventListener("dragover",e.fileDragHover,!1),this.addEventListener("dragleave",e.fileDragHover,!1),this.addEventListener("drop",(function(t){e.fileDragHover(t);var n=t.target.files||t.dataTransfer.files;e.initFilesUploader(n,this)}),!1)}))}},{key:"addSortableListListeners",value:function(){r()(this.target).find("ul.sortable").sortable()}},{key:"addCheckBoxListeners",value:function(){var t=this;r()(this.target).iCheck({checkboxClass:"icheckbox_square-blue",radioClass:"iradio_square-blue",increaseArea:"20%"}).on("ifChecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("check")})).on("ifUnchecked",(function(){r()(this).attr("data-grouped-checkbox-target")&&r()(t.target).find(r()(this).attr("data-grouped-checkbox-target")).iCheck("uncheck")}))}},{key:"addObjectPickerListeners",value:function(){var t=m("body").data("search-api");r()(this.target).find(".objectpicker").each((function(){var e=r()(this),n=e.data("type"),i=e.data("search-id"),o=e.data("query-search"),s=e.data("query-search-label"),a=e.data("circleOnly"),l=e.data("dynamic-loading"),c=e.data("sortable"),h=e.data("locale"),d=e.data("referrer-ems-id"),u={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection,allowClear:!0,placeholder:s&&""!==s?s:"Search"};e.attr("multiple")&&(u.closeOnSelect=!1),l&&(u.minimumInputLength=1,u.ajax={url:t,dataType:"json",delay:250,data:function(t){var e={q:t.term,page:t.page,type:n,searchId:i,querySearch:o};return void 0!==h&&(e.locale=h),void 0!==d&&(e.referrerEmsId=d),void 0!==a&&(e.circle=a),e},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.pager?1:nt.length)&&(e=t.length);for(var n=0,i=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:null;new i.Z(t.get(0),e),!1===g&&(g=(new h).getConfig()),t.find(".remove-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-item-panel");n.find("input._ems_internal_deleted").val("deleted"),n.hide(),e&&e()})),e&&(t.find("input").not(".ignore-ems-update,.datetime-picker,datetime-picker").on("input",e),t.find("select").not(".ignore-ems-update").on("change",e),t.find("textarea").not(".ignore-ems-update").on("input",e)),t.find(".add-content-button").on("click",(function(t){t.preventDefault();var n=d(this).closest(".collection-panel"),i=n.data("index"),r=n.data("prototype"),o=new RegExp(n.data("prototype-name"),"g"),s=new RegExp(n.data("prototype-label"),"g"),a=d(r.replace(s,i+1).replace(o,i));n.data("index",i+1),v(a),n.children(".panel-body").children(".collection-panel-container").append(a),e&&e()})),t.find(".ems-sortable > div").sortable({handle:".ems-handle"}),t.find(".selectpicker").selectpicker(),t.find(".ckeditor_ems").each((function(){var t=d(this).attr("data-height");t||(t=400);var n=d(this).attr("data-format-tags");n&&(g.format_tags=n);var i=d(this).attr("data-styles-set");i&&(g.stylesSet=i);var r=d(this).attr("data-content-css");r&&(g.contentsCss=r);var o=d(this).attr("data-lang");o&&(g.language=o),g.referrerEmsId=d(this).attr("data-referrer-ems-id");var s=d(this).attr("data-table-default-css");if(void 0===s&&(s="table table-bordered"),g.height=t,g.div_wrapTable="true",g.allowedContent=!0,g.extraAllowedContent="p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}",CKEDITOR.dtd.$removeEmpty.i=0,CKEDITOR.on("instanceReady",(function(t){var e,n,i=t.editor,r=null===(e=g)||void 0===e||null===(n=e.ems)||void 0===n?void 0:n.translations;if(void 0!==r&&r.hasOwnProperty(i.langCode)){var o=r[i.langCode];[].concat(f(Object.getOwnPropertyNames(i.lang)),f(Object.getOwnPropertyNames(Object.getPrototypeOf(i.lang)))).forEach((function(t){Object.entries(o).forEach((function(e){var n=u(e,2),r=n[0],o=n[1],s=r.split(".");t===s[0]&&i.lang[t].hasOwnProperty(s[1])&&(i.lang[t][s[1]]=o)}))}))}})),e&&!CKEDITOR.instances[d(this).attr("id")]&&!1===d(this).hasClass("ignore-ems-update")?CKEDITOR.replace(this,g).on("key",e):CKEDITOR.replace(this,g),CKEDITOR.on("dialogDefinition",(function(t){var e=t.data.name,n=t.data.definition;if("table"===e){var i=n.getContents("info");i.get("txtBorder").default=0,i.get("txtCellPad").default="",i.get("txtCellSpace").default="",i.get("txtWidth").default="",n.getContents("advanced").get("advCSSClasses").default=s}})),g.hasOwnProperty("emsAjaxPaste")){var a=CKEDITOR.instances[d(this).attr("id")];a.on("beforePaste",(function(t){var e=t.data.dataTransfer.getData("text/html");e&&""!==e&&(t.cancel(),fetch(g.emsAjaxPaste,{method:"POST",body:JSON.stringify({content:e}),headers:{"Content-Type":"application/json"}}).then((function(t){return t.ok?t.json().then((function(t){a.fire("paste",{type:"auto",dataValue:t.content,method:"paste"})})):Promise.reject(t)})).catch((function(){console.error("error pasting")})))}))}})),t.find(".colorpicker-component").colorpicker(),e&&t.find(".colorpicker-component").bind("changeColor",e),t.find(".timepicker").each((function(){var t={showMeridian:d(this).data("show-meridian"),explicitMode:d(this).data("explicit-mode"),minuteStep:d(this).data("minute-step"),disableMousewheel:!0,defaultTime:!1};d(this).unbind("change"),d(this).not(".ignore-ems-update")?e&&d(this).timepicker(t).on("changeTime.timepicker",e):d(this).timepicker(t)})),t.find(".datepicker").each((function(){d(this).unbind("change");var t={format:d(this).attr("data-date-format"),todayBtn:!0,weekStart:d(this).attr("data-week-start"),daysOfWeekHighlighted:d(this).attr("data-days-of-week-highlighted"),daysOfWeekDisabled:d(this).attr("data-days-of-week-disabled"),todayHighlight:d(this).attr("data-today-highlight")};d(this).attr("data-multidate")&&"false"!==d(this).attr("data-multidate")&&(t.multidate=!0),d(this).datepicker(t),e&&d(this).not(".ignore-ems-update").on("dp.change",e)})),t.find(".datetime-picker").each((function(){var t=d(this);t.unbind("change"),t.datetimepicker({keepInvalid:!0,extraFormats:[moment.ISO_8601]}),e&&t.not(".ignore-ems-update").on("dp.change",e)})),t.find("textarea,input").each((function(){var t=this.parentNode.querySelector(".text-counter");if(null!==t&&t.hasAttribute("data-counter-label")&&t.parentNode===this.parentNode){var e=t.getAttribute("data-counter-label"),n=function(n){var i=n.value.length;t.textContent=e.replace("%count%",i)};this.addEventListener("keyup",(function(t){n(t.target)})),n(this)}}))}},7361:function(t,e,n){"use strict";n.d(e,{O:function(){return c}});var i=n(4127),r=n(1611),o=(n(3423),n(9755));function s(t,e){for(var n=0;n div.alert").forEach((function(t){t.remove()})),this.loadingElement.style.display="block",this.modal.querySelectorAll("input, button, .select2, textarea").forEach((function(t){t.classList.add("emsco-modal-has-been-disabled"),t.setAttribute("disabled","disabled")}))}},{key:"stateReady",value:function(){this.loadingElement.style.display="none",this.modal.querySelector(".ajax-modal-body").style.display="block",this.modal.querySelectorAll("input.emsco-modal-has-been-disabled, button.emsco-modal-has-been-disabled, .select2.emsco-modal-has-been-disabled, textarea.emsco-modal-has-been-disabled").forEach((function(t){t.removeAttribute("disabled"),t.classList.remove("emsco-modal-has-been-disabled")}))}},{key:"load",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=this.modal.querySelector(".modal-dialog");r.classList.remove("modal-xs","modal-sm","modal-md","modal-lg","modal-auto-size"),t.hasOwnProperty("size")?r.classList.add("modal-"+t.size):r.classList.add("modal-md"),t.hasOwnProperty("noLoading")||this.stateLoading(),t.hasOwnProperty("title")&&(this.modal.querySelector(".modal-title").innerHTML=t.title),this.$modal.modal("show");var o={method:"GET",headers:{"Content-Type":"application/json"}};t.hasOwnProperty("data")&&(o.method="POST",o.body=t.data),fetch(t.url,o).then((function(t){return t.ok?t.json().then((function(r){n.ajaxReady(r,t.url,e,i),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"submitForm",value:function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(var r in CKEDITOR.instances)CKEDITOR.instances.hasOwnProperty(r)&&CKEDITOR.instances[r].updateElement();var o=new FormData(this.modal.querySelector("form"));this.stateLoading(),fetch(t,{method:"POST",body:o}).then((function(t){return t.ok?t.json().then((function(i){n.ajaxReady(i,t.url,e),n.stateReady()})):Promise.reject(t)})).catch((function(t){if("function"!=typeof i)throw n.printMessage("error","Error loading ..."),t;i(t)}))}},{key:"ajaxReady",value:function(t,e,n){var s=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t.hasOwnProperty("modalClose")&&!0===t.modalClose)return"function"==typeof n&&n(t,this.modal),void this.$modal.modal("hide");t.hasOwnProperty("modalTitle")&&this.$modal.find(".modal-title").html(t.modalTitle),t.hasOwnProperty("modalBody")&&(this.$modal.find(".ajax-modal-body").html(t.modalBody),this.$modal.find(":input").each((function(){o(this).addClass("ignore-ems-update")})),(0,i.n)(this.$modal)),t.hasOwnProperty("modalFooter")?this.$modal.find(".ajax-modal-footer").html(t.modalFooter):this.$modal.find(".ajax-modal-footer").html('');var c=t.hasOwnProperty("modalMessages")?t.modalMessages:[];c.forEach((function(t){var e=Object.keys(t)[0],n=t[e];s.printMessage(e,n)}));var h=this.modal.querySelector("form");h&&h.addEventListener("submit",(function(t){l.submitForm(e,n,a),t.preventDefault()}));var d=this.modal.querySelector("#ajax-modal-submit");d&&(d.addEventListener("click",(function(){l.submitForm(e,n,a)})),document.addEventListener("keydown",this.onKeyDown)),(0,r.B)(this.modal),"function"==typeof n&&n(t,this.modal)}},{key:"printMessage",value:function(t,e){var n;switch(t){case"warning":n="alert-warning";break;case"error":n="alert-danger";break;case"info":n="alert-info";break;default:n="alert-success"}this.modal.querySelector(".ajax-modal-body").insertAdjacentHTML("afterbegin",'")}}],n&&s(e.prototype,n),a&&s(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}(),l=new a("#ajax-modal"),c=new a("#pick-file-server-modal");e.Z=l},2450:function(t,e,n){"use strict";n.d(e,{t:function(){return l}});var i=n(300);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r=e&&e.prototype instanceof f?e:f,o=Object.create(r.prototype),s=new D(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return x()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=C(s,n);if(a){if(a===u)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=d(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===u)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var u={};function f(){}function p(){}function m(){}var g={};c(g,s,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(k([])));y&&y!==e&&n.call(y,s)&&(g=y);var _=m.prototype=f.prototype=Object.create(g);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,s,a,l){var c=d(t[o],t,s);if("throw"!==c.type){var h=c.arg,u=h.value;return u&&"object"==r(u)&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){i("next",t,a,l)}),(function(t){i("throw",t,a,l)})):e.resolve(u).then((function(t){h.value=t,a(h)}),(function(t){return i("throw",t,a,l)}))}l(c.arg)}var o;this._invoke=function(t,n){function r(){return new e((function(e,r){i(t,n,e,r)}))}return o=o?o.then(r,r):r()}}function C(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,C(t,e),"throw"===e.method))return u;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,u;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,u):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,u)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function k(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),u}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},t}function s(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function a(t){s(o,i,r,a,l,"next",t)}function l(t){s(o,i,r,a,l,"throw",t)}a(void 0)}))}}function l(t,e,n){return c.apply(this,arguments)}function c(){return(c=a(o().mark((function t(e,n,r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,o){["image/png","image/jpeg","image/webp"].includes(r.type)||t(null);var s=null,a=new FileReader,l=document.body.dataset.imageMaxSize;a.onload=function(a){var c=new Image;c.onload=function(a){var d=document.createElement("canvas"),u=c.width,f=c.height;u<=l&&f<=l&&t(null),u>f?u>l&&(f=Math.round(f*l/u),u=l):f>l&&(u=Math.round(u*l/f),f=l),d.width=u,d.height=f,d.getContext("2d").drawImage(c,0,0,u,f);var p=h(d.toDataURL(r.type)),m=r.name,g="";-1!==m.lastIndexOf(".")&&(g=m.substring(m.lastIndexOf(".")),m=m.substring(0,m.lastIndexOf("."))),p.name="".concat(m,"_").concat(u,"x").concat(f).concat(g);new i.Z({file:p,algo:e,initUrl:n,emsListener:self,onHashAvailable:function(t){s=t},onUploaded:function(e,n){t({hash:s,url:n})},onError:function(t,e){o("Error ".concat(e," during upload of resized image with message: ").concat(t))}})},c.src=a.target.result},a.readAsDataURL(r)})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function h(t){var e=";base64,";if(-1===t.indexOf(e)){var n=t.split(","),i=n[0].split(":")[1],r=n[1];return new Blob([r],{type:i})}for(var o=t.split(e),s=o[0].split(":")[1],a=window.atob(o[1]),l=a.length,c=new Uint8Array(l),h=0;h"+t.text+""},window.formatRepoSelection=function(t){var e,n,r;t.hasOwnProperty("element")&&t.element instanceof HTMLElement?e=null!==(n=t.element.dataset.tooltip)&&void 0!==n?n:null:e=null!==(r=t.tooltip)&&void 0!==r?r:null;if(null!==e){var o=i(''+t.text+"");return o.tooltip(),o}return t.text},window.objectPickerListeners=function(t,e){var n=t.data("type"),i=t.data("dynamic-loading"),r=t.data("search-id"),o=t.data("query-search"),s={escapeMarkup:function(t){return t},templateResult:formatRepo,templateSelection:formatRepoSelection};e?s.maximumSelectionLength=e:t.attr("multiple")&&(s.allowClear=!0,s.closeOnSelect=!1),i&&(s.ajax={url:object_search_url,dataType:"json",delay:250,data:function(t){return{q:t.term,page:t.page,type:n,searchId:r,querySearch:o}},processResults:function(t,e){return e.page=e.page||1,{results:t.items,pagination:{more:30*e.page=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;E(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function C(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function T(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){C(o,i,r,s,a,"next",t)}function a(t){C(o,i,r,s,a,"throw",t)}s(void 0)}))}}function E(t,e){for(var n=0;n div.media-lib-load-more"),listFiles:e.querySelector("ul.media-lib-list-files"),listFolders:e.querySelector("ul.media-lib-list-folders"),listUploads:e.querySelector("ul.media-lib-list-uploads")}),this._init()}var e,n,i,o,s,a,l,c,h,d,u;return e=t,n=[{key:"_init",value:function(){var t=this;this.loading(!0),this._addEventListeners(),this._initInfiniteScrollFiles(x(this,M).files,x(this,M).loadMoreFiles),Promise.allSettled([this._getFolders(),this._getFiles()]).then((function(){return t.loading(!1)}))}},{key:"isLoading",value:function(){return this.element.classList.contains("loading")}},{key:"loading",value:function(t){var e=this.element.querySelectorAll("button:not(.close-button)"),n=!!x(this,M).inputUpload&&x(this,M).header.querySelector('label[for="'.concat(x(this,M).inputUpload.id,'"]'));t?(this.element.classList.add("loading"),e.forEach((function(t){return t.disabled=!0})),n&&n.setAttribute("disabled","disabled")):(this.element.classList.remove("loading"),e.forEach((function(t){return t.disabled=!1})),n&&n.removeAttribute("disabled"))}},{key:"getSearchBox",value:function(){return x(this,M).header.querySelector(".media-lib-search")}},{key:"getFolders",value:function(){return x(this,M).listFolders.querySelectorAll(".media-lib-folder")}},{key:"getSelectionFile",value:function(){var t=this.getSelectionFiles();return 1===t.length?t[0]:null}},{key:"getSelectionFiles",value:function(){return x(this,M).listFiles.querySelectorAll(".active")}},{key:"_addEventListeners",value:function(){var t=this;document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&"a"===e.key&&t._selectAllFiles(e)})),this.element.onkeyup=function(e){e.shiftKey&&S(t,N,null),e.target.classList.contains("media-lib-search")&&t._onSearchInput(e.target,1e3)},this.element.onclick=function(e){if(!t.isLoading()){var n=e.target.classList;n.contains("media-lib-search")||(n.contains("media-lib-file")&&t._onClickFile(e.target,e),n.contains("media-lib-folder")&&t._onClickFolder(e.target),n.contains("btn-file-upload")&&x(t,M).inputUpload.click(),n.contains("btn-file-view")&&t._onClickButtonFileView(e.target),n.contains("btn-file-rename")&&t._onClickButtonFileRename(e.target),n.contains("btn-file-delete")&&t._onClickButtonFileDelete(e.target),n.contains("btn-files-delete")&&t._onClickButtonFilesDelete(e.target),n.contains("btn-files-move")&&t._onClickButtonFilesMove(e.target),n.contains("btn-folder-add")&&t._onClickButtonFolderAdd(),n.contains("btn-folder-delete")&&t._onClickButtonFolderDelete(e.target),n.contains("btn-folder-rename")&&t._onClickButtonFolderRename(e.target),n.contains("btn-home")&&t._onClickButtonHome(e.target),n.contains("breadcrumb-item")&&t._onClickBreadcrumbItem(e.target),e.target.dataset.hasOwnProperty("sortId")&&t._onClickFileSort(e.target),["media-lib-file","btn-file-rename","btn-file-delete","btn-files-delete","btn-files-move","btn-file-view"].some((function(t){return n.contains(t)}))||t._selectFilesReset())}},x(this,M).inputUpload.onchange=function(e){t.isLoading()||e.target.classList.contains("file-uploader-input")&&(t._uploadFiles(Array.from(e.target.files)),e.target.value="")},["dragenter","dragover","dragleave","drop","dragend"].forEach((function(e){x(t,M).files.addEventListener(e,(function(e){return t._onDragUpload(e)}))}))}},{key:"_onClickFile",value:function(t,e){var n=this;this.loading(!0);var i=1===this._selectFiles(t,e).length?t.dataset.id:null;this._getLayout(i).then((function(){n.loading(!1)}))}},{key:"_onClickFileSort",value:function(t){var e=this;S(this,Y,t.dataset.sortId),S(this,B,"asc"),t.dataset.hasOwnProperty("sortOrder")&&S(this,B,"asc"===t.dataset.sortOrder?"desc":"asc"),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFileView",value:function(t){var e=this,n=function(t,n){var i=x(e,M).listFiles.querySelector(".media-lib-file[data-id='".concat(t,"']")).closest("li")[n];return i?i.querySelector(".media-lib-file"):null},i=function(t,i,o){var a=r.Z.modal.querySelector(".btn-preview-".concat(t));a&&null!==n(o,i)&&(a.style.display="inline-block",a.addEventListener("click",(function(){var t=n(o,i);if(t){var r=x(e,M).files.querySelector(".media-lib-file-header"),a=r?r.getBoundingClientRect().height:0;e._selectFilesReset(),e._selectFile(t),x(e,M).files.scrollTop=t.offsetTop-x(e,M).files.offsetTop-a,s(t.dataset.id)}})))},o=function(t){var e={ArrowRight:"next",ArrowLeft:"prev"}[t.key]||!1;if(e){var n=r.Z.modal.querySelector(".btn-preview-".concat(e));n&&n.click()}},s=function(t){r.Z.modal.addEventListener("ajax-modal-close",(function t(){r.Z.modal.removeEventListener("ajax-modal-close",t),document.removeEventListener("keydown",o);var n=e.getSelectionFile();n&&n.click()})),r.Z.load({url:"".concat(x(e,R),"/file/").concat(t,"/view"),size:"auto-size",noLoading:!0},(function(){i("prev","previousSibling",t),i("next","nextSibling",t),document.addEventListener("keydown",o)}))};s(t.dataset.id)}},{key:"_onClickButtonFileRename",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));r.Z.load({url:"".concat(x(this,R),"/file/").concat(n,"/rename"),size:"sm"},(function(t){t.hasOwnProperty("success")&&!1!==t.success&&(t.hasOwnProperty("fileRow")&&(i.closest("li").innerHTML=t.fileRow),e._getLayout().then((function(){r.Z.close(),e.loading(!1)})))}))}},{key:"_onClickButtonFileDelete",value:function(t){var e=this,n=t.dataset.id,i=x(this,M).listFiles.querySelector(".media-lib-file[data-id='".concat(n,"']"));this._post("/file/".concat(n,"/delete")).then((function(t){t.hasOwnProperty("success")&&!1!==t.success&&(i.closest("li").remove(),e._selectFilesReset(),e.loading(!1))}))}},{key:"_onClickButtonFilesDelete",value:function(t){var e,n=this,i=this.getSelectionFiles();if(!(i.length<1)){var o=x(this,L)?"/delete-files/".concat(x(this,L)):"/delete-files",s=new URLSearchParams({selectionFiles:i.length.toString()}),a=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:x(this,R)+o+"?"+s.toString(),size:a},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var e=0,o=new v("progress-delete-files",{label:"Deleting files",value:100,showPercentage:!0});r.Z.getBodyElement().append(o.element()),n.loading(!0),Promise.allSettled(Array.from(i).map((function(r){return n._post("/file/".concat(r.dataset.id,"/delete")).then((function(){t.hasOwnProperty("success")&&!1!==t.success&&(r.closest("li").remove(),o.progress(Math.round(++e/i.length*100)).style("success"))}))}))).then((function(){return n._getFiles()})).then((function(){return n.loading(!1)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}}},{key:"_onClickButtonFilesMove",value:function(t,e){var n,i=this,o=this.getSelectionFiles();if(0!==o.length){var s=x(this,L)?"/move-files/".concat(x(this,L)):"/move-files",a=new URLSearchParams({selectionFiles:o.length.toString()});e&&a.append("targetId",e);var l=null!==(n=t.dataset.modalSize)&&void 0!==n?n:"sm";r.Z.load({url:x(this,R)+s+"?"+a.toString(),size:l},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("targetFolderId")){var e=t.targetFolderId,n=0,s=[],a=new v("progress-move-files",{label:1===o.length?"Moving file":"Moving files",value:100,showPercentage:!0}),l=document.createElement("div");l.id="move-errors",l.className="alert alert-danger",l.style.display="none",l.attributes.role="alert",r.Z.getBodyElement().append(l),r.Z.getBodyElement().append(a.element()),i.loading(!0),Promise.allSettled(Array.from(o).map((function(t){return new Promise((function(c,h){i._post("/file/".concat(t.dataset.id,"/move"),{targetFolderId:e}).then((function(e){e.hasOwnProperty("success")&&!1!==e.success&&(t.closest("li").remove(),c())})).catch((function(t){return t.json().then((function(t){s[t.error]=(s[t.error]||0)+1;var e="";for(var n in s)e+="

                                        ".concat(n," : for ").concat(s[n]," files

                                        ");l.style.display="block",l.innerHTML=e,h()}))})).finally((function(){a.style("success").progress(Math.round(++n/o.length*100)).status("".concat(n," / ").concat(o.length));var t=r.Z.getBodyElement().querySelector("div#move-errors");t&&r.Z.getBodyElement().replaceChild(l,t)}))}))}))).then((function(){return i._getFiles()})).then((function(){return i.loading(!1)})).then((function(){0===Object.keys(s).length&&setTimeout((function(){r.Z.close()}),2e3)}))}}))}}},{key:"_onClickFolder",value:function(t){var e=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),t.classList.add("active");var n=t.closest("li");n&&n.classList.contains("has-children")&&n.classList.toggle("open"),S(this,L,t.dataset.id),this._getFiles().then((function(){return e.loading(!1)}))}},{key:"_onClickButtonFolderAdd",value:function(){var t=this,e=x(this,L)?"/add-folder/".concat(x(this,L)):"/add-folder";r.Z.load({url:x(this,R)+e,size:"sm"},(function(e){e.hasOwnProperty("success")&&!0===e.success&&(t.loading(!0),t._getFolders(e.path).then((function(){return t.loading(!1)})))}))}},{key:"_onClickButtonFolderDelete",value:function(t){var e,n=this,i=t.dataset.id,o=null!==(e=t.dataset.modalSize)&&void 0!==e?e:"sm";r.Z.load({url:"".concat(x(this,R),"/folder/").concat(i,"/delete"),size:o},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")){var e=new v("progress-"+t.jobId,{label:"Deleting folder",value:100,showPercentage:!1});r.Z.getBodyElement().append(e.element()),n.loading(!0),Promise.allSettled([n._startJob(t.jobId),n._jobPolling(t.jobId,e)]).then((function(){return n._onClickButtonHome()})).then((function(){return n._getFolders()})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonFolderRename",value:function(t){var e=this,n=t.dataset.id;r.Z.load({url:"".concat(x(this,R),"/folder/").concat(n,"/rename"),size:"sm"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success&&t.hasOwnProperty("jobId")&&t.hasOwnProperty("path")){var n=new v("progress-"+t.jobId,{label:"Renaming",value:100,showPercentage:!1});r.Z.getBodyElement().append(n.element()),e.loading(!0),Promise.allSettled([e._startJob(t.jobId),e._jobPolling(t.jobId,n)]).then((function(){return e._getFolders(t.path)})).then((function(){return new Promise((function(t){return setTimeout(t,2e3)}))})).then((function(){return r.Z.close()}))}}))}},{key:"_onClickButtonHome",value:function(){var t=this;this.loading(!0),this.getFolders().forEach((function(t){return t.classList.remove("active")})),S(this,L,null),this._getFiles().then((function(){return t.loading(!1)}))}},{key:"_onClickBreadcrumbItem",value:function(t){var e=t.dataset.id;if(e){var n=x(this,M).listFolders.querySelector('.media-lib-folder[data-id="'.concat(e,'"]'));this._onClickFolder(n)}else this._onClickButtonHome()}},{key:"_onSearchInput",value:function(t,e){var n=this;clearTimeout(x(this,F)),S(this,F,setTimeout((function(){S(n,H,t.value),n._getFiles(0).then((function(){return n.loading(!1)}))}),e))}},{key:"_getLayout",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n="/layout",i=new URLSearchParams({loaded:x(this,P).toString()});return e&&i.append("fileId",e),this.getSelectionFiles().length>0&&i.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,L)&&i.append("folderId",x(this,L)),x(this,H)&&i.append("search",x(this,H)),i.size>0&&(n=n+"?"+i.toString()),this._get(n).then((function(e){e.hasOwnProperty("header")&&t._refreshHeader(e.header),e.hasOwnProperty("footer")&&(x(t,M).footer.innerHTML=e.footer)}))}},{key:"_getFiles",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;0===e&&(S(this,P,0),x(this,M).loadMoreFiles.classList.remove("show-load-more"),x(this,M).listFiles.innerHTML="");var n=new URLSearchParams({from:e.toString()});this.getSelectionFiles().length>0&&n.append("selectionFiles",this.getSelectionFiles().length.toString()),x(this,H)&&n.append("search",x(this,H)),x(this,Y)&&n.append("sortId",x(this,Y)),x(this,B)&&n.append("sortOrder",x(this,B));var i=x(this,L)?"/files/".concat(x(this,L)):"/files";return this._get("".concat(i,"?").concat(n.toString())).then((function(e){t._appendFiles(e)}))}},{key:"_getFolders",value:function(t){var e=this;return x(this,M).listFolders.innerHTML="",this._get("/folders").then((function(n){e._appendFolderItems(n),t&&e._openPath(t)}))}},{key:"_openPath",value:function(t){var e="";if(t.split("/").filter((function(t){return""!==t})).forEach((function(t){e+="/".concat(t);var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]')),i=n?n.closest("li"):null;i&&i.classList.contains("has-children")&&i.classList.add("open")})),""!==e){var n=document.querySelector('.media-lib-folder[data-path="'.concat(e,'"]'));n&&this._onClickFolder(n)}}},{key:"_appendFiles",value:function(t){t.hasOwnProperty("header")&&(this._refreshHeader(t.header),S(this,A,t.header)),t.hasOwnProperty("footer")&&(x(this,M).footer.innerHTML=t.footer),t.hasOwnProperty("rowHeader")&&(x(this,M).listFiles.innerHTML+=t.rowHeader,t.hasOwnProperty("sort")&&this._displaySort(t.sort.id,t.sort.order)),t.hasOwnProperty("totalRows")&&S(this,P,x(this,P)+t.totalRows),t.hasOwnProperty("rows")&&(x(this,M).listFiles.innerHTML+=t.rows),t.hasOwnProperty("remaining")&&t.remaining?x(this,M).loadMoreFiles.classList.add("show-load-more"):x(this,M).loadMoreFiles.classList.remove("show-load-more")}},{key:"_appendFolderItems",value:function(t){var e=this;x(this,M).listFolders.innerHTML=t.folders,this.getFolders().forEach((function(t){["dragenter","dragover","dragleave","drop"].forEach((function(n){t.addEventListener(n,(function(t){return e._onDragFolder(t)}))}))}))}},{key:"_refreshHeader",value:function(t){var e=document.activeElement===this.getSearchBox();if(x(this,M).header.innerHTML=t,e){var n=this.getSearchBox();n.focus();var i=n.value;n.value="",n.value=i}}},{key:"_displaySort",value:function(t,e){var n=x(this,M).listFiles.querySelector('[data-sort-id="'.concat(t,'"]'));n&&(n.dataset.sortOrder=e)}},{key:"_onDragUpload",value:function(t){var e,n;if(!(x(this,$).length>0)&&("dragend"===t.type&&S(this,K,0),"dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(S(this,K,(e=x(this,K),++e)),x(this,M).files.classList.add("media-lib-drop-area"),this._selectFilesReset()),"dragleave"===t.type&&(S(this,K,(n=x(this,K),--n)),0===x(this,K)&&x(this,M).files.classList.remove("media-lib-drop-area")),"drop"===t.type)){t.preventDefault(),S(this,K,0),x(this,M).files.classList.remove("media-lib-drop-area");var i=t.target.files||t.dataTransfer.files;this._uploadFiles(Array.from(i))}}},{key:"_onDragFolder",value:function(t){if(0!==x(this,$).length&&t.target.dataset.id!==x(this,L)&&("dragover"===t.type&&t.preventDefault(),"dragenter"===t.type&&(this.getFolders().forEach((function(t){return t.classList.remove("media-lib-drop-area")})),t.target.classList.add("media-lib-drop-area")),"dragleave"===t.type&&t.target.classList.remove("media-lib-drop-area"),"drop"===t.type)){t.preventDefault(),t.target.classList.remove("media-lib-drop-area");var e=t.target.dataset.id,n=x(this,M).header.querySelector(".btn-files-move");this._onClickButtonFilesMove(n,e)}}},{key:"_onDragFile",value:function(t){"dragstart"===t.type&&S(this,$,this.getSelectionFiles()),"dragend"===t.type&&(S(this,$,[]),this._selectFilesReset())}},{key:"_uploadFiles",value:function(t){var e=this;this.loading(!0),Promise.allSettled(t.map((function(t){return e._uploadFile(t)}))).then((function(){return e._getFiles().then((function(){return e.loading(!1)}))}))}},{key:"_uploadFile",value:function(t){var e=this;return new Promise((function(n,i){var r=Date.now(),o=document.createElement("li");o.id="upload-".concat(r);var s=document.createElement("div");s.className="upload-file";var a=document.createElement("button");a.type="button",a.className="close-button",a.addEventListener("click",(function(){x(e,M).listUploads.removeChild(o),o=!1,i()}));var l=document.createElement("i");l.className="fa fa-times",l.setAttribute("aria-hidden","true"),a.appendChild(l);var c=new v("progress-".concat(r),{label:t.name,value:5});s.append(c.style("success").element()),s.append(a),o.appendChild(s),x(e,M).listUploads.appendChild(o),e._getFileHash(t,c).then((function(n){return c.status("Resizing"),e._resizeImage(t,n)})).then((function(){c.status("Finished"),setTimeout((function(){x(e,M).listUploads.removeChild(o),n()}),1e3)})).catch((function(t){s.classList.add("upload-error"),c.status(t.message).style("danger").progress(100),setTimeout((function(){!1!==o&&(x(e,M).listUploads.removeChild(o),i())}),3e3)}))}))}},{key:"_resizeImage",value:(u=T(w().mark((function t(e,n){var i=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,_.t)(x(this,O).hashAlgo,x(this,O).urlInitUpload,e).then((function(t){return null===t?i._createFile(e,n):i._createFile(e,n,t.hash)})).catch((function(){return i._createFile(e,n)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return u.apply(this,arguments)})},{key:"_createFile",value:(d=T(w().mark((function t(e,n){var i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=s.length>2&&void 0!==s[2]?s[2]:null,(r=new FormData).append("name",e.name),r.append("filesize",e.size),r.append("fileMimetype",e.type),r.append("fileHash",n),r.append("fileResizedHash",null!=i?i:""),o=x(this,L)?"/add-file/".concat(x(this,L)):"/add-file",t.next=10,this._post(o,r,!0).catch((function(t){return t.json().then((function(t){throw new Error(t.error)}))}));case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return d.apply(this,arguments)})},{key:"_getFileHash",value:(h=T(w().mark((function t(e,n){var i,r=this;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){var o=null;new y.Z({file:e,algo:x(r,O).hashAlgo,initUrl:x(r,O).urlInitUpload,onHashAvailable:function(t){n.status("Hash available").progress(0),o=t},onProgress:function(t,e,i){"Computing hash"===t&&n.status("Calculating ...").progress(i),"Uploading"===t&&n.status("Uploading: "+i).progress(Math.round(100*e))},onUploaded:function(){n.status("Uploaded").progress(100),t(o)},onError:function(t){return i(t)}})}));case 2:if("string"==typeof(i=t.sent)){t.next=5;break}throw new Error("Invalid hash");case 5:return t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),function(t,e){return h.apply(this,arguments)})},{key:"_initInfiniteScrollFiles",value:function(t,e){var n=this;new IntersectionObserver((function(t){t.forEach((function(t){t.isIntersecting&&(n.loading(!0),n._getFiles(x(n,P)).then((function(){return n.loading(!1)})))}))}),{root:t,rootMargin:"0px",threshold:.5}).observe(e)}},{key:"_selectFile",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t._dragEventHandlers||(t._dragEventHandlers={}),t.classList.contains("active")?n&&(t.classList.remove("active"),t.draggable=!1,["dragstart","dragend"].forEach((function(e){t._dragEventHandlers[e]&&(t.removeEventListener(e,t._dragEventHandlers[e]),delete t._dragEventHandlers[e])}))):(t.classList.add("active"),t.draggable=!0,["dragstart","dragend"].forEach((function(n){t._dragEventHandlers[n]||(t._dragEventHandlers[n]=function(t){return e._onDragFile(t)},t.addEventListener(n,t._dragEventHandlers[n]))})))}},{key:"_selectFiles",value:function(t,e){var n=this;if(e.shiftKey&&null!==x(this,N)){var i=x(this,M).listFiles.querySelectorAll(".media-lib-file"),r=Array.from(i).indexOf(t),o=Array.from(i).indexOf(x(this,N));if(r>o){var s=[o,r];r=s[0],o=s[1]}i.forEach((function(t,e){e>=r&&e<=o&&n._selectFile(t)}))}else e.ctrlKey||e.metaKey?this._selectFile(t,!0):(this._selectFilesReset(!1),this._selectFile(t));return S(this,N,t),this.getSelectionFiles()}},{key:"_selectAllFiles",value:function(t){var e=this;t.target===document.body&&(t.preventDefault(),this.loading(!0),x(this,M).listFiles.querySelectorAll(".media-lib-file").forEach((function(t){return e._selectFile(t)})),this._getLayout().then((function(){e.loading(!1)})))}},{key:"_selectFilesReset",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];!0===e&&this._refreshHeader(x(this,A)),this.getSelectionFiles().forEach((function(e){e.classList.remove("active"),e.draggable=!1,["dragstart","dragend"].forEach((function(n){e.removeEventListener(n,(function(e){return t._onDragFile(e)}))}))}))}},{key:"_jobPolling",value:(c=T(w().mark((function t(e,n){var i;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getJobStatus(e);case 2:if(!0===(i=t.sent).started&&i.progress>0&&n.status("Running ...").progress(i.progress).style("success"),!0!==i.done){t.next=7;break}return n.status("Finished").progress(100),t.abrupt("return",i);case 7:return t.next=9,new Promise((function(t){return setTimeout(t,1500)}));case 9:return t.next=11,this._jobPolling(e,n);case 11:return t.abrupt("return",t.sent);case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return c.apply(this,arguments)})},{key:"_startJob",value:(l=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/start/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return l.apply(this,arguments)})},{key:"_getJobStatus",value:(a=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch("/job/status/".concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 2:return n=t.sent,t.abrupt("return",n.json());case 4:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"_get",value:(s=T(w().mark((function t(e){var n;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(x(this,R)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=T(w().mark((function t(e){var n,i,r,o,s=arguments;return w().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},i=s.length>2&&void 0!==s[2]&&s[2],this.loading(!0),r={},r=i?{method:"POST",body:n}:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)},t.next=7,fetch("".concat(x(this,R)).concat(e),r);case 7:return o=t.sent,t.abrupt("return",o.ok?o.json():Promise.reject(o));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&E(e.prototype,n),i&&E(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),W=n(9755),z=n.n(W),U=n(9755);function V(t){return V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V(t)}function q(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return G(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",stop:function(){n.relocate()}}),this.addListeners(e),this.updateCollapseButtons()}var e,n,r;return e=t,n=[{key:"addListeners",value:function(t){var e=z()(t),n=this;e.find(".json_menu_sortable_remove_button").on("click",(function(t){n.removeElement(this,t)})),e.find(".json_menu_sortable_add_item_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-item",U(this).data())})),e.find(".json_menu_sortable_add_node_button").on("click",(function(t){t.preventDefault(),n.addItem(U(this),"prototype-node",U(this).data())})),e.find(".json_menu_sortable_paste_button").on("click",(function(t){t.preventDefault(),n.paste(U(this))})),e.find("input.itemLabel").on("input",(function(t){n.updateLabel(this,t)}))}},{key:"updateLabel",value:function(t,e){z()(t).closest("li").data("label",z()(t).val()),this.relocate()}},{key:"removeElement",value:function(t,e){e.preventDefault(),z()(t).closest("li").remove(),this.relocate()}},{key:"addItem",value:function(t,e,n){var r=J(),o=this.parent.find(".json_menu_editor_fieldtype_widget").data(e);o=o.replace(/%uuid%/g,r);for(var s=0,a=Object.entries(n);s0?u.children("ol").append(d):u.append(U("
                                          ").append(d)),u.find(".button-collapse:first").attr("aria-expanded",!1);var f=z()("#"+r);this.addListeners(f),new i.Z(f.get(0)),this.relocate(),this.setFocus(r)}},{key:"setFocus",value:function(t){z()("#"+t).find("input").focus()}},{key:"updateCollapseButtons",value:function(){this.parent.find("li.nestedSortable").each((function(){var t=U(this).find(".button-collapse:first");0===U(this).find("ol:first li").length?t.css("display","none"):t.show()}))}},{key:"relocate",value:function(){this.updateCollapseButtons();var t=this.nestedSortable.nestedSortable("toHierarchy",{startDepthCount:0}),e=JSON.stringify(function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=n;return Object.keys(e).forEach((function(n){var r=e[n],o={id:r.id,label:r.label,contentType:r.contentType,type:r.type,object:r.object};r.hasOwnProperty("children")&&(o.children=t(r.children)),i.push(o)})),i}(t));this.hiddenField.val(e).trigger("input").trigger("change")}}],n&&X(e.prototype,n),r&&X(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Q(t,e,n){var i=new XMLHttpRequest;i.open("POST",t,!0),i.setRequestHeader("Content-Type","application/json"),tt(i,n,e)}function tt(t,e,n){t.onreadystatechange=function(){if(t.readyState===XMLHttpRequest.DONE){var n=JSON.parse(t.responseText);"function"==typeof e&&e(n,t)}},t.send(n)}var et=n(9755);function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);s=!0);}catch(t){a=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw r}}return o}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return it(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return it(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n div",update:function(){i._relocate()},isAllowed:function(t,e,n){var r=et(n).data(),o=e?et(e).data():et(i.target).data(),s=i.nodes[r.nodeId];return i.nodes[o.nodeId].addNodes.includes(s.name)}})),this._addEventListeners(this.target),window.addEventListener("focus",(function(){n._refreshPasteButtons()})),this._initSilentPublish(),this.selectItemId?(this.selectItem(this.selectItemId,!0),this.loading(!1)):this.loading(!1)}var e,n,i;return e=t,n=[{key:"getId",value:function(){return this.target.getAttribute("id")}},{key:"getStructureJson",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=function t(e){var n=[],i=e.querySelector("ol.json-menu-nested-list");return i&&i.querySelectorAll(":scope > li.json-menu-nested-item").forEach((function(e){var i=JSON.parse(e.dataset.item);i.children=t(e),n.push(i)})),n},n=e(this.target);if(!t)return JSON.stringify(n);var i=JSON.parse(this.target.dataset.item);return i.children=e(this.target),JSON.stringify(i)}},{key:"loading",value:function(t){var e=this.target.querySelector(".json-menu-nested-loading");e.style.display=t?"flex":"none"}},{key:"selectItem",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this._getElementItem(t);if(null!==n){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),n.classList.add("json-menu-nested-item-selected");var i=n.parentNode;if(null!==i){for(;i&&!i.classList.contains("json-menu-nested-root");){if(i.classList.contains("json-menu-nested-item")){var r=i.querySelector(".btn-collapse");r&&r.dispatchEvent(new CustomEvent("show"))}i=i.parentNode}e&&setTimeout((function(){n.scrollIntoView()}),1e3)}}}},{key:"_parseAttributes",value:function(){this.target.hasAttribute("data-hidden-field-id")&&(this.hiddenField=document.getElementById(this.target.dataset.hiddenFieldId)),this.config=this.target.dataset.config,this.nodes=JSON.parse(this.target.dataset.nodes),this.urls=JSON.parse(this.target.dataset.urls),this.selectItemId=!!this.target.hasAttribute("data-select-item-id")&&this.target.dataset.selectItemId}},{key:"_addEventListeners",value:function(t){this._relocate(),this._buttonItemAdd(t),this._buttonItemEdit(t),this._buttonItemDelete(t),this._buttonItemPreview(t),this._buttonItemCopy(t),this._buttonItemCopyAll(t),this._buttonItemPaste(t),this._refreshPasteButtons()}},{key:"_relocate",value:function(){this.target.querySelectorAll("li.json-menu-nested-item").forEach((function(t){t.classList.remove("json-menu-nested-item-selected")})),this.target.querySelectorAll("ol").forEach((function(t){t.hasAttribute("data-list")||t.setAttribute("data-list",t.parentElement.dataset.item),t.classList.contains("json-menu-nested-list")||t.classList.add("json-menu-nested-list"),t.classList.contains("collapse")||t.classList.contains("json-menu-nested-root")||t.classList.add("collapse")})),document.querySelectorAll(".collapsible").forEach((function(t){var e=t.querySelector(".btn-collapse");if(null!==e){var n=t.querySelectorAll(":scope > .collapse"),i=!1,r=!1;n.forEach((function(t){i=!!t.firstElementChild,r="block"===t.style.display&&0==r})),e.setAttribute("aria-expanded",r),i?(e.style.display="inline-block",e.onclick=function(t){t.preventDefault();var i=e.getAttribute("aria-expanded");e.setAttribute("aria-expanded","true"==i?"false":"true"),n.forEach((function(t){t.style.display="true"==i?"none":"block"}))},e.addEventListener("show",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","true"),n.forEach((function(t){t.style.display="block"}))})),e.addEventListener("hide",(function(t){t.preventDefault(),t.target.setAttribute("aria-expanded","false"),n.forEach((function(t){t.style.display="none"}))}))):(e.style.display="none",e.onclick=function(t){})}})),this.hasOwnProperty("hiddenField")&&null!==this.hiddenField&&(this.hiddenField.classList.contains("json-menu-nested-silent-publish")?(this.hiddenField.value=this.getStructureJson(!0),this.hiddenField.dispatchEvent(new CustomEvent("silentPublish"))):(this.hiddenField.value=this.getStructureJson(),et(this.hiddenField).trigger("input").trigger("change")))}},{key:"_getElementItem",value:function(t){return this.target.parentElement.querySelector('[data-item-id="'.concat(t,'"]'))}},{key:"_getElementItemList",value:function(t){return this.target.querySelector('[data-list="'.concat(t,'"]'))}},{key:"_getCopy",value:function(){return!!localStorage.hasOwnProperty(this.copyName)&&function t(e,n){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=0,o=Object.entries(e);r '):"")+"Add: ".concat(a.label),data:JSON.stringify({_data:{level:s,item_id:l,config:e.config,defaultData:c.get("defaultData")}}),size:"lg"},(function(t){t.hasOwnProperty("success")&&!0===t.success&&(e._appendHtml(i,t.html),e.selectItem(l))}))}}}))}},{key:"_buttonItemEdit",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-edit").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=JSON.parse(e._getElementItem(i).dataset.item),s=t.dataset.nodeId,a=t.dataset.level;if(e.nodes.hasOwnProperty(s)){var l=e.nodes[s];r.Z.load({url:l.urlEdit,title:(l.icon?' '):"")+"Edit: ".concat(l.label),data:JSON.stringify({_data:{level:a,item_id:i,object:o.object,config:e.config}}),size:"lg"},(function(t){if(t.hasOwnProperty("success")&&!1!==t.success){var n=e._getElementItemList(i);e._getElementItem(i).outerHTML=t.html,n&&e._getElementItem(i).insertAdjacentHTML("beforeend",n.outerHTML),e._addEventListeners(e._getElementItem(i).parentNode)}}))}}}))}},{key:"_buttonItemDelete",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-delete").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=e._getElementItem(i);r.parentNode.removeChild(r),e._relocate()}}))}},{key:"_buttonItemCopyAll",value:function(t){var e=this,n=t.querySelector(".btn-json-menu-nested-copy-all");null!==n&&(n.onclick=function(t){t.preventDefault(),e._setCopy({id:"_root",label:"_root",type:"_root",children:JSON.parse(e.getStructureJson())})})}},{key:"_buttonItemCopy",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-copy").forEach((function(t){t.parentElement,t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,r=function t(n){var i=JSON.parse(n.dataset.item),r=[],o=e._getElementItemList(n.dataset.itemId);return o&&o.querySelectorAll(":scope > li").forEach((function(e){r.push(t(e))})),{id:st(),label:i.label,type:i.type,object:i.object,children:r}}(e._getElementItem(i));e._setCopy(r)}}))}},{key:"_buttonItemPaste",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=e._getCopy();if(!1!==i){e.loading(!0);var r=t.dataset.itemId,o=(e._getElementItem(r),t.dataset.nodeId);e.nodes[o],Q(e.urls.paste,JSON.stringify({_data:{copied:i,config:e.config}}),(function(t){e._appendHtml(r,t.html),e.loading(!1)}))}}}))}},{key:"_buttonItemPreview",value:function(t){var e=this;t.querySelectorAll(".btn-json-menu-nested-preview").forEach((function(t){t.onclick=function(n){n.preventDefault();var i=t.dataset.itemId,o=e._getElementItem(i),s=JSON.parse(o.dataset.item);r.Z.load({url:e.urls.preview,title:t.dataset.title,size:"lg",data:JSON.stringify({_data:{type:s.type,object:s.object}})})}}))}},{key:"_appendHtml",value:function(t,e){var n=this._getElementItemList(t);if(n)n.insertAdjacentHTML("beforeend",e);else{var i='
                                            ').concat(e,"
                                          ");this._getElementItem(t).insertAdjacentHTML("beforeend",i)}this._addEventListeners(this._getElementItem(t).parentElement)}},{key:"_initSilentPublish",value:function(){var t=this;null!==this.hiddenField&&this.hiddenField.classList.contains("json-menu-nested-silent-publish")&&this.hiddenField.addEventListener("silentPublish",(function(e){var n=t.hiddenField.value;t.loading(!0),Q(t.urls.silentPublish,JSON.stringify({_data:{update:n,config:t.config}}),(function(e,n){if(200===n.status)return e.hasOwnProperty("urls")&&(t.urls=e.urls,t.target.setAttribute("data-urls",JSON.stringify(t.urls))),e.hasOwnProperty("nodes")&&(t.nodes=e.nodes,t.target.setAttribute("data-nodes",JSON.stringify(t.nodes))),void setTimeout((function(){return t.loading(!1)}),250);e.hasOwnProperty("alert")&&(document.getElementById(t.getId()+"-alerts").innerHTML=e.alert)}))}))}},{key:"_refreshPasteButtons",value:function(){var t=this,e=this._getCopy();document.querySelectorAll(".btn-json-menu-nested-paste").forEach((function(n){var i=n.parentElement;if(null!==e){var r=n.dataset.nodeId,o=t.nodes[r],s=e.type,a=n.dataset.allow;void 0!==o&&o.addNodes.includes(s)||a===s?i.style.display="list-item":i.style.display="none"}else i.style.display="none"}))}}],n&&rt(e.prototype,n),i&&rt(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),lt=n(1474);function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function ht(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ht=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},r=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function a(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{a({},"")}catch(t){a=function(t,e,n){return t[e]=n}}function l(t,e,n,i){var r=e&&e.prototype instanceof d?e:d,o=Object.create(r.prototype),s=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(r,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===r)throw o;return D()}for(n.method=r,n.arg=o;;){var s=n.delegate;if(s){var a=b(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=c(t,e,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var h={};function d(){}function u(){}function f(){}var p={};a(p,r,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&n.call(g,r)&&(p=g);var v=f.prototype=d.prototype=Object.create(p);function y(t){["next","throw","return"].forEach((function(e){a(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function i(r,o,s,a){var l=c(t[r],t,o);if("throw"!==l.type){var h=l.arg,d=h.value;return d&&"object"==ct(d)&&n.call(d,"__await")?e.resolve(d.__await).then((function(t){i("next",t,s,a)}),(function(t){i("throw",t,s,a)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return i("throw",t,s,a)}))}a(l.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function b(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return h;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function E(t){if(t){var e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i=0;--r){var o=this.tryEntries[r],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&n.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;C(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:E(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},t}function dt(t,e,n,i,r,o,s){try{var a=t[o](s),l=a.value}catch(t){return void n(t)}a.done?e(l):Promise.resolve(l).then(i,r)}function ut(t){return function(){var e=this,n=arguments;return new Promise((function(i,r){var o=t.apply(e,n);function s(t){dt(o,i,r,s,a,"next",t)}function a(t){dt(o,i,r,s,a,"throw",t)}s(void 0)}))}}function ft(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},n=e.activeItemId,i=void 0===n?null:n,r=e.loadChildrenId,o=void 0===r?null:r;this._post("/render",{active_item_id:i,load_parent_ids:gt(this,Ct),load_children_id:o}).then((function(e){e.hasOwnProperty("tree")&&e.hasOwnProperty("load_parent_ids")&&(vt(t,Ct,e.load_parent_ids),gt(t,bt).innerHTML=e.tree,t._dispatchEvent("jmn-load",{data:e,elements:t._sortables()})||t.loading(!1))}))}},{key:"itemGet",value:function(t){return this._get("/item/".concat(t))}},{key:"itemAdd",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return this._post("/item/".concat(t,"/add"),{position:n,add:e})}},{key:"itemDelete",value:function(t){var e=this;this._post("/item/".concat(t,"/delete")).then((function(n){e._dispatchEvent("jmn-delete",{data:n,nodeId:t})||e.load()}))}},{key:"loading",value:function(t){this.element.querySelector(".jmn-node-loading").style.display=t?"flex":"none"}},{key:"_addClickListeners",value:function(){var t=this;this.element.addEventListener("click",(function(e){var n=e.target,i=n.parentElement.closest(".jmn-node"),r=i?i.dataset.id:"_root";n.classList.contains("jmn-btn-add")&&t._onClickButtonAdd(n,r),n.classList.contains("jmn-btn-edit")&&t._onClickButtonEdit(n,r),n.classList.contains("jmn-btn-view")&&t._onClickButtonView(n,r),n.classList.contains("jmn-btn-delete")&&t._onClickButtonDelete(r),n.dataset.hasOwnProperty("jmnModalCustom")&&t._onClickModalCustom(n,r)}),!0)}},{key:"_onClickButtonAdd",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-add/").concat(t.dataset.add),"jmn-add")}},{key:"_onClickButtonEdit",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-edit"),"jmn-edit")}},{key:"_onClickButtonView",value:function(t,e){this._ajaxModal(t,"/item/".concat(e,"/modal-view"),"jmn-view")}},{key:"_onClickButtonDelete",value:function(t){this.itemDelete(t)}},{key:"_onClickModalCustom",value:function(t,e){var n=t.dataset.jmnModalCustom;this._ajaxModal(t,"/item/".concat(e,"/modal-custom/").concat(n),"jmn-modal-custom")}},{key:"_onClickButtonCollapse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.getAttribute("aria-expanded"),i=event.target.parentElement.closest(".jmn-node"),r=i.dataset.id;if("true"===n){t.setAttribute("aria-expanded","false");var o=i.querySelectorAll(".jmn-node"),s=Array.from(o).map((function(t){return t.dataset.id}));o.forEach((function(t){return t.remove()})),vt(this,Ct,gt(this,Ct).filter((function(t){return t!==r&&!s.includes(t)}))),this.load()}else t.setAttribute("aria-expanded","true"),gt(this,Ct).push(r),this.load({loadChildrenId:e?r:null})}},{key:"_addClickLongPressListeners",value:function(){var t,e=this,n=!1;this.element.addEventListener("mousedown",(function(e){e.target.classList.contains("jmn-btn-collapse")&&(t=setTimeout((function(){n=!0}),300))}),!0),this.element.addEventListener("mouseup",(function(i){i.target.classList.contains("jmn-btn-collapse")&&(e._onClickButtonCollapse(i.target,n),clearTimeout(t),n=!1)}))}},{key:"_sortables",value:function(){var t=this,e={group:"shared",draggable:".jmn-node",handle:".jmn-btn-move",dragoverBubble:!0,ghostClass:"jmn-move-ghost",chosenClass:"jmn-move-chosen",dragClass:"jmn-move-drag",animation:10,fallbackOnBody:!0,swapThreshold:.5,onMove:function(e){return t._onMove(e)},onEnd:function(e){return t._onMoveEnd(e)}},n=this.element.querySelectorAll(".jmn-sortable");return n.forEach((function(n){gt(t,Tt)[n.id]=lt.ZP.create(n,e)})),n}},{key:"_onMove",value:function(t){var e=t.dragged,n=t.to;return!(!e.dataset.hasOwnProperty("type")||!n.dataset.hasOwnProperty("types"))&&JSON.parse(n.dataset.types).includes(e.dataset.type)}},{key:"_onMoveEnd",value:function(t){var e=t.item.dataset.id,n=window.jsonMenuNestedComponents[t.to.closest(".json-menu-nested-component").id],i=window.jsonMenuNestedComponents[t.from.closest(".json-menu-nested-component").id],r=t.newIndex,o=t.to.closest(".jmn-node").dataset.id,s=t.from.closest(".jmn-node").dataset.id;n.id===i.id?this._post("/item/".concat(e,"/move"),{fromParentId:s,toParentId:o,position:r}).finally((function(){return n.load({activeItemId:e})})):i.itemGet(e).then((function(t){if(!t.hasOwnProperty("item"))throw new Error(JSON.stringify(t));return n.itemAdd(o,t.item,r)})).then((function(t){if(!t.hasOwnProperty("success")||!t.success)throw new Error(JSON.stringify(t));return i.itemDelete(e)})).catch((function(){})).finally((function(){n.load({activeItemId:e}),i.load()}))}},{key:"_ajaxModal",value:function(t,e,n){var i,o=this,s=null,a=null!==(i=t.dataset.modalSize)&&void 0!==i?i:this.modalSize,l=function t(){o.load({activeItemId:s}),r.Z.modal.removeEventListener("ajax-modal-close",t)};r.Z.modal.addEventListener("ajax-modal-close",l),r.Z.load({url:"".concat(gt(this,wt)).concat(e),size:a},(function(t){if(o._dispatchEvent(n,{data:t,ajaxModal:r.Z})&&r.Z.modal.removeEventListener("ajax-modal-close",l),"jmn-add"===n||"jmn-edit"===n){if(!t.hasOwnProperty("success")||!t.success)return;t.hasOwnProperty("load")&>(o,Ct).push(t.load),t.hasOwnProperty("item")&&t.item.hasOwnProperty("id")&&(s=t.item.id),r.Z.close()}}))}},{key:"_dispatchEvent",value:function(t,e){return e.jmn=this,!this.element.dispatchEvent(new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e}))}},{key:"_get",value:(s=ut(ht().mark((function t(e){var n;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading(!0),t.next=3,fetch("".concat(gt(this,wt)).concat(e),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=t.sent,t.abrupt("return",n.json());case 5:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"_post",value:(o=ut(ht().mark((function t(e){var n,i,r=arguments;return ht().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.length>1&&void 0!==r[1]?r[1]:{},this.loading(!0),t.next=4,fetch("".concat(gt(this,wt)).concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});case 4:return i=t.sent,t.abrupt("return",i.json());case 6:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})}],n&&ft(e.prototype,n),i&&ft(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Dt=n(9755);_t=function(t){t(document).ready((function(){var e,n,o,s;(e=t('section.sidebar ul.sidebar-menu a[href="'+window.location.pathname+window.location.search+'"]')).length>0?e.last().parents("li").addClass("active"):t("#side-menu-id").each((function(){t("#"+t(this).data("target")).parents("li").addClass("active")})),t("img.lazy").show().lazyload({effect:"fadeIn",threshold:200}),t(".match-height").matchHeight(),t("#modal-notification-close-button").on("click",(function(){t("#modal-notifications .modal-body").empty(),t("#modal-notifications").modal("hide")})),t("a.request_job").on("click",(function(e){e.preventDefault(),window.ajaxRequest.post(t(e.target).data("url")).success((function(e){window.ajaxRequest.post(e.jobUrl),t("ul#commands-log").prepend('
                                        1. Job #'+e.jobId+"
                                        2. ")}))})),t(".toggle-button").on("click",(function(){var e=t(this).data("toggle-contain"),n=t(this).html();t(this).html(e),t(this).data("toggle-contain",n)})),t("#add-search-filter-button").on("click",(function(e){e.preventDefault();var n=t("#list-of-search-filters"),r=n.data("prototype"),o=n.data("index"),s=t(r.replace(/__name__/g,o));n.data("index",o+1),new i.Z(s.get(0)),n.append(s)})),function(){var e=t(".code_editor_mode_ems");if(e){for(var n=ace.require("ace/ext/modelist"),i=[],r=0;r0;)e=n.pop();return!!("number"!=typeof e||115!==e&&83!==e||!t.ctrlKey&&!t.metaKey||t.altKey)||(i(t),!1)}))})),function(){t(".json_menu_editor_fieldtype").each((function(){new Z(this)}));var e=[];t(".json-menu-nested").each((function(){var t=new at(this);e[t.getId()]=t})),window.jsonMenuNested=e}(),n=document.getElementsByClassName("media-lib"),o=document.querySelector("body").dataset,[].forEach.call(n,(function(t){new j(t,{urlMediaLib:"/component/media-lib",urlInitUpload:o.initUpload,hashAlgo:o.hashAlgo})})),function(){var t=document.getElementsByClassName("json-menu-nested-component");window.jsonMenuNestedComponents=[],[].forEach.call(t,(function(t){var e=new Et(t);if(e.id in window.jsonMenuNestedComponents)throw new Error("duplicate id : ".concat(e.id));window.jsonMenuNestedComponents[e.id]=e}))}(),s=document.querySelectorAll("a[data-ajax-modal-url]"),[].forEach.call(s,(function(t){t.onclick=function(t){r.Z.load({url:t.target.dataset.ajaxModalUrl,size:t.target.dataset.ajaxModalSize},(function(t){t.hasOwnProperty("success")&&!0===t.success&&location.reload()}))}})),document.addEventListener("click",(function(t){if(t.target.classList.contains("core-post-button")){t.preventDefault();var e=t.target,n=JSON.parse(e.dataset.postSettings),i=e.href,r=n.hasOwnProperty("form")?document.getElementById(n.form):document.createElement("form");if(n.hasOwnProperty("form")){var o=document.createElement("INPUT");o.style.display="none",o.type="TEXT",o.name="source_url",o.value=i,r.appendChild(o),n.action&&(r.action=JSON.parse(n.action))}else r.style.display="none",r.method="post",r.action=i,e.parentNode.appendChild(r);if(n.hasOwnProperty("value")&&n.hasOwnProperty("name")){var s=document.createElement("INPUT");s.style.display="none",s.type="TEXT",s.name=JSON.parse(n.name),s.value=JSON.parse(n.value),r.appendChild(s)}r.submit()}})),window.setInterval((function(){t.getJSON(t("body").attr("data-status-url")).done((function(e){t("#status-overview").html(e.body)})).fail((function(e,n,i){var r=n+", "+i;t("#status-overview").html(' '+r)}))}),18e4),window.dispatchEvent(new CustomEvent("emsReady"))}))},"function"==typeof define&&n.amdO?define(["jquery"],_t):_t(window.jQuery)},3423:function(t,e,n){"use strict";function i(t,e){for(var n=0;ne&&t=0;n--)if(i=this.items[n],r=i.item[0],(o=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==r.className.indexOf(_.disabledClass))if(2===o){if((h=this.items[n+1])&&h.item.hasClass(_.disabledClass))continue}else if(1===o&&(d=this.items[n-1])&&d.item.hasClass(_.disabledClass))continue;if(f=1===o?"next":"prev",!(r===this.currentItem[0]||this.placeholder[f]()[0]===r||t.contains(this.placeholder[0],r)||"semi-dynamic"===this.options.type&&t.contains(this.element[0],r))){if(this.mouseentered||(t(r).mouseenter(),this.mouseentered=!0),_.isTree&&t(r).hasClass(_.collapsedClass)&&_.expandOnHover&&(this.hovering||(t(r).addClass(_.hoveringClass),this.hovering=window.setTimeout((function(){t(r).removeClass(_.collapsedClass).addClass(_.expandedClass),y.refreshPositions(),y._trigger("expand",e,y._uiHash())}),_.expandOnHover))),this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;t(r).mouseleave(),this.mouseentered=!1,t(r).removeClass(_.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!_.protectRoot||this.currentItem[0].parentNode===this.element[0]&&r.parentNode!==this.element[0]?_.protectRoot||this._rearrange(e,i):this.currentItem[0].parentNode!==this.element[0]&&r.parentNode===this.element[0]?(t(r).children(_.listType).length||(r.appendChild(u),_.isTree&&t(r).removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),void 0!==(p="down"===this.direction?t(r).prev().children(_.listType):t(r).children(_.listType))[0]&&this._rearrange(e,null,p)):this._rearrange(e,i),this._clearEmpty(r),this._trigger("change",e,this._uiHash());break}}if(function(){var t=this.placeholder.prev();m=t.length?t:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(_.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=t(m[0].previousSibling)}if(function(){var t=this.placeholder.next();g=t.length?t:null}.call(this),null!=g)for(;"li"!==g[0].nodeName.toLowerCase()||-1!==g[0].className.indexOf(_.disabledClass)||g[0]===this.currentItem[0]||g[0]===this.helper[0];){if(!g[0].nextSibling){g=null;break}g=t(g[0].nextSibling)}return this.beyondMaxLevels=0,null==a||null!=g||_.protectRoot&&a[0].parentNode==this.element[0]||!(_.rtl&&this.positionAbs.left+this.helper.outerWidth()>a.offset().left+a.outerWidth()||!_.rtl&&this.positionAbs.leftm.offset().left+_.tabSize)?this._isAllowed(a,l,l+c):(this._isAllowed(m,l,l+c+1),m.children(_.listType).length||(m[0].appendChild(u),_.isTree&&m.removeClass(_.leafClass).addClass(_.branchClass+" "+_.expandedClass)),s&&s<=m.offset().top?m.children(_.listType).prepend(this.placeholder):m.children(_.listType)[0].appendChild(this.placeholder[0]),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())):(a.after(this.placeholder[0]),v=!a.children(_.listItem).children("li:visible:not(.ui-sortable-helper)").length,_.isTree&&v&&a.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==a&&this._clearEmpty(a[0]),this._trigger("change",e,this._uiHash())),this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?t(this.domPosition.prev).after(this.placeholder):t(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",e,this._uiHash())),t("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=e,this._pid_current=t(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?t(this.domPosition.prev).next().index():0,t.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(t){var n=this.options.isTree?.8:.5,i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height*n,t.height),r=e(this.positionAbs.top+this.offset.click.top,t.top-t.height*n,t.height),o=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&o||"left"===a&&!o:s&&("down"===s&&i||"up"===s&&r)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||t.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var e,n;for(t.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),e=this.items.length-1;e>=0;e--)n=this.items[e].item[0],this._clearEmpty(n)},serialize:function(e){var n=t.extend({},this.options,e),i=this._getItemsAsjQuery(n&&n.connected),r=[];return t(i).each((function(){var e=(t(n.item||this).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),i=(t(n.item||this).parent(n.listType).parent(n.items).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/);e&&r.push((n.key||e[1])+"["+(n.key&&n.expression?e[1]:e[2])+"]="+(i?n.key&&n.expression?i[1]:i[2]:n.rootID))})),!r.length&&n.key&&r.push(n.key+"="),r.join("&")},toHierarchy:function(e){var n=t.extend({},this.options,e),i=[];return t(this.element).children(n.items).each((function(){var t=r(this);i.push(t)})),i;function r(e){var i,o=(t(e).attr(n.attribute||"id")||"").match(n.expression||/(.+)[-=_](.+)/),s=t(e).data();if(s.nestedSortableItem&&delete s.nestedSortableItem,o)return i={id:o[2]},i=t.extend({},i,s),t(e).children(n.listType).children(n.items).length>0&&(i.children=[],t(e).children(n.listType).children(n.items).each((function(){var t=r(this);i.children.push(t)}))),i}},toArray:function(e){var n=t.extend({},this.options,e),i=n.startDepthCount||0,r=[],o=1;return n.excludeRoot||(r.push({item_id:n.rootID,parent_id:null,depth:i,left:o,right:2*(t(n.items,this.element).length+1)}),o++),t(this.element).children(n.items).each((function(){o=s(this,i,o)})),r=r.sort((function(t,e){return t.left-e.left}));function s(e,o,a){var l,c,h=a+1;if(t(e).children(n.listType).children(n.items).length>0&&(o++,t(e).children(n.listType).children(n.items).each((function(){h=s(t(this),o,h)})),o--),l=t(e).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/),c=o===i?n.rootID:t(e).parent(n.listType).parent(n.items).attr(n.attribute||"id").match(n.expression||/(.+)[-=_](.+)/)[2],l){var d=t(e).data("name");r.push({id:l[2],parent_id:c,depth:o,left:a,right:h,name:d})}return a=h+1}},_clearEmpty:function(e){function n(e,n,i,r){r&&(n=[i,i=n][0]),t(e).removeClass(n).addClass(i)}var i=this.options,r=t(e).children(i.listType),o=r.is(":not(:empty)"),s=i.doNotClear||o||i.protectRoot&&t(e)[0]===this.element[0];i.isTree&&(n(e,i.branchClass,i.leafClass,s),s&&o&&n(e,i.collapsedClass,i.expandedClass)),s||r.remove()},_getLevel:function(t){var e,n=1;if(this.options.listType)for(e=t.closest(this.options.listType);e&&e.length>0&&!e.is(".ui-sortable");)n++,e=e.parent().closest(this.options.listType);return n},_getChildLevels:function(e,n){var i=this,r=this.options,o=0;return n=n||0,t(e).children(r.listType).children(r.items).each((function(t,e){o=Math.max(i._getChildLevels(e,n+1),o)})),n?o+1:o},_isAllowed:function(t,e,n){var i=this.options,r=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),o=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==t&&!o.is(t)||void 0===t&&o.is("li"))||!i.isAllowed(this.placeholder,t,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=r {% endblock textarea_widget %} + +{% block collection_entry_with_grouped_remove %} + {{ block('form_widget') }} + + + +{% endblock collection_entry_with_grouped_remove %} + +{% block _filter_options_synonyms_entry_widget %} + {{ block('collection_entry_with_grouped_remove') }} +{% endblock _filter_options_synonyms_entry_widget %}