/*! For license information please see theming-personal-theming.js.LICENSE.txt */ !function(){"use strict";var n,e={10106:function(n,e,r){var a=r(20144),o=r(79753),i=r(16453),c=r(4820),s=r(20571),l=r.n(s),u=r(13299),d=r.n(u),g=r(14625),m=r(31894),p=r(20296),h=r.n(p),f=r(69867),A=r.n(f),b=r(15168),v=r.n(b),k=r(1082),C=r.n(k),_=(r(97248),r(26932)),y=r(22200);function w(n,e,t,r,a,o,i){try{var c=n[o](i),s=c.value}catch(n){return void t(n)}c.done?e(s):Promise.resolve(s).then(r,a)}function x(n){return function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(n){w(o,r,a,i,c,"next",n)}function c(n){w(o,r,a,i,c,"throw",n)}i(void 0)}))}}function S(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t.6},calculateLuma:function(n){var e,t,r=(e=this.hexToRGB(n),t=3,function(n){if(Array.isArray(n))return n}(e)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,a,o=[],i=!0,c=!1;try{for(t=t.call(n);!(i=(r=t.next()).done)&&(o.push(r.value),!e||o.length!==e);i=!0);}catch(n){c=!0,a=n}finally{try{i||null==t.return||t.return()}finally{if(c)throw a}}return o}}(e,t)||function(n,e){if(n){if("string"==typeof n)return S(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?S(n,e):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return(.2126*r[0]+.7152*r[1]+.0722*r[2])/255},hexToRGB:function(n){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null},update:function(n){var e=this;return x(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.backgroundImage=n.backgroundImage,e.backgroundColor=n.backgroundColor,e.Theming.color=n.backgroundColor,e.$emit("update:background"),e.loading=!1;case 5:case"end":return t.stop()}}),t)})))()},setDefault:function(){var n=this;return x(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading="default",e.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/default"));case 3:t=e.sent,n.update(t.data);case 5:case"end":return e.stop()}}),e)})))()},setShipped:function(n){var e=this;return x(regeneratorRuntime.mark((function t(){var r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading=n,t.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/shipped"),{value:n});case 3:r=t.sent,e.update(r.data);case 5:case"end":return t.stop()}}),t)})))()},setFile:function(n){var e=arguments,t=this;return x(regeneratorRuntime.mark((function r(){var a,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=e.length>1&&void 0!==e[1]?e[1]:null,t.loading="custom",r.next=4,c.default.post((0,o.generateUrl)("/apps/theming/background/custom"),{value:n,color:a});case 4:i=r.sent,t.update(i.data);case 6:case"end":return r.stop()}}),r)})))()},removeBackground:function(){var n=this;return x(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading="remove",e.next=3,c.default.delete((0,o.generateUrl)("/apps/theming/background/custom"));case 3:t=e.sent,n.update(t.data);case 5:case"end":return e.stop()}}),e)})))()},pickColor:function(n){var e=this;return x(regeneratorRuntime.mark((function t(){var r,a,i,s,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading="color",s=(null==n||null===(r=n.target)||void 0===r||null===(a=r.dataset)||void 0===a?void 0:a.color)||(null===(i=e.Theming)||void 0===i?void 0:i.color)||"#0082c9",t.next=4,c.default.post((0,o.generateUrl)("/apps/theming/background/color"),{color:s});case 4:l=t.sent,e.update(l.data);case 6:case"end":return t.stop()}}),t)})))()},debouncePickColor:h()((function(){this.pickColor.apply(this,arguments)}),200),pickFile:function(){var n=this;return x(regeneratorRuntime.mark((function e(){var t,r,a,i,s,l,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R.pick();case 2:return t=e.sent,n.loading="custom",r=null,a=null,e.prev=6,s=(0,o.generateRemoteUrl)("dav/files/"+(0,y.getCurrentUser)().uid+t),e.next=10,c.default.get(s,{responseType:"blob"});case 10:return r=e.sent,l=URL.createObjectURL(r.data),e.next=14,n.getColorPaletteFromBlob(l);case 14:u=e.sent,a=null==u||null===(i=u.DarkVibrant)||void 0===i?void 0:i.hex,n.setFile(t,a),console.debug("Extracted colour",a,"from custom image",t,u),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(6),n.setFile(t),console.error("Unable to extract colour from custom image",{error:e.t0,path:t,response:r,color:a});case 24:case"end":return e.stop()}}),e,null,[[6,20]])})))()},getColorPaletteFromBlob:function(n){return new Promise((function(e,t){new(C())(n).getPalette((function(n,r){n&&t(n),e(r)}))}))}}},O=U,j=r(93379),G=r.n(j),Z=r(7795),F=r.n(Z),q=r(90569),L=r.n(q),N=r(3565),$=r.n(N),M=r(19216),z=r.n(M),W=r(44589),K=r.n(W),Y=r(18208),H={};H.styleTagTransform=K(),H.setAttributes=$(),H.insert=L().bind(null,"head"),H.domAPI=F(),H.insertStyleElement=z(),G()(Y.Z,H),Y.Z&&Y.Z.locals&&Y.Z.locals;var V=r(51900),Q=(0,V.Z)(O,(function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("div",{staticClass:"background-selector",attrs:{"data-user-theming-background-settings":""}},[t("button",{staticClass:"background background__filepicker",class:{"icon-loading":"custom"===n.loading,"background--active":"custom"===n.backgroundImage},attrs:{"data-color-bright":n.invertTextColor(n.Theming.color),"data-user-theming-background-custom":"",tabindex:"0"},on:{click:n.pickFile}},[n._v("\n\t\t"+n._s(n.t("theming","Custom background"))+"\n\t\t"),t("Check",{attrs:{size:44}})],1),n._v(" "),t("button",{staticClass:"background background__default",class:{"icon-loading":"default"===n.loading,"background--active":"default"===n.backgroundImage},style:{"--border-color":n.Theming.defaultColor},attrs:{"data-color-bright":n.invertTextColor(n.Theming.defaultColor),"data-user-theming-background-default":"",tabindex:"0"},on:{click:n.setDefault}},[n._v("\n\t\t"+n._s(n.t("theming","Default background"))+"\n\t\t"),t("Check",{attrs:{size:44}})],1),n._v(" "),t("NcColorPicker",{on:{input:n.debouncePickColor},model:{value:n.Theming.color,callback:function(e){n.$set(n.Theming,"color",e)},expression:"Theming.color"}},[t("button",{staticClass:"background background__color",style:{backgroundColor:n.Theming.color,"--border-color":n.Theming.color},attrs:{"data-color":n.Theming.color,"data-color-bright":n.invertTextColor(n.Theming.color),"data-user-theming-background-color":"",tabindex:"0"}},[n._v("\n\t\t\t"+n._s(n.t("theming","Change color"))+"\n\t\t")])]),n._v(" "),n._l(n.shippedBackgrounds,(function(e){return t("button",{directives:[{name:"tooltip",rawName:"v-tooltip",value:e.details.attribution,expression:"shippedBackground.details.attribution"}],key:e.name,staticClass:"background background__shipped",class:{"icon-loading":n.loading===e.name,"background--active":n.backgroundImage===e.name},style:{backgroundImage:"url("+e.preview+")","--border-color":e.details.primary_color},attrs:{"data-color-bright":"dark"===e.details.theming,"data-user-theming-background-shipped":e.name,tabindex:"0"},on:{click:function(t){return n.setShipped(e.name)}}},[t("Check",{attrs:{size:44}})],1)})),n._v(" "),t("button",{staticClass:"background background__delete",attrs:{"data-user-theming-background-clear":"",tabindex:"0"},on:{click:n.removeBackground}},[n._v("\n\t\t"+n._s(n.t("theming","Remove background"))+"\n\t\t"),t("Close",{attrs:{size:32}})],1)],2)}),[],!1,null,"16031e91",null).exports,J={name:"ItemPreview",components:{NcCheckboxRadioSwitch:l()},props:{enforced:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},theme:{type:Object,required:!0},type:{type:String,default:""},unique:{type:Boolean,default:!1}},computed:{switchType:function(){return this.unique?"switch":"radio"},name:function(){return this.unique?null:this.type},img:function(){return(0,o.generateFilePath)("theming","img",this.theme.id+".jpg")},checked:{get:function(){return this.selected},set:function(n){console.debug("Changed theme",this.theme.id,n),this.unique?this.$emit("change",{enabled:!0===n,id:this.theme.id}):this.$emit("change",{enabled:!0,id:this.theme.id})}}},methods:{onToggle:function(){"radio"!==this.switchType?this.checked=!this.checked:this.checked=!0}}},X=r(83005),nn={};nn.styleTagTransform=K(),nn.setAttributes=$(),nn.insert=L().bind(null,"head"),nn.domAPI=F(),nn.insertStyleElement=z(),G()(X.Z,nn),X.Z&&X.Z.locals&&X.Z.locals;var en=(0,V.Z)(J,(function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("div",{staticClass:"theming__preview",class:"theming__preview--"+n.theme.id},[t("div",{staticClass:"theming__preview-image",style:{backgroundImage:"url("+n.img+")"},on:{click:n.onToggle}}),n._v(" "),t("div",{staticClass:"theming__preview-description"},[t("h3",[n._v(n._s(n.theme.title))]),n._v(" "),t("p",[n._v(n._s(n.theme.description))]),n._v(" "),n.enforced?t("span",{staticClass:"theming__preview-warning",attrs:{role:"note"}},[n._v("\n\t\t\t"+n._s(n.t("theming","Theme selection is enforced"))+"\n\t\t")]):n._e(),n._v(" "),t("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:n.checked,disabled:n.enforced,name:n.name,type:n.switchType},on:{"update:checked":function(e){n.checked=e}}},[n._v("\n\t\t\t"+n._s(n.theme.enableLabel)+"\n\t\t")])],1)])}),[],!1,null,"37ca8ab2",null).exports;function tn(n,e,t,r,a,o,i){try{var c=n[o](i),s=c.value}catch(n){return void t(n)}c.done?e(s):Promise.resolve(s).then(r,a)}function rn(n){return function(){var e=this,t=arguments;return new Promise((function(r,a){var o=n.apply(e,t);function i(n){tn(o,r,a,i,c,"next",n)}function c(n){tn(o,r,a,i,c,"throw",n)}i(void 0)}))}}function an(n){return function(n){if(Array.isArray(n))return on(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||function(n,e){if(n){if("string"==typeof n)return on(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?on(n,e):void 0}}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function on(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t")},guidelinesLink:function(){return''},descriptionDetail:function(){return t("theming","If you find any issues, do not hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!").replace("{issuetracker}",this.issuetrackerLink).replace("{designteam}",this.designteamLink).replace(/\{linkend\}/g,"")},issuetrackerLink:function(){return''},designteamLink:function(){return''}},watch:{shortcutsDisabled:function(n){this.changeShortcutsDisabled(n)}},methods:{refreshGlobalStyles:function(){an(document.head.querySelectorAll("link.theme")).forEach((function(n){var e=new URL(n.href);e.searchParams.set("v",Date.now());var t=n.cloneNode();t.href=e.toString(),t.onload=function(){return n.remove()},document.head.append(t)}))},updateBackground:function(n){this.background="custom"===n.type||"default"===n.type?n.type:n.value,this.refreshGlobalStyles()},changeTheme:function(n){var e=n.enabled,t=n.id;this.themes.forEach((function(n){n.id===t&&e?n.enabled=!0:n.enabled=!1})),this.updateBodyAttributes(),this.selectItem(e,t)},changeFont:function(n){var e=n.enabled,t=n.id;this.fonts.forEach((function(n){n.id===t&&e?n.enabled=!0:n.enabled=!1})),this.updateBodyAttributes(),this.selectItem(e,t)},changeShortcutsDisabled:function(n){return rn(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=5;break}return e.next=3,(0,c.default)({url:(0,o.generateOcsUrl)("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),data:{configValue:"yes"},method:"POST"});case 3:e.next=7;break;case 5:return e.next=7,(0,c.default)({url:(0,o.generateOcsUrl)("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),method:"DELETE"});case 7:case"end":return e.stop()}}),e)})))()},updateBodyAttributes:function(){var n=this.themes.filter((function(n){return!0===n.enabled})).map((function(n){return n.id})),e=this.fonts.filter((function(n){return!0===n.enabled})).map((function(n){return n.id}));this.themes.forEach((function(n){document.body.toggleAttribute("data-theme-".concat(n.id),n.enabled)})),this.fonts.forEach((function(n){document.body.toggleAttribute("data-theme-".concat(n.id),n.enabled)})),document.body.setAttribute("data-themes",[].concat(an(n),an(e)).join(","))},selectItem:function(n,e){return rn(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,!n){r.next=6;break}return r.next=4,(0,c.default)({url:(0,o.generateOcsUrl)("apps/theming/api/v1/theme/{themeId}/enable",{themeId:e}),method:"PUT"});case 4:r.next=8;break;case 6:return r.next=8,(0,c.default)({url:(0,o.generateOcsUrl)("apps/theming/api/v1/theme/{themeId}",{themeId:e}),method:"DELETE"});case 8:r.next=14;break;case 10:r.prev=10,r.t0=r.catch(0),console.error(r.t0,r.t0.response),OC.Notification.showTemporary(t("theming",r.t0.response.data.ocs.meta.message+". Unable to apply the setting."));case 14:case"end":return r.stop()}}),r,null,[[0,10]])})))()}}},gn=r(7013),mn={};mn.styleTagTransform=K(),mn.setAttributes=$(),mn.insert=L().bind(null,"head"),mn.domAPI=F(),mn.insertStyleElement=z(),G()(gn.Z,mn),gn.Z&&gn.Z.locals&&gn.Z.locals;var pn=(0,V.Z)(dn,(function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("section",[t("NcSettingsSection",{staticClass:"theming",attrs:{title:n.t("theming","Appearance and accessibility"),"limit-width":!1}},[t("p",{domProps:{innerHTML:n._s(n.description)}}),n._v(" "),t("p",{domProps:{innerHTML:n._s(n.descriptionDetail)}}),n._v(" "),t("div",{staticClass:"theming__preview-list"},n._l(n.themes,(function(e){return t("ItemPreview",{key:e.id,attrs:{enforced:e.id===n.enforceTheme,selected:n.selectedTheme.id===e.id,theme:e,unique:1===n.themes.length,type:"theme"},on:{change:n.changeTheme}})})),1),n._v(" "),t("div",{staticClass:"theming__preview-list"},n._l(n.fonts,(function(e){return t("ItemPreview",{key:e.id,attrs:{selected:e.enabled,theme:e,unique:1===n.fonts.length,type:"font"},on:{change:n.changeFont}})})),1)]),n._v(" "),t("NcSettingsSection",{attrs:{title:n.t("theming","Keyboard shortcuts")}},[t("p",[n._v(n._s(n.t("theming","In some cases keyboard shortcuts can interfere with accessibility tools. In order to allow focusing on your tool correctly you can disable all keyboard shortcuts here. This will also disable all available shortcuts in apps.")))]),n._v(" "),t("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:n.shortcutsDisabled,name:"shortcuts_disabled",type:"switch"},on:{"update:checked":function(e){n.shortcutsDisabled=e},change:n.changeShortcutsDisabled}},[n._v("\n\t\t\t"+n._s(n.t("theming","Disable all keyboard shortcuts"))+"\n\t\t")])],1),n._v(" "),t("NcSettingsSection",{staticClass:"background",attrs:{title:n.t("theming","Background")}},[n.isUserThemingDisabled?[t("p",[n._v(n._s(n.t("theming","Customization has been disabled by your administrator")))])]:[t("p",[n._v(n._s(n.t("theming","Set a custom background")))]),n._v(" "),t("BackgroundSettings",{staticClass:"background__grid",on:{"update:background":n.refreshGlobalStyles}})]],2)],1)}),[],!1,null,"f871767a",null).exports;function hn(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t=o)&&Object.keys(a.O).every((function(n){return a.O[n](t[s])}))?t.splice(s--,1):(c=!1,o0&&n[u-1][2]>o;u--)n[u]=n[u-1];n[u]=[t,r,o]},a.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(e,{a:e}),e},a.d=function(n,e){for(var t in e)a.o(e,t)&&!a.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),a.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.nmd=function(n){return n.paths=[],n.children||(n.children=[]),n},a.j=1474,function(){a.b=document.baseURI||self.location.href;var n={1474:0};a.O.j=function(e){return 0===n[e]};var e=function(e,t){var r,o,i=t[0],c=t[1],s=t[2],l=0;if(i.some((function(e){return 0!==n[e]}))){for(r in c)a.o(c,r)&&(a.m[r]=c[r]);if(s)var u=s(a)}for(e&&e(t);l