(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[8033],{44368:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>r});i(82364);varo=i(78423),s=i(19755);functionn(t){returnn="function"==typeofSymbol&&"symbol"==typeofSymbol.iterator?function(t){returntypeoft}:function(t){returnt&&"function"==typeofSymbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeoft},n(t)}functiona(t){returnfunction(t){if(Array.isArray(t))returnl(t)}(t)||function(t){if("undefined"!=typeofSymbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])returnArray.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeoft)returnl(t,e);vari=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)returnArray.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))returnl(t,e)}(t)||function(){thrownewTypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}functionl(t,e){(null==e||e>t.length)&&(e=t.length);for(vari=0,o=newArray(e);i<e;i++)o[i]=t[i];returno}constr={props:["collection-id","collection-title","collection-description","collection-visibility","profile-id","profile-username"],components:{intersect:o.default},data:function(){return{collection:{},config:window.App.config,loaded:!1,posts:[],ids:[],user:!1,owner:!1,title:this.collectionTitle,description:this.collectionDescription,visibility:this.collectionVisibility,photoId:"",postsList:[],loadingPostList:!1,addingPostToCollection:!1,markedForDeletion:[],canLoadMore:!1,isIntersecting:!1,page:1}},beforeMount:function(){this.fetchCollection()},updated:function(){this.initReadMore()},methods:{enterIntersect:function(){this.isIntersecting||(this.isIntersecting=!0,this.page++,this.fetchItems())},statusUrl:function(t){return"/i/web/post/"+t.id},fetchCollection:function(){vart=this;axios.get("/api/local/collection/"+this.collectionId).then((function(e){t.collection=e.data,t.collection.post_count>9&&(t.canLoadMore=!0),t.fetchCurrentUser()}))},fetchCurrentUser:function(){vart=this;1==document.querySelectorAll("body")[0].classList.contains("loggedIn")?axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.user=e.data,t.owner=t.user.id==t.profileId,window._sharedData.curUser=e.data,window.App.util.navatar(),t.fetchItems()})):this.fetchItems()},fetchItems:function(){vart=this;axios.get("/api/local/collection/items/"+this.collectionId,{params:{page:this.page}}).then((function(e){vari;if(0==e.data.length)returnconsole.log("no items found"),t.loaded=!0,t.isIntersecting=!1,void(t.canLoadMore=!1);varo=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)}));(i=t.posts).push.apply(i,a(o)),t.ids=t.posts.map((function(t){returnt.id})),t.loaded=!0,t.isIntersecting=!1,0==o.length&&(t.canLoadMore=!1)}))},previewUrl:function(t){returnt&&t.sensitive?"/storage/no-preview.png?v="+(newDate).getTime():t.media_attachments[0].url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");"},addToCollection:function(){vart=this;this.loadingPostList=!0,0==this.postsList.length?axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{min_id:1,limit:40}}).then((function(e){t.postsList=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)})),t.loadingPostList=!1,t.$refs.addPhotoModal.show()})).catch((function(e){t.loadingPostList=!1,swal("An Error Occured","We cannot process your request at this time, please try again later.","error")})):(this.$refs.addPhotoModal.show(),this.loadingPostList=!1)},pushId:function(){vart=this,e=this.config.uploader.max_collection_length,i=this;if(this.posts.length>=e)swal("Error","You can only add "+e+" posts per collection","error");else{varo=this.photoId,s=window.location.origin,n=o.split("/");if(o.slice(0,s.length)!==s&&(swal("Invalid URL","You can only add posts from this instance","error"),this.photoId=""),!o.includes("/i/web/post/")&&!o.includes("/p/"))returnswal("Invalid URL","Invalid URL","error"),v