THANASOFT-DV/calendar/js/calendar-public-calendar-subscription-picker.js

2 lines
12 KiB
JavaScript

(self.webpackChunkcalendar=self.webpackChunkcalendar||[]).push([["public-calendar-subscription-picker"],{23888:(a,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>o});var e=t(71354),i=t.n(e),s=t(76314),r=t.n(s)()(i());r.push([a.id,".public-calendar-subscription-picker[data-v-19167f47]{padding:20px}.public-calendar-subscription-picker__attribution[data-v-19167f47]{color:var(--color-text-maxcontrast)}.public-calendar-subscription-picker__region[data-v-19167f47]{display:flex;margin-top:20px;align-items:center}.public-calendar-subscription-picker__region__name[data-v-19167f47]{flex-grow:1}.public-calendar-subscription-picker__region__name h3[data-v-19167f47]{font-weight:bold;margin-bottom:initial}.public-calendar-subscription-picker__region__name__subline[data-v-19167f47]{color:var(--color-text-maxcontrast)}","",{version:3,sources:["webpack://./src/components/Subscription/PublicCalendarSubscriptionPicker.vue"],names:[],mappings:"AACA,sDACC,YAAA,CAEA,mEACC,mCAAA,CAGD,8DACC,YAAA,CACA,eAAA,CACA,kBAAA,CAEA,oEACC,WAAA,CAEA,uEACC,gBAAA,CACA,qBAAA,CAGD,6EACC,mCAAA",sourcesContent:["\r\n.public-calendar-subscription-picker {\r\n\tpadding: 20px;\r\n\r\n\t&__attribution {\r\n\t\tcolor: var(--color-text-maxcontrast)\r\n\t}\r\n\r\n\t&__region {\r\n\t\tdisplay: flex;\r\n\t\tmargin-top: 20px;\r\n\t\talign-items: center;\r\n\r\n\t\t&__name {\r\n\t\t\tflex-grow: 1;\r\n\r\n\t\t\th3 {\r\n\t\t\t\tfont-weight: bold;\r\n\t\t\t\tmargin-bottom: initial;\r\n\t\t\t}\r\n\r\n\t\t\t&__subline {\r\n\t\t\t\tcolor: var(--color-text-maxcontrast)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t&__subscribe {}\r\n\t}\r\n}\r\n"],sourceRoot:""}]);const o=r},32424:(a,n,e)=>{"use strict";e.r(n),e.d(n,{default:()=>h});var i=e(76333),s=e(85168),r=e(95353),o=e(6934),c=e(28928);const l=JSON.parse('[{"country":"Algeria","filename":"AlgeriaHolidays.ics","datespan":"2024-2027","authors":"Imad Tbahriti"},{"country":"Australia","filename":"AustraliaHolidays.ics","datespan":"2024-2027","authors":"RGreyman"},{"country":"Austria","filename":"AustrianHolidays.ics","datespan":"2024-2027","authors":"boe"},{"country":"Belgium","filename":"BelgianHolidays.ics","datespan":"2024-2027","authors":"Hubertus Verdonck"},{"country":"Bolivia","filename":"BoliviaHolidays.ics","datespan":"2024-2027","authors":"Rebelde Boliche"},{"country":"Brazil","filename":"BrazilHolidays.ics","datespan":"2024-2027","authors":"Henrique Faria"},{"country":"Bulgaria","filename":"BulgarianHolidays.ics","datespan":"2024-2027beyond","authors":"Georgi D. Sotirov"},{"country":"Canada","filename":"CanadaHolidays.ics","datespan":"2024-2027","authors":"Sigurd Schmidt"},{"country":"Colombia","filename":"ColombianHolidays.ics","datespan":"2024-2027","authors":"Mauricio Sanchez"},{"country":"Costa Rica","filename":"CostaRicaHolidays.ics","datespan":"2024-2027","authors":"Gerardo Tovar"},{"country":"Croatia","filename":"CroatiaHolidays.ics","datespan":"2024-2027","authors":"Domagoj Debic"},{"country":"Czech","filename":"CzechHolidays.ics","datespan":"2024-2027","authors":"Martin Matula, Matěj Cepl, Peter Habcak"},{"country":"Finland (Finnish)","filename":"FinlandHolidays.ics","datespan":"2024-2027","authors":"Magnus Melin"},{"country":"Finland (Swedish)","filename":"FinlandHolidaysSwedish.ics","datespan":"2024-2027","authors":"Magnus Melin"},{"country":"Flanders","filename":"FlandersHolidays.ics","datespan":"2024-2027","authors":"Hubertus Verdonck"},{"country":"France","filename":"FrenchHolidays.ics","datespan":"2024-2027","authors":"danfra"},{"country":"Germany","filename":"GermanHolidays.ics","datespan":"2024-2027","authors":"Hagen Halbach"},{"country":"Greece","filename":"GreeceHolidays.ics","datespan":"2024-2027","authors":"Hans Kleiner"},{"country":"Haiti","filename":"HaitiHolidays.ics","authors":" Sheila Laplanche"},{"country":"Hungary","filename":"HungarianHolidays.ics","datespan":"2024-2027","authors":"spiraldancing, tozo"},{"country":"Iceland","filename":"IcelandHolidays.ics","datespan":"2024-2027","authors":"Kristjan Bjarni Gudmundsson"},{"country":"Ireland","filename":"IrelandHolidays2014-2021.ics","datespan":"2024-2027","authors":"Tom Condon"},{"country":"Italy","filename":"ItalianHolidays.ics","datespan":"2024-2027","authors":"Gianni Luppi/Gianfranco Balza"},{"country":"Japan","filename":"JapanHolidays.ics","datespan":"2024-2027","authors":"Atsushi Sakai"},{"country":"Kazakhstan (English)","filename":"KazakhstanHolidaysEnglish.ics","datespan":"2024-2027","authors":"Yuriy Gural"},{"country":"Kazakhstan (Russian)","filename":"KazakhstanHolidaysRussian.ics","datespan":"2024-2027","authors":"Yuriy Gural"},{"country":"Liechtenstein","filename":"LiechtensteinHolidays.ics","datespan":"2024-2027","authors":"boe"},{"country":"Lithuania","filename":"LithuanianHolidays.ics","datespan":"2024-2027","authors":"joshas"},{"country":"Morocco","filename":"MoroccoHolidays.ics","authors":"Tarik El Maniani"},{"country":"Netherlands","filename":"DutchHolidays.ics","datespan":"2024-2027","authors":"Pander, RobJE"},{"country":"Netherlands (English)","filename":"DutchHolidaysEnglish.ics","datespan":"2024-2027","authors":"Pander"},{"country":"Netherlands (German)","filename":"DutchHolidaysGerman.ics","datespan":"2024-2027","authors":"Pander"},{"country":"Netherlands (French)","filename":"DutchHolidaysFrench.ics","datespan":"2024-2027","authors":"Pander"},{"country":"Nicaragua","filename":"NicaraguaHolidays.ics","datespan":"2024-2027","authors":"phurtado1112"},{"country":"Norway","filename":"NorwegianHolidays.ics","datespan":"2024-2027","authors":"Håvard Wigtil"},{"country":"Pakistan","filename":"PakistanHolidays.ics","datespan":"2024-2027","authors":"Umar Toseef"},{"country":"Poland","filename":"PolishHolidays.ics","datespan":"2024-2027","authors":"Artur Majcherczak"},{"country":"Portugal","filename":"PortugalHolidays.ics","datespan":"2024-2027","authors":"Nuno Rua"},{"country":"Russia","filename":"RussiaHolidays.ics","datespan":"2024-2027","authors":"Alexander L. Slovesnik"},{"country":"Singapore","filename":"SingaporePublicHolidays-2021.ics","datespan":"2024-2027","authors":"Singapore Ministry of Manpower"},{"country":"Singapore","filename":"SingaporePublicHolidays-2022.ics","datespan":"2024-2027","authors":"Singapore Ministry of Manpower"},{"country":"Slovenia","filename":"SlovenianHolidays.ics","datespan":"2024-2027","authors":"Klemen Robnik, Peter Klofutar"},{"country":"Slovakia","filename":"SlovakHolidays.ics","datespan":"2024-2027","authors":"Branislav Rozbora"},{"country":"South Africa","filename":"SouthAfricaHolidays.ics","datespan":"2024-2027","authors":"Malcolm McLean"},{"country":"South Korea","filename":"SouthKoreaHolidays.ics","datespan":"2024-2027","authors":"Marcus Yoo"},{"country":"Spain","filename":"SpainHolidays.ics","datespan":"2024-2027","authors":"forolinux"},{"country":"Sweden","filename":"SwedishHolidays.ics","datespan":"2024-2027","authors":"Erik Lundin"},{"country":"Switzerland","filename":"SwissHolidays.ics","datespan":"2024-2027","authors":"boe"},{"country":"Trinidad and Tobago","filename":"TrinidadTobagoHolidays.ics","datespan":"2024-2027","authors":"Joe"},{"country":"UK [All]","filename":"UKHolidays.ics","datespan":"2024-2027","authors":"KR304"},{"country":"UK [England & Wales]","filename":"UKHolidays-EnglandWales.ics","datespan":"2024-2027","authors":"KR304"},{"country":"UK [Northern Ireland]","filename":"UKHolidays-NIreland.ics","datespan":"2024-2027","authors":"KR304"},{"country":"UK [Scotland]","filename":"UKHolidays-Scotland.ics","datespan":"2024-2027","authors":"KR304"},{"country":"Ukraine","filename":"UkraineHolidays.ics","datespan":"2024-2027","authors":"Kostya Nesterenko"},{"country":"Uruguay","filename":"UruguayHolidays.ics","datespan":"2024-2027","authors":"Gonzalo Alvarez"},{"country":"USA","filename":"USHolidays.ics","datespan":"2024-2027","authors":"Thomas Kelley"}]');var d=e(88484),u=e(38613);const p=function(a){return"string"==typeof a||a instanceof String||arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!a},y={name:"PublicCalendarSubscriptionPicker",components:{CalendarBlank:o.default,NcButton:i.x1,NcEmptyContent:i.yI,NcModal:i.FH},props:{showHolidays:Boolean},data(){let a=[];if(this.showHolidays)a=l.map((a=>({...a,displayName:t("calendar","Holidays in {region}",{region:a.country}),name:a.country,description:a.datespan,source:"https://www.thunderbird.net/media/caldata/"+a.filename})));else try{const n=(0,u.C)("calendar","publicCalendars");a=JSON.parse(n).filter((a=>{const n=p(a.name)&&(a=>{try{return Boolean(new URL(a))}catch{return!1}})(a.source)&&p(a.displayName,!0)&&p(a.description,!0)&&p(a.authors,!0);return n||console.error("Invalid public calendar",a),n}))}catch(a){console.error("Could not read public calendars",a),(0,s.Qg)(this.$t("calendar","An error occurred, unable to read public calendars."))}const n={},e={};return a.forEach((a=>{n[a.source]=!1,e[a.source]=!1})),{calendars:a,loading:!0,subscribed:e,subscribing:n,subscriptions:[]}},computed:{...(0,r.L8)(["sortedCalendars"])},async mounted(){this.subscriptions=await(0,c.HV)(),this.subscriptions.map((a=>this.subscribed[a.source]=!0)),this.loading=!1},methods:{async subscribe(a){try{this.subscribing[a.source]=!0,await this.$store.dispatch("appendSubscription",{displayName:a.displayName||a.name,color:(0,d.GM)(a.source),source:a.source}),this.subscribed[a.source]=!0}catch(a){console.error("Could not add calendar subscription",a),(0,s.Qg)(this.$t("calendar","An error occurred, unable to subscribe to calendar."))}finally{this.subscribing[a.source]=!1}}}};e(17433);const h=(0,e(14486).A)(y,(function(){var a=this,n=a._self._c;return n("NcModal",{on:{close:function(n){return a.$emit("close",n)}}},[n("div",{staticClass:"public-calendar-subscription-picker"},[a.showHolidays?n("h2",[a._v("\n\t\t\t"+a._s(a.t("calendar","Public holiday calendars"))+"\n\t\t")]):n("h2",[a._v("\n\t\t\t"+a._s(a.t("calendar","Public calendars"))+"\n\t\t")]),a._v(" "),a.calendars.length?a.showHolidays?n("p",{staticClass:"holiday-subscription-picker__attribution"},[a._v("\n\t\t\t"+a._s(a.t("calendar","Public holiday calendars are provided by Thunderbird. Calendar data will be downloaded from {website}",{website:"thunderbird.net"}))+"\n\t\t")]):n("p",{staticClass:"holiday-subscription-picker__attribution"},[a._v("\n\t\t\t"+a._s(a.t("calendar","These public calendars are suggested by the sever administrator. Calendar data will be downloaded from the respective website."))+"\n\t\t")]):n("NcEmptyContent",{attrs:{title:a.$t("calendar","No valid public calendars configured"),description:a.$t("calendar","Speak to the server administrator to resolve this issue.")},scopedSlots:a._u([{key:"icon",fn:function(){return[n("CalendarBlank",{attrs:{size:20,decorative:""}})]},proxy:!0}],null,!1,2920828918)}),a._v(" "),a._l(a.calendars,(function(t){return n("div",{key:t.source,staticClass:"public-calendar-subscription-picker__region"},[n("div",{staticClass:"public-calendar-subscription-picker__region__name"},[n("h3",[a._v(a._s(t.name))]),a._v(" "),t.description?n("div",{staticClass:"public-calendar-subscription-picker__region__name__subline"},[a._v("\n\t\t\t\t\t"+a._s(t.description)+"\n\t\t\t\t")]):a._e(),a._v(" "),t.authors?n("div",{staticClass:"public-calendar-subscription-picker__region__name__subline"},[a._v("\n\t\t\t\t\t"+a._s(a.t("calendar","By {authors}",{authors:t.authors}))+"\n\t\t\t\t")]):a._e()]),a._v(" "),n("div",{staticClass:"public-calendar-subscription-picker__region__subcribe"},[n("NcButton",{attrs:{disabled:a.loading||a.subscribing[t.source]||a.subscribed[t.source]},on:{click:function(n){return a.subscribe(t)}}},[a._v("\n\t\t\t\t\t"+a._s(a.subscribed[t.source]?a.t("calendar","Subscribed"):a.t("calendar","Subscribe"))+"\n\t\t\t\t")])],1)])}))],2)])}),[],!1,null,"19167f47",null).exports},17433:(a,n,t)=>{var e=t(23888);e.__esModule&&(e=e.default),"string"==typeof e&&(e=[[a.id,e,""]]),e.locals&&(a.exports=e.locals);(0,t(70534).A)("1d4ec58e",e,!0,{})}}]);
//# sourceMappingURL=calendar-public-calendar-subscription-picker.js.map?v=722c29de96c0ecdfd95f