"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[4529],{846:(t,e,n)=>{n.d(e,{T:()=>u});var a=n(85168),i=n(32981),s=n(53334),o=n(63814),p=n(65899),r=n(65043),l=n(36620),c=n(86438);const d=()=>(0,a.Qg)((0,s.Tl)("settings","An error occurred during the request. Unable to proceed.")),u=(0,p.nY)("settings-apps",{state:()=>({apps:[],categories:[],updateCount:(0,i.C)("settings","appstoreUpdateCount",0),loading:{apps:!1,categories:!1},loadingList:!1,gettingCategoriesPromise:null}),actions:{async loadCategories(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(this.categories.length>0)||t)try{this.loading.categories=!0;const{data:t}=await r.Ay.get((0,o.Jv)("settings/apps/categories"));for(const e of t)e.icon=c.A[e.id]??"";this.$patch({categories:t})}catch(t){l.A.error(t),d()}finally{this.loading.categories=!1}},async loadApps(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(this.apps.length>0)||t)try{this.loading.apps=!0;const{data:t}=await r.Ay.get((0,o.Jv)("settings/apps/list"));this.$patch({apps:t.apps})}catch(t){l.A.error(t),d()}finally{this.loading.apps=!1}},getCategoryById(t){return this.categories.find((e=>{let{id:n}=e;return n===t}))??null},getAppById(t){return this.apps.find((e=>{let{id:n}=e;return n===t}))??null}}})},1368:(e,n,a)=>{a.r(n),a.d(n,{default:()=>pt});var i=a(85471),s=a(53334),o=a(24387),p=a(846),r=a(92973),l=a(18195),c=a(35779),d=a(59892),u=a(61338);function A(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function g(t,e,n){return t.set(m(t,e),n),n}function h(t,e){return t.get(m(t,e))}function m(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function v(t,e,n){return(e=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}class C{constructor(t){v(this,"value",void 0),v(this,"next",void 0),this.value=t}}var b=new WeakMap,f=new WeakMap,y=new WeakMap;class _{constructor(){A(this,b,void 0),A(this,f,void 0),A(this,y,void 0),this.clear()}enqueue(t){var e;const n=new C(t);h(b,this)?(h(f,this).next=n,g(f,this,n)):(g(b,this,n),g(f,this,n)),g(y,this,(e=h(y,this),++e))}dequeue(){var t;const e=h(b,this);if(e)return g(b,this,h(b,this).next),g(y,this,(t=h(y,this),--t)),e.value}peek(){if(h(b,this))return h(b,this).value}clear(){g(b,this,void 0),g(f,this,void 0),g(y,this,0)}get size(){return h(y,this)}*[Symbol.iterator](){let t=h(b,this);for(;t;)yield t.value,t=t.next}}function x(t){w(t);const e=new _;let n=0;const a=()=>{n0&&(e.dequeue()(),n++)},i=async(t,e,i)=>{const s=(async()=>t(...i))();e(s);try{await s}catch{}n--,a()},s=function(s){for(var o=arguments.length,p=new Array(o>1?o-1:0),r=1;r{((s,o,p)=>{new Promise((t=>{e.enqueue(t)})).then(i.bind(void 0,s,o,p)),(async()=>{await Promise.resolve(),nn},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>t,set(i){w(i),t=i,queueMicrotask((()=>{for(;n0;)a()}))}}}),s}function w(t){if(!Number.isInteger(t)&&t!==Number.POSITIVE_INFINITY||!(t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var S=a(97012),N=a(62791),k=a(45834),D=a(62938);const I={name:"AppList",components:{AppItem:N.A,NcButton:S.A},mixins:[k.A],props:{category:{type:String,required:!0}},setup:()=>({appApiStore:(0,D.a)(),store:(0,p.T)()}),data:()=>({search:""}),computed:{counter(){return this.apps.filter((t=>t.update)).length},loading(){return this.$store.getters["appApiApps/isAppApiEnabled"]?this.$store.getters.loading("list")||this.appApiStore.getLoading("list"):this.$store.getters.loading("list")},hasPendingUpdate(){return this.apps.filter((t=>t.update)).length>0},showUpdateAll(){return this.hasPendingUpdate&&this.useListView},apps(){const t=this.$store.getters.isAppApiEnabled?this.appApiStore.getAllApps:[],e=[...this.$store.getters.getAllApps,...t].filter((t=>-1!==t.name.toLowerCase().search(this.search.toLowerCase()))).sort((function(t,e){const n=OC.Util.naturalSortCompare(t,e);if(0===n){const n=""+(t.active?0:1)+(t.update?0:1),a=""+(e.active?0:1)+(e.update?0:1);return Number(n)-Number(a)}return n}));return"installed"===this.category?e.filter((t=>t.installed)):"enabled"===this.category?e.filter((t=>t.active&&t.installed)):"disabled"===this.category?e.filter((t=>!t.active&&t.installed)):"app-bundles"===this.category?e.filter((t=>t.bundles)):"updates"===this.category?e.filter((t=>t.update)):"supported"===this.category?e.filter((t=>300===t.level)):"featured"===this.category?e.filter((t=>200===t.level)):e.filter((t=>t.appstore&&void 0!==t.category&&(t.category===this.category||t.category.indexOf(this.category)>-1)))},bundles(){return this.$store.getters.getAppBundles.filter((t=>this.bundleApps(t.id).length>0))},bundleApps:()=>function(t){return this.$store.getters.getAllApps.filter((e=>void 0!==e.bundleIds&&e.bundleIds.includes(t)))},searchApps(){if(""===this.search)return[];const t=this.$store.getters.isAppApiEnabled?this.appApiStore.getAllApps:[];return[...this.$store.getters.getAllApps,...t].filter((t=>-1!==t.name.toLowerCase().search(this.search.toLowerCase())&&!this.apps.find((e=>e.id===t.id))))},useAppStoreView(){return!this.useListView&&!this.useBundleView},useListView(){return"installed"===this.category||"enabled"===this.category||"disabled"===this.category||"updates"===this.category||"featured"===this.category||"supported"===this.category},useBundleView(){return"app-bundles"===this.category},allBundlesEnabled(){return t=>0===this.bundleApps(t).filter((t=>!t.active)).length},bundleToggleText(){return e=>this.allBundlesEnabled(e)?t("settings","Disable all"):t("settings","Download and enable all")}},beforeDestroy(){(0,u.al)("nextcloud:unified-search.search",this.setSearch),(0,u.al)("nextcloud:unified-search.reset",this.resetSearch)},mounted(){(0,u.B1)("nextcloud:unified-search.search",this.setSearch),(0,u.B1)("nextcloud:unified-search.reset",this.resetSearch)},methods:{setSearch(t){let{query:e}=t;this.search=e},resetSearch(){this.search=""},toggleBundle(t){return this.allBundlesEnabled(t)?this.disableBundle(t):this.enableBundle(t)},enableBundle(t){const e=this.bundleApps(t).map((t=>t.id));this.$store.dispatch("enableApp",{appId:e,groups:[]}).catch((t=>{console.error(t),OC.Notification.show(t)}))},disableBundle(t){const e=this.bundleApps(t).map((t=>t.id));this.$store.dispatch("disableApp",{appId:e,groups:[]}).catch((t=>{OC.Notification.show(t)}))},updateAll(){const t=x(1);this.apps.filter((t=>t.update)).map((e=>t((()=>{this.update(e.id)}))))}}};var T=a(85072),E=a.n(T),B=a(97825),P=a.n(B),$=a(77659),O=a.n($),L=a(55056),M=a.n(L),R=a(10540),U=a.n(R),W=a(41113),G=a.n(W),F=a(68483),z={};z.styleTagTransform=G(),z.setAttributes=M(),z.insert=O().bind(null,"head"),z.domAPI=P(),z.insertStyleElement=U(),E()(F.A,z),F.A&&F.A.locals&&F.A.locals;var V=a(14486);const Y=(0,V.A)(I,(function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"app-content-inner"}},[e("div",{staticClass:"apps-list",class:{"apps-list--list-view":t.useBundleView||t.useListView,"apps-list--store-view":t.useAppStoreView},attrs:{id:"apps-list"}},[t.useListView?[t.showUpdateAll?e("div",{staticClass:"apps-list__toolbar"},[t._v("\n\t\t\t\t"+t._s(t.n("settings","%n app has an update available","%n apps have an update available",t.counter))+"\n\t\t\t\t"),t.showUpdateAll?e("NcButton",{attrs:{id:"app-list-update-all",type:"primary"},on:{click:t.updateAll}},[t._v("\n\t\t\t\t\t"+t._s(t.n("settings","Update","Update all",t.counter))+"\n\t\t\t\t")]):t._e()],1):t._e(),t._v(" "),t.showUpdateAll?t._e():e("div",{staticClass:"apps-list__toolbar"},[t._v("\n\t\t\t\t"+t._s(t.t("settings","All apps are up-to-date."))+"\n\t\t\t")]),t._v(" "),e("TransitionGroup",{staticClass:"apps-list__list-container",attrs:{name:"apps-list",tag:"table"}},[e("tr",{key:"app-list-view-header"},[e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Icon")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Name")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Version")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Level")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Actions")))])])]),t._v(" "),t._l(t.apps,(function(n){return e("AppItem",{key:n.id,attrs:{app:n,category:t.category}})}))],2)]:t._e(),t._v(" "),t.useBundleView?e("table",{staticClass:"apps-list__list-container"},[e("tr",{key:"app-list-view-header"},[e("th",{attrs:{id:"app-table-col-icon"}},[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Icon")))])]),t._v(" "),e("th",{attrs:{id:"app-table-col-name"}},[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Name")))])]),t._v(" "),e("th",{attrs:{id:"app-table-col-version"}},[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Version")))])]),t._v(" "),e("th",{attrs:{id:"app-table-col-level"}},[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Level")))])]),t._v(" "),e("th",{attrs:{id:"app-table-col-actions"}},[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Actions")))])])]),t._v(" "),t._l(t.bundles,(function(n){return[e("tr",{key:n.id},[e("th",{attrs:{id:`app-table-rowgroup-${n.id}`,colspan:"5",scope:"rowgroup"}},[e("div",{staticClass:"apps-list__bundle-heading"},[e("span",{staticClass:"apps-list__bundle-header"},[t._v("\n\t\t\t\t\t\t\t\t"+t._s(n.name)+"\n\t\t\t\t\t\t\t")]),t._v(" "),e("NcButton",{attrs:{type:"secondary"},on:{click:function(e){return t.toggleBundle(n.id)}}},[t._v("\n\t\t\t\t\t\t\t\t"+t._s(t.t("settings",t.bundleToggleText(n.id)))+"\n\t\t\t\t\t\t\t")])],1)])]),t._v(" "),t._l(t.bundleApps(n.id),(function(a){return e("AppItem",{key:n.id+a.id,attrs:{"use-bundle-view":!0,headers:`app-table-rowgroup-${n.id}`,app:a,category:t.category}})}))]}))],2):t._e(),t._v(" "),t.useAppStoreView?e("ul",{staticClass:"apps-list__store-container"},t._l(t.apps,(function(n){return e("AppItem",{key:n.id,attrs:{app:n,category:t.category,"list-view":!1}})})),1):t._e()],2),t._v(" "),e("div",{staticClass:"apps-list apps-list--list-view",attrs:{id:"apps-list-search"}},[e("div",{staticClass:"apps-list__list-container"},[""!==t.search&&t.searchApps.length>0?e("table",{staticClass:"apps-list__list-container"},[e("caption",{staticClass:"apps-list__bundle-header"},[t._v("\n\t\t\t\t\t"+t._s(t.t("settings","Results from other categories"))+"\n\t\t\t\t")]),t._v(" "),e("tr",{key:"app-list-view-header"},[e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Icon")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Name")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Version")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Level")))])]),t._v(" "),e("th",[e("span",{staticClass:"hidden-visually"},[t._v(t._s(t.t("settings","Actions")))])])]),t._v(" "),t._l(t.searchApps,(function(n){return e("AppItem",{key:n.id,attrs:{app:n,category:t.category}})}))],2):t._e()])]),t._v(" "),""===t.search||t.loading||0!==t.searchApps.length||0!==t.apps.length?t._e():e("div",{staticClass:"emptycontent emptycontent-search",attrs:{id:"apps-list-empty"}},[e("div",{staticClass:"icon-settings-dark",attrs:{id:"app-list-empty-icon"}}),t._v(" "),e("h2",[t._v(t._s(t.t("settings","No apps found for your version")))])])])}),[],!1,null,"27c89479",null).exports;var q=a(9165),j=a(85168),H=a(63814),Q=a(65043),K=a(6695),J=a(36620);const X=t=>{const e={...t};if(e.date&&(e.date=Date.parse(e.date)),e.expiryDate&&(e.expiryDate=Date.parse(e.expiryDate)),"post"===e.type)return e;if("showcase"===e.type)return e;if("carousel"===e.type)return e;throw new Error(`Invalid argument, app discover element with type ${t.type??"unknown"} is unknown`)},Z=t=>{const e=Date.now();return!(t.date&&t.date>e||t.expiryDate&&t.expiryDatea.e(1023).then(a.bind(a,51023)))),n=(0,i.$V)((()=>a.e(459).then(a.bind(a,50459)))),o=(0,i.$V)((()=>a.e(8737).then(a.bind(a,98737)))),p=(0,i.KR)(!1),r=(0,i.KR)([]),l=t=>{for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t};return(0,i.KC)((async()=>{try{const{data:t}=await Q.Ay.get((0,H.Jv)("/settings/api/apps/discover"));if(0===t.length)return J.A.info("No app discover elements available (empty response)"),void(p.value=!0);const e=t.map(X).filter(Z),n=l(e);n.sort(((t,e)=>(t.order??1/0)<(e.order??1/0)?-1:1)),r.value=n}catch(t){p.value=!0,J.A.error(t),(0,j.Qg)((0,s.Tl)("settings","Could not load app discover section"))}})),{__sfc:!0,PostType:e,CarouselType:n,ShowcaseType:o,hasError:p,elements:r,shuffleArray:l,getComponent:t=>"post"===t?e:"carousel"===t?n:"showcase"===t?o:(0,i.pM)({mounted:()=>J.A.error("Unknown component requested ",t),render:t=>t("div",(0,s.Tl)("settings","Could not render element"))}),mdiEyeOff:q.Bk0,t:s.Tl,NcEmptyContent:c.A,NcIconSvgWrapper:K.A,NcLoadingIcon:d.A}}});var et=a(11711),nt={};nt.styleTagTransform=G(),nt.setAttributes=M(),nt.insert=O().bind(null,"head"),nt.domAPI=P(),nt.insertStyleElement=U(),E()(et.A,nt),et.A&&et.A.locals&&et.A.locals;const at=(0,V.A)(tt,(function(){var t=this,e=t._self._c,n=t._self._setupProxy;return e("div",{staticClass:"app-discover"},[n.hasError?e(n.NcEmptyContent,{attrs:{name:n.t("settings","Nothing to show"),description:n.t("settings","Could not load section content from app store.")},scopedSlots:t._u([{key:"icon",fn:function(){return[e(n.NcIconSvgWrapper,{attrs:{path:n.mdiEyeOff,size:64}})]},proxy:!0}],null,!1,638098482)}):0===n.elements.length?e(n.NcEmptyContent,{attrs:{name:n.t("settings","Loading"),description:n.t("settings","Fetching the latest news…")},scopedSlots:t._u([{key:"icon",fn:function(){return[e(n.NcLoadingIcon,{attrs:{size:64}})]},proxy:!0}])}):t._l(n.elements,(function(a,i){return e(n.getComponent(a.type),t._b({key:a.id??i,tag:"component"},"component",a,!1))}))],2)}),[],!1,null,"9bdc3f2a",null).exports,it=(0,i.pM)({__name:"AppStore",setup(t){const e=(0,o.lq)(),n=(0,p.T)(),a=(0,D.a)(),u=(0,i.EW)((()=>e.params?.category??"discover")),A=(0,s.Tl)("settings","App Store"),g=(0,i.EW)((()=>r.l[u.value]??n.getCategoryById(u.value)?.displayName??A));(0,i.nT)((()=>{window.document.title=`${g.value} - ${A} - Nextcloud`}));const h=(0,i.nI)(),m=(0,i.EW)((()=>(h?.proxy).$store.getters.loading("list")));return(0,i.KC)((()=>{(h?.proxy).$store.dispatch("getCategories",{shouldRefetchCategories:!0}),(h?.proxy).$store.dispatch("getAllApps"),(h?.proxy).$store.getters.isAppApiEnabled&&(a.fetchAllApps(),a.updateAppsStatus())})),(0,i.xo)((()=>{clearInterval(a.getStatusUpdater)})),{__sfc:!0,route:e,store:n,appApiStore:a,currentCategory:u,appStoreLabel:A,viewLabel:g,instance:h,isLoading:m,t:s.Tl,NcAppContent:l.A,NcEmptyContent:c.A,NcLoadingIcon:d.A,AppList:Y,AppStoreDiscoverSection:at}}});var st=a(19665),ot={};ot.styleTagTransform=G(),ot.setAttributes=M(),ot.insert=O().bind(null,"head"),ot.domAPI=P(),ot.insertStyleElement=U(),E()(st.A,ot),st.A&&st.A.locals&&st.A.locals;const pt=(0,V.A)(it,(function(){var t=this,e=t._self._c,n=t._self._setupProxy;return e(n.NcAppContent,{staticClass:"app-settings-content",attrs:{"page-heading":n.appStoreLabel}},[e("h2",{staticClass:"app-settings-content__label",domProps:{textContent:t._s(n.viewLabel)}}),t._v(" "),"discover"===n.currentCategory?e(n.AppStoreDiscoverSection):n.isLoading?e(n.NcEmptyContent,{staticClass:"empty-content__loading",attrs:{name:n.t("settings","Loading app list")},scopedSlots:t._u([{key:"icon",fn:function(){return[e(n.NcLoadingIcon,{attrs:{size:64}})]},proxy:!0}])}):e(n.AppList,{attrs:{category:n.currentCategory}})],1)}),[],!1,null,"27f36c48",null).exports},11711:(t,e,n)=>{n.d(e,{A:()=>p});var a=n(71354),i=n.n(a),s=n(76314),o=n.n(s)()(i());o.push([t.id,".app-discover[data-v-9bdc3f2a]{max-width:1008px;margin-inline:auto;padding-inline:54px;padding-block-end:var(--default-clickable-area, 44px);display:flex;flex-direction:column;gap:var(--default-clickable-area, 44px)}","",{version:3,sources:["webpack://./apps/settings/src/components/AppStoreDiscover/AppStoreDiscoverSection.vue"],names:[],mappings:"AACA,+BACC,gBAAA,CACA,kBAAA,CACA,mBAAA,CAEA,qDAAA,CAEA,YAAA,CACA,qBAAA,CACA,uCAAA",sourcesContent:["\n.app-discover {\n\tmax-width: 1008px; /* 900px + 2x 54px padding for the carousel controls */\n\tmargin-inline: auto;\n\tpadding-inline: 54px;\n\t/* Padding required to make last element not bound to the bottom */\n\tpadding-block-end: var(--default-clickable-area, 44px);\n\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--default-clickable-area, 44px);\n}\n"],sourceRoot:""}]);const p=o},18460:(t,e,n)=>{n.d(e,{A:()=>p});var a=n(71354),i=n.n(a),s=n(76314),o=n.n(s)()(i());o.push([t.id,"\n/* The categories-loading indicator */\n.categories--loading[data-v-419cd0cf] {\n\tflex: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n}\n","",{version:3,sources:["webpack://./apps/settings/src/views/AppStoreNavigation.vue"],names:[],mappings:";AA0IA,qCAAA;AACA;CACA,OAAA;CACA,aAAA;CACA,mBAAA;CACA,uBAAA;AACA",sourcesContent:['\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n\n