/*! third party licenses: js/vendor.LICENSE.txt */ import{r as xi,a as zi,V as ni}from"./style-D0wtco2u.chunk.mjs";import{g as Ii,n as Ci,N as Li,s as ri,a as yi,c as Mi,v as Ui,l as Ri}from"./_plugin-vue2_normalizer-YsIULHZS.chunk.mjs";import{N as Pi,B as M}from"./BrowserStorage-DTUWn1PX.chunk.mjs";import{N as Bi}from"./NcSettingsSection-DP3xDXrA-Dy5u8jq0.chunk.mjs";var W={exports:{}},ji=W.exports,Si;function Hi(){return Si||(Si=1,function(r,m){(function(g,h){var E="1.0.40",A="",si="?",Z="function",R="undefined",X="object",P="string",ci="major",e="model",a="name",i="type",o="vendor",s="version",_="architecture",D="console",b="mobile",l="tablet",v="smarttv",y="wearable",J="embedded",Q=500,B="Amazon",O="Apple",di="ASUS",bi="BlackBerry",j="Browser",H="Chrome",Ti="Edge",Y="Firefox",z="Google",li="Huawei",K="LG",ii="Microsoft",wi="Motorola",I="Opera",C="Samsung",ui="Sharp",V="Sony",ei="Xiaomi",oi="Zebra",pi="Facebook",mi="Chromium OS",fi="Mac OS",gi=" Browser",qi=function(w,u){var d={};for(var f in w)u[f]&&u[f].length%2===0?d[f]=u[f].concat(w[f]):d[f]=w[f];return d},F=function(w){for(var u={},d=0;d0?p.length===2?typeof p[1]==Z?this[p[0]]=p[1].call(this,N):this[p[0]]=p[1]:p.length===3?typeof p[1]===Z&&!(p[1].exec&&p[1].test)?this[p[0]]=N?p[1].call(this,N,p[2]):h:this[p[0]]=N?N.replace(p[1],p[2]):h:p.length===4&&(this[p[0]]=N?p[3].call(this,N.replace(p[1],p[2])):h):this[p]=N||h;d+=2}},$=function(w,u){for(var d in u)if(typeof u[d]===X&&u[d].length>0){for(var f=0;f2&&(c[e]="iPad",c[i]=l),c},this.getEngine=function(){var c={};return c[a]=h,c[s]=h,L.call(c,f,x.engine),c},this.getOS=function(){var c={};return c[a]=h,c[s]=h,L.call(c,f,x.os),p&&!c[a]&&S&&S.platform&&S.platform!="Unknown"&&(c[a]=S.platform.replace(/chrome os/i,mi).replace(/macos/i,fi)),c},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return f},this.setUA=function(c){return f=typeof c===P&&c.length>Q?ai(c,Q):c,this},this.setUA(f),this};k.VERSION=E,k.BROWSER=F([a,s,ci]),k.CPU=F([_]),k.DEVICE=F([e,o,i,D,b,v,l,y,J]),k.ENGINE=k.OS=F([a,s]),r.exports&&(m=r.exports=k),m.UAParser=k;var q=typeof g!==R&&(g.jQuery||g.Zepto);if(q&&!q.ua){var G=new k;q.ua=G.getResult(),q.ua.get=function(){return G.getUA()},q.ua.set=function(w){G.setUA(w);var u=G.getResult();for(var d in u)q.ua[d]=u[d]}}})(typeof window=="object"?window:ji)}(W,W.exports)),W.exports}var Yi=Hi();const Vi=Ii(Yi),U={EMAIL_SEND_OFF:0,EMAIL_SEND_HOURLY:1,EMAIL_SEND_3HOURLY:2,EMAIL_SEND_DAILY:3,EMAIL_SEND_WEEKLY:4},Fi=[{text:t("notifications","Never"),value:U.EMAIL_SEND_OFF},{text:t("notifications","1 hour"),value:U.EMAIL_SEND_HOURLY},{text:t("notifications","3 hours"),value:U.EMAIL_SEND_3HOURLY},{text:t("notifications","1 day"),value:U.EMAIL_SEND_DAILY},{text:t("notifications","1 week"),value:U.EMAIL_SEND_WEEKLY}],Ni={id:null,label:t("notifications","None")},$i=new Vi,Ei=$i.getBrowser(),Ai=Ei.name==="Safari"||Ei.name==="Mobile Safari",Gi={name:"UserSettings",components:{NcCheckboxRadioSwitch:Li,NcSelect:Pi,NcSettingsSection:Bi},setup(){const r=xi(Ri("notifications","config")),m=xi({secondary_speaker:M.getItem("secondary_speaker")==="true",secondary_speaker_device:JSON.parse(M.getItem("secondary_speaker_device"))??Ni}),g=zi([]);return{BATCHTIME_OPTIONS:Fi,isSafari:Ai,config:r,storage:m,devices:g}},methods:{async updateSettings(){try{const r=new FormData;r.append("batchSetting",this.config.setting_batchtime),r.append("soundNotification",this.config.sound_notification?"yes":"no"),r.append("soundTalk",this.config.sound_talk?"yes":"no"),await Mi.post(Ui("apps/notifications/api/v2/settings"),r),yi(t("notifications","Your settings have been updated."))}catch(r){ri(t("notifications","An error occurred while updating your settings.")),console.error(r)}},updateLocalSettings(){try{M.setItem("secondary_speaker",this.storage.secondary_speaker),this.storage.secondary_speaker&&this.storage.secondary_speaker_device.id?M.setItem("secondary_speaker_device",JSON.stringify(this.storage.secondary_speaker_device)):M.removeItem("secondary_speaker_device"),yi(t("notifications","Your settings have been updated."))}catch(r){ri(t("notifications","An error occurred while updating your settings.")),console.error(r)}},async initializeDevices(){if(!(!Ai&&navigator?.mediaDevices?.getUserMedia&&navigator?.mediaDevices?.enumerateDevices)||this.devices.length>0)return;let r=null;try{r=await navigator.mediaDevices.getUserMedia({audio:!0}),this.devices=(await navigator.mediaDevices.enumerateDevices()??[]).filter(m=>m.kind==="audiooutput").map(m=>({id:m.deviceId,label:m.label?m.label:m.fallbackLabel})).concat([Ni])}catch(m){ri(t("notifications","An error occurred while updating your settings.")),console.error("Error while requesting or initializing audio devices: ",m)}finally{r&&r.getTracks().forEach(m=>m.stop())}}}};var Wi=function(){var r=this,m=r._self._c;return m("NcSettingsSection",{attrs:{name:r.t("notifications","Notifications")}},[m("div",{staticClass:"notification-frequency__warning"},[r.config.is_email_set?r._e():m("strong",[r._v(r._s(r.t("notifications","You need to set up your email address before you can receive notification emails.")))])]),m("p",[m("label",{staticClass:"notification-frequency__label",attrs:{for:"notification_reminder_batchtime"}},[r._v(" "+r._s(r.t("notifications","Send email reminders about unhandled notifications after:"))+" ")]),m("select",{directives:[{name:"model",rawName:"v-model",value:r.config.setting_batchtime,expression:"config.setting_batchtime"}],staticClass:"notification-frequency__select",attrs:{id:"notification_reminder_batchtime",name:"notification_reminder_batchtime"},on:{change:[function(g){var h=Array.prototype.filter.call(g.target.options,function(E){return E.selected}).map(function(E){var A="_value"in E?E._value:E.value;return A});r.$set(r.config,"setting_batchtime",g.target.multiple?h:h[0])},function(g){return r.updateSettings()}]}},r._l(r.BATCHTIME_OPTIONS,function(g){return m("option",{key:g.value,domProps:{value:g.value}},[r._v(" "+r._s(g.text)+" ")])}),0)]),m("NcCheckboxRadioSwitch",{attrs:{checked:r.config.sound_notification},on:{"update:checked":[function(g){return r.$set(r.config,"sound_notification",g)},r.updateSettings]}},[r._v(" "+r._s(r.t("notifications","Play sound when a new notification arrives"))+" ")]),m("NcCheckboxRadioSwitch",{attrs:{checked:r.config.sound_talk},on:{"update:checked":[function(g){return r.$set(r.config,"sound_talk",g)},r.updateSettings]}},[r._v(" "+r._s(r.t("notifications","Play sound when a call started (requires Nextcloud Talk)"))+" ")]),r.config.sound_talk?[m("NcCheckboxRadioSwitch",{staticClass:"additional-margin-top",attrs:{checked:r.storage.secondary_speaker,disabled:r.isSafari},on:{"update:checked":[function(g){return r.$set(r.storage,"secondary_speaker",g)},r.updateLocalSettings]}},[r._v(" "+r._s(r.t("notifications","Also repeat sound on a secondary speaker"))+" ")]),r.isSafari?m("div",{staticClass:"notification-frequency__warning"},[m("strong",[r._v(r._s(r.t("notifications","Selection of the speaker device is currently not supported by Safari")))])]):r._e(),!r.isSafari&&r.storage.secondary_speaker?m("NcSelect",{attrs:{"input-id":"device-selector-audio-output",options:r.devices,label:"label","aria-label-combobox":r.t("notifications","Select a device"),clearable:!1,placeholder:r.t("notifications","Select a device")},on:{open:r.initializeDevices,input:r.updateLocalSettings},model:{value:r.storage.secondary_speaker_device,callback:function(g){r.$set(r.storage,"secondary_speaker_device",g)},expression:"storage.secondary_speaker_device"}}):r._e()]:r._e()],2)},Zi=[],Xi=Ci(Gi,Wi,Zi,!1,null,"25b56fc5");const Ji=Xi.exports;ni.prototype.t=t,ni.prototype.n=n,new ni({el:"#notifications-user-settings",render:r=>r(Ji)}); //# sourceMappingURL=notifications-settings.mjs.map