/* Copyright (c) 2022 Synology Inc. All rights reserved. */
!function(t){var e={};function o(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)o.d(n,i,function(e){return t[e]}.bind(null,i));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=20)}([function(t,e){t.exports=Vue},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){},function(t,e,o){t.exports=o(41)},function(t,e,o){"use strict";var n=o(1);o.n(n).a},function(t,e,o){"use strict";var n=o(2);o.n(n).a},function(t,e,o){"use strict";var n=o(3);o.n(n).a},function(t,e,o){"use strict";var n=o(4);o.n(n).a},function(t,e,o){"use strict";var n=o(5);o.n(n).a},function(t,e,o){"use strict";var n=o(6);o.n(n).a},function(t,e,o){"use strict";var n=o(7);o.n(n).a},function(t,e,o){"use strict";var n=o(8);o.n(n).a},function(t,e,o){"use strict";var n=o(9);o.n(n).a},function(t,e,o){"use strict";var n=o(10);o.n(n).a},function(t,e,o){"use strict";var n=o(11);o.n(n).a},function(t,e,o){"use strict";var n=o(12);o.n(n).a},function(t,e,o){"use strict";var n=o(13);o.n(n).a},function(t,e,o){"use strict";var n=o(14);o.n(n).a},function(t,e,o){"use strict";var n=o(15);o.n(n).a},function(t,e,o){"use strict";var n=o(16);o.n(n).a},function(t,e,o){"use strict";var n=o(17);o.n(n).a},function(t,e,o){"use strict";var n=o(18);o.n(n).a},function(t,e,o){"use strict";var n=o(19);o.n(n).a},function(t,e,o){},function(t,e,o){"use strict";o.r(e);var n={};o.r(n),o.d(n,"generateDsmFqdnRulesByValidator",function(){return S}),o.d(n,"generateApplicationFqdnRulesByValidator",function(){return $}),o.d(n,"generateDsmPortRulesByValidator",function(){return k}),o.d(n,"generateApplicationPortRulesByValidator",function(){return C}),o.d(n,"generateAliasRulesByValidator",function(){return P}),o.d(n,"generateAccessControlNameRules",function(){return A}),o.d(n,"accessControlCidrRules",function(){return D});var i=o(0),r=o.n(i),s={created(){this.SYNO=window.SYNO},methods:{_TT(t,e,o){try{return SYNO.SDS.Strings[t][e][o]}catch(t){return""}},_JSLIBSTR(t,e){try{return SYNOJSLIB_Strings[t][e]}catch(t){return""}}}},a={props:{applicationId:{type:String,required:!0},profile:{type:Object,required:!0},onlyShowCustom:{type:Boolean,default:!1},forceBackgroundImage:{type:String}},mounted(){this.$watch("backgroundImage",this.getBackgroundSize,{immediate:!0})},computed:{isRetina:()=>SYNO.SDS.UIFeatures.IconSizeManager.isRetinaMode(),resolution(){return this.isRetina?"2x":"1x"},appFnMapConfig(){return SYNO.SDS.Config.FnMap[this.applicationId].config},needBackgroundSize(){return["center","tile"].includes(this.profile.background_position)},defaultBackgroundImage(){return"dsm"===this.applicationId?`webman/resources/images/${this.resolution}/default_login_background/dsm7_01.jpg`:`${this.appFnMapConfig.jsBaseURL}/${this.appFnMapConfig.loginStyle.defaultLoginWallpaper.replace("{0}","1x")}`},customBackgroundImage(){if(this.profile.only_background_color)return"";if(this.forceBackgroundImage)return this.forceBackgroundImage;if("dsm"===this.applicationId&&this.profile.background_seq||"dsm"!==this.applicationId&&this.profile.login_background_seq){const t={api:"SYNO.Core.Theme.Image",version:1,method:"get",params:{type:"login_background",data:this.profile.background_seq,..."dsm"!==this.applicationId?{app:this.applicationId}:{}}};return`${SYNO.API.GetBaseURL(t)}&_v=${Date.now()}`}return this.defaultBackgroundImage},previewBackgroundImage(){return this.profile.from_dsm||!this.profile.enable_background_customize&&!this.profile.only_background_color?this.defaultBackgroundImage:this.customBackgroundImage},backgroundImage(){return this.onlyShowCustom?this.customBackgroundImage:this.previewBackgroundImage}},data:()=>({backgroundSize:[0,0]}),methods:{async getBackgroundNativeSize(){if(!this.backgroundImage)return[0,0];const t=new Image;return t.src=this.backgroundImage,await new Promise(e=>t.addEventListener("load",e)),[t.width,t.height]},async getBackgroundSize(){const t=await this.getBackgroundNativeSize();this.backgroundSize=[154*t[0]/screen.width,96*t[1]/screen.height]}}};function l(t,e,o,n,i,r,s,a){var l,p="function"==typeof t?t.options:t;if(e&&(p.render=e,p.staticRenderFns=o,p._compiled=!0),n&&(p.functional=!0),r&&(p._scopeId="data-v-"+r),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},p._ssrRegister=l):i&&(l=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),l)if(p.functional){p._injectStyles=l;var c=p.render;p.render=function(t,e){return l.call(e),c(t,e)}}else{var d=p.beforeCreate;p.beforeCreate=d?[].concat(d,l):[l]}return{exports:t,options:p}}o(21);var p=l(a,function(){var t=this.$createElement;return(this._self._c||t)("div",{class:["preview-image","preview-image--"+this.profile.background_position],style:{"background-image":"url('"+this.backgroundImage+"')","background-color":this.profile.background_color,"background-size":this.needBackgroundSize?this.backgroundSize[0]+"px "+this.backgroundSize[1]+"px":void 0}})},[],!1,null,"1ae35974",null).exports;async function c(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal",version:2,method:"list",params:t})}async function d(t="dsm"){const e="dsm"===t?{api:"SYNO.Core.Theme.Login",version:1,method:"get"}:{api:"SYNO.Core.Theme.AppPortalLogin",version:1,method:"get",params:{app:t}};return{login_title:"",login_welcome_title:"",login_welcome_msg:"",login_footer_msg:"",...await synowebapi.promises.request(e)}}async function u(){return await synowebapi.promises.request({api:"SYNO.Core.Web.DSM",version:2,method:"get"})}async function m(){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.ReverseProxy",method:"list",version:1})}async function f(){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.AccessControl",version:1,method:"list"})}var h={components:{BackgroundPreview:p},props:{applicationId:{type:String,required:!0},profile:{type:Object,required:!0}},computed:{isRetina:()=>SYNO.SDS.UIFeatures.IconSizeManager.isRetinaMode(),resolution(){return this.isRetina?"2x":"1x"},appConf(){const t=SYNO.SDS.Config.FnMap[this.applicationId];return t&&t.config||{}},maskPath(){if("dsm"===this.applicationId)return SYNO.SDS.UIFeatures.IconSizeManager.getIconPath("webman/modules/AdminCenter/images/{1}/login_portal/login_ui/img_loginui_dsm.png");if(!(this.appConf&&this.appConf.jsBaseURL&&this.appConf.loginStyle&&this.appConf.loginStyle.loginPreviewThumbnailMaskPath))return null;const t=this.appConf.loginStyle.loginPreviewThumbnailMaskPath.replace("{0}",this.resolution);return`${this.appConf.jsBaseURL}/${t}`},iconPath(){return"dsm"===this.applicationId?SYNO.SDS.UIFeatures.IconSizeManager.getIconPath("webman/modules/AdminCenter/images/{1}/login_portal/pkg_icn/dsm.png"):this.appConf&&this.appConf.jsBaseURL?this.appConf.loginIcon?SYNO.SDS.UIFeatures.IconSizeManager.getIconPath(`${this.appConf.jsBaseURL}/${this.appConf.loginIcon}`,"Header"):this.appConf.icon?SYNO.SDS.UIFeatures.IconSizeManager.getIconPath(`${this.appConf.jsBaseURL}/${this.appConf.icon}`,"Header"):null:null}}},_=(o(22),l(h,function(){var t=this.$createElement,e=this._self._c||t;return e("section",{staticClass:"login-style-preview"},[e("background-preview",{staticClass:"login-style-preview__cover",attrs:{"application-id":this.applicationId,profile:this.profile}}),this._v(" "),e("img",{staticClass:"login-style-preview__cover",attrs:{src:this.maskPath,draggable:"false"}}),this._v(" "),e("img",{staticClass:"login-style-preview__icon",attrs:{src:this.iconPath,draggable:"false"}})],1)},[],!1,null,"0e423bb4",null)),y=l({components:{LoginStylePreview:_.exports},props:{applicationId:{type:String,required:!0}},mounted(){this.load()},data:()=>({profile:{}}),methods:{async load(){this.profile=await d(this.applicationId)}}},function(){var t=this.$createElement;return(this._self._c||t)("login-style-preview",{attrs:{"application-id":this.applicationId,profile:this.profile}})},[],!1,null,null,null).exports,g={computed:{Ext:()=>Ext},async mounted(){this.updateAppWindow()},methods:{updateAppWindow(){this.$root._$extPanel&&(this.$appWindow=this.$root._$extPanel.findAppWindow(),this.$window=this.$appWindow),this.$root.$children[0]&&this.$root.$children[0].$children[0]&&"ModalWindow"===this.$root.$children[0].$children[0].$options.name&&(this.$window=this.$root.$children[0].$children[0],this.$appWindow=this.getAppWindow())},getAppWindow(){return function t(e){return e?e._isVue&&"AppWindow"===e.$options.name?e:e._isVue?t(e._isVue?e.$options.owner:e.owner):e.findAppWindow():null}(this.$window)},close(){this.$window.close()}}};SYNO.SDS.UIFeatures.IconSizeManager.isRetinaMode();var v={components:{ApplicationPreview:y},mixins:[g],props:{applicationId:{type:String,required:!0},applicationDisplayName:{type:String,required:!0}},methods:{openEditLoginStyle(){const{component:t,window:e}=((...t)=>this.$window._isVue?this.$window.openWindow(...t):this.$window.openVueWindow(...t))(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.LoginStyleEditor_vue);t.$children[0].$data.applicationId=this.applicationId,t.$children[0].$data.applicationDisplayName=this.applicationDisplayName,e.$on("close",()=>{this.$refs.preview.load()})}}},b=(o(23),l(v,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-form-multiple-item",{attrs:{"syno-id":"syno-lp-form-item-edit-style","hide-label":"",prop:"p-lp-login-style"}},[o("application-preview",{ref:"preview",attrs:{"application-id":t.applicationId}}),t._v(" "),o("v-button",{staticClass:"ac-lp-edit-style-btn",attrs:{"syno-id":"syno-lp-button-edit-style"},on:{click:function(){return t.openEditLoginStyle()}}},[t._v("\n "+t._s(t.$i18n("controlpanel","edit_login_style"))+"\n ")])],1)},[],!1,null,null,null).exports),w={filters:{colon:t=>`${t}${_T("common","colon")}`}},x={mixins:[g],data:()=>({dataProperty:"data",spinner:{isLoading:!1,loadingType:null,showStatusBar:!1,statusBarState:null,errorText:""}}),methods:{async onApply(){return this.onLoading(),await this._validate()?await new Promise(t=>{this.$emit("apply",this[this.dataProperty],async()=>{this._commit(),this.onDone(),t(!0)},async(...e)=>{this.onError(...e),t(!1)})}):(this.onDone(),!1)},async onCancel(){this.$emit("cancel")},async beforeClose(){if(!this._isDirty())return!0;const t=await this.openConfirmer();return"save"===t?await this.onApply():"dont_save"===t},async openConfirmer(){this.updateAppWindow();let t=Promise.resolve();return t=this.$window._isVue?this.$window.getMsgBox().confirmLostChange():new Promise(t=>{this.$window.getMsgBox().confirm("",this.$i18n("common","confirm_lostchange"),e=>{switch(e){case"yes":t("save");break;case"no":t("cancel");break;default:t("dont_save")}},this.$window,{yes:this.$i18n("common","save"),no:this.$i18n("common","cancel"),leftCustom:this.$i18n("common","dont_save")})}),await t},_commit(){return(this.commit||this.$refs.form&&this.$refs.form.commit||(()=>{}))()},async _validate(){const t=this.validate||this.$refs.form&&this.$refs.form.validate||(()=>!0);return await t()},_isDirty(){return(this.isDirty||this.$refs.form&&this.$refs.form.isDirty||(()=>!1))()},onReset(){this.$refs.form.resetFields()},onLoading(){this.spinner.isLoading=!0,this.spinner.loadingType="statusbar",this.spinner.showStatusBar=!0,this.spinner.statusBarState="loading",this._onLoading&&this._onLoading()},onDone(){this.spinner.isLoading=!1,this.spinner.loadingType=null,this.spinner.statusBarState=null},onError(t){this.spinner.errorText="string"==typeof t?t:SYNO.API.getErrorString(t),this.spinner.isLoading=!1,this.spinner.loadingType="statusbar",this.spinner.showStatusBar=!0,this.spinner.statusBarState="error",this._onError&&this._onError(t)}}};const S=t=>[{type:"string",required:!0,asyncValidator:async(e,o)=>{if(!await t.validateDsm(o,80))throw _T("app_port_alias","err_fqdn_duplicated");if(!await t.validateDsm(o,443))throw _T("app_port_alias","err_fqdn_duplicated")}}],$=t=>[{type:"string",required:!0,asyncValidator:async(e,o)=>{if(!await t.validateAppPortal(o,80))throw _T("app_port_alias","err_fqdn_duplicated");if(!await t.validateAppPortal(o,443))throw _T("app_port_alias","err_fqdn_duplicated")}}],k=t=>(e="")=>[{type:"string",required:!0,asyncValidator:async(t,o)=>{if(!Ext.form.VTypes.port(o))throw Ext.form.VTypes.portText;if(o===e)throw _T("error","error_port_conflict")}},{asyncValidator:async(e,o)=>{await t.validate(o)}}],C=t=>(e="")=>[{type:"string",asyncValidator:async(t,o)=>{if(o){if(!Ext.form.VTypes.port(o))throw Ext.form.VTypes.portText;if(+o==+e)throw _T("app_port_alias","err_port_dup")}}},{asyncValidator:async(e,o)=>{await t.validate(o)}}],P=t=>[{type:"string",asyncValidator:async(e,o)=>{o&&await t.validate(o)}}],A=(t=[])=>[{type:"string",required:!0,asyncValidator:async(e,o)=>{if(""===o)throw" ";if(t.some(t=>t===o))throw _T("app_port_alias","err_profile_dup")}}],D=[{type:"string",asyncValidator:async(t,e)=>{if(e&&!Ext.form.VTypes.cidr(e))throw _T("app_port_alias","err_bad_source_ip_or_cidr")}}];class I{constructor(t="dsm"){this.applicationId=t,this.portals=[],this.preserves=[],this.promise=Promise.resolve(),this.fetchApplications()}async validate(t=""){await this.promise;const e=parseInt(t,10);return"dsm"===this.applicationId?this.validateDsm(e):this.validateApplication(e)}async validateDsm(t=0){if(SYNO.SDS.Utils.isReservedPort(this.applicationId,t,t))throw _T("ftp","ftp_port_in_used");if(SYNO.SDS.Utils.isBrowserReservedPort(t,t))throw _T("common","err_browser_reserved_ports");return!0}async validateApplication(t=0){await this.promise;const e=SYNO.SDS.AdminCenter.LoginPortal.Utils.getPortNameByServiceName(this.applicationId);if(SYNO.SDS.Utils.isReservedPort(e,t,t))throw _T("app_port_alias","err_port_reserved");if(SYNO.SDS.Utils.isBrowserReservedPort(t,t))throw _T("common","err_browser_reserved_ports");if(this.preserves.filter(t=>t.id!==this.applicationId).some(e=>e.http_port===t||e.https_port===t))throw _T("app_port_alias","err_port_reserved");if(this.portals.filter(t=>t.id!==this.applicationId).some(e=>e.http_port===t||e.https_port===t))throw _T("app_port_alias","err_port_used")}async fetchApplications(){this.promise=c({additional:["default_setting"]});const{portal:t=[]}=await this.promise;this.portals=t,this.preserves=this.portals.map(t=>{const e=t&&t.additional&&t.additional.default_setting;return{id:t.id,...e}}).filter(t=>t.http_port||t.https_port)}}class q{constructor(){this.entries=[],this.promise=Promise.resolve(),this.load()}async validateFrontendPort(t={}){await this.promise;const e=/^(localhost|127\.0\.0\.1|0\.0\.0\.0|::1|0:0:0:0:0:0:0:1)$/i;if(!t.frontend.fqdn||"*"===t.frontend.fqdn||e.exec(t.frontend.fqdn)){if(80==+t.frontend.port||443==+t.frontend.port)throw _T("app_port_alias","err_port_reserved");if(this.entries.filter(e=>e.UUID!==t.UUID).some(e=>+e.frontend.port==+t.frontend.port))throw _T("app_port_alias","err_port_used");if(SYNO.SDS.Utils.isReservedPort("www",+t.frontend.port,+t.frontend.port))throw _T("app_port_alias","err_port_reserved");if(e.exec(t.backend.fqdn)&&+t.frontend.port==+t.backend.port)throw _T("app_port_alias","err_port_used")}if(SYNO.SDS.Utils.isBrowserReservedPort(+t.frontend.port,+t.frontend.port))throw _T("common","err_browser_reserved_ports");if(this.entries.filter(e=>e.UUID!==t.UUID).filter(t=>t.frontend.fqdn).some(e=>e.frontend.fqdn&&t.frontend.fqdn&&e.frontend.fqdn.toLowerCase()===t.frontend.fqdn.toLowerCase()&&+e.frontend.port==+t.frontend.port))throw _T("app_port_alias","err_frontend_duplicated");return!0}async validateBackendPort(t={}){if(!t.backend.port)return _JSLIBSTR("extlang","fieldblank");if(t.frontend.fqdn&&t.backend.fqdn&&t.frontend.fqdn.toLowerCase()===t.backend.fqdn.toLowerCase()&&+t.frontend.port==+t.backend.port)throw _T("app_port_alias","err_backend_duplicated");return!0}async load(){this.promise=m();const{entries:t=[]}=await this.promise;this.entries=t}}class O{constructor(t=""){this.applicationId=t,this.preserves=[],this.portals=[],this.promise=Promise.resolve(),this.fetchApplications()}async fetchApplications(){this.promise=c({additional:["default_setting"]});const{portal:t=[]}=await this.promise;this.portals=t,this.preserves=this.portals.map(t=>{const e=t&&t.additional&&t.additional.default_setting;return{id:t.id,...e}}).filter(t=>t.alias)}async validate(t=""){if(!Ext.form.VTypes.aliasname(t))throw _T("controlpanel","bad_alias_detail");if(await this.promise,this.preserves.filter(t=>t.id!==this.applicationId).some(e=>e.alias===t))throw _T("app_port_alias","err_alias_refused");if(this.portals.filter(t=>t.id!==this.applicationId).some(e=>e.alias===t))throw _T("app_port_alias","err_alias_used")}}function T(t){return{asyncValidator:async()=>{if(t)throw t}}}function N(t){return{asyncValidator:async(e,o)=>{if(!Ext.form.VTypes[t](o))throw Ext.form.VTypes[`${t}Text`]}}}class E{constructor(t="dsm"){this.fqdnPairs=[],this.applicationId=t,this.promise=Promise.resolve(),this.load()}async validate(t="",e=0,o={}){await this.promise;const{skips:n=[]}=o;return this.fqdnPairs.filter(t=>!n.includes(t.type)).every(o=>o.fqdn!==t||o.port!==e)}async validateDsm(t="",e=0){return await this.validate(t,e,{skips:["dsm"]})}async validateAppPortal(t="",e=0){return await this.validate(t,e,{skips:["app-portal"]})&&this.fqdnPairs.filter(t=>"app-portal"===t.type).filter(t=>t.id!==this.applicationId).every(o=>o.fqdn!==t||o.port!==e)}async validateFrontendReverseProxy(t={}){if(!await this.validate(t.frontend.fqdn,+t.frontend.port,{skips:["reverse-proxy"]}))throw _T("app_port_alias","err_fqdn_duplicated")}async load(){return this.promise=Promise.all([this.loadFqdnPairsByDSM(),this.loadFqdnPairsByAppPortals(),this.loadFqdnPairsByReverseProxy(),this.loadFqdnPairsByVHost()]),await this.promise}async loadFqdnPairsByDSM(){const{fqdn:t}=await u();t&&(this.fqdnPairs.push({type:"dsm",fqdn:t,port:80}),this.fqdnPairs.push({type:"dsm",fqdn:t,port:443}))}async loadFqdnPairsByAppPortals(){const{portal:t=[]}=await c(),e=t.reduce((t,e)=>e.fqdn?[...t,{type:"app-portal",id:e.id,fqdn:e.fqdn.toLowerCase(),port:80},{type:"app-portal",id:e.id,fqdn:e.fqdn.toLowerCase(),port:443}]:t,[]);this.fqdnPairs=this.fqdnPairs.concat(e)}async loadFqdnPairsByReverseProxy(){const{entries:t=[]}=await m(),e=t.reduce((t,e)=>{if(!(e.frontend&&e.frontend.fqdn&&e.frontend.port))return t;const{fqdn:o,port:n}=e.frontend;return[...t,{type:"reverse-proxy",fqdn:o.toLowerCase(),port:n}]},[]);this.fqdnPairs=this.fqdnPairs.concat(e)}async loadFqdnPairsByVHost(){const{hosts:t=[]}=await async function(){return SYNO.API.GetKnownAPI("SYNO.WebStation.HTTP.VHost")?await synowebapi.promises.request({api:"SYNO.WebStation.HTTP.VHost",method:"list",version:1}):{}}(),e=t.flatMap(t=>{if(!t.fqdn)return[];const e=t.fqdn.toLowerCase(),{http:o=[],https:n=[]}=t.port;return[...o,...n].map(t=>({type:"vhost",fqdn:e,port:t}))});this.fqdnPairs=this.fqdnPairs.concat(e)}}var R={components:{vFormItemLoginStyle:b},mixins:[g,w,x,s],props:{inModal:{type:Boolean,default:!1},applicationId:{type:String,required:!0},settings:{type:Object,required:!0}},mounted(){this.onLoading(),this.$watch("settings",()=>{for(let t in this.settings)this.$set(this.currentSettings,t,this.settings[t]);this.form.enable_hsts=this.currentSettings.enable_hsts||this.currentSettings.hsts,this.onDone()},{deep:!0}),this.$watch("currentSettings.fqdn",()=>{this.currentSettings.enable_custom_domain=!!this.currentSettings.fqdn,this.$forceUpdate()}),this.$watch("currentSettings.fqdn",()=>{""===this.currentSettings.fqdn&&(this.currentSettings.fqdn=null)}),this.$watch("currentSettings.alias",()=>{""===this.currentSettings.alias&&(this.currentSettings.alias=null)}),this.$watch("currentSettings.http_port",()=>{this.currentSettings.http_port=this.currentSettings.http_port?parseInt(this.currentSettings.http_port,10):null}),this.$watch("currentSettings.https_port",()=>{this.currentSettings.https_port=this.currentSettings.https_port?parseInt(this.currentSettings.https_port,10):null}),this.$watch("currentSettings.enable_custom_domain",()=>{this.currentSettings.enable_custom_domain?("hsts"in this.currentSettings&&(this.currentSettings.hsts=this.form.enable_hsts),"enable_hsts"in this.currentSettings&&(this.currentSettings.enable_hsts=this.form.enable_hsts)):("hsts"in this.currentSettings&&(this.currentSettings.hsts=!1),"enable_hsts"in this.currentSettings&&(this.currentSettings.enable_hsts=!1))}),this.$watch("form.enable_hsts",()=>{"hsts"in this.currentSettings&&(this.currentSettings.hsts=this.form.enable_hsts),"enable_hsts"in this.currentSettings&&(this.currentSettings.enable_hsts=this.form.enable_hsts)})},computed:{defaultSettings(){return this.currentSettings.additional&&this.currentSettings.additional.default_setting||{}},dsmFqdnRules(){return S(this.fqdnValidator)},httpPortRules(){return k(this.portValidator)(this.currentSettings.https_port)},httpsPortRules(){return k(this.portValidator)(this.currentSettings.http_port)}},data:()=>({dataProperty:"currentSettings",currentSettings:{additional:{default_setting:{}},enable_custom_domain:!1},form:{enable_hsts:!1},fqdnValidator:new E("dsm"),portValidator:new I("dsm")}),methods:{_onLoading(){this.$emit("loading")},_onError(t){this.$emit("error",t)}}},B=(o(24),l(R,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{class:{"ac-lp-login-editor__panel":!0,"ac-lp-login-editor__panel--modal":t.inModal},attrs:{"syno-id":"syno-lp-panel-application-editor",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,"confirm-text":t.$i18n("common","save"),"cancel-text":t.inModal?void 0:t.$i18n("common","reset"),confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"scroll-body",fn:function(){return[o("v-form",{ref:"form",staticClass:"lp-modal-content--bottom-padding",attrs:{"syno-id":"syno-lp-le-form",model:t.currentSettings}},[o("v-fieldset",{staticClass:"ac-lp-login-editor__login-style-fieldset",attrs:{"syno-id":"syno-lp-le-fieldset-style",title:t.$i18n("controlpanel","login_style_label")}},[o("v-form-item-login-style",{ref:"loginStyle",attrs:{"application-id":t.applicationId,"application-display-name":t.currentSettings.display_name||""}})],1),t._v(" "),o("v-fieldset",{attrs:{"syno-id":"syno-lp-le-fieldset-web-service",title:t.$i18n("controlpanel","web_service")}},[t._t("web-service",[o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-le-form-item-http",label:t._f("colon")(t.$i18n("controlpanel","dsm_port_http")),prop:"p-lp-le-http",rules:t.httpPortRules}},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"number-only":"",name:"p-lp-le-http","syno-id":"syno-lp-le-input-http",mask:function(t){return t.substr(0,5)}},model:{value:t.currentSettings.http_port,callback:function(e){t.$set(t.currentSettings,"http_port",e)},expression:"currentSettings.http_port"}})],1),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-le-form-item-https",label:t._f("colon")(t.$i18n("controlpanel","dsm_port_https")),prop:"p-lp-le-https",rules:t.httpsPortRules}},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"number-only":"",name:"p-lp-le-https","syno-id":"syno-lp-le-input-https",mask:function(t){return t.substr(0,5)}},model:{value:t.currentSettings.https_port,callback:function(e){t.$set(t.currentSettings,"https_port",e)},expression:"currentSettings.https_port"}})],1)],{settings:t.currentSettings,defaultSettings:t.defaultSettings}),t._v(" "),t._t("post-web-service",null,{settings:t.currentSettings,defaultSettings:t.defaultSettings})],2),t._v(" "),o("v-fieldset",{attrs:{"syno-id":"syno-lp-le-fieldset-domain",title:t.$i18n("app_port_alias","desc_domain")}},[t._t("domain",[o("v-form-item",{attrs:{"syno-id":"syno-lp-le-form-item-domain-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("controlpanel","dsm_domain_desc"))+"\n ")]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-le-form-item-domain",label:""+t.$i18n("controlpanel","customized_domain")+t.$i18n("common","colon"),prop:"p-lp-domain",rules:t.dsmFqdnRules},scopedSlots:t._u([{key:"after",fn:function(){return[o("v-whitetip",{attrs:{"syno-id":"syno-lp-le-whitetip-hsts",content:t.$i18n("service","tip_dsm_fqdn_NetBIOS")}})]},proxy:!0}])},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"syno-id":"syno-lp-le-input-domain",name:"p-lp-domain"},model:{value:t.currentSettings.fqdn,callback:function(e){t.$set(t.currentSettings,"fqdn",e)},expression:"currentSettings.fqdn"}})],1),t._v(" "),o("v-form-item",{attrs:{"syno-id":"syno-lp-le-form-item-hsts","hide-label":"",prop:"p-lp-hsts"}},[o("v-checkbox",{attrs:{"syno-id":"syno-lp-le-checkbox-hsts",name:"p-lp-hsts",disabled:!t.currentSettings.enable_custom_domain},model:{value:t.form.enable_hsts,callback:function(e){t.$set(t.form,"enable_hsts",e)},expression:"form.enable_hsts"}},[t._v("\n "+t._s(t.$i18n("service","enable_hsts_desc"))+"\n ")])],1)],{settings:t.currentSettings,defaultSettings:t.defaultSettings,form:t.form})],2),t._v(" "),t._t("post-fieldsets",null,{settings:t.currentSettings,defaultSettings:t.defaultSettings})],2)]},proxy:!0}],null,!0)})},[],!1,null,null,null).exports),L={components:{CommonLoginEditor:B},mixins:[g],mounted(){this.load()},data:()=>({dsmSettings:{}}),computed:{stringGotoCertificate(){return this.$i18n("certificate","goto_certificate")},stringGotoCertificateFront(){return this.stringGotoCertificate.split("{0}").reduce(t=>t)},stringGotoCertificateEnd(){return this.stringGotoCertificate.split("{0}").reduce((t,e)=>e)}},methods:{async load(){this.$refs.loginEditor.onLoading(),await this.$nextTick(),[this.dsmSettings]=await Promise.all([u(),this.$refs.loginEditor.$refs.loginStyle.$refs.preview.load()]),await this.$nextTick(),this.$refs.loginEditor.$refs.form.commit(),this.$refs.loginEditor.onDone()},gotoCertificatePage(){this.$appWindow.startModule("SYNO.SDS.AdminCenter.Security.Main",{tab:"CertificateTab"})},onCancel(){this.$refs.loginEditor.onReset()},async updateDSMSettings(t={},e,o){if(!this.$refs.loginEditor._isDirty())return o(this.$i18n("error","nochange_subject"));try{const o=await async function(t={}){const e=JSON.parse(JSON.stringify(t));return e.http_port=parseInt(e.http_port,10),e.https_port=parseInt(e.https_port,10),await synowebapi.promises.request({api:"SYNO.Core.Web.DSM",version:2,method:"set",params:e})}(t);e(),this.redirectOrRestart(o&&o.redirect_url),this.load()}catch(t){o(t)}},async redirectOrRestart(t=""){const e=!this.$appWindow.IsAllowRelay()||this.$appWindow.getOpenConfig("cms_self");if(!t||!e)return await new Promise(t=>{SYNO.SDS.AdminCenter.Utils.WaitHttpdRestart(this.$appWindow,t)()}),void(this.$appWindow.IsAllowRelay()&&this.$appWindow.close());const o=t.replace("://127.0.0.1",`://${this.$appWindow.getDsmHost()}`);this.maskDSMWithMessageBox(this.$i18n("service","restart_apache")),await new Promise(t=>setTimeout(t,3e4)),this.maskDSMWithMessageBox(this.$i18n("tcpip","connect_new_ip")),SYNO.SDS.UserSettings.unregisterUnloadEvent(),window.location.href=o},maskDSMWithMessageBox(t=""){this.dsmMessageBox&&!this.dsmMessageBox.isDestroyed||(this.dsmMessageBox=new SYNO.SDS.MessageBoxV5({modal:!0,draggable:!1,renderTo:document.body})),this.dsmMessageBox.getWrapper().show({msg:t||this.$i18n("common","msg_waiting")})}}},Y=(o(25),{components:{DsmLoginEditor:l(L,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("common-login-editor",{ref:"loginEditor",attrs:{"application-id":"dsm",settings:t.dsmSettings},on:{apply:t.updateDSMSettings,cancel:t.onCancel},scopedSlots:t._u([{key:"post-web-service",fn:function(e){var n=e.settings;return[o("v-form-item",{attrs:{"syno-id":"syno-lp-dsm-form-item-redirect","hide-label":"",prop:"p-lp-dsm-redirect"}},[o("v-checkbox",{attrs:{"syno-id":"syno-lp-dsm-checkbox-redirect"},model:{value:n.enable_https_redirect,callback:function(e){t.$set(n,"enable_https_redirect",e)},expression:"currentSettings.enable_https_redirect"}},[t._v("\n "+t._s(t.$i18n("service","redirect_secureui"))+"\n ")])],1),t._v(" "),o("v-form-item",{attrs:{"syno-id":"syno-lp-dsm-form-item-certificate","hide-label":"",textonly:""}},[o("span",{staticClass:"ac-lp-text-note"},[t._v(t._s(t.$i18n("common","note"))+t._s(t.$i18n("common","colon")))]),t._v("\n "+t._s(t.stringGotoCertificateFront)+"\n "),o("a",{staticClass:"ac-lp-link",on:{click:t.gotoCertificatePage}},[t._v(t._s(t.$i18n("certificate","certificate")))]),t._v("\n "+t._s(t.stringGotoCertificateEnd)+"\n ")])]}}])})},[],!1,null,"1d37055f",null).exports},methods:{load(){this.$refs.dsmEditor.load()},isDirty(){return this.$refs.dsmEditor.$refs.loginEditor._isDirty()},onApply(){this.$refs.dsmEditor.$refs.loginEditor.onApply()},onCancel(){this.$refs.dsmEditor.$refs.loginEditor.onReset()}}}),M=(o(26),l(Y,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"lp-tab--dsm"},[e("dsm-login-editor",{ref:"dsmEditor"})],1)},[],!1,null,null,null).exports),H={mixins:[g],mounted(){const t=this.$appWindow.IsAllowRelay(),e=t?this.$appWindow.getDsmHost():window.location.hostname,o=t?this.$appWindow.getDsmHttpPort():window.location.port;this.linkMaker=SYNO.SDS.AdminCenter.LoginPortal.Utils.LinkMaker(!0,!0,t,e,o)},data:()=>({linkMaker:()=>{}}),methods:{generateAliasHref(t=""){return this.linkMaker(!1,!0,!1,!0,t,!1)},generateHttpPortHref(t=""){return this.linkMaker(!1,!1,!0,!0,t,!0)},generateHttpsPortHref(t=""){return this.linkMaker(!1,!1,!1,!0,t,!0)},generateFqdnHref:(t="")=>SYNO.SDS.AdminCenter.LoginPortal.Utils.FQDNLinkMaker2(t)}},F={mixins:[H],props:{application:{type:Object,required:!0}},computed:{isQuickConnectTunnel:()=>SYNO.SDS.QuickConnect.Utils.isInTunnel(),fqdnLink(){return this.generateFqdnHref(this.application.fqdn)},httpLink(){return this.generateHttpPortHref(this.application.http_port)},httpsLink(){return this.generateHttpsPortHref(this.application.https_port)},aliasLink(){return this.generateAliasHref(this.application.alias)}}},V=(o(27),{components:{ApplicationPreview:y,ApplicationInformation:l(F,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"lp-applications-information"},[o("div",{staticClass:"lp-applications-information__row lp-applications-information__row--title"},[t._v(t._s(t.application.display_name))]),t._v(" "),o("div",{staticClass:"lp-applications-information__row"},[o("span",{staticClass:"lp-applications-information__row__label"},[t._v(t._s(t.$i18n("app_port_alias","desc_domain"))+t._s(t.$i18n("common","colon")))]),t._v(" "),o("span",{staticClass:"lp-applications-information__row__field"},[!t.isQuickConnectTunnel&&t.application.fqdn?o("a",{attrs:{href:t.fqdnLink,target:"_blank"}},[t._v(t._s(t.application.fqdn))]):t.application.fqdn?o("span",[t._v(t._s(t.application.fqdn))]):o("span",[t._v("-")])])]),t._v(" "),o("div",{staticClass:"lp-applications-information__row"},[o("span",{staticClass:"lp-applications-information__row__label"},[t._v("Http / Https"+t._s(t.$i18n("common","colon")))]),t._v(" "),o("span",{staticClass:"lp-applications-information__row__field"},[!t.isQuickConnectTunnel&&t.application.http_port?o("a",{attrs:{href:t.httpLink,target:"_blank"}},[t._v(t._s(t.application.http_port))]):t.application.http_port?o("span",[t._v(t._s(t.application.http_port))]):o("span",[t._v("-")]),t._v(" "),o("span",[t._v("/")]),t._v(" "),!t.isQuickConnectTunnel&&t.application.https_port?o("a",{attrs:{href:t.httpsLink,target:"_blank"}},[t._v(t._s(t.application.https_port))]):t.application.https_port?o("span",[t._v(t._s(t.application.https_port))]):o("span",[t._v("-")])])]),t._v(" "),o("div",{staticClass:"lp-applications-information__row"},[o("span",{staticClass:"lp-applications-information__row__label"},[t._v(t._s(t.$i18n("app_port_alias","desc_alias"))+t._s(t.$i18n("common","colon")))]),t._v(" "),o("span",{staticClass:"lp-applications-information__row__field"},[t.application.alias?o("a",{attrs:{href:t.aliasLink,target:"_blank"}},[t._v(t._s(t.application.alias))]):o("span",[t._v("-")])])])])},[],!1,null,null,null).exports},props:{application:{type:Object,required:!0}},methods:{load(){[this.$refs.preview,this.$refs.information].forEach(t=>t.load&&t.load())}}}),U=(o(28),{components:{ApplicationItem:l(V,function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"application-item"},[e("application-preview",{ref:"preview",staticClass:"application-item__preview",attrs:{"application-id":this.application.id}}),this._v(" "),e("application-information",{ref:"information",staticClass:"application-item__information",attrs:{application:this.application}})],1)},[],!1,null,"760531c0",null).exports},mixins:[g,x],mounted(){this.load()},computed:{selectedApplicationId(){return this.applications[this.selectedIndex]&&this.applications[this.selectedIndex].id||null}},data:()=>({selectedIndex:null,applications:[]}),methods:{async load(){this.onLoading();const t=await c(),e=t&&t.portal||[];this.applications=e.filter(t=>SYNO.SDS.StatusNotifier.isAppEnabled(t.id)),this.applications.forEach((t,e)=>{this.$refs[`application-item-${e}`]&&this.$refs[`application-item-${e}`].load&&this.$refs[`application-item-${e}`].load()}),this.onDone()},openEditorDialog(){const t=this.applications.find(t=>t.id===this.selectedApplicationId);if(!t)return;const{component:e,window:o}=this.$appWindow.openVueWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.ApplicationEditor_vue);e.$children[0].$data.applicationId=t.id,e.$children[0].$data.applicationDisplayName=t.display_name,o.$on("close",()=>this.load())},openOptionsDialog(){this.$appWindow.openVueWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.Options_vue)},onApply(){this.load()},onCancel(){this.load()}}}),W=(o(29),l(U,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"lp-tab lp-applications-page"},[o("v-panel",{staticClass:"lp-tab__panel lp-applications-page__panel",attrs:{"syno-id":"syno-lp-panel-apps","has-tbar":"","has-fbar":!1,loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"tbar",fn:function(){return[o("v-button",{attrs:{"syno-id":"syno-lp-btn-apps-edit",disabled:!t.selectedApplicationId},on:{click:function(e){return t.openEditorDialog()}}},[t._v("\n "+t._s(t.$i18n("common","alt_edit"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-lp-btn-apps-edit"},on:{click:function(e){return t.openOptionsDialog()}}},[t._v("\n "+t._s(t.$i18n("common","webman_options"))+"\n ")])]},proxy:!0},{key:"body",fn:function(){return[o("v-data-view",{staticClass:"lp-applications-page__data-view",attrs:{"syno-id":"syno-dv-lp-apps",items:t.applications},on:{selectionchange:function(e){t.selectedIndex=e}},scopedSlots:t._u([{key:"item",fn:function(e){var n=e.item,i=e.index;return[o("div",{on:{dblclick:function(e){return t.openEditorDialog()}}},[o("application-item",{ref:"application-item-"+i,attrs:{application:n}})],1)]}}])})]},proxy:!0}])})],1)},[],!1,null,null,null).exports),z={mixins:[g,x],methods:{openReverseProxyDialog(){const{component:t,window:e}=this.$appWindow.openVueWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.ReverseProxy_vue)},openAclDialog(){const{component:t,window:e}=this.$appWindow.openVueWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.AccessControl_vue)}}},j=(o(30),l(z,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{staticClass:"lp-tab__panel lp-advanced-page__panel",attrs:{"syno-id":"syno-panel-lp-advanced","has-fbar":!1,loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"scroll-body",fn:function(){return[o("v-form",{attrs:{"syno-id":"syno-form-lp-adv"}},[o("v-fieldset",{staticClass:"lp-advanced-page__first-fieldset",attrs:{"syno-id":"syno-fieldset-lp-adv-reverse-proxy",title:t.$i18n("app_port_alias","title_reverse_proxy"),collapsible:!1}},[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-adv-reverse-proxy-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("controlpanel","reverse_proxy_desc"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-lp-adv-rp"},on:{click:function(e){return t.openReverseProxyDialog()}}},[t._v("\n "+t._s(t.$i18n("app_port_alias","title_reverse_proxy"))+"\n ")])],1),t._v(" "),o("v-fieldset",{attrs:{"syno-id":"syno-fieldset-lp-adv-acl",title:t.$i18n("app_port_alias","title_access_control"),collapsible:!1}},[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-adv-acl-desc","hide-label":"",textonly:""},scopedSlots:t._u([{key:"after",fn:function(){return[o("v-whitetip",{attrs:{"syno-id":"syno-lp-le-whitetip-http",content:t.$i18n("controlpanel","desc_acl_profile")}})]},proxy:!0}])},[t._v("\n "+t._s(t.$i18n("controlpanel","acl_desc"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-lp-adv-rp"},on:{click:function(e){return t.openAclDialog()}}},[t._v("\n "+t._s(t.$i18n("app_port_alias","title_access_control"))+"\n ")])],1)],1)]},proxy:!0}])})},[],!1,null,null,null)),K=l({components:{TabDsm:M,TabApplications:W,TabAdvanced:j.exports},computed:{hasFbar(){return"dsm"===this.tabKey}},data:()=>({tabKey:"dsm"}),methods:{load(t={}){[this.$refs.dsm,this.$refs.applications,this.$refs.advanced].forEach(t=>t.load&&t.load()),this.setTab(t.tab)},setTab(t=""){const e=["dsm","applications","advanced"].includes(t)?t:"dsm";this.tabKey=e},isDirty(){return["dsm","applications","advanced"].some(t=>{const e=this.$refs[t],o=e.isDirty&&e.isDirty()||!1;return o&&(this.tabKey=t),o})},onApply(){[this.$refs.dsm,this.$refs.applications,this.$refs.advanced].forEach(t=>t.onApply&&t.onApply())},onCancel(){this.$refs.dsm.onCancel()}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-tabs",{staticClass:"admin-center__login-portal",attrs:{"syno-id":"ac-lp-tabs","active-tab-key":t.tabKey,"has-fbar":!1,"cancel-text":t.$i18n("common","reset")},on:{change:function(e){t.tabKey=e}}},[o("v-tab-pane",{attrs:{"syno-id":"ac-lp-tab-dsm","tab-key":"dsm",tab:"DSM"}},[o("tab-dsm",{ref:"dsm"})],1),t._v(" "),o("v-tab-pane",{attrs:{"syno-id":"ac-lp-tab-dsm","tab-key":"applications",tab:t.$i18n("controlpanel","applications")}},[o("tab-applications",{ref:"applications"})],1),t._v(" "),o("v-tab-pane",{attrs:{"syno-id":"ac-lp-tab-dsm","tab-key":"advanced",tab:t.$i18n("controlpanel","advanced")}},[o("tab-advanced",{ref:"advanced"})],1)],1)},[],!1,null,null,null).exports,J={components:{CommonLoginEditor:B},mixins:[H,g,w],props:{inModal:{type:Boolean,default:!1},applicationId:{type:String,required:!0}},mounted(){this.fetchAppPortal(),this.fetchAccessControl()},computed:{isQuickConnectTunnel:()=>SYNO.SDS.QuickConnect.Utils.isInTunnel(),tipPrefix(){return`${this.$i18n("service","service_file_customized_tip")} ${this.$i18n("common","colon")} `},rules:()=>n,aliasRules(){return[{asyncValidator:async()=>{if(this.errors.alias)throw this.errors.alias}},...P(this.aliasValidator)]},httpPortRules(){return(t={})=>[{asyncValidator:async()=>{if(this.errors.httpPort)throw this.errors.httpPort}},...C(this.portValidator)(t.https_port)]},httpsPortRules(){return(t={})=>[{asyncValidator:async()=>{if(this.errors.httpsPort)throw this.errors.httpsPort}},...C(this.portValidator)(t.http_port)]},applicationFqdnRules(){return[{asyncValidator:async()=>{if(this.errors.fqdn)throw this.errors.fqdn}},{asyncValidator:async(t,e)=>{if(!Ext.form.VTypes.FQDN(e))throw Ext.form.VTypes.FQDNText}},...$(this.fqdnValidator)]},accessControlRules(){return[{asyncValidator:async(t,e)=>{if(!this.accessControlOptions.some(t=>t.value===e))throw this.$i18n("extlang","invalidText")}}]},accessControlOptions(){return[{label:this.$i18n("app_port_alias","not_configured"),value:null},...this.accessControls.map(t=>({label:t.name,value:t.UUID}))]}},data(){return{dataProperty:"settings",settings:{},accessControls:[],fqdnValidator:new E(this.applicationId),portValidator:new I(this.applicationId),aliasValidator:new O(this.applicationId),errors:{alias:"",httpPort:"",httpsPort:"",fqdn:""},isCreateAccessControlActive:!1}},methods:{async fetchAppPortal(){const t=await async function(t=""){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal",method:"get",version:2,params:{id:t,additional:["default_setting"]}})}(this.applicationId);this.settings={acl:null,fqdn:null,...t},await this.$nextTick(),this.$refs.loginEditor.$refs.form.commit()},async fetchAccessControl(){const t=await f();this.accessControls=t&&t.entries||[]},async openCreateDialog(){this.isCreateAccessControlActive=!1,this.$refs.select.closeDropdown(),this.updateAppWindow();const{component:t,window:e}=this.$window.openWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.CreateAccessControl_vue);e.$on("success",async t=>{await this.fetchAccessControl();const e=this.accessControls.find(e=>e.name===t.name);this.settings.acl=e.UUID||null})},emitApply(...t){this.$emit("apply",...t)},emitCancel(...t){this.$emit("cancel",...t)},_onLoading(){this.errors.alias="",this.errors.httpPort="",this.errors.httpsPort="",this.errors.fqdn=""},_onError(t){if(t&&t.code){switch(t.code){case 4103:this.errors.alias=SYNO.API.getErrorString(t);break;case 4105:this.errors.httpPort=SYNO.API.getErrorString(t);break;case 4106:this.errors.httpsPort=SYNO.API.getErrorString(t);break;case 4107:this.errors.fqdn=SYNO.API.getErrorString(t)}this.$refs.loginEditor.$refs.form.validate()}}}},Q=(o(31),l(J,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("common-login-editor",{ref:"loginEditor",staticClass:"ac-application-login-editor",attrs:{"in-modal":t.inModal,"application-id":t.applicationId,settings:t.settings},on:{apply:t.emitApply,cancel:t.emitCancel,loading:t._onLoading,error:t._onError},scopedSlots:t._u([{key:"web-service",fn:function(e){var n=e.settings,i=e.defaultSettings;return[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-ale-webservice-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("controlpanel","applications_web_service_desc"))+"\n ")]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-form-item-lp-ale-alias",prop:"p-lp-ale-alias",label:t._f("colon")(t.$i18n("app_port_alias","desc_alias")),rules:t.aliasRules}},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"syno-id":"syno-input-lp-ale-alias",name:"p-lp-ale-alias",placeholder:i.alias},model:{value:n.alias,callback:function(e){t.$set(n,"alias",e)},expression:"currentSettings.alias"}})],1),t._v(" "),o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:n.alias,expression:"currentSettings.alias"}],staticClass:"ac-lp-login-editor__form-item link-tip-wrapper",attrs:{"text-only":"","syno-id":"syno-form-item-lp-ale-alias-link"}},[o("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:""+t.generateAliasHref(n.alias),expression:"`${generateAliasHref(currentSettings.alias)}`"}],staticClass:"link-tip"},[t._v("\n "+t._s(t.tipPrefix)+"\n "),t.settings.alias===n.alias?o("a",{attrs:{href:t.generateAliasHref(n.alias),target:"_blank"}},[t._v("\n "+t._s(t.generateAliasHref(n.alias))+"\n ")]):o("span",[t._v("\n "+t._s(t.generateAliasHref(n.alias))+"\n ")])])]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-ale-form-item-http",label:t._f("colon")(t.$i18n("controlpanel","customized_port_http")),prop:"p-lp-ale-http",rules:t.httpPortRules(n)}},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"number-only":"",name:"p-lp-ale-http","syno-id":"syno-lp-ale-input-http",placeholder:i.http_port,mask:function(t){return t.substr(0,5)}},model:{value:n.http_port,callback:function(e){t.$set(n,"http_port",e)},expression:"currentSettings.http_port"}})],1),t._v(" "),t.isQuickConnectTunnel?t._e():o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:n.http_port,expression:"currentSettings.http_port"}],staticClass:"ac-lp-login-editor__form-item link-tip-wrapper",attrs:{"text-only":"","syno-id":"syno-form-item-lp-ale-http-link"}},[o("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:""+t.generateHttpPortHref(n.http_port),expression:"`${generateHttpPortHref(currentSettings.http_port)}`"}],staticClass:"link-tip"},[t._v("\n "+t._s(t.tipPrefix)+"\n "),""+t.settings.http_port==""+n.http_port?o("a",{attrs:{href:t.generateHttpPortHref(n.http_port),target:"_blank"}},[t._v("\n "+t._s(t.generateHttpPortHref(n.http_port))+"\n ")]):o("span",[t._v("\n "+t._s(t.generateHttpPortHref(n.http_port))+"\n ")])])]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-ale-form-item-https",label:t._f("colon")(t.$i18n("controlpanel","customized_port_https")),prop:"p-lp-ale-https",rules:t.httpsPortRules(n)}},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"number-only":"",name:"p-lp-ale-https","syno-id":"syno-lp-ale-input-https",placeholder:i.https_port,mask:function(t){return t.substr(0,5)}},model:{value:n.https_port,callback:function(e){t.$set(n,"https_port",e)},expression:"currentSettings.https_port"}})],1),t._v(" "),t.isQuickConnectTunnel?t._e():o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:n.https_port,expression:"currentSettings.https_port"}],staticClass:"ac-lp-login-editor__form-item lp-login-style-editor__form-item--last link-tip-wrapper",attrs:{"text-only":"","syno-id":"syno-form-item-lp-ale-https-link"}},[o("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:""+t.generateHttpsPortHref(n.https_port),expression:"`${generateHttpsPortHref(currentSettings.https_port)}`"}],staticClass:"link-tip"},[t._v("\n "+t._s(t.tipPrefix)+"\n "),""+t.settings.https_port==""+n.https_port?o("a",{attrs:{href:t.generateHttpsPortHref(n.https_port),target:"_blank"}},[t._v("\n "+t._s(t.generateHttpsPortHref(n.https_port))+"\n ")]):o("span",[t._v("\n "+t._s(t.generateHttpsPortHref(n.https_port))+"\n ")])])])]}},{key:"domain",fn:function(e){var n=e.settings,i=e.defaultSettings,r=e.form;return[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-ale-domain-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("controlpanel","applications_domain_desc"))+"\n ")]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-lp-ale-form-item-domain",label:t._f("colon")(t.$i18n("controlpanel","customized_domain")),prop:"p-lp-ale-domain",rules:t.applicationFqdnRules},scopedSlots:t._u([{key:"after",fn:function(){return[o("v-whitetip",{attrs:{"syno-id":"syno-lp-le-whitetip-hsts",content:t.$i18n("service","tip_dsm_fqdn_NetBIOS")}})]},proxy:!0}],null,!0)},[o("v-input",{staticClass:"ac-lp-login-editor__input",attrs:{"syno-id":"syno-lp-ale-input-domain",name:"p-lp-ale-domain",placeholder:i.fqdn},model:{value:n.fqdn,callback:function(e){t.$set(n,"fqdn",e)},expression:"currentSettings.fqdn"}})],1),t._v(" "),t.isQuickConnectTunnel?t._e():o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:n.fqdn,expression:"currentSettings.fqdn"}],staticClass:"ac-lp-login-editor__form-item link-tip-wrapper",attrs:{"text-only":"","syno-id":"syno-form-item-lp-ale-fqdn-link"}},[o("span",{directives:[{name:"tooltip",rawName:"v-tooltip",value:""+t.generateFqdnHref(n.fqdn),expression:"`${generateFqdnHref(currentSettings.fqdn)}`"}],staticClass:"link-tip"},[t._v("\n "+t._s(t.tipPrefix)+"\n "),""+t.settings.fqdn==""+n.fqdn?o("a",{attrs:{href:t.generateFqdnHref(n.fqdn),target:"_blank"}},[t._v("\n "+t._s(t.generateFqdnHref(n.fqdn))+"\n ")]):o("span",[t._v("\n "+t._s(t.generateFqdnHref(n.fqdn))+"\n ")])])]),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item--last",attrs:{"syno-id":"syno-lp-ale-form-item-hsts","hide-label":"",prop:"p-lp-ale-hsts"}},[o("v-checkbox",{attrs:{"syno-id":"syno-lp-ale-checkbox-hsts",name:"p-lp-ale-hsts",disabled:!n.enable_custom_domain},model:{value:r.enable_hsts,callback:function(e){t.$set(r,"enable_hsts",e)},expression:"form.enable_hsts"}},[t._v("\n "+t._s(t.$i18n("service","enable_hsts_desc"))+"\n ")])],1)]}},{key:"post-fieldsets",fn:function(e){var n=e.settings;return[o("v-fieldset",{attrs:{"syno-id":"syno-lp-ale-acl",title:t.$i18n("app_port_alias","title_access_control")}},[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-ale-acl-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("controlpanel","applications_acl_desc"))+"\n ")]),t._v(" "),o("v-form-item",{staticClass:"ac-lp-login-editor__form-item",attrs:{"syno-id":"syno-form-item-lp-ale-acl",label:t._f("colon")(t.$i18n("app_port_alias","desc_acl")),prop:"syno-form-item-lp-ale-acl",rules:t.accessControlRules},scopedSlots:t._u([{key:"after",fn:function(){return[o("v-whitetip",{attrs:{"syno-id":"syno-lp-le-whitetip-hsts"}},[o("span",{domProps:{innerHTML:t._s(t.$i18n("app_port_alias","tip_access_control"))}})])]},proxy:!0}],null,!0)},[o("v-single-select",{ref:"select",attrs:{readonly:"","syno-id":"syno-select-lp-ale-acl",name:"syno-form-item-lp-ale-acl",width:"200px",options:t.accessControlOptions,"null-value":"$$NOT_USED$$"},scopedSlots:t._u([{key:"bottom-actions",fn:function(){return[o("v-select-divider-option"),t._v(" "),o("v-select-action-option",{attrs:{display:t.$i18n("vpnc","create_profile")},on:{click:function(e){return t.openCreateDialog()}}})]},proxy:!0}],null,!0),model:{value:n.acl,callback:function(e){t.$set(n,"acl",e)},expression:"currentSettings.acl"}})],1)],1)]}}])})},[],!1,null,null,null)),G=l({components:{ApplicationLoginEditor:Q.exports},mixins:[g],computed:{title(){return this.$i18n("controlpanel","edit_application_login_settings").replace("{0}",this.applicationDisplayName)}},data:()=>({applicationId:null,applicationDisplayName:""}),methods:{async onApply(t,e,o){try{await async function(t={}){const e=JSON.parse(JSON.stringify(t));return e.http_port&&(e.http_port=parseInt(e.http_port,10)),e.https_port&&(e.https_port=parseInt(e.https_port,10)),await synowebapi.promises.request({api:"SYNO.Core.AppPortal",method:"set",version:2,params:e})}(t),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{staticClass:"admin-center__login-portal",attrs:{"syno-id":"syno-lp-modal-app-editor",height:580,width:620,title:t.title,"before-close":function(){return t.$refs.editor.$refs.loginEditor.beforeClose()}}},[t.applicationId?o("application-login-editor",{ref:"editor",attrs:{"in-modal":"","application-id":t.applicationId},on:{apply:t.onApply,cancel:function(e){return t.close()}}}):t._e()],1)},[],!1,null,null,null).exports,X={components:{BackgroundPreview:p},mixins:[g],props:{applicationId:{type:String,required:!0},profile:{type:Object,required:!0}},mounted(){this.$watch("form.enableBackground",()=>{this.form.enableBackground?(this.form.backgroundImgOrColor="image",this.profile.enable_background_customize=!0,this.profile.only_background_color=!1):(this.profile.enable_background_customize=!1,this.profile.only_background_color=!1)}),this.$watch("form.backgroundImgOrColor",()=>{"image"===this.form.backgroundImgOrColor&&(this.profile.enable_background_customize=!0,this.profile.only_background_color=!1),"color"===this.form.backgroundImgOrColor&&(this.profile.enable_background_customize=!1,this.profile.only_background_color=!0)})},data(){return{isCustomColorPanelShown:!1,tmpBackgroundSrc:null,form:{enableBackground:this.profile.enable_background_customize||this.profile.only_background_color,backgroundImgOrColor:this.profile.enable_background_customize?"image":"color"}}},computed:{isRetina:()=>SYNO.SDS.UIFeatures.IconSizeManager.isRetinaMode(),resolution(){return this.isRetina?"2x":"1x"},jsBaseUrl(){return SYNO.SDS.Config.FnMap[this.applicationId]?SYNO.SDS.Config.FnMap[this.applicationId].config.jsBaseURL:""},loginStyleConfig(){return SYNO.SDS.Config.FnMap[this.applicationId]?SYNO.SDS.Config.FnMap[this.applicationId].config.loginStyle:{}},colorWindowConfig(){return{title:this.$i18n("personal_settings","customize_color"),showClose:!1,showMaximize:!1,resizable:!1,showMinimize:!1,height:"auto",width:436}},shouldAppendedColorPickerShown(){return["center","fit"].includes(this.profile.background_position)},backgroundPositionOptions(){return[{label:this.$i18n("dsmoption","login_background_position_fill"),value:"fill"},{label:this.$i18n("dsmoption","login_background_position_center"),value:"center"},{label:this.$i18n("dsmoption","login_background_position_fit"),value:"fit"},{label:this.$i18n("dsmoption","login_background_position_stretch"),value:"stretch"},{label:this.$i18n("dsmoption","login_background_position_tile"),value:"tile"}]},backgroundImgOrColorOptions(){return[{label:this.$i18n("personal_settings","image"),value:"image"},{label:this.$i18n("personal_settings","color"),value:"color"}]}},methods:{openImageSelector(){const t=new SYNO.SDS.Utils.ImageSelector({owner:this.$window,appName:this.applicationId,maxImageSizeKB:25600},"login_style","background");t.mon(t,"choose",e=>{if(!e)return;const o=e.get("apply_type");switch(this.profile.background_type=o,this.profile.background_path="fromDS"===o||"pkgDefault"===o?e.get("path"):e.get("path").split("/").pop(),o){case"pkgDefault":this.tmpBackgroundSrc=`${this.jsBaseUrl}/${this.loginStyleConfig.defaultLoginWallpaper}`.replace("{0}",this.resolution);break;case"fromDS":this.tmpBackgroundSrc=e.get("url").replace(/size=%22medium%22/,"size=%22big%22");break;default:this.tmpBackgroundSrc=e.get("url").replace(/is_thumbnail=(true)/,"is_thumbnail=false").replace(/thumbnail_(\d*)\./,"dsm7_$1.")}t.close()}),this.$window.openExtWindow(t)},onColorChange(t){this.profile.background_color=t,this.closeCustomColorPanel()},async showCustomColorPanel(){this.isCustomColorPanelShown=!0,await this.$nextTick(),this.$window.openModalWindow(this.$refs.customColorWindow)},closeCustomColorPanel(){this.$refs.customColorWindow.close(),this.isCustomColorPanelShown=!1}}},Z=(o(32),l(X,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"custom-background"},[o("v-form-item",{staticClass:"custom-background__checkbox",attrs:{"syno-id":"syno-form-item-lp-lse-bg","hide-label":"",prop:"p-lp-lse-bg"}},[o("v-checkbox",{attrs:{"syno-id":"syno-checkbox-lp-lse-bg",name:"p-lp-lse-bg"},model:{value:t.form.enableBackground,callback:function(e){t.$set(t.form,"enableBackground",e)},expression:"form.enableBackground"}},[t._v("\n "+t._s(t.$i18n("dsmoption","login_background"))+"\n ")])],1),t._v(" "),o("v-form-item",{attrs:{"syno-id":"syno-lp-lse-background-preview","hide-label":"",indent:"1"}},[o("div",{staticClass:"custom-background__preview-and-select"},[o("background-preview",{class:{"custom-background__preview-background":!0,"custom-background__preview-background--disabled":!t.form.enableBackground},attrs:{"only-show-custom":"","application-id":t.applicationId,profile:t.profile,"force-background-image":t.tmpBackgroundSrc}}),t._v(" "),o("div",[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-lse-enable-bg","hide-label":"",prop:"p-lp-lse-enable-bg"}},[o("v-select",{attrs:{"syno-id":"syno-select-lp-lse-enable-bg",width:"200px",name:"p-lp-lse-enable-bg",disabled:!t.form.enableBackground,options:t.backgroundImgOrColorOptions},model:{value:t.form.backgroundImgOrColor,callback:function(e){t.$set(t.form,"backgroundImgOrColor",e)},expression:"form.backgroundImgOrColor"}})],1),t._v(" "),"color"===t.form.backgroundImgOrColor?[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-lse-color","hide-label":""}},[o("v-color-picker",{attrs:{disabled:!t.profile.only_background_color,"syno-id":"syno-cp-lp-lse-bg-color"},on:{showcustom:function(e){return t.showCustomColorPanel()}},model:{value:t.profile.background_color,callback:function(e){t.$set(t.profile,"background_color",e)},expression:"profile.background_color"}})],1)]:[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-lse-select-btn","hide-label":""}},[o("v-button",{attrs:{"syno-id":"syno-select-lp-lse-img",disabled:!t.profile.enable_background_customize},on:{click:function(e){return t.openImageSelector()}}},[t._v("\n "+t._s(t.$i18n("personal_settings","select_image"))+"\n ")])],1),t._v(" "),o("v-form-multiple-item",{attrs:{"hide-label":"","syno-id":"syno-multiple-form-item-lp-lse-bg-pos"}},[o("v-form-item",{staticClass:"lp-login-style-editor__form-item--last",attrs:{"syno-id":"syno-form-item-lp-lse-bg-pos","hide-label":""}},[o("v-select",{attrs:{"syno-id":"syno-select-lp-lse-bg-pos",width:"200px",disabled:!t.profile.enable_background_customize,options:t.backgroundPositionOptions},model:{value:t.profile.background_position,callback:function(e){t.$set(t.profile,"background_position",e)},expression:"profile.background_position"}})],1),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item--last",attrs:{"syno-id":"syno-form-item-lp-lse-appended-color","hide-label":""}},[o("v-color-picker",{directives:[{name:"show",rawName:"v-show",value:t.shouldAppendedColorPickerShown,expression:"shouldAppendedColorPickerShown"}],attrs:{"syno-id":"syno-cp-lp-lse-bg-appended-color",disabled:!t.profile.enable_background_customize},on:{showcustom:function(e){return t.showCustomColorPanel()}},model:{value:t.profile.background_color,callback:function(e){t.$set(t.profile,"background_color",e)},expression:"profile.background_color"}})],1)],1),t._v(" "),o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{"syno-id":"syno-form-item-lp-lse-bg-type",prop:"p-item-lp-lse-bg-type"}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-bg-type",name:"p-item-lp-lse-bg-type"},model:{value:t.profile.background_type,callback:function(e){t.$set(t.profile,"background_type",e)},expression:"profile.background_type"}})],1),t._v(" "),o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{"syno-id":"syno-form-item-lp-lse-bg-path",prop:"p-item-lp-lse-bg-path"}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-bg-type",name:"p-item-lp-lse-bg-path"},model:{value:t.profile.background_path,callback:function(e){t.$set(t.profile,"background_path",e)},expression:"profile.background_path"}})],1)]],2)],1)]),t._v(" "),t.isCustomColorPanelShown?o("v-modal-window",t._b({ref:"customColorWindow",attrs:{"syno-id":"login-style-editor-v-form-custom-background-modal-window-0",inline:""}},"v-modal-window",t.colorWindowConfig,!1),[o("v-color-custom-panel",{attrs:{"syno-id":"login-style-editor-v-form-custom-background-color-custom-panel-0",initial:t.profile.background_color},on:{colorselected:t.onColorChange,colorselectcanceled:function(e){return t.closeCustomColorPanel()}}})],1):t._e()],1)},[],!1,null,"0c8f909a",null).exports),tt={mixins:[g],props:{applicationId:{type:String,required:!0},profile:{type:Object,required:!0}},computed:{logoSrc(){if(this.tmpLogoSrc)return this.tmpLogoSrc;const t={api:"SYNO.Core.Theme.Image",version:1,method:"get",params:{type:"login_style_logo"}};return("dsm"===this.applicationId||this.profile.from_dsm)&&this.profile.logo_seq&&(t.params.seq=this.profile.logo_seq),"dsm"!==this.applicationId&&this.profile.login_logo_seq&&(t.params.seq=this.profile.login_logo_seq,t.params.app=this.applicationId),t.params.seq?`${SYNO.API.GetBaseURL(t)}&_v=${Date.now()}`:null}},data:()=>({tmpLogoSrc:null}),methods:{openImageSelector(){const t=new SYNO.SDS.Utils.ImageSelector({owner:this.$window,maxImageSizeKB:1024},"login_style","logo");t.mon(t,"choose",e=>{if(!e)return;this.tmpLogoSrc=e.get("url");const o=e.get("apply_type");this.profile.logo_type=o,this.profile.logo_path="fromDS"===o?e.get("path"):e.get("path").split("/").pop(),t.close()}),this.$window.openExtWindow(t)}}},et=(o(33),{components:{VFormCustomBackground:Z,VFormCustomLogo:l(tt,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",[o("v-form-item",{staticClass:"custom-logo__checkbox",attrs:{"syno-id":"syno-form-item-lp-lse-enable-logo","hide-label":"",prop:"p-lp-lse-enable-logo"}},[o("v-checkbox",{attrs:{"syno-id":"syno-checkbox-lp-lse-enable-logo",name:"p-lp-lse-enable-logo"},model:{value:t.profile.enable_logo_customize,callback:function(e){t.$set(t.profile,"enable_logo_customize",e)},expression:"profile.enable_logo_customize"}},[t._v("\n "+t._s(t.$i18n("dsmoption","login_logo"))+"\n ")])],1),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item--last",attrs:{"syno-id":"syno-form-item-lp-lse-logo","hide-label":"",indent:"1"}},[o("div",{staticClass:"custom-logo__preview-and-select"},[o("div",{class:{"custom-logo__preview-logo":!0,"custom-logo__preview-logo--disabled":!t.profile.enable_logo_customize},style:{backgroundImage:t.logoSrc?"url('"+t.logoSrc+"')":null}}),t._v(" "),o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-lse-selector","hide-label":""}},[o("v-button",{attrs:{"syno-id":"syno-btn-lp-lse-selector",disabled:!t.profile.enable_logo_customize},on:{click:function(e){return t.openImageSelector()}}},[t._v("\n "+t._s(t.$i18n("personal_settings","select_image"))+"\n ")])],1)],1)]),t._v(" "),o("v-form-item",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{"syno-id":"syno-form-item-lp-lse-logo-src",prop:"_"}},[o("v-input",{attrs:{"syno-id":"syno-input-item-lp-lse-logo-src",name:"_"},model:{value:t.logoSrc,callback:function(e){t.logoSrc=e},expression:"logoSrc"}})],1)],1)},[],!1,null,"ea0aebac",null).exports},mixins:[g,x,w],props:{applicationId:{type:String,required:!0}},mounted(){this.fetchData(),this.unregister=this.registerMessageEvent(t=>{t&&t.data&&t.data.origin===this.origin&&("save"===t.data.action&&this.onApply(),delete window.previewParam)})},beforeDestroy(){this.unregister()},computed:{isProfileEmpty(){return 0===Object.keys(this.profile).length},isRetina:()=>SYNO.SDS.UIFeatures.IconSizeManager.isRetinaMode(),resolution(){return this.isRetina?"2x":"1x"},origin(){let t=window.location.origin;return t||(t=`${window.location.protocol}//${window.location.hostname}${window.location.port?":"+window.location.port:""}`),t}},data:()=>({dataProperty:"profile",profile:{}}),methods:{async fetchData(){this.profile=await d(this.applicationId),await this.$nextTick(),this.$refs.form.commit()},openPreviewTab(){const t=this.getPreviewUrl(),e=this.getPreviewParam();window.previewParam=e,window.open(t,"preview_login_style")},getPreviewUrl(){this.updateAppWindow();const t=this.$appWindow.getDsmHost(),e=this.$appWindow.getDsmHttpPort(),o=t&&e?`http://${t}:${e}/webman`:"",n=Ext.urlEncode({preview:!0,app_name:this.applicationId||""});return Ext.urlAppend(`${o}/`,n)},getPreviewParam(){if(!this.$refs.form.isDirty())return null;const t="dsm"===this.applicationId?!!(this.profile.logo_path||this.profile.logo_seq>0):!!(this.profile.logo_path||this.profile.login_logo_seq>-1),e="dsm"===this.applicationId?!!(this.profile.background_path||this.profile.background_seq>0):!!(this.profile.background_path||this.profile.login_background_seq>-1);return{preview_modified:!Ext.isIE9m,new_logo:!!this.profile.logo_path,login_logo_enable:this.profile.enable_logo_customize&&t,login_logo_path:this.getImageFullPath(this.profile.logo_type,this.profile.logo_path),login_logo_ext:(this.profile.logo_path||"").split(".").pop(),logo_type:this.profile.logo_type,new_background:!!this.profile.background_path,login_background_enable:this.profile.enable_background_customize&&e,login_background_path:this.getImageFullPath(this.profile.background_type,this.profile.background_path),login_background_ext:(this.profile.background_path||"").split(".").pop(),login_background_type:this.profile.background_type,login_background_pos:this.profile.background_position,login_background_color:this.profile.background_color,login_only_bgcolor:this.profile.only_background_color,custom_login_title:this.profile.login_title,login_welcome_title:this.profile.login_welcome_title,login_welcome_msg:this.profile.login_welcome_msg,login_footer_msg:this.profile.login_footer_msg,login_footer_enable_html:this.profile.login_footer_enable_html}},getImageFullPath(t,e=""){let o=e;return"history"===t&&(o=`/usr/syno/etc/login_image/${e}`),"default"===t&&(o=`/usr/syno/synoman/webman/resources/images/${this.resolution}/default_login_background/${e}`),"pkgDefault"===t&&(o=String.format(e,this.resolution,e)),"upload"===t&&(o=`/tmp/upload_tmp/${e}`),o},registerMessageEvent:t=>!Ext.isIE9m&&window.addEventListener&&window.removeEventListener?(window.addEventListener("message",t),()=>window.removeEventListener("message",t)):()=>{}}}),ot=(o(34),l(et,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{staticClass:"lp-login-style-editor__panel",attrs:{"syno-id":"syno-panel-lp-lse","fluid-footer":"",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"body",fn:function(){return[o("v-perfect-scrollbar",[o("div",{staticClass:"lp-modal-content"},[o("v-form",{ref:"form",attrs:{"syno-id":"syno-form-lp-lse"}},[o("v-fieldset",{staticClass:"lp-login-style-editor__fieldset--first",attrs:{"syno-id":"syno-fieldset-lp-lse-title",title:t.$i18n("dsmoption","login_title_background")}},[o("v-form-item",{staticClass:"lp-login-style-editor__login-title lp-login-style-editor__form-item",attrs:{"syno-id":"syno-form-item-lp-lse-title",prop:"p-lp-lse-title",label:t._f("colon")(t.$i18n("dsmsetting","login_title"))}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-title",name:"p-lp-lse-title"},model:{value:t.profile.login_title,callback:function(e){t.$set(t.profile,"login_title",e)},expression:"profile.login_title"}})],1),t._v(" "),t.isProfileEmpty?t._e():o("v-form-custom-background",{attrs:{"application-id":t.applicationId,profile:t.profile}}),t._v(" "),t.isProfileEmpty?t._e():o("v-form-custom-logo",{attrs:{"application-id":t.applicationId,profile:t.profile}})],1),t._v(" "),o("v-fieldset",{attrs:{"syno-id":"syno-fieldset-lp-lse-msg",title:t.$i18n("dsmoption","login_style_messages")}},[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-lse-msg-desc","hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("dsmoption","login_style_messages_desc"))+"\n ")]),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item",attrs:{"syno-id":"syno-form-item-lp-lse-msg-title",label:t._f("colon")(t.$i18n("dsmsetting","welcome_title")),prop:"p-lp-lse-msg-title"}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-msg-title",name:"p-lp-lse-msg-title",maxlength:127},model:{value:t.profile.login_welcome_title,callback:function(e){t.$set(t.profile,"login_welcome_title",e)},expression:"profile.login_welcome_title"}})],1),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item lp-login-style-editor__form-item--textarea",attrs:{"syno-id":"syno-form-item-lp-lse-msg-msg",label:t._f("colon")(t.$i18n("dsmsetting","welcome_msg")),prop:"p-lp-lse-msg-msg"}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-msg-msg",type:"textarea",name:"p-lp-lse-msg-msg",maxlength:255},model:{value:t.profile.login_welcome_msg,callback:function(e){t.$set(t.profile,"login_welcome_msg",e)},expression:"profile.login_welcome_msg"}})],1),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item lp-login-style-editor__form-item--textarea",attrs:{"syno-id":"syno-form-item-lp-lse-msg-footer",label:t._f("colon")(t.$i18n("dsmsetting","footer_msg")),prop:"p-lp-lse-msg-footer"}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-lse-msg-msg-footer",type:"textarea",name:"p-lp-lse-msg-footer",maxlength:512},model:{value:t.profile.login_footer_msg,callback:function(e){t.$set(t.profile,"login_footer_msg",e)},expression:"profile.login_footer_msg"}})],1),t._v(" "),o("v-form-item",{staticClass:"lp-login-style-editor__form-item lp-login-style-editor__form-item--last-in-fieldset",attrs:{"syno-id":"syno-form-item-lp-lse-msg-footer-html",prop:"p-lp-lse-msg-footer-html"}},[o("v-checkbox",{attrs:{"syno-id":"syno-checkbox-lp-lse-msg-footer-html",name:"p-lp-lse-msg-footer-html"},model:{value:t.profile.login_footer_enable_html,callback:function(e){t.$set(t.profile,"login_footer_enable_html",e)},expression:"profile.login_footer_enable_html"}},[t._v("\n "+t._s(t.$i18n("dsmsetting","footer_enable_html"))+"\n ")])],1)],1)],1)],1)])]},proxy:!0},{key:"fbar",fn:function(){return[o("div",{staticClass:"default pull-right"},[o("v-button",{attrs:{"syno-id":"syno-btn-fbar-preview",type:"footbar"},on:{click:function(e){return t.openPreviewTab()}}},[t._v("\n "+t._s(t.$i18n("dsmoption","login_preview"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-fbar-cancel",type:"footbar"},on:{click:function(e){return t.onCancel()}}},[t._v("\n "+t._s(t.$i18n("common","cancel"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-fbar-commit",type:"footbar",suffix:"blue"},on:{click:function(e){return t.onApply()}}},[t._v("\n "+t._s(t.$i18n("common","save"))+"\n ")])],1)]},proxy:!0}])})},[],!1,null,null,null)),nt=l({components:{LoginStyleEditor:ot.exports},mixins:[g],data:()=>({applicationId:null,applicationDisplayName:""}),computed:{title(){return"dsm"===this.applicationId?this.$i18n("dsmoption","loginstyle_editor_header"):this.$i18n("controlpanel","edit_application_login_style").replace("{0}",this.applicationDisplayName)}},methods:{async onApply(t,e,o){try{await async function(t="dsm",e={}){const o={...e};!o.enable_logo_customize||!o.from_dsm||o.logo_type&&o.logo_path||(o.logo_type="fromDSMStyle",o.logo_path="logo.jpg");const n="dsm"===t?o.logo_path||o.logo_seq>0:o.logo_path||o.login_logo_seq>-1;o.enable_logo_customize=!(!o.enable_logo_customize||!n);const i="dsm"===t?{api:"SYNO.Core.Theme.Login",version:1,method:"set",params:o}:{api:"SYNO.Core.Theme.AppPortalLogin",version:1,method:"set",params:{app:t,...o}};return await synowebapi.promises.request(i)}(this.applicationId,t),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{staticClass:"admin-center__login-portal",attrs:{"syno-id":"syno-lp-modal-login-style-editor",height:520,width:620,title:t.title,"before-close":function(){return t.$refs.editor.beforeClose()}}},[o("div",{staticClass:"lp-modal-content-wrapper"},[t.applicationId?o("login-style-editor",{ref:"editor",attrs:{applicationId:t.applicationId},on:{apply:t.onApply,cancel:function(e){return t.close()}}}):t._e()],1)])},[],!1,null,null,null).exports,it=l({filters:{renderFontendOrBackend(t={}){let e="UNKNOWN";switch(t.protocol){case 0:e="http";break;case 1:e="https";break;default:e="UNKOWN"}return`${e}://${t.fqdn||"*"}${[[0,80],[1,443]].some(([e,o])=>!(t.protocol===e&&t.port===o))?`:${t.port}`:""}`}},mixins:[g,x],data:()=>({contextmenuLeft:"0px",contextmenuTop:"0px",showMenu:!1,data:[],selectedRows:[]}),computed:{contextMenuStyle(){return{top:this.contextmenuTop,left:this.contextmenuLeft}},singleSelectedRow(){return 1===this.selectedRows.length&&this.selectedRows[0]},isEditActionActive(){return!!this.singleSelectedRow},isDeleteActionActive(){return this.selectedRows.length>0},columns(){return[{title:this.$i18n("app_port_alias","description"),field:"description"},{title:this.$i18n("app_port_alias","source"),field:"frontend"},{title:this.$i18n("app_port_alias","destination"),field:"backend"}]}},mounted(){this.load()},methods:{async load(){this.onLoading(),this.$refs.dataTable&&this.$refs.dataTable.clearSelection();const t=await m();this.data=t&&t.entries||[],this.onDone()},openCreateDialog(){this.updateAppWindow();const{window:t}=this.$window.openWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.CreateReverseProxy_vue);t.$on("close",()=>this.load())},openEditDialog(){if(!this.isEditActionActive)return;this.updateAppWindow();const{window:t}=this.$window.openWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.UpdateReverseProxy_vue,{profile:this.singleSelectedRow});t.$on("close",()=>this.load())},async deleteReverseProxies(){if(this.isDeleteActionActive&&"confirm"===await this.$window.getMsgBox().confirmDelete("",this.$i18n("app_port_alias","confirm_delete_proxy")))try{this.onLoading();const t=this.selectedRows.map(t=>t.UUID);await async function(t=[]){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.ReverseProxy",method:"delete",version:1,params:{uuids:t}})}(t),this.load(),this.onDone()}catch(t){this.onError(t)}},onRightClickCell(t,e,o,n,i){i.preventDefault(),this.selectedRows=[t],this.contextmenuLeft=`${i.pageX}px`,this.contextmenuTop=`${i.pageY}px`,this.showMenu=!0},onMenuClose(){this.showMenu=!1}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{staticClass:"lp-reverse-proxy-component__panel",attrs:{"fluid-footer":"","syno-id":"syno-panel-reverse-proxy","has-tbar":0!==t.data.length,loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"tbar",fn:function(){return[o("v-button",{attrs:{"syno-id":"syno-btn-reverse-proxy-create"},on:{click:function(e){return t.openCreateDialog()}}},[t._v("\n "+t._s(t.$i18n("common","create"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-reverse-proxy-edit",disabled:!t.isEditActionActive},on:{click:function(e){return t.openEditDialog()}}},[t._v("\n "+t._s(t.$i18n("common","alt_edit"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-reverse-proxy-delete",disabled:!t.isDeleteActionActive},on:{click:function(e){return t.deleteReverseProxies()}}},[t._v("\n "+t._s(t.$i18n("common","delete"))+"\n ")])]},proxy:!0},{key:"body",fn:function(){return[0!==t.data.length?o("div",{staticClass:"lp-modal-content"},[o("v-data-table",{ref:"dataTable",staticClass:"data-table",attrs:{"multiple-selected":"","syno-id":"syno-table-reverse-proxy",columns:t.columns,"current-data":t.data},on:{refresh:function(e){return t.load()},rowclick:function(e){t.selectedRows=e.rows},rowdblclick:function(e){return t.openEditDialog()},"cell-contextmenu":t.onRightClickCell},scopedSlots:t._u([{key:"frontend",fn:function(e){var o=e.data;return[t._v("\n "+t._s(t._f("renderFontendOrBackend")(o))+"\n ")]}},{key:"backend",fn:function(e){var o=e.data;return[t._v("\n "+t._s(t._f("renderFontendOrBackend")(o))+"\n ")]}}],null,!1,2723677059)}),t._v(" "),t.showMenu?o("v-portal",{attrs:{"mount-to":"body","target-style":t.contextMenuStyle}},[o("v-menu",{attrs:{"syno-id":"reverse-proxy-index-menu-0","close-on-select":""},on:{"menu-close":t.onMenuClose}},[o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-index-menu-item-1",title:t.$i18n("common","alt_edit"),disabled:!t.isEditActionActive},on:{click:function(e){return t.openEditDialog()}}}),t._v(" "),o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-index-menu-item-2",title:t.$i18n("common","delete"),disabled:!t.isDeleteActionActive},on:{click:function(e){return t.deleteReverseProxies()}}})],1)],1):t._e()],1):o("v-empty-view",{attrs:{"syno-id":"syno-empty-view-reverse-proxy"},on:{"action-click":function(e){return t.openCreateDialog()}}})]},proxy:!0},{key:"fbar",fn:function(){return[o("div",{staticClass:"default pull-right"},[o("v-button",{attrs:{"syno-id":"reverse-proxy-index-button-0",type:"footbar"},on:{click:function(e){return t.onCancel()}}},[t._v("\n "+t._s(t.$i18n("common","close"))+"\n ")])],1)]},proxy:!0}])})},[],!1,null,null,null),rt=l({components:{ReverseProxy:it.exports},mixins:[g]},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{attrs:{"syno-id":"syno-modal-reverse-proxy",height:450,width:680,title:t.$i18n("app_port_alias","title_reverse_proxy")}},[o("reverse-proxy",{on:{apply:function(e){return t.close()},cancel:function(e){return t.close()}}})],1)},[],!1,null,null,null).exports,st={props:{profile:{type:String,required:!0},errors:{type:Object,required:!0},isDirty:{type:Function,default:()=>!1},validate:{type:Function,default:()=>!0}},created(){this.fqdnValidator=new E,this.portValidator=new q},computed:{reverseProxyFrontendFqdnRules(){return[T(this.errors.frontendFqdn),N("FQDN2"),{asyncValidator:async()=>{await this.fqdnValidator.validateFrontendReverseProxy(this.profile)}}]},reverseProxyFrontendPortRules(){return[T(this.errors.frontendPort),N("port"),{asyncValidator:async()=>{await this.portValidator.validateFrontendPort(this.profile)}}]},reverseProxyBackendFqdnRules(){return[T(this.errors.backendFqdn),N("FQDN3")]},reverseProxyBackendPortRules(){return[N("port"),{asyncValidator:async()=>{await this.portValidator.validateBackendPort(this.profile)}}]},reverseProxyTimeoutRules(){return[{asyncValidator:async(t,e)=>{if(!(1<=e&&e<=86400))throw this.$i18n("app_port_alias","err_proxy_timeout")}}]},reverseProxyConnectTimeoutRules(){return[T(this.errors.proxyConnectTimeout),...this.reverseProxyTimeoutRules]},reverseProxySendTimeoutRules(){return[T(this.errors.proxySendTimeout),...this.reverseProxyTimeoutRules]},reverseProxyReadTimeoutRules(){return[T(this.errors.proxyReadTimeout),...this.reverseProxyTimeoutRules]}},methods:{_onLoading(){this.errors.frontendFqdn="",this.errors.frontendPort="",this.errors.backendFqdn="",this.errors.customHeaderNameIndex=-1,this.errors.customHeaderName="",this.errors.customHeaderValueIndex=-1,this.errors.customHeaderValue="",this.errors.proxyConnectTimeout="",this.errors.proxyReadTimeout="",this.errors.proxySendTimeout="",this.$nextTick()},_onError(t){if(t&&t.code){switch(t.code){case 4154:this.errors.frontendFqdn=SYNO.API.getErrorString(t);break;case 4155:this.errors.frontendPort=SYNO.API.getErrorString(t);break;case 4156:this.errors.backendFqdn=SYNO.API.getErrorString(t);break;case 4164:case 4166:this.errors.customHeaderNameIndex=t.errors.index[0],this.errors.customHeaderName=SYNO.API.getErrorString(t);break;case 4165:this.errors.customHeaderValueIndex=t.errors.index[0],this.errors.customHeaderValue=SYNO.API.getErrorString(t);break;case 4168:this.errors.proxyConnectTimeout=SYNO.API.getErrorString(t);break;case 4169:this.errors.proxyReadTimeout=SYNO.API.getErrorString(t);break;case 4170:this.errors.proxySendTimeout=SYNO.API.getErrorString(t)}this.validate()}},generateReverseProxyCustomizedHeaderNameRules(t){return[{asyncValidator:async()=>{if(t===this.errors.customHeaderNameIndex)throw this.errors.customHeaderName}},{asyncValidator:async(t,e)=>{if(!/^([a-zA-Z1-9]|-){1,}$/i.exec(e))throw this.$i18n("app_port_alias","err_invalid_header_name")}},{asyncValidator:async(t,e)=>{if(this.profile.customize_headers.filter(t=>t.name.toUpperCase()===e.toUpperCase()).length>1)throw this.$i18n("app_port_alias","err_header_name_duplicated")}}]},generateReverseProxyCustomizedHeaderValueRules(t){return[{asyncValidator:async(e,o)=>{if(!o)throw this.$i18n("app_port_alias","err_invalid_header_value");if(t===this.errors.customHeaderValueIndex)throw this.errors.customHeaderValue}}]}}},at={mixins:[x,st],props:{profile:{type:Object,required:!0},isDirty:{type:Function,required:!0},commit:{type:Function,required:!0},validate:{type:Function,required:!0}},data:()=>({dataProperty:"profile",aclProfiles:[]}),computed:{aclOptions(){return[{label:this.$i18n("app_port_alias","not_configured"),value:null},...this.aclProfiles.map(t=>({label:t.name,value:t.UUID}))]},protocolOptions(){return[{label:this.$i18n("common","http"),value:0},{label:this.$i18n("common","https"),value:1}]}},async mounted(){this.load()},methods:{async load(){const t=await f();this.aclProfiles=t.entries||[]}}},lt=(o(35),l(at,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{attrs:{"syno-id":"reverse-proxy-editor-general-panel-0","fluid-footer":"",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,"confirm-text":t.$i18n("common","save"),confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"scroll-body",fn:function(){return[o("v-form",{ref:"form",staticClass:"reverse-proxy-editor-general",attrs:{"syno-id":"reverse-proxy-editor-general-form-0"}},[o("v-form-item",{staticClass:"proxy-description-item",attrs:{prop:"reverse-proxy-editor-general-input-0",label:t.$i18n("app_port_alias","reverse_proxy_name")+t.$i18n("common","colon"),rules:[{type:"string",required:!0}]}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-general-input-0",name:"reverse-proxy-editor-general-input-0"},model:{value:t.profile.description,callback:function(e){t.$set(t.profile,"description",e)},expression:"profile.description"}})],1),t._v(" "),o("v-fieldset",{attrs:{title:t.$i18n("app_port_alias","source"),collapsible:!1}},[o("v-form-item",{attrs:{label:t.$i18n("app_port_alias","protocol")+t.$i18n("common","colon")}},[o("v-single-select",{attrs:{"syno-id":"reverse-proxy-editor-general-single-select-0",width:null,options:t.protocolOptions},model:{value:t.profile.frontend.protocol,callback:function(e){t.$set(t.profile.frontend,"protocol",e)},expression:"profile.frontend.protocol"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-general-input-1",label:t.$i18n("app_port_alias","hostname")+t.$i18n("common","colon"),rules:t.reverseProxyFrontendFqdnRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-general-input-1",name:"reverse-proxy-editor-general-input-1",placeholder:"*",maxlength:255},model:{value:t.profile.frontend.fqdn,callback:function(e){t.$set(t.profile.frontend,"fqdn",e)},expression:"profile.frontend.fqdn"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-general-input-2",label:t.$i18n("common","port")+t.$i18n("common","colon"),rules:t.reverseProxyFrontendPortRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-general-input-2",name:"reverse-proxy-editor-general-input-2",placeholder:0===t.profile.frontend.protocol?"80":"443","number-only":"",maxlength:5},model:{value:t.profile.frontend.port,callback:function(e){t.$set(t.profile.frontend,"port",e)},expression:"profile.frontend.port"}})],1),t._v(" "),o("v-form-item",{attrs:{"hide-label":""}},[o("v-checkbox",{attrs:{"syno-id":"reverse-proxy-editor-general-checkbox-0",disabled:0===t.profile.frontend.protocol},model:{value:t.profile.frontend.https.hsts,callback:function(e){t.$set(t.profile.frontend.https,"hsts",e)},expression:"profile.frontend.https.hsts"}},[t._v("\n "+t._s(t.$i18n("service","enable_hsts"))+"\n ")])],1),t._v(" "),o("v-form-item",{attrs:{label:t.$i18n("app_port_alias","desc_acl")+t.$i18n("common","colon")},scopedSlots:t._u([{key:"after",fn:function(){return[o("v-whitetip",[o("span",{domProps:{innerHTML:t._s(t.$i18n("app_port_alias","tip_access_control"))}})])]},proxy:!0}])},[o("v-single-select",{staticClass:"frontend-acl-select",attrs:{"syno-id":"reverse-proxy-editor-general-single-select-1",tooltip:"",width:null,"null-value":"",options:t.aclOptions},model:{value:t.profile.frontend.acl,callback:function(e){t.$set(t.profile.frontend,"acl",e)},expression:"profile.frontend.acl"}})],1)],1),t._v(" "),o("v-fieldset",{attrs:{title:t.$i18n("app_port_alias","destination"),collapsible:!1}},[o("v-form-item",{attrs:{label:t.$i18n("app_port_alias","protocol")+t.$i18n("common","colon")}},[o("v-single-select",{attrs:{"syno-id":"reverse-proxy-editor-general-single-select-2",width:null,options:t.protocolOptions},model:{value:t.profile.backend.protocol,callback:function(e){t.$set(t.profile.backend,"protocol",e)},expression:"profile.backend.protocol"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-general-input-3",label:t.$i18n("app_port_alias","hostname")+t.$i18n("common","colon"),rules:t.reverseProxyBackendFqdnRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-general-input-3",name:"reverse-proxy-editor-general-input-3",placeholder:"localhost",maxlength:255},model:{value:t.profile.backend.fqdn,callback:function(e){t.$set(t.profile.backend,"fqdn",e)},expression:"profile.backend.fqdn"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-general-input-4",label:t.$i18n("common","port")+t.$i18n("common","colon"),rules:t.reverseProxyBackendPortRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-general-input-4",name:"reverse-proxy-editor-general-input-4",placeholder:0===t.profile.backend.protocol?"80":"443","number-only":"",maxlength:5},model:{value:t.profile.backend.port,callback:function(e){t.$set(t.profile.backend,"port",e)},expression:"profile.backend.port"}})],1)],1)],1)]},proxy:!0}])})},[],!1,null,null,null).exports),pt={mixins:[g,x,st],props:{profile:{type:Object,required:!0},isDirty:{type:Function,required:!0},commit:{type:Function,required:!0},validate:{type:Function,required:!0}},data:()=>({dataProperty:"profile",selectedIndexes:[]}),computed:{isDeleteActionActive(){return this.selectedIndexes.length>0},columns(){return[{title:this.$i18n("app_port_alias","proxy_header_name"),field:"name",disableSort:!0},{title:this.$i18n("app_port_alias","proxy_header_value"),field:"value",disableSort:!0}]}},methods:{addHeader(t={name:"",value:""}){const e=!!t.name,o=this.profile.customize_headers.map(t=>t.name).some(e=>e===t.name);e&&o||this.profile.customize_headers.push(t)},addWebsocketHeaders(){this.addHeader({name:"Upgrade",value:"$http_upgrade"}),this.addHeader({name:"Connection",value:"$connection_upgrade"})},async deleteHeaders(){this.isDeleteActionActive&&"confirm"===await this.$window.getMsgBox().confirmDelete("",this.$i18n("app_port_alias","confirm_delete_profile"))&&(this.profile.customize_headers=this.profile.customize_headers.filter((t,e)=>!this.selectedIndexes.includes(e)),this.selectedIndexes=[])}}},ct=(o(36),l(pt,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-panel-0","has-tbar":"","fluid-footer":"",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,"confirm-text":t.$i18n("common","save"),confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"tbar",fn:function(){return[o("v-button",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-button-0"},scopedSlots:t._u([{key:"dropdown",fn:function(){return[o("v-menu",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-menu-0"}},[o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-menu-item-0",title:t.$i18n("common","create")},on:{click:function(e){return t.addHeader()}}}),t._v(" "),o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-menu-item-1",title:t.$i18n("app_port_alias","desc_policy_web_socket")},on:{click:function(e){return t.addWebsocketHeaders()}}})],1)]},proxy:!0}])},[t._v("\n "+t._s(t.$i18n("common","create"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-button-1",disabled:!t.isDeleteActionActive},on:{click:t.deleteHeaders}},[t._v("\n "+t._s(t.$i18n("common","delete"))+"\n ")])]},proxy:!0},{key:"body",fn:function(){return[o("v-form",{ref:"form",staticClass:"custom-header-form",attrs:{"syno-id":"reverse-proxy-editor-custom-header-form-0"}},[o("v-data-table",{ref:"dataTable",attrs:{"syno-id":"reverse-proxy-editor-custom-header-data-table-0","multiple-selected":"",columns:t.columns,"current-data":t.profile.customize_headers},on:{rowclick:function(e){t.selectedIndexes=e.indexes}},scopedSlots:t._u([{key:"name",fn:function(e){var n=e.row,i=e.index;return[o("v-form-item",{attrs:{prop:"reverse-proxy-editor-custom-header-input-0",rules:t.generateReverseProxyCustomizedHeaderNameRules(i)}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-input-0",name:"reverse-proxy-editor-custom-header-input-0"},model:{value:n.name,callback:function(e){t.$set(n,"name",e)},expression:"row.name"}})],1)]}},{key:"value",fn:function(e){var n=e.row,i=e.index;return[o("v-form-item",{attrs:{prop:"reverse-proxy-editor-custom-header-input-1",rules:t.generateReverseProxyCustomizedHeaderValueRules(i)}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-custom-header-input-1",name:"reverse-proxy-editor-custom-header-input-1"},model:{value:n.value,callback:function(e){t.$set(n,"value",e)},expression:"row.value"}})],1)]}}])})],1)]},proxy:!0}])})},[],!1,null,null,null).exports),dt={mixins:[x,st],props:{profile:{type:Object,required:!0},isDirty:{type:Function,required:!0},commit:{type:Function,required:!0},validate:{type:Function,required:!0}},data(){return{dataProperty:"profile",form:{useErrorPage:!this.profile.proxy_intercept_errors}}},computed:{httpVersionOptions:()=>[{label:"HTTP 1.0",value:0},{label:"HTTP 1.1",value:1}]},mounted(){this.$watch("form.useErrorPage",t=>{this.profile.proxy_intercept_errors=!t})}},ut=(o(37),l(dt,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{attrs:{"syno-id":"reverse-proxy-editor-advanced-panel-0","fluid-footer":"",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,"confirm-text":t.$i18n("common","save"),confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"scroll-body",fn:function(){return[o("v-form",{ref:"form",staticClass:"reverse-proxy-editor-advanced",attrs:{"syno-id":"reverse-proxy-editor-advanced-form-0"}},[o("v-form-item",{attrs:{"hide-label":"",textonly:""}},[t._v("\n "+t._s(t.$i18n("app_port_alias","desc_proxy_timeout"))+"\n ")]),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-advanced-input-0",indent:"1",label:t.$i18n("app_port_alias","desc_proxy_connect_timeout")+t.$i18n("common","colon"),rules:t.reverseProxyConnectTimeoutRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-advanced-input-0",name:"reverse-proxy-editor-advanced-input-0","number-only":"",maxlength:5},model:{value:t.profile.proxy_connect_timeout,callback:function(e){t.$set(t.profile,"proxy_connect_timeout",e)},expression:"profile.proxy_connect_timeout"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-advanced-input-1",indent:"1",label:t.$i18n("app_port_alias","desc_proxy_send_timeout")+t.$i18n("common","colon"),rules:t.reverseProxySendTimeoutRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-advanced-input-1",name:"reverse-proxy-editor-advanced-input-1","number-only":"",maxlength:5},model:{value:t.profile.proxy_send_timeout,callback:function(e){t.$set(t.profile,"proxy_send_timeout",e)},expression:"profile.proxy_send_timeout"}})],1),t._v(" "),o("v-form-item",{attrs:{prop:"reverse-proxy-editor-advanced-input-2",indent:"1",label:t.$i18n("app_port_alias","desc_proxy_read_timeout")+t.$i18n("common","colon"),rules:t.reverseProxyReadTimeoutRules}},[o("v-input",{attrs:{"syno-id":"reverse-proxy-editor-advanced-input-2",name:"reverse-proxy-editor-advanced-input-2","number-only":"",maxlength:5},model:{value:t.profile.proxy_read_timeout,callback:function(e){t.$set(t.profile,"proxy_read_timeout",e)},expression:"profile.proxy_read_timeout"}})],1),t._v(" "),o("v-form-item",{staticClass:"proxy_http_version",attrs:{prop:"reverse-proxy-editor-advanced-single-select-0",label:t.$i18n("app_port_alias","desc_proxy_http_version")+t.$i18n("common","colon")}},[o("v-single-select",{attrs:{"syno-id":"reverse-proxy-editor-advanced-single-select-0",name:"reverse-proxy-editor-advanced-single-select-0",width:null,options:t.httpVersionOptions},model:{value:t.profile.proxy_http_version,callback:function(e){t.$set(t.profile,"proxy_http_version",e)},expression:"profile.proxy_http_version"}})],1),t._v(" "),o("v-form-item",{attrs:{"hide-label":"",prop:"reverse-proxy-editor-advanced-checkbox-0"}},[o("v-checkbox",{attrs:{"syno-id":"reverse-proxy-editor-advanced-checkbox-0",name:"reverse-proxy-editor-advanced-checkbox-0"},model:{value:t.form.useErrorPage,callback:function(e){t.$set(t.form,"useErrorPage",e)},expression:"form.useErrorPage"}},[t._v("\n "+t._s(t.$i18n("app_port_alias","desc_proxy_intercept_errors"))+"\n ")])],1)],1)]},proxy:!0}])})},[],!1,null,null,null).exports);function mt(t={}){return{description:"",proxy_connect_timeout:60,proxy_read_timeout:60,proxy_send_timeout:60,proxy_http_version:1,proxy_intercept_errors:!1,...t,frontend:{acl:null,fqdn:null,port:null,protocol:0,...t.frontend,https:{hsts:!1,...t.frontend&&t.frontend.https}},backend:{fqdn:null,port:null,protocol:0,...t.backend},customize_headers:[...t.customize_headers||[]]}}var ft=l({components:{General:lt,CustomHeader:ct,Advanced:ut},props:{profile:{type:Object,required:!0}},data(){return{aProfile:mt(this.profile),activeTabKey:"general",errors:{frontendFqdn:"",frontendPort:"",backendFqdn:"",customHeaderNameIndex:-1,customHeaderName:"",customHeaderValueIndex:-1,customHeaderValue:"",proxyConnectTimeout:"",proxyReadTimeout:"",proxySendTimeout:""}}},computed:{tabs(){return[{key:"general",title:this.$i18n("app_port_alias","title_proxy_general"),synoId:"reverse-proxy-editor-tab-pane-general",component:lt},{key:"custom-header",title:this.$i18n("app_port_alias","title_proxy_customized_headers"),synoId:"reverse-proxy-editor-tab-pane-header",component:ct},{key:"advanced",title:this.$i18n("app_port_alias","title_proxy_advance"),synoId:"reverse-proxy-editor-tab-pane-advanced",component:ut}]}},mounted(){this.watchConvertStringToNumber()},methods:{beforeClose(){return this.$refs[this.activeTabKey][0].beforeClose()},isDirty(){return this.tabs.map(t=>t.key).map(t=>this.$refs[t][0]).some(t=>t.$refs.form.isDirty())},commit(){this.tabs.map(t=>t.key).map(t=>this.$refs[t][0]).forEach(t=>t.$refs.form.commit())},async validate(){return await this.$nextTick(),(await Promise.all(this.tabs.map(t=>t.key).map(t=>[t,this.$refs[t][0]]).reverse().map(async([t,e])=>!!await e.$refs.form.validate()||(this.activeTabKey=t,!1)))).every(t=>t)},watchConvertStringToNumber(){this.$watch("aProfile.frontend.port",()=>{this.aProfile.frontend.port=this.aProfile.frontend.port?parseInt(this.aProfile.frontend.port,10):null}),this.$watch("aProfile.backend.port",()=>{this.aProfile.backend.port=this.aProfile.backend.port?parseInt(this.aProfile.backend.port,10):null}),this.$watch("aProfile.proxy_connect_timeout",()=>{this.aProfile.proxy_connect_timeout=this.aProfile.proxy_connect_timeout?parseInt(this.aProfile.proxy_connect_timeout,10):null}),this.$watch("aProfile.proxy_read_timeout",()=>{this.aProfile.proxy_read_timeout=this.aProfile.proxy_read_timeout?parseInt(this.aProfile.proxy_read_timeout,10):null}),this.$watch("aProfile.proxy_send_timeout",()=>{this.aProfile.proxy_send_timeout=this.aProfile.proxy_send_timeout?parseInt(this.aProfile.proxy_send_timeout,10):null})},emitApply(t={},e,o){const n=JSON.parse(JSON.stringify(t));"*"===n.frontend.fqdn&&(n.frontend.fqdn=null),n.customize_headers=n.customize_headers.map(t=>({name:t.name,value:t.value})),this.$emit("apply",n,e,o)}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-tabs",{attrs:{"syno-id":"reverse-proxy-editor-tabs-0","has-fbar":!1,"active-tab-key":t.activeTabKey},on:{change:function(e){t.activeTabKey=e}}},t._l(t.tabs,function(e){return o("v-tab-pane",{key:e.key,attrs:{"syno-id":e.synoId,"tab-key":e.key,tab:e.title}},[o(e.component,{ref:e.key,refInFor:!0,tag:"component",attrs:{profile:t.aProfile,errors:t.errors,"is-dirty":t.isDirty,commit:t.commit,validate:t.validate},on:{apply:t.emitApply,cancel:function(e){return t.$emit("cancel")}}})],1)}),1)},[],!1,null,null,null).exports,ht=l({components:{ReverseProxyEditor:ft},mixins:[g],data:()=>({profile:{}}),methods:{async onApply(t={},e,o){try{await async function(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.ReverseProxy",method:"create",version:1,params:{entry:t}})}(t),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{staticClass:"admin-center-login-portal admin-center-login-portal--reverse_proxy",attrs:{"syno-id":"reverse-proxy-create-modal-window-0",height:560,width:600,title:t.$i18n("app_port_alias","desc_edit_reverse_proxy"),"before-close":function(){return t.$refs.editor.beforeClose()}}},[o("reverse-proxy-editor",{ref:"editor",attrs:{profile:t.profile},on:{apply:t.onApply,cancel:function(e){return t.close()}}})],1)},[],!1,null,null,null).exports,_t=l({components:{ReverseProxyEditor:ft},mixins:[g],props:{profile:{type:Object,required:!0}},methods:{async onApply(t={},e,o){try{await async function(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.ReverseProxy",method:"update",version:1,params:{entry:t}})}(t),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{staticClass:"admin-center-login-portal admin-center-login-portal--reverse_proxy",attrs:{"syno-id":"reverse-proxy-update-modal-window-0",height:560,width:600,title:t.$i18n("app_port_alias","desc_edit_reverse_proxy"),"before-close":function(){return t.$refs.editor.beforeClose()}}},[o("reverse-proxy-editor",{ref:"editor",attrs:{profile:t.profile},on:{apply:t.onApply,cancel:function(e){return t.close()}}})],1)},[],!1,null,null,null).exports,yt=l({mixins:[g,x],async mounted(){await this.$nextTick(),this.load()},computed:{contextMenuStyle(){return{top:this.contextmenuTop,left:this.contextmenuLeft}},singleSelectedRow(){return 1===this.selectedRows.length&&this.selectedRows[0]},isEditActionActive(){return!!this.singleSelectedRow},isDeleteActionActive(){return this.selectedRows.length>0},columns(){return[{title:this.$i18n("common","name"),field:"name"}]}},data:()=>({contextmenuLeft:"0px",contextmenuTop:"0px",showMenu:!1,data:[],selectedRows:[]}),methods:{async load(){this.onLoading(),this.$refs.dataTable&&this.$refs.dataTable.clearSelection();const t=await f();this.data=t&&t.entries||[],this.onDone()},async openCreateDialog(){this.updateAppWindow();const{component:t,window:e}=this.$window.openWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.CreateAccessControl_vue);e.$on("close",()=>this.load())},async openEditDialog(){if(!this.isEditActionActive)return;this.updateAppWindow();const{component:t,window:e}=this.$window.openWindow(SYNO.SDS.AdminCenter.LoginPortal.Dialogs.UpdateAccessControl_vue,{profile:this.singleSelectedRow});e.$on("close",()=>this.load())},async deleteAccessControls(){if(this.isDeleteActionActive&&"confirm"===await this.$window.getMsgBox().confirmDelete("",this.$i18n("app_port_alias","confirm_delete_profile")))try{this.onLoading();const t=this.selectedRows.map(t=>t.UUID);await async function(t=[]){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.AccessControl",method:"delete",version:1,params:{uuids:t}})}(t),this.load(),this.onDone()}catch(t){this.onError(t)}},onRightClickCell(t,e,o,n,i){i.preventDefault(),this.selectedRows=[t],this.contextmenuLeft=`${i.pageX}px`,this.contextmenuTop=`${i.pageY}px`,this.showMenu=!0},onMenuClose(){this.showMenu=!1}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{staticClass:"lp-acl-component__panel",attrs:{"fluid-footer":"","syno-id":"syno-panel-acl","has-tbar":0!==t.data.length,loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"tbar",fn:function(){return[o("v-button",{attrs:{"syno-id":"syno-btn-acl-create"},on:{click:function(e){return t.openCreateDialog()}}},[t._v("\n "+t._s(t.$i18n("common","create"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-acl-edit",disabled:!t.isEditActionActive},on:{click:function(e){return t.openEditDialog()}}},[t._v("\n "+t._s(t.$i18n("common","alt_edit"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-acl-delete",disabled:!t.isDeleteActionActive},on:{click:function(e){return t.deleteAccessControls()}}},[t._v("\n "+t._s(t.$i18n("common","delete"))+"\n ")])]},proxy:!0},{key:"body",fn:function(){return[0!==t.data.length?o("div",{staticClass:"lp-modal-content"},[o("v-data-table",{ref:"dataTable",staticClass:"data-table",attrs:{"multiple-selected":"","syno-id":"syno-table-acl",columns:t.columns,"current-data":t.data},on:{refresh:function(e){return t.load()},rowclick:function(e){t.selectedRows=e.rows},rowdblclick:function(e){return t.openEditDialog()},"cell-contextmenu":t.onRightClickCell},scopedSlots:t._u([{key:"name",fn:function(e){var n=e.row.name;return[o("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:{overflowOnly:!0,content:n},expression:"{ overflowOnly: true, content: name }"}],domProps:{textContent:t._s(n)}})]}}],null,!1,4268715404)}),t._v(" "),t.showMenu?o("v-portal",{attrs:{"mount-to":"body","target-style":t.contextMenuStyle}},[o("v-menu",{attrs:{"syno-id":"reverse-proxy-index-menu-0","close-on-select":""},on:{"menu-close":t.onMenuClose}},[o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-index-menu-item-1",title:t.$i18n("common","alt_edit"),disabled:!t.isEditActionActive},on:{click:function(e){return t.openEditDialog()}}}),t._v(" "),o("v-menu-item",{attrs:{"syno-id":"reverse-proxy-index-menu-item-2",title:t.$i18n("common","delete"),disabled:!t.isDeleteActionActive},on:{click:function(e){return t.deleteAccessControls()}}})],1)],1):t._e()],1):o("v-empty-view",{attrs:{"syno-id":"syno-empty-view-acl"},on:{"action-click":function(e){return t.openCreateDialog()}}})]},proxy:!0},{key:"fbar",fn:function(){return[o("div",{staticClass:"default pull-right"},[o("v-button",{attrs:{"syno-id":"access-control-index-button-0",type:"footbar"},on:{click:function(e){return t.onCancel()}}},[t._v("\n "+t._s(t.$i18n("common","close"))+"\n ")])],1)]},proxy:!0}])})},[],!1,null,null,null),gt=l({components:{AccessControl:yt.exports},mixins:[g]},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{attrs:{"syno-id":"syno-modal-acl",height:450,width:680,title:t.$i18n("app_port_alias","title_access_control")}},[o("div",{staticClass:"lp-modal-content-wrapper"},[o("access-control",{on:{apply:function(e){return t.close()},cancel:function(e){return t.close()}}})],1)])},[],!1,null,null,null).exports,vt={mixins:[x],props:{profile:{type:Object,default:()=>{},required:!0}},computed:{columns(){return[{title:this.$i18n("app_port_alias","desc_source_ip_or_cidr"),field:"address",disableSort:!0},{title:this.$i18n("app_port_alias","desc_allow_or_deny"),field:"access",disableSort:!0}]},accessOptions(){return[{label:this.$i18n("app_port_alias","desc_allow"),value:!0},{label:this.$i18n("app_port_alias","desc_deny"),value:!1}]},rules:()=>n,nameRules(){const t=this.allProfiles.filter(t=>t.UUID!==this.profile.UUID).map(t=>t.name);return A(t)}},async mounted(){await this.fetchPropfiles(),this.fillDefaultProfileNameWhenMounted()},data:()=>({dataProperty:"profile",selected:null,allProfiles:[]}),methods:{async fetchPropfiles(){this.onLoading();const t=await f();this.allProfiles=t&&t.entries||[],this.onDone()},async fillDefaultProfileNameWhenMounted(){if(""!==this.profile.name)return;const t=this.allProfiles.map(t=>t.name),e=this.$i18n("app_port_alias","desc_new_profile");for(let o=e,n=2;n<1e3;o=`${e} (${n++})`)if(t.every(t=>t!==o)){this.profile.name=o;break}await this.$nextTick(),this._commit()},appendRule(){this.profile.rules.push({address:"",access:!0})},async deleteRule(){this.selected&&"confirm"===await this.$window.getMsgBox().confirmDelete("",this.$i18n("app_port_alias","confirm_delete_proxy"))&&(this.profile.rules.splice(this.selected.index,1),this.$refs.dataTable.clearSelection())}}},bt=(o(38),l(vt,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-panel",{staticClass:"login-portal-acl lp-acl-editor__panel",attrs:{"syno-id":"syno-panel-lp-acl-editor",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,"confirm-text":t.$i18n("common","save"),confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"lp-modal-content"},[o("v-form",{ref:"form",staticClass:"lp-acl-editor__content-container",attrs:{"syno-id":"syno-form-lp-acl-editor"}},[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-acl-editor-name",prop:"p-lp-acl-editor-name",rules:t.nameRules,label:t.$i18n("app_port_alias","profile_name")+t.$i18n("common","colon")}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-acl-editor-name",name:"p-lp-acl-editor-name"},model:{value:t.profile.name,callback:function(e){t.$set(t.profile,"name",e)},expression:"profile.name"}})],1),t._v(" "),o("v-fieldset",{staticClass:"lp-acl-editor__fieldset",attrs:{"syno-id":"syno-fieldset-lp-acl-cidr",title:t.$i18n("app_port_alias","access_control_rules"),collapsible:!1}},[o("div",{staticClass:"lp-acl-editor__rules-toolbar"},[o("v-button",{attrs:{"syno-id":"syno-btn-lp-acl-cidr-add"},on:{click:function(e){return t.appendRule()}}},[t._v("\n "+t._s(t.$i18n("common","create"))+"\n ")]),t._v(" "),o("v-button",{attrs:{"syno-id":"syno-btn-lp-acl-cidr-del",disabled:!t.selected},on:{click:function(e){return t.deleteRule()}}},[t._v("\n "+t._s(t.$i18n("common","delete"))+"\n ")])],1),t._v(" "),o("v-data-table",{ref:"dataTable",staticClass:"lp-acl-editor__data-table",attrs:{"syno-id":"syno-table-lp-acl-cidr-rules","is-draggable":"",columns:t.columns,"current-data":t.profile.rules},on:{reorder:function(e){t.profile.rules=e.data},rowclick:function(e){t.selected=e},rowclear:function(e){t.selected=null}},scopedSlots:t._u([{key:"th",fn:function(e){var n=e.title;return["address"===e.column.field?[t._v("\n "+t._s(n)+"\n "),o("v-whitetip",{attrs:{"syno-id":"syno-lp-acl-whitetip-cidr",content:t.$i18n("controlpanel","tip_source_ip_or_cidr")}})]:t._e()]}},{key:"address",fn:function(e){var n=e.row;return[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-acl-cidr-rule-address",prop:"p-lp-acl-cidr-rule-address",rules:t.rules.accessControlCidrRules}},[o("v-input",{attrs:{"syno-id":"syno-input-lp-acl-cidr-rule-address",name:"p-lp-acl-cidr-rule-address",placeholder:t.$i18n("app_port_alias","desc_all")},model:{value:n.address,callback:function(e){t.$set(n,"address",e)},expression:"rule.address"}})],1)]}},{key:"access",fn:function(e){var n=e.row;return[o("v-form-item",{attrs:{"syno-id":"syno-form-item-lp-acl-cidr-rule-access",prop:"p-lp-acl-cidr-rule-access"}},[o("v-select",{attrs:{"syno-id":"syno-select-lp-acl-cidr-rule-access",name:"p-lp-acl-cidr-rule-access",readonly:"",width:"",options:t.accessOptions},model:{value:n.access,callback:function(e){t.$set(n,"access",e)},expression:"rule.access"}})],1)]}}])}),t._v(" "),o("v-form-item",{staticClass:"login-portal-acl-foot-note-form-item",attrs:{textonly:"","hide-label":"","syno-id":"syno-form-item-acl-foot-note"}},[o("span",{staticClass:"ac-lp-text-note"},[t._v(t._s(t.$i18n("common","note"))+t._s(t.$i18n("common","colon")))]),t._v("\n "+t._s(t.$i18n("controlpanel","note_source_ip_or_cidr"))+"\n ")])],1)],1)],1)]},proxy:!0}])})},[],!1,null,null,null).exports),wt=l({components:{AccessControlEditor:bt},mixins:[g],data:()=>({profile:{name:"",rules:[]}}),methods:{async onApply(t,e,o){const n=JSON.parse(JSON.stringify(t));n.rules=n.rules.map(t=>({address:t.address,access:t.access}));try{await async function(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.AccessControl",method:"create",version:1,params:t})}({entry:n}),this.$window.$emit("success",n),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{attrs:{"syno-id":"syno-modal-acl-create",height:420,width:720,title:t.$i18n("app_port_alias","title_edit_access_control"),"before-close":function(){return t.$refs.editor.beforeClose()}}},[o("div",{staticClass:"lp-modal-content-wrapper"},[o("access-control-editor",{ref:"editor",attrs:{profile:t.profile},on:{apply:t.onApply,cancel:function(e){return t.close()}}})],1)])},[],!1,null,null,null).exports,xt=l({components:{AccessControlEditor:bt},mixins:[g],props:{profile:{type:Object,required:!0}},data(){return{currentProfile:JSON.parse(JSON.stringify(this.profile))}},methods:{async onApply(t,e,o){const n=JSON.parse(JSON.stringify(t));n.rules=n.rules.map(t=>({address:t.address,access:t.access}));try{await async function(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.AccessControl",method:"update",version:1,params:t})}({entry:n}),e(),this.close()}catch(t){o(t)}}}},function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{attrs:{"syno-id":"syno-modal-acl-update",height:420,width:720,title:t.$i18n("app_port_alias","title_edit_access_control"),"before-close":function(){return t.$refs.editor.beforeClose()}}},[o("div",{staticClass:"lp-modal-content-wrapper"},[t.profile?o("access-control-editor",{ref:"editor",attrs:{profile:t.currentProfile},on:{apply:t.onApply,cancel:function(e){return t.close()}}}):t._e()],1)])},[],!1,null,null,null).exports,St={mixins:[g,x],mounted(){this.load(),this.$on("apply",this._onApply),this.$on("cancel",this._onCancel)},data:()=>({dataProperty:"appPortalConfig",appPortalConfig:{}}),methods:{async load(){this.onLoading(),this.appPortalConfig=await async function(){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.Config",version:1,method:"get"})}(),await this.$nextTick(),this.$refs.form.commit(),this.onDone()},async _onApply(t,e,o){try{await async function(t={}){return await synowebapi.promises.request({api:"SYNO.Core.AppPortal.Config",version:1,method:"set",params:t})}(t),e(),this.close()}catch(t){o(t)}},_onCancel(){this.close()}}},$t=(o(39),l(St,function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("v-modal-window",{attrs:{"syno-id":"syno-lp-modal-options",height:"auto",width:480,title:t.$i18n("login_portal","network_option_header"),"before-close":function(){return t.beforeClose()}}},[o("div",{staticClass:"lp-modal-content-wrapper"},[o("v-panel",{staticClass:"lp-options-dialog__panel",attrs:{"syno-id":"syno-lp-panel-options","fluid-footer":"",loading:t.spinner.isLoading,"loading-type":t.spinner.loadingType,"show-status-bar":t.spinner.showStatusBar,"status-bar-state":t.spinner.statusBarState,"error-text":t.spinner.errorText,confirm:function(){return t.onApply()},cancel:function(){return t.onCancel()}},on:{"update:showStatusBar":function(e){return t.$set(t.spinner,"showStatusBar",e)},"update:show-status-bar":function(e){return t.$set(t.spinner,"showStatusBar",e)}},scopedSlots:t._u([{key:"body",fn:function(){return[o("div",{staticClass:"lp-modal-content lp-modal-content--bottom-padding"},[o("v-form",{ref:"form",attrs:{"syno-id":"syno-lp-form-options"}},[o("v-form-item",{attrs:{"syno-id":"syno-lp-form-item-options-show-titlebar","hide-label":"",prop:"p-lp-options-show-titlebar"}},[o("v-checkbox",{attrs:{"syno-id":"syno-lp-checkbox-options-show-titlebar",name:"p-lp-options-show-titlebar",value:!t.appPortalConfig.show_titlebar},on:{input:function(e){t.appPortalConfig.show_titlebar=!e}}},[t._v("\n "+t._s(t.$i18n("common","remove_banner"))+"\n ")])],1),t._v(" "),o("v-form-item",{attrs:{"syno-id":"syno-lp-form-item-options-show-titlebar-desc","hide-label":"",indent:"1"}},[t._v("\n "+t._s(t.$i18n("common","remove_banner_desc"))+"\n ")])],1)],1)]},proxy:!0}])})],1)])},[],!1,null,null,null).exports);o(40),Ext.namespace("SYNO.SDS.AdminCenter.LoginPortal"),SYNO.SDS.AdminCenter.LoginPortal.Main_vue=r.a.extend({template:"",components:{LpMain:K}}),Ext.namespace("SYNO.SDS.AdminCenter.LoginPortal.Dialogs"),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.ApplicationEditor_vue=r.a.extend({template:"",components:{LpApplicationEditor:G}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.LoginStyleEditor_vue=r.a.extend({template:"",components:{LpLoginStyleEditor:nt}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.ReverseProxy_vue=r.a.extend({template:"",components:{LpReverseProxy:rt}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.CreateReverseProxy_vue=r.a.extend({template:"",components:{LpCreateReverseProxy:ht}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.UpdateReverseProxy_vue=r.a.extend({template:'',components:{LpUpdateReverseProxy:_t},props:{profile:{type:Object,required:!0}}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.AccessControl_vue=r.a.extend({template:"",components:{LpAccessControl:gt}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.CreateAccessControl_vue=r.a.extend({template:"",components:{LpCreateAccessControl:wt}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.UpdateAccessControl_vue=r.a.extend({template:'',components:{LpUpdateAccessControl:xt},props:{profile:{type:Object,required:!0}}}),SYNO.SDS.AdminCenter.LoginPortal.Dialogs.Options_vue=r.a.extend({template:"",components:{LpOptions:$t}})}]);