| 1 |
import{D as n,F as r,K as l,ae as p,ab as x,L as D,S as a,I as c,E as v,O as _,Q as d,R as T,af as se,J as Y,P as M,a7 as q,y as Dt,B as K,ak as ye,ay as Le,W as me,aj as te,U as vt,M as qt,V as Ps,a5 as Gt,G as xo,T as Rt,at as Oo,al as gs,am as ys,az as Ho,ar as jo}from"./vue.js?ver=2.10.0";import{c as vs,a as No,b as zo}from"./vue-router.js?ver=2.10.0";import{E as j,a as O,b as Yt,c as qo,d as J,e as fe,f as bt,g as ie,h as ve,i as Ye,j as ct,k as dt,l as Be,m as je,n as be,o as ke,p as Is,q as De,r as Pe,s as ae,t as re,u as Wt,v as pe,w as Es,x as ge,y as Ie,z as We,A as Ke,B as Ze,C as As,D as Us,F as Bs,G as Ds,H as Rs,I as Je,J as Go,K as xs,L as Os,M as Yo,N as ut,O as _t,P as mt,Q as Hs,R as Wo,S as Kt,T as Zt,U as Jt,V as Qt,W as Xt,X as Ko,Y as Zo,Z as Jo,_ as xt}from"./element-plus.js?ver=2.10.0";import"./dayjs.js?ver=2.10.0";import{d as Ne,m as Qo,a as js,c as Xo,s as ei}from"./pinia.js?ver=2.10.0";import{bc as Ns,b as kt,bd as ti,be as wt,a5 as Ot,az as bs,bf as zs,a1 as qs,a0 as Ct,bg as si,bh as Fe,l as oi,bi as Gs,bj as Ys,n as Ws,bk as ii,bl as ni,L as li,M as ai,J as Ks,bm as ri,bn as ci,m as di,bo as ui,d as $t,bp as Zs,U as Js,R as Qs,bq as _i,br as Xs,bs as mi,bt as hi,bu as fi,bv as pi,bw as gi,bx as yi,by as vi,bz as bi,bA as ki,bB as wi,bC as Ci,bD as $i,v as Si,j as Vi,bE as Mi,bF as Li,bG as Ti,bH as Fi,s as Pi,D as Ii,C as Ei,p as Ai,bI as Ui,bJ as Bi,bK as Di,bL as Ri,bM as xi,bN as Oi,bO as Hi,$ as ji,bP as Ni,bQ as zi,bR as qi,N as Gi,bS as Yi}from"./vendor.js?ver=2.10.0";import{_ as P,P as Wi,E as Ki}from"./emoji-picker.js?ver=2.10.0";import{u as Zi,v as es,w as Ji,x as Oe,y as Qi}from"./fcom-utils.js?ver=2.10.0";import{H as Xi,O as en,m as tn,s as sn,c as on,a as nn,h as ln,b as an,x as rn,P as cn,W as dn,U as un,d as _n,_ as mn,u as Ht,$ as hn,w as fn,r as pn,L as it,e as gn}from"./milkdown.js?ver=2.10.0";const le=Ne("cache",{state:()=>({cache:{},stats:{hits:0,misses:0,size:0,totalSaved:0},maxSize:500,maxMemorySize:50*1024*1024}),getters:{getCacheHitRate:e=>{const t=e.stats.hits+e.stats.misses;return t>0?(e.stats.hits/t*100).toFixed(2):0},getCacheSize:e=>Object.keys(e.cache).length,getMemoryUsage:e=>{try{return(new Blob([JSON.stringify(e.cache)]).size/1024/1024).toFixed(2)+" MB"}catch{return"Unknown"}},getCacheKeys:e=>Object.keys(e.cache),getCacheEntry:e=>t=>e.cache[t]||null},actions:{get(e,t=null){const s=this.cache[e];if(!s)return this.stats.misses++,null;const u=Date.now()-s.timestamp,o=s.ttl||t||5*60*1e3;return u>o?(delete this.cache[e],this.stats.misses++,this.stats.size=Object.keys(this.cache).length,null):(this.stats.hits++,s.hits=(s.hits||0)+1,s.lastAccessed=Date.now(),s.data)},set(e,t,s=5*60*1e3){Object.keys(this.cache).length>=this.maxSize&&this.pruneLRU(50),this.cache[e]={data:t,timestamp:Date.now(),lastAccessed:Date.now(),hits:0,ttl:s},this.stats.size=Object.keys(this.cache).length,this.stats.totalSaved++},invalidate(e){this.cache[e]&&(delete this.cache[e],this.stats.size=Object.keys(this.cache).length)},invalidatePattern(e){let t=0;return Object.keys(this.cache).forEach(s=>{s.includes(e)&&(delete this.cache[s],t++)}),this.stats.size=Object.keys(this.cache).length,t},pruneLRU(e){const t=Object.entries(this.cache).map(([s,u])=>({key:s,lastAccessed:u.lastAccessed||u.timestamp})).sort((s,u)=>s.lastAccessed-u.lastAccessed).slice(0,e);return t.forEach(({key:s})=>{delete this.cache[s]}),this.stats.size=Object.keys(this.cache).length,t.length},pruneExpired(e=15*60*1e3){let t=0;const s=Date.now();return Object.entries(this.cache).forEach(([u,o])=>{s-o.timestamp>e&&(delete this.cache[u],t++)}),this.stats.size=Object.keys(this.cache).length,t},clear(){this.cache={},this.stats.hits=0,this.stats.misses=0,this.stats.size=0},getStats(){return{...this.stats,hitRate:this.getCacheHitRate,memoryUsage:this.getMemoryUsage,cacheSize:this.getCacheSize}},has(e){return e in this.cache},getKeysMatching(e){return Object.keys(this.cache).filter(t=>t.includes(e))},warmCache(e){Object.entries(e).forEach(([t,s])=>{this.set(t,s)})}}}),St=Ne("ui",{state:()=>({lastScrollPath:null,lastScrollPosition:0,lastViewedFeed:{},layoutStyle:null,sortBy:null,layoutStyleByContext:{},sortByContext:{},listSortByContext:{},modals:{feedModal:!1,createPostModal:!1,editPostModal:!1,shareModal:!1},globalLoading:!1,sidebarCollapsed:!1,searchQuery:"",activeSpace:null,activeTopic:null}),getters:{getLastViewedFeed:e=>t=>e.lastViewedFeed[t]||null,getLayoutStyle:e=>t=>e.layoutStyleByContext[t]||e.layoutStyle||"list",getSortBy:e=>t=>e.sortByContext[t]||e.sortBy||"latest",isModalOpen:e=>t=>e.modals[t]||!1},actions:{saveScrollPosition(e,t){this.lastScrollPath=e,this.lastScrollPosition=t},restoreScrollPosition(e){return this.lastScrollPath===e&&this.lastScrollPosition>0?this.lastScrollPosition:0},consumeScrollPosition(e){const t=this.restoreScrollPosition(e);return t>0&&(this.lastScrollPath=null,this.lastScrollPosition=0),t},saveLastViewedFeed(e,t,s){this.lastViewedFeed[e]={feedId:t,index:s,timestamp:Date.now()}},setLayoutStyle(e){this.layoutStyle=e;try{localStorage.setItem("fcom_feed_layout",e)}catch(t){console.error("Failed to save layout style:",t)}},setLayoutStyleForContext(e,t){this.layoutStyleByContext[e]=t;try{localStorage.setItem("fcom_layout_by_context",JSON.stringify(this.layoutStyleByContext))}catch(s){console.error("Failed to save layout style:",s)}},setSortBy(e){this.sortBy=e;try{localStorage.setItem("fcom_feed_sort",e)}catch(t){console.error("Failed to save sort preference:",t)}},setSortByForContext(e,t){this.sortByContext[e]=t;try{localStorage.setItem("fcom_sort_by_context",JSON.stringify(this.sortByContext))}catch(s){console.error("Failed to save sort preference:",s)}},setListSort(e,t,s){this.listSortByContext[e]={field:t,dir:s};try{localStorage.setItem("fcom_list_sort_by_context",JSON.stringify(this.listSortByContext))}catch(u){console.error("Failed to save list sort preference:",u)}},getListSort(e){return this.listSortByContext[e]||null},openModal(e){this.modals[e]=!0},closeModal(e){this.modals[e]=!1},toggleModal(e){this.modals[e]=!this.modals[e]},setGlobalLoading(e){this.globalLoading=e},toggleSidebar(){this.sidebarCollapsed=!this.sidebarCollapsed},setSidebar(e){this.sidebarCollapsed=e},setSearchQuery(e){this.searchQuery=e},setActiveSpace(e){this.activeSpace=e},setActiveTopic(e){this.activeTopic=e},clearScrollPosition(){this.lastScrollPath=null,this.lastScrollPosition=0},clearLastViewedFeeds(){this.lastViewedFeed={}},initialize(){try{const e=localStorage.getItem("fcom_feed_layout");e&&(this.layoutStyle=e);const t=localStorage.getItem("fcom_layout_by_context");t&&(this.layoutStyleByContext=JSON.parse(t))}catch(e){console.error("Failed to restore layout style:",e)}try{const e=localStorage.getItem("fcom_feed_sort");e&&(this.sortBy=e);const t=localStorage.getItem("fcom_sort_by_context");t&&(this.sortByContext=JSON.parse(t));const s=localStorage.getItem("fcom_list_sort_by_context");s&&(this.listSortByContext=JSON.parse(s))}catch(e){console.error("Failed to restore sort preference:",e)}},reset(){this.lastScrollPath=null,this.lastScrollPosition=0,this.lastViewedFeed={},this.modals={feedModal:!1,createPostModal:!1,editPostModal:!1,shareModal:!1},this.globalLoading=!1,this.sidebarCollapsed=!1,this.searchQuery="",this.activeSpace=null,this.activeTopic=null}}}),Ue=Ne("user",{state:()=>({currentUser:null,profilesByUsername:{},follows:{},followers:[],loading:{},lastFetched:{}}),getters:{getProfile:e=>t=>e.profilesByUsername[t]||null,isFollowing:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&["1","2"].includes(String(s))},isBlocked:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&String(s)==="0"},getFollowLevel:e=>t=>e.follows[String(t)],getCurrentUser:e=>e.currentUser,isLoading:e=>t=>e.loading[t]||!1,followingCount:e=>Object.values(e.follows).filter(t=>["1","2"].includes(String(t))).length,followersCount:e=>e.followers.length},actions:{initializeCurrentUser(){var e;(e=window.fluentComAdmin)!=null&&e.auth&&(this.currentUser=window.fluentComAdmin.auth)},setFollows(e){if(!(!e||typeof e!="object"))for(const[t,s]of Object.entries(e)){const u=String(t);s==null?delete this.follows[u]:this.follows[u]=String(s)}},removeFollow(e){delete this.follows[String(e)]},async fetchProfile(e,t=!1){const s=le(),u=`user-profile:${e}`;if(!t){const o=s.get(u);if(o)return this.profilesByUsername[e]=o,o.follow!==void 0&&o.user_id&&this.setFollows({[o.user_id]:o.follow}),o}this.loading[e]=!0;try{const o=await this.$api.get(`profile/${e}`),i=o.profile;return i.follow!==void 0&&i.user_id&&this.setFollows({[i.user_id]:i.follow}),o.current_user_follows&&this.setFollows(o.current_user_follows),this.profilesByUsername[e]=i,this.lastFetched[e]=Date.now(),s.set(u,i,5*60*1e3),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch user profile:",o),o}},async updateProfile(e,t=null,s=null){var o,i;const u=le();try{const m=s||((o=this.currentUser)==null?void 0:o.username),f=await this.$api.put(`profile/${m}`,{data:e}),h=f.profile||f.user||f;return this.currentUser={...this.currentUser,...h},t&&t!==h.username&&(delete this.profilesByUsername[t],u.invalidate(`user-profile:${t}`)),h.username&&(this.profilesByUsername[h.username]=h,u.invalidate(`user-profile:${h.username}`)),(i=window.fluentComAdmin)!=null&&i.auth&&(window.fluentComAdmin.auth={...window.fluentComAdmin.auth,...h}),h}catch(m){throw console.error("Failed to update profile:",m),m}},async toggleFollow(e,t=null){var f,h,g;const s=le(),u=String(e),o=this.follows[u],i=o!==void 0&&["1","2"].includes(String(o)),m=o;i?(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)):(this.follows[u]="1",t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow="1"));try{const k=i?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(k);return i?delete this.follows[u]:((f=b.follow)==null?void 0:f.level)!==void 0&&this.setFollows({[u]:b.follow.level}),t&&this.profilesByUsername[t]&&(((h=b.xprofile)==null?void 0:h.followers_count)!==void 0&&(this.profilesByUsername[t].followers_count=b.xprofile.followers_count),s.invalidate(`user-profile:${t}`)),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!i}),b}catch(k){throw i?(this.follows[u]=m,t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow=m)):(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)),console.error("Failed to toggle follow:",k),k}},invalidateProfile(e){le().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=le();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Me=Ne("feed",{state:()=>({feedsByContext:{},feedsById:{},stickyFeeds:{},loading:{},pagination:{},filters:{},tickerIntervals:{},tickerEnabled:{},lastTickerCheck:{},tickerPending:{},newPostsCount:{},ticker:{count:0,lastFetched:0},executionTimes:{},_pendingRequests:{},_requestSeq:{},_recentContexts:[]}),getters:{getFeedsByContext:e=>t=>{const s=e.feedsByContext[t];return s?s.data||[]:[]},getFeedById:e=>t=>e.feedsById[t]||null,getStickyFeed:e=>t=>e.stickyFeeds[t]||null,getPagination:e=>t=>e.pagination[t]||{page:1,per_page:10,total:0,last_page:1,has_more:!1},isLoading:e=>t=>e.loading[t]||!1,getExecutionTime:e=>t=>e.executionTimes[t]||"",totalFeedsInMemory:e=>{let t=Object.keys(e.feedsById).length;return Object.values(e.feedsByContext).forEach(s=>{var u;t+=((u=s.data)==null?void 0:u.length)||0}),t},disableAutoLoad:e=>t=>{const s=e.loading[t]||!1,u=e.pagination[t];return u?s||u.has_more===!1:!0},getTickerCount:e=>e.ticker.count||0,getTickerLastFetched:e=>e.ticker.lastFetched||0,isTickerActive:e=>t=>e.tickerEnabled[t]&&e.tickerIntervals[t]!==null,getNewPostsCount:e=>t=>e.newPostsCount[t]||0,getMemoryStats:e=>{let t=0,s={};Object.keys(e.feedsByContext).forEach(i=>{var f,h;const m=((h=(f=e.feedsByContext[i])==null?void 0:f.data)==null?void 0:h.length)||0;s[i]=m,t+=m});const u=Object.keys(e.feedsById).length,o=(t*5/1024).toFixed(2);return{totalFeeds:t,feedsByContextCount:s,feedsByIdCount:u,estimatedMemoryMB:o,contexts:Object.keys(e.feedsByContext).length}}},actions:{async fetchFeeds(e,t={},s=!1){var k,b,S;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:s,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(k=this.pagination[e])==null?void 0:k.page}),this.loading[e]){console.log("[Feed Store] Already loading for context:",e,"- ignoring duplicate request");return}const u=(this._requestSeq[e]||0)+1;this._requestSeq[e]=u;const o=s?(((b=this.pagination[e])==null?void 0:b.page)||0)+1:t.page||1,i={...t,page:o,per_page:t.per_page||10},m=`feeds:${e}:${JSON.stringify(i)}`,f=le(),h=JSON.stringify({search:i.search||"",order_by_type:i.order_by_type||"",topic_slug:i.topic_slug||"",status:i.status||""});if(!s&&o===1){const w=f.get(m,3e5);if(w)return this.feedsByContext[e]={...w.feedsByContext,filterKey:h},this.pagination[e]=w.pagination,this.executionTimes[e]=w.executionTime,this.touchContext(e),w.stickyFeed&&!window["viewed_sticky_posts_"+w.stickyFeed.id]?this.stickyFeeds[e]=w.stickyFeed:(this.stickyFeeds[e]=null,w.stickyFeed&&((S=this.feedsByContext[e])!=null&&S.data)&&(this.feedsByContext[e].data.some($=>$.id===w.stickyFeed.id)||this.feedsByContext[e].data.unshift(w.stickyFeed))),w.feedsByContext.data.forEach($=>{this.feedsById[$.id]=$}),this.loading[e]=!1,w}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",i).then(w=>{var $,y,C,L;if(this._requestSeq[e]===u){if(w.sticky){const V="viewed_sticky_posts_"+w.sticky.id;window[V]?(w.feeds.data.some(I=>I.id===w.sticky.id)||w.feeds.data.unshift(w.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=w.sticky}else o===1&&(this.stickyFeeds[e]=null);if(s){const V=(($=this.feedsByContext[e])==null?void 0:$.data)||[];this.feedsByContext[e]={data:[...V,...w.feeds.data],timestamp:Date.now(),filterKey:h}}else this.feedsByContext[e]={data:w.feeds.data,timestamp:Date.now(),filterKey:h};if(this.pagination[e]={page:o,per_page:i.per_page,total:w.feeds.total,last_page:w.feeds.last_page,has_more:w.feeds.has_more},this.touchContext(e),console.log("[Feed Store] Updated pagination:",{context:e,page:o,has_more:w.feeds.has_more,total:w.feeds.total}),w.execution_time&&(this.executionTimes[e]=w.execution_time),w.feeds.data.forEach(V=>{this.feedsById[V.id]={...V,timestamp:Date.now()}}),s){const V=((C=(y=this.feedsByContext[e])==null?void 0:y.data)==null?void 0:C.length)||0;V>500&&(console.log("[Feed Store] Pruning feeds, count:",V),this.pruneOldFeeds(e))}return w.last_fetched_timestamp&&(this.ticker.lastFetched=w.last_fetched_timestamp,(L=window.fluentFrameworkApp)!=null&&L.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:w.last_fetched_timestamp})),w.current_user_follows&&Ue().setFollows(w.current_user_follows),!s&&o===1&&f.set(m,{feedsByContext:this.feedsByContext[e],pagination:this.pagination[e],stickyFeed:this.stickyFeeds[e],executionTime:this.executionTimes[e]}),console.log("[Feed Store] Fetch SUCCESS, stored feeds for context:",e,{feedCount:this.feedsByContext[e].data.length,pagination:this.pagination[e],hasSticky:!!this.stickyFeeds[e]}),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after success for context:",e),{feeds:this.feedsByContext[e].data,pagination:this.pagination[e],sticky:this.stickyFeeds[e]}}}).catch(w=>{throw console.error("[Feed Store] Failed to fetch feeds:",w),this._requestSeq[e]===u&&(this.loading[e]=!1),w})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,s=le(),u=s.get(t,10*60*1e3);if(u)return this.feedsById[u.id]=u,u;try{const i=(await this.$api.get(`feeds/${e}/by-slug`)).feed;return this.feedsById[i.id]={...i,timestamp:Date.now()},s.set(t,i),window.appVars&&(window.appVars.last_feed_id=i.id),i}catch(o){throw console.error("Failed to fetch feed:",o),o}},_contextShowsUnlisted(e){const t=this.feedsByContext[e];if(!t||!t.filterKey)return!1;try{return JSON.parse(t.filterKey).status==="unlisted"}catch{return!1}},async createFeed(e,t){var s,u,o,i,m;try{const f=await this.$api.post("feeds",t),h=f.feed;if(this.feedsById[h.id]={...h,timestamp:Date.now()},!f.scheduled_at){const k=b=>{this.feedsByContext[b]||(this.feedsByContext[b]={data:[],timestamp:Date.now()}),this.stickyFeeds[b]&&(this.feedsByContext[b].data.some(w=>w.id===this.stickyFeeds[b].id)||this.feedsByContext[b].data.unshift(this.stickyFeeds[b]),this.stickyFeeds[b]=null);const S=this.feedsByContext[b].data.findIndex(w=>w.id===h.id);S===-1&&this.feedsByContext[b].data.unshift(h),this.pagination[b]?S===-1&&this.pagination[b].total++:this.pagination[b]={page:1,per_page:10,total:1,last_page:1,has_more:!1}};if(h.status==="unlisted")Object.keys(this.feedsByContext).forEach(b=>{this._contextShowsUnlisted(b)&&k(b)});else{k(e),h.space_id&&e!=="global"&&(k("global"),le().invalidatePattern("feeds:global"));const b=`user-${h.user_id}`;this.feedsByContext[b]&&e!==b&&k(b)}(u=(s=window.fluentFrameworkApp)==null?void 0:s.$eventBus)==null||u.emit("recent_activities_refresh")}return f.last_fetched_timestamp&&(this.ticker.lastFetched=f.last_fetched_timestamp,(o=window.FluentCommunityUtil)!=null&&o.eventBus&&((m=(i=window.fluentFrameworkApp)==null?void 0:i.$eventBus)==null||m.emit("newest_feed_fetched",{last_fetched_timestamp:f.last_fetched_timestamp}))),le().invalidatePattern(`feeds:${e}`),f}catch(f){throw console.error("Failed to create feed:",f),f}},async updateFeed(e,t){const s=this.feedsById[e]?{...this.feedsById[e]}:null;this.feedsById[e]&&(this.feedsById[e]={...this.feedsById[e],...t,timestamp:Date.now()}),Object.keys(this.feedsByContext).forEach(u=>{const o=this.feedsByContext[u].data.findIndex(i=>i.id===e);o!==-1&&(this.feedsByContext[u].data[o]={...this.feedsByContext[u].data[o],...t})});try{const o=(await this.$api.patch(`feeds/${e}`,t)).feed;return this.feedsById[e]={...this.feedsById[e],...o,timestamp:Date.now()},Object.keys(this.feedsByContext).forEach(m=>{const f=this.feedsByContext[m].data.findIndex(h=>h.id===e);f!==-1&&(this.feedsByContext[m].data[f]={...this.feedsByContext[m].data[f],...o})}),o.status==="unlisted"&&Object.keys(this.feedsByContext).forEach(m=>{if(this._contextShowsUnlisted(m))return;const f=this.feedsByContext[m];f!=null&&f.data&&(f.data=f.data.filter(h=>h.id!==e))}),le().invalidatePattern("feed:"),o}catch(u){throw s&&(this.feedsById[e]=s,Object.keys(this.feedsByContext).forEach(o=>{const i=this.feedsByContext[o].data.findIndex(m=>m.id===e);i!==-1&&(this.feedsByContext[o].data[i]=s)})),console.error("Failed to update feed:",u),u}},async deleteFeed(e,t,s=null){try{return await this.$api.delete(`feeds/${t}`),delete this.feedsById[t],s!==null&&this.feedsByContext[e]?this.feedsByContext[e].data.splice(s,1):Object.keys(this.feedsByContext).forEach(o=>{var i;(i=this.feedsByContext[o])!=null&&i.data&&(this.feedsByContext[o].data=this.feedsByContext[o].data.filter(m=>m.id!==t))}),this.pagination[e]&&this.pagination[e].total--,le().invalidatePattern("feed:"),!0}catch(u){throw console.error("Failed to delete feed:",u),u}},async fetchTicker(e){var t,s,u;try{const o=e||this.ticker.lastFetched;console.log("[Legacy Ticker] Fetching ticker with timestamp:",o);const i=await this.$api.get("feeds/ticker",{last_fetched_timestamp:o});if(console.log("[Legacy Ticker] Response:",{has_changes:i.has_changes,feeds:((t=i.feeds)==null?void 0:t.length)||0,new_items_count:i.new_items_count}),this.ticker={count:i.new_items_count||0,lastFetched:i.last_fetched_timestamp||Date.now()},console.log("[Legacy Ticker] Checking if we should process feeds:",{has_changes:i.has_changes,feeds_exists:!!i.feeds,feeds_length:((s=i.feeds)==null?void 0:s.length)||0,feeds_data:i.feeds}),i.has_changes&&i.feeds&&i.feeds.length>0){console.log(`[Legacy Ticker] ✅ Processing ${i.feeds.length} feed updates`);const m={};i.feeds.forEach(f=>{console.log("[Legacy Ticker] Processing feed update:",f);const h=f.context||"global";m[h]||(m[h]=[]),m[h].push(f)}),console.log("[Legacy Ticker] Updates grouped by context:",m);for(const f in m){console.log(`[Legacy Ticker] 📥 Processing context: ${f} (${m[f].length} updates)`);try{await this.processTickerUpdates(f,m[f]),console.log(`[Legacy Ticker] ✅ Successfully processed context: ${f}`)}catch(h){console.error(`[Legacy Ticker] ❌ Failed to process context: ${f}`,h)}}}else console.log("[Legacy Ticker] ⏭️ Skipping feed processing - no changes or no feeds in response");return(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("ticker_updated",i),this.ticker}catch(o){throw console.error("[Legacy Ticker] Failed to fetch ticker:",o),o}},resetTicker(){this.ticker.count=0},markStickyAsViewed(e,t){const s=this.stickyFeeds[e];s&&s.id===t&&(window["viewed_sticky_posts_"+t]=!0,this.feedsByContext[e]&&(this.feedsByContext[e].data.some(u=>u.id===s.id)||this.feedsByContext[e].data.unshift(s)),this.stickyFeeds[e]=null)},pruneOldFeeds(e=null){(e?[e]:Object.keys(this.feedsByContext)).forEach(u=>{var i;const o=((i=this.feedsByContext[u])==null?void 0:i.data)||[];if(o.length>500){const m=o.slice(0,o.length-500);this.feedsByContext[u].data=o.slice(o.length-500),console.log(`[Feed Store] Pruned ${m.length} old feeds from ${u}, kept ${this.feedsByContext[u].data.length}`),m.forEach(f=>{Object.values(this.feedsByContext).some(g=>{var k;return(k=g.data)==null?void 0:k.some(b=>b.id===f.id)})||delete this.feedsById[f.id]})}})},resetContext(e){this.feedsByContext[e]={data:[],timestamp:0},this.pagination[e]={page:1,per_page:10,total:0,last_page:1,has_more:!1},this.stickyFeeds[e]=null,this.loading[e]=!1,this.executionTimes[e]="",le().invalidatePattern(`feeds:${e}`)},touchContext(e){if(!e)return;const t=this._recentContexts.indexOf(e);t>-1&&this._recentContexts.splice(t,1),this._recentContexts.push(e);const s=10;if(this._recentContexts.length<=s)return;let u=this._recentContexts.length-s;const o=[];for(const i of this._recentContexts)u>0&&!this.loading[i]?(delete this.feedsByContext[i],delete this.pagination[i],delete this.stickyFeeds[i],delete this.executionTimes[i],u--):o.push(i);this._recentContexts=o},async softRefreshContext(e,t={}){var s,u,o,i;if((u=(s=this.feedsByContext[e])==null?void 0:s.data)!=null&&u.length&&!this.loading[e]){this.touchContext(e);try{const m=await this.$api.get(t.feed_base_url||"feeds",{...t,page:1,per_page:t.per_page||10}),f=this.feedsByContext[e];if(!((o=f==null?void 0:f.data)!=null&&o.length))return;const h=f.data,g=((i=m.feeds)==null?void 0:i.data)||[];if(!g.length){f.timestamp=Date.now();return}const k=new Map(g.map(y=>[y.id,y])),b=new Set(h.map(y=>y.id)),S=h.map(y=>{const C=k.get(y.id);return C?{...y,...C}:y}),w=g.filter(y=>!b.has(y.id));this.feedsByContext[e]={...f,data:[...w,...S],timestamp:Date.now()};const $=Date.now();if(g.forEach(y=>{this.feedsById[y.id]={...this.feedsById[y.id]||{},...y,timestamp:$}}),m.sticky){const y="viewed_sticky_posts_"+m.sticky.id;window[y]||(this.stickyFeeds[e]=m.sticky)}}catch(m){console.warn("[Feed Store] Soft refresh failed for context",e,m)}}},startTicker(e="global",t=3e4){this.lastTickerCheck[e]||(this.lastTickerCheck[e]=new Date().toISOString()),this.stopTicker(e),this.tickerEnabled[e]=!0,this.newPostsCount[e]=0,this.tickerIntervals[e]=setInterval(()=>{this.checkForUpdates(e)},t),console.log(`[Feed Store] Ticker started for ${e} (interval: ${t}ms)`),this.checkForUpdates(e)},stopTicker(e){this.tickerIntervals[e]&&(clearInterval(this.tickerIntervals[e]),this.tickerIntervals[e]=null,this.tickerEnabled[e]=!1,console.log(`[Feed Store] Ticker stopped for ${e}`))},stopAllTickers(){Object.keys(this.tickerIntervals).forEach(e=>{this.stopTicker(e)})},async checkForUpdates(e="global"){if(!this.tickerPending[e]){this.tickerPending[e]=!0;try{const t=await this.$api.get("feeds/ticker-updates",{context:e,since:this.lastTickerCheck[e]||new Date().toISOString()});this.lastTickerCheck[e]=t.timestamp,t.has_changes&&t.updates.length>0&&(console.log(`[Feed Store] Ticker found ${t.updates.length} changes for ${e}`),await this.processTickerUpdates(e,t.updates))}catch(t){t.xhr_status!==404&&console.error("[Feed Store] Ticker check failed:",t)}finally{this.tickerPending[e]=!1}}},async processTickerUpdates(e,t){var o;console.log(`[processTickerUpdates] Called for context: ${e} with ${t.length} updates`),console.log("[processTickerUpdates] Updates:",t);const s=[],u=[];if(t.forEach(i=>{console.log("[processTickerUpdates] Processing update:",{id:i.id,action:i.action,updated_at:i.updated_at});const m=this.feedsById[i.id];console.log("[processTickerUpdates] Existing feed in store:",m?{id:m.id,updated_at:m.updated_at}:"NOT IN STORE"),i.action==="deleted"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for DELETION`),u.push(i.id)):i.action==="created"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (CREATED)`),s.push(i.id)):i.action==="updated"&&(!m||new Date(m.updated_at)<new Date(i.updated_at)?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (UPDATED - ${m?"outdated":"not in store"})`),s.push(i.id)):console.log(`[processTickerUpdates] ⏭️ Skipping feed ${i.id} - already have latest version`))}),console.log("[processTickerUpdates] Summary:",{toFetch:s.length,toDelete:u.length,fetchIds:s,deleteIds:u}),u.length>0&&(console.log(`[processTickerUpdates] 🗑️ Deleting ${u.length} feeds from ${e}`),this.deleteFeedsFromStore(e,u)),s.length>0){console.log(`[processTickerUpdates] 📥 Fetching ${s.length} feeds for ${e}`),await this.fetchFeedsByIds(e,s);const i=t.filter(m=>m.action==="created").length;i>0&&(this.newPostsCount[e]=(this.newPostsCount[e]||0)+i)}(o=window.fluentFrameworkApp)!=null&&o.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:e,added:s.filter(i=>!this.feedsById[i]).length,updated:s.filter(i=>this.feedsById[i]).length,removed:u.length})},async fetchFeedsByIds(e,t){if(t.length===0)return;console.log("[Feed Store] fetchFeedsByIds called:",{context:e,count:t.length,ids:t});const s=20;try{if(t.length>s){console.log(`[Feed Store] Batching ${t.length} feeds into chunks of ${s}`);for(let u=0;u<t.length;u+=s){const o=t.slice(u,u+s);await this.fetchFeedBatch(e,o)}}else await this.fetchFeedBatch(e,t);console.log(`[Feed Store] Successfully fetched ${t.length} feeds for ${e}`)}catch(u){console.error("[Feed Store] Failed to fetch feeds by IDs:",{context:e,feedIds:t,error:u})}},async fetchFeedBatch(e,t){try{console.log("[Feed Store] Fetching feeds:",{context:e,feedIds:t});const s=await this.$api.post("feeds/batch",{feed_ids:t,context:e});if(console.log("[Feed Store] API response:",s),!s||!Array.isArray(s.feeds)){console.error("[Feed Store] Invalid response from /feeds/batch:",s);return}console.log(`[Feed Store] Received ${s.feeds.length} feeds for context: ${e}`),s.feeds.forEach(u=>{this.feedsById[u.id]=u,this.feedsByContext[e]||(this.feedsByContext[e]={data:[],timestamp:Date.now()});const o=this.feedsByContext[e].data,i=o.findIndex(m=>m.id===u.id);i===-1?o.unshift(u):o[i]=u})}catch(s){throw console.error("[Feed Store] Failed to fetch batch for context:",e,s),s}},deleteFeedsFromStore(e,t){t.forEach(s=>{var o;delete this.feedsById[s],(o=this.feedsByContext[e])!=null&&o.data&&(this.feedsByContext[e].data=this.feedsByContext[e].data.filter(i=>i.id!==s)),le().invalidate(`feed:${s}`)}),console.log(`[Feed Store] Deleted ${t.length} feeds from ${e}`)},clearNewPostsCount(e){this.newPostsCount[e]=0},clearAll(){this.stopAllTickers(),this.feedsByContext={},this.feedsById={},this.stickyFeeds={},this.loading={},this.pagination={},this.filters={},this.ticker={count:0,lastFetched:0},this.executionTimes={},this._pendingRequests={},this.tickerIntervals={},this.tickerEnabled={},this.lastTickerCheck={},this.tickerPending={},this.newPostsCount={}}}}),He=Ne("space",{state:()=>({spacesBySlug:{},currentSpace:null,currentPageLayout:null,mySpaces:[],topicsBySpace:{},loading:{},mySpacesLoading:!1,lastFetched:{}}),getters:{getSpaceBySlug:e=>t=>e.spacesBySlug[t]||null,getCurrentSpace:e=>e.currentSpace,getSpaceTopics:e=>t=>e.topicsBySpace[t]||[],isJoinedSpace:e=>t=>e.mySpaces.some(s=>s.slug===t),getMySpaces:e=>[...e.mySpaces].sort((t,s)=>t.title.localeCompare(s.title)),isLoading:e=>t=>e.loading[t]||!1,joinedSpacesCount:e=>e.mySpaces.length},actions:{async fetchSpace(e,t=!1){const s=le(),u=`space:${e}`;if(!t){const o=s.get(u);if(o)return this.spacesBySlug[e]=o,this.currentSpace=o,o}this.loading[e]=!0;try{const o=await this.$api.get(`spaces/${e}/by-slug`),i=o.space||o;return this.spacesBySlug[e]=i,this.currentSpace=i,this.lastFetched[e]=Date.now(),o.topics&&(this.topicsBySpace[e]=o.topics),o.pending_count!==void 0&&(i.pending_count=o.pending_count),s.set(u,i,15*60*1e3),typeof window<"u"&&(window.fcom_current_community=i),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch space:",o),o}},async joinSpace(e,t=null){var i,m,f;const s=le(),u=t||this.spacesBySlug[e];if(!u)throw new Error("Space not found");const o=((i=u.user_status)==null?void 0:i.status)==="active";o||(u.user_status||(u.user_status={}),u.user_status.status="active",u.members_count=(u.members_count||0)+1,this.mySpaces.find(h=>h.slug===e)||this.mySpaces.push(u));try{const h=await this.$api.post(`spaces/${e}/join`),g=(m=h.membership)==null?void 0:m.status;if(g&&(u.user_status.status=g),g&&g!=="active"&&!o){u.members_count=Math.max(0,(u.members_count||1)-1);const k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,1)}return s.invalidate(`space:${e}`),s.invalidate("my-spaces"),(f=window.fluentFrameworkApp)!=null&&f.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_joined",u),h}catch(h){if(!o){u.user_status.status=null,u.members_count=Math.max(0,(u.members_count||1)-1);const g=this.mySpaces.findIndex(k=>k.slug===e);g!==-1&&this.mySpaces.splice(g,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,g;const t=le(),s=this.spacesBySlug[e];if(!s)throw new Error("Space not found");const u=((m=s.user_status)==null?void 0:m.status)==="active",o=(f=s.user_status)==null?void 0:f.status,i=s.members_count;if(u){s.user_status.status=null,s.members_count=Math.max(0,(s.members_count||1)-1);const k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,1)}try{const k=await this.$api.post(`spaces/${e}/leave`),b=k.space||k;return this.spacesBySlug[e]=b,((h=this.currentSpace)==null?void 0:h.slug)===e&&(this.currentSpace=b),t.invalidate(`space:${e}`),t.invalidate("my-spaces"),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(k){throw u&&(s.user_status.status=o,s.members_count=i,this.mySpaces.push(s)),console.error("Failed to leave space:",k),k}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},setCurrentPageLayout(e){this.currentPageLayout=e||null},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=le();t.invalidate(`space:${e}`),t.invalidate(`space-topics:${e}`),delete this.lastFetched[e],this.currentSpace&&this.currentSpace.slug===e&&(this.currentSpace=null),delete this.spacesBySlug[e],delete this.topicsBySpace[e]},clearAll(){this.spacesBySlug={},this.currentSpace=null,this.mySpaces=[],this.topicsBySpace={},this.loading={},this.mySpacesLoading=!1,this.lastFetched={};const e=le();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),ts=Ne("notification",{state:()=>({notifications:[],unreadCount:0,loading:!1,pagination:{page:1,per_page:20,total:0,has_more:!1},pollingInterval:null,pollingEnabled:!1,lastFetched:0}),getters:{getUnreadCount:e=>e.unreadCount,getNotifications:e=>e.notifications,getUnreadNotifications:e=>e.notifications.filter(t=>!t.is_read),isLoading:e=>e.loading,isPollingActive:e=>e.pollingEnabled&&e.pollingInterval!==null},actions:{async fetchNotifications(e=!1){this.loading=!0;const t=e?this.pagination.page+1:1;try{const s=await this.$api.get("notifications",{page:t,per_page:this.pagination.per_page});return e?this.notifications=[...this.notifications,...s.notifications.data]:this.notifications=s.notifications.data,this.pagination={page:t,per_page:this.pagination.per_page,total:s.notifications.total,has_more:s.notifications.has_more},this.unreadCount=s.unread_count||0,this.lastFetched=Date.now(),this.loading=!1,s}catch(s){throw this.loading=!1,console.error("Failed to fetch notifications:",s),s}},async fetchUnreadCount(){try{const e=await this.$api.get("notifications/unread");return this.unreadCount=e.unread_count||0,this.unreadCount}catch(e){return e.xhr_status!==404&&console.error("Failed to fetch unread count:",e),this.unreadCount}},async markAsRead(e){var s;const t=this.notifications.find(u=>u.id===e);t&&!t.is_read&&(t.is_read=!0,this.unreadCount=Math.max(0,this.unreadCount-1));try{const u=await this.$api.post(`notifications/mark-read/${e}`);this.unreadCount=u.unread_count??this.unreadCount,(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("notification_read",e)}catch(u){throw t&&(t.is_read=!1,this.unreadCount++),console.error("Failed to mark notification as read:",u),u}},async markFeedNotificationsAsRead(e){var u;const t=this.notifications.filter(o=>o.object_id===e&&!o.is_read),s=this.unreadCount;t.forEach(o=>{o.is_read=!0}),this.unreadCount=Math.max(0,this.unreadCount-t.length);try{const o=await this.$api.post(`notifications/mark-read/${e}/by-feed-id`);this.unreadCount=o.unread_notification_count??this.unreadCount,(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feed_notifications_read",e)}catch(o){throw t.forEach(i=>{i.is_read=!1}),this.unreadCount=s,console.error("Failed to mark feed notifications as read:",o),o}},async markAllAsRead(){var s;const e=this.unreadCount,t=this.notifications.map(u=>({...u,is_read:u.is_read}));this.notifications.forEach(u=>{u.is_read=!0}),this.unreadCount=0;try{await this.$api.post("notifications/mark-all-read"),(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&(window.fluentFrameworkApp.$eventBus.emit("all_notifications_read"),window.fluentFrameworkApp.$eventBus.emit("notification_count_updated",0))}catch(u){throw this.notifications=t,this.unreadCount=e,console.error("Failed to mark all notifications as read:",u),u}},startPolling(e=6e4){this.pollingInterval&&this.stopPolling(),this.pollingEnabled=!0,this.fetchUnreadCount(),this.pollingInterval=setInterval(()=>{this.fetchUnreadCount()},e),console.log(`[Notification Store] Polling started (interval: ${e}ms)`)},stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null,this.pollingEnabled=!1,console.log("[Notification Store] Polling stopped"))},clearAll(){this.notifications=[],this.unreadCount=0,this.loading=!1,this.pagination={page:1,per_page:20,total:0,has_more:!1},this.lastFetched=0,this.stopPolling()}}}),eo=Ne("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,maxBackoff:6e4,maxErrors:5,paused:!1,visibilityHandler:null,focusHandler:null}),getters:{isActive:e=>e.enabled&&e.tickerInterval!==null,isPaused:e=>e.paused},actions:{start(e=45e3,t=75e3,s=5e4){this.tickerInterval&&this.stop(),this.minInterval=e,this.maxInterval=t,this.enabled=!0,this.errorCount=0,this.lastCheck=null,console.log(`[Global Ticker] Started (random interval: ${e}ms - ${t}ms, initial delay: ${s}ms)`),this.setupVisibilityHandler(),console.log(`[Global Ticker] First check scheduled in ${(s/1e3).toFixed(1)} seconds`),setTimeout(async()=>{this.enabled&&(await this.check(),this.scheduleNextCheck())},s)},scheduleNextCheck(){if(this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),!this.enabled)return;let e;this.errorCount>0?e=Math.min(this.maxBackoff,1e3*Math.pow(2,this.errorCount)):e=Math.floor(Math.random()*(this.maxInterval-this.minInterval+1))+this.minInterval,console.log(`[Global Ticker] Next check in ${(e/1e3).toFixed(1)} seconds`),this.tickerInterval=setTimeout(async()=>{this.paused||await this.check(),this.scheduleNextCheck()},e)},stop(){const e=this.enabled||this.tickerInterval!==null;this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),this.enabled=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),this.focusHandler&&(window.removeEventListener("focus",this.focusHandler),this.focusHandler=null),e&&console.log("[Global Ticker] Stopped")},pause(){this.paused=!0,console.log("[Global Ticker] Paused (tab hidden)")},resume(){this.paused=!1,console.log("[Global Ticker] Resumed (tab visible)"),this.check()},async check(){if(!this.pending){this.pending=!0;try{const e={};this.lastCheck&&(e.since=this.lastCheck),console.log("[Global Ticker] Check params:",e);const t=await this.$api.get("feeds/ticker",e);t&&t.timestamp&&(this.lastCheck=t.timestamp,console.log("[Global Ticker] Updated lastCheck to:",this.lastCheck)),this.errorCount=0,await this.processUpdates(t)}catch(e){this.handleError(e)}finally{this.pending=!1}}},async processUpdates(e){var i;const{feeds:t=[],notifications:s={},spaces:u=[],has_changes:o=!1}=e;if(s&&s.unread_count!==void 0&&this.processNotificationUpdates(s),!!o&&(console.log("[Global Ticker] Processing updates:",{feeds:t.length,notifications:s.unread_count||0,spaces:u.length}),t.length>0&&await this.processFeedUpdates(t),u.length>0&&this.processSpaceUpdates(u),(i=window.fluentFrameworkApp)!=null&&i.$eventBus)){const m={...e,unread_notification_count:s.unread_count||0};window.fluentFrameworkApp.$eventBus.emit("ticker_updated",m)}},async processFeedUpdates(e){console.log("[Ticker Debug] processFeedUpdates called with:",e);const t=Me();e.forEach(s=>{var m;const u=s.context||"global",o=s.id,i=[u];if(s.action!=="deleted"&&(u.startsWith("space-")&&i.push("global"),s.user_id&&i.push(`user-${s.user_id}`)),s.action==="deleted")console.log(`[Global Ticker] Deleting feed ${o} from contexts:`,i),i.forEach(f=>{t.deleteFeedsFromStore(f,[o])});else if(s.feed_data){const f=s.feed_data;console.log(`[Global Ticker] Updating feed ${o} in contexts:`,i),i.forEach(h=>{t.feedsById[f.id]=f,t.feedsByContext[h]||(t.feedsByContext[h]={data:[],timestamp:Date.now()});const g=t.feedsByContext[h].data,k=g.findIndex(b=>b.id===f.id);k===-1?(g.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),s.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(g[k]=f,console.log(`[Global Ticker] Updated feed ${f.id} in ${h}`))}),(m=window.fluentFrameworkApp)!=null&&m.$eventBus&&i.forEach(h=>{window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:h,added:s.action==="created"?1:0,updated:s.action==="updated"?1:0,removed:0})})}else console.warn(`[Global Ticker] Feed ${o} has no feed_data, skipping update`)})},processNotificationUpdates(e){var u,o,i,m;const t=ts();e.unread_count!==void 0&&(t.unreadCount=e.unread_count,(o=(u=window.fluentFrameworkApp)==null?void 0:u.$eventBus)==null||o.emit("notification_count_updated",e.unread_count));const s=e.new_items;Array.isArray(s)&&s.length&&((m=(i=window.fluentFrameworkApp)==null?void 0:i.$eventBus)==null||m.emit("new_notifications_received",s))},processSpaceUpdates(e){console.log("[Global Ticker] Space updates:",e.length)},handleError(e){if(e&&e.xhr_status!==404&&console.error("[Global Ticker] Check failed:",e),this.errorCount++,this.errorCount>=this.maxErrors){console.warn("[Global Ticker] Too many consecutive failures — stopping ticker."),this.stop();return}},setupVisibilityHandler(){typeof document.hidden<"u"&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=()=>{document.hidden?this.pause():this.resume()},document.addEventListener("visibilitychange",this.visibilityHandler)),this.focusHandler&&window.removeEventListener("focus",this.focusHandler),this.focusHandler=()=>{document.hidden||this.check()},window.addEventListener("focus",this.focusHandler)}}}),yn={name:"ChatIcon"},vn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function bn(e,t,s,u,o,i){return n(),r("svg",vn,[...t[0]||(t[0]=[l("path",{d:"M6.66732 11.25H13.334M6.66732 7.08333H10.0007",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M5.08267 15.833C3.99924 15.7264 3.18762 15.401 2.6433 14.8567C1.66699 13.8804 1.66699 12.309 1.66699 9.16634V8.74967C1.66699 5.60698 1.66699 4.03563 2.6433 3.05932C3.61961 2.08301 5.19096 2.08301 8.33366 2.08301H11.667C14.8097 2.08301 16.381 2.08301 17.3573 3.05932C18.3337 4.03563 18.3337 5.60698 18.3337 8.74967V9.16634C18.3337 12.309 18.3337 13.8804 17.3573 14.8567C16.381 15.833 14.8097 15.833 11.667 15.833C11.1999 15.8434 10.8279 15.879 10.4625 15.9622C9.46385 16.1921 8.5391 16.7031 7.62522 17.1487C6.32307 17.7837 5.67199 18.1012 5.2634 17.8039C4.48174 17.2218 5.24577 15.4179 5.41699 14.583",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])])}const Qe=P(yn,[["render",bn]]),kn={name:"HeartIcon",props:{filled:{default:!1}}},wn={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},Cn={key:1,viewBox:"0 0 24 24","aria-hidden":"true"};function $n(e,t,s,u,o,i){return s.filled?(n(),r("svg",wn,[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})],-1)])])):(n(),r("svg",Cn,[...t[1]||(t[1]=[l("g",null,[l("path",{d:"M16.697 5.5c-1.222-.06-2.679.51-3.89 2.16l-.805 1.09-.806-1.09C9.984 6.01 8.526 5.44 7.304 5.5c-1.243.07-2.349.78-2.91 1.91-.552 1.12-.633 2.78.479 4.82 1.074 1.97 3.257 4.27 7.129 6.61 3.87-2.34 6.052-4.64 7.126-6.61 1.111-2.04 1.03-3.7.477-4.82-.561-1.13-1.666-1.84-2.908-1.91zm4.187 7.69c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})],-1)])]))}const Xe=P(kn,[["render",$n]]),to=["comment_added","mention_added","comment/react_added","child_comment_added"];function so(e){const t=(e==null?void 0:e.route)||{},{action:s,object_id:u,feed_id:o}=e||{};return{...t,query:{comment_added:{comment_id:u},mention_added:{comment_id:u},"comment/react_added":{comment_id:u},comment_report_added:{comment_id:o}}[s]??t.query??{}}}const Sn={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:Qe,HeartIcon:Xe},props:["notifications"],methods:{handleNotificationClick(e,t){var u,o;if(this.markRead(e,t),!to.includes(e.action))return;const s=(o=(u=this.getNotificationRoute(e))==null?void 0:u.query)==null?void 0:o.comment_id;s&&this.$eventBus.emit("scroll_to_comment",s)},markRead(e){e.subscriber&&e.subscriber.is_read==1||this.$post("notifications/mark-read/"+e.id).then(t=>{const s=e.feed_id;this.notifications.forEach(u=>{u.subscriber&&(u.id===e.id||s&&u.feed_id===s)&&(u.subscriber.is_read=1)}),this.$eventBus.emit("notification_count_updated",t.unread_count)})},getNotificationRoute(e){return so(e)}}},Vn={class:"notification_avatar"},Mn={class:"fcom_notification_type"},Ln={class:"notification_content"},Tn=["innerHTML"],Fn=["title"];function Pn(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("ChatIcon"),h=j,g=p("HeartIcon"),k=p("router-link");return n(!0),r(T,null,x(s.notifications,(b,S)=>{var w;return n(),r("div",{class:D(["notification_wrap",{notification_wrap_unread:((w=b==null?void 0:b.subscriber)==null?void 0:w.is_read)=="0"}])},[a(k,{onClick:$=>i.handleNotificationClick(b,S),to:i.getNotificationRoute(b),class:"notification_item"},{default:c(()=>[l("div",Vn,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",Mn,[b.action=="comment_added"||b.action=="child_comment_added"?(n(),v(h,{key:0,class:"fcom_nt_comment"},{default:c(()=>[a(f)]),_:1})):b.action=="feed/react_added"||b.action=="comment/react_added"?(n(),v(h,{key:1,class:"fcom_nt_heart"},{default:c(()=>[a(g,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(n(),v(h,{key:2,class:"fcom_nt_mention"},{default:c(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(n(),v(h,{key:3,class:"fcom_new_post"},{default:c(()=>[...t[0]||(t[0]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"},[l("path",{d:"M12.9915 20.5C13.7121 20.5 13.9925 20.4956 13.9925 20.4956C17.4088 20.471 19.2922 20.3099 20.5342 19.2552C22 18.0104 22 16.0069 22 12C22 7.99306 22 5.98959 20.5342 4.7448C19.0683 3.5 16.7091 3.5 11.9906 3.5C7.27213 3.5 4.91289 3.5 3.44705 4.7448C2.32426 5.69827 2.0615 7.09687 2 9.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M2.98242 19.5H2.9914",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M2 15.7349C4.49328 15.7349 6.77053 18 6.77053 20.4996M10 20.4996C10 16 5.99511 12.5 2.04522 12.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"})],-1)])]),_:1})):_("",!0)])]),l("div",Ln,[l("div",{innerHTML:b.content},null,8,Tn),l("span",{title:b.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(b.updated_at)),9,Fn)])]),_:2},1032,["onClick","to"])],2)}),256)}const oo=P(Sn,[["render",Pn]]),In={name:"NotificationIcon"},En={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function An(e,t,s,u,o,i){return n(),r("svg",En,[...t[0]||(t[0]=[l("path",{d:"M2.10794 11.9954C1.93073 13.1229 2.72301 13.9055 3.69305 14.2955C7.41201 15.7908 12.5873 15.7908 16.3063 14.2955C17.2763 13.9055 18.0686 13.1229 17.8914 11.9954C17.7825 11.3024 17.244 10.7254 16.845 10.162C16.3224 9.41493 16.2705 8.60009 16.2704 7.73317C16.2704 4.38291 13.4629 1.66699 9.99968 1.66699C6.53645 1.66699 3.72895 4.38291 3.72895 7.73317C3.72887 8.60009 3.67694 9.41493 3.15435 10.162C2.75537 10.7254 2.21685 11.3024 2.10794 11.9954Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M7.5 17.5C8.16345 18.0182 9.03956 18.3333 10 18.3333C10.9604 18.3333 11.8366 18.0182 12.5 17.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const Un=P(In,[["render",An]]),Bn={name:"NotificationOnboard",components:{Bell:Ns,Close:kt},emits:["before-prompt"],props:{placement:{type:String,default:"feed_sidebar"},shouldShowCloseButton:{type:Boolean,default:!0}},data(){return{pushEnabled:!1,permission:"",requestInProgress:!1,confirmed:!1,dismissed:!1}},computed:{hasPush(){if(!this.appVars.has_push_notification||!this.pushEnabled||this.permission==="granted"||!this.appVars.push_prompt_placements.includes(this.placement)||this.dismissed)return!1;const e=this.Storage.get("fcom_push_prompt_closed",0);return!e||new Date().getTime()>e}},methods:{dismiss(){this.Storage.set("fcom_push_prompt_closed",new Date().getTime()+7*24*60*60*1e3),this.dismissed=!0},async processSubscribe(){if(this.$emit("before-prompt"),this.permission==="denied"){const t='<a href="'+"https://docs.fluentcommunity.co/enabling-and-disabling-push-notifications"+'" target="_blank" rel="noopener noreferrer">',s=this.$t("Notifications are blocked for this site. Reset the permission in your browser settings, come back, and reload the page.")+" "+this.$t("Not sure how? %1$sFollow this guide%2$s.",t,"</a>");this.$messageBox.alert(s,this.$t("Notifications Blocked"),{dangerouslyUseHTMLString:!0,confirmButtonText:this.$t("Close"),closeOnClickModal:!0,closeOnPressEscape:!0}).catch(()=>{});return}window.fluentNotify&&(this.requestInProgress=!0,await window.fluentNotify.subscribe()?(this.$notify.success(this.$t("You have successfully subscribed to push notifications.")),this.permission=window.fluentNotify.getPermission(),this.confirmed=!0):this.$notify.error(this.$t("Failed to subscribe to push notifications. Please try again.")),this.requestInProgress=!1,this.permission=window.fluentNotify.getPermission())},watchForPermissionChange(){var e,t;this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()}},mounted(){var e,t;window.fluentNotify?(this.pushEnabled=(e=window.fluentNotify)==null?void 0:e.isAvailable,this.permission=(t=window.fluentNotify)==null?void 0:t.getPermission()):document.addEventListener("fluent-notify-initialized",this.watchForPermissionChange)},beforeUnmount(){document.removeEventListener("fluent-notify-initialized",this.watchForPermissionChange)}},Dn={key:0,class:"app_side_widget widget_push_notification"},Rn={class:"widget_header"},xn={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},On=["aria-label"],Hn={class:"widget_body notifications_wrap"},jn={class:"onboard_actions fcom_mt_10"},Nn={key:0},zn={key:1},qn={key:0,style:{"margin-top":"10px"}},Gn={key:1,class:"app_side_widget widget_push_notification"};function Yn(e,t,s,u,o,i){const m=p("Bell"),f=j,h=p("Close"),g=O,k=Yt;return i.hasPush?(n(),r("div",Dn,[l("div",Rn,[l("h3",xn,[a(f,{style:{"font-size":"120%"}},{default:c(()=>[a(m)]),_:1}),l("span",null,d(e.$t("Never Miss a Reply")),1)]),s.shouldShowCloseButton?(n(),r("button",{key:0,type:"button",class:"fcom_push_prompt_dismiss","aria-label":e.$t("Dismiss push notification prompt"),onClick:t[0]||(t[0]=b=>i.dismiss())},[a(f,null,{default:c(()=>[a(h)]),_:1})],8,On)):_("",!0)]),l("div",Hn,[l("p",null,d(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",jn,[a(g,{loading:o.requestInProgress,class:"fcom_primary_button",onClick:t[1]||(t[1]=b=>i.processSubscribe())},{default:c(()=>[o.requestInProgress?(n(),r("span",zn,d(e.$t("Processing...")),1)):(n(),r("span",Nn,d(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),o.requestInProgress?(n(),r("p",qn,d(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):o.confirmed?(n(),r("div",Gn,[a(k,{type:"success",closable:!1,"show-icon":"",title:e.$t("You will get push notifications on replies and important updates.")},null,8,["title"])])):_("",!0)}const ss=P(Bn,[["render",Yn]]),Wn={name:"Notifications",components:{NotificationsBlock:oo,NotificationIcon:Un,NotificationOnboard:ss},data(){return{unread_notifications:[],unread_count:parseInt(this.appVars.unread_notification_count),loading:!1,working:!1,visible:!1,notification_type:"all"}},methods:{onTickerUpdated(e){this.appVars.unread_notification_count=e.unread_notification_count,this.unread_count=e.unread_notification_count},onNotificationCountUpdated(e){this.appVars.unread_notification_count=e,this.unread_count=e},switchType(e){this.notification_type=e,this.fetchUnread()},toggleNotifications(){this.loading=!0,this.visible=!0,this.fetchUnread()},handleClose(){this.$refs.notification_pop.hide(),this.visible=!1},fetchUnread(){this.loading=!0;const e={per_page:50};this.notification_type==="unread"?e.status="unread":e.notification_type=this.notification_type,this.$get("notifications",e).then(t=>{var s;this.unread_notifications=((s=t.notifications)==null?void 0:s.data)||[],this.appVars.unread_notification_count=t.unread_count,this.unread_count=t.unread_count}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},markAllRead(){this.working=!0,this.$post("notifications/mark-all-read").then(e=>{this.$notify.success(e.message),this.fetchUnread()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})},keyBind(e){e.code==="KeyN"&&e.altKey&&this.$refs.notification_icon.click()}},mounted(){var e;document.addEventListener("keydown",this.keyBind),(e=window.fcom_portal_general)!=null&&e.hide_header_on_scroll&&(this._scrollClose=()=>this.isMobile&&this.handleClose(),document.addEventListener("fcom_layout_scroll",this._scrollClose)),this.$eventBus.on("ticker_updated",this.onTickerUpdated),this.$eventBus.on("notification_count_updated",this.onNotificationCountUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this._scrollClose&&document.removeEventListener("fcom_layout_scroll",this._scrollClose),this.$eventBus.off("ticker_updated",this.onTickerUpdated),this.$eventBus.off("notification_count_updated",this.onNotificationCountUpdated)}},Kn=["aria-label"],Zn={class:"notifications_wrap unread_notifications"},Jn={class:"norification_pop_header"},Qn={class:"fcom_filter_menu"},Xn={class:"fcom_filter_menu_ul"},el={key:2,class:"fcom_no_unread_notifications"};function tl(e,t,s,u,o,i){const m=p("NotificationIcon"),f=j,h=qo,g=O,k=J,b=p("notifications-block"),S=p("router-link"),w=p("notification-onboard"),$=fe,y=se("loading");return n(),v($,{popperClass:"notification_pop","popper-options":{strategy:"fixed"},onBeforeEnter:t[8]||(t[8]=C=>i.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:c(()=>[a(h,{max:20,hidden:!o.unread_count,value:o.unread_count,class:"item"},{default:c(()=>[l("button",{class:"fcom_menu_button","aria-label":e.$t("Notifications"),ref:"notification_icon"},[a(f,null,{default:c(()=>[a(m)]),_:1})],8,Kn)]),_:1},8,["hidden","value"])]),default:c(()=>[l("div",Zn,[l("div",Jn,[l("h3",null,d(e.$t("Recent Notifications")),1),l("div",null,[Y((n(),v(g,{disabled:o.working,size:"small",onClick:t[0]||(t[0]=C=>i.markAllRead())},{default:c(()=>[M(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[y,o.working]])])]),l("div",Qn,[l("ul",Xn,[l("li",null,[l("a",{onClick:t[1]||(t[1]=q(C=>i.switchType("all"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="all"}),href:"#"},d(e.$t("Recent")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=q(C=>i.switchType("unread"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=q(C=>i.switchType("mentioned"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=q(C=>i.switchType("following"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),o.loading?(n(),v(k,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):o.unread_notifications.length?(n(),r("div",{key:1,onClick:t[6]||(t[6]=C=>e.$refs.notification_pop.hide()),class:"notifications fcom_thin_scrollbar"},[a(b,{onClose:t[5]||(t[5]=C=>i.handleClose()),notifications:o.unread_notifications},null,8,["notifications"])])):(n(),r("div",el,[l("p",null,d(e.$t("No notifications found")),1)])),a(S,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:i.handleClose},{default:c(()=>[a(g,{class:"fcom_secondary_button"},{default:c(()=>[M(d(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"]),a(w,{placement:"notification_popover",onBeforePrompt:t[7]||(t[7]=C=>i.handleClose())})])]),_:1},512)}const sl=P(Wn,[["render",tl]]),ol=40,il={name:"NotificationToaster",data(){return{duration:12e3,maxVisible:2,seenKeys:[]}},computed:{storageKey(){var e;return"fcom_seen_toasts_"+(((e=this.auth)==null?void 0:e.user_id)||0)}},created(){this.seenKeys=this.readSeenKeys(),this.$eventBus.on("new_notifications_received",this.handleNewNotifications)},beforeUnmount(){this.$eventBus.off("new_notifications_received",this.handleNewNotifications)},methods:{handleNewNotifications(e){if(!Array.isArray(e)||!e.length)return;if(document.hidden){this.rememberKeys(e.map(s=>this.getKey(s)));return}const t=e.filter(s=>s&&!this.seenKeys.includes(this.getKey(s)));t.length&&(this.rememberKeys(t.map(s=>this.getKey(s))),t.slice(0,this.maxVisible).reverse().forEach(s=>this.showToast(s)))},showToast(e){const t=window.innerWidth<=1024,s={message:this.renderBody(e),duration:this.duration,position:t?"top-left":"bottom-left",showClose:!0,customClass:"fcom_notification_toast",onClick:()=>{u&&u.close(),this.openNotification(e)}};t&&(s.offset=20);const u=this.$notify(s)},renderBody(e){const t=[];return e.avatar&&t.push(Dt("img",{class:"fcom_toast_avatar",src:e.avatar,alt:"",onError:this.setAltImg})),t.push(Dt("span",{class:"fcom_toast_text"},e.text||"")),Dt("div",{class:"fcom_toast_body"},t)},openNotification(e){var u;this.markRead(e);const t=so(e);if(this.$router.push(t),!to.includes(e.action))return;const s=(u=t==null?void 0:t.query)==null?void 0:u.comment_id;s&&this.$eventBus.emit("scroll_to_comment",s)},markRead(e){this.$post("notifications/mark-read/"+e.id).then(t=>{this.$eventBus.emit("notification_count_updated",t.unread_count)}).catch(()=>{})},getKey(e){return e.id+":"+(e.notified_at||"")},rememberKeys(e){if(!e.length)return;const t=this.seenKeys.concat(e.filter(s=>!this.seenKeys.includes(s)));this.seenKeys=t.slice(-ol),this.writeSeenKeys(this.seenKeys)},readSeenKeys(){try{const e=window.localStorage.getItem(this.storageKey),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}},writeSeenKeys(e){try{window.localStorage.setItem(this.storageKey,JSON.stringify(e))}catch{}},setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}},render(){return null}},nl={name:"ImageUploader",emits:["uploaded","completed","uploading"],data(){return{loading:!1}},props:{button_text:{type:String,default:""},remove_label:{type:String,default:""},additionalData:{type:Object,default:()=>({})},isMultiple:{type:Boolean,default:!1},can_remove:{type:Boolean,default:!1},confirm_remove:{type:Boolean,default:!1},isTextBtn:{type:Boolean,default:!0},removeIcon:{type:Boolean,default:!0},className:{type:String,default:"image-uploader"}},methods:{handleRemove(){if(!this.confirm_remove){this.$emit("uploaded","");return}this.$confirm(this.$t("Are you sure you want to remove this image?"),this.$t("Remove Image?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.$emit("uploaded","")})},handleSuccess(e){this.$emit("uploaded",e.media.url),this.$emit("completed",e),this.loading=!1},handleError(e){this.$handleError(JSON.parse(e.message)),this.$emit("completed",e),this.loading=!1},inProgress(e){this.$emit("uploading"),this.loading=!0}},computed:{action_url(){return this.appVars.rest.url+"/feeds/media-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}}};function ll(e,t,s,u,o,i){const m=O,f=bt,h=p("CloseBold"),g=j,k=se("loading");return n(),r(T,null,[a(f,{class:D(s.className),multiple:s.isMultiple,action:i.action_url,headers:i.headers,accept:"image/*",data:s.additionalData,"on-success":i.handleSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1},{default:c(()=>[K(e.$slots,"trigger",{loading:o.loading},()=>[K(e.$slots,"default",{loading:o.loading},()=>[Y((n(),v(m,{disabled:o.loading,text:s.isTextBtn,class:"fcom_plain_button"},{default:c(()=>[M(d(s.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[k,o.loading]])])])]),_:3},8,["class","multiple","action","headers","data","on-success","on-progress","on-error"]),s.can_remove?(n(),v(m,{key:0,class:"remove_img",size:"small",type:"danger",plain:"",onClick:i.handleRemove,text:s.isTextBtn,"aria-label":s.remove_label||e.$t("Remove")},{default:c(()=>[K(e.$slots,"remove",{},()=>[s.removeIcon?(n(),v(g,{key:0},{default:c(()=>[a(h)]),_:1})):_("",!0),l("span",null,d(e.$t("Remove")),1)])]),_:3},8,["onClick","text","aria-label"])):_("",!0)],64)}const Re=P(nl,[["render",ll]]),al={name:"ImageIcon"},rl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function cl(e,t,s,u,o,i){return n(),r("svg",rl,[...t[0]||(t[0]=[l("path",{d:"M7.49996 18.3327H12.5C16.6666 18.3327 18.3333 16.666 18.3333 12.4993V7.49935C18.3333 3.33268 16.6666 1.66602 12.5 1.66602H7.49996C3.33329 1.66602 1.66663 3.33268 1.66663 7.49935V12.4993C1.66663 16.666 3.33329 18.3327 7.49996 18.3327Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M7.50004 8.33333C8.42052 8.33333 9.16671 7.58714 9.16671 6.66667C9.16671 5.74619 8.42052 5 7.50004 5C6.57957 5 5.83337 5.74619 5.83337 6.66667C5.83337 7.58714 6.57957 8.33333 7.50004 8.33333Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M2.22498 15.7918L6.33331 13.0335C6.99164 12.5918 7.94164 12.6418 8.53331 13.1501L8.80831 13.3918C9.45831 13.9501 10.5083 13.9501 11.1583 13.3918L14.625 10.4168C15.275 9.85846 16.325 9.85846 16.975 10.4168L18.3333 11.5835",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const os=P(al,[["render",cl]]),dl={name:"PollIcon"},ul={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function _l(e,t,s,u,o,i){return n(),r("svg",ul,[...t[0]||(t[0]=[l("path",{d:"M1.66663 18.334H18.3333",stroke:"currentColor","stroke-width":"1.5","stroke-miterlimit":"10","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M8.125 3.33268V18.3327H11.875V3.33268C11.875 2.41602 11.5 1.66602 10.375 1.66602H9.625C8.5 1.66602 8.125 2.41602 8.125 3.33268Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M2.5 8.33268V18.3327H5.83333V8.33268C5.83333 7.41602 5.5 6.66602 4.5 6.66602H3.83333C2.83333 6.66602 2.5 7.41602 2.5 8.33268Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M14.1666 12.5007V18.334H17.5V12.5007C17.5 11.584 17.1666 10.834 16.1666 10.834H15.5C14.5 10.834 14.1666 11.584 14.1666 12.5007Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const ml=P(dl,[["render",_l]]),hl={name:"SurveyEditForm",props:{form:{type:Object,required:!0},is_editing:{type:Boolean,default:!1}},emits:["cancel"],data(){return{}},methods:{addOption(){this.form.options.push({label:"",slug:""})},removeOption(e){this.form.options.splice(e,1)}}},fl={class:"fcom_compose_app_form"},pl={class:"fcom_app_header"},gl={class:"fcom_app_options"},yl={class:"fcom_app_pref"},vl={class:"fcom_app_footer"},bl={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function kl(e,t,s,u,o,i){const m=O,f=ie,h=p("Plus"),g=j,k=ve,b=Ye;return n(),r("div",fl,[l("div",pl,[l("h5",null,d(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=S=>e.$emit("cancel")),size:"small",text:""},{default:c(()=>[M(d(e.$t("cancel")),1)]),_:1})])]),l("div",gl,[(n(!0),r(T,null,x(s.form.options,(S,w)=>(n(),r("div",{class:"fcom_app_option",key:"option_"+w},[a(f,{modelValue:S.label,"onUpdate:modelValue":$=>S.label=$,type:"text",placeholder:e.$t("Your option text")},ye({_:2},[!S.slug&&w!==0?{name:"suffix",fn:c(()=>[a(m,{onClick:$=>i.removeOption(w),text:"",size:"small"},{default:c(()=>[...t[3]||(t[3]=[M("x",-1)])]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",yl,[a(m,{onClick:i.addOption,text:"",size:"small"},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1}),l("span",null,d(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",vl,[l("h5",null,d(e.$t("Poll Settings")),1),s.is_editing?_("",!0):(n(),v(k,{key:0,modelValue:s.form.type,"onUpdate:modelValue":t[1]||(t[1]=S=>s.form.type=S),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),t[4]||(t[4]=l("br",null,null,-1)),l("label",bl,d(e.$t("End Date:")),1),l("div",null,[a(b,{style:{"min-width":"50%"},placeholder:e.$t("Leave blank for not end"),clearable:!0,type:"datetime",modelValue:s.form.end_date,"onUpdate:modelValue":t[2]||(t[2]=S=>s.form.end_date=S),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const wl=P(hl,[["render",kl]]),Cl={name:"GiphyIcon"},$l={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Sl(e,t,s,u,o,i){return n(),r("svg",$l,[...t[0]||(t[0]=[Le('<path d="M12.9287 10.09H14.7095" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.0781 8.20333H12.9277V11.98" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M10.3458 8.19998V11.98" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M7.74961 8.2H6.48961C5.44549 8.2 4.59961 9.04588 4.59961 10.09V10.09C4.59961 11.1341 5.44549 11.98 6.48961 11.98H7.74961V10.09H6.69961" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4.5 19C2.567 19 1 17.433 1 15.5L1 4.49999C1 2.567 2.567 0.999992 4.5 0.999992H15.5C17.433 0.999992 19 2.567 19 4.49999V15.5C19 17.433 17.433 19 15.5 19H4.5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>',5)])])}const Vl=P(Cl,[["render",Sl]]),Ml={name:"Giphy",components:{GiphyIcon:Vl},data(){return{gifs:[],searchQuery:"",offset:0,limit:20,loading:!1}},methods:{loadGifs(){var t,s;if(this.offset===0&&((s=(t=this.$gloablStorage)==null?void 0:t.gifs)==null?void 0:s.length)>0&&!this.searchQuery){this.gifs=this.$gloablStorage.gifs;return}this.loading=!0;const e={limit:this.limit,offset:this.offset,q:this.searchQuery.trim()};this.$get("giphy",e).then(u=>{this.gifs=this.offset===0?u.gifs:this.gifs.concat(u.gifs),!this.searchQuery&&this.offset===0&&(this.$gloablStorage.gifs=this.gifs),this.offset+=this.limit}).catch(u=>{this.$handleError(u)}).finally(()=>{this.loading=!1})},handleGiphyClick(){this.offset=0,this.searchQuery="",this.loadGifs()},handleSearch:Zi(function(){this.offset=0,this.loadGifs()},300),handleScroll(e){e.target.scrollHeight-e.target.scrollTop===e.target.clientHeight&&!this.loading&&this.loadGifs()},selectGiphy(e){this.$emit("selected-giphy",e),this.$refs.popover.hide()}}},Ll={class:"fcom_giphy_composer"},Tl={class:"search-container"},Fl=["onLoad","src","alt","onClick"],Pl={key:0,class:"img_loading"},Il={key:1,class:"no_result"};function El(e,t,s,u,o,i){const m=ie,f=ct,h=dt,g=p("GiphyIcon"),k=j,b=O,S=fe,w=se("loading");return n(),r("div",Ll,[a(S,{placement:"bottom-end",width:300,persistent:!1,trigger:"click",teleported:!1,"popper-class":"fcom_giphy_popover fcom_menu_below_nav",ref:"popover"},{reference:c(()=>[a(b,{"aria-label":e.$t("Pick GIF"),text:"",onClick:i.handleGiphyClick},{default:c(()=>[a(k,{class:D(["fcom_apps_icon"])},{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:c(()=>[Y((n(),r("div",Tl,[a(m,{modelValue:o.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=$=>o.searchQuery=$),placeholder:e.$t("Search Gifs"),onInput:i.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...$)=>i.handleScroll&&i.handleScroll(...$))},[o.gifs.length>0?(n(),v(h,{key:0,gutter:5},{default:c(()=>[(n(!0),r(T,null,x(o.gifs,$=>(n(),v(f,{span:12,key:$.id,class:"gif_item"},{default:c(()=>[l("img",{alt:"",onLoad:y=>$.loaded=!0,src:$.images.preview_gif.url,onClick:y=>i.selectGiphy($)},null,40,Fl),$.loaded?_("",!0):(n(),r("p",Pl))]),_:2},1024))),128))]),_:1})):(n(),r("p",Il,d(e.$t("No results")),1))],32),t[2]||(t[2]=l("div",{class:"fcom_giphy_powered_by"},[l("span",{class:"powered_by"},"POWERED BY "),l("span",null,"GIPHY")],-1))])),[[w,o.loading]])]),_:1},512)])}const Al=P(Ml,[["render",El]]),Ul={name:"VideoIcon"},Bl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Dl(e,t,s,u,o,i){return n(),r("svg",Bl,[...t[0]||(t[0]=[l("rect",{x:"1",y:"1",width:"18",height:"18",rx:"3.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M8.90484 7.14604L12.663 9.3589C13.1383 9.6384 13.1383 10.3237 12.663 10.6032L8.90484 12.816C8.4208 13.1013 7.80896 12.7534 7.80896 12.1934V7.76865C7.80896 7.20869 8.4208 6.86076 8.90484 7.14604Z",fill:"currentColor"},null,-1)])])}const Rl=P(Ul,[["render",Dl]]);const xl={name:"FluentPlayerPreview",emits:["load-failed"],props:{media:{type:Object,required:!0}},data(){return{html:"",loading:!1,playerInstanceKey:"",fallbackGuardCleanups:[],guardGeneration:0}},watch:{"media.url"(){this.loadFluentPlayerContent()}},async mounted(){await this.loadFluentPlayerContent()},beforeUnmount(){this.clearFallbackGuard()},methods:{getFallbackTiming(e,t){var u,o;const s=Number((o=(u=this.appVars.features.fluent_player)==null?void 0:u.fallback)==null?void 0:o[e]);return!Number.isFinite(s)||s<500?t:s},getPlayerInstanceKey(){if(!this.playerInstanceKey){const e=Number.parseInt(this._uid,10);this.playerInstanceKey=Number.isSafeInteger(e)&&e>0?`i${e}`:`i${Math.random().toString(36).slice(2,8)}`}return this.playerInstanceKey},getStableMediaId(){var u,o,i,m,f,h,g,k,b,S,w,$;const e=Number.parseInt((u=this.media)==null?void 0:u.media_id,10);if(Number.isSafeInteger(e)&&e>0)return e;const t=[(o=this.media)==null?void 0:o.media_key,(i=this.media)==null?void 0:i.feed_id,(m=this.media)==null?void 0:m.share_url,(h=(f=this.media)==null?void 0:f.settings)==null?void 0:h.src,(g=this.media)==null?void 0:g.url,(k=this.media)==null?void 0:k.html,(b=this.media)==null?void 0:b.title,(S=this.media)==null?void 0:S.player,(w=this.media)==null?void 0:w.type,($=this.media)==null?void 0:$.provider].filter(Boolean).join("|");if(!t)return 1;let s=5381;for(let y=0;y<t.length;y++)s=(s<<5)+s+t.charCodeAt(y)>>>0;return s||1},async loadFluentPlayerContent(){this.clearFallbackGuard();const e=++this.guardGeneration;this.loading=!0;try{if(!this.appVars.features.has_fluent_player||this.appVars.features.enable_fluent_player!=="yes"){this.$emit("load-failed");return}const t=this.getStableMediaId(),s=await this.withTimeout(this.$get("fluent-player/video-content/"+t,{...this.media,media_id:t,player_instance_key:this.getPlayerInstanceKey()}),this.getFallbackTiming("content_timeout_ms",1e4));if(e!==this.guardGeneration)return;s.html?(this.html=s.html,this.$nextTick(()=>{if(e!==this.guardGeneration)return;const u=this.$el&&this.$el.querySelector(".fluent-player");if(!u){this.fallBack("player markup missing");return}this.startFallbackGuard(u,s.media)})):this.$emit("load-failed")}catch(t){if(e!==this.guardGeneration)return;console.warn("Failed to load fluent-player assets:",t),this.$emit("load-failed")}finally{e===this.guardGeneration&&(this.loading=!1)}},withTimeout(e,t){return Promise.race([e,new Promise((s,u)=>{const o=setTimeout(()=>u(new Error("fluent-player content request timed out")),t);this.fallbackGuardCleanups.push(()=>clearTimeout(o))})])},startFallbackGuard(e,t){const s=()=>{document.dispatchEvent(new CustomEvent("InitSingleFluentPlayer",{detail:{container:e,playerData:{media:t}}}))};this.waitForPlayerScript(this.getFallbackTiming("script_timeout_ms",12e3),u=>{if(!u){this.fallBack("player script never loaded");return}s(),this.verifyPlayerInit(e)})},waitForPlayerScript(e,t){const s=()=>typeof window.FluentPlayer=="function";if(s()){t(!0);return}const u=document.querySelector('script[src*="fluent-player.js"]');let o=!1;const i=()=>{o=!0};u&&u.addEventListener("error",i);const m=()=>!u||!window.performance||!performance.getEntriesByType?!1:performance.getEntriesByType("resource").some(S=>S.name===u.src&&S.responseEnd>0);let f=0,h=0;const g=this.getFallbackTiming("script_grace_ms",2e3),k=setInterval(()=>{if(f+=250,s()){b(),t(!0);return}u&&(o||m())&&(h+=250),(h>=g||f>=e)&&(b(),t(!1))},250),b=()=>{clearInterval(k),u&&u.removeEventListener("error",i)};this.fallbackGuardCleanups.push(b)},verifyPlayerInit(e){const t=()=>{const o=e.querySelector("media-player");return!!(o&&o.hasAttribute("data-media-player"))};if(t()){this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e);return}let s=0;const u=setInterval(()=>{s+=250,t()?(clearInterval(u),this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e)):s>=this.getFallbackTiming("init_timeout_ms",3e3)&&(clearInterval(u),this.fallBack("player did not initialize"))},250);this.fallbackGuardCleanups.push(()=>clearInterval(u))},enhanceAudioSpeedLabel(e){try{const t=e.querySelector("media-player");if(!(t&&(t.getAttribute("view-type")==="audio"||e.querySelector(".fp-audio-layout"))))return;const u=e.querySelector(".fp-speed-menu media-menu-button");if(!u)return;const o=u.querySelector('media-icon[type="odometer"]');o&&(o.style.display="none");let i=u.querySelector(".fcom_speed_label");i||(i=document.createElement("span"),i.className="fcom_speed_label",u.appendChild(i));const m=()=>{const f=Number(t.playbackRate)||1;i.textContent=(Number.isInteger(f)?f:f.toFixed(2).replace(/0+$/,"").replace(/\.$/,""))+"x"};m(),t.addEventListener("rate-change",m),this.fallbackGuardCleanups.push(()=>t.removeEventListener("rate-change",m))}catch{}},watchCanPlay(e){const t=e.querySelector("media-player");if(!t){this.fallBack("media-player element missing");return}if(t.hasAttribute("data-can-play"))return;let s=0,u=!1;const o=this.getFallbackTiming("stall_timeout_ms",12e3),i=1e3,m=()=>{s=0},f=["load-start","source-change","provider-change","loaded-metadata","loaded-data","progress","waiting","play"];f.forEach(L=>t.addEventListener(L,m));let h=null;const g=()=>{const L=t.querySelector("iframe");L&&L!==h&&(h=L,h.addEventListener("load",m),m())};g();let k=null;const b=()=>{k&&(clearInterval(k),k=null)},S=()=>{k||(k=setInterval(C,i))},w="IntersectionObserver"in window?new IntersectionObserver(L=>{const V=L[L.length-1];u=!!(V&&V.isIntersecting),u?(s=0,S()):b()}):null,$=()=>y();t.addEventListener("can-play",$);const y=()=>{b(),t.removeEventListener("can-play",$),f.forEach(L=>t.removeEventListener(L,m)),h&&h.removeEventListener("load",m),w&&w.disconnect()},C=()=>{if(!document.body.contains(t)||t.hasAttribute("data-can-play")){y();return}g(),!(!u||!t.hasAttribute("data-can-load"))&&(s+=i,s>=o&&(y(),this.fallBack("player stalled before becoming playable")))};w?w.observe(t):(u=!0,S()),this.fallbackGuardCleanups.push(y)},fallBack(e){this.clearFallbackGuard(),console.warn("FluentPlayer: switching to standard media render ("+e+")"),this.html="",this.$emit("load-failed")},clearFallbackGuard(){const e=this.fallbackGuardCleanups;this.fallbackGuardCleanups=[],e.forEach(t=>{try{t()}catch{}})}}},Ol={class:"fluent-player-preview"},Hl={key:0,class:"player-container"},jl=["innerHTML"];function Nl(e,t,s,u,o,i){const m=J;return n(),r("div",Ol,[o.html?(n(),r("div",Hl,[l("div",{innerHTML:o.html},null,8,jl)])):_("",!0),o.loading?(n(),v(m,{key:1,animated:"",rows:5})):_("",!0)])}const Vt=P(xl,[["render",Nl],["__scopeId","data-v-f5d37d95"]]),zl={name:"TuneIcon"},ql={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false"};function Gl(e,t,s,u,o,i){return n(),r("svg",ql,[...t[0]||(t[0]=[l("path",{d:"M6 4v6M6 14v6M12 4v3M12 11v9M18 4v9M18 17v3",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1),l("path",{d:"M4 12h4M10 9h4M16 15h4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1)])])}const Yl=P(zl,[["render",Gl]]),Wl={name:"AudioList",components:{FluentPlayerPreview:Vt,TuneIcon:Yl,Close:kt},emits:["remove","edit"],props:{feed:{type:Object,default:null},audios:{type:Array,default:()=>[]},editable:{type:Boolean,default:!1}},data(){return{failedItems:{}}},methods:{onLoadFailed(e){this.failedItems={...this.failedItems,[e]:!0}},audioUrl(e){var t;return((t=e.settings)==null?void 0:t.src)||e.url||""},audioType(e){const s=this.audioUrl(e).split("?")[0].split("#")[0].split(".").pop().toLowerCase();return{mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"}[s]||"audio/mpeg"},audioKey(e,t){var o,i;const s=((o=e.settings)==null?void 0:o.posterSrc)||e.image||"",u=((i=e.settings)==null?void 0:i.title)||e.title||"";return(e.media_id||t)+"|"+s+"|"+u},playerMediaFor(e){var s,u;const t={...e,feed_id:((s=this.feed)==null?void 0:s.id)||e.feed_id||"",share_url:((u=this.feed)==null?void 0:u.permalink)||e.share_url||""};return this.editable&&(t.controls={...e.controls||{},settings:!1}),t}}},Kl={class:"fcom_audio_list"},Zl={key:1,class:"fcom_audio_native_wrap"},Jl={class:"fcom_audio_native",controls:"",preload:"metadata"},Ql=["src","type"],Xl=["aria-label","onClick"],ea=["aria-label","onClick"];function ta(e,t,s,u,o,i){const m=p("fluent-player-preview"),f=p("tune-icon"),h=p("Close"),g=j;return n(),r("div",Kl,[(n(!0),r(T,null,x(s.audios,(k,b)=>(n(),r("div",{key:i.audioKey(k,b),class:"fcom_audio_player_wrap"},[o.failedItems[k.media_id||b]?(n(),r("div",Zl,[l("audio",Jl,[l("source",{src:i.audioUrl(k),type:i.audioType(k)},null,8,Ql)])])):(n(),v(m,{key:0,media:i.playerMediaFor(k),onLoadFailed:S=>i.onLoadFailed(k.media_id||b)},null,8,["media","onLoadFailed"])),s.editable?(n(),r(T,{key:2},[l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_edit_btn","aria-label":e.$t("Edit audio"),onClick:S=>e.$emit("edit",b)},[a(f)],8,Xl),l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_remove_btn","aria-label":e.$t("Remove audio"),onClick:S=>e.$emit("remove",b)},[a(g,null,{default:c(()=>[a(h)]),_:1})],8,ea)],64)):_("",!0)]))),128))])}const io=P(Wl,[["render",ta]]);const sa={name:"MediaPreview",components:{Postcard:ti,FluentPlayerPreview:Vt,AudioList:io},props:["feed","media_item","is_single"],data(){return{is_error:!1,isPlaying:!1,videoFailed:!1,fluentPlayerFailed:!1}},watch:{"media.url"(){this.fluentPlayerFailed=!1,this.videoFailed=!1}},computed:{media(){var e;return this.feed?(e=this.feed.meta)==null?void 0:e.media_preview:this.media_item},audioMedias(){var s,u,o,i,m;const e=(u=(s=this.feed)==null?void 0:s.meta)==null?void 0:u.audio_medias;if(Array.isArray(e)&&e.length)return e;const t=(i=(o=this.feed)==null?void 0:o.meta)==null?void 0:i.media_preview;return t&&(((m=t.settings)==null?void 0:m.viewType)==="audio"||t.content_type==="audio")?[t]:[]},playerMedia(){var e,t,s,u;return{...this.media,feed_id:((e=this.feed)==null?void 0:e.id)||((t=this.media)==null?void 0:t.feed_id)||"",share_url:((s=this.feed)==null?void 0:s.permalink)||((u=this.media)==null?void 0:u.share_url)||""}},mediaSrcUrl(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.src)||((s=this.media)==null?void 0:s.url)||""},mediaWrapperType(){return this.media.type==="oembed"&&!this.isVideoMedia?"meta_data":this.media.type},isVideoMedia(){return this.isYouTubePlaylistUrl(this.mediaSrcUrl)&&!this.media.html?!1:["oembed","iframe_html","video","fluent_player"].includes(this.media.type)},hasFluentPlayer(){var e;return this.appVars.features.has_fluent_player&&((e=this.appVars.features.fluent_player)==null?void 0:e.enable)},playEmbeddedVideos(){var e;return(e=this.appVars.features.fluent_player)==null?void 0:e.play_embedded_videos}},methods:{toAbsoluteUrl(e){return e?/^[a-z][\w+.-]*:/i.test(e)?e:`https://${e}`:""},getDomainName(e){const t=this.toAbsoluteUrl(e);if(!t)return"";try{return new URL(t).hostname.replace(/^www\./i,"")}catch{return""}},isYouTubePlaylistUrl(e){return e?/^(https?:\/\/)?([\w-]+\.)?youtube\.com\/playlist\?/i.test(e)&&/[?&]list=/i.test(e):!1},isYouTubePlaylistEmbed(){var t;const e=(((t=this.media)==null?void 0:t.html)||"").replace(/&/gi,"&");return/youtube(-nocookie)?\.com\/embed\/[^"'\s]*[?&]list=/i.test(e)},isSupportedByFluentPlayer(){var s,u;const e=((u=(s=this.media)==null?void 0:s.settings)==null?void 0:u.src)||this.media.url;return!e||this.isYouTubePlaylistUrl(e)||this.isYouTubePlaylistEmbed()||!this.playEmbeddedVideos&&this.media.provider!=="upload"?!1:[{name:"youtube",regex:/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/},{name:"vimeo",regex:/^(https?:\/\/)?(www\.)?vimeo\.com\/\d+(\/[a-f0-9]+)?([?#].*)?$/},{name:"file",regex:/\.(mp4|m3u8|mpd|webm|mov|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}].some(o=>o.regex.test(e))},getAspectRatio(e,t){if(e&&t){let s=e/t;return s<1?16/9:s}return 16/9},handleImageError(){this.is_error=!0},getVideoType(e){const t={mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",qt:"video/quicktime"},s=e.split(".").pop().toLowerCase();return t[s]||"video/mp4"},isAudioUrl(e){return e?/\.(mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i.test(e):!1},getAudioType(e){const t={mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"},s=e.split("?")[0].split("#")[0].split(".").pop().toLowerCase();return t[s]||"audio/mpeg"},playVideo(){this.$refs.nativeVideo&&this.$refs.nativeVideo.play()},onVideoPause(){this.$refs.nativeVideo&&this.$refs.nativeVideo.currentTime>0&&(this.isPlaying=!0)}}},oa={key:0,class:"feed_media feed_media_audio_list"},ia={key:0},na={key:1},la=["innerHTML"],aa={key:2,class:"native_audio_wrapper"},ra=["preload"],ca=["src","type"],da=["controls","preload","poster"],ua=["src","type"],_a={key:4,class:"native_video_wrapper"},ma={key:1,class:"fcom_media_load_error"},ha=["href"],fa={key:0,class:"feed_media_image"},pa={key:1,class:"feed_media_content"},ga={class:"media_domain"},ya={class:"feed_media_title"},va={key:0,class:"feed_media_description"},ba={class:"feed_meta_desc"};function ka(e,t,s,u,o,i){const m=p("audio-list"),f=p("fluent-player-preview"),h=Be,g=J;return i.audioMedias.length?(n(),r("div",oa,[a(m,{feed:s.feed,audios:i.audioMedias},null,8,["feed","audios"])])):(n(),r("div",{key:1,class:D(["feed_media","feed_media_"+i.mediaWrapperType])},[i.isVideoMedia?(n(),r(T,{key:0},[i.hasFluentPlayer&&i.isSupportedByFluentPlayer()&&!o.fluentPlayerFailed?(n(),r("div",ia,[a(f,{media:i.playerMedia,onLoadFailed:t[0]||(t[0]=k=>o.fluentPlayerFailed=!0)},null,8,["media"])])):i.media.html?(n(),r("div",na,[l("div",{class:"feed_media_ext_video",innerHTML:i.media.html},null,8,la)])):i.media.url&&i.isAudioUrl(i.media.url)?(n(),r("div",aa,[l("audio",{class:"native_audio_player",controls:"",preload:s.is_single?"metadata":"none"},[l("source",{src:i.media.url,type:i.getAudioType(i.media.url)},null,8,ca)],8,ra)])):i.media.url&&!o.videoFailed?(n(),r("div",{key:3,class:D(["native_video_wrapper",{video_playing:o.isPlaying}])},[l("video",{ref:"nativeVideo",class:"native_video_player",controls:o.isPlaying,preload:s.is_single?"metadata":"none",poster:i.media.thumbnail,onPlay:t[2]||(t[2]=k=>o.isPlaying=!0),onPause:t[3]||(t[3]=(...k)=>i.onVideoPause&&i.onVideoPause(...k)),onEnded:t[4]||(t[4]=k=>o.isPlaying=!1)},[l("source",{src:i.media.url,type:i.getVideoType(i.media.url),onError:t[1]||(t[1]=k=>o.videoFailed=!0)},null,40,ua)],40,da),o.isPlaying?_("",!0):(n(),r("div",{key:0,class:"native_video_overlay",onClick:t[5]||(t[5]=(...k)=>i.playVideo&&i.playVideo(...k))},[...t[7]||(t[7]=[l("div",{class:"native_play_button"},[l("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[l("path",{d:"M8 5v14l11-7z"})])],-1)])]))],2)):i.media.url?(n(),r("div",_a,[i.media.thumbnail?(n(),v(h,{key:0,src:i.media.thumbnail,alt:"",style:{width:"100%"}},null,8,["src"])):(n(),r("p",ma,d(e.$t("This video could not be played.")),1))])):_("",!0)],64)):i.media.type=="image"||i.media.is_uploaded?(n(),r("div",{key:1,class:D(["feed_media_provider_"+i.media.provider,"feed_media_image feed_custom_uploaded"])},[i.media.image&&!o.is_error?(n(),v(h,{key:0,alt:"",style:me({width:"100%",aspectRatio:i.getAspectRatio(i.media.width,i.media.height)}),src:i.media.image,lazy:!0,previewSrcList:[i.media.image],loading:"lazy",onError:i.handleImageError,"zoom-rate":1.2,"max-scale":7,"hide-on-click-modal":!0,"preview-teleported":!0,"min-scale":.2,"initial-index":1,class:D("fcom_media_provider_"+i.media.provider),fit:"scale-down"},{placeholder:c(()=>[a(g,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(n(),r("a",{key:2,href:i.toAbsoluteUrl(i.media.url),target:"_blank",rel:"noopener",class:"feed_media_link"},[i.media.image&&!o.is_error?(n(),r("div",fa,[a(h,{onError:t[6]||(t[6]=k=>i.handleImageError()),style:{width:"100%"},src:i.media.image},{error:c(()=>[...t[8]||(t[8]=[l("span",null,null,-1)])]),_:1},8,["src"])])):_("",!0),i.media.title||i.media.url?(n(),r("div",pa,[l("div",ga,d(i.getDomainName(i.media.url)),1),l("div",ya,d(e.getExcerpt(i.media.title||i.media.url,88)),1),i.media.description?(n(),r("div",va,[l("div",ba,d(e.getExcerpt(i.media.description,160)),1)])):_("",!0)])):_("",!0)],8,ha))],2))}const xe=P(sa,[["render",ka],["__scopeId","data-v-de1ae8ac"]]);const ks={video:{extensions:[".mp4",".webm",".mov",".qt"],pattern:/\.(mp4|webm|mov|qt)$/i},audio:{extensions:[".mp3",".wav",".m4a",".aac",".ogg",".oga",".flac"],pattern:/\.(mp3|wav|m4a|aac|ogg|oga|flac)$/i}},ws=[{name:"youtube",regex:/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/},{name:"vimeo",regex:/^(https?:\/\/)?(www\.)?vimeo\.com\/\d+(\/[a-f0-9]+)?([?#].*)?$/},{name:"file",regex:/\.(mp4|m3u8|mpd|webm|mov|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}],wa={name:"FluentPlayerUploader",components:{UploadFilled:wt},emits:["video-added","completed","uploading"],props:{className:{type:String,default:"video-uploader"},type:{type:String,default:"url"},media_kind:{type:String,default:"video"}},data(){return{videoUrl:"",processing:!1}},computed:{uploadKind(){return this.media_kind==="audio"?"audio":"video"},acceptTypes(){return ks[this.uploadKind].extensions.join(",")},uploadButtonLabel(){return this.uploadKind==="audio"?this.$t("Upload Audio"):this.$t("Upload Video")},kindErrorMessage(){return this.uploadKind==="audio"?this.$t("The file must be a valid audio type (MP3, WAV, M4A, AAC, OGG, FLAC)"):this.$t("The file must be a valid video type (MP4, WebM, MOV)")},uploadData(){return{context:"fluent_player",media_kind:this.uploadKind}},action_url(){return this.appVars.rest.url+"/fluent-player/video-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{beforeUpload(e){return ks[this.uploadKind].pattern.test(e.name||"")?!0:(this.$handleError(this.kindErrorMessage),!1)},async handleUrlSubmit(){if(!this.videoUrl)return;const e=ws.some(u=>u.name==="file"&&u.regex.test(this.videoUrl)),t=ws.some(u=>u.name!=="file"&&u.regex.test(this.videoUrl));let s={type:"oembed",url:this.videoUrl,html:"",content_type:"video"};e?(s.player="fluent_player",s.provider="url",s.media_id=new Date().getTime()):t&&(s.player="fluent_player",s.media_id=new Date().getTime()),this.$emit("video-added",s)},handleVideoUploadSuccess(e){var t,s;try{if(!e||!e.media||!e.media.url)throw new Error("Invalid response: missing media.url");const{media:u}=e,o=((t=u.settings)==null?void 0:t.viewType)==="audio"||this.uploadKind==="audio",i={type:"upload",url:u.url,player:"fluent_player",provider:"upload",content_type:o?"audio":"video",html:"",title:((s=u.settings)==null?void 0:s.title)||"",media_id:u.media_id,settings:u.settings||{}};this.$emit("video-added",i)}catch(u){console.error("[FluentPlayerUploader] handleVideoUploadSuccess error:",u,e)}finally{this.$emit("completed",e),this.processing=!1}},handleError(e){try{let t=(e==null?void 0:e.message)||e;if(typeof t=="string")try{const s=JSON.parse(t);t=(s==null?void 0:s.message)||t}catch{}this.$handleError(t)}catch(t){console.error("[FluentPlayerUploader] handleError failed:",t,e)}finally{this.$emit("completed",e),this.processing=!1}},inProgress(e){this.$emit("uploading"),this.processing=!0}}},Ca=["element-loading-text"],$a={key:0,class:"upload-options"},Sa={class:"uploader-content"},Va={class:"el-upload__text"},Ma={key:1,class:"url-input-section"};function La(e,t,s,u,o,i){const m=p("upload-filled"),f=j,h=O,g=bt,k=ie,b=se("loading");return Y((n(),r("div",{class:"fluent-player-uploader","element-loading-text":e.$t("Uploading media..."),"element-loading-background":"rgba(255, 255, 255, 0.85)"},[s.type==="upload"?(n(),r("div",$a,[a(g,{drag:"",class:D([s.className,"video-drag-uploader"]),multiple:i.uploadKind==="audio",action:i.action_url,headers:i.headers,accept:i.acceptTypes,data:i.uploadData,"before-upload":i.beforeUpload,"on-success":i.handleVideoUploadSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1,disabled:o.processing},{default:c(()=>[l("div",Sa,[a(f,{class:"el-icon--upload"},{default:c(()=>[a(m)]),_:1}),l("div",Va,[M(d(e.$t("Drop file here or"))+" ",1),l("em",null,d(e.$t("upload by clicking")),1)]),a(h,{type:"primary",class:"upload-button",loading:o.processing,disabled:o.processing},{default:c(()=>[K(e.$slots,"trigger",{},()=>[K(e.$slots,"default",{},()=>[M(d(o.processing?e.$t("Uploading..."):i.uploadButtonLabel),1)])])]),_:3},8,["loading","disabled"])])]),_:3},8,["class","multiple","action","headers","accept","data","before-upload","on-success","on-progress","on-error","disabled"])])):(n(),r("div",Ma,[a(k,{modelValue:o.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=S=>o.videoUrl=S),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:c(()=>[a(h,{onClick:i.handleUrlSubmit,loading:o.processing},{default:c(()=>[M(d(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,Ca)),[[b,o.processing]])}const Ta=P(wa,[["render",La]]),Fa={name:"MediaEmbeder",emits:["embeded"],props:{media:{type:Object,default:()=>({type:"oembed",url:"",inner_html:"",content_type:"video",html:"",provider:"",title:"",author_name:"",image:""})},box_title:{type:String,default:""},box_description:{type:String,default:""},has_iframe:{type:Boolean,default:!0},space:{type:String,default:""},is_feed:{type:Boolean,default:!1}},components:{MediaPreview:xe,FluentPlayerUploader:Ta},computed:{showPreview(){return this.media.html&&!this.showInput},editorMode:{get(){return this.media.type},set(e){this.media.type=e}},hasFluentPlayer(){var e;return this.hasFluentPlayerInstalled&&((e=this.appVars.features.fluent_player)==null?void 0:e.enable)},hasFluentPlayerInstalled(){return this.appVars.features.has_fluent_player},hasUploadEnabled(){var e;return this.is_feed&&this.hasFluentPlayer&&((e=this.appVars.features.fluent_player)==null?void 0:e.has_video_upload)},uploadRole(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.video_upload_role)||"admin"},getSpace(){return this.space||""},playEmbeddedVideos(){var e;return(e=this.appVars.features.fluent_player)==null?void 0:e.play_embedded_videos},editorTitle(){return this.box_title||this.$t("Featured media")},uploadHint(){return this.$t("The file must be a valid video type (MP4, WebM, MOV)")},hasUpload(){return this.hasUploadEnabled&&(this.uploadRole==="everyone"||this.uploadRole==="admin_moderator"&&(this.isModerator(this.getSpace)||this.isAdmin())||this.uploadRole==="admin"&&this.isAdmin())}},data(){return{appReady:!1,showInput:!1,fetching:!1,uploading:!1,uploadKind:"video"}},methods:{fetchData(){this.media.url&&(this.fetching=!0,this.$get("feeds/oembed",{url:this.media.url}).then(e=>{this.media.html=e.oembed.html,this.media.provider=e.oembed.provider,this.media.title=e.oembed.title,this.media.author_name=e.oembed.author_name,this.media.type=e.oembed.type,this.media.image=e.oembed.image,this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetching=!1}))},handleAddCustomHtml(){if(!/<iframe[\s>]/i.test(this.media.html||"")){this.$handleError(this.$t("Only iframe embed code is supported. Script-based embeds will not work."));return}this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1},handleFluentPlayerVideo(e){Object.assign(this.media,e);const t=this.media.type==="upload"||this.media.provider==="url";if(this.media.player==="fluent_player"&&t){this.media.type="oembed",this.$emit("embeded",this.media);return}this.fetchData()}},mounted(){typeof this.media!="object"&&(this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}),this.appReady=!0,this.media.html||this.fetchData()}},Pa={key:0},Ia={key:0,class:"fcom_media_editor_actions"},Ea={key:1,class:"fcom_media_editor fcom_media_embeder"},Aa={key:0},Ua={key:1},Ba={key:2,class:"fcom_course_media"};function Da(e,t,s,u,o,i){var w;const m=O,f=je,h=be,g=ie,k=p("fluent-player-uploader"),b=p("media-preview"),S=se("loading");return o.appReady?Y((n(),r("div",Pa,[s.has_iframe||i.hasUpload?(n(),r("div",Ia,[i.showPreview?(n(),v(m,{key:0,onClick:t[0]||(t[0]=$=>o.showInput=!0),size:"small",text:""},{default:c(()=>[M(d(e.$t("Edit media")),1)]),_:1})):(n(),v(h,{key:1,onChange:t[1]||(t[1]=$=>{s.media.html="",s.media.url="",o.showInput=!0}),size:"small",modelValue:i.editorMode,"onUpdate:modelValue":t[2]||(t[2]=$=>i.editorMode=$),disabled:o.uploading,"aria-label":e.$t("Media source")},{default:c(()=>[a(f,{label:e.$t("Oembed"),value:"oembed"},null,8,["label"]),s.has_iframe?(n(),v(f,{key:0,label:e.$t("HTML Code"),value:"iframe_html"},null,8,["label"])):_("",!0),i.hasUpload?(n(),v(f,{key:1,label:e.$t("Upload Video"),value:"upload","data-testid":"upload-kind-video"},null,8,["label"])):_("",!0)]),_:1},8,["modelValue","disabled","aria-label"]))])):_("",!0),i.showPreview?(n(),r("div",Ba,[a(b,{media_item:s.media},null,8,["media_item"])])):(n(),r("div",Ea,[s.media.type=="iframe_html"&&s.has_iframe?(n(),r(T,{key:0},[l("h3",null,d(e.$t("Add Video from custom HTML Code")),1),a(g,{rows:5,modelValue:s.media.html,"onUpdate:modelValue":t[3]||(t[3]=$=>s.media.html=$),type:"textarea",placeholder:e.$t("Paste an iframe code")},null,8,["modelValue","placeholder"]),a(m,{class:"fcom_secondary_button fcom_mt_20",onClick:t[4]||(t[4]=$=>i.handleAddCustomHtml())},{default:c(()=>[M(d(e.$t("Embed")),1)]),_:1})],64)):(n(),r(T,{key:1},[l("h3",null,d(i.editorTitle),1),i.hasFluentPlayerInstalled&&s.media.type==="upload"?(n(),r("p",Aa,d(i.uploadHint),1)):(n(),r("p",Ua,d(s.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),i.hasFluentPlayer&&(s.media.type==="upload"||i.playEmbeddedVideos)?(n(),v(k,{key:2,type:((w=s.media)==null?void 0:w.type)==="upload"?"upload":"url",media_kind:o.uploadKind,onVideoAdded:i.handleFluentPlayerVideo,onUploading:t[5]||(t[5]=$=>o.uploading=!0),onCompleted:t[6]||(t[6]=$=>o.uploading=!1)},null,8,["type","media_kind","onVideoAdded"])):(n(),v(g,{key:3,onKeydown:te(i.fetchData,["enter"]),size:"large",modelValue:s.media.url,"onUpdate:modelValue":t[7]||(t[7]=$=>s.media.url=$),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:c(()=>[a(m,{onClick:i.fetchData,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[S,o.fetching]]):_("",!0)}const Ra=P(Fa,[["render",Da]]),xa={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:Ra,VideoIcon:Rl},data(){return{videoUrl:"",showVideoPop:!1,media:{type:"oembed",url:"",inner_html:"",content_type:"video"}}},watch:{showVideoPop(e){e||this.resetMedia()}},methods:{show(){this.showVideoPop=!0},resetMedia(){this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}},embeded(e){var s;this.$emit("embeded",e),e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")||(this.showVideoPop=!1,this.resetMedia())}}},Oa={class:"fcom_video_embeder"};function Ha(e,t,s,u,o,i){const m=p("VideoIcon"),f=j,h=O,g=p("media-embeder"),k=ke;return n(),r("div",Oa,[a(h,{"aria-label":e.$t("Add Video"),text:"",onClick:i.show},{default:c(()=>[a(f,{class:D(["fcom_apps_icon"])},{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"]),o.showVideoPop?(n(),v(k,{key:0,title:e.$t("Attach Media"),modelValue:o.showVideoPop,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVideoPop=b),width:e.dialogWidth,style:{"max-width":"600px"},"append-to-body":!0},{default:c(()=>[a(g,{box_title:e.$t("Add Featured Video for this post"),has_iframe:s.is_admin,is_feed:!0,onEmbeded:i.embeded,space:s.space,media:o.media},null,8,["box_title","has_iframe","onEmbeded","space","media"])]),_:1},8,["title","modelValue","width"])):_("",!0)])}const ja=P(xa,[["render",Ha]]),Na="modulepreload",za=function(e){return"/"+e},Cs={},he=function(t,s,u){if(!s||s.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(s.map(i=>{if(i=za(i),i in Cs)return;Cs[i]=!0;const m=i.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let k=o.length-1;k>=0;k--){const b=o[k];if(b.href===i&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${f}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Na,m||(g.as="script",g.crossOrigin=""),g.href=i,document.head.appendChild(g),m)return new Promise((k,b)=>{g.addEventListener("load",k),g.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=i,window.dispatchEvent(m),!m.defaultPrevented)throw i})};var no=(e=>(e.CodeMirror="code-mirror",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.ImageBlock="image-block",e))(no||{});const qa={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function Ga(e,t,s){switch(e){case"link-tooltip":{const{defineFeature:u}=await he(()=>import("./index.js?ver=2.10.0"),[]);return u(t,s)}case"block-edit":{const{defineFeature:u}=await he(()=>import("./index2.js?ver=2.10.0"),[]);return u(t,s)}case"placeholder":{const{defineFeature:u}=await he(()=>import("./index3.js?ver=2.10.0"),[]);return u(t,s)}case"toolbar":{const{defineFeature:u}=await he(()=>import("./index4.js?ver=2.10.0"),[]);return u(t,s)}case"image-block":{const{defineFeature:u}=await he(()=>import("./index5.js?ver=2.10.0"),[]);return u(t,s)}}}const Ya=Xi([],"FeaturesCtx");function Wa(e){return t=>{t.inject(Ya,e)}}var is=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},_e=(e,t,s)=>(is(e,t,"read from private field"),s?s.call(e):t.get(e)),qe=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},nt=(e,t,s,u)=>(is(e,t,"write to private field"),u?u.call(e,s):t.set(e,s),s),Ka=(e,t,s)=>(is(e,t,"access private method"),s),Ce,lt,at,yt,Ge,jt,lo;class ao{constructor({root:t,features:s={},featureConfigs:u={},defaultValue:o="",onUpdate:i=f=>{},handleCommonActions:m=(f,h)=>{}}){var k;qe(this,jt),qe(this,Ce,void 0),qe(this,lt,void 0),qe(this,at,void 0),qe(this,yt,!0),qe(this,Ge,null);const f=Object.entries({...qa,...s}).filter(([,b])=>b).map(([b])=>b);nt(this,at,(typeof t=="string"?document.querySelector(t):t)??document.body),nt(this,Ce,en.make().config(Wa(f)).config(b=>{b.set(tn,_e(this,at)),b.set(sn,o),b.set(on,{editable:()=>_e(this,yt)})}).config(b=>{const S=async(w,$)=>await m("handleFileUpload",{ctx:b,files:w,schema:$});b.update(nn.key,w=>({...w,uploader:S}))}).config(b=>{const S=b.get(ln);S.markdownUpdated((w,$,y)=>{$!==y&&i($)}),S.updated((w,$,y)=>{m("editor_updated",w)})}).use(an).use(rn).use(cn).use(dn).use(un).use(_n).use(mn));const h=(k=u==null?void 0:u["block-edit"])==null?void 0:k.canAddImage;h&&_e(this,Ce).use(Ht(()=>new Ot({filterTransaction:b=>b.docChanged?!b.steps.some(w=>{var y,C;let $=!1;return(C=(y=w.slice)==null?void 0:y.content)==null||C.forEach(L=>{var V;L.type.name.includes("image")&&($=!0),(V=L.content)==null||V.forEach(I=>{I.type.name.includes("image")&&($=!0)})}),$})||h():!0}))),_e(this,Ce).use(Ht(()=>new Ot({props:{handleTextInput(b,S,w,$){const y=b.state.schema.marks.link;if($!==" "||!y)return!1;const C=b.state.doc.resolve(S),L=/(?:^|\s)((?:https?:\/\/|www\.)\S+)$/.exec(C.parent.textBetween(0,C.parentOffset,void 0,""));if(!L)return!1;const V=L[1].replace(/[.,)]+$/,""),I=S-L[1].length,F=I+V.length;if(b.state.doc.rangeHasMark(I,F,y))return!1;const R=(V.startsWith("http")?"":"https://")+V,B=b.state.tr.insertText($,S).addMark(I,F,y.create({href:R})).removeStoredMark(y);return b.dispatch(B),!0}},appendTransaction:(b,S,w)=>{const $=w.schema.marks.link,y=w.selection.$cursor;if(!$||!y||!b.some(B=>B.docChanged))return null;const C=B=>B==null?void 0:B.marks.find(U=>U.type===$);if((w.storedMarks??y.marks()).some(B=>B.type===$)&&!C(y.nodeBefore)&&!C(y.nodeAfter))return w.tr.removeStoredMark($);const I=y.pos;if(I<1||w.doc.textBetween(I-1,I)!==" "||!w.doc.rangeHasMark(I-1,I,$))return null;const F=C(w.doc.resolve(I-1).nodeBefore),R=C(w.doc.resolve(I).nodeAfter);return R&&(F==null?void 0:F.attrs.href)===R.attrs.href?null:w.tr.removeMark(I-1,I,$).removeStoredMark($)}}))),_e(this,Ce).use(Ht(()=>{let b=!1,S=!1;return new Ot({view:w=>({update(){var F;const $=w.state.schema.marks.link,y=w.state.selection.$cursor,C=R=>R.type===$,L=!!$&&!!(y!=null&&y.marks().some(C)),V=document.querySelector("milkdown-link-preview"),I=(V==null?void 0:V.style.display)==="none"&&!S;if(L&&!I){V&&S&&(V.style.display=""),S=!1;const R=w.coordsAtPos((F=y.nodeBefore)!=null&&F.marks.some(C)?y.pos-1:y.pos);w.dom.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,clientX:R.left+1,clientY:(R.top+R.bottom)/2}))}else!L&&b&&(w.dom.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0})),V&&(V.style.display="none"),S=!0);b=L}})})}));const g=[];f.forEach(b=>{const S=u[b];g.push(Ga(b,_e(this,Ce),S))}),nt(this,lt,Promise.all(g))}async create(){await _e(this,lt);const t=await _e(this,Ce).create();return Ka(this,jt,lo).call(this),t}async destroy(){var t;return(t=_e(this,Ge))==null||t.disconnect(),await _e(this,lt),_e(this,Ce).destroy()}get editor(){return _e(this,Ce)}setReadonly(t){return nt(this,yt,!t),this}getMarkdown(){return _e(this,Ce).action(hn())}getEditor(){return _e(this,Ce)}destroyEditor(){this.destroy()}}Ce=new WeakMap;lt=new WeakMap;at=new WeakMap;yt=new WeakMap;Ge=new WeakMap;jt=new WeakSet;lo=function(){const e=_e(this,at),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},s=u=>{const o=e.querySelector(u);o&&(_e(this,Ge).observe(o,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(o),0))};nt(this,Ge,new MutationObserver(u=>{const o=u[0];o.type==="childList"?(s("milkdown-link-edit"),s("milkdown-link-preview")):t(o.target)})),_e(this,Ge).observe(e,{childList:!0,subtree:!0})};ao.Feature=no;const Za={name:"CrepeEditor",emits:["update:modelValue","handleMediaUpload","editorCreated","editor-escape"],props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},autofocus:{type:Boolean,default:!1},mentionQuery:{type:Object,default:()=>({})},autofocus_changed:{type:[Boolean,Number],default:!1},disable_mention:{type:Boolean,default:!1},disable_media:{type:Boolean,default:!1},defaultMentions:{type:Array,default:()=>[]},context:{type:String,default:""},is_modal:{type:Boolean,default:!1},onInlineUpload:{type:Function,default:null},canAddImage:{type:Function,default:null}},components:{MilkdownProvider:fn,ProsemirrorAdapterProvider:pn},data(){return{editor:null,editorFailed:!1,currentContent:"",showMentionPop:!1,currentMentionSearch:"",mentionResults:[],justReplaced:!1,searchingMention:!1,hasUnsavedChanges:!1,pendingNavigation:null,activeUploadBlock:null}},watch:{autofocus_changed(e){e&&this.focusOnEditor()},editorFailed(e){e&&this.$nextTick(this.resizeFallback)},modelValue(){this.editorFailed&&this.$nextTick(this.resizeFallback)},currentContent(){var t;const e=this.context==="feed"||this.context==="comment";this.hasUnsavedChanges=e&&!!((t=this.currentContent)!=null&&t.replace(/ |\u00A0/gi,"").trim()),this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=this.hasUnsavedChanges)}},methods:{onUnsavedChangesProceeded(){if(this.pendingNavigation){this.hasUnsavedChanges=!1,this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=!1);const e=this.pendingNavigation;this.pendingNavigation=null,setTimeout(()=>e.click(),0)}},clearContent(){if(!this.editor){this.currentContent="",this.$emit("update:modelValue",""),this.$refs.fallbackInput&&(this.$refs.fallbackInput.style.height="");return}this.editor.action(e=>{const t=e.get(it),{state:s}=t,u=s.tr.replaceWith(0,s.doc.content.size,s.schema.nodes.paragraph.create());t.dispatch(u)}),this.currentContent=""},updateContent(e){if(!this.editor){this.currentContent=(this.modelValue||"")+e,this.$emit("update:modelValue",this.currentContent);return}this.editor.action(t=>{const s=t.get(it),{state:u}=s,{from:o}=u.selection,i=e,m=u.tr.insertText(i,o),f=o+i.length,h=m.setSelection(bs.create(m.doc,f));s.dispatch(h),s.focus()})},initEditor(){const e=this,t=new ao({root:this.$refs.crepe_editor_vue,defaultValue:this.modelValue,featureConfigs:{placeholder:{text:this.placeholder||this.$t("Type your message here!"),mode:"doc"},"block-edit":{hasImageBlock:!this.disable_media&&!!this.onInlineUpload,canAddImage:this.canAddImage},"image-block":{onUpload:async s=>{if(!this.onInlineUpload)return null;this.activeUploadBlock&&this.activeUploadBlock.classList.add("uploading");try{return await this.onInlineUpload(s)}finally{this.activeUploadBlock&&(this.activeUploadBlock.classList.remove("uploading"),this.activeUploadBlock=null)}},blockUploadButton:()=>this.$t("Upload image"),blockConfirmButton:()=>this.$t("Confirm"),blockUploadPlaceholderText:this.$t("or paste link")},"link-tooltip":{inputPlaceholder:this.$t("Paste link...")}},onUpdate(s){s=s.replace(/!\[[^\]]*\]\(\s*\)/g,""),e.$emit("update:modelValue",s),e.currentContent=s},async handleCommonActions(s,u){if(s==="editor_updated"){if(e.disable_mention)return!1;e.checkforMention(u)}else if(s==="handleFileUpload")return e.disable_media?[]:await e.handleFileUpload(u)}});t.create().then(()=>{this.editor=t.getEditor(),this.focusOnEditor(),this.$emit("editorCreated")}).catch(s=>{console.error("FluentCommunity: rich editor failed to load, falling back to plain text",s),this.editorFailed=!0,this.$emit("editorCreated")})},onFallbackInput(e){this.currentContent=e.target.value,this.$emit("update:modelValue",e.target.value),this.resizeFallback()},resizeFallback(){const e=this.$refs.fallbackInput;e&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const s=t.get(it),{state:u}=s;let o=null;e&&u.doc.descendants((m,f)=>{if(m.isText&&m.text){const h=m.text.lastIndexOf(e);h!==-1&&(o=f+h+e.length+1)}});const i=o!==null?Math.min(o,u.doc.content.size-1):Math.max(1,u.doc.content.size-1);s.dispatch(u.tr.setSelection(bs.create(u.doc,i))),s.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const s=e.get(it),{state:u}=s,{selection:o}=u;if(!o)return;const m=u.doc.textBetween(0,o.to," ").match(/@([\p{L}\p{M}\p{N}_.-]+)$/u);if(!m){this.showMentionPop=!1,this.currentMentionSearch="";return}let f=m[1];if(!f||f.length<3){if(this.defaultMentions&&this.defaultMentions.length){let h=f.toLowerCase(),g=this.defaultMentions.filter(k=>k.username.toLowerCase().includes(h)||k.display_name.toLowerCase().includes(h));g.length&&(this.currentMentionSearch=f,this.mentionResults=g,this.showMentionPop=!0)}return}if(this.currentMentionSearch&&(this.currentMentionSearch=f,this.searchingMention))return!1;this.searchingMention=!0,this.currentMentionSearch=f,this.$get("members",{mention:this.currentMentionSearch,...this.mentionQuery}).then(h=>{this.mentionResults=h.members.data,this.showMentionPop=!0}).finally(()=>{this.searchingMention=!1})},addMention(e){if(this.disable_mention||!this.editor)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+" "),this.editor.action(gn(this.currentContent)),this.focusOnEditor(e),this.showMentionPop=!1,this.currentMentionSearch="",this.justReplaced=!0,setTimeout(()=>{this.justReplaced=!1},2e3)},async handleFileUpload(e){const t=e.files;for(let s=0;s<t.length;s++){const u=t.item(s);if(u&&u.type.includes("image"))if(this.onInlineUpload){if(this.canAddImage&&!this.canAddImage())continue;await this.insertInlineImage(u)}else this.$emit("handleMediaUpload",u)}return[]},async insertInlineImage(e){try{const t=await this.onInlineUpload(e);if(!t||!this.editor)return;this.editor.action(s=>{const u=s.get(it),{state:o}=u,i=o.schema.nodes["image-block"];if(!i)return;const m=i.create({src:t,caption:"",ratio:1}),{$from:f}=o.selection,h=f.after(1),g=o.tr.insert(h,m);u.dispatch(g),u.focus()})}catch{}},handleBeforeUnload(e){this.hasUnsavedChanges&&(e.preventDefault(),e.returnValue="")},handleLinkClick(e){const t=e.target.closest("a");if(!t||!this.hasUnsavedChanges||e.metaKey||e.ctrlKey)return;const s=t.getAttribute("href"),u=this.appVars.portal_url;if(!s)return;const o=s.startsWith(u)||s.startsWith("/"),i=s===window.location.href;o&&!i&&(e.preventDefault(),e.stopPropagation(),this.pendingNavigation=t,this.$eventBus.emit("showUnsavedChangesModal",this.context))},handleImageBlockClick(e){const t=e.target.closest("milkdown-image-block");t&&(this.activeUploadBlock=t,e.target.closest(".confirm")&&!this.canAddImage()&&(e.preventDefault(),e.stopPropagation()))},handleEditorKeydown(e){const t=this.$refs.crepe_editor_vue;e.key!=="Escape"||!(t!=null&&t.contains(e.target))||this.showMentionPop||t.querySelector('milkdown-slash-menu[data-show="true"], milkdown-toolbar[data-show="true"], milkdown-link-preview[data-show="true"], milkdown-link-edit[data-show="true"]')||this.$emit("editor-escape")}},mounted(){this.initEditor(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("click",this.handleLinkClick,!0),document.addEventListener("keydown",this.handleEditorKeydown,!0),this.onInlineUpload&&this.$refs.crepe_editor_vue.addEventListener("click",this.handleImageBlockClick,!0),this.$eventBus.on("unsavedChangesProceeded",this.onUnsavedChangesProceeded)},beforeUnmount(){var e;this.editor&&this.editor.destroy(),this.context==="comment"&&this.is_modal&&this.hasUnsavedChanges&&(window.fcom_modal_comment_unsaved=!1),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("click",this.handleLinkClick,!0),document.removeEventListener("keydown",this.handleEditorKeydown,!0),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0)),this.$eventBus.off("unsavedChangesProceeded",this.onUnsavedChangesProceeded)}},Ja={style:{position:"relative"},class:"fcom_md_editor"},Qa={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},Xa=["placeholder","value"],er={class:"fcom_mention_pop_wrap"},tr={key:0},sr={key:0},or=["onClick"],ir=["src"],nr={key:1};function lr(e,t,s,u,o,i){const m=p("ProsemirrorAdapterProvider"),f=p("MilkdownProvider"),h=fe;return n(),r(T,null,[a(f,null,{default:c(()=>[a(m,null,{default:c(()=>[l("div",Ja,[Y(l("div",Qa,null,512),[[vt,!o.editorFailed]]),o.editorFailed?(n(),r("textarea",{key:0,ref:"fallbackInput",class:"fcom_md_editor_fallback",placeholder:s.placeholder||e.$t("Type your message here!"),value:s.modelValue,onInput:t[0]||(t[0]=(...g)=>i.onFallbackInput&&i.onFallbackInput(...g))},null,40,Xa)):_("",!0)])]),_:1})]),_:1}),l("div",er,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:o.showMentionPop,width:300,persistent:!1},{reference:c(()=>[...t[1]||(t[1]=[l("span",{style:{}},null,-1)])]),default:c(()=>[o.justReplaced?_("",!0):(n(),r("div",tr,[o.mentionResults.length?(n(),r("ul",sr,[(n(!0),r(T,null,x(o.mentionResults,g=>(n(),r("li",{key:g.user_id,onClick:k=>i.addMention("@"+g.username)},[g.avatar?(n(),r("img",{key:0,alt:"",src:g.avatar},null,8,ir)):_("",!0),l("span",null,d(g.display_name)+" (@"+d(g.username)+")",1)],8,or))),128))])):o.searchingMention?_("",!0):(n(),r("div",nr,[l("p",null,d(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const ns=P(Za,[["render",lr]]);const ar={name:"ActionPopover",emits:["show","hide"],props:{items:{type:Array,default:()=>[]},width:{type:[Number,String],default:150},placement:{type:String,default:"bottom",validator:e=>["top","top-start","top-end","bottom","bottom-start","bottom-end","left","left-start","left-end","right","right-start","right-end"].includes(e)},persistent:{type:Boolean,default:!1},teleported:{type:Boolean,default:!1}},data(){return{visible:!1}},watch:{visible(e){this.$emit(e?"show":"hide"),document[e?"addEventListener":"removeEventListener"]("click",this.onClickOutside,!0)}},methods:{toggle(){this.visible=!this.visible},hide(){this.visible=!1},onClickOutside(e){var s,u,o,i,m;const t=(u=(s=this.$refs.popoverRef)==null?void 0:s.popperRef)==null?void 0:u.contentRef;t!=null&&t.contains(e.target)||(o=this.$refs.triggerRef)!=null&&o.contains(e.target)||(m=(i=e.target).closest)!=null&&m.call(i,".el-popper")||this.hide()},handleAction(e){this.hide(),e.action&&e.action()},focusFirstItem(){this.focusItem(0)},focusItem(e){var u;const t=this.$refs.menuItems;if(!Array.isArray(t)||!t.length)return;const s=t[(e+t.length)%t.length];(u=s==null?void 0:s.focus)==null||u.call(s)},hideAndFocusTrigger(){this.hide(),this.$nextTick(()=>{var s,u;const e=this.$refs.triggerRef,t=((s=e==null?void 0:e.querySelector)==null?void 0:s.call(e,"button, a, [tabindex]"))||e;(u=t==null?void 0:t.focus)==null||u.call(t)})}},beforeUnmount(){document.removeEventListener("click",this.onClickOutside,!0)}},rr=["onClick","onKeydown"];function cr(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=O,g=fe;return n(),v(g,{trigger:"manual",placement:s.placement,persistent:s.persistent,width:s.width,visible:o.visible,teleported:s.teleported,"popper-class":"fcom_menu_below_nav",onAfterEnter:i.focusFirstItem,ref:"popoverRef"},{reference:c(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...k)=>i.toggle&&i.toggle(...k))},[K(e.$slots,"trigger",{visible:o.visible},()=>[a(h,{"aria-label":e.$t("View actions"),"aria-haspopup":"menu","aria-expanded":o.visible,class:"fcom_action_popover_default_trigger_button",size:"small"},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded"])])],512)]),default:c(()=>[K(e.$slots,"default",{hide:i.hide},()=>[l("ul",{class:"actions_items",role:"menu","aria-orientation":"vertical",onKeydown:t[1]||(t[1]=te(q((...k)=>i.hideAndFocusTrigger&&i.hideAndFocusTrigger(...k),["prevent","stop"]),["esc"]))},[(n(!0),r(T,null,x(s.items,(k,b)=>(n(),r("li",{key:b,ref_for:!0,ref:"menuItems",class:D(["fcom_action_popover_item",k.type?"fcom_action_popover_item_"+k.type:""]),role:"menuitem",tabindex:"0",onClick:S=>i.handleAction(k),onKeydown:[te(q(S=>i.handleAction(k),["prevent"]),["enter"]),te(q(S=>i.handleAction(k),["prevent"]),["space"]),te(q(S=>i.focusItem(b+1),["prevent"]),["down"]),te(q(S=>i.focusItem(b-1),["prevent"]),["up"])]},d(k.label),43,rr))),128))],32)])]),_:3},8,["placement","persistent","width","visible","teleported","onAfterEnter"])}const et=P(ar,[["render",cr]]),dr={name:"SmilyIcon"},ur={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _r(e,t,s,u,o,i){return n(),r("svg",ur,[...t[0]||(t[0]=[Le('<g><circle cx="9.99996" cy="10.0013" r="8.33333" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></circle><path d="M6.66663 12.5C7.42673 13.512 8.6369 14.1667 9.99996 14.1667C11.363 14.1667 12.5732 13.512 13.3333 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M6.6741 7.5L6.66663 7.5Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M13.3333 7.5L13.3258 7.5Z" fill="currentColor"></path><path d="M6.6741 7.5L6.66663 7.5M13.3333 7.5L13.3258 7.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g>',1)])])}const mr=P(dr,[["render",_r]]),hr={name:"EmojiPicker",components:{Picker:Wi,ActionPopover:et,SmilyIcon:mr},emits:["emoji-selected"],props:{close_on_select:{type:Boolean,default:!1}},data(){return{emojiIndex:null,emojiLoading:!1,errorMessage:"",isLoading:!1}},methods:{onEmojiSelect(e){this.$emit("emoji-selected",e.native),this.close_on_select&&this.closeAndRefocus()},closeAndRefocus(){var e;(e=this.$refs.fcom_emoji_popover)==null||e.hideAndFocusTrigger()},applyEmojiIndex(){this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1,this.focusSearchInput()},focusSearchInput(){this.$nextTick(()=>{var s,u,o,i;const e=document.activeElement,t=(s=this.$refs.emojiTrigger)==null?void 0:s.$el;e&&e!==document.body&&e!==t&&!e.closest(".ffcom_emoji")||(i=(o=(u=this.$refs.picker)==null?void 0:u.$el)==null?void 0:o.querySelector("input"))==null||i.focus()})},loadEmojiAssets(){if(this.isLoading)return;if(window.fcomEmojiIndex){this.applyEmojiIndex();return}this.isLoading=!0;let e=this.appVars.assets_url+"libs/static/tw_emojis.json";this.emojiLoading=!0,fetch(e).then(t=>t.json()).then(t=>{t?(window.fcomEmojiIndex=new Ki(t),this.applyEmojiIndex()):this.errorMessage=this.$t("Emoji loading failed")}).catch(()=>{this.errorMessage=this.$t("Emoji loading failed")}).finally(()=>{this.isLoading=!1})}}},fr={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},pr={key:0},gr={style:{"text-align":"center","margin-bottom":"20px"}},yr={key:1,class:"fcom_emoji_holder"};function vr(e,t,s,u,o,i){const m=p("SmilyIcon"),f=j,h=O,g=J,k=p("Picker"),b=p("action-popover");return n(),v(b,{ref:"fcom_emoji_popover","close-on-click-outside":!0,placement:"bottom",persistent:!1,"trigger-interactive":!0,teleported:!0,width:350,onShow:i.loadEmojiAssets},{trigger:c(({visible:S})=>[a(h,{ref:"emojiTrigger","aria-label":e.$t("Pick Emoji"),"aria-haspopup":"dialog","aria-expanded":S?"true":"false",onKeydown:te(w=>S&&i.closeAndRefocus(),["esc"]),text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded","onKeydown"])]),default:c(()=>[l("div",{class:"ffcom_emoji",onKeydown:t[0]||(t[0]=te(q(S=>i.closeAndRefocus(),["prevent","stop"]),["esc"]))},[o.emojiLoading?(n(),r("div",fr,[o.errorMessage?(n(),r("div",pr,d(o.errorMessage),1)):(n(),r(T,{key:1},[l("div",gr,d(e.$t("Loading...")),1),a(g,{animated:!0,rows:3})],64))])):o.emojiIndex?(n(),r("div",yr,[a(k,{title:e.$t("Pick Emoji"),i18n:{search:e.$t("Search"),notfound:e.$t("No Emoji Found"),categories:{search:e.$t("Search Results"),recent:e.$t("Frequently Used"),smileys:e.$t("Smileys & Emotion"),people:e.$t("People & Body"),nature:e.$t("Animals & Nature"),foods:e.$t("Food & Drink"),activity:e.$t("Activity"),places:e.$t("Travel & Places"),objects:e.$t("Objects"),symbols:e.$t("Symbols"),flags:e.$t("Flags"),custom:e.$t("Custom")}},color:"#66b1ff",showPreview:!1,ref:"picker",data:o.emojiIndex,set:"twitter",onSelect:i.onEmojiSelect,emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)],32)]),_:1},8,["onShow"])}const ro=P(hr,[["render",vr]]),br={name:"AudioEditModal",components:{ImageUploader:Re,EditPen:zs,Delete:qs},emits:["update:visible","saved"],props:{media:{type:Object,required:!0},visible:{type:Boolean,default:!1}},data(){return{localTitle:this.readTitle(),localPoster:this.readPoster(),saving:!1}},watch:{visible(e){e&&(this.localTitle=this.readTitle(),this.localPoster=this.readPoster())}},methods:{readTitle(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.title)||((s=this.media)==null?void 0:s.title)||""},readPoster(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.posterSrc)||((s=this.media)==null?void 0:s.image)||""},save(){var e;if(!this.localTitle||!this.localTitle.trim()){this.$handleError(this.$t("Audio file name cannot be empty"));return}if(this.localTitle=this.localTitle.trim(),!((e=this.media)!=null&&e.media_id)){this.$emit("saved",this.buildLocalUpdate()),this.$emit("update:visible",!1);return}this.saving=!0,this.$post("fluent-player/audio-media/"+this.media.media_id,{title:this.localTitle,posterSrc:this.localPoster}).then(t=>{this.$emit("saved",{...this.media,...t.media}),this.$emit("update:visible",!1)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},buildLocalUpdate(){var t;const e={...((t=this.media)==null?void 0:t.settings)||{},title:this.localTitle,posterSrc:this.localPoster,poster_is_custom:!!this.localPoster};return{...this.media,title:this.localTitle,image:this.localPoster,settings:e}}}},kr={class:"fcom_audio_edit"},wr={id:"fcom_audio_name_label",class:"fcom_audio_edit__label"},Cr={class:"fcom_audio_edit__label"},$r={class:"fcom_audio_edit__thumb_row"},Sr={class:"fcom_image_uploader_wrapper"},Vr={class:"fcom_sr_only"};function Mr(e,t,s,u,o,i){const m=ie,f=Be,h=p("EditPen"),g=j,k=O,b=p("Delete"),S=p("image-uploader"),w=ke;return n(),v(w,{"model-value":s.visible,title:e.$t("Edit Audio"),width:"440px","append-to-body":"","onUpdate:modelValue":t[3]||(t[3]=$=>e.$emit("update:visible",$))},{footer:c(()=>[a(k,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=$=>e.$emit("update:visible",!1))},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(k,{class:"fcom_primary_button",loading:o.saving,disabled:!o.localTitle||!o.localTitle.trim(),onClick:i.save},{default:c(()=>[M(d(e.$t("Save")),1)]),_:1},8,["loading","disabled","onClick"])]),default:c(()=>[l("div",kr,[l("label",wr,d(e.$t("Audio file name")),1),a(m,{modelValue:o.localTitle,"onUpdate:modelValue":t[0]||(t[0]=$=>o.localTitle=$),placeholder:e.$t("Audio file name"),"aria-label":e.$t("Audio file name"),"aria-labelledby":"fcom_audio_name_label"},null,8,["modelValue","placeholder","aria-label"]),l("label",Cr,d(e.$t("Thumbnail")),1),l("div",$r,[o.localPoster?(n(),v(f,{key:0,src:o.localPoster,alt:e.$t("Thumbnail"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",Sr,[a(S,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.localPoster,confirm_remove:!0,additionalData:{resize:!1,max_width:500,skip_convert:"yes"},onUploaded:t[1]||(t[1]=$=>{o.localPoster=$})},ye({remove:c(()=>[a(g,null,{default:c(()=>[a(b)]),_:1}),l("span",Vr,d(e.$t("Remove Thumbnail")),1)]),_:2},[o.localPoster?{name:"trigger",fn:c(({loading:$})=>[a(k,{class:"fcom_plain_button",loading:$,disabled:$,"aria-label":e.$t("Change Thumbnail"),title:e.$t("Change Thumbnail")},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["loading","disabled","aria-label","title"])]),key:"0"}:void 0]),1032,["can_remove"])])])])]),_:1},8,["model-value","title"])}const Lr=P(br,[["render",Mr]]),Tr={name:"MusicIcon"},Fr={width:"22",height:"22",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",focusable:"false"};function Pr(e,t,s,u,o,i){return n(),r("svg",Fr,[...t[0]||(t[0]=[l("path",{d:"M7.5 15V4.583l8.333-1.25V13.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M5.417 17.5c1.15 0 2.083-.84 2.083-1.875S6.567 13.75 5.417 13.75 3.333 14.59 3.333 15.625 4.266 17.5 5.417 17.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M13.75 15.625c1.15 0 2.083-.84 2.083-1.875s-.933-1.875-2.083-1.875-2.083.84-2.083 1.875.933 1.875 2.083 1.875Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const Ir=P(Tr,[["render",Pr]]),Er={name:"AudioUploadButton",components:{MusicIcon:Ir},emits:["audio-added","uploading","completed"],props:{space:{type:String,default:""},remaining:{type:Number,default:null}},data(){return{uploading:!1}},computed:{maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},capacity(){return this.remaining===null?this.maxAudios:Math.max(0,this.remaining)},canUpload(){const e=this.appVars.features.fluent_player;if(!this.appVars.features.has_fluent_player||!e||!e.enable||!e.has_audio_upload)return!1;const t=e.video_upload_role||"admin";return t==="everyone"?!0:t==="admin_moderator"?this.isModerator(this.space)||this.isAdmin():this.isAdmin()}},methods:{pickFiles(){this.$refs.fileInput&&this.$refs.fileInput.click()},async onFilesSelected(e){var s,u;let t=Array.from(e.target.files||[]);if(e.target.value="",!!t.length){if(this.capacity<=0){this.$handleError(this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}t.length>this.capacity&&((u=(s=this.$notify)==null?void 0:s.warning)==null||u.call(s,this.$t("You can add a maximum of %s audios per post.",this.maxAudios)),t=t.slice(0,this.capacity)),this.uploading=!0,this.$emit("uploading");for(const o of t)try{await this.uploadOne(o)}catch(i){this.$handleError(i&&i.message?i.message:i)}this.uploading=!1,this.$emit("completed")}},uploadOne(e){const t=new FormData;return t.append("file",e),t.append("context","fluent_player"),t.append("media_kind","audio"),fetch(this.appVars.rest.url+"/fluent-player/video-upload",{method:"POST",headers:{"X-WP-Nonce":this.appVars.rest.nonce},body:t}).then(s=>s.json().then(u=>({ok:s.ok,body:u}))).then(({ok:s,body:u})=>{if(!s||!u||!u.media||!u.media.url)throw new Error(u&&u.message||this.$t("Failed to upload audio"));const o=u.media;this.$emit("audio-added",{type:"upload",url:o.url,player:"fluent_player",provider:"upload",content_type:"audio",html:"",title:o.settings&&o.settings.title||e.name,media_id:o.media_id,settings:o.settings||{}})})}}};function Ar(e,t,s,u,o,i){const m=p("MusicIcon"),f=j,h=O;return i.canUpload?(n(),v(h,{key:0,"aria-label":e.$t("Upload Audio"),title:e.$t("Upload Audio"),text:"",loading:o.uploading,onClick:i.pickFiles},{default:c(()=>[a(f,{class:"fcom_status_img_icon"},{default:c(()=>[a(m)]),_:1}),l("input",{ref:"fileInput",type:"file",accept:".mp3,.wav,.m4a,.aac,.ogg,.oga,.flac",multiple:"",hidden:"",onChange:t[0]||(t[0]=(...g)=>i.onFilesSelected&&i.onFilesSelected(...g))},null,544)]),_:1},8,["aria-label","title","loading","onClick"])):_("",!0)}const Ur=P(Er,[["render",Ar]]),Br={name:"DocumentsUploader",components:{UploadFilled:wt,Document:Ct},emits:["filesChanged","fileAdded"],props:{is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})},showLists:{type:Boolean,default:!0},prevFiles:{type:Array,default:()=>[]}},computed:{action_url(){return this.appVars.rest.url+"/documents/upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}},uploadingFiles(){return this.fileList.filter(e=>e.status==="uploading")}},data(){return{fileList:[]}},methods:{handleSuccess(e){var t;console.log(e),(t=e==null?void 0:e.file)!=null&&t.media_key&&this.$emit("fileAdded",e==null?void 0:e.file)},handleChange(){let e=[];this.fileList.forEach(t=>{var s,u;(u=(s=t==null?void 0:t.response)==null?void 0:s.file)!=null&&u.media_key&&e.push({id:t.response.file.id,media_key:t.response.file.media_key,title:t.response.file.title,type:t.response.file.type})}),this.$emit("filesChanged",e)},handleError(e){this.$handleError(JSON.parse(e.message))}}},Dr={class:"fcom_documents_uploader"},Rr={class:"el-upload__text"},xr={key:0},Or={class:"fcom_document_lists"},Hr={class:"fcom_each_document"},jr={class:"fcom_document_info"},Nr={class:"fcom_document_icon"},zr={class:"fcom_document_title"},qr={class:"fcom_document_actions"};function Gr(e,t,s,u,o,i){const m=p("UploadFilled"),f=j,h=bt,g=p("Document"),k=O;return n(),r("div",Dr,[a(h,{action:i.action_url,headers:i.headers,"file-list":o.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>o.fileList=b),accept:"*/*",drag:"",class:"fcom_document_upload",multiple:s.is_multiple,data:s.additional_data,"show-file-list":s.showLists,"on-change":i.handleChange,"on-success":i.handleSuccess,"on-error":i.handleError,"on-remove":i.handleChange},{default:c(()=>[a(f,{class:"el-icon--upload"},{default:c(()=>[a(m)]),_:1}),l("div",Rr,d(e.$t("Drop file here or click to upload")),1)]),_:1},8,["action","headers","file-list","multiple","data","show-file-list","on-change","on-success","on-error","on-remove"]),!s.showLists&&i.uploadingFiles.length?(n(),r("div",xr,[l("div",Or,[(n(!0),r(T,null,x(i.uploadingFiles,b=>(n(),r("div",Hr,[l("div",jr,[l("div",Nr,[a(f,null,{default:c(()=>[a(g)]),_:1})]),l("span",zr,d(b.name),1)]),l("div",qr,[a(k,{text:"",size:"small",loading:!0},{default:c(()=>[M(d(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const Yr=P(Br,[["render",Gr]]),Wr={name:"PdfIcon"},Kr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Zr(e,t,s,u,o,i){return n(),r("svg",Kr,[...t[0]||(t[0]=[l("path",{opacity:"0.4",d:"M19 11C19 10.1825 19 9.4306 18.8478 9.06306C18.6955 8.69552 18.4065 8.40649 17.8284 7.82843L13.0919 3.09188C12.593 2.593 12.3436 2.34355 12.0345 2.19575C11.9702 2.165 11.9044 2.13772 11.8372 2.11401C11.5141 2 11.1614 2 10.4558 2C7.21082 2 5.58831 2 4.48933 2.88607C4.26731 3.06508 4.06508 3.26731 3.88607 3.48933C3 4.58831 3 6.21082 3 9.45584V14C3 17.7712 3 19.6569 4.17157 20.8284C5.34315 22 7.22876 22 11 22H19M12 2.5V3C12 5.82843 12 7.24264 12.8787 8.12132C13.7574 9 15.1716 9 18 9H18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M21 14H19C18.4477 14 18 14.4477 18 15V16.5M18 16.5V19M18 16.5H20.5M7 19V17M7 17V14H8.5C9.32843 14 10 14.6716 10 15.5C10 16.3284 9.32843 17 8.5 17H7ZM12.5 14H13.7857C14.7325 14 15.5 14.7462 15.5 15.6667V17.3333C15.5 18.2538 14.7325 19 13.7857 19H12.5V14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const Jr=P(Wr,[["render",Zr]]),Qr={name:"ZipIcon"},Xr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function ec(e,t,s,u,o,i){return n(),r("svg",Xr,[...t[0]||(t[0]=[l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.24643 13.7697C8.9545 13.7507 8.55839 13.75 8.00407 13.75H7.00391C6.58969 13.75 6.25391 13.4142 6.25391 13C6.25391 12.5858 6.58969 12.25 7.00391 12.25H8.00407C8.01907 12.25 8.03402 12.25 8.04892 12.25C8.66199 12.25 9.18423 12.25 9.57881 12.2929C9.93962 12.3322 10.469 12.4271 10.7888 12.8672C10.9627 13.1066 11.0272 13.3876 10.9857 13.67C10.9495 13.9166 10.8383 14.1258 10.7382 14.2819C10.5513 14.5734 10.2447 14.912 9.91903 15.2718C9.90537 15.2868 9.89169 15.3019 9.87798 15.3171L8.63592 16.6895C8.43153 16.9153 8.27429 17.0901 8.15532 17.2303C8.44726 17.2493 8.84336 17.25 9.39768 17.25H10.3978C10.8121 17.25 11.1478 17.5858 11.1478 18C11.1478 18.4142 10.8121 18.75 10.3978 18.75L9.35284 18.75C8.73977 18.75 8.21752 18.7501 7.82294 18.7071C7.46213 18.6678 6.93277 18.5729 6.61299 18.1328C6.43908 17.8934 6.37458 17.6124 6.41604 17.33C6.45224 17.0835 6.5634 16.8742 6.66351 16.7181C6.85041 16.4266 7.15703 16.088 7.48273 15.7283C7.49638 15.7132 7.51006 15.6981 7.52377 15.6829L8.76583 14.3105C8.97022 14.0847 9.12746 13.9099 9.24643 13.7697Z",fill:"currentColor"},null,-1),l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.1914 13C12.1914 12.5858 12.5272 12.25 12.9414 12.25H15.4869C15.9011 12.25 16.2369 12.5858 16.2369 13C16.2369 13.4142 15.9011 13.75 15.4869 13.75H14.9641V17.25H15.4869C15.9011 17.25 16.2369 17.5858 16.2369 18C16.2369 18.4142 15.9011 18.75 15.4869 18.75H12.9414C12.5272 18.75 12.1914 18.4142 12.1914 18C12.1914 17.5858 12.5272 17.25 12.9414 17.25H13.4641V13.75H12.9414C12.5272 13.75 12.1914 13.4142 12.1914 13Z",fill:"currentColor"},null,-1),l("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19.0189 12.25C19.0305 12.25 19.0419 12.25 19.0534 12.25H19.7321C20.8365 12.25 21.7549 13.1328 21.7549 14.25C21.7549 15.3673 20.8365 16.25 19.7321 16.25H18.7852V18C18.7852 18.4142 18.4494 18.75 18.0352 18.75C17.621 18.75 17.2852 18.4142 17.2852 18V14C17.2852 13.9885 17.2852 13.9769 17.2852 13.9653C17.2851 13.7605 17.285 13.5378 17.3107 13.3497C17.3411 13.1278 17.4193 12.8466 17.6588 12.6114C17.8964 12.378 18.1772 12.3037 18.3966 12.2748C18.5853 12.2499 18.8094 12.2499 19.0189 12.25ZM18.7852 14.75H19.7321C20.0336 14.75 20.2549 14.5135 20.2549 14.25C20.2549 13.9866 20.0336 13.75 19.7321 13.75H19.0534C18.9463 13.75 18.8604 13.7501 18.7863 13.7514C18.7852 13.8207 18.7852 13.9009 18.7852 14V14.75Z",fill:"currentColor"},null,-1),l("path",{opacity:"0.4",d:"M7.13841 20.7033C8.00786 20.7942 9.13899 20.7955 10.7476 20.7955H14.9079C15.4456 20.7955 15.8816 21.233 15.8816 21.7727C15.8816 22.3125 15.4456 22.75 14.9079 22.75H10.6927C9.15159 22.75 7.91879 22.75 6.93654 22.6473C5.92712 22.5417 5.0659 22.3186 4.32113 21.7919C3.93077 21.5159 3.58222 21.1871 3.28704 20.8146C2.71721 20.0956 2.47396 19.2577 2.35985 18.2843C2.24996 17.3469 2.24998 16.1743 2.25 14.7262V12.1428V12.1427C2.25 10.7244 2.24999 9.61179 2.30919 8.71107C2.36944 7.79422 2.49398 7.02952 2.77509 6.31755C3.61848 4.1815 5.39221 2.51875 7.61221 1.73658C8.99465 1.2495 10.6813 1.24971 13.5209 1.25007L13.7572 1.25009L13.9605 1.25004L13.9606 1.25004C15.5156 1.2495 16.548 1.24914 17.4068 1.55172C18.7834 2.03673 19.8918 3.071 20.4206 4.41031C20.6039 4.87447 20.6795 5.36014 20.7153 5.90477C20.75 6.43335 20.75 7.08083 20.75 7.87999V7.88006V10.0455C20.75 10.5852 20.3141 11.0228 19.7763 11.0228C19.2386 11.0228 18.8026 10.5852 18.8026 10.0455V7.91329C18.8026 7.07303 18.8021 6.49008 18.7721 6.03341C18.7427 5.58546 18.6879 5.32704 18.6102 5.1304C18.3001 4.34503 17.6344 3.70339 16.7618 3.39593C16.2584 3.21858 15.5913 3.20463 13.7572 3.20463C13.4591 3.20463 13.1023 3.2058 12.7641 3.20732C12.426 3.20885 11.8726 3.21134 11.4104 3.48025C11.1057 3.65756 10.8849 3.85945 10.7582 4.08004C10.5409 4.45845 10.4166 4.89711 10.4166 5.3648C10.4166 5.51193 10.4262 5.70446 10.4344 5.88206L10.4344 5.88212C10.4417 6.03696 10.4496 6.20566 10.4531 6.3737C10.461 6.75379 10.449 7.19733 10.3343 7.62548C10.1108 8.45945 9.4594 9.11086 8.62543 9.33432C8.19728 9.44904 7.75374 9.46105 7.37365 9.45315C7.20551 9.44966 7.03693 9.44174 6.88201 9.43446C6.70441 9.42622 6.48041 9.41667 6.33328 9.41667C5.88661 9.41667 5.46642 9.53003 5.09991 9.72955C4.87246 9.85337 4.65104 10.0965 4.47811 10.3875C4.19749 10.8596 4.19732 11.4982 4.19734 11.7652L4.19737 14.6653C4.19737 16.1888 4.19894 17.2461 4.29387 18.0559C4.38611 18.8427 4.55555 19.2754 4.81111 19.5979C4.9889 19.8223 5.20128 20.0234 5.44274 20.1941C5.80057 20.4472 6.28449 20.6139 7.13841 20.7033Z",fill:"currentColor"},null,-1)])])}const tc=P(Qr,[["render",ec]]),sc={name:"AudioIcon"},oc={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function ic(e,t,s,u,o,i){return n(),r("svg",oc,[...t[0]||(t[0]=[l("path",{d:"M5.5 21.5H18.5C20.1569 21.5 21.5 20.1569 21.5 18.5V5.5C21.5 3.84315 20.1569 2.5 18.5 2.5H5.5C3.84315 2.5 2.5 3.84315 2.5 5.5V18.5C2.5 20.1569 3.84315 21.5 5.5 21.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),l("path",{d:"M10 15.5C10 16.3284 9.32843 17 8.5 17C7.67157 17 7 16.3284 7 15.5C7 14.6716 7.67157 14 8.5 14C9.32843 14 10 14.6716 10 15.5ZM10 15.5V8.5L16 7V13.5M16 13.5C16 14.3284 15.3284 15 14.5 15C13.6716 15 13 14.3284 13 13.5C13 12.6716 13.6716 12 14.5 12C15.3284 12 16 12.6716 16 13.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const nc=P(sc,[["render",ic]]),lc={name:"DocIcon"},ac={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function rc(e,t,s,u,o,i){return n(),r("svg",ac,[...t[0]||(t[0]=[l("path",{d:"M21 15C21 14.4477 20.5523 14 20 14H19C18.4477 14 18 14.4477 18 15V18C18 18.5523 18.4477 19 19 19H20C20.5523 19 21 18.5523 21 18M7 14H8C9.10457 14 10 14.8954 10 16V17C10 18.1046 9.10457 19 8 19H7V14ZM13.5 14H14.5C15.0523 14 15.5 14.4477 15.5 15V18C15.5 18.5523 15.0523 19 14.5 19H13.5C12.9477 19 12.5 18.5523 12.5 18V15C12.5 14.4477 12.9477 14 13.5 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M19 22H5C3.89543 22 3 21.1046 3 20L3 4C3 2.89543 3.89543 2 5 2H12L19 9V11M18.5 9H13.998C12.8935 9 11.998 8.10457 11.998 7V2.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const cc=P(lc,[["render",rc]]),dc={name:"VideoFileIcon"},uc={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function _c(e,t,s,u,o,i){return n(),r("svg",uc,[...t[0]||(t[0]=[l("path",{d:"M19 13V9L12 2H5C3.89543 2 3 2.89543 3 4V20C3 21.1046 3.89543 22 5 22H9",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M12 2V7C12 8.10457 12.8954 9 14 9H19",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),l("path",{d:"M18 19.5L21 21V17L18 18.5M18 19.5V18.5M18 19.5V21C18 21.5523 17.5523 22 17 22H13C12.4477 22 12 21.5523 12 21V17C12 16.4477 12.4477 16 13 16H17C17.5523 16 18 16.4477 18 17V18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1)])])}const mc=P(dc,[["render",_c]]);const hc={name:"DocumentLists",components:{Document:Ct,Download:si,PdfIcon:Jr,ImageIcon:os,ZipIcon:tc,AudioIcon:nc,DocIcon:cc,VideoFileIcon:mc},props:["document_lists","additional_data","is_editable","allow_rename"],emits:["fileRemoved","documentsUpdated"],data(){return{editingIndex:null,editingTitle:"",isSaving:!1}},computed:{canEditTitle(){return this.is_editable||this.allow_rename}},methods:{removeDocument(e,t){if(!this.is_editable){this.$emit("fileRemoved",e);return}this.$confirm(this.$t("Are you sure you want to delete this document?"),this.$t("Warning"),{confirmButtonText:this.$t("OK"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.deleteDocument(e,t)})},deleteDocument(e,t){this.isSaving=!0,this.$post("documents/delete",{id:t.id}).then(s=>{this.$notify.success(s.message),this.document_lists.splice(e,1),this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})},getIcon(e){return e=="application/pdf"?"pdf-icon":e.includes("image")?"image-icon":e=="application/zip"?"zip-icon":e.includes("audio")?"audio-icon":e.includes("video")?"video-file-icon":e.includes("openxmlformats")?"doc-icon":"document"},startEdit(e,t){this.editingIndex=e,this.editingTitle=this.getBaseName(t.title)},cancelEdit(){this.editingIndex=null,this.editingTitle=""},getFileExtension(e){if(!e)return"";const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t)},getBaseName(e){const t=this.getFileExtension(e);return t?e.slice(0,-t.length):e||""},saveDoc(e){const t=this.editingTitle.trim()+this.getFileExtension(e.title);this.isSaving=!0,this.$post("documents/update",{id:e.id,title:t,...this.additional_data}).then(s=>{e.title=t,this.$notify.success(s.message),this.isSaving=!1,this.editingIndex=null,this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})}}},fc={class:"fcom_document_lists"},pc={class:"fcom_each_document"},gc={class:"fcom_document_info"},yc={class:"fcom_document_icon"},vc={class:"fcom_document_ext"},bc={class:"fcom_rename_actions"},kc=["href"],wc={class:"fcom_document_actions"},Cc=["href","aria-label"];function $c(e,t,s,u,o,i){const m=j,f=ie,h=O,g=p("EditPen"),k=p("Download"),b=p("DeleteFilled"),S=se("loading");return n(),r("div",fc,[(n(!0),r(T,null,x(s.document_lists,(w,$)=>(n(),r("div",pc,[l("div",gc,[l("div",yc,[a(m,null,{default:c(()=>[(n(),v(qt(i.getIcon(w.type))))]),_:2},1024)]),i.canEditTitle&&o.editingIndex==$?(n(),r(T,{key:0},[a(f,{readonly:o.isSaving,size:"small","aria-label":e.$t("Document name"),style:{flex:"1",width:"100%"},modelValue:o.editingTitle,"onUpdate:modelValue":t[0]||(t[0]=y=>o.editingTitle=y)},ye({_:2},[i.getFileExtension(w.title)?{name:"suffix",fn:c(()=>[l("span",vc,d(i.getFileExtension(w.title)),1)]),key:"0"}:void 0]),1032,["readonly","aria-label","modelValue"]),l("div",bc,[a(h,{disabled:o.isSaving||!o.editingTitle.trim(),loading:o.isSaving,onClick:y=>i.saveDoc(w),type:"primary",size:"small"},{default:c(()=>[M(d(e.$t("Update")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{disabled:o.isSaving,onClick:i.cancelEdit,size:"small"},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"])])],64)):(n(),r("a",{key:1,href:w.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},d(w.title),9,kc))]),Y((n(),r("div",wc,[i.canEditTitle&&o.editingIndex!=$?(n(),v(h,{key:0,"aria-label":e.$t("Edit"),onClick:y=>i.startEdit($,w),plain:"",text:"",size:"small"},{default:c(()=>[a(m,null,{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),!s.is_editable&&w.url?(n(),r("a",{key:1,href:w.url+"&force_download=1",target:"_blank","aria-label":e.$t("Download"),class:"el-button el-button--text"},[a(m,null,{default:c(()=>[a(k)]),_:1})],8,Cc)):_("",!0),s.is_editable?(n(),v(h,{key:2,"aria-label":e.$t("Delete"),onClick:y=>i.removeDocument($,w),plain:"",text:"",size:"small"},{default:c(()=>[a(m,null,{default:c(()=>[a(b)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0)])),[[S,o.isSaving]])]))),256))])}const tt=P(hc,[["render",$c]]);const Sc={name:"DocumentUploaderPop",components:{DocumentLists:tt,DocumentsUploader:Yr,Document:Ct},props:["feed","space_id","is_inline"],methods:{reset(){delete this.feed.document_ids,this.feed.content_type=""},fileAdded(e){this.feed.document_ids||(this.feed.document_ids=[]),this.feed.document_ids.push(e),this.feed.content_type="document"},removeDocument(e){this.feed.document_ids.splice(e,1),(!this.feed.document_ids||this.feed.document_ids.length===0)&&(this.feed.content_type="")}}},Vc={class:"fcom_inline_docs_form"},Mc={class:"fcom_doc_upload_modal"};function Lc(e,t,s,u,o,i){var g;const m=O,f=p("documents-uploader"),h=p("document-lists");return n(),r("div",Vc,[l("div",Mc,[a(m,{onClick:t[0]||(t[0]=k=>i.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(f,{style:{"margin-bottom":"20px"},showLists:!1,additional_data:{space_id:s.space_id},is_multiple:!0,onFileAdded:i.fileAdded},null,8,["additional_data","onFileAdded"]),a(h,{class:"fcom_boxed_documents",additional_data:{space_id:s.space_id,feed_id:s.feed.id},is_editable:!0,document_lists:(g=s.feed)==null?void 0:g.document_ids,onFileRemoved:i.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const Tc=P(Sc,[["render",Lc]]),Fc={name:"PaperClipIcon"},Pc={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Ic(e,t,s,u,o,i){return n(),r("svg",Pc,[...t[0]||(t[0]=[l("path",{d:"M18.1188 9.2622L11.431 16.6897C9.50497 18.8288 6.13081 18.9109 3.86828 16.8737C1.60575 14.8365 1.33471 11.4723 3.26079 9.33317L9.14601 2.79697C10.4836 1.31147 12.8106 1.25484 14.3818 2.66956C15.953 4.08428 16.1399 6.40445 14.8023 7.88995L9.45214 13.832C8.70311 14.6638 7.42326 14.695 6.54338 13.9027C5.66351 13.1105 5.5607 11.8344 6.30973 11.0025L10.8574 5.95182",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const co=P(Fc,[["render",Ic]]),Ec=window.fluentComAdmin.auth,Ac={name:"FeedTextComposer",components:{AudioEditModal:Lr,AudioList:io,AudioUploadButton:Ur,PaperClipIcon:co,DocumentLists:tt,DocumentUploaderPop:Tc,Document:Ct,MediaPreview:xe,Giphy:Al,ImageUploader:Re,SurveyEditForm:wl,MarkdownEditor:ns,EmojiPicker:ro,VideoEmbeder:ja,ImageIcon:os,PollIcon:ml},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+Ec.first_name}},config:{type:Object,default(){return{multipleMedia:!1,surveyApp:!1,videoApp:!1,disableUpload:!1,documentsApp:!1,space_id:null,spaceSlug:null,isAdmin:!1}}},disabled:{type:Boolean,default(){return!1}},autofocus:{type:Boolean,default(){return!0}},content:{type:Object,default(){return{message:"",media_images:[]}}},mentionQuery:{type:Object,default(){return{}}},autofocus_changed:{type:[Boolean,Number],default(){return!1}},defaultMentions:{type:Array,default(){return[]}},context:{type:String,default(){return""}},is_editing:{type:Boolean,default(){return!1}},is_modal:{type:Boolean,default(){return!1}}},computed:{hasActiveApp(){return this.content.content_type=="document"},hasInlineImageUpload(){return this.appVars.features.has_inline_image_upload==="yes"},maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},audioRemaining(){var e,t;return Math.max(0,this.maxAudios-(((t=(e=this.content)==null?void 0:e.audio_medias)==null?void 0:t.length)||0))}},data(){return{mentionResults:[],mentionSearch:"",uploading:!1,isEmojiPickerVisible:!1,showAudioEdit:!1,composerEditIndex:null,maxMediaPerPost:this.appVars.features.max_media_per_post}},methods:{cencelSurvey(){this.content.survey=null},insertEmoji(e){this.$refs.markdownEditor&&this.$refs.markdownEditor.updateContent(e)},focusComposerAction(){var t,s,u;const e=((t=this.$refs.composerActions)==null?void 0:t.querySelector("button:not([disabled])"))||((u=(s=this.$refs.composerActions)==null?void 0:s.parentElement)==null?void 0:u.querySelector("button:not([disabled])"));e==null||e.focus()},clearContent(){var e;this.content.message="",(e=this.$refs.markdownEditor)==null||e.clearContent()},checkHasImageForCommentsEdit(e){return e.media&&e.media.media_url},removeImageFromComments(){this.content.media=null},checkForImage(e){for(let t=0;t<e.clipboardData.items.length;++t){let s=e.clipboardData.items[t];if(s.kind=="file"&&s.type.startsWith("image/")){const u=s.getAsFile(),o=e.clipboardData.getData("text")||"clipboard-image.png";this.uploadImage(new File([u],o,{type:u.type}))}}},uploadImage(e,t=!0){if(this.config.disableUpload)return this.$notify.error(this.$t("You are not allowed to upload media here.")),!1;if(!this.canAddImage())return!1;t&&(this.uploading=!0);const s=new FormData;return s.append("file",e),s.append("max_width",1400),s.append("context",this.context),s.append("resize",!0),this.$uploadFile("feeds/media-upload",s).then(u=>(t&&this.handleMediaUpload(u.media.url),u.media.url)).catch(u=>{this.$handleError(u)}).finally(()=>{this.uploading=!1})},handleMediaUpload(e,t="uploader"){var s,u;if(this.content.media_images||(this.content.media_images=[]),(u=(s=this.content)==null?void 0:s.meta)!=null&&u.media_preview&&(this.content.meta.media_preview=null),this.config.multipleMedia||(this.content.media_images=[]),!this.canAddImage())return!1;this.content.media=null,this.content.meta=null,this.content.audio_medias=[],this.content.media_images.push({url:e,provider:t,type:"image",height:0,width:0})},initSurveyForm(){this.content.survey||(this.content.survey={type:"single_choice",options:[{slug:"",label:this.$t("First choice")},{slug:"",label:""}]})},selectedGiphy(e){var s,u;this.content.meta||(this.content.meta=[]),(s=this.content)!=null&&s.media_images&&(this.content.media_images=[]),(u=this.content)!=null&&u.media&&(this.content.media=null),this.content.audio_medias=[];const t={image:e.images.downsized_medium.url,height:e.images.downsized_medium.height,width:e.images.downsized_medium.width,type:"image",provider:"giphy"};this.content.meta={media_preview:t}},handleVideoAttachment(e){var s,u,o;if(e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")){if(this.content.media_images=[],this.content.media=null,this.content.meta&&!Array.isArray(this.content.meta)&&this.content.meta.media_preview&&(this.content.meta.media_preview=null),Array.isArray(this.content.audio_medias)||(this.content.audio_medias=[]),this.content.audio_medias.length>=this.maxAudios){(o=(u=this.$notify)==null?void 0:u.warning)==null||o.call(u,this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}this.content.audio_medias.push({...e,player:"fluent_player"}),this.syncAudioMediasToMeta();return}this.content.media_images=[],this.content.meta=[],this.content.audio_medias=[],this.content.media=e},syncAudioMediasToMeta(){const e=Array.isArray(this.content.audio_medias)?this.content.audio_medias:[];(!this.content.meta||Array.isArray(this.content.meta))&&(this.content.meta={...this.content.meta||{}}),e.length?this.content.meta.audio_medias=e:delete this.content.meta.audio_medias},removeComposerAudio(e){Array.isArray(this.content.audio_medias)&&(this.content.audio_medias.splice(e,1),this.syncAudioMediasToMeta())},openComposerAudioEdit(e){this.composerEditIndex=e,this.showAudioEdit=!0},onComposerAudioSaved(e){if(this.composerEditIndex===null)return;const t=this.content.audio_medias[this.composerEditIndex]||{};this.content.audio_medias.splice(this.composerEditIndex,1,{...t,...e}),this.syncAudioMediasToMeta()},getInlineImageCount(){var t,s;const e=(s=(t=this.$refs.markdownEditor)==null?void 0:t.$refs)==null?void 0:s.crepe_editor_vue;return e?e.querySelectorAll('img[src^="http"]').length:0},canAddImage(){var s;return(((s=this.content.media_images)==null?void 0:s.length)||0)+this.getInlineImageCount()>=this.maxMediaPerPost?(this.$notify.error(this.$t("You can upload a maximum of %s images per post.",this.maxMediaPerPost)),!1):!0}},mounted(){var t,s,u;const e=(s=(t=this.content)==null?void 0:t.meta)==null?void 0:s.audio_medias;Array.isArray(e)&&e.length&&!((u=this.content.audio_medias)!=null&&u.length)&&(this.content.audio_medias=[...e]),this.autofocus&&this.$nextTick(()=>{this.$refs.create_status&&this.$refs.create_status.focus()})}},Uc={class:"fcom_text_composer"},Bc={class:"fcom_editor status_text_input"},Dc={key:1,class:"fcom_audio_compose_list"},Rc={key:2,style:{position:"relative","text-align":"center"}},xc={key:3,class:"fcom_media_items"},Oc={key:0,class:"fcom_media_images"},Hc=["src","alt"],jc={key:1,class:"fcrom_media_images"},Nc={class:"fcrom_media_image"},zc=["src","alt"],qc={key:4,class:"fcrom_media_images"},Gc=["src","alt"],Yc={key:5,class:"fcrom_media_images"},Wc={class:"fcrom_media_image"},Kc=["src","alt"],Zc={class:"fcom_composer_footer"},Jc={class:"fcom_composer_apps"},Qc={key:0},Xc={ref:"composerActions",class:"fcom_composer_actions"};function ed(e,t,s,u,o,i){var A,N,H,z,G,ne,E,Q,de,X,Ve;const m=p("MarkdownEditor"),f=p("DocumentUploaderPop"),h=p("SurveyEditForm"),g=p("audio-list"),k=p("audio-edit-modal"),b=O,S=p("media-preview"),w=p("CloseBold"),$=j,y=p("ImageIcon"),C=p("image-uploader"),L=p("video-embeder"),V=p("audio-upload-button"),I=p("PaperClipIcon"),F=p("PollIcon"),R=p("EmojiPicker"),B=p("Giphy"),U=se("loading");return n(),r(T,null,[l("div",Uc,[l("div",Bc,[K(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:s.content.message,"onUpdate:modelValue":t[0]||(t[0]=ee=>s.content.message=ee),context:s.context,is_modal:s.is_modal,autofocus:s.autofocus,placeholder:s.placeholder,mentionQuery:s.mentionQuery,defaultMentions:s.defaultMentions,autofocus_changed:s.autofocus_changed,onInlineUpload:i.hasInlineImageUpload?ee=>i.uploadImage(ee,!1):null,canAddImage:i.canAddImage,onHandleMediaUpload:i.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")}),onEditorEscape:i.focusComposerAction},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload","onEditorEscape"]),K(e.$slots,"after_input")]),s.content.content_type=="document"?(n(),r(T,{key:0},[s.config.documentsApp&&s.config.space_id?(n(),v(f,{key:0,is_inline:!0,feed:s.content,space_id:s.config.space_id},null,8,["feed","space_id"])):_("",!0)],64)):(n(),r(T,{key:1},[s.content.survey?(n(),v(h,{key:0,onCancel:i.cencelSurvey,form:s.content.survey,is_editing:s.is_editing},null,8,["onCancel","form","is_editing"])):_("",!0),(N=(A=s.content)==null?void 0:A.audio_medias)!=null&&N.length?(n(),r("div",Dc,[a(g,{audios:s.content.audio_medias,editable:!0,onRemove:i.removeComposerAudio,onEdit:i.openComposerAudioEdit},null,8,["audios","onRemove","onEdit"]),o.composerEditIndex!==null?(n(),v(k,{key:0,media:s.content.audio_medias[o.composerEditIndex],visible:o.showAudioEdit,"onUpdate:visible":t[2]||(t[2]=ee=>o.showAudioEdit=ee),onSaved:i.onComposerAudioSaved},null,8,["media","visible","onSaved"])):_("",!0)])):(z=(H=s.content)==null?void 0:H.media)!=null&&z.type?(n(),r("div",Rc,[a(b,{onClick:t[3]||(t[3]=ee=>{s.content.media=null}),text:"",type:"danger"},{default:c(()=>[M(d(e.$t("Remove Media")),1)]),_:1}),a(S,{media_item:s.content.media},null,8,["media_item"])])):(G=s.content)!=null&&G.meta?(n(),r("div",xc,[(E=(ne=s.content.meta)==null?void 0:ne.media_items)!=null&&E.length?(n(!0),r(T,{key:0},x(s.content.meta.media_items,(ee,Z)=>(n(),r("div",{key:Z},[ee.type=="image"?(n(),r("div",Oc,[l("img",{class:"fcom_media_image",src:ee.url,alt:e.$t("Media image")},null,8,Hc),a(b,{"aria-label":e.$t("Remove image"),class:"fcom_media_images_cross_button",link:"",onClick:oe=>s.content.meta.media_items.splice(Z,1)},{default:c(()=>[a($,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])])):_("",!0)]))),128)):((de=(Q=s.content.meta)==null?void 0:Q.media_preview)==null?void 0:de.type)=="image"||(Ve=(X=s.content.meta)==null?void 0:X.media_preview)!=null&&Ve.image?(n(),r("div",jc,[l("div",Nc,[l("img",{src:s.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,zc),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[4]||(t[4]=ee=>s.content.meta.media_preview=null)},{default:c(()=>[a($,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)])):s.content.media_images&&s.content.media_images.length?(n(),r("div",qc,[(n(!0),r(T,null,x(s.content.media_images,(ee,Z)=>(n(),r("div",{class:"fcrom_media_image",key:Z},[l("img",{src:ee.url,alt:e.$t("Media image")},null,8,Gc),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:oe=>s.content.media_images.splice(Z,1)},{default:c(()=>[a($,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])]))),128))])):i.checkHasImageForCommentsEdit(s.content)?(n(),r("div",Yc,[l("div",Wc,[l("img",{src:s.content.media.media_url,alt:e.$t("Media image")},null,8,Kc),a(b,{"aria-label":e.$t("Remove image"),link:"",onClick:t[5]||(t[5]=ee=>i.removeImageFromComments())},{default:c(()=>[a($,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label"])])])):_("",!0)],64))]),K(e.$slots,"before_composer_footer"),Y((n(),r("div",Zc,[l("div",Jc,[i.hasActiveApp?_("",!0):(n(),r(T,{key:0},[o.maxMediaPerPost?(n(),v(C,{key:0,additionalData:{resize:!0,context:s.context,max_width:1400},isMultiple:s.config.multipleMedia,onUploading:t[6]||(t[6]=()=>{o.uploading=!0}),onCompleted:t[7]||(t[7]=()=>{o.uploading=!1}),onUploaded:i.handleMediaUpload},{default:c(()=>[a(b,{"aria-label":e.$t("Upload Media"),loading:o.uploading,text:""},{default:c(()=>[a($,{class:"fcom_status_img_icon"},{default:c(()=>[a(y)]),_:1}),o.uploading?(n(),r("span",Qc,d(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["aria-label","loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),v(L,{key:1,space:s.config.spaceSlug,is_admin:s.config.is_admin,onEmbeded:i.handleVideoAttachment},null,8,["space","is_admin","onEmbeded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),v(V,{key:2,space:s.config.spaceSlug,remaining:i.audioRemaining,onAudioAdded:i.handleVideoAttachment,onUploading:t[8]||(t[8]=()=>{o.uploading=!0}),onCompleted:t[9]||(t[9]=()=>{o.uploading=!1})},null,8,["space","remaining","onAudioAdded"])):_("",!0),s.config.documentsApp&&s.config.space_id?(n(),v(b,{key:3,"aria-label":e.$t("Add Documents"),title:e.$t("Upload Documents"),text:"",onClick:t[10]||(t[10]=ee=>s.content.content_type="document")},{default:c(()=>[a($,{class:D(["fcom_apps_icon"])},{default:c(()=>[a(I)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),s.config.surveyApp&&e.hasFeature("has_survey_poll")?(n(),v(b,{key:4,"aria-label":e.$t("Create Poll"),onClick:i.initSurveyForm,text:""},{default:c(()=>[a($,{class:"fcom_apps_icon"},{default:c(()=>[a(F)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),e.hasFeature("emoji_app")?(n(),v(R,{key:5,onEmojiSelected:i.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(n(),v(B,{key:6,onSelectedGiphy:i.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",Xc,[K(e.$slots,"default")],512)])),[[U,o.uploading]]),K(e.$slots,"after_composer_footer")],64)}const ht=P(Ac,[["render",ed]]),td={name:"ImageCarousel",props:["feed","is_single"],data(){return{failedMedia:{}}},computed:{srcList(){return this.feed.meta.media_items.map(e=>e.url)},visibleMedia(){return this.feed.meta.media_items.map((e,t)=>({url:e.url,type:e.type,index:t})).slice(0,4)},overflowCount(){return this.srcList.length>4?this.srcList.length-4:0},carouselClass(){const e=this.srcList.length;return e===1?"fcom_image_carousel_num_1":e===3?"fcom_image_carousel_num_3":e===2||e===4||e>4?"fcom_image_carousel_num_2_or_4":""}},methods:{getVideoType(e){switch(e.split(".").pop().toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";default:return"video/mp4"}},isOverflowSlot(e){return e===3&&this.feed.meta.media_items.length>4}}},sd={class:"fcom_image_carousel"},od={key:0},id=["preload","poster"],nd=["src","type","onError"],ld={key:1,class:"fcom_media_load_error"},ad={key:1,class:"fcom_image_wrap"},rd={key:0,class:"fcom_image_overlay"};function cd(e,t,s,u,o,i){const m=Be;return n(),r("div",sd,[l("div",{class:D([i.carouselClass+" "+s.feed.type,"fcom_image_carousel__container"])},[(n(!0),r(T,null,x(i.visibleMedia,(f,h)=>(n(),r("div",{class:D(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(n(),r("div",od,[o.failedMedia[f.url]?(n(),r("p",ld,d(e.$t("This video could not be played.")),1)):(n(),r("video",{key:0,style:{width:"100%","aspect-ratio":"16/9"},controls:"",preload:s.is_single?"":"none",poster:f.thumbnail},[l("source",{src:f.url,type:i.getVideoType(f.url),onError:g=>o.failedMedia[f.url]=!0},null,40,nd)],8,id))])):(n(),r("div",ad,[a(m,{lazy:"",alt:"",src:f.url,"zoom-rate":1.2,"max-scale":7,"min-scale":.5,"hide-on-click-modal":!0,"preview-teleported":!0,"initial-index":f.index,"preview-src-list":i.srcList,"show-progress":"",fit:"cover"},null,8,["src","initial-index","preview-src-list"]),i.isOverflowSlot(h)?(n(),r("div",rd,"+"+d(i.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const Mt=P(td,[["render",cd]]),dd={name:"ErrorIcon"},ud={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(245 166 7)","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"h-3 w-3 ltr:mr-2 rtl:ml-2"};function _d(e,t,s,u,o,i){return n(),r("svg",ud,[...t[0]||(t[0]=[l("circle",{cx:"12",cy:"12",r:"10"},null,-1),l("line",{x1:"12",x2:"12",y1:"16",y2:"12"},null,-1),l("line",{x1:"12",x2:"12.01",y1:"8",y2:"8"},null,-1)])])}const uo=P(dd,[["render",_d]]),md={name:"ReportReview",components:{ErrorIcon:uo},props:{feed:{type:Object,required:!0},type:{type:String,default:"post"}},emits:["updated"],methods:{openReportDetails(){this.$eventBus.emit("showReportReviewModal",{content:this.feed,type:this.type})},handleReportUpdate(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&this.$emit("updated",e.content)}},mounted(){this.$eventBus.on("updateModerationReport",this.handleReportUpdate)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.handleReportUpdate)}},hd={class:"fcom_feed_report_wrap"},fd={class:"fcom_feed_report_content"},pd={key:0},gd={key:1},yd={key:2},vd={class:"fcom_feed_report_action"};function bd(e,t,s,u,o,i){const m=p("ErrorIcon"),f=O;return n(),r("div",hd,[l("div",fd,[a(m),s.feed.meta.auto_flagged=="yes"?(n(),r("span",pd,d(e.$t("This %s has been flagged automatically by the site rule.",s.type)),1)):s.feed.meta.reports_count>1?(n(),r("span",gd,d(e.$t("This %1$s has been flagged with %2$s reports",s.type,s.feed.meta.reports_count)),1)):(n(),r("span",yd,d(e.$t("This %1$s has been flagged with %2$s report",s.type,s.feed.meta.reports_count)),1))]),l("div",vd,[a(f,{onClick:t[0]||(t[0]=h=>i.openReportDetails())},{default:c(()=>[M(d(e.$t("Review")),1)]),_:1})])])}const _o=P(md,[["render",bd]]),kd={name:"StickyIcon"},wd={viewBox:"0 0 24 24","aria-hidden":"true",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-14j79pv r-10ptun7 r-1janqcz"};function Cd(e,t,s,u,o,i){return n(),r("svg",wd,[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M7 4.5C7 3.12 8.12 2 9.5 2h5C15.88 2 17 3.12 17 4.5v5.26L20.12 16H13v5l-1 2-1-2v-5H3.88L7 9.76V4.5z"})],-1)])])}const Lt=P(kd,[["render",Cd]]),$d={name:"FeedMdContent",props:["content","class_name"],data(){return{hoverTimeout:null,lightboxImages:[],lightboxIndex:0}},watch:{content(){this.$nextTick(()=>{this.cleanupListeners(),this.setupListeners()})}},methods:{setupListeners(){const e=this.$refs.content;if(!e)return;const t=/\/u\/([^\/]+)\/?$/;e.querySelectorAll("a").forEach(s=>{const u=s.getAttribute("href"),o=(u==null?void 0:u.startsWith(this.appVars.portal_url))&&u.match(t);if(!o)return;const i=o[1];s._mentionEnter=()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.$eventBus.emit("show_mention_popover",{username:i,triggerElement:s})},500)},s._mentionLeave=()=>{clearTimeout(this.hoverTimeout),this.$eventBus.emit("hide_mention_popover")},s.addEventListener("mouseenter",s._mentionEnter),s.addEventListener("mouseleave",s._mentionLeave)}),this._clickHandler=s=>{var m;const u=s.target.closest('img[src^="http"]');if(u){s.preventDefault();const f=Array.from(e.querySelectorAll('img[src^="http"]')).map(h=>h.src);this.lightboxImages=f,this.lightboxIndex=Math.max(0,f.indexOf(u.src));return}const o=s.target.closest(".fcom_copy_code_btn");if(!o)return;s.stopPropagation();const i=(m=o.parentElement)==null?void 0:m.querySelector("pre");i&&this.$toClipboard((i.querySelector("code")||i).innerText,"Code copied")},e.addEventListener("click",this._clickHandler),e.querySelectorAll("pre").forEach(s=>{var o;if((o=s.parentElement)!=null&&o.classList.contains("fcom_code_wrap"))return;const u=document.createElement("div");u.className="fcom_code_wrap",u.innerHTML='<button class="fcom_copy_code_btn" title="'+this.$t("Copy code")+'"></button>',s.replaceWith(u),u.prepend(s)})},cleanupListeners(){const e=this.$refs.content;e&&(e.querySelectorAll("a").forEach(t=>{t._mentionEnter&&(t.removeEventListener("mouseenter",t._mentionEnter),t.removeEventListener("mouseleave",t._mentionLeave))}),this.$eventBus.emit("hide_mention_popover"),clearTimeout(this.hoverTimeout),this._clickHandler&&(e.removeEventListener("click",this._clickHandler),this._clickHandler=null),e.querySelectorAll(".fcom_copy_code_btn").forEach(t=>t.remove()))}},mounted(){this.$nextTick(()=>this.setupListeners())},beforeUnmount(){this.cleanupListeners()}},Sd=["innerHTML"];function Vd(e,t,s,u,o,i){const m=Is;return n(),r(T,null,[l("div",{ref:"content",class:D(["feed_md_content",s.class_name]),innerHTML:s.content},null,10,Sd),o.lightboxImages.length?(n(),v(m,{key:0,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,onClose:t[0]||(t[0]=f=>o.lightboxImages=[]),"show-progress":o.lightboxImages.length>1},null,8,["url-list","initial-index","show-progress"])):_("",!0)],64)}const Tt=P($d,[["render",Vd]]),Md=80,Ld=20,Td=5e3,Ft={methods:{scrollCommentIntoView(e,t=null){var f;const s=this.$el instanceof Element?this.$el:(f=this.$el)==null?void 0:f.parentElement,u=(s==null?void 0:s.closest(".feed"))||document,o=h=>h&&u.querySelector("#comment_"+h),i=o(e)||o(t);if(!i)return;const m=i.querySelector(".comment_text")||i;m.classList.add("fcom_highlight_glow"),setTimeout(()=>m.classList.remove("fcom_highlight_glow"),Td),setTimeout(()=>{const h=i.getBoundingClientRect();h.top>=Md&&h.bottom<=window.innerHeight-Ld||i.scrollIntoView({behavior:"smooth",block:"center"})},50)}}},Fd={name:"SingleComment",mixins:[Ft],components:{ImageCarousel:Mt,FeedTextComposer:ht,MediaPreview:xe,ReportReview:_o,StickyIcon:Lt,FeedMdContent:Tt,ActionPopover:et},props:{comment:{type:Object,required:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},space_id:{type:String,default:null}},emits:["deleted","updated","reload","copyLink"],watch:{isEdit(e){e||(this.expanded=!1,this.canExpand=!1,this.$nextTick(()=>{this.checkOverflow(),this.canExpand&&(this.expanded=!0)}))}},mounted(){this.$nextTick(()=>this.checkOverflow())},data(){return{working:!1,isEdit:!1,editingComment:null,focusTrigger:0,expanded:!1,canExpand:!1}},computed:{contentClass(){return"comment_text_body"+(this.expanded?"":" clamped")},isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess()&&this.isReportEnabled&&this.show_report&&(this.comment.status=="pending"||((e=this.comment.meta)==null?void 0:e.reports_count))},showReportOption(){return!(this.comment.user_id==this.auth.user_id)&&this.auth.user_id&&this.isReportEnabled},showStickyOption(){return!this.comment.parent_id&&this.hasSpaceModeratorAccess()},getReportComment(){return{...this.comment,space_id:this.space_id}},commentActions(){const e=[{label:this.$t("Copy Link"),action:()=>this.copyCommentLink(this.comment)}];return this.showStickyOption&&e.push({label:this.comment.is_sticky?this.$t("Unpin from Top"):this.$t("Pin to Top"),action:()=>this.toggleSticky()}),this.showReportOption&&e.push({label:this.$t("Report Comment"),action:()=>this.reportComment(this.comment)}),this.canEditComment(this.comment)&&e.push({label:this.$t("Edit"),action:()=>this.editComment()}),this.canDeleteComment(this.comment)&&e.push({label:this.$t("Delete"),type:"danger",action:()=>this.deleteComment()}),e}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.updateComment()},deleteComment(){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.comment.post_id+"/comments/"+this.comment.id).then(e=>{this.$emit("deleted"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})})},editComment(){this.working=!0,this.$get(`comments/${this.comment.id}`,{context:"edit"}).then(e=>{this.editingComment=e.comment,this.isEdit=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1,this.$refs.comment_actions.hide()})},updateComment(){var t,s,u,o;const e=((t=this.editingComment.media_images)==null?void 0:t.length)>0||((u=(s=this.editingComment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);if(!((o=this.editingComment.message)!=null&&o.replace(/ |\u00A0/gi,"").trim())&&!e){this.$notify.error(this.$t("Comment cannot be empty")),this.focusTrigger++;return}this.working=!0,this.isEdit=!0,this.$post(`feeds/${this.comment.post_id}/comments/${this.comment.id}`,{comment:this.editingComment.message,media_images:this.editingComment.media_images,meta:this.editingComment.meta}).then(i=>{this.$notify.success((i==null?void 0:i.message)||this.$t("Comment updated successfully")),Object.assign(this.comment,i.comment),this.comment.media_images=[],this.isEdit=!1,this.$nextTick(()=>{this.scrollCommentIntoView(this.comment.id)})}).catch(i=>{this.$handleError(i),this.focusTrigger++}).finally(()=>{this.isEdit=!1,this.working=!1})},toggleSticky(){this.hasSpaceModeratorAccess()&&(this.working=!0,this.comment.is_sticky=!this.comment.is_sticky,this.$patch("feeds/"+this.comment.post_id+"/comments/"+this.comment.id,{is_sticky:this.comment.is_sticky?1:0}).then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},renderedComment(e){const s=/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/.exec(e);if(s&&s[1]){let i=s[1];if(i){let m=`<div class="feed_media_ext_video"><iframe src="https://www.youtube.com/embed/${i}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;e+=m}}let u=window.location.origin,o=new RegExp(u,"g");return e=e.replace(/<a(.*?)href="(.*?)"(.*?)>/g,(i,m,f,h)=>f.match(o)?`<a${m}href="${f}"${h}>`:`<a${m}href="${f}" target="_blank"${h}>`),e},copyCommentLink(e){this.$emit("copyLink",e),this.$refs.comment_actions.hide()},reportComment(e){this.$refs.comment_actions.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:e,type:"comment"})},checkOverflow(){var t,s;if(this.expanded)return;const e=(s=(t=this.$refs.commentBody)==null?void 0:t.$refs)==null?void 0:s.content;e&&(this.canExpand=e.scrollHeight>e.clientHeight+1)},toggleExpand(){this.expanded=!this.expanded},reportUpdated(e){var t;e.status=="unpublished"?this.$emit("deleted"):(this.comment.status=e.status,this.comment.meta&&(this.comment.meta.reports_count=((t=e.meta)==null?void 0:t.reports_count)||0),this.$emit("updated"))}}},Pd={key:1,class:"person_avatar"},Id={class:"comment_wrap"},Ed={key:0,class:"comment_text"},Ad={key:0,class:"comment_text_head"},Ud={class:"comment_text_head_name"},Bd=["title"],Dd={key:0,class:"comment_text_head_status"},Rd={class:"comment_actions"},xd={key:2,class:"comment_text_media"},Od={key:3,class:"comment_text_media"};function Hd(e,t,s,u,o,i){const m=p("ReportReview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=De,k=p("StickyIcon"),b=j,S=O,w=p("MoreFilled"),$=p("ActionPopover"),y=p("FeedMdContent"),C=p("MediaPreview"),L=p("ImageCarousel"),V=p("feed-text-composer"),I=se("loading");return n(),r(T,null,[i.showReport?(n(),v(m,{key:0,feed:i.getReportComment,type:"comment",onUpdated:i.reportUpdated},null,8,["feed","onUpdated"])):_("",!0),s.show_header&&s.comment.xprofile?(n(),r("div",Pd,[a(f,{with_level:!1,xprofile:s.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),Y((n(),r("div",Id,[o.isEdit?(n(),r("div",{key:1,onKeydown:t[4]||(t[4]=te((...F)=>i.maybeSave&&i.maybeSave(...F),["enter"])),class:"comment_text"},[a(V,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:o.editingComment,autofocus:!0,autofocus_changed:o.focusTrigger},{default:c(()=>[l("div",null,[a(S,{onClick:t[2]||(t[2]=F=>o.isEdit=!1),class:"fcom_secondary_button"},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(S,{class:"fcom_primary_button",onClick:t[3]||(t[3]=F=>i.updateComment(o.editingComment))},{default:c(()=>[M(d(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(n(),r("div",Ed,[s.show_header?(n(),r("div",Ad,[l("div",Ud,[a(h,{show_badge:!0,xprofile:s.comment.xprofile,show_follow:!0},null,8,["xprofile"]),l("div",{title:s.comment.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(s.comment.created_at)),9,Bd),s.comment.status=="pending"?(n(),r("div",Dd,[a(g,{type:"warning"},{default:c(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Rd,[s.comment.is_sticky?(n(),v(S,{key:0,onClick:t[0]||(t[0]=F=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:c(()=>[a(b,{title:e.$t("Unpin from Top"),class:"fcom_sticky"},{default:c(()=>[a(k)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a($,{ref:"comment_actions",items:i.commentActions,placement:"bottom",width:200},{trigger:c(()=>[a(S,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(b,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["items"])])])):_("",!0),a(y,{ref:"commentBody",class_name:i.contentClass,content:i.renderedComment(s.comment.message_rendered)},null,8,["class_name","content"]),o.canExpand?(n(),r("button",{key:1,type:"button",class:"fcom_see_more_btn",onClick:t[1]||(t[1]=(...F)=>i.toggleExpand&&i.toggleExpand(...F))},d(o.expanded?e.$t("See less"):e.$t("See more")),1)):_("",!0),s.comment.meta.media_preview?(n(),r("div",xd,[a(C,{media_item:s.comment.meta.media_preview},null,8,["media_item"])])):s.comment.meta.media_items?(n(),r("div",Od,[s.comment.meta.media_items?(n(),v(L,{key:0,feed:s.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),K(e.$slots,"after_comment_text")])),[[I,o.working]])],64)}const mo=P(Fd,[["render",Hd]]);function W(e){return window.fluentComAdmin.i18n[e]||e}const ho={public:{label:W("Public"),description:W("__PUBLIC_SPACE_DESC"),space_description:W("__PIBLIC_SPACE_DESC_2")},private:{label:W("Private"),description:W("__PRIVATE_SPACE_DESC"),space_description:W("__PRIVATE_SPACE_DESC_2")},secret:{label:W("Secret"),description:W("Only invited members can view and post."),space_description:W("__SECRET_SPACE_DESC_2")}},jd={public:{label:W("Public"),description:W("Anyone can view and enroll the course for free")},private:{label:W("Private"),description:W("__PRIVATE_COURSE_DESC")},secret:{label:W("Secret"),description:W("Only invited students can view and enroll the course content.")}},Nd={self_paced:{label:W("Self Paced"),description:W("__SELF_PAED_COURSE_DESC")},structured:{label:W("Structured"),description:W("__STRUCTURED_COURSE_DESC")},scheduled:{label:W("Scheduled"),description:W("Course starts on a specific date. Sections are dripped relative to that date.")}};W("Leaderboard Settings"),W("Settings for Leaderboard & Gamification features"),W("Get Leaderboard & Gamification Module"),W("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),W("Emoji Module"),W("Settings for Emoji & Reaction features"),W("Get Emoji & Reaction Module"),W("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),W("Giphy Module"),W("Customize Your Giphy Module Settings"),W("Get Giphy Module"),W("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),W("User Badge Module"),W("Add a badge next to user profile name to highlight valued users"),W("Get User Badge Module"),W("Show a customized badge on user profiles beside their names to easily recognize your admins or moderators, or to give appreciation to your power users."),W("Media Module"),W("Add a badge next to user profile name to highlight valued users"),W("Get Media Module"),W("Choose where to store your media files. Options include Local File System, Amazon S3, or Cloudflare R2 for storing and serving your media assets"),W("Progressive Web App (PWA)"),W("Let members install your community as an app on their phone"),W("Get Progressive Web App (PWA) Module"),W("Turn your community into an installable mobile app with your own name, icon and colors, plus an Install App option right in the portal menu.");const Ae=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let s=0;s<t.length;s++)if(e>=t[s].min_points&&e<=t[s].max_points)return t[s];return t[t-1]},zd={name:"SocialLinks",props:["xprofile","isOwn"],computed:{hasSocialLinks(){return this.socialLinks.length>0},socialLinks(){var u;if(!this.xprofile)return[];const e=[];this.xprofile.website&&e.push({title:this.$t("Website"),icon:'<svg viewBox="0 0 40 20" fill="currentColor"><path d="M3.8 10C3.8 6.58 6.58 3.8 10 3.8H18V0H10C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20H18V16.2H10C6.58 16.2 3.8 13.42 3.8 10ZM12 12H28V8H12V12ZM30 0H22V3.8H30C33.42 3.8 36.2 6.58 36.2 10C36.2 13.42 33.42 16.2 30 16.2H22V20H30C35.52 20 40 15.52 40 10C40 4.48 35.52 0 30 0Z"></path></svg>',url:this.xprofile.website});let t=this.xprofile.social_links;if(t||(t=(u=this.xprofile.meta)==null?void 0:u.social_links),es(t))return e;const s=this.appVars.socialLinkProviders;return s&&this.each(s,(o,i)=>{t[i]&&e.push({title:o.title,icon:o.icon_svg,url:o.domain+t[i]})}),e}}},qd={key:0,class:"fcom_social_links"},Gd=["href","title"];function Yd(e,t,s,u,o,i){const m=j,f=p("router-link");return i.hasSocialLinks?(n(),r("div",qd,[(n(!0),r(T,null,x(i.socialLinks,h=>(n(),r("a",{rel:"noopener nofollow",target:"_blank",href:h.url,key:h.title,title:h.title},[a(m,{innerHTML:h.icon},null,8,["innerHTML"])],8,Gd))),128)),s.isOwn&&!i.hasSocialLinks?(n(),v(f,{key:0,to:{name:"update_profile",params:{username:s.xprofile.username}}},{default:c(()=>[M(d("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Pt=P(zd,[["render",Yd]]),Wd={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:Ue()}},data(){return{loading:!1,hovering:!1}},watch:{profile:{immediate:!0,handler(e){e!=null&&e.user_id&&(e==null?void 0:e.follow)!==void 0&&this.userStore.setFollows({[e.user_id]:e.follow})}}},computed:{isFollowing(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isFollowing(this.profile.user_id):!1},showFollowAction(){var s;const e=(s=this.profile)==null?void 0:s.user_id,t=this.auth.user_id;return this.hasFeature("followers_module")&&e&&t&&e!=t},isBlocked(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isBlocked(this.profile.user_id):!1},followBtnText(){var e;return this.followButtonText?this.followButtonText:(e=this.profile)!=null&&e.is_follower?this.$t("Follow Back"):this.$t("Follow")}},methods:{confirmUnfollow(){this.unfollowUser()},async followUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully followed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},async unfollowUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully unfollowed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},unblockUser(){this.loading=!0,this.$post("profile/"+this.profile.username+"/unblock").then(e=>{this.userStore.removeFollow(this.profile.user_id),this.$notify.success(e.message)}).finally(()=>{this.loading=!1})}}},Kd={key:0},Zd={key:1},Jd={key:0},Qd={key:1};function Xd(e,t,s,u,o,i){const m=O;return i.showFollowAction?(n(),r(T,{key:0},[i.isBlocked?(n(),v(m,{key:0,class:"fcom_secondary_button danger_button",loading:o.loading,disabled:o.loading,style:{"min-width":"90px","max-height":"30px"},onClick:i.unblockUser,onMouseenter:t[0]||(t[0]=f=>o.hovering=!0),onMouseleave:t[1]||(t[1]=f=>o.hovering=!1)},{default:c(()=>[o.hovering?(n(),r("span",Zd,d(e.$t("Unblock")),1)):(n(),r("span",Kd,d(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):i.isFollowing?(n(),v(m,{key:1,onClick:i.confirmUnfollow,class:D(["fcom_secondary_button",{danger_button:o.hovering}]),style:{"min-width":"95px","max-height":"30px"},loading:o.loading,disabled:o.loading,onMouseenter:t[2]||(t[2]=f=>o.hovering=!0),onMouseleave:t[3]||(t[3]=f=>o.hovering=!1)},{default:c(()=>[o.hovering?(n(),r("span",Qd,d(e.$t("Unfollow")),1)):(n(),r("span",Jd,d(e.$t("Following")),1))]),_:1},8,["onClick","class","loading","disabled"])):(n(),v(m,{key:2,onClick:i.followUser,class:"fcom_color_button",style:{"max-height":"30px"},loading:o.loading,disabled:o.loading},{default:c(()=>[l("span",null,d(i.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const st=P(Wd,[["render",Xd]]),eu={name:"UserRouteLink",props:{xprofile:{default:()=>({})},show_pop:{type:Boolean,default:!0},show_badge:{type:Boolean,default:!1},show_verified:{type:Boolean,default:!0},show_follow:{type:Boolean,default:!1},virtualRef:{default:null}},emits:["popover-mouseenter","popover-mouseleave"],components:{SocialLinks:Pt,FollowAction:st},data(){return{}},computed:{userLevel(){var e;return this.has_leaderboard&&((e=this.xprofile)!=null&&e.total_points)?Ae(this.xprofile.total_points):null}},methods:{initShow(){document.addEventListener("scroll",this.onScroll,!0)},onHide(){document.removeEventListener("scroll",this.onScroll,!0)},onScroll(){var e,t;(t=(e=this.$refs.popoverRef)==null?void 0:e.hide)==null||t.call(e),this.virtualRef&&this.$eventBus.emit("hide_mention_popover")}},beforeUnmount(){document.removeEventListener("scroll",this.onScroll,!0)}},tu=["href"],su={class:"fcom_user_display_name"},ou={key:1,class:"user_route"},iu=["href"],nu={class:"fcom_user_display_name"},lu={class:"fcom_profile_pop_avatar"},au={key:0,class:"fcom_prfile_tagline"},ru={class:"fcom_level_name"},cu={style:{display:"block"},class:"fcoml_level_sub meta_line"},du={class:"fcom_profile_pop_info"},uu={class:"pop_info_header"},_u={class:"header_name"},mu=["href"],hu={class:"fcom_user_display_name"},fu={class:"fcom_user_name"},pu={key:0,class:"header_actions"},gu={key:0,class:"fcom_profile_pop_bio"},yu=["title"],vu=["title"],bu={class:"pop_info_btns"},ku=["href"],wu=["href"];function Cu(e,t,s,u,o,i){const m=p("verified-sign"),f=p("UserBadge"),h=p("UserAvatar"),g=ct,k=p("follow-action"),b=p("SocialLinks"),S=dt,w=fe;return s.show_pop?(n(),r("span",ou,[a(w,{ref:"popoverRef",visible:s.virtualRef?!0:null,"virtual-ref":s.virtualRef,"virtual-triggering":!!s.virtualRef,width:500,"show-after":s.virtualRef?0:500,trigger:s.virtualRef?null:"hover",onShow:i.initShow,onHide:i.onHide,persistent:!1,"popper-class":"fcom_profile_popper",placement:"top","popper-style":"padding: 0;"},{reference:c(()=>[K(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",nu,d(s.xprofile.display_name),1)],8,iu)])]),default:c(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=$=>s.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=$=>s.virtualRef&&e.$emit("popover-mouseleave"))},[s.xprofile&&s.xprofile.username?(n(),v(S,{key:0,gutter:20},{default:c(()=>[a(g,{sm:24,md:8},{default:c(()=>[l("div",lu,[a(h,{xprofile:s.xprofile},null,8,["xprofile"]),i.userLevel?(n(),r("div",au,[l("div",ru,d(i.userLevel.title),1),l("div",cu,d(i.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(g,{sm:24,md:16},{default:c(()=>{var $,y;return[l("div",du,[l("div",uu,[l("div",_u,[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",hu,d(s.xprofile.display_name),1),s.xprofile.is_verified?(n(),v(m,{key:0})):_("",!0),s.show_badge?(n(),v(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,mu),l("span",fu," @"+d(s.xprofile.username),1)]),s.show_follow?(n(),r("div",pu,[a(k,{profile:s.xprofile},null,8,["profile"])])):_("",!0)]),($=s.xprofile.meta)!=null&&$.short_description_rendered||s.xprofile.short_description_rendered?(n(),r("div",gu,d(e.getExcerpt(((y=s.xprofile.meta)==null?void 0:y.short_description_rendered)||s.xprofile.short_description_rendered,160)),1)):_("",!0),s.xprofile.created_at?(n(),r("div",{key:1,title:s.xprofile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.xprofile.created_at))),9,yu)):_("",!0),s.xprofile.last_activity?(n(),r("div",{key:2,title:s.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.xprofile.last_activity))),9,vu)):_("",!0),l("div",bu,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:s.xprofile.username})},d(e.$t("View Profile")),9,ku),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(n(),r("a",{key:0,class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("chat/?user_id=:user_id",{user_id:s.xprofile.user_id})},d(e.$t("Message")),9,wu)):_("",!0)]),a(b,{style:{"justify-content":"left"},xprofile:s.xprofile,isOwn:!1},null,8,["xprofile"])])]}),_:1})]),_:1})):_("",!0)],32)]),_:3},8,["visible","virtual-ref","virtual-triggering","show-after","trigger","onShow","onHide"]),s.show_verified&&s.xprofile.is_verified?(n(),v(m,{key:0})):_("",!0),s.show_badge?(n(),v(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)])):(n(),r("a",{key:0,href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[K(e.$slots,"default",{},()=>[l("p",su,d(s.xprofile.display_name),1)]),s.show_verified&&s.xprofile.is_verified?(n(),v(m,{key:0})):_("",!0),s.show_badge?(n(),v(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,tu))}const Te=P(eu,[["render",Cu]]),$u={name:"CommentReacts",components:{UserRouteLink:Te},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{comment:{required:!0,default:null}},methods:{getReactions(){this.reactions&&this.reactions.length===this.comment.reactions_count||(this.loading=!0,this.$get("comments/"+this.comment.id+"/reactions").then(e=>{this.reactions=e.reactions,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},Su={style:{"margin-left":"5px"}},Vu={key:0},Mu={key:1},Lu={class:"fcom_user_lists"},Tu={key:2};function Fu(e,t,s,u,o,i){const m=J,f=p("UserAvatar"),h=p("UserRouteLink"),g=Pe,k=fe;return n(),v(k,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click","popper-class":"fcom_menu_below_nav",onShow:i.getReactions},{reference:c(()=>[l("span",Su,d(s.comment.reactions_count),1)]),default:c(()=>[o.loading?(n(),r("div",Vu,[a(m,{animated:!0,rows:1})])):o.reactions?(n(),r("div",Mu,[a(g,{"max-height":"300px"},{default:c(()=>[l("ul",Lu,[(n(!0),r(T,null,x(o.reactions,b=>(n(),r("li",null,[b.xprofile?(n(),r(T,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),r("div",Tu,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const Pu=P($u,[["render",Fu]]),Iu={name:"NestedReplyBox",mixins:[Ft],components:{SingleComment:mo,FeedTextComposer:ht,CommentReactions:Pu,HeartIcon:Xe},props:["comment","feed","checkPermission","show_reacts_only","defaultMentions","is_modal"],emits:["commented","copyLink"],data(){return{open:!1,composerOpen:!1,replyingToId:null,autofocusInput:!1,focusTick:0,composerKey:0,commentReply:{message:"",media_images:[]},submitting:!1}},computed:{canComment(){return this.hasCommentPermission(this.feed)||!this.checkPermission}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.addComment()},addComment(){var t,s,u;const e=((t=this.commentReply.media_images)==null?void 0:t.length)>0||((u=(s=this.commentReply.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.commentReply.message&&!e||!this.comment.id||(this.submitting=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.commentReply.message,parent_id:this.comment.id,media_images:this.commentReply.media_images,meta:this.commentReply.meta}).then(o=>{var i;this.comment.comments||(this.comment.comments=[]),this.commentReply={message:"",media_images:[]},(i=this.$refs.composer)==null||i.clearContent(),this.comment.comments.push(o.comment),Array.isArray(this.feed.comments)&&this.feed.comments.push(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id,this.comment.id)})}).catch(o=>{this.$handleError(o)}).finally(()=>{this.submitting=!1}))},toggleCommentBox(e,t=!0){var m;if(!this.hasCommentPermission(this.feed)){this.$notify({message:this.$t("Please join the Space to post a comment."),type:"warning"});return}const s=e==null?void 0:e.id,u=(m=e==null?void 0:e.xprofile)==null?void 0:m.username,o=t&&u&&e.user_id!=this.auth.user_id?u:"";if(!t){this.open=this.composerOpen=!this.open,this.replyingToId=null,this.autofocusInput=!1;return}if(this.composerOpen&&this.replyingToId===s){this.composerOpen=!1;return}const i=this.composerOpen;this.replyingToId=s,this.open=this.composerOpen=this.autofocusInput=!0,this.isComposerEmpty()?(this.commentReply.message=o?`@${o} `:"",i&&this.composerKey++):this.focusTick++},isComposerEmpty(){return!(this.commentReply.message||"").replace(/ |\u00A0/gi,"").trim()},handleCommentDelete(e){const t=this.comment.comments[e];this.comment.comments.splice(e,1),t!=null&&t.id&&Array.isArray(this.feed.comments)&&(this.feed.comments=this.feed.comments.filter(s=>s.id!==t.id)),this.feed.comments_count--},toggleLike(e){let t=!e.liked;this.$post("feeds/"+this.feed.id+"/comments/"+e.id+"/reactions",{state:t?1:0}).then(s=>{e.liked=s.liked,e.reactions_count=s.reactions_count}).catch(s=>{this.$handleError(s)})},emitCopyLink(e){this.$emit("copyLink",e)}}},Eu={key:0,class:"reply_box"},Au=["aria-expanded"],Uu={class:"fcom_comments_react fcom_reaction_list"},Bu={class:"child_comments"},Du=["id"],Ru={key:0,class:"reply_box"},xu=["onClick","aria-expanded"],Ou={class:"fcom_comments_react fcom_reaction_list"},Hu={key:0,class:"child_reply_wrap"},ju={class:"feed_commenting"},Nu={class:"person_avatar"},zu=["alt","src"];function qu(e,t,s,u,o,i){var S;const m=p("HeartIcon"),f=j,h=p("CommentReactions"),g=p("single-comment"),k=O,b=p("feed-text-composer");return n(),r(T,null,[i.canComment?(n(),r("div",Eu,[((S=s.feed.meta)==null?void 0:S.comments_disabled)!=="yes"?(n(),r("button",{key:0,type:"button",onClick:t[0]||(t[0]=w=>i.toggleCommentBox(s.comment)),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===s.comment.id},d(e.$t("Reply")),9,Au)):_("",!0),l("span",{class:D([{fcom_is_liked:s.comment.liked},"reply_btn"])},[l("div",Uu,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!s.comment.liked,class:D({user_reacted:s.comment.liked}),onClick:t[1]||(t[1]=w=>i.toggleLike(s.comment)),onKeydown:[t[2]||(t[2]=te(q(w=>i.toggleLike(s.comment),["prevent"]),["enter"])),t[3]||(t[3]=te(q(w=>i.toggleLike(s.comment),["prevent"]),["space"]))]},{default:c(()=>[a(m,{filled:s.comment.liked},null,8,["filled"])]),_:1},8,["aria-label","aria-pressed","class"]),parseInt(s.comment.reactions_count)?(n(),v(h,{key:0,comment:s.comment},null,8,["comment"])):_("",!0)])],2),K(e.$slots,"after_reply_box_text",{toggleOpen:()=>i.toggleCommentBox(s.comment,!1),open:o.open})])):_("",!0),!s.show_reacts_only||o.open?(n(),r(T,{key:1},[l("div",Bu,[(n(!0),r(T,null,x(s.comment.comments,(w,$)=>(n(),r("div",{id:"comment_"+w.id,class:"each_comment"},[a(g,{onCopyLink:i.emitCopyLink,onDeleted:y=>i.handleCommentDelete($),comment:w,show_report:!0},{after_comment_text:c(()=>{var y;return[i.canComment?(n(),r("div",Ru,[((y=s.feed.meta)==null?void 0:y.comments_disabled)!=="yes"?(n(),r("button",{key:0,type:"button",onClick:C=>i.toggleCommentBox(w),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===w.id},d(e.$t("Reply")),9,xu)):_("",!0),l("span",{class:D([{fcom_is_liked:w.liked},"reply_btn"])},[l("div",Ou,[a(f,{role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!w.liked,class:D({user_reacted:w.liked}),onClick:C=>i.toggleLike(w),onKeydown:[te(q(C=>i.toggleLike(w),["prevent"]),["enter"]),te(q(C=>i.toggleLike(w),["prevent"]),["space"])]},{default:c(()=>[a(m,{filled:w.liked},null,8,["filled"])]),_:2},1032,["aria-label","aria-pressed","class","onClick","onKeydown"]),parseInt(w.reactions_count)?(n(),v(h,{key:0,comment:w},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,Du))),256))]),o.composerOpen?(n(),r("div",Hu,[l("div",ju,[l("div",Nu,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,zu)]),l("div",{onKeydown:t[5]||(t[5]=te((...w)=>i.maybeSave&&i.maybeSave(...w),["enter"])),class:"feed_comment_input comment_text"},[(n(),v(b,{ref:"composer",key:o.composerKey,config:{multipleMedia:!0},context:"comment",is_modal:s.is_modal,defaultMentions:s.defaultMentions?s.defaultMentions:[],disabled:o.submitting,autofocus:o.autofocusInput,autofocus_changed:o.focusTick,mentionQuery:{space_id:s.feed.space_id},content:o.commentReply,placeholder:e.$t("Leave a reply")},{default:c(()=>[a(k,{loading:o.submitting,disabled:o.submitting,onClick:t[4]||(t[4]=w=>i.addComment()),class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Reply")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","defaultMentions","disabled","autofocus","autofocus_changed","mentionQuery","content","placeholder"]))],32)])])):_("",!0)],64)):_("",!0)],64)}const Gu=P(Iu,[["render",qu]]),Yu={name:"FeedComments",components:{SingleComment:mo,NestedReplyBox:Gu},props:["feed","show_all","checkPermission","defaultMentions","sortBy","is_single","is_modal"],emits:["forceShowAll"],created(){this._lastSortBy=null,this._sortedTopLevelIds=null},data(){return{loading:!1}},computed:{_displayData(){const e=this.feed.comments;if(!e||!e.length)return{list:[],lastComment:null};const t={},s=[],u={};let o=null;for(let h=0;h<e.length;h++){const g=e[h];!o&&g.is_sticky&&(o=g),g.parent_id?(t[g.parent_id]||(t[g.parent_id]=[]),t[g.parent_id].push(g)):(s.push(g.id),u[g.id]=g)}for(const h of s)u[h].comments=t[h]||void 0;if(o&&u[o.id]){o=u[o.id];const h=s.indexOf(o.id);h!==-1&&s.splice(h,1),delete u[o.id]}const i=o||(s.length?u[s[s.length-1]]:null);if(!s.length&&!o)return{list:[],lastComment:null};const m=this.sortBy;if(this._lastSortBy!==m){let h=[...s];m==="oldest"||!m?h.sort((g,k)=>g-k):m==="latest"?h.sort((g,k)=>k-g):m==="popular"?h.sort((g,k)=>{var b,S;return(((b=u[k])==null?void 0:b.reactions_count)||0)-(((S=u[g])==null?void 0:S.reactions_count)||0)}):m==="most_replied"&&h.sort((g,k)=>{var b,S;return(((b=t[k])==null?void 0:b.length)||0)-(((S=t[g])==null?void 0:S.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(s),g=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(k=>h.has(k)&&u[k]).map(k=>u[k]);for(let k=s.length-1;k>=0;k--)g.has(s[k])||f.unshift(u[s[k]])}else f=s.map(h=>u[h]);return o&&f.unshift(o),{list:f,lastComment:i}},displayComments(){return this._displayData.list},lastComment(){return this._displayData.lastComment}},methods:{fetchComments(){this.loading=!0,this.$get("feeds/"+this.feed.id+"/comments").then(e=>{this.feed.comments=e.comments}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},collectCommentIds(e){var u;const t=new Set([e.id]),s=e.comments?[...e.comments]:[];for(;s.length;){const o=s.pop();t.add(o.id),(u=o.comments)!=null&&u.length&&s.push(...o.comments)}return t},handleCommentDelete(e){const t=this.collectCommentIds(e);this.feed.comments=this.feed.comments.filter(s=>!t.has(s.id)),this.feed.comments_count-=t.size},handleStickyCommentDelete(){this.feed.sticky_comment=null,this.feed.comments_count--},copyCommentLink(e){let t={name:"single_feed",params:{feed_slug:this.feed.slug},query:{comment_id:e.id}};this.feed.course_id&&(t={name:"view_lesson",params:{lesson_slug:this.feed.slug},query:{comment_id:e.id}});let s=this.$router.resolve(t),u=this.appVars.urls.portal_base;u=u.replace(/\/$/,"");let o=u+s.fullPath;navigator.clipboard.writeText(o).then(()=>{this.$notify.success(this.$t("Link copied to clipboard"))}).catch(i=>{this.$notify.error(this.$t("Failed to copy the link"))})},maybeShowAllComments(){if(this.is_single||!this.hasFeature("show_post_modal")){this.$emit("forceShowAll");return}this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments"})}},mounted(){!this.feed.comments&&this.feed.comments_count&&this.fetchComments()}},Wu={key:0,class:"feed_comments"},Ku=["id"],Zu={key:1,class:"feed_comments"},Ju=["id"],Qu=["onClick","aria-expanded"];function Xu(e,t,s,u,o,i){const m=J,f=p("nested-reply-box"),h=p("single-comment");return s.show_all?(n(),r("div",Wu,[o.loading?(n(),v(m,{key:0,row:5,class:"feed_comments_skeleton"})):(n(),r(T,{key:1},[K(e.$slots,"before_comments_start"),(n(!0),r(T,null,x(i.displayComments,(g,k)=>(n(),r("div",{class:"each_comment",key:g.id,id:"comment_"+g.id},[a(h,{comment:g,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onReload:i.fetchComments,onDeleted:b=>i.handleCommentDelete(g)},ye({_:2},[g.parent_id?void 0:{name:"after_comment_text",fn:c(()=>[a(f,{feed:s.feed,comment:g,checkPermission:s.checkPermission,defaultMentions:s.defaultMentions?s.defaultMentions:[],is_modal:s.is_modal,onCopyLink:i.copyCommentLink},null,8,["feed","comment","checkPermission","defaultMentions","is_modal","onCopyLink"])]),key:"0"}]),1032,["comment","space_id","onCopyLink","onReload","onDeleted"])],8,Ku))),128))],64))])):i.lastComment?(n(),r("div",Zu,[l("div",{class:"each_comment",id:"comment_"+i.lastComment.id},[a(h,{comment:i.lastComment,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onDeleted:t[0]||(t[0]=g=>i.handleCommentDelete(i.lastComment))},ye({_:2},[i.lastComment.parent_id?void 0:{name:"after_comment_text",fn:c(()=>[a(f,{defaultMentions:s.defaultMentions?s.defaultMentions:[],onCopyLink:i.copyCommentLink,show_reacts_only:!0,checkPermission:s.checkPermission,feed:s.feed,comment:i.lastComment,is_modal:s.is_modal},{after_reply_box_text:c(({toggleOpen:g,open:k})=>[i.lastComment.comments&&i.lastComment.comments.length?(n(),r("button",{key:0,type:"button",onClick:b=>g(),class:"reply_btn last_comment_reply_txt","aria-expanded":k},d(e.$_n("%d reply","%d replies",i.lastComment.comments.length)),9,Qu)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment","is_modal"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])],8,Ju),s.feed.comments_count>1?(n(),r("div",{key:0,onClick:t[1]||(t[1]=g=>i.maybeShowAllComments()),class:"each_comment show_all_comments"},d(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const fo=P(Yu,[["render",Xu]]);const e_={name:"ReactedUsers",components:{UserRouteLink:Te},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{feed:{type:Object,required:!0,default:()=>({})}},computed:{reactedProfiles(){let e=[],t=this.auth.user_id;return this.feed.has_user_react&&e.push({user_id:t,avatar:this.auth.avatar}),this.each(this.feed.reactions,s=>{s.user_id!=t&&s.xprofile&&e.push({user_id:s.user_id,avatar:s.xprofile.avatar})}),e.slice(0,3)}},methods:{getReactions(){this.reactions&&this.reactions.length===this.feed.reactions_count||(this.loading=!0,this.$get("feeds/"+this.feed.id+"/reactions").then(e=>{this.reactions=e.reactions,e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.$nextTick(()=>{var t,s,u,o;(o=(u=(s=(t=this.$refs.reactedPopover)==null?void 0:t.popperRef)==null?void 0:s.popperInstanceRef)==null?void 0:u.update)==null||o.call(u)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},t_=["title"],s_={key:0,class:"reactions_avatars"},o_=["alt","src"],i_={key:0},n_={key:1},l_={class:"fcom_user_lists"},a_={key:2};function r_(e,t,s,u,o,i){const m=J,f=p("UserAvatar"),h=p("UserRouteLink"),g=Pe,k=fe;return n(),v(k,{ref:"reactedPopover",persistent:!1,"popper-class":"fcom_feed_reacted_user_list",placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:i.getReactions},{reference:c(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[i.reactedProfiles&&i.reactedProfiles.length?(n(),r("div",s_,[(n(!0),r(T,null,x(i.reactedProfiles,b=>(n(),r("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(n(),r("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,o_)):_("",!0)]))),128))])):_("",!0),l("span",null,d(e.$_n("%s like","%s likes",s.feed.reactions_count)),1)],8,t_)]),default:c(()=>[o.loading?(n(),r("div",i_,[a(m,{animated:!0,rows:3})])):o.reactions?(n(),r("div",n_,[a(g,{"max-height":"300px"},{default:c(()=>[l("ul",l_,[(n(!0),r(T,null,x(o.reactions,b=>(n(),r("li",null,[b.xprofile?(n(),r(T,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),r("div",a_,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const c_=P(e_,[["render",r_]]),d_={name:"FeedFooter",mixins:[Ft],components:{ReactedUsers:c_,FeedComments:fo,FeedTextComposer:ht,ChatIcon:Qe,HeartIcon:Xe},props:["feed","is_single","space_slug","is_modal"],emits:["commented","joinSpace"],data(){return{commenting:!1,comment:{message:"",media_images:[]},saving:!1,show_all_comments:this.is_single,reactions:[],isAutoFocus:!1,showCommentBox:!0,defaultMentions:[],sortBy:"oldest"}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.postComment()},postComment(){this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(e=>{var t;this.feed.comments||(this.feed.comments=[]),this.feed.comments.push(e.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.comment={message:"",media_images:[]},this.commenting=!1,(t=this.$refs.composer)==null||t.clearContent(),this.$notify.success(e.message),this.$nextTick(()=>{this.$emit("commented",e.comment),this.scrollCommentIntoView(e.comment.id)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})},showCommentForm(){if(!this.is_single&&this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=!0,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!0});return}this.show_all_comments=!0,this.commenting?(this.commenting=!1,setTimeout(()=>{this.commenting=!0,this.isAutoFocus=!0},100)):(this.commenting=!0,this.isAutoFocus=!0),this.prepareDefaultMentions()},showAll(){this.show_all_comments=!this.show_all_comments,this.commenting=!this.commenting,this.isAutoFocus=!1,this.prepareDefaultMentions()},maybeShowFeedModal(){if(this.is_single){this.showAll();return}if(!this.hasFeature("show_post_modal")){this.showAll();return}this.feed.auto_focus_comment=!1,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!1})},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0);let t=!this.feed.has_user_react;this.$post("feeds/"+this.feed.id+"/react",e).then(s=>{this.feed.has_user_react=t,this.feed.reactions_count=s.new_count}).catch(s=>{this.$handleError(s)})},prepareDefaultMentions(){if(!this.auth.user_id||this.defaultMentions.length)return;let e=this.auth.user_id,t=[];this.feed.user_id!=e&&t.push(this.feed.xprofile);let s=this.feed.comments.slice(-30);this.each(s,u=>{u.user_id!=e&&t.push(u.xprofile)}),this.defaultMentions=Ji(t,"user_id")},changeCommentsSortBy(){this.$storeLocalData("comments_sort_by",this.sortBy)}},mounted(){let e=this.feed.default_comment_sort_by||"oldest";this.sortBy=this.$getLocalData("comments_sort_by",e),this.is_single&&this.prepareDefaultMentions(),this.feed.auto_focus_comment&&setTimeout(()=>{this.commenting=!0,this.isAutoFocus=!0},100)}},u_={ref:"feed_footer",class:"feed_footer"},__={class:"fcom_feed_footer_actions"},m_=["aria-label","aria-pressed"],h_={class:"fcom_sr_only"},f_={class:"fcom_sr_only"},p_={class:"fcom_feed_footer_meta"},g_={key:0},y_={key:0,class:"fcom_reactions_count feed_reaction_meta"},v_={class:"feed_comment_count"},b_={key:2,class:"feed_reaction_meta"},k_={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},w_=["id"],C_={key:0,style:{padding:"0",margin:"0","text-align":"center"}},$_={key:1,class:"feed_commenting"},S_={class:"person_avatar"},V_=["src"],M_={key:2,class:""},L_={style:{padding:"0",margin:"0","text-align":"center"}},T_={key:0,style:{margin:"10px 0"}},F_=["href"];function P_(e,t,s,u,o,i){var y,C,L,V;const m=p("HeartIcon"),f=j,h=p("ChatIcon"),g=p("ReactedUsers"),k=ae,b=re,S=p("feed-comments"),w=O,$=p("feed-text-composer");return n(),r(T,null,[l("div",u_,[l("div",__,[l("ul",null,[l("li",{class:D(["fcom_reaction fcom_reaction_list",{react_active:s.feed.has_user_react}]),role:"button",tabindex:"0","aria-label":e.$t("React"),"aria-pressed":!!s.feed.has_user_react,onClick:t[0]||(t[0]=I=>i.toggleReact()),onKeydown:[t[1]||(t[1]=te(q(I=>i.toggleReact(),["prevent"]),["enter"])),t[2]||(t[2]=te(q(I=>i.toggleReact(),["prevent"]),["space"]))]},[a(f,{class:D({user_reacted:s.feed.has_user_react})},{default:c(()=>[a(m,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",null,[l("span",h_,d(e.$t("React")),1)])],42,m_),((y=s.feed.meta)==null?void 0:y.comments_disabled)!=="yes"?(n(),r("li",{key:0,class:"fcom_comment_btn_wrap",role:"button",tabindex:"0",onClick:t[3]||(t[3]=I=>i.showCommentForm()),onKeydown:[t[4]||(t[4]=te(q(I=>i.showCommentForm(),["prevent"]),["enter"])),t[5]||(t[5]=te(q(I=>i.showCommentForm(),["prevent"]),["space"]))]},[a(f,null,{default:c(()=>[a(h)]),_:1}),l("span",null,[l("span",f_,d(e.$t("Comment")),1)])],32)):_("",!0)])]),l("div",p_,[s.feed.reactions_count||s.feed.comments_count||((C=s.feed.meta)==null?void 0:C.comments_disabled)==="yes"?(n(),r("ul",g_,[s.feed.reactions_count?(n(),r("li",y_,[a(g,{feed:s.feed},null,8,["feed"])])):_("",!0),s.feed.comments_count>0?(n(),r("li",{key:1,onClick:t[6]||(t[6]=(...I)=>i.maybeShowFeedModal&&i.maybeShowFeedModal(...I)),class:"feed_reaction_meta"},[l("div",v_,d(e.$_n("%d comment","%d comments",s.feed.comments_count)),1)])):((L=s.feed.meta)==null?void 0:L.comments_disabled)==="yes"?(n(),r("li",b_,d(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a(S,{sortBy:o.sortBy,defaultMentions:o.defaultMentions,onForceShowAll:i.showAll,show_all:o.show_all_comments,feed:s.feed,is_single:s.is_single,is_modal:s.is_modal},{before_comments_start:c(()=>[s.feed.comments_count>=2?(n(),r("div",k_,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[7]||(t[7]=I=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[8]||(t[8]=I=>o.sortBy=I),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:c(()=>[a(k,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(k,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(k,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(k,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])],512)):_("",!0)]),_:1},8,["sortBy","defaultMentions","onForceShowAll","show_all","feed","is_single","is_modal"]),o.commenting||s.is_single?(n(),r("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment feed_commentbox_main"},[((V=s.feed.meta)==null?void 0:V.comments_disabled)==="yes"?(n(),r(T,{key:0},[s.feed.comments_count?(n(),r("p",C_,d(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(s.feed)?(n(),r("div",$_,[l("div",S_,[l("img",{alt:"",src:e.auth.photo},null,8,V_)]),o.showCommentBox?(n(),r("div",{key:0,onKeydown:t[10]||(t[10]=te((...I)=>i.maybeSave&&i.maybeSave(...I),["enter"])),class:"feed_comment_input"},[a($,{ref:"composer",context:"comment",is_modal:s.is_modal,config:{multipleMedia:!0},mentionQuery:{space_id:s.feed.space_id},autofocus_changed:o.commenting,defaultMentions:o.defaultMentions,autofocus:o.isAutoFocus,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:c(()=>[a(w,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=I=>i.postComment())},{default:c(()=>[M(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(n(),r("div",M_,[l("p",L_,[M(d(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(n(),r("div",T_,[a(w,{class:"fcom_primary_button",onClick:t[11]||(t[11]=()=>{e.$emit("joinSpace")})},{default:c(()=>[M(d(e.$t("Join Space")),1)]),_:1})])):(n(),r("a",{key:1,href:e.getCurrentAuthUrl()},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,F_))])]))],8,w_)):_("",!0)],64)}const I_=P(d_,[["render",P_]]),E_={name:"SpaceIcon",props:["space_profile"]},A_=["alt","src"],U_={key:1,class:"fcom_emoji"},B_={key:2,class:"fcom_shape"},D_={key:3,class:"fcom_no_avatar"};function R_(e,t,s,u,o,i){var f,h,g,k;const m=j;return s.space_profile.logo?(n(),r("img",{key:0,alt:e.$t("Space Logo"),src:s.space_profile.logo},null,8,A_)):(f=s.space_profile.settings)!=null&&f.emoji?(n(),r("span",U_,d((h=s.space_profile.settings)==null?void 0:h.emoji),1)):(g=s.space_profile.settings)!=null&&g.shape_svg?(n(),r("span",B_,[a(m,{innerHTML:(k=s.space_profile.settings)==null?void 0:k.shape_svg},null,8,["innerHTML"])])):(n(),r("span",D_))}const ze=P(E_,[["render",R_]]);const x_={name:"SingleLineTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},maxlength:{type:Number,default:500},isActive:{type:Boolean,default:!1}},emits:["update:modelValue","enter"],methods:{onInput(e){const t=e.target.value.replace(/\n/g,"");this.$emit("update:modelValue",t),this.$nextTick(this.adjustTextareaHeight)},adjustTextareaHeight(){const e=this.$refs.textarea;e.style.height="auto",e.style.height=e.scrollHeight+"px"}},mounted(){this.adjustTextareaHeight()},watch:{modelValue(){this.$nextTick(this.adjustTextareaHeight)},isActive(e){e&&setTimeout(()=>{this.$refs.textarea.focus()},100)}}},O_=["value","maxlength","placeholder"];function H_(e,t,s,u,o,i){return n(),r("textarea",{value:s.modelValue,onInput:t[0]||(t[0]=(...m)=>i.onInput&&i.onInput(...m)),onKeydown:t[1]||(t[1]=te(q(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:s.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:s.placeholder},null,40,O_)}const j_=P(x_,[["render",H_]]),N_={name:"EyeIcon"},z_={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q_(e,t,s,u,o,i){return n(),r("svg",z_,[...t[0]||(t[0]=[l("path",{d:"M17.9536 9.2035C18.207 9.55877 18.3337 9.7364 18.3337 9.99935C18.3337 10.2623 18.207 10.4399 17.9536 10.7952C16.8152 12.3915 13.908 15.8327 10.0003 15.8327C6.09264 15.8327 3.18541 12.3915 2.04703 10.7952C1.79367 10.4399 1.66699 10.2623 1.66699 9.99935C1.66699 9.7364 1.79367 9.55877 2.04703 9.2035C3.18541 7.60722 6.09264 4.16602 10.0003 4.16602C13.908 4.16602 16.8152 7.60722 17.9536 9.2035Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),l("path",{d:"M12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5C11.3807 12.5 12.5 11.3807 12.5 10Z",stroke:"currentColor","stroke-width":"1.5"},null,-1)])])}const G_=P(N_,[["render",q_]]),Y_={name:"CalendarIcon"},W_={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function K_(e,t,s,u,o,i){return n(),r("svg",W_,[...t[0]||(t[0]=[Le('<path d="M11 1.3335V2.66683M3 1.3335V2.66683" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M6.99766 8.66699H7.00364M6.99766 11.3337H7.00364M9.66134 8.66699H9.66732M4.33398 8.66699H4.33997M4.33398 11.3337H4.33997" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1.33398 5.3335H12.6673" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M0.666992 8.16216C0.666992 5.25729 0.666992 3.80486 1.50174 2.90243C2.33648 2 3.67999 2 6.36699 2H7.63366C10.3207 2 11.6642 2 12.4989 2.90243C13.3337 3.80486 13.3337 5.25729 13.3337 8.16216V8.5045C13.3337 11.4094 13.3337 12.8618 12.4989 13.7642C11.6642 14.6667 10.3207 14.6667 7.63366 14.6667H6.36699C3.67999 14.6667 2.33648 14.6667 1.50174 13.7642C0.666992 12.8618 0.666992 11.4094 0.666992 8.5045V8.16216Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path><path d="M1 5.3335H13" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"></path>',5)])])}const po=P(Y_,[["render",K_]]);const Z_={name:"CreateStatusForm",emits:["updatePost","added"],props:{space:{type:String,default:""},btn_text:{type:String,default:"Post"},editing_feed:{type:Object,default:()=>({title:"",type:"text",message:"",media_image:"",topic_ids:[],send_announcement_email:"no",status:"published"})},defaultState:{type:String,default:"idle"},disableSpace:{type:Boolean,default:!1},default_placeholder:{type:String,default:""},initial_placeholder:{type:String,default:""},disableUpload:{type:Boolean,default:!1},saving:{type:Boolean,default:!1},author:{type:Object,default:()=>({})}},components:{SpaceIcon:ze,FeedTextComposer:ht,SingleLineTextarea:j_,EyeIcon:G_,CalendarIcon:po},data(){return{feed:this.editing_feed,isAutoFocus:!1,state:this.defaultState,posting:!1,doingOembed:!1,oembed:null,postableSpaces:[],autofocus_changed:!1,globalDisabled:this.appVars.features.disable_global_posts,hasPostTitle:this.hasFeature("has_post_title"),scheduleModalVisible:!1,scheduleForm:{date:null,time:null},editorReady:!1}},watch:{"scheduleForm.date":{handler(e){this.scheduleForm.time=null}}},computed:{...Qo(He,["spacesBySlug"]),allSpaces(){return this.space&&this.spacesBySlug[this.space]?{...this.appVars.auth.spaces,[this.space]:this.spacesBySlug[this.space]}:this.appVars.auth.spaces},isEditing(){var e;return(e=this.editing_feed)==null?void 0:e.id},isScheduleDisabled(){return!this.scheduleForm.date||!this.scheduleForm.time},showScheduleInfo(){return this.feed.scheduled_at&&!this.isEditing},showScheduleIcon(){return(this.isAdmin()||this.isCurrentSpaceAdmin)&&!this.isEditing&&this.has_pro},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getPlaceholder(){const e=this.appVars.topicsConfig.max_topics_per_post;return this.isTopicRequired?this.$_n("Select a topic","Choose up to %s topics",e):this.$_n("Select a topic","Choose up to %s topics (optional)",e)},getButtonLabel(){return this.feed.scheduled_at&&!this.isEditing?this.$t("Schedule"):this.btn_text},getScheduleLabel(){return this.$t("Scheduled for %1$s at %2$s",this.formattedDate(this.feed.scheduled_at),this.formattedTime(this.feed.scheduled_at))},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u},getPostTitle(){return this.isEditing?this.author.name||"":this.$t("Create Post")},canPost(){var e,t;return this.space?(t=(e=this.allSpaces[this.space])==null?void 0:e.permissions)==null?void 0:t.can_create_post:this.appVars.auth.user_id},isTopicRequired(){var e,t;return this.currentSpaceSlug?((t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.settings)==null?void 0:t.topic_required)=="yes":!1},isStateActive(){return this.state=="active"},isCurrentSpaceAdmin(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.community_moderator:!1},isCommunityAdmin(){return this.isAdmin()},currentPlaceHolder(){return this.isStateActive?this.default_placeholder?this.default_placeholder:this.$t("Write something here..."):this.initial_placeholder?this.initial_placeholder:this.$t("What's happening, %s",this.auth.first_name)},currentTopics(){var s;let e=this.currentSpaceSlug;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},canUploadDoc(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.can_upload_documents:!1},currentSpaceSlug(){if(this.space)return this.space;let e=this.feed.space;return e&&typeof e=="object"?e==null?void 0:e.slug:e},currentSpaceId(){var e;return this.currentSpaceSlug?(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.id:null},feedContext(){const e=this.space||this.currentSpaceSlug;return e&&e!=="__self__post__"?`space-${e}`:"global"}},methods:{...js(Me,["createFeed"]),changeAutoFocus(){this.feed.title=this.feed.title.replace(/\n/g,""),this.updateAutofocus()},updateAutofocus(){this.autofocus_changed=!1,setTimeout(()=>{this.autofocus_changed=!0},100)},openScheduleModal(){this.scheduleModalVisible=!0},makeActive(){this.editorReady=!0,this.$nextTick(()=>{this.prepareData(),this.state="active",this.hasPostTitle||this.updateAutofocus()})},cancelPost(){this.state="idle",this.postableSpaces=[]},cancelSchedule(){this.scheduleModalVisible=!1,this.scheduleForm.date=null,this.scheduleForm.time=null,this.feed.scheduled_at=null},previewPost(){const e={...this.feed,space:this.space||this.feed.space,is_editing:this.isEditing,author:this.author};this.$eventBus.emit("showPreviewPostModal",e)},initFeed(){return{type:"text",message:"",media_image:"",topic_ids:[],scheduled_at:null,send_announcement_email:"no",status:"published"}},schedulePost(){if(this.scheduleModalVisible=!1,!this.scheduleForm.date||!this.scheduleForm.time){this.feed.scheduled_at=null;return}const e=this.convertTo24Hour(this.scheduleForm.time);this.feed.scheduled_at=`${this.scheduleForm.date} ${e}:00`},post(){if(!this.isStateActive)return;if(this.feed.id){this.$emit("updatePost",this.feed);return}const e=this.feed;if(this.space&&(e.space=this.space),!e.space){this.$refs.fcom_posting_space.classList.add("fcon_shake"),setTimeout(()=>{this.$refs.fcom_posting_space.classList.remove("fcon_shake")},500),this.$notify({title:this.$t("Error"),message:this.$t("Please select a space to post in."),type:"error"});return}if(e.space!="__self__post__"&&e.send_announcement_email=="yes"){let t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space after 5 minutes of this post");e.scheduled_at&&(t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space. The email will be sent at the scheduled time.")),this.$confirm(t,this.$t("Sending email to all members?"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.postStatus(e)}).catch(()=>{this.feed.send_announcement_email="no",this.state="active",this.$notify({title:this.$t("Cancelled"),message:this.$t("You have cancelled the action."),type:"info"})})}else this.postStatus(e)},feedSpaceChanged(){this.$refs.fcom_posting_space_select.blur(),this.feed.topic_ids=""},goToCreatedFeed(e){if(!(e!=null&&e.slug))return;if(this.hasFeature("show_post_modal")){this.$eventBus.emit("showFeedModal",{feed:e});return}const t=e.space?{name:"space_feed",params:{feed_slug:e.slug,space:e.space.slug}}:{name:"single_feed",params:{feed_slug:e.slug}};this.$router.push(t)},async postStatus(e){var t,s;this.posting=!0;try{const o=await Me().createFeed(this.feedContext,e);if(o.scheduled_at||(this.$notify.success(o.message),this.$emit("added",o.feed),((t=o.feed)==null?void 0:t.status)==="unlisted"?this.goToCreatedFeed(o.feed):this.$nextTick(()=>{const i=document.getElementById("feed_id_"+o.feed.id);i&&(i.classList.add("fcom_highlight_glow"),setTimeout(()=>{i.classList.remove("fcom_highlight_glow")},4500))})),this.feed=this.initFeed(),this.state="idle",o.scheduled_at){const i=this.formattedDateTime(o.scheduled_at);this.$notify.success(this.$t("Your post has been scheduled for %s. Please find the scheduled post from your profile",i))}this.editorReady=!1}catch(u){this.$handleError(u),(s=u==null?void 0:u.shakes)!=null&&s.topic_ids&&(this.$refs.fcom_topics_input.classList.add("fcon_shake"),setTimeout(()=>{this.$refs.fcom_topics_input.classList.remove("fcon_shake")},500))}finally{this.posting=!1}},prepareData(){var m;if(this.space)return[];let e=Object.values(this.allSpaces),t=this.appVars.space_groups,s=[],u=[];this.each(t,f=>{let h=e.filter(g=>{let k=g.parent_id==f.id&&g.permissions&&g.permissions.can_create_post;return k&&u.push(g.slug),k});h.length&&s.push({label:f.title,spaces:h})});let o=e.filter(f=>!f.parent_id&&f.permissions&&f.permissions.can_create_post);o&&o.length&&s.push({label:this.$t("Others"),spaces:o}),this.globalDisabled||s.unshift({label:"",spaces:[{title:this.$t("On my profile"),slug:"__self__post__"}]}),this.postableSpaces=s;const i=this.appVars.default_post_space;!this.feed.space&&i&&["all_feeds","user_profile_feeds"].includes((m=this.$route)==null?void 0:m.name)&&this.postableSpaces.some(f=>f.spaces.some(h=>h.slug===i))&&(this.feed.space=i)}},mounted(){(this.editing_feed.id||this.defaultState=="active")&&(this.editorReady=!0)}},J_={class:"person_avatar"},Q_=["alt","src"],X_={class:"create_header_content"},em={key:0,class:"fcom_create_status_box_header"},tm={class:"user_infos"},sm={class:"feed_user_name"},om={class:"feed_meta_info"},im={key:1,class:"feed_timestamp"},nm={class:"create_header_action"},lm={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},am={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},rm={key:0,class:"fcom_meta_text"},cm={class:"fcom_post_actions"},dm={key:0,class:"fcom_post_space_name"},um={class:"target_label"},_m={ref:"fcom_posting_space",style:{"margin-right":"10px"}},mm={key:0,class:"fcom_space_title"},hm={key:1},fm={class:"fcom_empty_spaces_dropdown"},pm={key:0,class:"fcom_composer_admin_actions"},gm={key:0},ym={class:"dialog_header"},vm={class:"dialog_left schedule_header_left"},bm={class:"dialog_body"},km={class:"fcom_input_help"},wm={class:"dialog_footer"};function Cm(e,t,s,u,o,i){const m=p("EditPen"),f=j,h=p("CalendarIcon"),g=O,k=p("EyeIcon"),b=p("Close"),S=p("SingleLineTextarea"),w=ae,$=re,y=p("SpaceIcon"),C=Wt,L=ve,V=p("feed-text-composer"),I=Ye,F=pe,R=Es,B=ge,U=ke;return i.canPost?(n(),r("div",{key:0,class:D([{state_active:i.isStateActive},"create_status_holder"])},[l("div",{class:D(["create_header",{state_active:i.isStateActive}])},[l("div",J_,[l("img",{alt:s.author.name||e.$t("Your Photo"),src:s.author.avatar||e.auth.avatar},null,8,Q_)]),l("div",X_,[i.isStateActive?_("",!0):(n(),r("div",{key:0,onClick:t[0]||(t[0]=(...A)=>i.makeActive&&i.makeActive(...A)),class:"form_placeholder"},d(i.currentPlaceHolder),1)),l("div",{class:D([{fcom_editor_with_title:o.hasPostTitle,"is-active":i.isStateActive},"fcom_create_status_box"])},[i.isStateActive?(n(),r("div",em,[l("div",tm,[l("div",sm,d(i.getPostTitle),1),l("div",om,[!s.editing_feed.id&&i.showScheduleInfo?(n(),r("div",{key:0,onClick:t[1]||(t[1]=(...A)=>i.openScheduleModal&&i.openScheduleModal(...A)),class:"feed_scheduled_info"},[l("span",null,d(i.getScheduleLabel),1),a(f,null,{default:c(()=>[a(m)]),_:1})])):(n(),r("span",im,d(s.editing_feed.id?e.humanDateDiff(s.editing_feed.created_at):e.dayjs().format(e.siteDateTimeFormat)),1))])]),l("div",nm,[i.showScheduleIcon?(n(),v(g,{key:0,"aria-label":e.$t("Schedule post"),onClick:i.openScheduleModal,text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),a(g,{"aria-label":e.$t("Preview"),onClick:i.previewPost,text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(k)]),_:1})]),_:1},8,["aria-label","onClick"]),i.isEditing?_("",!0):(n(),v(g,{key:1,"aria-label":e.$t("Close"),class:"close_btn",onClick:i.cancelPost,text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(b)]),_:1})]),_:1},8,["aria-label","onClick"]))])])):_("",!0),o.editorReady?(n(),v(V,{key:1,context:"feed",placeholder:i.currentPlaceHolder,config:{surveyApp:!0,space_id:i.currentSpaceId,is_admin:i.isCurrentSpaceAdmin||i.isCommunityAdmin,spaceSlug:i.currentSpaceSlug,disableUpload:s.disableUpload,multipleMedia:!0,documentsApp:i.canUploadDoc,videoApp:!0},autofocus:o.isAutoFocus||!o.hasPostTitle,onEditorCreated:t[9]||(t[9]=()=>{o.isAutoFocus=!0}),mentionQuery:i.currentSpaceSlug&&i.currentSpaceSlug!=="__self__post__"?{space:i.currentSpaceSlug}:{},disabled:o.posting,autofocus_changed:o.autofocus_changed,is_editing:!!i.isEditing,content:o.feed},{before_input:c(()=>[o.hasPostTitle?(n(),v(S,{key:0,maxlength:120,autofocus:!0,isActive:i.isStateActive,modelValue:o.feed.title,"onUpdate:modelValue":t[2]||(t[2]=A=>o.feed.title=A),onEnter:t[3]||(t[3]=A=>i.changeAutoFocus()),placeholder:o.hasPostTitle=="required"?e.$t("Short title of this post"):e.$t("Title (optional)")},null,8,["isActive","modelValue","placeholder"])):_("",!0)]),before_composer_footer:c(()=>[K(e.$slots,"before_footer")]),after_input:c(()=>[e.has_pro&&i.currentTopics.length?(n(),r("div",lm,[a($,{"popper-class":"fcom_topics_select","multiple-limit":e.appVars.topicsConfig.max_topics_per_post,modelValue:o.feed.topic_ids,"onUpdate:modelValue":t[4]||(t[4]=A=>o.feed.topic_ids=A),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:i.getPlaceholder},{default:c(()=>[(n(!0),r(T,null,x(i.currentTopics,A=>(n(),v(w,{key:A.slug,label:A.title,value:A.id},{default:c(()=>[l("span",am,d(A.title),1),A.description?(n(),r("span",rm,d(A.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["multiple-limit","modelValue","multiple","placeholder"])],512)):_("",!0)]),after_composer_footer:c(()=>[e.hasFeature("mention_mail")&&i.isCurrentSpaceAdmin&&o.feed.send_announcement_email?(n(),r("div",pm,[a(L,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=A=>o.feed.send_announcement_email=A),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(n(),r("span",gm,"("+d(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:c(()=>[l("div",cm,[s.space&&i.isStateActive?(n(),r("div",dm,[l("span",null,"#"+d(s.space),1)])):_("",!0),!s.space&&!s.disableSpace?(n(),r(T,{key:1},[l("span",um,d(e.$t("Posting in:")),1),l("span",_m,[a($,{modelValue:o.feed.space,"onUpdate:modelValue":t[5]||(t[5]=A=>o.feed.space=A),style:{width:"170px"},ref:"fcom_posting_space_select",class:"fcom_minimal_select","popper-class":"fcom_posting_space_select",placeholder:e.$t("Select Space"),onChange:t[6]||(t[6]=A=>i.feedSpaceChanged())},{empty:c(()=>[l("p",fm,d(Object.keys(i.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:c(()=>[(n(!0),r(T,null,x(o.postableSpaces,A=>(n(),v(C,{key:A.label,label:A.label},{default:c(()=>[(n(!0),r(T,null,x(A.spaces,N=>(n(),v(w,{key:N.slug,label:N.title,value:N.slug},{default:c(()=>[N.id?(n(),r("span",mm,[a(y,{space_profile:N},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(N.title,30)),1)])):(n(),r("span",hm,d(e.getExcerpt(N.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),K(e.$slots,"before_submit_btn"),a(g,{onClick:t[7]||(t[7]=A=>i.post()),disabled:o.posting||i.isEditing&&s.saving,loading:i.isEditing?s.saving:o.posting,class:D(["fcom_primary_button",{fcom_update_button:i.isEditing}])},{default:c(()=>[M(d(i.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),K(e.$slots,"after_composer")],2)])],2),a(U,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=A=>o.scheduleModalVisible=A),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:c(()=>[l("div",ym,[l("div",vm,[l("h4",null,d(e.$t("Schedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:c(()=>[l("div",wm,[a(g,{class:"fcom_secondary_button",onClick:i.cancelSchedule},{default:c(()=>[M(d(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(g,{class:"fcom_primary_button",disabled:i.isScheduleDisabled,onClick:i.schedulePost},{default:c(()=>[M(d(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:c(()=>[l("div",bm,[a(B,{"label-position":"top",class:"fcom_schedule_form"},{default:c(()=>[a(F,{label:e.$t("Date")},{default:c(()=>[a(I,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=A=>o.scheduleForm.date=A),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(F,{label:e.$t("Time")},{default:c(()=>[a(R,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=A=>o.scheduleForm.time=A),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1}),a(F,null,{default:c(()=>[l("p",km,d(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const It=P(Z_,[["render",Cm]]),$m={name:"EditFeed",components:{SpaceIcon:ze,CreateStatusForm:It},data(){return{loading:!1,saving:!1,localDialogVisible:this.dialogVisible,feed:{},autofocus_changed:!1,hasPostTitle:this.hasFeature("has_post_title"),changeSpace:!1,newSpaceId:null,makeUnlisted:!1}},props:{dialogVisible:{type:Boolean,required:!0},feedSlug:{type:String,required:!0},hide_create_form:{type:Boolean,default:!1},author:{type:Object,default:()=>({})}},computed:{canMovePost(){return this.has_pro&&this.hasSpaceModeratorAccess(this.feed.space)},profileOptionLabel(){return this.auth&&this.feed.user_id&&this.auth.user_id==this.feed.user_id?this.$t("On my profile"):this.$t("On author's profile")}},methods:{getFeed(){this.loading=!0,this.$get("feeds/"+this.feedSlug+"/by-slug",{context:"edit"}).then(e=>{this.feed=e.feed,this.makeUnlisted=e.feed.status==="unlisted"}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleUpdatePost(e){var s;let t={id:e.id,title:e.title,message:e.message,space:(s=e==null?void 0:e.space)==null?void 0:s.slug,meta:e.meta,content_type:e.content_type,document_ids:e.document_ids,media:e.media,media_images:e.media_images,survey:e.survey,topic_ids:e.topic_ids,send_announcement_email:e.send_announcement_email};this.changeSpace&&this.newSpaceId&&(this.newSpaceId==="profile"?t.move_to_profile=1:t.new_space_id=this.newSpaceId),["published","unlisted"].includes(this.feed.status)&&(t.status=this.makeUnlisted?"unlisted":"published"),this.saving=!0,this.$post(`feeds/${e.id}`,t).then(u=>{this.$notify.success(u.message),this.$emit("updated",u.feed),this.handleClose()}).catch(u=>{this.$handleError(u)}).finally(()=>{this.saving=!1})},handleClose(){this.localDialogVisible=!1,this.$emit("close")}},mounted(){this.getFeed()}},Sm={class:"fcom_feed_edit"},Vm={class:"fcom_feed_edit_dialog_header"},Mm={key:0,class:"fcom_feed_edit_dialog_body"},Lm={key:0},Tm={key:0,style:{"margin-top":"5px"}},Fm={class:"fcom_space_title"};function Pm(e,t,s,u,o,i){const m=p("Close"),f=j,h=ve,g=ae,k=p("SpaceIcon"),b=re,S=Ie,w=p("create-status-form"),$=J,y=ke,C=se("loading");return n(),r("div",Sm,[a(y,{class:"fcom_feed_edit_dialog",modelValue:o.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=L=>o.localDialogVisible=L),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:c(()=>{var L,V;return[Y((n(),r("div",null,[l("div",Vm,[l("span",null,d(e.$t("Edit Feed")),1),a(f,{onClick:i.handleClose},{default:c(()=>[a(m)]),_:1},8,["onClick"])]),o.feed.id?(n(),r("div",Mm,[!(s.hide_create_form&&e.auth.user_id)||e.canEditFeed(o.feed)?(n(),v(w,{key:0,"default-state":"active",btn_text:e.$t("Update"),editing_feed:o.feed,author:s.author,onUpdatePost:i.handleUpdatePost,saving:o.saving,disableSpace:!0,space:(V=(L=o.feed)==null?void 0:L.space)==null?void 0:V.slug},{after_composer:c(()=>[i.canMovePost?(n(),r("div",Lm,[a(h,{modelValue:o.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=I=>o.changeSpace=I),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),o.changeSpace?(n(),r("div",Tm,[a(b,{modelValue:o.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=I=>o.newSpaceId=I),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:c(()=>[a(g,{value:"profile",label:i.profileOptionLabel,disabled:!o.feed.space_id},{default:c(()=>[l("span",null,d(i.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(n(!0),r(T,null,x(e.appVars.auth.spaces,I=>(n(),v(g,{disabled:o.feed.space_id==I.id,key:I.id,label:I.title,value:I.id},{default:c(()=>[l("span",Fm,[a(k,{space_profile:I},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(I.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:c(()=>[e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(o.feed.status)?(n(),v(S,{key:0,content:e.$t("Hidden from all feeds and listings. Only reachable by its direct link."),placement:"top"},{default:c(()=>[a(h,{modelValue:o.makeUnlisted,"onUpdate:modelValue":t[2]||(t[2]=I=>o.makeUnlisted=I),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Make unlisted")),1)]),_:1},8,["modelValue"])]),_:1},8,["content"])):_("",!0)]),_:1},8,["btn_text","editing_feed","author","onUpdatePost","saving","space"])):_("",!0)])):(n(),v($,{key:1,rows:5,animated:!0}))])),[[C,o.loading]])]}),_:1},8,["modelValue","width"])])}const ls=P($m,[["render",Pm]]),Im={name:"Avatar",props:{xprofile:{default:()=>({})},with_level:{type:Boolean,default(){return!0}},is_rounded:{type:Boolean,default(){return!0}},with_completion:{type:Boolean,default(){return!1}},is_online:{type:Boolean,default(){return!1}}},computed:{level(){if(!this.with_level||!this.has_leaderboard)return"";const e=Ae(this.xprofile.total_points);return e?e.level:0},withCompletion(){var s;if(!this.with_completion||!((s=this.xprofile)!=null&&s.total_points))return!1;const e=Ae(this.xprofile.total_points),t=Ae(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Ae(this.xprofile.total_points),t=Ae(e.max_points+1),s=this.xprofile.total_points-e.min_points,u=t.min_points-e.min_points,i=s/u*100/100*360;return{backgroundImage:`conic-gradient(rgb(56, 117, 223) ${i}deg, #D9D9D9 ${i}deg)`}}},methods:{setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}}},Em=["src"],Am={key:1,class:"fcom_no_image"},Um=["aria-label"];function Bm(e,t,s,u,o,i){return n(),r("div",{class:D([{fcom_avatar_is_rounded:s.is_rounded,is_member_online:s.is_online},"fcom_user_avatar"])},[l("span",{style:me(i.getOutlineStyle),class:D({fcom_compilation_avatar:i.withCompletion})},[s.xprofile?(n(),r("img",{key:0,onError:t[0]||(t[0]=(...m)=>i.setAltImg&&i.setAltImg(...m)),src:s.xprofile.avatar,alt:""},null,40,Em)):(n(),r("span",Am))],6),i.level||s.is_online?(n(),r("div",{key:0,role:"region","aria-label":e.$t("User Level"),class:"fcom_user_level_mark"},[l("span",null,d(i.level),1)],8,Um)):_("",!0)],2)}const as=P(Im,[["render",Bm]]),Dm={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Te,UserAvatar:as},data(){return{voters:[],loading:!1,showVotersDialog:!0,cache:{},requestId:0}},watch:{option(){this.loadVoters()}},computed:{getVotePercentage(){return this.option.vote_counts?Math.floor(this.option.vote_counts/this.totalCount*100)+"%":"0%"}},methods:{switchOption(e){this.$emit("updateOption",e)},closeDialog(){this.showVotersDialog=!1,this.$emit("close")},loadVoters(){var u;const e=(u=this.option)==null?void 0:u.slug;if(!e)return;const t=++this.requestId,s=this.cache[e];s&&(this.voters=s),this.loading=!s,this.$get(`feeds/${this.feed.id}/apps/survey-voters/${e}`).then(({voters:o})=>{this.cache[e]=o,t===this.requestId&&(this.voters=o)}).catch(o=>{s||this.$handleError(o)}).finally(()=>{t===this.requestId&&(this.loading=!1)})}},mounted(){this.loadVoters()}},Rm={class:"dialog_header"},xm={class:"fcom_filter_menu"},Om={class:"fcom_filter_menu_ul"},Hm=["onClick"],jm={key:1},Nm={class:"feed_meta_info survey_voters_meta"},zm={class:"meta_line"},qm={class:"meta_line"},Gm={class:"voters_list"},Ym={class:"voter_avatar"},Wm={class:"voter_info"},Km=["title"],Zm={key:2,class:"not_found"};function Jm(e,t,s,u,o,i){const m=J,f=p("UserAvatar"),h=p("UserRouteLink"),g=Pe,k=ke;return n(),v(k,{modelValue:o.showVotersDialog,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVotersDialog=b),"modal-class":"fcom_common_dialog menu_dialog","close-on-click-modal":!0,"append-to-body":!0,width:e.dialogWidth,style:{"max-width":"800px"},direction:"rtl",onClose:i.closeDialog},{header:c(({close:b})=>[l("div",Rm,[l("div",xm,[l("ul",Om,[(n(!0),r(T,null,x(s.options,S=>(n(),r("li",{key:S.slug},[l("a",{onClick:q(w=>i.switchOption(S.slug),["prevent"]),class:D({"router-link-exact-active":s.option.slug==S.slug}),href:"#"},d(S.label),11,Hm)]))),128))])])])]),default:c(()=>[o.loading?(n(),v(m,{key:0,animated:"",rows:4})):o.voters.length?(n(),r("div",jm,[l("div",Nm,[l("span",zm,d(i.getVotePercentage),1),l("span",qm,d(e.$_n("%s Vote","%s Votes",s.option.vote_counts)),1)]),a(g,{"max-height":"800px"},{default:c(()=>[l("div",Gm,[(n(!0),r(T,null,x(o.voters,b=>(n(),r("div",{key:b.id,class:"voter_item"},[b.xprofile?(n(),r(T,{key:0},[l("div",Ym,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",Wm,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(n(),r("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},d(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,Km)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(n(),r("div",Zm,[l("p",null,d(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const Qm=P(Dm,[["render",Jm]]),Xm={name:"SurveyRenderer",props:{feed:{type:Object,required:!0},is_preview:{type:Boolean,default:!1},hasTopMedia:{type:Boolean,default:!1},isChildFeed:{type:Boolean,default:!1}},components:{SurveyVoters:Qm},data(){var e,t;return{inputType:(t=(e=this.feed.meta)==null?void 0:e.survey_config)==null?void 0:t.type,formattedOptions:[],working:!1,totalCount:0,showVotersDialog:!1,selectedOption:null,endingDate:null}},watch:{"feed.meta.survey_config":{handler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&(this.inputType=t.type,this.setupData())},deep:!0}},computed:{isEnded(){return this.endingDate&&this.isPastDate(this.endingDate)},endedDateLabel(){return this.$t("ended %s",this.humanDateDiff(this.endingDate))},endingDateLabel(){return this.$t("ending %s",this.humanDateDiff(this.endingDate))},shouldHideBorder(){var e,t;return!this.hasTopMedia&&(((e=this.feed.meta)==null?void 0:e.media_items)||((t=this.feed.meta)==null?void 0:t.media_preview))||this.isChildFeed}},methods:{getVoteStyle(e){const t=e?e/this.totalCount*100:0,s={width:t+"%"};return t>0&&t<100&&(s["border-top-right-radius"]=0,s["border-bottom-right-radius"]=0),s},showVoters(e){this.selectedOption=e,this.showVotersDialog=!0},updateOption(e){this.selectedOption=this.formattedOptions.find(t=>t.slug===e)},toggleVote(e){if(this.isEnded){this.$notify.error(this.$t("This poll has ended."));return}if(this.showVotersDialog)return;let t=this.formattedOptions[e].voted;this.inputType=="single_choice"&&this.each(this.formattedOptions,s=>{s.voted=!1}),this.formattedOptions[e].voted=!t,this.syncVotes()},syncVotes(){if(this.is_preview)return;let e=[];this.each(this.formattedOptions,t=>{t.voted&&e.push(t.slug)}),this.working=!0,this.$post(`feeds/${this.feed.id}/apps/survey-vote`,{vote_indexes:e}).then(t=>{this.feed.meta.survey_config=t.survey_config,this.setupData()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.working=!1})},setupData(){let e=[],t=0;this.feed.meta.survey_config&&(this.each(this.feed.meta.survey_config.options,s=>{e.push(s),s.vote_counts&&(t+=parseInt(s.vote_counts))}),this.formattedOptions=e,this.totalCount=t,this.endingDate=this.feed.meta.survey_config.end_date)}},mounted(){this.setupData()}},eh={class:"fcom_app_options"},th=["onClick"],sh={class:"fcom_app_text"},oh={class:"fcom_app_input_wrap"},ih={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},nh={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},lh=["onClick"],ah={key:0},rh={class:"feed_meta_info"},ch={key:0,class:"meta_line"},dh=["title"],uh=["title"];function _h(e,t,s,u,o,i){const m=p("ArrowRight"),f=j,h=p("SurveyVoters");return n(),r(T,null,[l("div",{class:D(["fcom_app_render",{"no-border":i.shouldHideBorder}])},[l("div",eh,[(n(!0),r(T,null,x(o.formattedOptions,(g,k)=>(n(),r("div",{key:g.slug,onClick:b=>i.toggleVote(k),class:D([g.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",sh,[l("span",oh,[l("span",{class:D("fcom_input_"+o.inputType)},[o.inputType=="single_choice"?(n(),r("svg",ih,[...t[1]||(t[1]=[l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1)])])):(n(),r("svg",nh,[...t[2]||(t[2]=[l("path",{fill:"currentColor",d:"M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"},null,-1)])]))],2)]),l("span",null,d(g.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>i.showVoters(g)},[M(d(g.vote_counts?Math.floor(g.vote_counts/o.totalCount*100)+"%":"")+" ",1),g.vote_counts?(n(),r("span",ah,"("+d(g.vote_counts)+")",1)):_("",!0),g.vote_counts?(n(),v(f,{key:1,class:"fcom_arrow_icon"},{default:c(()=>[a(m)]),_:1})):_("",!0)],8,lh),o.totalCount?(n(),r("span",{key:0,style:me(i.getVoteStyle(g.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,th))),128))]),l("div",rh,[o.totalCount?(n(),r("span",ch,d(e.$_n("%d vote","%d votes",o.totalCount)),1)):_("",!0),o.endingDate?(n(),r(T,{key:1},[i.isEnded?(n(),r("span",{key:0,title:e.$t("Ended at: %s",o.endingDate),class:"meta_line"},d(i.endedDateLabel),9,dh)):(n(),r("span",{key:1,title:e.$t("Will end at: %s",o.endingDate),class:"meta_line"},d(i.endingDateLabel),9,uh))],64)):_("",!0)])],2),o.showVotersDialog?(n(),v(h,{key:0,feed:s.feed,option:o.selectedOption,options:o.formattedOptions,totalCount:o.totalCount,onUpdateOption:i.updateOption,onClose:t[0]||(t[0]=g=>o.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const go=P(Xm,[["render",_h]]),mh={name:"BookmarkIcon",props:["is_active"]},hh={key:0,style:{color:"#1d9bf0"},class:"bookmark_icon_active",width:"16",height:"20",viewBox:"0 0 16 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},fh={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ph(e,t,s,u,o,i){return s.is_active?(n(),r("svg",hh,[...t[0]||(t[0]=[l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(n(),r("svg",fh,[...t[1]||(t[1]=[l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))}const yo=P(mh,[["render",ph]]);const gh={name:"RenderChildPost",components:{ImageCarousel:Mt,SurveyRenderer:go,DocumentLists:tt,UserRouteLink:Te,MediaPreview:xe,FeedMdContent:Tt},props:["feed_id"],data(){return{feed:null,loading:!1,notFound:null,in_space:this.$route.params.space,hasOverflowContent:!1}},computed:{hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern"||!this.feed)return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},feedClasses(){if(!this.feed)return[];let e=["feed_single"];return e.push("feed_type_"+this.feed.type),this.hasTopMedia&&e.push("feed_modern_layout"),e}},methods:{getFeed(){this.loading=!0,this.$get("feeds/"+this.feed_id+"/by-id").then(e=>{this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),this.$nextTick(()=>{this.setOverFlow()})}).catch(e=>{typeof e=="object"&&e.xhr_status==404?this.notFound=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},handleFeedClick(e){e.preventDefault()&&e.stopPropagation();let t={name:"single_feed",params:{feed_slug:this.feed.slug}};this.feed.space&&(t={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),this.$router.push(t)},setOverFlow(){let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},mounted(){this.getFeed()}},yh=["id"],vh={key:0,class:"fcom_top_media"},bh={class:"fcom_feed_header_wrap"},kh={class:"feed_header"},wh={key:0,class:"feed_user"},Ch={class:"feed_user_name"},$h={class:"feed_meta_info"},Sh={key:0,class:"meta_line"},Vh=["title","href"],Mh={key:1,class:"feed_timestamp"},Lh={key:0,class:"feed_title"},Th={class:"feed_title_heading"},Fh={key:1,class:"expand-button"};function Ph(e,t,s,u,o,i){var $,y,C,L,V,I,F,R,B,U,A;const m=p("media-preview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=p("FeedMdContent"),k=O,b=p("DocumentLists"),S=p("SurveyRenderer"),w=p("ImageCarousel");return o.feed?(n(),r("div",{key:0,onClick:t[0]||(t[0]=(...N)=>i.handleFeedClick&&i.handleFeedClick(...N)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+o.feed.id,class:D([i.feedClasses,"feed"])},[i.hasTopMedia?(n(),r("div",vh,[o.feed.meta&&o.feed.meta.media_preview?(n(),v(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",bh,[l("div",kh,[o.feed.xprofile?(n(),r("div",wh,[a(f,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",Ch,[a(h,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",$h,[o.feed.content_type=="survey"&&((L=(C=(y=($=o.feed)==null?void 0:$.meta)==null?void 0:y.survey_config)==null?void 0:C.options)!=null&&L.length)?(n(),r("span",Sh,d(e.$t("created a poll")),1)):_("",!0),l("a",{title:o.feed.created_at,href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,Vh),!o.in_space&&o.feed.space?(n(),r("span",Mh,d(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:D([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[o.feed.title?(n(),r("div",Lh,[l("h2",Th,d(o.feed.title),1)])):_("",!0),a(g,{class_name:"feed_texts",content:o.feed.message_rendered},null,8,["content"]),o.hasOverflowContent?(n(),r("div",Fh,[a(k,{class:"btn_expand"},{default:c(()=>[M(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="document"?(n(),v(b,{key:1,document_lists:((I=(V=o.feed)==null?void 0:V.meta)==null?void 0:I.document_lists)||[]},null,8,["document_lists"])):(n(),r(T,{key:2},[o.feed.content_type=="survey"&&((U=(B=(R=(F=o.feed)==null?void 0:F.meta)==null?void 0:R.survey_config)==null?void 0:B.options)!=null&&U.length)?(n(),v(S,{key:0,feed:o.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),o.feed.meta?(n(),r(T,{key:1},[o.feed.meta.media_items?(n(),v(w,{key:0,feed:o.feed},null,8,["feed"])):!i.hasTopMedia&&(o.feed.meta.media_preview||(A=o.feed.meta.audio_medias)!=null&&A.length)?(n(),v(m,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,yh)])):_("",!0)}const Ih=P(gh,[["render",Ph]]),Eh={name:"CustomAppMeta",components:{RenderChildPost:Ih},props:{feed:{type:Object,required:!0}}},Ah={ref:"fcom_custom_app"},Uh={key:0},Bh=["innerHTML"];function Dh(e,t,s,u,o,i){const m=p("RenderChildPost");return n(),r("div",Ah,[s.feed.meta.custom_app_preview.app_name=="child_post"&&s.feed.meta.custom_app_preview.feed_id?(n(),r("div",Uh,[a(m,{feed_id:s.feed.meta.custom_app_preview.feed_id},null,8,["feed_id"])])):s.feed.meta.custom_app_preview.custom_html?(n(),r("div",{key:1,innerHTML:s.feed.meta.custom_app_preview.custom_html},null,8,Bh)):_("",!0)],512)}const Rh=P(Eh,[["render",Dh]]),xh={name:"FeedAction",components:{EditFeed:ls},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],data(){return{isEdit:!1,working:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReportOption(){var t,s;return!(((t=this.feed)==null?void 0:t.user_id)==((s=this.auth)==null?void 0:s.user_id))&&this.auth.user_id&&this.isReportEnabled}},methods:{editItem(){this.$refs.popover.hide(),this.isEdit=!0},handleUpdate(e){this.$emit("updated",e);const t=document.getElementById("feed_id_"+e.id);t&&(t.classList.add("fcom_highlight_glow"),setTimeout(()=>{t.classList.remove("fcom_highlight_glow")},4500))},reportPost(){this.$refs.popover.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:this.feed,type:"post"})},copyFeedLink(){navigator.clipboard.writeText(this.feed.permalink).then(()=>{this.$notify.success(this.$t("Link copied to clipboard")),this.$refs.popover.hide()}).catch(e=>{this.$notify.error(this.$t("Failed to copy"))})},toggleSticky(){!this.feed.space_id||this.working||(this.working=!0,this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleSidebarPin(){!this.feed.space_id||this.working||(this.$refs.popover.hide(),this.working=!0,this.feed.priority=!this.feed.priority,this.$patch("feeds/"+this.feed.id,{priority:this.feed.priority?1:0}).then(e=>{this.$notify.success(e.feed.priority?this.$t("Pinned to sidebar"):this.$t("Unpinned from sidebar")),this.feed.priority=e.feed.priority,this.$eventBus.emit("updateSpaceSidebar",this.feed.space_id)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleUnlist(){if(this.working)return;const e=this.feed.status!=="unlisted";this.$refs.popover.hide(),this.working=!0,this.$patch("feeds/"+this.feed.id,{status:e?"unlisted":"published"}).then(t=>{this.feed.status=t.feed.status,this.$notify.success(t.feed.status==="unlisted"?this.$t("Post has been unlisted."):this.$t("Post has been listed.")),this.$emit("updated",t.feed)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.working=!1})},toggleCommentStatus(){var t;if(this.working)return;let e=((t=this.feed.meta)==null?void 0:t.comments_disabled)=="yes";this.$refs.popover.hide(),this.working=!0,this.$patch("feeds/"+this.feed.id,{comments_disabled:e?0:1}).then(s=>{var o;let u=((o=s.feed.meta)==null?void 0:o.comments_disabled)=="yes";this.$notify.success(u?this.$t("Comments have been disabled."):this.$t("Comments have been enabled.")),this.feed.meta.comments_disabled=s.feed.meta.comments_disabled}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})},removePreview(){this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to remove the preview image? This action cannot be undone."),this.$t("Remove Preview"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.feed.id+"/media-preview").then(e=>{this.feed.meta.media_preview=null}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})}).catch(()=>{})},deleteItem(){this.working||(this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working||(this.working=!0,this.$emit("deleted"),this.working=!1)}).catch(()=>{}))}}},Oh={class:"actions_items"},Hh={key:0},jh={key:1},Nh={key:0},zh={key:1},qh={key:0},Gh={key:1},Yh={key:0},Wh={key:1};function Kh(e,t,s,u,o,i){var b,S;const m=p("MoreFilled"),f=j,h=O,g=fe,k=p("EditFeed");return n(),r(T,null,[a(g,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav"},{reference:c(()=>[a(h,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:c(()=>{var w,$;return[l("ul",Oh,[K(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=y=>i.copyFeedLink())},d(e.$t("Copy Link")),1),i.showReportOption?(n(),r("li",{key:0,onClick:t[1]||(t[1]=y=>i.reportPost())},d(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(s.feed)?(n(),r(T,{key:1},[l("li",{onClick:t[2]||(t[2]=y=>i.editItem())},d(e.$t("Edit")),1),e.has_pro&&e.isCommunityModerator()&&["published","unlisted"].includes(s.feed.status)?(n(),r("li",{key:0,onClick:t[3]||(t[3]=y=>i.toggleUnlist())},[s.feed.status=="unlisted"?(n(),r("span",Hh,d(e.$t("List Post")),1)):(n(),r("span",jh,d(e.$t("Unlist Post")),1))])):_("",!0),s.feed.space&&e.hasSpaceAdminAccess(s.feed.space)?(n(),r(T,{key:1},[l("li",{onClick:t[4]||(t[4]=y=>i.toggleSticky())},[s.feed.is_sticky?(n(),r("span",Nh,d(e.$t("Unpin from Top")),1)):(n(),r("span",zh,d(e.$t("Pin to top")),1))]),l("li",{onClick:t[5]||(t[5]=y=>i.toggleSidebarPin())},[s.feed.priority?(n(),r("span",Gh,d(e.$t("Unpin from sidebar")),1)):(n(),r("span",qh,d(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(w=s.feed.meta)!=null&&w.media_preview?(n(),r("li",{key:2,onClick:t[6]||(t[6]=y=>i.removePreview())},d(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(s.feed.space)?(n(),r("li",{key:3,onClick:t[7]||(t[7]=y=>i.toggleCommentStatus())},[(($=s.feed.meta)==null?void 0:$.comments_disabled)=="yes"?(n(),r("span",Yh,d(e.$t("Enable comments")),1)):(n(),r("span",Wh,d(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(s.feed)?(n(),r("li",{key:2,onClick:t[8]||(t[8]=y=>i.deleteItem())},d(e.$t("Delete")),1)):_("",!0),K(e.$slots,"after_feed_actions_pop")])]}),_:3},512),o.isEdit?(n(),v(k,{key:0,feedSlug:s.feed.slug,dialogVisible:o.isEdit,hide_create_form:s.hide_create_form,author:{name:(b=s.feed.xprofile)==null?void 0:b.display_name,avatar:(S=s.feed.xprofile)==null?void 0:S.avatar},onUpdated:i.handleUpdate,onClose:t[9]||(t[9]=w=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const vo=P(xh,[["render",Kh]]);const Zh={name:"Feed",components:{DocumentLists:tt,CustomAppMeta:Rh,BookmarkIcon:yo,StickyIcon:Lt,UserRouteLink:Te,EditFeed:ls,FeedFooter:I_,MediaPreview:xe,ImageCarousel:Mt,SurveyRenderer:go,ReportReview:_o,FeedAction:vo,FeedMdContent:Tt},emits:["updated","deleted","removed","reload","commented"],props:{feed:{type:Object,required:!0},is_single:{type:Boolean,default:!1},is_route:{type:Boolean,default:!1},show_footer:{type:Boolean,default:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},hide_create_form:{type:Boolean,default:!1},is_preview:{type:Boolean,default:!1},show_actions:{type:Boolean,default:!0},is_modal:{type:Boolean,default:!1},isSingleSpacePage:{type:Boolean,default:!1}},data(){return{in_space:this.$route.params.space,working:!1,hasOverflowContent:!1,isExpanded:!1,joiningSpace:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess(this.feed.space)&&this.isReportEnabled&&this.show_report&&(this.feed.status=="pending"||((e=this.feed.meta)==null?void 0:e.reports_count))},space_slug(){let e=!1;return this.feed.space?e=this.feed.space.slug:this.$route.params.space&&(e=this.$route.params.space),e},feedClasses(){let e=[];return e.push("feed_type_"+this.feed.type),this.feed.type=="article"&&e.push(this.feed.featured_image?"feed_has_image":"feed_no_image"),this.is_preview&&e.push("feed_preview"),this.is_single?e.push("feed_single"):e.push("feed_list_item"),this.hasTopMedia&&e.push("feed_modern_layout"),e},feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.space_slug&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.space_slug}}),e},hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern")return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},parsedMessage(){return this.parseMessage(this.feed.message_rendered)}},methods:{getTopicRoute(e){return this.space_slug?{name:"space_feeds",params:{space:this.space_slug},query:{topic:e}}:{name:"all_feeds",query:{topic:e}}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},gotoTopicUrl(e){let t=this.getTopicRoute(e);this.$router.push(t)},gotoFeed(e){e&&(e.metaKey||e.ctrlKey)||(e&&(e.preventDefault(),e.stopPropagation()),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},getFeedContent(){return this.feed.title},expandInline(){this.hasOverflowContent=!1,this.isExpanded=!0},showFullContent(e){if(!this.hasFeature("show_post_modal")){this.expandInline();return}e&&e.stopPropagation(),this.$eventBus.emit("showFeedModal",{feed:this.feed})},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;let s=e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(o,i,m,f)=>o.startsWith("<a")&&!o.includes('target="_blank"')?o.includes(window.location.origin)?o:o.replace("<a",'<a target="_blank" rel="noopener noreferrer nofollow"'):i&&!this.isInsideHtmlTag(f,m)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${i}">#${i}</a>`:o);return s.indexOf('<span class="fcom_dynamic_prop" data-type="timestamp"')===-1?s:(o=>o.replace(/<span class="fcom_dynamic_prop" data-type="timestamp" data-timestamp="(\d+)">([^<]+)<\/span>/g,(i,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return i;const k=h.local().format(this.siteDateTimeFormat)+" ("+this.currentTimeZoneName+")";return`<span class="fcom_timestamp" title="${f}">${k}</span>`}catch{return i}}))(s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},handleRemoveBookmark(){this.$emit("deleted")},toggleBookmark(){const e={react_type:"bookmark"};this.feed.bookmarked&&(e.remove=!0),this.feed.bookmarked=!this.feed.bookmarked,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.$notify.success(this.feed.bookmarked?this.$t("Bookmarked"):this.$t("Removed from bookmark")),!this.feed.bookmarked&&this.$route.name==="bookmarks"&&this.$emit("removeFromBookmark")}).catch(t=>{this.$handleError(t),this.feed.bookmarked=!this.feed.bookmarked})},toggleSticky(){this.feed.space_id&&(this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}))},joinSpace(){this.joiningSpace=!0,this.$post("spaces/"+this.feed.space.slug+"/join").then(e=>{this.appVars.user_membership_slugs.push(this.feed.space.slug),this.$notify.success(e.message),document.location.href=this.feed.permalink}).catch(e=>{this.$handleError(e)}).finally(()=>{this.joiningSpace=!1})},onModReport(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&(e.action==="unpublished"&&e.type!=="comment"?this.$emit("removed"):(this.feed.meta={...this.feed.meta,...e.content.meta},e.content.status&&(this.feed.status=e.content.status)))}},created(){this.$eventBus.on("updateModerationReport",this.onModReport)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.onModReport)},mounted(){if(document.dispatchEvent(new CustomEvent("fcomFeedMounted",{detail:{isSingle:this.is_single,feed:this.feed,feedBody:this.$refs.feed_body}})),this.is_single||this.feed.is_sticky||this.feed.priority){this.isExpanded=!0;return}let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},Jh=["id"],Qh={key:1,class:"fcom_top_media"},Xh={key:2,class:"fcom_feed_header_wrap"},ef={class:"feed_actions fcom_concat_buttons"},tf={key:0,class:"fcom_feed_topics"},sf={class:"feed_header"},of={key:0,class:"feed_user"},nf={class:"feed_user_info"},lf={class:"feed_user_name"},af={key:0,class:"feed_status"},rf={key:1,class:"feed_status"},cf={key:2,class:"feed_status"},df={class:"feed_meta_info"},uf={key:0,class:"meta_line"},_f=["title","href"],mf=["title","href"],hf={key:3},ff={key:0,class:"feed_title"},pf={key:0,class:"feed_title_heading"},gf=["href"],yf={key:1,class:"feed_title_heading"};function vf(e,t,s,u,o,i){var A,N,H,z,G,ne,E,Q,de,X,Ve,ee,Z,oe,gt;const m=p("report-review"),f=p("media-preview"),h=O,g=p("StickyIcon"),k=j,b=p("BookmarkIcon"),S=p("FeedAction"),w=p("router-link"),$=p("UserAvatar"),y=p("UserRouteLink"),C=De,L=p("FeedMdContent"),V=p("SurveyRenderer"),I=p("ImageCarousel"),F=p("DocumentLists"),R=p("CustomAppMeta"),B=p("feed-footer"),U=se("loading");return Y((n(),r("div",{id:"feed_id_"+((A=s.feed)==null?void 0:A.id),class:D([i.feedClasses,"feed"])},[i.showReport?(n(),v(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0),i.hasTopMedia?(n(),r("div",Qh,[s.feed.meta&&s.feed.meta.media_preview?(n(),v(f,{key:0,feed:s.feed,is_preview:s.is_preview},null,8,["feed","is_preview"])):_("",!0)])):_("",!0),s.show_header?(n(),r("div",Xh,[l("div",ef,[e.auth.user_id&&!e.hasSpaceAccess((N=s.feed.space)==null?void 0:N.slug)&&!s.is_single&&!s.isSingleSpacePage?(n(),v(h,{key:0,loading:o.joiningSpace,class:"fcom_secondary_button join_button",onClick:t[0]||(t[0]=ue=>i.joinSpace())},{default:c(()=>[M(d(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),s.show_actions?(n(),r(T,{key:1},[s.feed.is_sticky&&o.in_space?(n(),v(h,{key:0,onClick:t[1]||(t[1]=ue=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:c(()=>[a(k,{class:"fcom_sticky"},{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])):_("",!0),e.auth.user_id?(n(),v(h,{key:1,"aria-label":e.$t("Toggle Bookmark"),size:"small",text:"",onClick:t[2]||(t[2]=ue=>i.toggleBookmark()),class:D([{bookmark_active:s.feed.bookmarked},"feed_bookmark no_pad_btn"]),title:s.feed.bookmarked?e.$t("Remove From Bookmark"):e.$t("Bookmark this post")},{default:c(()=>[a(k,{style:{"font-size":"14px"}},{default:c(()=>[a(b,{is_active:s.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a(S,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},{before_feed_actions_pop:c(()=>[s.is_route?(n(),r("li",{key:0,onClick:t[3]||(t[3]=ue=>e.$emit("reload"))},d(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),K(e.$slots,"after_feed_actions")]),((H=e.appVars.topicsConfig)==null?void 0:H.show_on_post_card)=="yes"&&s.feed.terms&&s.feed.terms.length?(n(),r("div",tf,[(n(!0),r(T,null,x(s.feed.terms,ue=>(n(),v(w,{onClick:q(tI=>i.gotoTopicUrl(ue.slug),["prevent"]),key:ue.slug,to:i.getTopicRoute(ue.slug),class:"feed_timestamp"},{default:c(()=>[M("#"+d(ue.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",sf,[s.feed.xprofile?(n(),r("div",of,[a($,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",nf,[l("div",lf,[a(y,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"]),s.feed.status=="pending"?(n(),r("span",af,[a(C,{type:"warning"},{default:c(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="scheduled"?(n(),r("span",rf,[a(C,{type:"warning"},{default:c(()=>[M(d(e.$t("Scheduled")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"&&!s.is_single?(n(),r("span",cf,[a(C,{class:"fcom_unlisted_tag"},{default:c(()=>[M(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",df,[s.feed.content_type=="survey"&&((E=(ne=(G=(z=s.feed)==null?void 0:z.meta)==null?void 0:G.survey_config)==null?void 0:ne.options)!=null&&E.length)?(n(),r("span",uf,d(e.$t("created a poll")),1)):_("",!0),s.feed.status=="scheduled"?(n(),r("a",{key:1,title:s.feed.scheduled_at,onClick:t[4]||(t[4]=(...ue)=>i.gotoFeed&&i.gotoFeed(...ue)),href:s.feed.permalink,class:"feed_timestamp"},d(i.getScheduledTime(s.feed.scheduled_at)),9,_f)):(n(),r("a",{key:2,title:s.feed.created_at,onClick:t[5]||(t[5]=(...ue)=>i.gotoFeed&&i.gotoFeed(...ue)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,mf)),!o.in_space&&s.feed.space?(n(),r("span",hf,[a(w,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:c(()=>[M(d(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),K(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:D([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[s.feed.title?(n(),r("div",ff,[s.is_single?(n(),r("h2",yf,d(s.feed.title),1)):(n(),r("h2",pf,[l("a",{onClick:t[6]||(t[6]=q((...ue)=>i.showFullContent&&i.showFullContent(...ue),["prevent"])),href:s.feed.permalink},d(s.feed.title),9,gf)]))])):_("",!0),a(L,{class_name:"feed_texts",content:i.parsedMessage},null,8,["content"]),o.hasOverflowContent&&!o.isExpanded?(n(),r("div",{key:1,onClick:t[7]||(t[7]=ue=>i.expandInline()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:c(()=>[M(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="survey"&&((Ve=(X=(de=(Q=s.feed)==null?void 0:Q.meta)==null?void 0:de.survey_config)==null?void 0:X.options)!=null&&Ve.length)?(n(),r(T,{key:3},[a(V,{feed:s.feed,is_preview:s.is_preview,hasTopMedia:i.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),s.feed.meta.media_items?(n(),v(I,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(ee=s.feed.meta.audio_medias)!=null&&ee.length)?(n(),v(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):s.feed.content_type=="document"?(n(),v(F,{key:4,document_lists:((oe=(Z=s.feed)==null?void 0:Z.meta)==null?void 0:oe.document_lists)||[]},null,8,["document_lists"])):s.feed.meta?(n(),r(T,{key:5},[s.feed.meta.media_items?(n(),v(I,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(gt=s.feed.meta.audio_medias)!=null&>.length)?(n(),v(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0),s.feed.meta.custom_app_preview?(n(),v(R,{key:2,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),s.show_footer?(n(),v(B,{key:6,feed:s.feed,is_modal:s.is_modal,is_single:s.is_single,space_slug:i.space_slug,onJoinSpace:t[8]||(t[8]=()=>{i.joinSpace()}),onCommented:t[9]||(t[9]=ue=>{e.$emit("commented",ue)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),K(e.$slots,"after_feed_footer")],10,Jh)),[[U,o.working]])}const ot=P(Zh,[["render",vf]]),bf={data(){return{isDarkMode:!1}},methods:{updateDarkMode(){this.isDarkMode=document.documentElement.classList.contains("dark")}},mounted(){this.updateDarkMode(),this.observer=new MutationObserver(this.updateDarkMode),this.observer.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})},beforeUnmount(){this.observer&&this.observer.disconnect()}},$s=/\.(mp4|webm|mov|m4v|ogv|m3u8|mpd|qt)([?#]|$)/i,kf=/\.(mp3|m4a|aac|wav|ogg|oga|flac|opus|weba)([?#]|$)/i,wf={name:"FeedCardCover",mixins:[bf],props:{feed:{type:Object,required:!0}},computed:{placeholderImageSrc(){const e=this.isDarkMode?"feed-placeholder-dark.png":"feed-placeholder.png";return this.appVars.assets_url+"images/"+e},media(){var s;const e=this.feed.meta,t=e==null?void 0:e.media_preview;return t&&(t.thumbnail||t.image||t.html||this.videoSrcOf(t))?t:((s=e==null?void 0:e.media_items)==null?void 0:s[0])||null},videoSrc(){const e=this.media;return!e||e.thumbnail||e.html||e.image&&!$s.test(e.image)?null:this.videoSrcOf(e)},imageSrc(){const e=this.media;return e?e.thumbnail?e.thumbnail:e.image?e.image:e.html?this.extractIframeThumbnail(e.html)||this.placeholderImageSrc:e.url||this.placeholderImageSrc:this.placeholderImageSrc}},data(){return{video_failed:!1,cover_visible:!1}},methods:{videoSrcOf(e){const t=e.url||e.image;return!t||kf.test(t)?null:$s.test(t)?t.split("#")[0]:(e.type==="video"||e.content_type==="video")&&e.url?e.url:null},markVideoFailed(){this.video_failed=!0},checkVideoTrack(e){e.target.videoWidth||(this.video_failed=!0)},extractIframeThumbnail(e){const t=e.match(/src=["']([^"']+)["']/);if(!t)return null;const s=t[1],u=[[/youtube\.com\/embed\/([^?/]+)/,o=>"https://img.youtube.com/vi/"+o+"/hqdefault.jpg"],[/player\.vimeo\.com\/video\/([^?/]+)/,o=>"https://vumbnail.com/"+o+".jpg"],[/fast\.wistia\.net\/embed\/iframe\/([^?/]+)/,o=>"https://fast.wistia.net/embed/medias/"+o+"/swatch"],[/dailymotion\.com\/(?:embed\/video|player\.html\?video=)\/?([^?/&]+)/,o=>"https://www.dailymotion.com/thumbnail/video/"+o]];for(const[o,i]of u){const m=s.match(o);if(m)return i(m[1])}return null}},mounted(){if(this.videoSrc){if(typeof IntersectionObserver>"u"){this.cover_visible=!0;return}this._io=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(this.cover_visible=!0,this._io.disconnect(),this._io=null)},{rootMargin:"200px"}),this._io.observe(this.$el)}},beforeUnmount(){this._io&&(this._io.disconnect(),this._io=null)}},Cf=["src"],$f=["src","alt"];function Sf(e,t,s,u,o,i){return i.videoSrc&&o.cover_visible&&!o.video_failed?(n(),r("video",{key:0,class:"card_image",src:i.videoSrc+"#t=0.1",preload:"metadata",muted:"",playsinline:"","aria-hidden":"true",onError:t[0]||(t[0]=(...m)=>i.markVideoFailed&&i.markVideoFailed(...m)),onLoadedmetadata:t[1]||(t[1]=(...m)=>i.checkVideoTrack&&i.checkVideoTrack(...m))},null,40,Cf)):(n(),r("img",{key:1,src:i.videoSrc?i.placeholderImageSrc:i.imageSrc,class:"card_image",alt:s.feed.title||e.$t("Placeholder image")},null,8,$f))}const Vf=P(wf,[["render",Sf]]),Mf={name:"FeedCard",components:{UserRouteLink:Te,ChatIcon:Qe,HeartIcon:Xe,StickyIcon:Lt,MediaPreview:xe,ImageCarousel:Mt,UserAvatar:as,FeedAction:vo,FeedCardCover:Vf},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e}},data(){return{in_space:this.$route.params.space}},methods:{handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},goToFeedView(e,t=!1){if(!(e.ctrlKey||e.metaKey)){if(e.preventDefault(),e.stopPropagation(),this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}window.__showing_feed=this.feed,this.$router.push(this.feedRoute)}},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},Lf=["id"],Tf={class:"fcom_feed_card_header"},Ff={class:"feed_card_user"},Pf={class:"feed_card_body"},If={class:"fcom_feed_title_row"},Ef=["textContent"],Af={key:0,class:"feed_status"},Uf={key:1,class:"feed_status"},Bf={class:"card_description feed_meta_info"},Df=["title","href"],Rf={key:0},xf={class:"fcom_feed_card_footer"},Of={class:"num_label"},Hf={class:"num_label"},jf={class:"fcom_feed_card_action"};function Nf(e,t,s,u,o,i){var C;const m=p("FeedCardCover"),f=p("UserAvatar"),h=De,g=p("UserRouteLink"),k=p("router-link"),b=p("HeartIcon"),S=j,w=O,$=p("ChatIcon"),y=p("FeedAction");return n(),r("div",{id:"feed_id_"+((C=s.feed)==null?void 0:C.id),class:"fcom_feed_card"},[l("div",Tf,[l("div",{onClick:t[0]||(t[0]=(...L)=>i.goToFeedView&&i.goToFeedView(...L)),class:"feed_card_cover"},[a(m,{feed:s.feed},null,8,["feed"])]),l("div",Ff,[a(f,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])]),l("div",Pf,[l("div",If,[l("div",{onClick:t[1]||(t[1]=(...L)=>i.goToFeedView&&i.goToFeedView(...L)),class:"card_title feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,60))},null,8,Ef),s.feed.status=="pending"?(n(),r("span",Af,[a(h,{type:"warning"},{default:c(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),r("span",Uf,[a(h,{class:"fcom_unlisted_tag"},{default:c(()=>[M(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",Bf,[a(g,{xprofile:s.feed.xprofile,show_verified:!1,show_follow:!0},null,8,["xprofile"]),l("a",{title:s.feed.created_at,onClick:t[2]||(t[2]=(...L)=>i.goToFeedView&&i.goToFeedView(...L)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,Df),!o.in_space&&s.feed.space?(n(),r("span",Rf,[a(k,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:c(()=>[M(d(e.$t(e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",xf,[a(w,{"aria-label":e.$t("React"),text:""},{default:c(()=>[a(S,{class:D({user_reacted:s.feed.has_user_react}),onClick:t[3]||(t[3]=L=>i.toggleReact())},{default:c(()=>[a(b,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Of,d(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(w,{"aria-label":e.$t("Comment"),onClick:t[4]||(t[4]=L=>i.goToFeedView(L,!0)),text:""},{default:c(()=>[a(S,null,{default:c(()=>[a($)]),_:1}),l("span",Hf,d(s.feed.comments_count),1)]),_:1},8,["aria-label"])]),l("div",jf,[a(y,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},null,8,["feed","hide_create_form","onUpdated","onDeleted"])])],8,Lf)}const zf=P(Mf,[["render",Nf]]),qf={name:"FeedListItem",components:{UserRouteLink:Te,ChatIcon:Qe,HeartIcon:Xe,StickyIcon:Lt},props:["feed"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e}},data(){return{in_space:this.$route.params.space}},methods:{getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;return e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,u,o,i)=>s.startsWith("<a")&&!s.includes('target="_blank"')?s.includes(window.location.origin)?s:s.replace("<a",'<a target="_blank" rel="noopener"'):u&&!this.isInsideHtmlTag(i,o)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${u}">#${u}</a>`:s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},goToFeedView(e,t=!1){if(this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}e.ctrlKey||e.metaKey||(e.preventDefault(),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},Gf=["id"],Yf={class:"fcom_feed_data"},Wf={key:0,class:"fcom_sticky"},Kf={class:"feed_user"},Zf=["href"],Jf=["href"],Qf={class:"fcom_feed_title_row"},Xf=["textContent"],ep={key:0,class:"feed_status"},tp={key:1,class:"feed_status"},sp={class:"fcom_feed_meta"},op={key:0},ip={class:"feed_actions"},np={class:"num_label"},lp={class:"num_label"};function ap(e,t,s,u,o,i){var w,$,y;const m=p("StickyIcon"),f=j,h=p("UserAvatar"),g=De,k=p("HeartIcon"),b=O,S=p("ChatIcon");return n(),r("div",{id:"feed_id_"+((w=s.feed)==null?void 0:w.id),class:"fcom_feed_list"},[l("div",Yf,[s.feed.is_sticky?(n(),r("div",Wf,[a(f,{class:"fcom_sticky"},{default:c(()=>[a(m)]),_:1})])):_("",!0),l("div",Kf,[l("a",{href:i.getFeedHref(),onClick:t[0]||(t[0]=(...C)=>i.goToFeedView&&i.goToFeedView(...C))},[a(h,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])],8,Zf)]),l("a",{href:i.getFeedHref(),onClick:t[1]||(t[1]=(...C)=>i.goToFeedView&&i.goToFeedView(...C)),class:"feed_body"},[l("div",Qf,[l("div",{class:"feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,250))},null,8,Xf),s.feed.status=="pending"?(n(),r("span",ep,[a(g,{type:"warning"},{default:c(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="unlisted"?(n(),r("span",tp,[a(g,{class:"fcom_unlisted_tag"},{default:c(()=>[M(d(e.$t("Unlisted")),1)]),_:1})])):_("",!0)]),l("div",sp,[M(d(((y=($=s.feed)==null?void 0:$.xprofile)==null?void 0:y.display_name)||"No Name")+" • "+d(e.humanDateDiff(s.feed.created_at))+" ",1),!o.in_space&&s.feed.space?(n(),r("span",op,"• #"+d(s.feed.space.slug),1)):_("",!0)])],8,Jf)]),l("div",ip,[a(b,{"aria-label":e.$t("React"),text:""},{default:c(()=>[a(f,{class:D({user_reacted:s.feed.has_user_react}),onClick:t[2]||(t[2]=C=>i.toggleReact())},{default:c(()=>[a(k,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",np,d(s.feed.reactions_count),1)]),_:1},8,["aria-label"]),a(b,{"aria-label":e.$t("Comment"),onClick:t[3]||(t[3]=C=>i.goToFeedView(C,!0)),text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(S)]),_:1}),l("span",lp,d(s.feed.comments_count),1)]),_:1},8,["aria-label"])])],8,Gf)}const bo=P(qf,[["render",ap]]),rp={name:"SwitchTimelineIcon"},cp={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function dp(e,t,s,u,o,i){return n(),r("svg",cp,[...t[0]||(t[0]=[l("path",{d:"M4 1H13.75V2.5H4V1ZM1.375 2.875C1.07663 2.875 0.790483 2.75647 0.579505 2.5455C0.368526 2.33452 0.25 2.04837 0.25 1.75C0.25 1.45163 0.368526 1.16548 0.579505 0.954505C0.790483 0.743526 1.07663 0.625 1.375 0.625C1.67337 0.625 1.95952 0.743526 2.1705 0.954505C2.38147 1.16548 2.5 1.45163 2.5 1.75C2.5 2.04837 2.38147 2.33452 2.1705 2.5455C1.95952 2.75647 1.67337 2.875 1.375 2.875ZM1.375 8.125C1.07663 8.125 0.790483 8.00647 0.579505 7.7955C0.368526 7.58452 0.25 7.29837 0.25 7C0.25 6.70163 0.368526 6.41548 0.579505 6.2045C0.790483 5.99353 1.07663 5.875 1.375 5.875C1.67337 5.875 1.95952 5.99353 2.1705 6.2045C2.38147 6.41548 2.5 6.70163 2.5 7C2.5 7.29837 2.38147 7.58452 2.1705 7.7955C1.95952 8.00647 1.67337 8.125 1.375 8.125ZM1.375 13.3C1.07663 13.3 0.790483 13.1815 0.579505 12.9705C0.368526 12.7595 0.25 12.4734 0.25 12.175C0.25 11.8766 0.368526 11.5905 0.579505 11.3795C0.790483 11.1685 1.07663 11.05 1.375 11.05C1.67337 11.05 1.95952 11.1685 2.1705 11.3795C2.38147 11.5905 2.5 11.8766 2.5 12.175C2.5 12.4734 2.38147 12.7595 2.1705 12.9705C1.95952 13.1815 1.67337 13.3 1.375 13.3ZM4 6.25H13.75V7.75H4V6.25ZM4 11.5H13.75V13H4V11.5Z",fill:"currentColor"},null,-1)])])}const up=P(rp,[["render",dp]]),_p={name:"SwitchListIcon"},mp={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"};function hp(e,t,s,u,o,i){return n(),r("svg",mp,[...t[0]||(t[0]=[l("path",{d:"M2.53168 9.32334C2.79738 9.26497 3.0942 9.25 3.4 9.25H20.6C20.9058 9.25 21.2026 9.26497 21.4683 9.32334C21.7425 9.38357 22.0291 9.49978 22.2647 9.73532C22.5002 9.97086 22.6164 10.2575 22.6767 10.5317C22.735 10.7974 22.75 11.0942 22.75 11.4V12.6C22.75 12.9058 22.735 13.2026 22.6767 13.4683C22.6164 13.7425 22.5002 14.0291 22.2647 14.2647C22.0291 14.5002 21.7425 14.6164 21.4683 14.6767C21.2026 14.735 20.9058 14.75 20.6 14.75H3.4C3.0942 14.75 2.79738 14.735 2.53168 14.6767C2.25749 14.6164 1.97086 14.5002 1.73532 14.2647C1.49978 14.0291 1.38357 13.7425 1.32334 13.4683C1.26497 13.2026 1.25 12.9058 1.25 12.6V11.4C1.25 11.0942 1.26497 10.7974 1.32334 10.5317C1.38357 10.2575 1.49978 9.97086 1.73532 9.73532C1.97086 9.49978 2.25749 9.38357 2.53168 9.32334Z",fill:"var(--fcom-primary-text)"},null,-1),l("path",{opacity:"0.4",d:"M2.53168 1.32334C2.79738 1.26497 3.0942 1.25 3.4 1.25H20.6C20.9058 1.25 21.2026 1.26497 21.4683 1.32334C21.7425 1.38357 22.0291 1.49978 22.2647 1.73532C22.5002 1.97086 22.6164 2.25749 22.6767 2.53168C22.735 2.79738 22.75 3.0942 22.75 3.4V4.6C22.75 4.9058 22.735 5.20262 22.6767 5.46832C22.6164 5.74251 22.5002 6.02914 22.2647 6.26468C22.0291 6.50022 21.7425 6.61643 21.4683 6.67666C21.2026 6.73503 20.9058 6.75 20.6 6.75H3.4C3.0942 6.75 2.79738 6.73503 2.53168 6.67666C2.25749 6.61643 1.97086 6.50022 1.73532 6.26468C1.49978 6.02914 1.38357 5.74251 1.32334 5.46832C1.26497 5.20262 1.25 4.9058 1.25 4.6V3.4C1.25 3.0942 1.26497 2.79738 1.32334 2.53168C1.38357 2.25749 1.49978 1.97086 1.73532 1.73532C1.97086 1.49978 2.25749 1.38357 2.53168 1.32334Z",fill:"var(--fcom-primary-text)"},null,-1),l("path",{opacity:"0.4",d:"M2.53168 17.3233C2.79738 17.265 3.0942 17.25 3.4 17.25H20.6C20.9058 17.25 21.2026 17.265 21.4683 17.3233C21.7425 17.3836 22.0291 17.4998 22.2647 17.7353C22.5002 17.9709 22.6164 18.2575 22.6767 18.5317C22.735 18.7974 22.75 19.0942 22.75 19.4V20.6C22.75 20.9058 22.735 21.2026 22.6767 21.4683C22.6164 21.7425 22.5002 22.0291 22.2647 22.2647C22.0291 22.5002 21.7425 22.6164 21.4683 22.6767C21.2026 22.735 20.9058 22.75 20.6 22.75H3.4C3.0942 22.75 2.79738 22.735 2.53168 22.6767C2.25749 22.6164 1.97086 22.5002 1.73532 22.2647C1.49978 22.0291 1.38357 21.7425 1.32334 21.4683C1.26497 21.2026 1.25 20.9058 1.25 20.6V19.4C1.25 19.0942 1.26497 18.7974 1.32334 18.5317C1.38357 18.2575 1.49978 17.9709 1.73532 17.7353C1.97086 17.4998 2.25749 17.3836 2.53168 17.3233Z",fill:"var(--fcom-primary-text)"},null,-1)])])}const fp=P(_p,[["render",hp]]),pp={name:"SwitchCardIcon"},gp={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"};function yp(e,t,s,u,o,i){return n(),r("svg",gp,[...t[0]||(t[0]=[l("path",{d:"M3 4C3 3.44772 3.44772 3 4 3H10C10.5523 3 11 3.44772 11 4V10C11 10.5523 10.5523 11 10 11H4C3.44772 11 3 10.5523 3 10V4ZM3 14C3 13.4477 3.44772 13 4 13H10C10.5523 13 11 13.4477 11 14V20C11 20.5523 10.5523 21 10 21H4C3.44772 21 3 20.5523 3 20V14ZM13 4C13 3.44772 13.4477 3 14 3H20C20.5523 3 21 3.44772 21 4V10C21 10.5523 20.5523 11 20 11H14C13.4477 11 13 10.5523 13 10V4ZM13 14C13 13.4477 13.4477 13 14 13H20C20.5523 13 21 13.4477 21 14V20C21 20.5523 20.5523 21 20 21H14C13.4477 21 13 20.5523 13 20V14ZM15 5V9H19V5H15ZM15 15V19H19V15H15ZM5 5V9H9V5H5ZM5 15V19H9V15H5Z"},null,-1)])])}const vp=P(pp,[["render",yp]]),bp={name:"DoubleChevronUpIcon",props:{fill:{type:String,default:"currentColor"}}},kp=["fill"];function wp(e,t,s,u,o,i){return n(),r("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[l("path",{d:"M5 13L10 8L15 13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1),l("path",{d:"M5 8L10 3L15 8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])],8,kp)}const Cp=P(bp,[["render",wp]]),$p={name:"ScrollToTop",components:{DoubleChevronUpIcon:Cp},props:{threshold:{type:Number,default:200}},data(){return{visible:!1}},methods:{onLayoutScroll(e){this.visible=e.detail.scrollTop>this.threshold},scrollToTop(){window.scrollTo({top:0,behavior:"smooth"})}},mounted(){document.addEventListener("fcom_layout_scroll",this.onLayoutScroll)},beforeUnmount(){document.removeEventListener("fcom_layout_scroll",this.onLayoutScroll)}},Sp=["aria-label"],Vp={class:"fcom_scroll_to_top_icon"};function Mp(e,t,s,u,o,i){const m=p("DoubleChevronUpIcon");return n(),v(Ps,{"enter-active-class":"fcom_scroll_to_top_enter_active","leave-active-class":"fcom_scroll_to_top_leave_active","enter-from-class":"fcom_scroll_to_top_enter_from","leave-to-class":"fcom_scroll_to_top_leave_to",duration:200},{default:c(()=>[o.visible?(n(),r("button",{key:0,type:"button",class:"fcom_scroll_to_top","aria-label":e.$t("Scroll to top"),onClick:t[0]||(t[0]=(...f)=>i.scrollToTop&&i.scrollToTop(...f))},[l("span",Vp,[a(m)])],8,Sp)):_("",!0)]),_:1})}const Lp=P($p,[["render",Mp]]);let Tp=0;const Fp={name:"AllFeeds",emits:["refetch","update:loading"],inheritAttrs:!1,setup(){const e=Me(),t=St();return{feedStore:e,uiStore:t}},props:{space:{type:[String,Number],default(){return null}},user_id:{type:[String,Number],default(){return null}},hide_create_form:{type:Boolean,default(){return!1}},hide_filters:{type:Boolean,default(){return!1}},feed_base_url:{type:String,default(){return"feeds"}},default_search:{type:String,default(){return""}},searchIn:{type:Array,default(){return["post_content"]}},layout_style:{type:String,default(){return"timeline"}},feed_name:{type:String,default(){return""}},topic_slug:{type:[String,Number],default(){return null}},can_change_order:{type:Boolean,default(){return!0}},default_order_by:{type:String,default(){return""}},can_change_layout:{type:Boolean,default(){return!0}},context_suffix:{type:String,default(){return""}}},components:{CreateStatusForm:It,Feed:ot,FeedCard:zf,FeedListItem:bo,SwitchTimelineIcon:up,SwitchListIcon:fp,SwitchCardIcon:vp,ScrollToTop:Lp},watch:{space(e){this.canReuseCachedFeeds()?this.scheduleStalenessRefresh():this.fetchFeedsFromStore(),this.restoreLayoutPreference()},search(){this.fetchFeedsFromStore()},loading(e){this.$emit("update:loading",e)},topic_slug(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},"$route.query.search"(e){this.search=e||""}},computed:{feedContext(){let e;return this.space?e=`space-${this.space}`:this.user_id?e=`user-${this.user_id}`:e="global",this.context_suffix?`${e}:${this.context_suffix}`:e},feeds(){return this.feedStore.getFeedsByContext(this.feedContext)},sticky(){return this.feedStore.getStickyFeed(this.feedContext)},pagination(){return this.feedStore.getPagination(this.feedContext)},loading(){return this.feedStore.isLoading(this.feedContext)},execution_time(){return this.feedStore.getExecutionTime(this.feedContext)},disableAutoLoad(){return this.feedStore.disableAutoLoad(this.feedContext)},currentLayoutStyle(){return this.can_change_layout?this.custom_layout_style:this.layout_style},computedPostOrderOptions(){return this.user_id?this.appVars.user_post_order_by_options:this.appVars.post_order_by_options},isOwnProfile(){return!!(this.user_id&&this.auth.user_id&&this.user_id==this.auth.user_id)},canFilterStatus(){return this.has_pro&&(this.isCommunityModerator()||this.isOwnProfile)},visibilityOptions(){return[{value:"",label:this.$t("All")},{value:"published",label:this.$t("Published")},{value:"unlisted",label:this.$t("Unlisted")},{value:"pending",label:this.$t("In Review")},{value:"scheduled",label:this.$t("Scheduled")}]},currentSortLabel(){const e=this.computedPostOrderOptions||{};return e[this.sort_by]||Object.values(e)[0]||this.$t("Latest")},sortGroupLabelId(){return"fcom_feed_filter_sort_"+this.filterUid},visibilityGroupLabelId(){return"fcom_feed_filter_visibility_"+this.filterUid},activeVisibilityLabel(){if(!this.status_filter)return"";const e=this.visibilityOptions.find(t=>t.value===this.status_filter);return e?e.label:""},triggerAriaLabel(){return this.activeVisibilityLabel?this.$t("Sort: %1$s, visibility: %2$s",this.currentSortLabel,this.activeVisibilityLabel):this.$t("Sort: %s",this.currentSortLabel)}},data(){return{appReady:!0,filterUid:Tp++,sort_by:"",status_filter:"",filterPopperOptions:{modifiers:[{name:"flip",options:{fallbackPlacements:["top-end","bottom-end"],padding:8}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}}]},search:this.$route.query.search||"",custom_layout_style:this.layout_style,disable_sticky:!1,boundHandler:null}},methods:{...js(Me,["fetchFeeds","createFeed","updateFeed","deleteFeed","resetContext"]),currentFilterKey(){return JSON.stringify({search:this.search||"",order_by_type:this.sort_by||"",topic_slug:this.topic_slug||"",status:this.status_filter||""})},canReuseCachedFeeds(){var t,s;const e=(t=this.feedStore.feedsByContext)==null?void 0:t[this.feedContext];return(s=e==null?void 0:e.data)!=null&&s.length?e.filterKey===this.currentFilterKey():!1},scheduleStalenessRefresh(){var s;this.feedStore.touchContext(this.feedContext);const t=(s=this.feedStore.feedsByContext)==null?void 0:s[this.feedContext];t!=null&&t.timestamp&&(Date.now()-t.timestamp<6e4||this.feedStore.softRefreshContext(this.feedContext,{feed_base_url:this.feed_base_url,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,status:this.status_filter,search_in:this.searchIn}))},async fetchFeedsFromStore(e=!1){try{await this.feedStore.fetchFeeds(this.feedContext,{feed_base_url:this.feed_base_url,page:e?this.pagination.page:1,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,status:this.status_filter,search_in:this.searchIn},e)}catch(t){this.$handleError(t)}},selectSortBy(e){this.sort_by!==e&&(this.sort_by=e,this.resetFetch())},selectStatusFilter(e){this.status_filter!==e&&(this.status_filter=e,this.resetFetch())},async handleDelete(e){const t=this.feeds[e];if(t)try{await this.feedStore.deleteFeed(this.feedContext,t.id,e),this.$notify.success(this.$t("Post deleted successfully"))}catch(s){this.$handleError(s)}},handleRemoveFromList(e){const t=this.feeds[e];t&&this.feedStore.deleteFeedsFromStore(this.feedContext,[t.id])},async handleUpdate(e,t){try{await this.feedStore.updateFeed(e.id,e)}catch(s){this.$handleError(s)}},handleLoadMore(){var o;if(this.disableAutoLoad)return!1;if(this.pagination.last_page==this.pagination.page)return;let e=document.querySelector(".all_feeds_holder .feed_outer:last-child");if(!e)return;let t=e.getBoundingClientRect(),s=(o=window.fcomLayoutRef)==null?void 0:o.wrapRef;!s||t.bottom-s.getBoundingClientRect().bottom-t.height>100||this.loading||this.fetchFeedsFromStore(!0)},resetFetch(){!this.hide_filters&&!this.default_search&&!this.user_id&&(this.$storeLocalData("feed_sort_by",this.sort_by),this.$storeLocalData("feed_status_filter",this.status_filter)),this.disable_sticky="yes",this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},spaceChanged(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},routeNewArticle(){this.space?this.$router.push({name:"space_write_article",params:{space:this.space}}):this.$router.push({name:"write_article"})},switchView(e){this.custom_layout_style!=e&&(this.custom_layout_style=e,this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")&&this.$storeLocalData("feed_layout_style_"+this.feed_name,e),this.$notify.success(this.$t("Layout changed")))},restoreLayoutPreference(){if(this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")){let e=this.$getLocalData("feed_layout_style_"+this.feed_name);this.custom_layout_style=e||this.layout_style}else this.custom_layout_style=this.layout_style}},created(){if(this.default_search&&(this.search=this.default_search),this.default_order_by&&!this.can_change_order?this.sort_by=this.default_order_by:!this.hide_filters&&!this.default_search&&(this.user_id?this.sort_by="":this.sort_by=this.$getLocalData("feed_sort_by")||""),this.$route.query.sort_by&&(this.sort_by=this.$route.query.sort_by),this.sort_by||(this.sort_by=this.default_order_by||"latest"),this.isCommunityModerator()&&!this.hide_filters&&!this.default_search&&!this.user_id&&(this.status_filter=this.$getLocalData("feed_status_filter")||""),this.canReuseCachedFeeds()){this.scheduleStalenessRefresh();return}this.fetchFeedsFromStore()},mounted(){this.restoreLayoutPreference(),this.boundHandler=this.handleLoadMore.bind(this),document.addEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.on("doGlobalSearch",e=>{this.loading||this.search!=e&&(this.search=e,this.pagination.page=1,this.$router.push({query:{search:e}}))})},beforeUnmount(){this.$eventBus.emit("leaving_all_feeds"),document.removeEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.off("doGlobalSearch"),this.feeds&&this.feeds.length>50&&this.feedStore.pruneOldFeeds()}},Pp={key:1,class:"feed_filters"},Ip={class:"fcom_feed_filter_value"},Ep={key:1,class:"fcom_feed_filter_active"},Ap={key:0,role:"presentation",class:"fcom_feed_filter_group"},Up=["id"],Bp=["aria-labelledby"],Dp={key:1,role:"presentation",class:"fcom_feed_filter_group"},Rp=["id"],xp=["aria-labelledby"],Op={key:1,class:"fcom_layout_switch"},Hp={class:"fcom_icon_menu"},jp={class:"fcom_icon_menu"},Np={class:"fcom_icon_menu"},zp={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},qp={key:0},Gp={key:3,class:"fcom_sticky_feed"},Yp={class:"all_feeds_holder"},Wp={key:0,style:{"margin-top":"20px","text-align":"center"}},Kp={key:5},Zp={class:"feed_outer"},Jp={class:"feed"},Qp={style:{"text-align":"center"},class:"feed_body not_found"},Xp={key:0},e1={key:1},t1={key:2};function s1(e,t,s,u,o,i){const m=p("create-status-form"),f=p("Operation"),h=j,g=p("ArrowDown"),k=O,b=We,S=Ke,w=Ze,$=p("SwitchCardIcon"),y=p("SwitchListIcon"),C=p("SwitchTimelineIcon"),L=p("feed"),V=p("FeedListItem"),I=p("FeedCard"),F=J,R=p("ScrollToTop");return n(),r(T,null,[K(e.$slots,"before_create_form"),!s.hide_create_form&&e.auth.user_id?(n(),v(m,{key:0,space:s.space,btn_text:e.$t("Post")},null,8,["space","btn_text"])):_("",!0),K(e.$slots,"before_feeds"),s.hide_filters?_("",!0):(n(),r("div",Pp,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),s.can_change_order||i.canFilterStatus?(n(),v(w,{key:0,class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","popper-options":o.filterPopperOptions},{dropdown:c(()=>[a(S,{class:"fcom_feed_filter_menu"},{default:c(()=>[s.can_change_order?(n(),r("li",Ap,[l("span",{id:i.sortGroupLabelId,class:"fcom_feed_filter_group_label"},d(e.$t("Sort by")),9,Up),l("ul",{role:"group","aria-labelledby":i.sortGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(T,null,x(i.computedPostOrderOptions,(B,U)=>(n(),v(b,{key:U,class:D({fcom_feed_filter_selected:o.sort_by===U}),onClick:A=>i.selectSortBy(U)},{default:c(()=>[M(d(B),1)]),_:2},1032,["class","onClick"]))),128))],8,Bp)])):_("",!0),i.canFilterStatus?(n(),r("li",Dp,[l("span",{id:i.visibilityGroupLabelId,class:D(["fcom_feed_filter_group_label",{fcom_feed_filter_group_divided:s.can_change_order}])},d(e.$t("Visibility")),11,Rp),l("ul",{role:"group","aria-labelledby":i.visibilityGroupLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(T,null,x(i.visibilityOptions,B=>(n(),v(b,{key:B.value,class:D({fcom_feed_filter_selected:o.status_filter===B.value}),onClick:U=>i.selectStatusFilter(B.value)},{default:c(()=>[M(d(B.label),1)]),_:2},1032,["class","onClick"]))),128))],8,xp)])):_("",!0)]),_:1})]),default:c(()=>[a(k,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.triggerAriaLabel},{default:c(()=>[i.canFilterStatus?(n(),r("span",{key:0,class:D(["fcom_feed_filter_icon",{"is-active":!!o.status_filter}])},[a(h,null,{default:c(()=>[a(f)]),_:1})],2)):_("",!0),l("span",Ip,d(i.currentSortLabel),1),i.activeVisibilityLabel?(n(),r("span",Ep,"("+d(i.activeVisibilityLabel)+")",1)):_("",!0),a(h,{class:"fcom_feed_filter_caret"},{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["popper-options"])):_("",!0),s.can_change_layout&&s.feed_name&&e.hasFeature("can_switch_layout")?(n(),r("div",Op,[a(w,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:c(()=>[a(S,{class:"fcom_layout_dropdown_menu"},{default:c(()=>[a(b,{onClick:t[0]||(t[0]=B=>i.switchView("card")),class:D({selected_layout:o.custom_layout_style==="card"})},{default:c(()=>[l("div",Hp,[a($),l("span",null,d(e.$t("Card")),1)])]),_:1},8,["class"]),a(b,{onClick:t[1]||(t[1]=B=>i.switchView("list")),class:D({selected_layout:o.custom_layout_style==="list"})},{default:c(()=>[l("div",jp,[a(y),l("span",null,d(e.$t("List")),1)])]),_:1},8,["class"]),a(b,{onClick:t[2]||(t[2]=B=>i.switchView("timeline")),class:D({selected_layout:o.custom_layout_style==="timeline"})},{default:c(()=>[l("div",Np,[a(C),l("span",null,d(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:c(()=>[a(k,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:c(()=>[a(h,{class:D(["fcom_layout_icon","fcom_layout_icon_"+o.custom_layout_style])},{default:c(()=>[o.custom_layout_style=="card"?(n(),v($,{key:0})):o.custom_layout_style=="list"?(n(),v(y,{key:1})):(n(),v(C,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),i.pagination.total&&o.search?(n(),r("div",zp,[M(d(e.$_n("%s result found","%s results found",i.pagination.total))+" ",1),i.execution_time?(n(),r("span",qp,d(e.$t("in %ss",i.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),i.sticky?(n(),r("div",Gp,[a(L,{onReload:t[3]||(t[3]=B=>{i.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[4]||(t[4]=B=>{i.sticky=B}),onDeleted:t[5]||(t[5]=()=>{i.sticky=null}),feed:i.sticky,show_report:!0,isSingleSpacePage:!!s.space},null,8,["feed","isSingleSpacePage"])])):_("",!0),i.feeds.length?(n(),r("div",{key:4,ref:"all_feeds_wrap",class:D(["fcom_feed_style_"+i.currentLayoutStyle,"all_feeds"])},[l("div",Yp,[(n(!0),r(T,null,x(i.feeds,(B,U)=>(n(),r("div",{key:B.id,class:"feed_outer"},[i.currentLayoutStyle=="list"?(n(),v(V,{key:0,feed:B},null,8,["feed"])):i.currentLayoutStyle=="card"?(n(),v(I,{key:1,feed:B,hide_create_form:s.hide_create_form,onUpdated:A=>i.handleUpdate(A,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(n(),v(L,{key:2,feed:B,isSingleSpacePage:!!s.space,show_report:!0,layout_style:i.currentLayoutStyle,hide_create_form:s.hide_create_form,onUpdated:A=>i.handleUpdate(A,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),i.pagination.has_more!==!1?(n(),r("div",Wp,[a(k,{class:"fcom_secondary_button",disabled:i.loading,loading:i.loading,onClick:t[6]||(t[6]=B=>i.fetchFeedsFromStore(!0))},{default:c(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)],2)):!i.loading&&!i.sticky?(n(),r("div",Kp,[l("div",Zp,[l("div",Jp,[l("div",Qp,[o.search?(n(),r("p",Xp,d(e.$t("No results found based on your search criteria")),1)):s.topic_slug?(n(),r("p",e1,d(e.$t("No posts found for the selected topic")),1)):(n(),r("p",t1,d(e.$t("No posts found!")),1))])])])])):_("",!0),i.loading&&!i.feeds.length?(n(),r(T,{key:6},[a(F,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),i.pagination.page==1?(n(),r(T,{key:0},[a(F,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),a(F,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})],64)):_("",!0)],64)):_("",!0),a(R,{threshold:500})],64)}const ft=P(Fp,[["render",s1]]),o1={name:"SearchBar",components:{SpaceIcon:ze,AllFeeds:ft,SearchIcon:Fe,Loading:oi},data(){return{search:"",SearchIcon:Gt(Fe),showingSearch:!1,perform_search:!1,searching:!1,searchGroups:[],search_space:"__all__",searchIn:["post_content"]}},computed:{placeholder(){return this.search_space!="__all__"?this.$t("Search in %s","#"+this.search_space):this.$t("Search here...")}},methods:{onRouteUpdated(){this.showingSearch=!1},initSearch(){this.openSearch()},openSearch(){this.search||(this.perform_search=!1,this.search_space=this.$route.params.space||"__all__",this.searchIn=["post_content"]),this.showingSearch=!0,this.handleOpen()},toSearch(){if(!this.search){this.perform_search=!1;return}if(this.perform_search&&this.$refs.feedsRef){this.$refs.feedsRef.search=this.search;return}this.perform_search=!0},onClear(){this.search="",this.perform_search=!1},handleScroll(e){if(this.$refs.feedsScroller.wrapRef.scrollHeight-this.$refs.feedsScroller.wrapRef.clientHeight-e.scrollTop<100){let s=this.$refs.feedsRef;!s.loading&&s.pagination.page<s.pagination.last_page&&(s.pagination.page++,s.fetchFeeds(!0))}},keyBind(e){e.key==="k"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.showingSearch?this.showingSearch=!1:this.openSearch())},handleOpen(){this.formatSearchGroups()},focusInput(){this.$refs.seatch_input&&this.$refs.seatch_input.focus()},formatSearchGroups(){if(this.searchGroups.length)return;let e=this.appVars.auth.spaces;e=Object.values(e);let t=this.appVars.space_groups,s=[];this.each(t,u=>{let o=e.filter(i=>i.parent_id==u.id&&i.permissions&&i.permissions.can_view_posts);o.length&&s.push({label:u.title,spaces:o})}),this.searchGroups=s}},mounted(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("route_updated",this.onRouteUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this.$eventBus.off("route_updated",this.onRouteUpdated)}},i1=["aria-label"],n1={class:"fcom_search_header"},l1={key:0,class:"fcom_space_title"},a1={key:1},r1={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},c1={key:0,class:"fcom_search_results"},d1={key:1,class:"fcom_search_welcome"};function u1(e,t,s,u,o,i){const m=p("SearchIcon"),f=j,h=p("Loading"),g=ae,k=p("SpaceIcon"),b=Wt,S=re,w=ie,$=ve,y=As,C=p("all-feeds"),L=Pe,V=ke;return n(),r(T,null,[l("button",{class:"fcom_menu_button","aria-label":e.$t("Search"),onClick:t[0]||(t[0]=I=>i.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:c(()=>[a(m)]),_:1})],8,i1),o.showingSearch?(n(),v(V,{key:0,top:"60px","append-to-body":!0,"lock-scroll":!0,"modal-class":"fcom_search_bar_visible",onOpened:i.focusInput,modelValue:o.showingSearch,"onUpdate:modelValue":t[5]||(t[5]=I=>o.showingSearch=I),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:c(()=>[l("div",n1,[a(w,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=I=>o.search=I),placeholder:i.placeholder,onKeyup:te(i.toSearch,["enter"]),onClear:i.onClear,clearable:""},ye({prefix:c(()=>[a(f,{onClick:i.toSearch},{default:c(()=>[a(m)]),_:1},8,["onClick"])]),append:c(()=>[a(S,{class:"fcom_minimal_select fcom_global_search_append",modelValue:o.search_space,"onUpdate:modelValue":t[1]||(t[1]=I=>o.search_space=I),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:c(()=>[a(g,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(n(!0),r(T,null,x(o.searchGroups,I=>(n(),v(b,{key:I.label,label:I.label},{default:c(()=>[(n(!0),r(T,null,x(I.spaces,F=>(n(),v(g,{key:F.slug,label:F.title,value:F.slug},{default:c(()=>[F.id?(n(),r("span",l1,[a(k,{space_profile:F},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(F.title,30)),1)])):(n(),r("span",a1,d(e.getExcerpt(F.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:2},[o.searching?{name:"suffix",fn:c(()=>[a(f,{class:"is-loading fcom_search_spinner"},{default:c(()=>[a(h)]),_:1})]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClear"]),l("div",r1,[l("span",null,d(e.$t("Search in:")),1),a(y,{modelValue:o.searchIn,"onUpdate:modelValue":t[3]||(t[3]=I=>o.searchIn=I),class:"fcom_search_in"},{default:c(()=>[a($,{value:"post_content",class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Post Title & Content")),1)]),_:1}),a($,{value:"post_comments",class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:c(()=>[o.perform_search?(n(),r("div",c1,[a(L,{ref:"feedsScroller",onScroll:i.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:c(()=>[a(C,{searchIn:o.searchIn,layout_style:"list",feed_name:"search_results",context_suffix:"search",space:o.search_space!="__all__"?o.search_space:"",ref:"feedsRef",default_search:o.search,hide_filters:!1,hide_create_form:!0,"onUpdate:loading":t[4]||(t[4]=I=>o.searching=I)},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(n(),r("div",d1,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("h3",null,d(e.$t("Search for anything")),1),l("p",null,d(e.$t("Try searching for keywords in posts")),1),l("p",null,[M(d(e.$t("Tip: Quick-launch search with"))+" ",1),t[6]||(t[6]=l("b",null,"⌘ + K",-1)),M(" (Mac) "+d(e.$t("or"))+" ",1),t[7]||(t[7]=l("b",null,"Ctrl + K",-1)),t[8]||(t[8]=M(" (Windows/Linux)",-1))])]))]),_:1},8,["onOpened","modelValue","width"])):_("",!0)],64)}const _1=P(o1,[["render",u1]]),m1={name:"Drawer",emits:["update:modelValue"],props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},size:{type:String,default:"40%"},direction:{type:String,default:"right",validator:e=>["left","right","top","bottom"].includes(e)},closeOnClickModal:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},withHeader:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},zIndex:{type:Number,default:null},id:{type:String,default:""},modalClass:{type:String,default:"fcom_common_dialog"},drawerClass:{type:String,default:"fcom_high_drawer"},headerClass:{type:String,default:""},bodyClass:{type:String,default:""},footerClass:{type:String,default:""},hasCloseConfirmation:{type:Boolean,default:!1},closeConfirmationMessage:{type:String,default:""},confirmLeaveAction:{type:Function,default:null},cancelLeaveAction:{type:Function,default:null},beforeClose:{type:Function,default:null}},computed:{elDirection(){return{left:"ltr",right:"rtl",top:"ttb",bottom:"btt"}[this.direction]||"rtl"}},methods:{handleBeforeClose(e){const t=()=>{this.beforeClose?this.beforeClose(e):e()};if(this.hasCloseConfirmation){const s=this.closeConfirmationMessage||this.$t("Are you sure you want to close this?");this.$confirm(s,this.$t("Confirm"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.confirmLeaveAction&&this.confirmLeaveAction(),t()}).catch(()=>{this.cancelLeaveAction&&this.cancelLeaveAction()})}else t()}}},h1=["id"];function f1(e,t,s,u,o,i){const m=Us;return n(),v(m,xo({"model-value":s.modelValue,"onUpdate:modelValue":t[0]||(t[0]=f=>e.$emit("update:modelValue",f)),direction:i.elDirection,size:s.size,modal:s.modal,"modal-class":s.modalClass,class:s.drawerClass,"close-on-click-modal":s.closeOnClickModal,"append-to-body":s.appendToBody,"destroy-on-close":s.destroyOnClose,"show-close":s.showClose,"with-header":s.withHeader,"lock-scroll":s.lockScroll,"open-delay":s.openDelay,"close-delay":s.closeDelay},s.zIndex!==null?{"z-index":s.zIndex}:{},{id:s.id,"before-close":i.handleBeforeClose}),ye({default:c(()=>[l("div",{class:D(s.bodyClass)},[K(e.$slots,"default")],2)]),_:2},[s.withHeader?{name:"header",fn:c(({close:f,titleId:h,titleClass:g})=>[K(e.$slots,"header",{close:f,titleId:h,titleClass:g},()=>[s.title?(n(),r("h4",{key:0,id:h,class:D([g,s.headerClass]),style:{margin:"0"}},d(s.title),11,h1)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:c(()=>[l("div",{class:D(s.footerClass)},[K(e.$slots,"footer")],2)]),key:"1"}:void 0]),1040,["model-value","direction","size","modal","modal-class","class","close-on-click-modal","append-to-body","destroy-on-close","show-close","with-header","lock-scroll","open-delay","close-delay","id","before-close"])}const ko=P(m1,[["render",f1]]);const p1={name:"SvgShapeGenerator",emits:["update"],data(){return{currentColor:"",selectedShape:"circle"}},computed:{svgShapes(){return{circle:`<svg class="fcom_shape fcom_shape_circle" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><circle cx="12" cy="12" r="12"/></svg>`,square:`<svg class="fcom_shape fcom_shape_square" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><rect x="0" y="0" width="24" height="24"/></svg>`,triangle:`<svg class="fcom_shape fcom_shape_triangle" viewBox="0 0 24 24" fill="${this.currentColor}" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M21 12L2 2v20z"/></svg>`,star:`<svg class="fcom_shape fcom_shape_star" viewBox="0 0 24 24" width="24" height="24"><polygon points="12,2.4 14.6,8.4 21.6,8.4 15.6,13.2 18,19.6 12,15.6 6,19.6 8.4,13.2 2.4,8.4 9.4,8.4" fill="${this.currentColor}"/></svg>`,heart:`<svg class="fcom_shape fcom_shape_heart" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" fill="${this.currentColor}"/></svg>`,diamond:`<svg class="fcom_shape fcom_shape_diamond" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><polygon points="12,2 22,12 12,22 2,12" fill="${this.currentColor}"/></svg>`}}},methods:{selectShape(e){this.selectedShape=e,this.$emit("update",this.svgShapes[e])},colorChanged(e){this.currentColor=e,this.$emit("update",this.svgShapes[this.selectedShape])}}},g1={class:"fcom_svg_generator"},y1={class:"fcom_form_item"},v1={class:"fcom_form_item"},b1=["innerHTML"];function k1(e,t,s,u,o,i){const m=Bs,f=je,h=be;return n(),r("div",g1,[l("div",y1,[l("label",null,d(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:o.currentColor,"onUpdate:modelValue":t[0]||(t[0]=g=>o.currentColor=g),onActiveChange:i.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",v1,[l("label",null,d(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=g=>i.selectShape(o.selectedShape)),modelValue:o.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=g=>o.selectedShape=g)},{default:c(()=>[(n(!0),r(T,null,x(i.svgShapes,(g,k)=>(n(),v(f,{key:k,value:k},{default:c(()=>[l("div",{innerHTML:g},null,8,b1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const w1=P(p1,[["render",k1]]),C1={name:"LogoEmojiSelector",components:{EmojiPicker:ro,ImageUploader:Re,SvgShapeGenerator:w1,ActionPopover:et},props:{config:{type:Object,required:!0,default:()=>({emoji:"",logo:"",shape_svg:""})},fallback_mark:{type:String,default:'<span class="fcom_no_avatar"></span>'},custom_svg:{type:Boolean,default:!1}},data(){return{emoji:this.config.emoji||"",logo:this.config.logo||"",shape_svg:this.config.shape_svg||"",selectedTab:"emoji"}},methods:{setData(e){e=="emoji"?(this.logo="",this.shape_svg=""):e=="shape_svg"?(this.emoji="",this.logo=""):(this.emoji="",this.shape_svg=""),this.$emit("update",{logo:this.logo,emoji:this.emoji,shape_svg:this.shape_svg})},handleLogoPhotoUpload(e){this.logo=e,this.setData("logo")},handleShapeChanged(e){this.shape_svg=e,this.setData("shape_svg")}},computed:{currentMark(){return this.logo?`<img alt="" src="${this.logo}" style="width: 20px; height: 20px; aspect-ratio: 1/1;">`:this.emoji.trim()?`<span style="font-size: 20px">${this.emoji.trim()}</span>`:this.shape_svg?'<i class="fcom_shape el-icon">'+this.shape_svg+"</i>":this.fallback_mark}},mounted(){if(this.logo)this.selectedTab="logo";else if(this.emoji)this.selectedTab="emoji";else if(this.shape_svg){if(this.custom_svg&&!/fcom_shape/.test(this.shape_svg)){this.selectedTab="shape_svg";return}this.selectedTab="shape"}}},$1=["innerHTML"];function S1(e,t,s,u,o,i){const m=O,f=p("EmojiPicker"),h=ie,g=Ds,k=p("SvgShapeGenerator"),b=Be,S=p("ImageUploader"),w=Rs,$=p("action-popover");return n(),v($,{ref:"iconPicker","close-on-click-outside":!0,"trigger-interactive":!0,teleported:!0,width:e.modalWidth},{trigger:c(()=>[a(m,{"aria-label":e.$t("Pick Emoji"),style:{padding:"4px 16px",display:"flex","justify-content":"center","align-items":"center"}},{default:c(()=>[l("span",{class:"logo_emoji_holder",style:{cursor:"pointer"},innerHTML:i.currentMark||""},null,8,$1)]),_:1},8,["aria-label"])]),default:c(({hide:y})=>[l("div",null,[a(w,{modelValue:o.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=C=>o.selectedTab=C),type:"border-card"},{default:c(()=>[a(g,{name:"emoji",label:e.$t("Emoji")},{default:c(()=>[a(h,{onChange:t[1]||(t[1]=C=>i.setData("emoji")),modelValue:o.emoji,"onUpdate:modelValue":t[2]||(t[2]=C=>o.emoji=C),placeholder:e.$t("Select or paste your emoji here"),style:{width:"100%"}},ye({_:2},[e.has_pro?{name:"append",fn:c(()=>[a(f,{close_on_select:!0,onEmojiSelected:t[0]||(t[0]=C=>{o.emoji=C,i.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(g,{name:"shape",label:e.$t("Shape")},{default:c(()=>[a(k,{onUpdate:i.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),s.custom_svg?(n(),v(g,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:c(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=C=>i.setData("shape_svg")),modelValue:o.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=C=>o.shape_svg=C),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(g,{name:"logo",label:e.$t("Custom Image")},{default:c(()=>[o.logo?(n(),v(b,{key:0,alt:e.$t("Logo"),src:o.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a(S,{can_remove:!!o.logo,isTextBtn:!1,additionalData:{resize:!0,max_width:400},onUploaded:i.handleLogoPhotoUpload},null,8,["can_remove","onUploaded"])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(m,{onClick:C=>y(),type:"success",plain:"",class:"fcom_mt_20"},{default:c(()=>[M(d(e.$t("Close")),1)]),_:1},8,["onClick"])])]),_:1},8,["width"])}const rs=P(C1,[["render",S1]]),V1={name:"SlugInput",emits:["update:modelValue"],props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},is_inital_inactive:{type:Boolean,default:!1},edit_notice:{type:String,default:""},popMessage:{type:String,default:""},description:{type:String,default:""},prefix:{type:String,default:""}},watch:{modelValue(e){this.model=e}},data(){return{model:this.modelValue,showEdit:this.is_inital_inactive}},methods:{updateSlug(){this.model=this.model.replace(/\s/g,"-"),this.model=this.model.replace(/[^a-zA-Z0-9-_]/g,""),this.$emit("update:modelValue",this.model)},confirmEditInit(){this.$confirm(this.popMessage||this.$t("Are you sure you want to change the slug?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.showEdit=!1})}}},M1={key:0,class:"fcom_slug_input_info"},L1=["innerHTML"],T1={key:1,class:"fcom_help_text"};function F1(e,t,s,u,o,i){const m=O,f=ie;return n(),r(T,null,[a(f,{class:"fcom_slug_input",disabled:s.disabled,readonly:o.showEdit,modelValue:o.model,"onUpdate:modelValue":t[1]||(t[1]=h=>o.model=h),ref:"input",placeholder:s.placeholder,onInput:i.updateSlug},ye({_:2},[s.prefix?{name:"prepend",fn:c(()=>[l("span",null,d(s.prefix),1)]),key:"0"}:void 0,o.showEdit?{name:"append",fn:c(()=>[a(m,{onClick:t[0]||(t[0]=h=>i.confirmEditInit()),text:"",type:"info"},{default:c(()=>[M(d(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!o.showEdit&&s.edit_notice?(n(),r("div",M1,[l("p",{innerHTML:s.edit_notice},null,8,L1)])):_("",!0),s.description?(n(),r("div",T1,[l("p",null,d(s.description),1)])):_("",!0)],64)}const Et=P(V1,[["render",F1]]),P1={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},I1={class:"fcom_errors_alert_list"};function E1(e,t,s,u,o,i){const m=Yt;return s.errors.length&&!o.dismissed?(n(),v(m,{key:0,type:"warning",closable:s.dismissable,"show-icon":"",onClose:t[0]||(t[0]=f=>o.dismissed=!0)},{title:c(()=>[l("ul",I1,[(n(!0),r(T,null,x(s.errors,(f,h)=>(n(),r("li",{key:h},d(f),1))),128))])]),_:1},8,["closable"])):_("",!0)}const At=P(P1,[["render",E1]]),A1={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:Et,ActionPopover:et,ErrorAlerts:At},data(){return{topics:[],selected:this.modelValue,loading:!1,creatingTopic:!1,newTopicErrors:[],newTopic:{title:"OK"}}},computed:{maxTopicsPerSpace(){var e;return((e=this.appVars.topicsConfig)==null?void 0:e.max_topics_per_space)||20},isTopicLimitReached(){var e;return((e=this.selected)==null?void 0:e.length)>=this.maxTopicsPerSpace}},methods:{getTopicsPlaceholder(){return this.$_n("Choose a topic","Choose up to %s topics",this.maxTopicsPerSpace)},initCreatetopic(){this.newTopicErrors=[],this.newTopic={title:"",description:"",slug:""}},validateForm(){return this.newTopicErrors=[],(!this.newTopic.title||!this.newTopic.title.trim())&&this.newTopicErrors.push(this.$t("Topic title is required.")),this.newTopicErrors.length===0},fetchTopics(){this.loading=!0,this.$get("admin/topics",{optionsOnly:!0,space_id:this.space_id}).then(e=>{this.topics=e.topics}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},createTopic(e){if(!this.validateForm())return;this.creatingTopic=!0;let t={title:this.newTopic.title,description:this.newTopic.description,slug:this.newTopic.slug,is_inline:!0};this.$post("admin/topics",t).then(s=>{this.$notify.success(s.message),this.fetchTopics(),this.selected.push(s.topic.id),e()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.creatingTopic=!1})}},watch:{selected(){this.$emit("update:modelValue",this.selected)}},mounted(){this.fetchTopics()}},U1={class:"fcom_topic_selector"},B1={key:0,class:"fcom_meta_text"};function D1(e,t,s,u,o,i){const m=ae,f=re,h=p("Plus"),g=j,k=O,b=ie,S=pe,w=p("slug-input"),$=p("error-alerts"),y=ge,C=p("action-popover"),L=se("loading");return n(),r("div",U1,[Y((n(),v(f,{modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=V=>o.selected=V),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":i.maxTopicsPerSpace,placeholder:i.getTopicsPlaceholder()},{default:c(()=>[(n(!0),r(T,null,x(o.topics,V=>(n(),v(m,{key:V.slug,label:V.title,value:V.id},{default:c(()=>[l("span",null,d(V.title),1),V.description?(n(),r("span",B1,d(V.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[L,o.loading]]),e.isAdmin()&&s.creatable?(n(),v(C,{key:0,placement:"left",width:400,onShow:i.initCreatetopic},{trigger:c(()=>[a(k,{disabled:i.isTopicLimitReached,class:"fcom_secondary_button"},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1},8,["disabled"])]),default:c(({hide:V})=>[a(y,{modelValue:o.newTopic,"onUpdate:modelValue":t[4]||(t[4]=I=>o.newTopic=I),"label-position":"top","require-asterisk-position":"right"},{default:c(()=>[a(S,{label:e.$t("Title"),required:""},{default:c(()=>[a(b,{modelValue:o.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=I=>o.newTopic.title=I),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,{label:e.$t("Slug (optional)")},{default:c(()=>[a(w,{modelValue:o.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=I=>o.newTopic.slug=I),placeholder:e.$t("Slug of the topic"),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores.")},null,8,["modelValue","placeholder","description"])]),_:1},8,["label"]),a(S,{label:e.$t("Description (optional)")},{default:c(()=>[a(b,{modelValue:o.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=I=>o.newTopic.description=I),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{errors:o.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a(S,null,{default:c(()=>[a(k,{class:"fcom_primary_button",onClick:I=>i.createTopic(V),loading:o.creatingTopic},{default:c(()=>[M(d(e.$t("Create")),1)]),_:1},8,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const wo=P(A1,[["render",D1]]),R1={name:"ListViewIcon"},x1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O1(e,t,s,u,o,i){return n(),r("svg",x1,[...t[0]||(t[0]=[Le('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 26C20 21.5817 23.5817 18 28 18C32.4183 18 36 21.5817 36 26C36 30.4183 32.4183 34 28 34C23.5817 34 20 30.4183 20 26Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip0_3601_59265)"><ellipse cx="27.9996" cy="33.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="24.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 26C44 24.3431 45.3431 23 47 23H137C138.657 23 140 24.3431 140 26C140 27.6569 138.657 29 137 29H47C45.3431 29 44 27.6569 44 26Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="48.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="48.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 62C20 57.5817 23.5817 54 28 54C32.4183 54 36 57.5817 36 62C36 66.4183 32.4183 70 28 70C23.5817 70 20 66.4183 20 62Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip1_3601_59265)"><ellipse cx="27.9996" cy="69.6001" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="60.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 62C44 60.3431 45.3431 59 47 59H137C138.657 59 140 60.3431 140 62C140 63.6569 138.657 65 137 65H47C45.3431 65 44 63.6569 44 62Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="84.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="84.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 98C20 93.5817 23.5817 90 28 90C32.4183 90 36 93.5817 36 98C36 102.418 32.4183 106 28 106C23.5817 106 20 102.418 20 98Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip2_3601_59265)"><ellipse cx="27.9996" cy="105.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="96.3999" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 98C44 96.3431 45.3431 95 47 95H137C138.657 95 140 96.3431 140 98C140 99.6569 138.657 101 137 101H47C45.3431 101 44 99.6569 44 98Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="120.5" width="135" height="27" rx="3.5" fill="transparent"></rect><rect x="12.5" y="120.5" width="135" height="27" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 134C20 129.582 23.5817 126 28 126C32.4183 126 36 129.582 36 134C36 138.418 32.4183 142 28 142C23.5817 142 20 138.418 20 134Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip3_3601_59265)"><ellipse cx="27.9996" cy="141.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="132.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 134C44 132.343 45.3431 131 47 131H137C138.657 131 140 132.343 140 134C140 135.657 138.657 137 137 137H47C45.3431 137 44 135.657 44 134Z" fill="var(--fcom-secondary-border)"></path><defs><clipPath id="clip0_3601_59265"><rect x="20" y="18" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip1_3601_59265"><rect x="20" y="54" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip2_3601_59265"><rect x="20" y="90" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip3_3601_59265"><rect x="20" y="126" width="16" height="16" rx="8" fill="transparent"></rect></clipPath></defs>',23)])])}const H1=P(R1,[["render",O1]]),j1={name:"TimelineViewIcon"},N1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function z1(e,t,s,u,o,i){return n(),r("svg",N1,[...t[0]||(t[0]=[Le('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="135" height="60" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="135" height="60" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 24C20 21.7909 21.7909 20 24 20H136C138.209 20 140 21.7909 140 24C140 26.2091 138.209 28 136 28H24C21.7909 28 20 26.2091 20 24Z" fill="var(--fcom-secondary-border)"></path><path d="M20 37C20 34.7909 21.7909 33 24 33H130.286C132.495 33 134.286 34.7909 134.286 37C134.286 39.2091 132.495 41 130.286 41H24C21.7909 41 20 39.2091 20 37Z" fill="var(--fcom-secondary-border)"></path><path d="M20 57C20 52.5817 23.5817 49 28 49C32.4183 49 36 52.5817 36 57C36 61.4183 32.4183 65 28 65C23.5817 65 20 61.4183 20 57Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip0_3601_59186)"><ellipse cx="27.9996" cy="64.6001" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="55.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 53C44 51.3431 45.3431 50 47 50H81C82.6569 50 84 51.3431 84 53C84 54.6569 82.6569 56 81 56H47C45.3431 56 44 54.6569 44 53Z" fill="var(--fcom-secondary-border)"></path><path d="M44 62C44 60.8954 44.8954 60 46 60H66C67.1046 60 68 60.8954 68 62C68 63.1046 67.1046 64 66 64H46C44.8954 64 44 63.1046 44 62Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="85.5" width="135" height="60" rx="3.5" fill="transparent"></rect><rect x="12.5" y="85.5" width="135" height="60" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 97C20 94.7909 21.7909 93 24 93H136C138.209 93 140 94.7909 140 97C140 99.2091 138.209 101 136 101H24C21.7909 101 20 99.2091 20 97Z" fill="var(--fcom-secondary-border)"></path><path d="M20 110C20 107.791 21.7909 106 24 106H130.286C132.495 106 134.286 107.791 134.286 110C134.286 112.209 132.495 114 130.286 114H24C21.7909 114 20 112.209 20 110Z" fill="var(--fcom-secondary-border)"></path><path d="M20 130C20 125.582 23.5817 122 28 122C32.4183 122 36 125.582 36 130C36 134.418 32.4183 138 28 138C23.5817 138 20 134.418 20 130Z" fill="var(--fcom-secondary-border)"></path><g clip-path="url(#clip1_3601_59186)"><ellipse cx="27.9996" cy="137.6" rx="6.4" ry="4.8" fill="var(--fcom-primary-bg)" fill-opacity="0.72"></ellipse><circle opacity="0.9" cx="27.9998" cy="128.4" r="3.2" fill="var(--fcom-primary-bg)"></circle></g><path d="M44 126C44 124.343 45.3431 123 47 123H81C82.6569 123 84 124.343 84 126C84 127.657 82.6569 129 81 129H47C45.3431 129 44 127.657 44 126Z" fill="var(--fcom-secondary-border)"></path><path d="M44 135C44 133.895 44.8954 133 46 133H66C67.1046 133 68 133.895 68 135C68 136.105 67.1046 137 66 137H46C44.8954 137 44 136.105 44 135Z" fill="var(--fcom-secondary-border)"></path><defs><clipPath id="clip0_3601_59186"><rect x="20" y="49" width="16" height="16" rx="8" fill="transparent"></rect></clipPath><clipPath id="clip1_3601_59186"><rect x="20" y="122" width="16" height="16" rx="8" fill="transparent"></rect></clipPath></defs>',19)])])}const q1=P(j1,[["render",z1]]),G1={name:"SpaceGroupSelector",props:["modelValue","space_id"],emits:["update:modelValue"],data(){return{loading:!1,selected:this.modelValue,groups:[]}},watch:{selected(e){this.$emit("update:modelValue",e)}},methods:{getGroups(){this.loading=!0,this.$get("spaces/space_groups",{options_only:"yes",space_id:this.space_id}).then(e=>{this.groups=e.groups}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getGroups()}};function Y1(e,t,s,u,o,i){const m=ae,f=re,h=se("loading");return Y((n(),v(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=g=>o.selected=g)},{default:c(()=>[(n(!0),r(T,null,x(o.groups,g=>(n(),v(m,{key:g.id,value:g.id.toString(),label:g.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,o.loading]])}const cs=P(G1,[["render",Y1]]),W1={name:"global_form_builder",props:{formData:{type:Object,required:!1,default(){return{}}},submitButtonText:{type:String,required:!1,default:"Save"},formFields:{type:Array,required:!0,default(){return[]}},disableSubmit:{type:Boolean,required:!1,default:!1}},methods:{handleSubmit(){this.$emit("submit",this.formData)}}},K1={class:"fcom_form_builder"},Z1=["innerHTML"],J1={key:8},Q1={key:9,class:"fcom_help_text"},X1=["innerHTML"];function eg(e,t,s,u,o,i){const m=ie,f=Je,h=be,g=ae,k=re,b=ve,S=As,w=Ye,$=Bs,y=pe,C=O,L=ge;return n(),r("div",K1,[a(L,{"label-position":"top",model:s.formData,onSubmit:q(e.doNothing,["prevent"])},{default:c(()=>[(n(!0),r(T,null,x(s.formFields,(V,I)=>(n(),v(y,{key:e.index,label:V.label},ye({default:c(()=>[V.type=="text"?(n(),v(m,{key:0,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F,placeholder:V.placeholder,type:V.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):V.type=="radio"?(n(),v(h,{key:1,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F},{default:c(()=>[(n(!0),r(T,null,x(V.options,(F,R)=>(n(),v(f,{key:R,value:F.value,label:F.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="select"?(n(),v(k,{key:2,class:"fcom_select",multiple:V.is_multiple,clearable:"",filterable:"",modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F,placeholder:V.placeholder},{default:c(()=>[(n(!0),r(T,null,x(V.options,(F,R)=>(n(),v(g,{key:R,label:F.label,value:F.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):V.type=="checkbox"?(n(),v(S,{key:3,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F},{default:c(()=>[(n(!0),r(T,null,x(V.options,(F,R)=>(n(),v(b,{key:R,value:F.value,label:F.label,class:"fcom_checkbox"},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="inline_checkbox"?(n(),v(b,{key:4,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F,"true-value":V.true_value||"yes","false-value":V.false_value||"no",class:"fcom_checkbox"},{default:c(()=>[M(d(V.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):V.type=="date"?(n(),v(w,{key:5,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F,type:V.data_type||"date","value-format":V.value_format||"YYYY-MM-DD",format:V.value_format||"YYYY-MM-DD",placeholder:V.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):V.type=="color_picker"?(n(),v($,{key:6,modelValue:s.formData[I],"onUpdate:modelValue":F=>s.formData[I]=F},null,8,["modelValue","onUpdate:modelValue"])):V.type=="raw_html"?(n(),r("div",{key:7,innerHTML:V.content},null,8,Z1)):(n(),r("div",J1,[l("pre",null,d(V),1)])),V.help_text?(n(),r("div",Q1,[l("p",{innerHTML:V.help_text},null,8,X1)])):_("",!0)]),_:2},[V.label?{name:"label",fn:c(()=>[M(d(V.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),s.disableSubmit?_("",!0):(n(),v(y,{key:0},{default:c(()=>[a(C,{class:"fcom_primary_button",onClick:q(i.handleSubmit,["prevent"])},{default:c(()=>[M(d(s.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const Co=P(W1,[["render",eg]]),tg={name:"CardViewIcon"},sg={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"};function og(e,t,s,u,o,i){return n(),r("svg",sg,[...t[0]||(t[0]=[Le('<rect x="0.5" y="0.5" width="159" height="157" rx="5.5" fill="transparent"></rect><rect x="0.5" y="0.5" width="159" height="157" rx="5.5" stroke="var(--fcom-secondary-border)"></rect><rect x="12.5" y="12.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="12.5" y="12.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 24.5714C20 22.0467 22.0467 20 24.5714 20H63.4286C65.9533 20 68 22.0467 68 24.5714V42.4286C68 44.9533 65.9533 47 63.4286 47H24.5714C22.0467 47 20 44.9533 20 42.4286V24.5714Z" fill="var(--fcom-primary-border)"></path><path d="M20 56C20 54.3431 21.3431 53 23 53H65C66.6569 53 68 54.3431 68 56C68 57.6569 66.6569 59 65 59H23C21.3431 59 20 57.6569 20 56Z" fill="var(--fcom-secondary-border)"></path><path d="M20 66C20 64.3431 21.3431 63 23 63H41C42.6569 63 44 64.3431 44 66C44 67.6569 42.6569 69 41 69H23C21.3431 69 20 67.6569 20 66Z" fill="var(--fcom-secondary-border)"></path><rect x="84.5" y="12.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="84.5" y="12.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M92 24.5714C92 22.0467 94.0467 20 96.5714 20H135.429C137.953 20 140 22.0467 140 24.5714V42.4286C140 44.9533 137.953 47 135.429 47H96.5714C94.0467 47 92 44.9533 92 42.4286V24.5714Z" fill="var(--fcom-primary-border)"></path><path d="M92 56C92 54.3431 93.3431 53 95 53H137C138.657 53 140 54.3431 140 56C140 57.6569 138.657 59 137 59H95C93.3431 59 92 57.6569 92 56Z" fill="var(--fcom-secondary-border)"></path><path d="M92 66C92 64.3431 93.3431 63 95 63H113C114.657 63 116 64.3431 116 66C116 67.6569 114.657 69 113 69H95C93.3431 69 92 67.6569 92 66Z" fill="var(--fcom-secondary-border)"></path><rect x="12.5" y="83.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="12.5" y="83.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M20 95.5714C20 93.0467 22.0467 91 24.5714 91H63.4286C65.9533 91 68 93.0467 68 95.5714V113.429C68 115.953 65.9533 118 63.4286 118H24.5714C22.0467 118 20 115.953 20 113.429V95.5714Z" fill="var(--fcom-primary-border)"></path><path d="M20 127C20 125.343 21.3431 124 23 124H65C66.6569 124 68 125.343 68 127C68 128.657 66.6569 130 65 130H23C21.3431 130 20 128.657 20 127Z" fill="var(--fcom-secondary-border)"></path><path d="M20 137C20 135.343 21.3431 134 23 134H41C42.6569 134 44 135.343 44 137C44 138.657 42.6569 140 41 140H23C21.3431 140 20 138.657 20 137Z" fill="var(--fcom-secondary-border)"></path><rect x="84.5" y="83.5" width="63" height="62" rx="3.5" fill="transparent"></rect><rect x="84.5" y="83.5" width="63" height="62" rx="3.5" stroke="var(--fcom-secondary-border)"></rect><path d="M92 95.5714C92 93.0467 94.0467 91 96.5714 91H135.429C137.953 91 140 93.0467 140 95.5714V113.429C140 115.953 137.953 118 135.429 118H96.5714C94.0467 118 92 115.953 92 113.429V95.5714Z" fill="var(--fcom-primary-border)"></path><path d="M92 127C92 125.343 93.3431 124 95 124H137C138.657 124 140 125.343 140 127C140 128.657 138.657 130 137 130H95C93.3431 130 92 128.657 92 127Z" fill="var(--fcom-secondary-border)"></path><path d="M92 137C92 135.343 93.3431 134 95 134H113C114.657 134 116 135.343 116 137C116 138.657 114.657 140 113 140H95C93.3431 140 92 138.657 92 137Z" fill="var(--fcom-secondary-border)"></path>',22)])])}const ig=P(tg,[["render",og]]),ng={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:cs,SlugInput:Et,ImageUploader:Re,LogoEmojiSelector:rs,TopicSelector:wo,ListViewIcon:H1,TimelineViewIcon:q1,FormBuilder:Co,ErrorAlerts:At,CardViewIcon:ig},props:{community:{required:!1,default:null},parent_id:{required:!1,default:null},savingCount:{required:!1,default:0},disable_redirect:{required:!1,default:!1}},data(){return{saving:!1,privacies:ho,formErrors:[],form:{title:"",slug:"",privacy:"private",parent_id:"",description:"",settings:{custom_lock_screen:"no",restricted_post_only:"no",verified_post_only:"no",emoji:"🚀",shape_svg:"",can_request_join:"yes",layout_style:"timeline",disable_layout_style:"no",show_sidebar:"yes",members_page_status:"members_only",document_library:"no",document_access:"members_only",media_gallery:"no",media_access:"members_only",document_upload:"admin_only"},topic_ids:[]},dataLoaded:!1,showingSections:["basic"],postOrderOptions:this.appVars.post_order_by_options,commentOrderOptions:this.appVars.comment_order_by_options,metaSettings:null,fetchingMetaBoxes:!1}},watch:{savingCount(){this.submit()}},computed:{isDefaultLockscreen(){return this.form.settings.custom_lock_screen=="no"&&this.form.privacy=="private"}},methods:{goToCustomization(){this.validateForm()&&(this.showingSections=["customization"])},getValidationErrors(){var t,s;const e=[];return(!this.form.title||!this.form.title.trim())&&e.push(this.$t("Space title is required.")),((t=this.form.settings)==null?void 0:t.topic_required)==="yes"&&!((s=this.form.topic_ids)!=null&&s.length)&&e.push(this.$t("Please select at least one topic when members are required to select a topic.")),e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(){if(this.form.id){const u=this.getValidationErrors();if(u.length){this.$notify.error(u[0]);return}}else if(!this.validateForm())return;this.saving=!0;let e="spaces",t={space:this.form},s=this.$post;if(this.form.id&&(e+="/"+this.form.id+"/by-id",t={space_id:this.form.id,data:{slug:this.form.slug,title:this.form.title,privacy:this.form.privacy,description:this.form.description,group_chat_support:this.form.group_chat_support,settings:this.form.settings,logo:this.form.logo,parent_id:this.form.parent_id??"",cover_photo:this.form.cover_photo,topic_ids:this.form.topic_ids}},s=this.$put,this.metaSettings)){let u={};this.each(this.metaSettings,(o,i)=>{u[i]=o.settings}),t.meta_settings=u}s(e,t).then(u=>{if(this.$eventBus.emit("reloadMenu"),!this.form.id&&!this.disable_redirect){let o=this.$router.resolve({name:"space_feeds",params:{space:u.space.slug}}).href;window.location.href=o;return}this.$notify.success(u.message),this.$emit("completed",u.space),u.redirect_url&&!this.disable_redirect&&(window.location.href=u.redirect_url)}).catch(u=>{this.form.id||(this.showingSections=["basic"]),this.$handleError(u)}).finally(()=>{this.saving=!1})},handleCoverPhotoUpload(e){this.form.cover_photo=e},handleLogoPhotoUpload(e){this.form.logo=e},fetchMetaBoxes(){this.community.id&&(this.fetchingMetaBoxes=!0,this.$get("spaces/"+this.community.slug+"/meta-settings",{space_id:this.community.id}).then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))}},mounted(){if(this.community&&this.community.id){this.community.chat_thread_id&&(this.community.group_chat_support="yes"),this.form=this.community;let e=[];this.community.topics&&this.each(this.community.topics,t=>{e.push(t.id)}),this.form.topic_ids=e,this.fetchMetaBoxes(this.community.id)}else this.parent_id?this.form.parent_id=this.parent_id:this.$route.query.parent_id&&(this.form.parent_id=this.$route.query.parent_id);this.form.id&&(this.showingSections=["basic","customization"]),this.dataLoaded=!0}},lg={key:0},ag={class:"fcom_form_section"},rg={class:"fcom_help_text"},cg={class:"fcom_form_section"},dg={style:{"font-weight":"bold"}},ug=["innerHTML"],_g={key:0},mg={class:"fcom_help_text"},hg={key:0},fg={key:1,class:"fcom_form_section"},pg={class:"fcom_lined_checkboxes"},gg={key:0,class:"fcom_pro_feature"},yg={key:0,class:"fcom_feature_nested"},vg={key:0,class:"fcom_pro_feature"},bg={key:1,class:"fcom_feature_nested"},kg={class:"fcom_form_section"},wg={class:"fcom_svg_radio_item"},Cg={class:"svg_radio_label"},$g={class:"fcom_svg_radio_item"},Sg={class:"svg_radio_label"},Vg={class:"fcom_svg_radio_item"},Mg={class:"svg_radio_label"},Lg={class:"fcom_help_text"},Tg={key:0},Fg={key:1},Pg={class:"fcom_form_section"},Ig={class:"fcom_help_text"},Eg=["href"],Ag={class:"fcom_image_uploader_wrapper"},Ug={class:"fcom_help_text"},Bg={class:"fcom_image_uploader_wrapper"},Dg={class:"fcom_help_text"},Rg={class:"fcom_space_form_bottom"},xg={class:"fcom_space_form_bottom"},Og={key:0},Hg={class:"fcom_form_section fcom_mt_20"};function jg(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=ie,h=pe,g=p("SlugInput"),k=p("space-group-selector"),b=ae,S=re,w=Je,$=be,y=ve,C=p("TimelineViewIcon"),L=p("ListViewIcon"),V=p("CardViewIcon"),I=p("topic-selector"),F=Be,R=p("EditPen"),B=j,U=O,A=p("Delete"),N=p("ImageUploader"),H=p("error-alerts"),z=ge,G=p("form-builder"),ne=se("loading");return n(),r("div",null,[a(z,{onSubmit:t[32]||(t[32]=q(E=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[33]||(t[33]=E=>o.form=E),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:c(()=>[o.showingSections.indexOf("basic")!==-1?(n(),r(T,{key:0},[o.form.id?_("",!0):(n(),r("h4",lg,d(e.$t("Basic Info")),1)),l("div",ag,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Space Title"),required:""},{default:c(()=>[a(f,{type:"text",placeholder:e.$t("Your Space Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>o.form.title=E)},{prepend:c(()=>{var E,Q;return[o.dataLoaded?(n(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=de=>{o.form.settings.emoji=de.emoji,o.form.logo=de.logo,o.form.settings.shape_svg=de.shape_svg}),config:{logo:o.form.logo,emoji:((E=o.form.settings)==null?void 0:E.emoji)||"",shape_svg:((Q=o.form.settings)==null?void 0:Q.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:c(()=>[a(g,{popMessage:e.$t("The URLs of this space posts will be changed to the new slug. If you have lots of contents in this space, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=E=>o.form.slug=E),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Space Slug (no space or special chars)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Description")},{default:c(()=>[a(f,{type:"textarea",rows:3,placeholder:e.$t("Space Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>o.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:c(()=>[o.dataLoaded?(n(),v(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=E=>o.form.parent_id=E),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",rg,[l("p",null,d(e.$t("Select a menu group to where this space will be added to the sidebar. If you do not select a menu group, it will be available on the all spaces page.")),1)])]),_:1},8,["label"])]),l("div",cg,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:c(()=>[a(S,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=E=>o.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:c(()=>[(n(!0),r(T,null,x(o.privacies,(E,Q)=>(n(),v(b,{key:Q,label:E.label,value:Q},{default:c(()=>[l("span",dg,d(e.$labelize(E.label)),1),l("p",{innerHTML:E.description},null,8,ug)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),r(T,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:c(()=>[a($,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=E=>o.form.settings.custom_lock_screen=E),class:""},{default:c(()=>[a(w,{value:"yes"},{default:c(()=>[M(d(e.$t("Custom Lock Screen")),1)]),_:1}),a(w,{value:"no"},{default:c(()=>[M(d(e.$t("Default Lock Screen")),1)]),_:1}),a(w,{disabled:!e.has_pro,value:"redirect"},{default:c(()=>[M(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),r("span",_g,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:c(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=E=>o.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",mg,[l("p",null,d(e.$t("This link will be used to redirect the non-members. This may be your sales page for this space")),1)])]),_:1},8,["label"])):_("",!0)],64)):_("",!0),i.isDefaultLockscreen?(n(),v(h,{key:1,style:{"margin-bottom":"0"}},{default:c(()=>[a(y,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=E=>o.form.settings.can_request_join=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),i.isDefaultLockscreen?(n(),v(h,{key:2},{default:c(()=>[a(y,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=E=>o.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Show Paywalls in Default Lock Screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),a(h,{label:e.$t("Who can view space members")},{default:c(()=>[a(S,{modelValue:o.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=E=>o.form.settings.members_page_status=E)},{default:c(()=>[a(b,{value:"members_only",label:e.$t("Members Only")},null,8,["label"]),a(b,{value:"admin_only",label:e.$t("Admin/Moderators Only")},null,8,["label"]),a(b,{value:"logged_in",label:e.$t("Any Logged in users")},null,8,["label"]),a(b,{value:"everybody",label:e.$t("Anyone")},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"])])],64)):_("",!0),o.showingSections.indexOf("customization")!==-1?(n(),r(T,{key:1},[o.form.id?_("",!0):(n(),r("h4",hg,d(e.$t("Customization")),1)),o.form.settings?(n(),r("div",fg,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:c(()=>[l("div",pg,[a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=E=>o.form.settings.restricted_post_only=E)},{default:c(()=>[M(d(e.$t("Only admin or moderators can create post")),1)]),_:1},8,["modelValue"]),a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.verified_post_only,"onUpdate:modelValue":t[12]||(t[12]=E=>o.form.settings.verified_post_only=E)},{default:c(()=>[M(d(e.$t("Only verified members can create posts (admins and moderators can always post)")),1)]),_:1},8,["modelValue"]),a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[13]||(t[13]=E=>o.form.settings.hide_members_count=E)},{default:c(()=>[M(d(e.$t("Hide Members count from spaces page (when members page access unavailable)")),1)]),_:1},8,["modelValue"]),a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.show_sidebar,"onUpdate:modelValue":t[14]||(t[14]=E=>o.form.settings.show_sidebar=E)},{default:c(()=>[M(d(e.$t("Show Right Sidebar on Space")),1)]),_:1},8,["modelValue"]),a(y,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.document_library,"onUpdate:modelValue":t[15]||(t[15]=E=>o.form.settings.document_library=E)},{default:c(()=>[M(d(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(n(),r("span",gg," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),o.form.settings.document_library=="yes"?(n(),r("div",yg,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:c(()=>[a($,{modelValue:o.form.settings.document_access,"onUpdate:modelValue":t[16]||(t[16]=E=>o.form.settings.document_access=E),class:"fcom_radio_group_inline"},{default:c(()=>[a(w,{value:"members_only"},{default:c(()=>[M(d(e.$t("Members of this space")),1)]),_:1}),a(w,{value:"logged_in"},{default:c(()=>[M(d(e.$t("Any Logged in users")),1)]),_:1}),a(w,{value:"everybody"},{default:c(()=>[M(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Who can upload the documents?")},{default:c(()=>[a($,{modelValue:o.form.settings.document_upload,"onUpdate:modelValue":t[17]||(t[17]=E=>o.form.settings.document_upload=E),class:"fcom_radio_group_inline"},{default:c(()=>[a(w,{value:"members_only"},{default:c(()=>[M(d(e.$t("Any Members")),1)]),_:1}),a(w,{value:"admin_only"},{default:c(()=>[M(d(e.$t("Admin/Moderators Only")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0),a(y,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.media_gallery,"onUpdate:modelValue":t[18]||(t[18]=E=>o.form.settings.media_gallery=E)},{default:c(()=>[M(d(e.$t("Enable Media Gallery for this space"))+" ",1),e.has_pro?_("",!0):(n(),r("span",vg," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),e.has_pro&&o.form.settings.media_gallery=="yes"?(n(),r("div",bg,[a(h,{label:e.$t("Media Gallery Access (View)")},{default:c(()=>[a($,{modelValue:o.form.settings.media_access,"onUpdate:modelValue":t[19]||(t[19]=E=>o.form.settings.media_access=E),class:"fcom_radio_group_inline"},{default:c(()=>[a(w,{value:"members_only"},{default:c(()=>[M(d(e.$t("Members of this space")),1)]),_:1}),a(w,{value:"logged_in"},{default:c(()=>[M(d(e.$t("Any Logged in users")),1)]),_:1}),a(w,{value:"everybody"},{default:c(()=>[M(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0)])]),_:1}),a(h,{label:e.$t("Default Post Sort By")},{default:c(()=>[a(S,{modelValue:o.form.settings.default_post_sort_by,"onUpdate:modelValue":t[20]||(t[20]=E=>o.form.settings.default_post_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:c(()=>[(n(!0),r(T,null,x(o.postOrderOptions,(E,Q)=>(n(),v(b,{key:Q,value:Q,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_post_sort_by,"onUpdate:modelValue":t[21]||(t[21]=E=>o.form.settings.disable_post_sort_by=E)},{default:c(()=>[M(d(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:c(()=>[a(S,{modelValue:o.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[22]||(t[22]=E=>o.form.settings.default_comment_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:c(()=>[(n(!0),r(T,null,x(o.commentOrderOptions,(E,Q)=>(n(),v(b,{key:Q,value:Q,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",kg,[l("h4",null,d(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:c(()=>[a($,{modelValue:o.form.settings.layout_style,"onUpdate:modelValue":t[23]||(t[23]=E=>o.form.settings.layout_style=E),class:"fcom_svg_radio_group"},{default:c(()=>[l("div",wg,[a(w,{value:"timeline"},{default:c(()=>[a(C,{style:{width:"100px",height:"auto"}}),l("p",Cg,d(e.$t("Timeline")),1)]),_:1})]),l("div",$g,[a(w,{value:"list"},{default:c(()=>[a(L,{style:{width:"100px",height:"auto"}}),l("p",Sg,d(e.$t("List")),1)]),_:1})]),l("div",Vg,[a(w,{value:"card"},{default:c(()=>[a(V,{style:{width:"100px",height:"auto"}}),l("p",Mg,d(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:c(()=>[a(y,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_layout_style,"onUpdate:modelValue":t[24]||(t[24]=E=>o.form.settings.disable_layout_style=E)},{default:c(()=>[M(d(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",Lg,[o.form.settings.disable_layout_style==="yes"?(n(),r("p",Tg,d(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(n(),r("p",Fg,d(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",Pg,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),v(h,{key:0,label:e.$t("Topic navigation")},{default:c(()=>[a(I,{creatable:!0,space_id:o.form.id,modelValue:o.form.topic_ids,"onUpdate:modelValue":t[25]||(t[25]=E=>o.form.topic_ids=E)},null,8,["space_id","modelValue"]),l("div",Ig,[l("p",null,[M(d(e.$t("Categorize your posts and allow members to filter spaces with the topic navigation bar. You can define up to 20 topics per space."))+" ",1),e.isAdmin()?(n(),r("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics.")),9,Eg)):_("",!0)])]),a(y,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.topic_required,"onUpdate:modelValue":t[26]||(t[26]=E=>o.form.settings.topic_required=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Make members select a topic")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),e.appVars.has_chat?(n(),v(h,{key:1,label:e.$t("Group Chat?")},{default:c(()=>[a(y,{"true-value":"yes","false-value":"no",modelValue:o.form.group_chat_support,"onUpdate:modelValue":t[27]||(t[27]=E=>o.form.group_chat_support=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Enable group chat for this space members")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:c(()=>[o.form.settings.og_image?(n(),v(F,{key:0,alt:e.$t("Thumbnail / Open Graph Image"),src:o.form.settings.og_image,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",Ag,[a(N,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.settings.og_image,confirm_remove:!0,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:t[28]||(t[28]=E=>{o.form.settings.og_image=E})},ye({remove:c(()=>[a(B,null,{default:c(()=>[a(A)]),_:1})]),_:2},[o.form.settings.og_image?{name:"trigger",fn:c(()=>[a(U,{"aria-label":e.$t("Edit image"),class:"fcom_plain_button"},{default:c(()=>[a(B,null,{default:c(()=>[a(R)]),_:1})]),_:1},8,["aria-label"])]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",Ug,[l("p",null,d(e.$t("Will be used on card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Featured Image (Recommended size: 1600x500) - Optional")},{default:c(()=>[o.form.cover_photo?(n(),v(F,{key:0,src:o.form.cover_photo,alt:e.$t("Featured Image Preview"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",Bg,[a(N,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.cover_photo,confirm_remove:!0,additionalData:{resize:!0,max_width:1600},onUploaded:i.handleCoverPhotoUpload},ye({remove:c(()=>[a(B,null,{default:c(()=>[a(A)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:c(()=>[a(U,{class:"fcom_plain_button"},{default:c(()=>[a(B,null,{default:c(()=>[a(R)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",Dg,[l("p",null,d(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),a(H,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),v(h,{key:2,style:{"margin-top":"45px"}},{default:c(()=>[l("div",Rg,[o.showingSections.indexOf("basic")===-1?(n(),v(U,{key:0,class:"plain_button",text:"",onClick:t[29]||(t[29]=()=>{o.showingSections=["basic"]})},{default:c(()=>[l("span",null,d(e.$t("Go Back")),1)]),_:1})):_("",!0),Y((n(),v(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[30]||(t[30]=E=>i.submit())},{default:c(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled"])),[[ne,o.saving]])])]),_:1}))])],64)):(n(),r(T,{key:2},[a(H,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:c(()=>[l("div",xg,[t[34]||(t[34]=l("span",null,null,-1)),a(U,{onClick:t[31]||(t[31]=E=>i.goToCustomization()),class:"fcom_primary_button"},{default:c(()=>[l("span",null,d(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),Y((n(),r("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),r("div",Og,[(n(!0),r(T,null,x(o.metaSettings,E=>(n(),r("div",Hg,[l("h4",null,d(E.section_title),1),a(G,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,o.fetchingMetaBoxes]])])}const ds=P(ng,[["render",jg]]),Ng={name:"CreateCorseForm",components:{FormBuilder:Co,SpaceGroupSelector:cs,TopicSelector:wo,SlugInput:Et,ImageUploader:Re,LogoEmojiSelector:rs,ErrorAlerts:At,CrepeEditor:ns},emits:["completed","close"],props:{course:{required:!1,default:{title:"",description:"",privacy:"public",course_type:"self_paced",cover_photo:"",parent_id:"",status:"draft",category_ids:[],settings:{emoji:"",custom_lock_screen:"no",shape_svg:"",disable_comments:"no",hide_members_count:"no"}}},savingCount:{required:!1,default:0},parent_id:{required:!1,default:null},disable_redirect:{required:!1,default:!1}},data(){return{saving:!1,privacies:jd,formErrors:[],form:{slug:"",title:"",description:"",privacy:"public",course_type:"self_paced",cover_photo:"",parent_id:"",status:"draft",category_ids:[],settings:{emoji:"",custom_lock_screen:"no",shape_svg:"",course_details:"",course_layout:"classic"}},courseTypes:Nd,dataLoaded:!1,metaSettings:null,fetchingMetaBoxes:!1,appReady:!1,courseInstructors:[],fetchingInstructors:!1}},watch:{savingCount(){this.submit(!1)}},methods:{getValidationErrors(){const e=[];return(!this.form.title||!this.form.title.trim())&&e.push(this.$t("Course title is required.")),(!this.form.description||!this.form.description.trim())&&e.push(this.$t("Short description is required.")),e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(e=!1){if(this.form.id){const o=this.getValidationErrors();if(o.length){this.$notify.error(o[0]);return}}else if(!this.validateForm())return;this.saving=!0;let t="admin/courses",s=this.form,u=this.$post;if(this.form.id&&(t+="/"+this.form.id,s={title:this.form.title,privacy:this.form.privacy,course_type:this.form.course_type,description:this.form.description,status:this.form.status,slug:this.form.slug,logo:this.form.logo,cover_photo:this.form.cover_photo,space_id:this.form.id,parent_id:this.form.parent_id,settings:this.form.settings,category_ids:this.form.category_ids},u=this.$put,this.form.created_by&&this.isAdmin()&&(s.created_by=this.form.created_by),this.metaSettings)){let o={};this.each(this.metaSettings,(i,m)=>{o[m]=i.settings}),s.meta_settings=o}u(t,s).then(o=>{if(!this.form.id&&!this.disable_redirect){let i=this.$getRouteLink("admin/manage-courses/edit/"+o.course.id+"/lessons");window.location.href=i,this.form={};return}this.$eventBus.emit("reloadMenu"),this.$notify.success(o.message||this.$t("Course has been created successfully")),this.$emit("completed",o.course),e&&this.$emit("close")}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1})},searchUsers(e=""){e&&e.length<3||this.fetchCourseInstructors(e)},handlePhotoUpload(e){this.form.cover_photo=e},fetchMetaBoxes(){this.course.id&&(this.fetchingMetaBoxes=!0,this.$get("admin/courses/"+this.course.id+"/meta-settings").then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))},fetchCourseInstructors(e=""){this.fetchingInstructors=!0,this.$get("admin/courses/"+this.course.id+"/instructors/search",{search:e}).then(t=>{this.courseInstructors=t.instructors}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingInstructors=!1})}},mounted(){var t,s,u,o,i;this.course.id?(this.form=this.course,this.form.created_by=parseInt(this.form.created_by),this.fetchMetaBoxes(),this.fetchCourseInstructors()):this.parent_id&&(this.form.parent_id=this.parent_id);const e=(s=(t=this.course)==null?void 0:t.settings)==null?void 0:s.course_type;e&&!((u=this.form)!=null&&u.course_type)&&(this.form.course_type=e),(!((i=(o=this.form)==null?void 0:o.settings)!=null&&i.course_layout)||!this.has_pro)&&(this.form.settings.course_layout="classic"),this.dataLoaded=!0,this.$nextTick(()=>{this.appReady=!0})}},zg={key:0},qg={class:"fcom_form_section"},Gg={class:"fcom_help_text"},Yg={class:"fcom_help_text"},Wg={class:"fcom_form_section"},Kg={style:{"font-weight":"bold"}},Zg={key:0},Jg={class:"fcom_help_text"},Qg={style:{"font-weight":"bold"}},Xg={class:"fcom_form_section"},ey={class:"fcom_lined_checkboxes"},ty={class:"fcom_checkbox_with_tooltip"},sy={key:0},oy={key:0},iy={class:"fcom_help_text"},ny={key:0,class:"fcom_form_section"},ly={class:"fcom_select_photo",style:{float:"left"}},ay=["src","alt"],ry={style:{float:"right",color:"#8492a6","font-size":"13px"}},cy={class:"fcom_lined_checkboxes"},dy={class:"fcom_form_section"},uy={class:"fcom_help_text"},_y=["href"],my={class:"fcom_image_uploader_wrapper"},hy={class:"fcom_help_text"},fy={class:"fcom_space_form_bottom"},py={key:0},gy={class:"fcom_form_section fcom_mt_20"},yy={key:1},vy=["href"];function by(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=ie,h=pe,g=p("SlugInput"),k=p("crepe-editor"),b=p("space-group-selector"),S=Je,w=be,$=ae,y=re,C=ve,L=p("InfoFilled"),V=j,I=Ie,F=p("topic-selector"),R=Be,B=p("EditPen"),U=O,A=p("Delete"),N=p("ImageUploader"),H=p("error-alerts"),z=ge,G=p("form-builder"),ne=se("loading");return e.hasFeature("has_course")?(n(),r("div",zg,[a(z,{onSubmit:t[23]||(t[23]=q(E=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[24]||(t[24]=E=>o.form=E),"label-position":"top","require-asterisk-position":"right"},{default:c(()=>[l("div",qg,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Course Title"),required:""},{default:c(()=>[a(f,{type:"text",ref:"titleInput",placeholder:e.$t("Your Course Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>o.form.title=E)},{prepend:c(()=>{var E,Q;return[o.dataLoaded?(n(),v(m,{key:0,custom_svg:!0,config:{logo:o.form.logo,emoji:(E=o.form.settings)==null?void 0:E.emoji,shape_svg:((Q=o.form.settings)==null?void 0:Q.shape_svg)||""},onUpdate:t[0]||(t[0]=de=>{o.form.settings.emoji=de.emoji,o.form.logo=de.logo,o.form.settings.shape_svg=de.shape_svg})},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:c(()=>[a(g,{popMessage:e.$t("The URLs of this course lessons will be changed to the new slug. If you have lots of lessons and sections in this course, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=E=>o.form.slug=E),description:e.$t("No spaces or special characters allowed. Only letters, numbers, hyphens, and underscores."),placeholder:e.$t("Course Slug (no spaces or special characters)")},null,8,["popMessage","is_inital_inactive","modelValue","description","placeholder"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Short Description"),required:""},{default:c(()=>[a(f,{type:"textarea",placeholder:e.$t("Course Description"),modelValue:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>o.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:c(()=>[o.appReady?(n(),v(k,{key:0,modelValue:o.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=E=>o.form.settings.course_details=E),autofocus:!1,placeholder:e.$t("Add any additional information or notes about this course here"),disable_media:!0},null,8,["modelValue","placeholder"])):_("",!0),l("div",Gg,[l("p",null,d(e.$t("This section will be displayed on the course landing page. Add extra details, notes, or instructions to help learners understand the course better.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:c(()=>[o.dataLoaded?(n(),v(b,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=E=>o.form.parent_id=E),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Yg,[l("p",null,d(e.$t("Select a menu group to where this course will be added to the sidebar. If you do not select a menu group, it will be available on the all courses page.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Status")},{default:c(()=>[a(w,{modelValue:o.form.status,"onUpdate:modelValue":t[6]||(t[6]=E=>o.form.status=E),class:"fcom_radio_group"},{default:c(()=>[a(S,{value:"published"},{default:c(()=>[M(d(e.$t("Published")),1)]),_:1}),a(S,{value:"draft"},{default:c(()=>[M(d(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",Wg,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:c(()=>[a(y,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=E=>o.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:c(()=>[(n(!0),r(T,null,x(o.privacies,(E,Q)=>(n(),v($,{key:Q,label:E.label,value:Q},{default:c(()=>[l("span",Kg,d(E.label),1),l("p",null,d(E.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),r(T,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:c(()=>[a(w,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=E=>o.form.settings.custom_lock_screen=E),class:"fcom_radio_group"},{default:c(()=>[a(S,{value:"yes"},{default:c(()=>[M(d(e.$t("Custom")),1)]),_:1}),a(S,{value:"no"},{default:c(()=>[M(d(e.$t("Default")),1)]),_:1}),a(S,{disabled:!e.has_pro,value:"redirect"},{default:c(()=>[M(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),r("span",Zg,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:c(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=E=>o.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Jg,[l("p",null,d(e.$t("This link will be used to redirect the unenrolled or public users. This may be your sales page for this course")),1)])]),_:1},8,["label"])):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),v(h,{key:1,style:{"margin-bottom":"0"}},{default:c(()=>[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=E=>o.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Show Paywalls in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),v(h,{key:2},{default:c(()=>[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_welcome_banner,"onUpdate:modelValue":t[11]||(t[11]=E=>o.form.settings.show_welcome_banner=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Show Welcome Banner in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)],64)):_("",!0),a(h,{label:e.$t("Enrollment Type")},{default:c(()=>[a(y,{"popper-class":"rich_select",modelValue:o.form.course_type,"onUpdate:modelValue":t[12]||(t[12]=E=>o.form.course_type=E),placeholder:e.$t("Select Type")},{default:c(()=>[(n(!0),r(T,null,x(o.courseTypes,(E,Q)=>(n(),v($,{key:Q,label:E.label,value:Q},{default:c(()=>[l("span",Qg,d(E.label),1),l("p",null,d(E.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),l("div",Xg,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:c(()=>[l("div",ey,[o.form.privacy=="public"&&o.form.course_type=="self_paced"?(n(),v(C,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.public_lesson_view,"onUpdate:modelValue":t[13]||(t[13]=E=>o.form.settings.public_lesson_view=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_comments,"onUpdate:modelValue":t[14]||(t[14]=E=>o.form.settings.disable_comments=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[15]||(t[15]=E=>o.form.settings.hide_members_count=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"]),l("div",ty,[a(C,{disabled:!e.has_pro,"true-value":"yes","false-value":"no","model-value":e.has_pro?o.form.settings.sequential_lesson_order:"no","onUpdate:modelValue":t[16]||(t[16]=E=>{o.form.settings.sequential_lesson_order=E}),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Lesson order enforcement"))+" ",1),e.has_pro?_("",!0):(n(),r("span",sy,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled","model-value"]),a(I,{class:"box-item fcom_checkbox_tooltip",effect:"dark",placement:"right-end"},{content:c(()=>[M(d(e.$t("Your members will have to complete each lesson")),1),t[25]||(t[25]=l("br",null,null,-1)),M(" "+d(e.$t("in order before moving onto the next one.")),1)]),default:c(()=>[a(V,null,{default:c(()=>[a(L)]),_:1})]),_:1})])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:c(()=>[a(w,{modelValue:o.form.settings.course_layout,"onUpdate:modelValue":t[17]||(t[17]=E=>o.form.settings.course_layout=E),class:"fcom_radio_group"},{default:c(()=>[a(S,{value:"classic"},{default:c(()=>[M(d(e.$t("Classic")),1)]),_:1}),a(S,{disabled:!e.has_pro,value:"modern"},{default:c(()=>[M(d(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(n(),r("span",oy,"("+d(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",iy,[l("p",null,d(e.$t("Classic is the default layout. For a more visual and engaging experience, the Modern layout displays the featured image or embedded video thumbnail.")),1)])]),_:1},8,["label"])]),o.form.id?(n(),r("div",ny,[l("h4",null,d(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:c(()=>[a(y,{disabled:!e.isAdmin(),class:"rich_select","fit-input-width":"",filterable:"",remote:"",loading:o.fetchingInstructors,"remote-method":i.searchUsers,placeholder:e.$t("Select User"),modelValue:o.form.created_by,"onUpdate:modelValue":t[18]||(t[18]=E=>o.form.created_by=E)},{default:c(()=>[(n(!0),r(T,null,x(o.courseInstructors,E=>(n(),v($,{class:"fcom_with_photo_option",key:E.ID,label:E.display_name+" ("+(E.user_email||E.ID)+")",value:E.ID},{default:c(()=>[l("span",ly,[l("img",{src:E.photo,alt:E.display_name},null,8,ay),l("span",null,d(E.display_name),1)]),l("span",ry,d(E.user_email||E.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["disabled","loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),a(h,null,{default:c(()=>[l("div",cy,[a(C,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_instructor_view,"onUpdate:modelValue":t[19]||(t[19]=E=>o.form.settings.hide_instructor_view=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),o.form.settings.hide_instructor_view!="yes"?(n(),v(C,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[20]||(t[20]=E=>o.form.settings.show_instructor_students_count=E),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",dy,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),v(h,{key:0,label:e.$t("Topic navigation")},{default:c(()=>[a(F,{modelValue:o.form.category_ids,"onUpdate:modelValue":t[21]||(t[21]=E=>o.form.category_ids=E),creatable:!0},null,8,["modelValue"]),l("div",uy,[l("p",null,d(e.$t("Categorize your course and allow members to filter courses with the topic navigation bar in the courses directory. You can define up to 20 topics per course.")),1),l("p",null,[e.isAdmin()?(n(),r("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics")),9,_y)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:c(()=>[o.form.cover_photo?(n(),v(R,{key:0,alt:e.$t("Cover Photo"),src:o.form.cover_photo,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",my,[a(N,{isTextBtn:!1,can_remove:!!o.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:i.handlePhotoUpload},ye({remove:c(()=>[a(V,null,{default:c(()=>[a(A)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:c(()=>[a(U,{class:"fcom_plain_button"},{default:c(()=>[a(V,null,{default:c(()=>[a(B)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",hy,[l("p",null,d(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(H,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),v(h,{key:1,style:{"margin-top":"45px"}},{default:c(()=>[l("div",fy,[t[26]||(t[26]=l("span",null,null,-1)),a(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[22]||(t[22]=E=>i.submit()),loading:o.saving},{default:c(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),Y((n(),r("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),r("div",py,[(n(!0),r(T,null,x(o.metaSettings,E=>(n(),r("div",gy,[l("h4",null,d(E.section_title),1),a(G,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,o.fetchingMetaBoxes]])])):(n(),r("div",yy,[l("p",null,d(e.$t("Course Module is disabled. Please enable the course module first")),1),l("a",{class:"el-button el-button--default fcom_primary_button fcom_mt_10",href:e.$getRouteLink("admin/settings/features")},d(e.$t("Go to features settings")),9,vy)]))}const ky=P(Ng,[["render",by]]),wy={name:"SpaceCourseSelector",components:{SpaceIcon:ze},emits:["update:modelValue","selectedType","selectedSlug"],props:{modelValue:{type:[String,Number,Array],default:""},placeholder_text:{type:String,default:""},is_multiple:{type:Boolean,default:!1},memberships:{type:Array,default:[]}},data(){return{all_spaces:[],selected_spaces:"",loading:!1,formattedSpaceGroups:[],app_ready:!1}},watch:{selected_spaces(e){this.is_multiple?this.$emit("update:modelValue",Array.isArray(e)?e:[]):this.$emit("update:modelValue",e||"")}},methods:{isMemberOfSpace(e){return this.memberships&&this.memberships.includes(e.toString())},fetch(){this.loading=!0,this.$get("admin/all_space_courses").then(e=>{this.all_spaces=e.all_spaces,this.formatSpaceGroups()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},emitChanges(){this.$emit("update:modelValue",this.selected_spaces||"");const e=Array.isArray(this.selected_spaces)&&this.selected_spaces.length?this.selected_spaces[0]:this.selected_spaces,t=this.all_spaces.find(s=>s.id==e);this.$emit("selectedSlug",(t==null?void 0:t.slug)||""),this.$emit("selectedType",(t==null?void 0:t.type)=="course"?"course":"space")},formatSpaceGroups(){if(this.all_spaces.length==0)return;let e=this.all_spaces,t=this.appVars.space_groups,s=[],u=[];this.each(t,i=>{let m=e.filter(f=>{let h=f.parent_id==i.id;return h&&u.push(f.slug),h});m.length&&s.push({label:i.title,spaces:m})});let o=e.filter(i=>i.parent_id===null);o&&o.length&&s.push({label:this.$t("Uncategorized"),spaces:o}),this.formattedSpaceGroups=s}},mounted(){this.is_multiple?this.selected_spaces=Array.isArray(this.modelValue)?this.modelValue:[]:this.selected_spaces=this.modelValue||"",this.fetch(),this.app_ready=!0}},Cy={key:0,class:"fcom_space_title"},$y={key:0},Sy={key:1};function Vy(e,t,s,u,o,i){const m=p("SpaceIcon"),f=ae,h=Wt,g=re,k=se("loading");return o.app_ready?(n(),v(g,{key:0,onChange:i.emitChanges,modelValue:o.selected_spaces,"onUpdate:modelValue":t[0]||(t[0]=b=>o.selected_spaces=b),filterable:"",multiple:s.is_multiple,placeholder:s.placeholder_text,style:{width:"100%"}},{default:c(()=>[(n(!0),r(T,null,x(o.formattedSpaceGroups,b=>Y((n(),v(h,{key:b.label,label:b.label},{default:c(()=>[(n(!0),r(T,null,x(b.spaces,S=>(n(),v(f,{key:S.slug,label:S.title,disabled:i.isMemberOfSpace(S.id),value:S.id.toString()},{default:c(()=>[S.id?(n(),r("span",Cy,[a(m,{space_profile:S},null,8,["space_profile"]),l("span",null,[M(d(e.getExcerpt(S.title,50))+" ",1),S.type=="course"?(n(),r("span",$y," ("+d(e.$t("course"))+")",1)):_("",!0)])])):(n(),r("span",Sy,d(e.getExcerpt(S.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[k,o.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const us=P(wy,[["render",Vy]]),My={name:"SidebarLinkForm",components:{SpaceGroupSelector:cs,LogoEmojiSelector:rs,SpaceCourseSelector:us,ErrorAlerts:At},emits:["completed"],data(){return{saving:!1,formErrors:[],form:{title:"",privacy:"public",parent_id:"",settings:{permalink:"",new_tab:"yes",emoji:"🔗",shape_svg:"",memberships:[]}},dataLoaded:!1}},props:{link:{type:Object,default:()=>({})},parent_id:{type:[Number,String],default:null}},methods:{validateForm(){return this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push(this.$t("Link title is required.")),(!this.form.settings.permalink||!this.form.settings.permalink.trim())&&this.formErrors.push(this.$t("URL cannot be empty.")),this.formErrors.length===0},saveSettings(){this.validateForm()&&(this.saving=!0,this.$post("admin/links",{link:this.form}).then(e=>{this.$eventBus.emit("reloadMenu"),this.$emit("completed",e.link),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))}},mounted(){this.link&&this.link.id?this.form=this.link:this.parent_id?this.form.parent_id=this.parent_id:this.$route.query.parent_id&&(this.form.parent_id=this.$route.query.parent_id),this.dataLoaded=!0}},Ly={class:"fcom_form_section"},Ty={class:"fcom_help_text"},Fy={class:"fcom_help_text"},Py={class:"fcom_help_text"},Iy={key:0},Ey={key:1};function Ay(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=ie,h=pe,g=ve,k=p("space-group-selector"),b=Je,S=be,w=p("SpaceCourseSelector"),$=p("error-alerts"),y=O,C=ge,L=se("loading");return n(),v(C,{onSubmit:t[8]||(t[8]=q(V=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[9]||(t[9]=V=>o.form=V),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:c(()=>[l("div",Ly,[a(h,{label:e.$t("Link Title"),required:""},{default:c(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=V=>o.form.title=V)},{prepend:c(()=>{var V,I;return[o.dataLoaded?(n(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=F=>{o.form.settings.emoji=F.emoji,o.form.logo=F.logo,o.form.settings.shape_svg=F.shape_svg}),config:{logo:o.form.logo,emoji:((V=o.form.settings)==null?void 0:V.emoji)||"",shape_svg:((I=o.form.settings)==null?void 0:I.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Permalink"),required:""},{default:c(()=>[a(f,{placeholder:e.$t("URL of the link"),modelValue:o.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=V=>o.form.settings.permalink=V)},null,8,["placeholder","modelValue"]),l("div",Ty,[a(g,{modelValue:o.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=V=>o.form.settings.new_tab=V),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:c(()=>[o.dataLoaded?(n(),v(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=V=>o.form.parent_id=V),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Fy,[l("p",null,d(e.$t("Select a menu group to where this link will be added to the sidebar.")),1)])]),_:1},8,["label"]),a(h,{label:e.$t("Visibility")},{default:c(()=>[a(S,{modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=V=>o.form.privacy=V)},{default:c(()=>[a(b,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(b,{label:e.$t("Logged-in users only"),value:"logged_in"},null,8,["label"]),a(b,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["modelValue"]),l("div",Py,[l("p",null,d(e.$t("Select who can see this link.")),1)])]),_:1},8,["label"]),o.form.privacy=="members_only"?(n(),v(h,{key:0,label:e.$t("Select Space/Course Memberships")},{default:c(()=>[a(w,{modelValue:o.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=V=>o.form.settings.membership_ids=V),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a($,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:c(()=>[Y((n(),v(y,{class:"fcom_primary_button",disabled:o.saving,onClick:t[7]||(t[7]=V=>i.saveSettings())},{default:c(()=>[o.form.id?(n(),r("span",Iy,d(e.$t("Update")),1)):(n(),r("span",Ey,d(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[L,o.saving]])]),_:1})])]),_:1},8,["modelValue"])}const Uy=P(My,[["render",Ay]]),By={name:"SpaceIcon"},Dy={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"};function Ry(e,t,s,u,o,i){return n(),r("svg",Dy,[...t[0]||(t[0]=[Le('<g><path d="M64,42c-13.2,0-24,10.8-24,24s10.8,24,24,24s24-10.8,24-24S77.2,42,64,42z M64,82c-8.8,0-16-7.2-16-16s7.2-16,16-16 s16,7.2,16,16S72.8,82,64,82z"></path><path d="M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9 l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"></path><path d="M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"></path><path d="M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20 c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"></path><path d="M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"></path><path d="M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1 c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"></path></g>',1)])])}const xy=P(By,[["render",Ry]]),Oy={name:"CourseIcon"},Hy={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function jy(e,t,s,u,o,i){return n(),r("svg",Hy,[...t[0]||(t[0]=[l("path",{d:"M10.734 5.84746L14.7114 6.9072M9.88139 9.01146L11.8701 9.54132M9.98031 14.9723L10.7758 15.1843C13.0258 15.7838 14.1508 16.0835 15.037 15.5747C15.9233 15.0659 16.2247 13.9473 16.8276 11.71L17.6802 8.54599C18.2831 6.3087 18.5845 5.19006 18.0728 4.30879C17.5611 3.42752 16.4362 3.12778 14.1862 2.52831L13.3907 2.31636C11.1407 1.71688 10.0157 1.41714 9.12948 1.92594C8.24322 2.43474 7.94178 3.55338 7.3389 5.79067L6.4863 8.95466C5.88342 11.1919 5.58198 12.3106 6.09367 13.1919C6.60536 14.0731 7.73034 14.3729 9.98031 14.9723Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),l("path",{d:"M9.99996 17.4559L9.20634 17.672C6.96165 18.2832 5.83931 18.5889 4.95512 18.0701C4.07093 17.5513 3.7702 16.4107 3.16874 14.1295L2.31814 10.9035C1.71668 8.62232 1.41595 7.48174 1.92643 6.58318C2.36802 5.80591 3.33329 5.83421 4.58329 5.83411",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])])}const Ny=P(Oy,[["render",jy]]),zy={name:"SpaceCreateModal",components:{Drawer:ko,CreateSpaceForm:ds,CreateCourseForm:ky,SidebarLinkForm:Uy,ArrowLeftBold:Gs,SpaceIcon:xy,CourseIcon:Ny,Link:Ys},data(){return{step:"choose_type",parent_id:null,showCreateSpaceModal:!1,select_type:"space_form",disable_redirect:!1,enteredForm:!1}},computed:{currentTitle(){return this.step==="choose_type"?this.$t("Choose a Space Type"):this.step==="space_form"?this.$t("Create a Discussion Space"):this.step==="course_form"?this.$t("Create a Course"):this.step==="link_form"?this.$t("Create a Link"):""},leaveMessage(){return this.enteredForm?this.$t("Some settings have been changed. Are you sure to leave this page?"):this.$t("Closing will discard your changes. Are you sure?")}},watch:{showCreateSpaceModal(e){e||(this._resetState(),this._clearUrlQuery())}},methods:{handleNextStep(){this.enteredForm=!0,this.step=this.select_type},_resetState(){this.step="choose_type",this.select_type="space_form",this.enteredForm=!1},_clearUrlQuery(){const{create_space:e,parent_id:t,...s}=this.$route.query;e===void 0&&t===void 0||this.$router.replace({query:s})},handleCompleted(e){this.enteredForm=!1,this.parent_id=null,this.showCreateSpaceModal=!1,this.$eventBus.emit("spaceCreated",e)}},beforeUnmount(){this.$eventBus.off("createSpaceModal")},created(){this.$eventBus.on("createSpaceModal",e=>{const t=this.$route.query.parent_id||null;this._resetState(),this.showCreateSpaceModal=!0,this.parent_id=e&&e.parent_id||t||null,e&&(this.disable_redirect=!!e.disable_redirect,e.spaceConfig?(this.step="space_form",this.select_type="space_form",this.enteredForm=!0):e.course_config&&(this.select_type="course_form",this.step="course_form",this.enteredForm=!0))})},mounted(){this.$router.isReady().then(()=>{const{create_space:e,parent_id:t}=this.$route.query;e==="yes"&&t&&this.$eventBus.emit("createSpaceModal",{parent_id:t})})}},qy={class:"dialog_header"},Gy={class:"dialog_left"},Yy={class:"dialog_body"},Wy={key:0,class:"space-type-selector"},Ky={class:"space-cards"},Zy={class:"space-card-label"},Jy={class:"space-card-label"},Qy={key:0,class:"space-card-note"},Xy={class:"space-card-label"},ev={key:0,class:"space-card-note"},tv={class:"dialog_footer"};function sv(e,t,s,u,o,i){const m=p("ArrowLeftBold"),f=j,h=O,g=p("SpaceIcon"),k=p("CourseIcon"),b=p("Link"),S=p("create-space-form"),w=p("create-course-form"),$=p("sidebar-link-form"),y=p("Drawer");return n(),v(y,{modelValue:o.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=C=>o.showCreateSpaceModal=C),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":o.enteredForm,"close-confirmation-message":i.leaveMessage,drawerClass:"fcom_space_create_drawer"},ye({header:c(()=>[l("div",qy,[l("div",Gy,[o.step!="choose_type"?(n(),v(h,{key:0,"aria-label":e.$t("Back"),onClick:t[0]||(t[0]=C=>o.step="choose_type"),text:"",size:"small"},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])):_("",!0),l("h4",null,d(i.currentTitle),1)])])]),default:c(()=>[l("div",Yy,[o.step=="choose_type"?(n(),r("div",Wy,[l("div",Ky,[l("div",{onClick:t[1]||(t[1]=C=>o.select_type="space_form"),class:D([{"is-active":o.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:c(()=>[a(g)]),_:1}),l("span",Zy,d(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=C=>!!e.hasFeature("has_course")&&(o.select_type="course_form")),class:D([{"is-active":o.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:c(()=>[a(k)]),_:1}),l("span",Jy,d(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(n(),r("span",Qy,d(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=C=>!!e.appVars.pro&&(o.select_type="link_form")),class:D([{"is-active":o.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:c(()=>[a(b)]),_:1}),l("span",Xy,d(e.$t("Link")),1),e.appVars.pro?_("",!0):(n(),r("span",ev,d(e.$t("Pro Required")),1))],2)])])):o.step=="space_form"?(n(),v(S,{key:1,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="course_form"?(n(),v(w,{key:2,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="link_form"?(n(),v($,{key:3,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[o.step=="choose_type"?{name:"footer",fn:c(()=>[l("div",tv,[a(h,{disabled:!o.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=C=>i.handleNextStep())},{default:c(()=>[M(d(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const ov=P(zy,[["render",sv]]),iv={name:"ExpandIcon"},nv={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function lv(e,t,s,u,o,i){return n(),r("svg",nv,[...t[0]||(t[0]=[l("path",{d:"M14 2H18V6",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M12 8L18 2",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M6 18H2V14",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M8 12L2 18",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const _s=P(iv,[["render",lv]]),av={name:"ReportContentModal",data(){return{reportConfig:null,showModal:!1,saving:!1,contentType:"",reportReason:"",reportExplanation:""}},computed:{currentTitle(){return this.contentType=="comment"?this.$t("Report Comment"):this.$t("Report Post")}},methods:{closeModal(){this.showModal=!1},showReportContentModal(e){this.showModal=!0,this.reportReason="",this.reportExplanation="",this.contentType=e.type,this.reportConfig=e.reportConfig},validateAndSubmit(){if(!this.reportReason){this.$handleError(this.$t("Please select a reason for reporting this content"));return}this.submitReport()},getParentId(){return this.contentType=="comment"?this.reportConfig.id:null},getPostId(){return this.contentType=="post"?this.reportConfig.id:this.reportConfig.post_id},submitReport(){this.saving=!0,this.$post("moderation/report",{content_type:this.contentType,user_id:this.auth.user_id,post_id:this.getPostId(),parent_id:this.getParentId(),reason:this.reportReason,explanation:this.reportExplanation}).then(e=>{this.$notify.success(e.message),this.$eventBus.emit("updateModerationReport",{content:e.content,action:"reported"}),this.closeModal()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},created(){this.$eventBus.on("showReportContentModal",this.showReportContentModal)},beforeUnmount(){this.$eventBus.off("showReportContentModal",this.showReportContentModal)}},rv={class:"dialog_header"},cv={class:"dialog_left"},dv={class:"dialog_body"},uv={class:"fcom_report_content_form"},_v={class:"dialog_footer"};function mv(e,t,s,u,o,i){const m=ae,f=re,h=pe,g=ie,k=ge,b=O,S=ke;return o.showModal?(n(),v(S,{key:0,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,width:e.drawerWidth,modelValue:o.showModal,"onUpdate:modelValue":t[4]||(t[4]=w=>o.showModal=w),direction:"rtl",onClose:i.closeModal},{header:c(()=>[l("div",rv,[l("div",cv,[l("h4",null,d(i.currentTitle),1)])])]),footer:c(()=>[l("div",_v,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=w=>i.closeModal())},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=w=>i.validateAndSubmit()),loading:o.saving},{default:c(()=>[M(d(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:c(()=>[l("div",dv,[l("div",uv,[a(k,{ref:"reportForm","label-position":"top"},{default:c(()=>[a(h,{label:e.$t("Reason")},{default:c(()=>[a(f,{modelValue:o.reportReason,"onUpdate:modelValue":t[0]||(t[0]=w=>o.reportReason=w),placeholder:e.$t("Please select a reason for reporting this content")},{default:c(()=>[(n(!0),r(T,null,x(e.appVars.report_reasons,(w,$)=>(n(),v(m,{key:$,label:w,value:$},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:c(()=>[a(g,{modelValue:o.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=w=>o.reportExplanation=w),placeholder:e.$t("Provide an explanation (Optional)"),type:"textarea",rows:4,maxlength:1e3,"show-word-limit":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},512)])])]),_:1},8,["width","modelValue","onClose"])):_("",!0)}const hv=P(av,[["render",mv]]),fv={name:"Pagination",emits:["fetch","per_page_change"],props:{pagination:{required:!0,type:Object},extra_sizes:{required:!1,type:Array,default(){return[]}},hide_on_single:{required:!1,type:Boolean,default(){return!0}}},computed:{page_sizes(){const e=[];this.pagination.per_page<10&&e.push(this.pagination.per_page);const t=[10,20,50,80,100,120,150];return[...e,...t,...this.extra_sizes]},pager_layout(){return this.isMobile?"total, sizes, jumper, prev, next":"total, sizes, jumper , prev, pager, next"}},methods:{changePage(e){this.pagination.page=e,this.$emit("fetch")},changeSize(e){this.pagination.per_page=e,this.$emit("per_page_change",e),this.$emit("fetch")}}},pv={class:"fcom_pagination_wrap"};function gv(e,t,s,u,o,i){const m=Go;return n(),r("div",pv,[a(m,{background:!1,size:"small","pager-count":5,layout:i.pager_layout,onCurrentChange:i.changePage,onSizeChange:i.changeSize,"hide-on-single-page":s.hide_on_single,"current-page":s.pagination.page,"page-sizes":i.page_sizes,"page-size":s.pagination.per_page,total:s.pagination.total},null,8,["layout","onCurrentChange","onSizeChange","hide-on-single-page","current-page","page-sizes","page-size","total"])])}const $e=P(fv,[["render",gv]]),yv={name:"ReportReviewModal",components:{Pagination:$e},data(){return{isOpen:!1,loading:!1,content:{},postReports:[],report:null,type:null,ignoring:!1,unpublishing:!1,pagination:{page:1,per_page:10,total:0}}},computed:{getReason(){return e=>this.appVars.report_reasons[e]},isContentLive(){var e;return((e=this.content)==null?void 0:e.status)=="published"},getPublishBtnText(){return this.isContentLive?this.$t("Dismiss Reports"):this.$t("Approve")+" "+this.$t(this.ucFirst(this.type))},getUnpublishBtnText(){return this.isContentLive?this.$t("Unpublish")+" "+this.$t(this.ucFirst(this.type)):this.$t("Remove")+" "+this.$t(this.ucFirst(this.type))}},methods:{closeModal(){this.isOpen=!1,this.content={},this.type=null,this.postReports=[],this.report=null,this.pagination={page:1,per_page:10,total:0}},showReportReviewModal(e){this.isOpen=!0,this.content=e.content,this.type=e.type,this.getPostReports()},getPostReports(){var t;this.loading=!0;let e={page:this.pagination.page,per_page:this.pagination.per_page,content_type:this.type,space_id:(t=this.content)==null?void 0:t.space_id};this.type=="comment"?e.parent_id=this.content.id:e.post_id=this.content.id,this.$get("moderation/reports",e).then(s=>{this.postReports=s.reports.data,this.report=s.reports.data[0]||null,this.pagination.total=s.reports.total}).catch(s=>{this.$handleError(s)}).finally(()=>{this.loading=!1})},ignoreReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.ignoring=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"ignored"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"ignored",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.ignoring=!1})},unpublishReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.unpublishing=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"unpublished"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"unpublished",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.unpublishing=!1})}},created(){this.$eventBus.on("showReportReviewModal",this.showReportReviewModal)},beforeUnmount(){this.$eventBus.off("showReportReviewModal",this.showReportReviewModal)}},vv={class:"dialog_body"},bv={class:"report_details"},kv={class:"report_details_header"},wv={class:"report_details_header_left"},Cv={class:"report_details_header_right"},$v={key:0},Sv={key:1},Vv={key:1},Mv={class:"report_reason"},Lv=["title"],Tv={key:0,class:"report_details_body"},Fv=["textContent"],Pv=["aria-label"],Iv={class:"dialog_footer report_footer"};function Ev(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=J,g=p("Pagination"),k=O,b=ke;return n(),v(b,{modelValue:o.isOpen,"onUpdate:modelValue":t[3]||(t[3]=S=>o.isOpen=S),"modal-class":"fcom_common_dialog",id:"fluent_comminity_body",width:e.dialogWidth,"append-to-body":!0,"close-on-click-modal":!1,direction:"rtl",onClose:i.closeModal},{footer:c(()=>[l("div",Iv,[a(k,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=S=>i.unpublishReport()),loading:o.unpublishing,disabled:!o.loading&&!o.report},{default:c(()=>[M(d(i.getUnpublishBtnText),1)]),_:1},8,["loading","disabled"]),a(k,{class:"fcom_primary_button",onClick:t[2]||(t[2]=S=>i.ignoreReport()),loading:o.ignoring,disabled:!o.loading&&!o.report},{default:c(()=>[M(d(i.getPublishBtnText),1)]),_:1},8,["loading","disabled"])])]),default:c(()=>{var S,w;return[l("div",vv,[l("h4",null,d(e.$t("Reports")+" ("+((w=(S=o.content)==null?void 0:S.meta)==null?void 0:w.reports_count)+")"),1),l("div",bv,[o.loading?(n(),v(h,{key:1,rows:5,animated:!0})):(n(!0),r(T,{key:0},x(o.postReports,$=>(n(),r("div",{key:$.id,class:"report_details_item"},[l("div",kv,[l("div",wv,[$.reporter?(n(),v(m,{key:0,with_level:!1,xprofile:$.reporter},null,8,["xprofile"])):_("",!0)]),l("div",Cv,[!$.reporter&&!i.getReason($.reason)?(n(),r("div",$v,d(e.$t("Flagged automatically by the site rule")),1)):(n(),r("div",Sv,[$.reporter?(n(),v(f,{key:0,show_verified:!1,xprofile:$.reporter},null,8,["xprofile"])):(n(),r("span",Vv,d(e.$t("By System ")),1)),i.getReason($.reason)?(n(),r(T,{key:2},[l("span",null,d(e.$t("reported for ")),1),l("span",Mv,d(i.getReason($.reason)),1)],64)):_("",!0)])),l("div",{title:$.created_at,class:"meta_line"},d(e.humanDateDiff($.created_at)),9,Lv)])]),$.explanation?(n(),r("div",Tv,[l("div",{textContent:d($.explanation)},null,8,Fv)])):_("",!0)]))),128)),o.pagination.total?(n(),r("div",{key:2,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(g,{hide_on_single:!0,onFetch:t[0]||(t[0]=$=>i.getPostReports()),pagination:o.pagination},null,8,["pagination"])],8,Pv)):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const Av=P(yv,[["render",Ev]]),Uv={name:"PreviewPostModal",components:{Feed:ot},data(){return{loading:!1,isOpen:!1,previewData:null,allSpaces:this.appVars.auth.spaces}},methods:{closeModal(){this.isOpen=!1,this.previewData=null},showPreviewPostModal(e){if(e!=null&&e.message){if(!(e!=null&&e.space)&&!(e!=null&&e.is_editing)){this.$handleError({message:this.$t("Please select a space to preview.")});return}}else{this.$handleError({message:this.$t("Please write a message to preview.")});return}this.isOpen=!0,this.preparePreviewData(e),this.generatePreview()},preparePreviewData(e){var t;this.previewData={...e,xprofile:(t=e.author)!=null&&t.name?{display_name:e.author.name,avatar:e.author.avatar}:this.appVars.auth,space:this.allSpaces[e==null?void 0:e.space],created_at:dayjs.utc().subtract(this.appVars.date_offset,"s").format("YYYY-MM-DD HH:mm:ss"),content_type:this.determineContentType(e),meta:this.prepareMetadata(e),terms:this.processTopicIds(e)}},determineContentType(e){return e!=null&&e.survey?"survey":e!=null&&e.document_ids?"document":"post"},prepareMetadata(e){return{...e==null?void 0:e.meta,survey_config:e==null?void 0:e.survey,document_lists:e==null?void 0:e.document_ids}},processTopicIds(e){let t=e==null?void 0:e.topic_ids;return t?(t=Array.isArray(t)?t:[t],t.map(s=>this.currentTopics(e==null?void 0:e.space).find(u=>u.id==s))):[]},currentTopics(e){var s;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},generatePreview(){this.loading=!0,this.$post("feeds/markdown-preview",{text:this.previewData.message,feed:this.previewData,with:["meta"]}).then(e=>{this.previewData.message_rendered=e.html,this.previewData.meta={...this.previewData.meta,...e.meta}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},created(){this.$eventBus.on("showPreviewPostModal",this.showPreviewPostModal)},beforeUnmount(){this.$eventBus.off("showPreviewPostModal",this.showPreviewPostModal)}};function Bv(e,t,s,u,o,i){const m=J,f=O,h=p("Feed"),g=Pe,k=ke;return o.previewData?(n(),v(k,{key:0,modelValue:o.isOpen,"onUpdate:modelValue":t[0]||(t[0]=b=>o.isOpen=b),class:"fcom_feed_modal",width:e.dialogWidth,"align-center":!0,"append-to-body":!0,"close-on-click-modal":!1,onClose:i.closeModal},{default:c(()=>[a(g,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:c(()=>[o.loading?(n(),v(m,{key:0,rows:4,animated:!0})):(n(),v(h,{key:1,feed:o.previewData,is_single:!0,is_preview:!0,show_actions:!1,show_footer:!1},{after_feed_actions:c(()=>[a(f,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:i.closeModal,text:""},null,8,["onClick"])]),_:1},8,["feed"]))]),_:1},512)]),_:1},8,["modelValue","width","onClose"])):_("",!0)}const Dv=P(Uv,[["render",Bv]]),Rv={name:"UnfinishedChangesModal",emits:["proceed"],data(){return{isVisible:!1,message:""}},methods:{handleCancel(){this.isVisible=!1,window.fcom_pending_modal_close=!1},handleProceed(){this.isVisible=!1,window.fcom_pending_modal_close?(this.$emit("proceed"),window.fcom_pending_modal_close=!1,window.fcom_modal_comment_unsaved=!1):this.$eventBus.emit("unsavedChangesProceeded")},showModal(e){e==="feed"?this.message=this.$t("You haven't finished your post yet. Do you want to leave without finishing?"):e==="comment"&&(this.message=this.$t("You haven't finished your comment yet. Do you want to leave without finishing?")),this.isVisible=!0}},mounted(){this.$eventBus.on("showUnsavedChangesModal",this.showModal)},beforeUnmount(){this.$eventBus.off("showUnsavedChangesModal",this.showModal)}},xv={class:"dialog_header"},Ov={class:"dialog_left"},Hv={class:"dialog_body"},jv={class:"dialog_footer"};function Nv(e,t,s,u,o,i){const m=O,f=ke;return n(),v(f,{"modal-class":"fcom_common_dialog fcom_editor_unfinished_dialog",modelValue:o.isVisible,"onUpdate:modelValue":t[0]||(t[0]=h=>o.isVisible=h),width:e.modalWidth,"close-on-click-modal":!1,"close-on-press-escape":!1,"append-to-body":!0,"show-close":!1},{header:c(()=>[l("div",xv,[l("div",Ov,[l("h4",null,d(e.$t("Leave Page?")),1)])])]),footer:c(()=>[l("div",jv,[a(m,{class:"fcom_secondary_button",onClick:i.handleCancel},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:i.handleProceed},{default:c(()=>[M(d(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:c(()=>[l("div",Hv,[l("span",null,d(o.message),1)])]),_:1},8,["modelValue","width"])}const zv=P(Rv,[["render",Nv]]),qv={name:"MentionPopover",components:{UserRouteLink:Te},setup(){return{userStore:Ue()}},data(){return{xprofile:null,virtualRef:null,hideTimeout:null,cache:{},cacheTTL:5*60*1e3,requestId:0}},methods:{getCached(e){const t=this.cache[e];return t?Date.now()-t.timestamp>this.cacheTTL?(delete this.cache[e],null):t.data:null},setCache(e,t){this.cache[e]={data:t,timestamp:Date.now()}},async showPopover({username:e,triggerElement:t}){this.cancelHide();const s=++this.requestId;let u=this.getCached(e);if(!u){try{u=await this.userStore.fetchProfile(e)}catch{return}this.setCache(e,u)}s===this.requestId&&(this.xprofile=u,this.virtualRef=t)},cancelHide(){clearTimeout(this.hideTimeout)},startHideTimeout(){this.cancelHide(),this.hideTimeout=setTimeout(()=>{this.virtualRef=null},200)}},mounted(){this.$eventBus.on("show_mention_popover",this.showPopover),this.$eventBus.on("hide_mention_popover",this.startHideTimeout)},beforeUnmount(){this.$eventBus.off("show_mention_popover",this.showPopover),this.$eventBus.off("hide_mention_popover",this.startHideTimeout),clearTimeout(this.hideTimeout)}};function Gv(e,t,s,u,o,i){const m=p("UserRouteLink");return o.virtualRef&&o.xprofile?(n(),v(m,{key:0,xprofile:o.xprofile,virtualRef:o.virtualRef,show_badge:!0,show_follow:!0,onPopoverMouseenter:i.cancelHide,onPopoverMouseleave:i.startHideTimeout},null,8,["xprofile","virtualRef","onPopoverMouseenter","onPopoverMouseleave"])):_("",!0)}const Yv=P(qv,[["render",Gv]]);let Wv=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(Wv))xs.el[e]=t;const Kv={name:"PortalApplication",components:{NotificationsPop:sl,NotificationToaster:il,SearchBar:_1,Feed:ot,SpaceCreateModal:ov,ReportContentModal:hv,ElConfigProvider:Os,ExpandIcon:_s,ReportReviewModal:Av,PreviewPostModal:Dv,UnfinishedChangesModal:zv,MentionPopover:Yv},setup(){const e=eo(),t=Me();return{tickerStore:e,feedStore:t}},data(){return{loading:!1,mobileMenuItems:this.appVars.mobileMenuItems,hasSearchHolder:!1,hasNotificationHolder:!1,isSmallScreen:!1,popFeed:null,shopPopFeed:!1,prevUrl:null,previousFocus:null,enLang:xs,loadedStyles:{},tickerDismissed:!1}},computed:{newFeedsCount(){return this.feedStore.getNewPostsCount("global")||0}},watch:{$route(e,t){var i,m;if(this.popFeed&&(this.prevUrl=e.href,this.closeFeedModal()),(i=e.meta)!=null&&i.lazy_styles&&this.loadLazyStyles(e.meta.lazy_styles),(m=e.meta)!=null&&m.in_space&&e.params.space){let f=e.params.space;const h=document.querySelectorAll(`.fcom_space_${f} .fcom_unread_count`);for(let g=0,k=h.length;g<k;g++)h[g].remove()}if(e.name==t.name&&e.path===t.path&&e.query.topic!=t.query.topic){this.$eventBus.emit("topic_changed",e.query.topic);return}e.query.create_space&&e.query.parent_id&&this.$eventBus.emit("open_create_space_modal",e.query.create_space),this.$eventBus.emit("route_updated",{to:e,from:t});const s=e.name;document.body.setAttribute("data-route",s),document.dispatchEvent(new CustomEvent("route_updated",{detail:{to:e,from:t}})),document.querySelectorAll(".feed_layout").forEach(f=>{f.classList.remove("space_opened")}),this.isSmallScreen&&document.querySelector(".feed_layout")&&document.querySelector(".feed_layout").classList.remove("space_opened");const u=e.meta.active_menu;document.querySelectorAll(".fcom_general_menu a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_general_menu a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")}),document.querySelectorAll(".fcom_sidebar_contents a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_sidebar_contents a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")});const o=(f,h)=>{var g;if(h)try{(g=document.querySelector(f+h))==null||g.classList.add("router-link-exact-active")}catch(k){console.error(k)}};e.meta.in_course&&o(".fcom_space_",e.params.course_slug),e.meta.in_space&&o(".space_contents a.fcom_space_",e.params.space)}},methods:{markPushNotificationsRead(){this.$router.isReady().then(()=>{if(!this.$route.query.fcom_pn)return;const e=parseInt(this.$route.query.feed_id,10),t=new URL(window.location.href);["fcom_pn","feed_id","nc"].forEach(s=>t.searchParams.delete(s)),window.history.replaceState(window.history.state,"",t.href),e&&this.$post(`notifications/mark-read/${e}/by-feed-id`).then(s=>{this.$eventBus.emit("notification_count_updated",s.unread_notification_count)}).catch(()=>{})})},dismissTicker(){this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),console.log("[App] Ticker dismissed")},routeToAllFeeds(){this.changeTitle(this.$t("Feeds")),this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),this.$router.push({name:"dashboard",query:{stamp:new Date().getTime(),sort_by:"latest"}})},reloadSidebarMenu(){this.$get("options/sidebar-menu-html").then(e=>{e.sidebar_html&&document.getElementById("fcom_sidebar_wrap")&&(document.getElementById("fcom_sidebar_wrap").innerHTML=e.sidebar_html,document.dispatchEvent(new CustomEvent("sidebar_menu_reloaded"))),e.auth_spaces&&(this.auth=e.auth_spaces)})},showFeedModal(e){e.feed&&(this.previousFocus=document.activeElement,this.popFeed=e.feed,this.shopPopFeed=!0,this.prevUrl=window.location.href,window.history.pushState({},"",e.feed.permalink),document.body.classList.add("fcom_post_modal_opened"),e.view=="comments"&&this.$nextTick(()=>{setTimeout(()=>{var m;const t=(m=this.$refs.feed_dialog_scroller)==null?void 0:m.wrapRef;if(!t)return;const s=e.highlight_comment_id,u=s?"instant":"smooth",o=s&&t.querySelector("#comment_"+s);if(o){t.querySelectorAll(".fcom_highlight_comment").forEach(f=>{f.classList.remove("fcom_highlight_comment")}),o.classList.add("fcom_highlight_comment"),t.scrollTo({top:o.offsetTop-100,behavior:u}),o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}),this.keepCommentInView(t,o);return}const i=t.querySelector(".feed_footer");i&&t.scrollTo({top:i.offsetTop-100,behavior:u})},100)}))},keepCommentInView(e,t){if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>{if(!e.contains(t)){s.disconnect();return}e.scrollTo({top:t.offsetTop-100,behavior:"instant"})});s.observe(e.firstElementChild||e),setTimeout(()=>s.disconnect(),2e3)},closeFeedModal(){if(window.fcom_modal_comment_unsaved){window.fcom_pending_modal_close=!0,this.$refs.unfinishedChangesModal.showModal("comment");return}this.proceedCloseFeedModal()},proceedCloseFeedModal(){this.shopPopFeed=!1,this.popFeed=null,this.prevUrl&&window.history.pushState({},"",this.prevUrl),document.body.classList.remove("fcom_post_modal_opened"),this.previousFocus&&typeof this.previousFocus.focus=="function"&&this.$nextTick(()=>{this.previousFocus.focus({preventScroll:!0}),this.previousFocus=null})},gotToFeed(){let e={name:"single_feed",params:{feed_slug:this.popFeed.slug}};this.popFeed.space&&(e={name:"space_feed",params:{feed_slug:this.popFeed.slug,space:this.popFeed.space.slug}}),this.popFeed.auto_focus_comment=!1,window.__showing_feed=this.popFeed,this.$router.push(e),this.$nextTick(()=>{this.closeFeedModal()})},async handleModalFeedDelete(){if(this.popFeed)try{const e=this.popFeed.space?`space-${this.popFeed.space.slug}`:"global";await this.feedStore.deleteFeed(e,this.popFeed.id),this.proceedCloseFeedModal(),this.$notify.success(this.$t("Post deleted successfully"))}catch(e){this.$handleError(e)}},loadLazyStyles(e){this.each(e,t=>{if(!this.appVars.lazy_styles[t]||this.loadedStyles[t])return;this.loadedStyles[t]=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.appVars.lazy_styles[t],s.type="text/css",s.id=t,s.media="all",document.head.appendChild(s)})}},created(){const e=document.querySelector(".fcom_notification_holder");this.auth.user_id&&e&&(e.replaceChildren(),this.hasNotificationHolder=!0),this.hasSearchHolder=!!document.getElementsByClassName("fcom_search_holder").length,this.$eventBus.on("fresh_feeds_loaded",t=>{let s=t.space;s||(s="__all"),this.feedMonitorCache[s]=t.feeds[0].id}),document.addEventListener("doCustomGlobalSearch",t=>{this.$eventBus.emit("doGlobalSearch",t.detail.search)}),this.$eventBus.on("reloadMenu",()=>{this.reloadSidebarMenu()}),this.$eventBus.on("toTop",t=>{window.fcomLayoutRef&&(t||(t=0),window.fcomLayoutRef.scrollTo({top:t,behavior:"instant"}))}),this.isSmallScreen=window.innerWidth<=1024},mounted(){this.$eventBus.on("showFeedModal",this.showFeedModal),this.auth.user_id&&(console.log("[App] Starting new Pinia ticker with random intervals (45-75s)..."),this.tickerStore.start(),this.markPushNotificationsRead()),this.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},Zv={key:0,class:"fcom_new_ticker"},Jv={key:1,class:"fcom_mobile_menu"},Qv={class:"focm_menu_items"},Xv=["innerHTML"],e0=["innerHTML"],t0=["href","aria-label"],s0=["innerHTML"],o0=["innerHTML"];function i0(e,t,s,u,o,i){const m=p("router-view"),f=j,h=p("router-link"),g=Yo,k=p("ExpandIcon"),b=O,S=p("feed"),w=Pe,$=ke,y=p("search-bar"),C=p("notifications-pop"),L=p("notification-toaster"),V=p("space-create-modal"),I=p("unfinished-changes-modal"),F=p("preview-post-modal"),R=p("report-content-modal"),B=p("report-review-modal"),U=p("mention-popover"),A=Os;return n(),v(A,{locale:o.enLang},{default:c(()=>[a(m,{class:D(e.appVars.route_classes)},null,8,["class"]),(n(),v(Rt,{to:"body"},[u.tickerStore.isActive&&i.newFeedsCount>0&&!o.tickerDismissed?(n(),r("div",Zv,[l("div",{onClick:t[0]||(t[0]=N=>i.routeToAllFeeds()),class:"fcom_ticker_menu"},d(e.$_n("A new post is available","%s new posts available",i.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=N=>i.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),o.mobileMenuItems&&o.mobileMenuItems.length?(n(),r("div",Jv,[l("div",Qv,[(n(!0),r(T,null,x(o.mobileMenuItems,N=>(n(),r("div",null,[N.route?(n(),v(h,{key:0,"aria-label":N.title||e.$t("Menu item"),class:"focm_menu_item",to:N.route},{default:c(()=>[a(f,null,{default:c(()=>[N.icon?(n(),v(qt(N.icon),{key:0})):N.icon_svg?(n(),r("span",{key:1,innerHTML:N.icon_svg},null,8,Xv)):_("",!0)]),_:2},1024),N.html?(n(),r("span",{key:0,innerHTML:N.html},null,8,e0)):_("",!0)]),_:2},1032,["aria-label","to"])):(n(),r("a",{key:1,href:N.permalink,"aria-label":N.title||e.$t("Menu item"),class:"focm_menu_item"},[N.icon_svg?(n(),v(f,{key:0},{default:c(()=>[l("span",{innerHTML:N.icon_svg},null,8,s0)]),_:2},1024)):_("",!0),l("span",{innerHTML:N.html},null,8,o0)],8,t0))]))),256))])])):_("",!0),a($,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:o.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=N=>o.shopPopFeed=N),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{i.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:c(()=>[a(w,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:c(()=>[o.popFeed?(n(),v(S,{key:0,onDeleted:i.handleModalFeedDelete,is_single:!0,feed:o.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:c(()=>[a(g,{direction:"vertical"}),a(b,{"aria-label":e.$t("Expand"),onClick:i.gotToFeed,class:"no_pad_btn",text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(k)]),_:1})]),_:1},8,["aria-label","onClick"]),a(b,{"aria-label":e.$t("Close"),style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:i.closeFeedModal,text:""},null,8,["aria-label","onClick"])]),_:1},8,["onDeleted","feed"])):_("",!0)]),_:1},512)]),_:1},8,["modelValue","before-close"])])),o.hasSearchHolder?(n(),v(Rt,{key:0,to:".fcom_search_holder"},[a(y)])):_("",!0),o.hasNotificationHolder?(n(),v(Rt,{key:1,to:".fcom_notification_holder"},[a(C)])):_("",!0),e.auth.user_id?(n(),v(L,{key:2})):_("",!0),e.isAdmin?(n(),v(V,{key:3})):_("",!0),a(I,{ref:"unfinishedChangesModal",onProceed:i.proceedCloseFeedModal},null,8,["onProceed"]),a(F),a(R),a(B),a(U)]),_:1},8,["locale"])}const n0=P(Kv,[["render",i0]]),l0={name:"ContentLayout",props:["title","content_class","wrapper_class"]},a0={key:0,class:"fhr_content_layout_header"},r0=["aria-label"],c0=["aria-label"];function d0(e,t,s,u,o,i){return n(),r("div",{class:D([s.wrapper_class,"fhr_content_layout"])},[K(e.$slots,"header",{},()=>[s.title?(n(),r("div",a0,[K(e.$slots,"title",{},()=>[l("h1",{role:"region","aria-label":e.$t("Page Title"),style:{cursor:"pointer"},onClick:t[0]||(t[0]=m=>e.$eventBus.emit("toTop")),class:"fhr_page_title"},d(s.title),9,r0)]),l("div",{role:"region","aria-label":e.$t("Actions"),class:"fhr_page_actions"},[K(e.$slots,"actions")],8,c0)])):_("",!0)]),K(e.$slots,"sub_header"),l("div",{class:D([s.content_class,"fhr_content_layout_body"])},[K(e.$slots,"default")],2)],2)}const we=P(l0,[["render",d0]]),u0={name:"Dashboard",components:{Layout:we},data(){return{greetings:"",notices:[]}},mounted(){this.$route.query.sort_by=="latest"&&this.$storeLocalData("feed_sort_by",""),this.$router.push({name:"all_feeds"})}},_0={key:0,class:"dashboard_actions"},m0=["innerHTML"],h0={key:1};function f0(e,t,s,u,o,i){const m=p("layout");return n(),v(m,{title:o.greetings},{default:c(()=>[o.notices.length?(n(),r("div",_0,[l("h4",null,d(e.$t("Action required")),1),l("ul",null,[(n(!0),r(T,null,x(o.notices,f=>(n(),r("li",{innerHTML:f},null,8,m0))),256))])])):(n(),r("div",h0,[l("p",null,d(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const p0=P(u0,[["render",f0]]),g0={name:"AppLayout",props:["wrapper_class"]},y0={class:"feeds_main"};function v0(e,t,s,u,o,i){const m=p("router-view");return n(),r("div",{class:D([s.wrapper_class,"feeds fcom_feeds"])},[l("div",y0,[K(e.$slots,"before_route_view"),K(e.$slots,"default",{},()=>[a(m)]),K(e.$slots,"after_route_view")])],2)}const Se=P(g0,[["render",v0]]),b0={name:"RecentActivities",components:{NotificationOnboard:ss},props:{context:{default(){return{}}},prompt_placement:{type:String,default:"feed_sidebar"},widget_title:{type:String,default(){return""}},pinned_widget_title:{type:String,default(){return""}},with_pins:{type:Boolean,default(){return!1}},is_trending:{type:Boolean,default(){return!1}},with_pending_count:{type:Boolean,default(){return!1}}},data(){return{activities:[],loading:!1,pinned_posts:[],pending_count:0,after_contents:"",before_contents:""}},watch:{"context.space_id"(){this.getActivities()},"context.user_id"(){this.getActivities()}},methods:{getActivities(){this.loading=!0,this.$get("activities",{page:1,per_page:5,context:this.context,with_pins:this.with_pins?1:0,is_trending:this.is_trending?1:0,with_pending_count:this.with_pending_count?1:0}).then(e=>{this.activities=e.activities.data,this.after_contents=e.after_contents,this.before_contents=e.before_contents,e.pinned_posts&&(this.pinned_posts=e.pinned_posts),e.pending_count&&(this.pending_count=e.pending_count)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},goToActivity(e){this.$router.push(e.route)},getActivityLink(e){const t=this.$router.resolve(e.route);let s=this.appVars.urls.portal_base;return s=s.replace(/\/$/,""),s+t.fullPath}},mounted(){this.getActivities(),this.$eventBus.on("recent_activities_refresh",this.getActivities)},beforeUnmount(){this.$eventBus.off("recent_activities_refresh",this.getActivities)}},k0=["innerHTML"],w0={key:1,class:"app_side_widget fcom_widget_highlight"},C0={class:"widget_header"},$0=["aria-label"],S0={class:"widget_body"},V0=["aria-label"],M0={class:"widget_header"},L0={class:"widget_body notifications_wrap"},T0={class:"notification_wrap"},F0=["href"],P0={class:"notification_item"},I0={class:"notification_avatar"},E0={class:"notification_content"},A0=["innerHTML"],U0={style:{"margin-top":"5px"},class:"feed_timestamp"},B0=["aria-label"],D0={class:"widget_header"},R0={class:"widget_body notifications_wrap"},x0={class:"notification_wrap"},O0=["href"],H0={class:"notification_avatar"},j0={class:"notification_content"},N0=["innerHTML"],z0=["title"],q0={key:2,class:"notification_wrap"},G0={class:"notification_item"},Y0={class:"notification_content"},W0={class:"no_notifications"},K0=["innerHTML"];function Z0(e,t,s,u,o,i){const m=p("NotificationOnboard"),f=O,h=p("UserAvatar"),g=J;return n(),r(T,null,[o.before_contents?(n(),r("div",{key:0,innerHTML:o.before_contents},null,8,k0)):_("",!0),a(m,{placement:s.prompt_placement},null,8,["placement"]),o.pending_count&&s.with_pending_count?(n(),r("div",w0,[l("div",C0,[l("h3",{role:"region","aria-label":e.$t("Pending Members")},d(e.$t("Pending Members")),9,$0)]),l("div",S0,[l("p",null,d(e.$t("%s people requested to join the community.",o.pending_count)),1)]),a(f,{role:"link","aria-label":e.$t("View pending members"),onClick:t[0]||(t[0]=k=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:c(()=>[M(d(e.$t("View pending members")),1)]),_:1},8,["aria-label"])])):_("",!0),s.with_pins&&o.pinned_posts.length?(n(),r("div",{key:2,role:"region","aria-label":e.$t("Featured Posts"),class:"app_side_widget widget_recent_activities"},[l("div",M0,[l("h3",null,d(s.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",L0,[(n(!0),r(T,null,x(o.pinned_posts,k=>{var b;return n(),r("div",T0,[l("a",{class:"no_style_link",href:k.permalink},[l("div",P0,[l("div",I0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",E0,[l("div",{innerHTML:k.message},null,8,A0),l("span",U0,d((b=k.xprofile)==null?void 0:b.display_name),1)])])],8,F0)])}),256))])],8,V0)):_("",!0),l("div",{role:"region","aria-label":e.$t("Space Activities"),class:"app_side_widget widget_recent_activities"},[l("div",D0,[l("h3",null,d(s.widget_title||e.$t("Recent Activities")),1)]),l("div",R0,[o.loading?(n(),v(g,{key:0,animated:!0,rows:5})):o.activities.length?(n(!0),r(T,{key:1},x(o.activities,k=>(n(),r("div",x0,[l("a",{href:i.getActivityLink(k),class:"notification_item"},[l("div",H0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",j0,[l("div",{innerHTML:k.message},null,8,N0),l("span",{title:k.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(k.updated_at)),9,z0)])],8,O0)]))),256)):(n(),r("div",q0,[l("div",G0,[l("div",Y0,[l("div",W0,d(e.$t("No recent activities found")),1)])])]))])],8,B0),o.after_contents?(n(),r("div",{key:3,innerHTML:o.after_contents},null,8,K0)):_("",!0)],64)}const Ut=P(b0,[["render",Z0]]),J0={name:"FeedMenu",methods:{openCustomizer(e){var t;(t=this.$refs.feed_actions)==null||t.hide(),this.$router.push({name:e})}}},Q0={class:"actions_items"};function X0(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=O,g=fe;return n(),r("div",null,[a(g,{placement:"bottom",ref:"feed_actions",trigger:"click",persistent:!1,"popper-options":{strategy:"fixed"}},{reference:c(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:c(()=>[l("ul",Q0,[e.has_pro?(n(),r("li",{key:0,onClick:t[0]||(t[0]=k=>i.openCustomizer("feed_settings_welcome_banner"))},d(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=k=>i.openCustomizer("feed_settings_links"))},d(e.$t("Manage Links")),1)])]),_:1},512)])}const e2=P(J0,[["render",X0]]),t2={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")},currentUrl(){return window.location.origin+this.$router.resolve(this.$route.fullPath).href}}},s2={class:"object_menu"},o2={class:"fcom_space_menu_ul"},i2=["target","href"],n2=["src"],l2={key:1,class:"fcom_emoji"},a2={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function r2(e,t,s,u,o,i){const m=j;return n(),r("div",s2,[l("ul",o2,[(n(!0),r(T,null,x(i.enabledLinks,f=>(n(),r("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",class:D(["fcom_custom_link",{"router-link-exact-active":f.permalink===i.currentUrl}]),href:f.permalink},[f.icon_image?(n(),r("img",{key:0,alt:"",src:f.icon_image},null,8,n2)):f.emoji?(n(),r("span",l2,d(f.emoji),1)):f.shape_svg?(n(),r("span",a2,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,d(f.title),1)],10,i2)]))),128))])])}const ms=P(t2,[["render",r2]]),c2={name:"FeedsRoute",components:{SpaceIcon:ze,Layout:we,AppLayout:Se,RecentActivities:Ut,FeedMenu:e2,RenderSpaceLinks:ms},data(){return{transiting:!1}},methods:{goToProfile(){this.$router.push({name:"update_profile",params:{username:this.auth.username}})},resetRoute(){this.transiting=!0,this.$nextTick(()=>{this.transiting=!1})}},mounted(){window.scrollTo(0,0)}},d2=["aria-label"],u2={key:0,class:"fcom_profile_complete_btn_wrap"},_2={key:1},m2={key:0,class:"fcom_feed_box"},h2={key:0,class:"fcom_main_side_wrap"},f2={class:"fcom_side_box"};function p2(e,t,s,u,o,i){const m=p("render-space-links"),f=O,h=p("feed-menu"),g=p("router-view"),k=ut,b=p("recent-activities"),S=_t,w=mt,$=p("layout"),y=p("app-layout");return n(),v(y,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a($,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:c(()=>[l("h1",{onClick:t[0]||(t[0]=C=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title clickable"},d(e.$t("Feed")),1)]),sub_header:c(()=>{var C;return[((C=e.appVars.feed_links)==null?void 0:C.length)>0?(n(),r("nav",{key:0,"aria-label":e.$t("Feed Links"),class:"fcom_sub_header"},[a(m,{links:e.appVars.feed_links},null,8,["links"])],8,d2)):_("",!0)]}),actions:c(()=>[e.auth.compilation_score<100?(n(),r("div",u2,[a(f,{onClick:i.goToProfile,type:"danger"},{default:c(()=>[M(d(e.$t("Complete your profile"))+" ("+d(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(n(),r("div",_2,[a(h)])):_("",!0)]),default:c(()=>[a(w,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:c(()=>[a(k,{class:"fcom_main"},{default:c(()=>[o.transiting?_("",!0):(n(),r("div",m2,[a(g)]))]),_:1}),a(S,{class:"fcom_resp_side",width:"306px"},{default:c(()=>[e.isMobile?_("",!0):(n(),r("div",h2,[l("div",f2,[a(b,{is_trending:!0,pinned_widget_title:e.$t("Trending Posts"),with_pins:!0},null,8,["pinned_widget_title"])])]))]),_:1})]),_:1})]),_:1},8,["title"])]),_:1})}const g2=P(c2,[["render",p2]]);const y2={name:"NewPostsBanner",components:{ArrowUp:Ws},props:{context:{type:String,default:"global"},minScrollToShow:{type:Number,default:500}},setup(){return{feedStore:Me()}},data(){return{show:!1,count:0,scrollPosition:0}},mounted(){this.$eventBus.on("feeds_updated",this.handleFeedUpdates),document.addEventListener("fcom_layout_scroll",this.handleScroll),this.checkNewPosts()},beforeUnmount(){this.$eventBus.off("feeds_updated",this.handleFeedUpdates),document.removeEventListener("fcom_layout_scroll",this.handleScroll)},methods:{handleFeedUpdates({context:e,added:t}){e===this.context&&t>0&&this.scrollPosition>this.minScrollToShow&&(this.count=this.feedStore.getNewPostsCount(this.context),this.show=!0)},handleScroll(e){this.scrollPosition=e.detail.scrollTop,this.scrollPosition<100&&this.show&&this.dismissBanner()},checkNewPosts(){const e=this.feedStore.getNewPostsCount(this.context);e>0&&this.scrollPosition>this.minScrollToShow&&(this.count=e,this.show=!0)},scrollToTop(){window.fcomLayoutRef&&window.fcomLayoutRef.setScrollTop(0),this.dismissBanner()},dismissBanner(){this.show=!1,this.feedStore.clearNewPostsCount(this.context),this.count=0}}},v2={class:"fcom_new_posts_text"};function b2(e,t,s,u,o,i){const m=p("ArrowUp"),f=j;return n(),v(Ps,{name:"slide-down"},{default:c(()=>[o.show?(n(),r("div",{key:0,class:"fcom_new_posts_banner",onClick:t[0]||(t[0]=(...h)=>i.scrollToTop&&i.scrollToTop(...h))},[a(f,{class:"fcom_new_posts_icon"},{default:c(()=>[a(m)]),_:1}),l("span",v2,d(o.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:o.count})),1)])):_("",!0)]),_:1})}const k2=P(y2,[["render",b2],["__scopeId","data-v-e4ec71f4"]]),w2={name:"AllFeeds",components:{Feeds:ft,NewPostsBanner:k2},setup(){return{tickerStore:eo()}},mounted(){var e,t;if(this.changeTitle(this.$t("All Feeds")),(e=this.appVars.features)!=null&&e.enable_feed_ticker){const s=((t=this.appVars.features)==null?void 0:t.ticker_interval)||3e4;this.tickerStore.start(s)}},beforeUnmount(){var e;(e=this.appVars.features)!=null&&e.enable_feed_ticker&&this.tickerStore.stop()}},C2={key:0,class:"notices fcom_notice_wrap"},$2=["innerHTML"];function S2(e,t,s,u,o,i){var g;const m=p("WelcomeBanner"),f=p("NewPostsBanner"),h=p("feeds");return n(),r(T,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(n(),r("div",C2,[(n(!0),r(T,null,x(e.appVars.portal_notices,k=>(n(),r("div",{innerHTML:k},null,8,$2))),256))])):_("",!0),e.appVars.welcome_banner?(n(),v(m,{key:1})):_("",!0),(g=e.appVars.features)!=null&&g.enable_feed_ticker?(n(),v(f,{key:2,context:"global"})):_("",!0),a(h,{space:"",feed_name:"all_feeds",can_change_order:e.appVars.features.disable_feed_sort_by!=="yes",default_order_by:e.appVars.features.default_feed_sort_by||"",layout_style:e.appVars.features.default_feed_layout,can_change_layout:e.appVars.features.can_switch_layout},null,8,["can_change_order","default_order_by","layout_style","can_change_layout"])],64)}const V2=P(w2,[["render",S2]]),M2={name:"ViewFeed",components:{Feed:ot},props:["feed_slug"],setup(){return{feedStore:Me()}},data(){return{loading:!0,feed:null,notFound:!1}},watch:{feed_slug(){this.feed=null,this.$nextTick(()=>{this.getFeed()})},"$route.query.comment_id"(e){e&&this.highlightComment(e)}},methods:{getFeed(){this.feed=null,this.loading=!0,this.$get("feeds/"+this.feed_slug+"/by-slug").then(e=>{if(this.isWrongSpaceContext(e.feed)){this.notFound=!0;return}this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.changeFeedTitle(),this.$nextTick(()=>{this.checkCommentScroll()})}).catch(e=>{this.$handleError(e),typeof e=="object"&&e.xhr_status==404&&(this.notFound=!0)}).finally(()=>{this.loading=!1})},isWrongSpaceContext(e){var s;const t=this.$route.params.space;return t&&((s=e==null?void 0:e.space)==null?void 0:s.slug)!==t},changeFeedTitle(){this.changeTitle(this.feed.title||"Feed")},async handleDelete(){var e;if(this.feed)try{const t=this.feed.space?`space-${this.feed.space.slug}`:"global";await this.feedStore.deleteFeed(t,this.feed.id),(e=window.history.state)!=null&&e.back?this.$router.back():this.$router.push({name:"all_feeds"})}catch(t){this.$handleError(t)}},checkCommentScroll(){const e=this.$route.query.comment_id;e?this.highlightComment(e):this.$eventBus.emit("toTop",0)},highlightComment(e){e&&(document.querySelectorAll(".fcom_highlight_comment").forEach(t=>{t.classList.remove("fcom_highlight_comment")}),setTimeout(()=>{const t=document.getElementById("comment_"+e);if(!t){this.$eventBus.emit("toTop",0);return}t.classList.add("fcom_highlight_comment");const s=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;s.top>=0&&s.bottom<=u||(t.style.scrollMarginTop="100px",t.scrollIntoView({behavior:"instant"}))},100))}},mounted(){if(this.$eventBus.on("scroll_to_comment",this.highlightComment),window.__showing_feed&&window.__showing_feed.slug==this.feed_slug){if(this.isWrongSpaceContext(window.__showing_feed)){window.__showing_feed=null,this.notFound=!0,this.loading=!1;return}this.feed=window.__showing_feed,window.__showing_feed=null,this.$nextTick(()=>{this.changeFeedTitle(),this.checkCommentScroll()})}else this.getFeed()},beforeUnmount(){this.$eventBus.off("scroll_to_comment",this.highlightComment)}},L2={key:0,class:"fcom_feed_report_wrap"},T2={class:"fcom_feed_report_content"},F2={key:1,class:"feed_outer"},P2={key:3,class:"error-container"},I2={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},E2={class:"error-title"},A2={class:"error-message"},U2={class:"error-explanation"},B2={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},D2={class:"error-actions"},R2=["href"];function x2(e,t,s,u,o,i){const m=p("Feed"),f=J;return n(),r("div",null,[o.feed&&o.feed.status=="unpublished"?(n(),r("div",L2,[l("div",T2,[l("span",null,d(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),o.feed?(n(),r("div",F2,[a(m,{is_single:!0,is_route:!0,show_report:!0,feed:o.feed,onReload:i.getFeed,onRemoved:i.getFeed,onDeleted:i.handleDelete},null,8,["feed","onReload","onRemoved","onDeleted"])])):o.loading?(n(),v(f,{key:2,rows:5,animated:!0,class:"white_loaded"})):o.notFound?(n(),r("div",P2,[l("div",I2,[l("h1",E2,d(e.$t("Post Not Found")),1),l("p",A2,d(e.$t("Sorry, the requested post could not be found.")),1),l("p",U2,d(e.$t("This may be due to one of the following reasons:")),1),l("ul",B2,[l("li",null,d(e.$t("You do not have permission to view this post")),1),l("li",null,d(e.$t("The post URL may be incorrect")),1),l("li",null,d(e.$t("The post has been deleted")),1)]),l("div",D2,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},d(e.$t("Back to home")),9,R2)])])])):_("",!0)])}const Ss=P(M2,[["render",x2]]),O2={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:Re},props:{space:{type:String,required:!0},space_profile:{required:!1}},data(){return{updating:!1}},computed:{profile(){return this.space_profile?(this.search="",this.space_profile):{title:".......",slug:"..",cover_photo:this.appVars.assets_url+"images/placeholer.png",permissions:{}}},isMod(){return this.profile.permissions.community_moderator}},methods:{removeCoverPhoto(){this.$confirm(this.$t("Are you sure you want to remove the cover photo?"),this.$t("Remove Space Cover Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.space_profile.cover_photo="",this.updateSpace({cover_photo:""})})},handleCoverPhotoUpload(e){this.space_profile.cover_photo=e,this.updateSpace({cover_photo:e})},updateSpace(e){this.space_profile.id&&(this.updating=!0,this.$put("spaces/"+this.space+"/by-slug",{data:e}).then(t=>{this.$notify.success(t.message),this.$emit("refetch"),this.$eventBus.emit("reloadMenu")}).catch(t=>{this.$handleError(t)}).finally(()=>{this.updating=!1}))}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e})}},H2={key:0,class:"object_header space_header"},j2={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function N2(e,t,s,u,o,i){const m=O,f=p("image-uploader"),h=se("loading");return i.profile.cover_photo?Y((n(),r("div",H2,[l("div",{style:me({backgroundImage:"url("+i.profile.cover_photo+")"}),class:"object_cover"},[i.isMod?(n(),r("div",j2,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:c(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:c(()=>[M(d(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:q(i.removeCoverPhoto,["prevent"])},{default:c(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])])):_("",!0)],4)])),[[h,o.updating]]):_("",!0)}const z2=P(O2,[["render",N2]]),q2={name:"SpaceMenuLink",props:{link:{type:Object,required:!0}}},G2=["textContent"],Y2=["href","target","textContent"];function W2(e,t,s,u,o,i){const m=p("router-link");return s.link.route?(n(),v(m,{key:0,to:s.link.route},{default:c(()=>[l("span",{textContent:d(s.link.title)},null,8,G2)]),_:1},8,["to"])):(n(),r("a",{key:1,class:D(s.link.css_class??""),href:s.link.url,target:s.link.is_external?"_blank":"_self",textContent:d(s.link.title)},null,10,Y2))}const K2=P(q2,[["render",W2]]),Z2=90,J2={name:"SpaceMenuItems",components:{SpaceMenuLink:K2},props:["profile","flat"],data(){return{visibleCount:null,resizeObserver:null,resizeTimer:null}},computed:{allLinks(){var e;return((e=this.profile)==null?void 0:e.header_links)||[]},flatLinks(){const e=[...this.allLinks],t=e.findIndex(s=>{var u;return((u=s.route)==null?void 0:u.name)==="space_feeds"});return e.splice(t===-1?e.length:t+1,0,{title:this.$t("About"),route:{name:"space_about"}}),e},visibleLinks(){return this.flat?this.flatLinks:this.visibleCount===null?this.allLinks:this.allLinks.slice(0,this.visibleCount)},overflowLinks(){return this.visibleCount===null?[]:this.allLinks.slice(this.visibleCount)}},watch:{allLinks(){this.flat||this.scheduleFit()}},methods:{linkKey(e,t){var s;return(((s=e.route)==null?void 0:s.name)||e.url||e.title||"link")+"_"+t},closeMore(){this.$refs.more_menu&&this.$refs.more_menu.hide()},scheduleFit(){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(()=>{this.fitLinks()},80)},fitLinks(){this.flat||!this.allLinks.length||(this.visibleCount=null,this.$nextTick(()=>{const e=this.$refs.nav,t=this.$refs.list;if(!e||!t)return;const s=e.clientWidth;if(!s)return;const u=Array.from(t.children).filter(i=>!i.classList.contains("fcom_space_menu_more")).map(i=>i.offsetWidth),o=i=>{let m=0,f=0;for(let h=0;h<this.allLinks.length&&(m+=u[h]||0,!(m>i));h++)f++;return f};if(o(s)>=this.allLinks.length){this.visibleCount=this.allLinks.length;return}this.visibleCount=Math.max(o(s-Z2),1)}))}},mounted(){this.flat||(this.fitLinks(),typeof ResizeObserver<"u"&&this.$refs.nav?(this.resizeObserver=new ResizeObserver(()=>{this.scheduleFit()}),this.resizeObserver.observe(this.$refs.nav)):window.addEventListener("resize",this.scheduleFit))},beforeUnmount(){clearTimeout(this.resizeTimer),this.resizeObserver?(this.resizeObserver.disconnect(),this.resizeObserver=null):window.removeEventListener("resize",this.scheduleFit)}},Q2=["aria-label"],X2={key:0,class:"fcom_space_menu_more"},eb=["aria-label"],tb={class:"fcom_space_menu_ul fcom_linked_menus fcom_space_menu_overflow"};function sb(e,t,s,u,o,i){const m=p("space-menu-link"),f=p("ArrowDown"),h=j,g=fe;return n(),r("nav",{ref:"nav","aria-label":e.$t("Space menu"),class:"fcom_space_menu_nav"},[l("ul",{ref:"list",class:D(["fcom_space_menu_ul",{fcom_space_menu_overflow:s.flat}])},[(n(!0),r(T,null,x(i.visibleLinks,(k,b)=>(n(),r("li",{key:i.linkKey(k,b)},[a(m,{link:k},null,8,["link"])]))),128)),i.overflowLinks.length?(n(),r("li",X2,[a(g,{ref:"more_menu",persistent:!1,placement:"bottom-end",width:220,"popper-options":{strategy:"fixed"},trigger:"click"},{reference:c(()=>[l("button",{type:"button",class:"fcom_space_menu_more_btn","aria-label":e.$t("More menu items")},[l("span",null,d(e.$t("More")),1),a(h,null,{default:c(()=>[a(f)]),_:1})],8,eb)]),default:c(()=>[l("ul",tb,[(n(!0),r(T,null,x(i.overflowLinks,(k,b)=>(n(),r("li",{key:i.linkKey(k,b),onClick:t[0]||(t[0]=S=>i.closeMore())},[a(m,{link:k},null,8,["link"])]))),128))])]),_:1},512)])):_("",!0)],2)],8,Q2)}const ob=P(J2,[["render",sb]]),ib={name:"MenuIcon"},nb={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor"};function lb(e,t,s,u,o,i){return n(),r("svg",nb,[...t[0]||(t[0]=[l("path",{d:"M1 2.75A.75.75 0 0 1 1.75 2h12.5a.75.75 0 0 1 0 1.5H1.75A.75.75 0 0 1 1 2.75Z"},null,-1),l("path",{d:"M1 7.75A.75.75 0 0 1 1.75 7h7.5a.75.75 0 0 1 0 1.5h-7.5A.75.75 0 0 1 1 7.75Z"},null,-1),l("path",{d:"M1 12.75a.75.75 0 0 1 .75-.75h12.5a.75.75 0 0 1 0 1.5H1.75a.75.75 0 0 1-.75-.75Z"},null,-1)])])}const ab=P(ib,[["render",lb]]),rb={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:Re,SpaceMenuItems:ob,MenuIcon:ab},setup(){return{spaceStore:He()}},props:{space:{type:String,required:!0},space_profile:{required:!1}},data(){return{joining:!1,updating:!1,editLockscreen:!1,search_term:this.$route.query.search||"",SearchIcon:Gt(Fe),drawerVisible:!1}},computed:{profile(){return this.space_profile?(this.search="",this.space_profile):{title:".......",slug:"..",cover_photo:this.appVars.assets_url+"images/placeholer.png",permissions:{}}},showActions(){return this.profile.id?this.profile.membership||this.isAdmin()?!0:this.isMobile:!1},isMod(){return this.profile.permissions.community_moderator},currentSectionTitle(){const e=(this.profile.header_links||[]).find(t=>{var u,o,i;if(((u=t.route)==null?void 0:u.name)!==this.$route.name)return!1;const s=(i=(o=t.route)==null?void 0:o.params)==null?void 0:i.page_slug;return!s||s===this.$route.params.page_slug});return e?e.title:this.$route.name==="space_about"?this.$t("About"):this.$t("Space menu")}},methods:{async join(){var e;this.joining=!0;try{const t=await this.spaceStore.joinSpace(this.space,this.space_profile);((e=t.membership)==null?void 0:e.status)==="active"&&!this.appVars.user_membership_slugs.includes(this.space)&&this.appVars.user_membership_slugs.push(this.space),this.$notify.success(t.message),this.$emit("refetch"),this.$eventBus.emit("reloadMenu")}catch(t){this.$handleError(t)}finally{this.joining=!1}},async leave(){try{await this.$confirm(this.$t("Are you sure you want to leave this community?"),this.$t("Leave Space"),{confirmButtonText:this.$t("Leave Space"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}),this.joining=!0;try{await this.spaceStore.leaveSpace(this.space);const e=this.appVars.user_membership_slugs.indexOf(this.space);e!==-1&&this.appVars.user_membership_slugs.splice(e,1),this.$notify.success(this.$t("Successfully left the space")),this.profile.membership=null,this.$emit("refetch"),this.$eventBus.emit("leaveCommunity",this.space),this.$eventBus.emit("reloadMenu")}catch(e){this.$handleError(e)}finally{this.joining=!1}}catch{}},initDeleteSpace(){this.$refs.space_actions.hide(),this.$confirm(this.$t("Are you sure you want to delete this space?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes, Delete the Space"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.$promt(this.$t("Please Type %s to confirm. Please note, all the posts, comments, activities of this Space will be delete.",'"DELETE"'),this.$t("Delete Space"),{confirmButtonText:this.$t("Confirm Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button"}).then(e=>{e.value==="DELETE"?this.deleteSpace():this.$notify.error(this.$t("The verification string does not match"))})})},deleteSpace(){this.$del("spaces/"+this.space_profile.slug).then(e=>{this.$notify.success(e.message),this.$router.push({name:"all_feeds"}),this.$eventBus.emit("reloadMenu")}).catch(e=>{this.$handleError(e)})},goToSettings(){this.$router.push({name:"space_settings_general",params:{space:this.space}})},performSearch(){this.$eventBus.emit("doGlobalSearch",this.search_term)}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e}),this.$route.query.customize_space&&this.$router.replace({name:"space_settings_general",params:{space:this.space}})}},cb={class:"space_header"},db={class:"object_menu"},ub={key:0,class:"menu_actions"},_b=["href"],mb={class:"fcom_space_menu_trigger"},hb=["textContent"],fb={class:"actions_items"};function pb(e,t,s,u,o,i){const m=p("space-menu-items"),f=O,h=p("MoreFilled"),g=j,k=p("MenuIcon"),b=fe,S=se("loading");return Y((n(),r("div",cb,[l("div",db,[a(m,{profile:i.profile,class:"fcom_desktop_only"},null,8,["profile"]),i.profile.id?(n(),r("div",ub,[e.auth.user_id?i.profile.membership?_("",!0):(n(),v(f,{key:1,disabled:o.joining,loading:o.joining,onClick:t[0]||(t[0]=w=>i.join()),class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},d(e.$t("Join")),9,_b)),i.showActions?(n(),v(b,{key:2,persistent:!1,ref:"space_actions",placement:"bottom-end",width:200,"popper-options":{strategy:"fixed"},"popper-class":"fcom_space_actions_pop",trigger:"click"},{reference:c(()=>[a(f,{"aria-label":e.$t("Space menu"),class:"fcom_dot_menu fcom_space_actions_trigger",size:"small",text:""},{default:c(()=>[a(g,{class:"fcom_space_actions_dots"},{default:c(()=>[a(h)]),_:1}),l("span",mb,[a(g,null,{default:c(()=>[a(k)]),_:1}),l("span",{class:"fcom_space_menu_trigger_label",textContent:d(i.currentSectionTitle)},null,8,hb)])]),_:1},8,["aria-label"])]),default:c(()=>[a(m,{profile:i.profile,flat:!0,class:"fcom_linked_menus fcom_sm_only",onClick:t[1]||(t[1]=w=>e.$refs.space_actions.hide())},null,8,["profile"]),l("ul",fb,[e.hasSpaceAdminAccess(i.profile)?(n(),r(T,{key:0},[l("li",{onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),i.goToSettings()})},d(e.$t("Space Settings")),1),t[5]||(t[5]=l("li",{class:"fcom_li_separator"},null,-1))],64)):_("",!0),i.profile.membership?(n(),r("li",{key:1,onClick:t[3]||(t[3]=()=>{e.$refs.space_actions.hide(),i.leave()})},d(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(n(),r("li",{key:2,onClick:t[4]||(t[4]=(...w)=>i.initDeleteSpace&&i.initDeleteSpace(...w))},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[S,o.updating]])}const $o=P(rb,[["render",pb]]),gb={name:"AboutSpace",components:{RecentActivities:Ut},props:["space_profile","has_permission"],data(){return{privacies:ho}}},yb={class:"fcom_main_side_wrap"},vb=["aria-label"],bb={class:"widget_header"},kb={key:0,class:"widget_body"},wb=["innerHTML"],Cb={class:"space_meta"},$b={class:"space_meta_item"},Sb={class:"meta_label"},Vb={class:"meta_desc"};function Mb(e,t,s,u,o,i){var k,b,S;const m=p("Guide"),f=j,h=J,g=p("recent-activities");return n(),r("div",yb,[l("div",{role:"region","aria-label":e.$t("About Space"),class:"app_side_widget widget_recent_activities"},[l("div",bb,[l("h3",null,d(e.$t("About")),1)]),s.space_profile?(n(),r("div",kb,[l("div",{class:"space_description",innerHTML:s.space_profile.description_rendered},null,8,wb),l("div",Cb,[l("div",$b,[l("div",Sb,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("span",null,d((k=o.privacies[s.space_profile.privacy])==null?void 0:k.label),1)]),l("div",Vb,d((b=o.privacies[s.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(n(),v(h,{key:1,animated:!0}))],8,vb),s.space_profile?(n(),v(g,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:(S=s.space_profile)==null?void 0:S.slug,space_id:s.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const So=P(gb,[["render",Mb]]),Lb={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},Tb=["fill"];function Fb(e,t,s,u,o,i){return n(),r("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[...t[0]||(t[0]=[l("path",{d:"M10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5Z",fill:"none",stroke:"currentColor"},null,-1)])],8,Tb)}const hs=P(Lb,[["render",Fb]]),Pb={name:"LessonIcon"},Ib={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Eb(e,t,s,u,o,i){return n(),r("svg",Ib,[...t[0]||(t[0]=[l("rect",{width:"60",height:"48",rx:"4",fill:"#F2F5F8"},null,-1),l("path",{d:"M30 16.5L21 21.75L30 27L37.5 22.625V28.125H39V21.75L30 16.5ZM23.9993 25.1179V28.5001C25.3676 30.3217 27.5461 31.5001 29.9998 31.5001C32.4535 31.5001 34.6321 30.3217 36.0004 28.5001L36.0001 25.1185L30.0002 28.6184L23.9993 25.1179Z",fill:"#525866"},null,-1)])])}const Vo=P(Pb,[["render",Eb]]),Ab={name:"PlayIcon"},Ub={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Bb(e,t,s,u,o,i){return n(),r("svg",Ub,[...t[0]||(t[0]=[Le('<g filter="url(#filter0_d_6543_69201)"><path d="M10 16.5C5.85775 16.5 2.5 13.1422 2.5 9C2.5 4.85775 5.85775 1.5 10 1.5C14.1422 1.5 17.5 4.85775 17.5 9C17.5 13.1422 14.1422 16.5 10 16.5ZM8.9665 6.31125C8.92136 6.28113 8.8689 6.26383 8.8147 6.26117C8.76051 6.25851 8.7066 6.27059 8.65873 6.29615C8.61086 6.3217 8.57082 6.35975 8.54287 6.40626C8.51492 6.45277 8.5001 6.50599 8.5 6.56025V11.4398C8.5001 11.494 8.51492 11.5472 8.54287 11.5937C8.57082 11.6402 8.61086 11.6783 8.65873 11.7039C8.7066 11.7294 8.76051 11.7415 8.8147 11.7388C8.8689 11.7362 8.92136 11.7189 8.9665 11.6888L12.6258 9.24975C12.6669 9.22236 12.7006 9.18524 12.724 9.14166C12.7473 9.09809 12.7595 9.04943 12.7595 9C12.7595 8.95057 12.7473 8.90191 12.724 8.85834C12.7006 8.81476 12.6669 8.77764 12.6258 8.75025L8.96575 6.31125H8.9665Z" fill="white"></path></g><defs><filter id="filter0_d_6543_69201" x="0.5" y="0.5" width="19" height="19" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="1"></feOffset><feGaussianBlur stdDeviation="1"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0.0392157 0 0 0 0 0.0509804 0 0 0 0 0.0784314 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6543_69201"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6543_69201" result="shape"></feBlend></filter></defs>',2)])])}const Mo=P(Ab,[["render",Bb]]),Db={name:"PlayPlaceholderIcon"},Rb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function xb(e,t,s,u,o,i){return n(),r("svg",Rb,[...t[0]||(t[0]=[Le('<rect width="60" height="48" rx="4" fill="#F2F5F8"></rect><g clip-path="url(#clip0_6463_70077)"><g filter="url(#filter0_d_6463_70077)"><path d="M30 31.5C25.8578 31.5 22.5 28.1423 22.5 24C22.5 19.8578 25.8578 16.5 30 16.5C34.1423 16.5 37.5 19.8578 37.5 24C37.5 28.1423 34.1423 31.5 30 31.5ZM28.9665 21.3112C28.9214 21.2811 28.8689 21.2638 28.8147 21.2612C28.7605 21.2585 28.7066 21.2706 28.6587 21.2961C28.6109 21.3217 28.5708 21.3598 28.5429 21.4063C28.5149 21.4528 28.5001 21.506 28.5 21.5602V26.4398C28.5001 26.494 28.5149 26.5472 28.5429 26.5937C28.5708 26.6402 28.6109 26.6783 28.6587 26.7039C28.7066 26.7294 28.7605 26.7415 28.8147 26.7388C28.8689 26.7362 28.9214 26.7189 28.9665 26.6888L32.6258 24.2498C32.6669 24.2224 32.7006 24.1852 32.724 24.1417C32.7473 24.0981 32.7595 24.0494 32.7595 24C32.7595 23.9506 32.7473 23.9019 32.724 23.8583C32.7006 23.8148 32.6669 23.7776 32.6258 23.7502L28.9658 21.3112H28.9665Z" fill="#525866"></path></g></g><defs><filter id="filter0_d_6463_70077" x="20.5" y="15.5" width="19" height="19" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="1"></feOffset><feGaussianBlur stdDeviation="1"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0.0392157 0 0 0 0 0.0509804 0 0 0 0 0.0784314 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6463_70077"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_6463_70077" result="shape"></feBlend></filter><clipPath id="clip0_6463_70077"><rect width="20" height="20" fill="white" transform="translate(20 14)"></rect></clipPath></defs>',3)])])}const Lo=P(Db,[["render",xb]]),Ob={name:"_LockscreenLessonEditor",components:{CircleIcon:hs,LessonIcon:Vo,PlayIcon:Mo,PlayPlaceholderIcon:Lo},props:{sections:{type:Array,required:!0},is_editor:{type:Boolean,default:!1},settings:{type:Object,required:!1}},computed:{lessonsCount(){return this.sections.reduce((e,t)=>e+t.lessons.length,0)},sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},lessonDuration(){return e=>{const t=e.lessons.reduce((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}}},methods:{isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(t==null?void 0:t.html)},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isModernLayout(){var e;return this.has_pro&&((e=this.settings)==null?void 0:e.course_layout)==="modern"},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},maybeGotoLesson(e,t){if(!this.is_editor){if(this.isFreePreview(e)){this.gotoLesson(e);return}t.is_locked&&t.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",t.unlock_date),type:"info"})}},gotoLesson(e){this.$router.push({name:"view_lesson",params:{lesson_slug:e.slug}}),setTimeout(()=>{window.location.reload()},100)},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}}},Hb={class:"fcom_course_sections"},jb={class:"fcom_course_intro"},Nb={class:"fcom_course_labels"},zb={class:"fcom_course_info"},qb={class:"fcom_card_sections"},Gb={class:"fcom_section_items"},Yb=["onClick"],Wb={class:"fcom_section_primary_item_title"},Kb={class:"title_line_container"},Zb={class:"title_line"},Jb={class:"fcom_meta_text"},Qb={key:0,class:"fcom_meta_text"},Xb={class:"fcom_section_primary_item_actions"},ek=["onClick"],tk={class:"fcom_heading_item clickable"},sk={class:"lesson_feature_media"},ok=["src","alt"],ik=["src","alt"],nk={class:"lesson_title"},lk=["innerHTML"],ak={class:"lesson_duration"},rk={key:0},ck={key:1},dk=["innerHTML"];function uk(e,t,s,u,o,i){const m=p("ArrowRight"),f=p("ArrowDown"),h=j,g=p("CircleIcon"),k=p("Lock"),b=p("PlayPlaceholderIcon"),S=p("LessonIcon"),w=p("PlayIcon");return n(),r("div",Hb,[l("div",jb,[l("div",Nb,[l("h3",null,d(e.$t("Course Content")),1),l("p",zb,[M(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),M(" "+d(e.$_n("%s Lesson","%s Lessons",i.lessonsCount)),1)])])]),l("div",qb,[l("div",Gb,[(n(!0),r(T,null,x(s.sections,$=>(n(),r("div",{key:$.id,class:"fcom_section_primary"},[$.lessons.length?(n(),r("div",{key:0,onClick:y=>$.is_closed=!$.is_closed,class:D(["clickable fcom_section_primary_item",{is_closed:$.is_closed}])},[l("div",Wb,[l("div",Kb,[l("div",Zb,[l("h4",null,d($.title),1)]),l("span",Jb,d(e.$t("%d lessons",$.lessons.length)),1),i.lessonDuration($)?(n(),r("span",Qb," • "+d(i.lessonDuration($)),1)):_("",!0)])]),l("div",Xb,[a(h,{class:"clickable"},{default:c(()=>[$.is_closed?(n(),v(m,{key:0,class:"fcom_arrow_icon"})):(n(),v(f,{key:1}))]),_:2},1024)])],10,Yb)):_("",!0),$.is_closed?_("",!0):(n(!0),r(T,{key:1},x($.lessons,y=>(n(),r("div",{key:y.id,class:D(["fcom_section_item",{is_locked:!i.isFreePreview(y)}])},[l("div",{onClick:C=>i.maybeGotoLesson(y,$),class:"fcom_section_item_title"},[l("p",tk,[a(h,null,{default:c(()=>[i.isFreePreview(y)?(n(),v(g,{key:0})):(n(),v(k,{key:1}))]),_:2},1024),i.isModernLayout?(n(),r(T,{key:0},[l("span",sk,[y.featured_image?(n(),r("img",{key:0,src:y.featured_image,alt:y.title},null,8,ok)):i.hasMediaImage(y)?(n(),r("img",{key:1,src:y.meta.media.image,alt:y.title},null,8,ik)):i.hasMediaVideo(y)?(n(),v(b,{key:2})):(n(),v(S,{key:3})),i.showPlayIcon(y)?(n(),v(w,{key:4,class:"play_icon"})):_("",!0)]),l("span",nk,[l("span",{innerHTML:y.title},null,8,lk),l("span",ak,[y.meta.video_length?(n(),r("span",rk,d(i.formatSeconds(y.meta.video_length)),1)):(n(),r("span",ck,d("---")))])])],64)):(n(),r("span",{key:1,innerHTML:y.title},null,8,dk))])],8,ek)],2))),128))]))),128))])])])}const _k=P(Ob,[["render",uk]]),mk={name:"ImagePlaceholder"},hk={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function fk(e,t,s,u,o,i){return n(),r("svg",hk,[...t[0]||(t[0]=[l("rect",{width:"240",height:"240",fill:"#F5F6F7"},null,-1),l("path",{d:"M133.125 121.65L129.33 116.7C129 116.26 128.56 116.04 128.01 116.04C127.46 116.04 127.02 116.26 126.69 116.7L121.163 123.96C120.723 124.51 120.654 125.088 120.956 125.693C121.259 126.298 121.768 126.6 122.483 126.6H148.718C149.433 126.6 149.941 126.298 150.244 125.693C150.546 125.088 150.478 124.51 150.038 123.96L142.035 113.483C141.705 113.043 141.265 112.823 140.715 112.823C140.165 112.823 139.725 113.043 139.395 113.483L133.125 121.65ZM115.8 139.8C113.985 139.8 112.431 139.154 111.139 137.861C109.846 136.569 109.2 135.015 109.2 133.2V93.6C109.2 91.785 109.846 90.2313 111.139 88.9388C112.431 87.6462 113.985 87 115.8 87H155.4C157.215 87 158.769 87.6462 160.061 88.9388C161.354 90.2313 162 91.785 162 93.6V133.2C162 135.015 161.354 136.569 160.061 137.861C158.769 139.154 157.215 139.8 155.4 139.8H115.8ZM115.8 133.2H155.4V93.6H115.8V133.2ZM102.6 153C100.785 153 99.2313 152.354 97.9388 151.061C96.6462 149.769 96 148.215 96 146.4V103.5C96 102.565 96.3163 101.781 96.9488 101.149C97.5813 100.516 98.365 100.2 99.3 100.2C100.235 100.2 101.019 100.516 101.651 101.149C102.284 101.781 102.6 102.565 102.6 103.5V146.4H145.5C146.435 146.4 147.219 146.716 147.851 147.349C148.484 147.981 148.8 148.765 148.8 149.7C148.8 150.635 148.484 151.419 147.851 152.051C147.219 152.684 146.435 153 145.5 153H102.6Z",fill:"#98A2B3"},null,-1)])])}const To=P(mk,[["render",fk]]),pk={name:"LockscreenPaywallView",components:{ImagePlaceholder:To},props:{space_id:{type:[String,Number],required:!0},field:{type:Object,required:!0},editable:{type:Boolean,default:!1}},data(){return{loading:!1,availablePaywalls:[]}},computed:{buttonStyles(){return{backgroundColor:this.field.button_color,borderColor:this.field.button_color,color:this.field.button_text_color}},cardStyles(){return{backgroundColor:this.field.background_color||"transparent",color:this.field.text_color||"var(--fcom-primary-text, #2B2E33)"}},filteredPaywalls(){return!Array.isArray(this.field.paywalls)||!Array.isArray(this.availablePaywalls)?[]:this.field.paywalls.map(e=>{for(const t of this.availablePaywalls)if(Array.isArray(t.variants)){const s=t.variants.find(u=>String(u.id)===String(e));if(s)return{...s,description:t.post_excerpt}}return null}).filter(Boolean)}},methods:{isSubscriptionPaywall(e){var t;return((t=e.other_info)==null?void 0:t.payment_type)=="subscription"},getRepeatInterval(e){var u;const t=(u=e.other_info)==null?void 0:u.repeat_interval;return t&&{daily:this.$t("day"),weekly:this.$t("week"),monthly:this.$t("month"),quarterly:this.$t("quarter"),half_yearly:this.$t("half year"),yearly:this.$t("year")}[t]||""},fetchAvailablePaywalls(){if(!this.space_id){this.availablePaywalls=[];return}const e={space_id:this.space_id};this.editable||(e.paywall_ids=this.field.paywalls),this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",e).then(t=>{this.availablePaywalls=t.paywalls||[]}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.hasFeature("has_fluentcart")&&this.fetchAvailablePaywalls()}},gk={class:"fcom_paywall_cards"},yk={class:"paywall_header"},vk={class:"paywall_body"},bk=["innerHTML"],kk={key:0,class:"subscription"},wk={class:"paywall_footer"},Ck={key:0,class:"fcom_mb_10"},$k=["href"];function Sk(e,t,s,u,o,i){const m=J,f=Hs,h=p("ImagePlaceholder");return n(),r("div",gk,[o.loading?(n(),v(m,{key:0,rows:3,animated:!0})):(n(!0),r(T,{key:1},x(i.filteredPaywalls,g=>(n(),r("div",{key:g.id,class:"fcom_paywall",style:me(i.cardStyles)},[l("div",yk,[g.photo?(n(),v(f,{key:0,src:g.photo},null,8,["src"])):(n(),v(f,{key:1},{default:c(()=>[a(h)]),_:1})),l("span",null,d(g.variation_title),1)]),l("div",vk,[l("span",{innerHTML:g.total_price},null,8,bk),i.isSubscriptionPaywall(g)?(n(),r("span",kk," / "+d(i.getRepeatInterval(g)),1)):_("",!0)]),l("div",wk,[s.field.show_description=="yes"&&(g!=null&&g.description)?(n(),r("span",Ck,d(g.description),1)):_("",!0),s.editable?Y((n(),r("input",{key:1,class:"el-button fcom_primary_button link_button",style:me(i.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=k=>s.field.button_text=k)},null,4)),[[Oo,s.field.button_text]]):(n(),r("a",{key:2,class:"el-button fcom_primary_button link_button",style:me(i.buttonStyles),href:g.checkout_url},d(s.field.button_text),13,$k))])],4))),128))])}const Vk=P(pk,[["render",Sk]]),Mk={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:_k,LockscreenPaywallView:Vk},computed:{lockscreenFields(){var e,t;return(t=(e=this.profile)==null?void 0:e.lockscreen_config.lockScreen)==null?void 0:t.filter(s=>!s.hidden)},buttonLink(){return e=>e.button_link||"javascript:void(0)"},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}}},Lk={class:"fcom_custom_lockscreen"},Tk={class:"fcom_lockscreen_content"},Fk={class:"fcom_item"},Pk={class:"fcom_content"},Ik=["href","target"],Ek={key:1,class:"fcom_content_wrap"},Ak=["innerHTML"],Uk={key:2,class:"fcom_content_wrap"},Bk={key:3,class:"fcom_content_wrap"},Dk={key:4,class:"fcom_paywall_wrap"};function Rk(e,t,s,u,o,i){const m=p("welcome-banner"),f=p("lockscreen-lesson-editor"),h=p("lockscreen-paywall-view");return n(),r("div",Lk,[l("div",Tk,[(n(!0),r(T,null,x(i.lockscreenFields,g=>{var k;return n(),r("div",Fk,[g.type=="image"?(n(),r("div",{key:0,class:"fcom_image_wrap",style:me(i.imageStyles(g))},[l("div",Pk,[l("h2",{style:me(i.headingStyles(g))},d(g.heading),5),l("p",{style:me(i.descriptionStyles(g))},d(g.description),5),g.button_text?(n(),r("a",{key:0,class:"fcom_btn",href:i.buttonLink(g),style:me(i.buttonStyles(g)),target:g.new_tab=="yes"?"_blank":"_self"},d(g.button_text),13,Ik)):_("",!0)])],4)):_("",!0),g.type=="block"&&g.content?(n(),r("div",Ek,[l("div",{class:"fcom_custom_editor_html",innerHTML:g.content},null,8,Ak)])):_("",!0),g.type=="welcome_banner"&&g.banner?(n(),r("div",Uk,[a(m,{config:g.banner,"close-key":"fcom_course_welcome_banner_closed_"+s.profile.id+"_not_enrolled","wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])])):_("",!0),g.type=="lesson"?(n(),r("div",Bk,[a(f,{sections:s.sections,settings:s.profile.settings},null,8,["sections","settings"])])):_("",!0),g.type=="paywall"&&((k=g.paywalls)==null?void 0:k.length)>0?(n(),r("div",Dk,[a(h,{space_id:s.profile.id,field:g},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const Fo=P(Mk,[["render",Rk]]),xk={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:To},props:{space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,availablePaywalls:[]}},methods:{isSubscriptionPaywall(e){var t;return((t=e.other_info)==null?void 0:t.payment_type)=="subscription"},getRepeatInterval(e){var u;const t=(u=e.other_info)==null?void 0:u.repeat_interval;return{daily:this.$t("day"),weekly:this.$t("week"),monthly:this.$t("month"),quarterly:this.$t("quarter"),half_yearly:this.$t("half year"),yearly:this.$t("year")}[t]||""},fetchAvailablePaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",{space_id:this.space_id}).then(e=>{this.availablePaywalls=e.paywalls||[]}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchAvailablePaywalls()}},Ok={class:"space_default_lock_box fcom_paywall_cards"},Hk={class:"paywall_header"},jk={class:"paywall_body"},Nk=["innerHTML"],zk={key:0,class:"subscription"},qk={class:"paywall_footer"},Gk={key:0,class:"fcom_mb_10"},Yk=["href"];function Wk(e,t,s,u,o,i){const m=J,f=Hs,h=p("ImagePlaceholder");return n(),r("div",Ok,[o.loading?(n(),v(m,{key:0,rows:3,animated:!0})):(n(!0),r(T,{key:1},x(o.availablePaywalls,g=>(n(),r(T,{key:g.ID},[(n(!0),r(T,null,x(g.variants,k=>(n(),r("div",{key:k.id,class:"fcom_paywall"},[l("div",Hk,[k.photo?(n(),v(f,{key:0,src:k.photo},null,8,["src"])):(n(),v(f,{key:1},{default:c(()=>[a(h)]),_:1})),l("span",null,d(k.variation_title),1)]),l("div",jk,[l("span",{innerHTML:k.total_price},null,8,Nk),i.isSubscriptionPaywall(k)?(n(),r("span",zk," / "+d(i.getRepeatInterval(k)),1)):_("",!0)]),l("div",qk,[k!=null&&k.description?(n(),r("span",Gk,d(g.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:k.checkout_url},d(e.$t("Join Now")),9,Yk)])]))),128))],64))),128))])}const Po=P(xk,[["render",Wk]]),Kk={name:"LockscreenView",components:{CustomLockscreenView:Fo,DefaultLockscreenPaywall:Po},props:["space_profile","joining"],emits:["join"],computed:{isDefaultScreen(){return this.space_profile},isNonMember(){var e;return(e=this.space_profile.permissions)==null?void 0:e.is_non_member}},mounted(){var e;(e=this.space_profile.lockscreen_config)!=null&&e.redirect_url&&(window.location.href=this.space_profile.lockscreen_config.redirect_url)}},Zk={key:0,style:{margin:"30px","text-align":"center"}},Jk={key:0,class:"space_lock_box space_default_lock_box"},Qk={class:"space_lock_box space_default_lock_box"},Xk={class:"lock_desc"},ew=["href"],tw={key:0,class:"lock_desc"},sw={key:1,class:"lock_desc"},ow=["href"],iw={key:2},nw={key:2,class:"space_lock_box"},lw={class:"lock_desc"},aw=["href"];function rw(e,t,s,u,o,i){var b,S;const m=p("Lock"),f=j,h=O,g=p("default-lockscreen-paywall"),k=p("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(n(),r("h3",Zk,d(e.$t("Please wait...")),1)):s.space_profile.lockscreen_config?(n(),r(T,{key:1},[s.space_profile.permissions&&s.space_profile.permissions.is_pending?(n(),r("div",Jk,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Membership Request Under Review")),1)])):s.space_profile.lockscreen_config.showCustom?(n(),r("div",iw,[a(k,{profile:s.space_profile},null,8,["profile"])])):(n(),r(T,{key:1},[l("div",Qk,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private space")),1),s.space_profile.lockscreen_config.canSendRequest?(n(),r(T,{key:0},[l("p",Xk,d(e.$t("Please send a join request and an admin will review your join request.")),1),e.auth.user_id?(n(),v(h,{key:0,disabled:s.joining,loading:s.joining,class:"fcom_primary_button",onClick:t[0]||(t[0]=w=>e.$emit("join"))},{default:c(()=>[M(d(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(n(),r("a",{key:1,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login or Signup")),9,ew))],64)):(n(),r(T,{key:1},[s.space_profile.lockscreen_config.showPaywalls?(n(),r("p",tw,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),r("p",sw,d(e.$t("Members have to be invited to this space.")),1)),e.auth.user_id?_("",!0):(n(),r("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,ow))],64))]),s.space_profile.lockscreen_config.showPaywalls?(n(),v(g,{key:0,space_id:(S=s.space_profile)==null?void 0:S.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(n(),r("div",nw,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to join this community")),1),l("p",lw,d(e.$t("To join the discussion of this community, please login or signup")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,aw)]))}const cw=P(Kk,[["render",rw]]),dw={name:"NotFoundResult",props:{title:{type:String,default:""},message:{type:String,default:""},icon:{type:String,default:"error"},actions:{type:Array,default:()=>[]}},computed:{displayActions(){return this.actions.length?this.actions:[{text:this.$t("Go to Home"),class:"fcom_primary_button",action:()=>this.$router.push({name:"all_feeds"})}]}}},uw={class:"fcom_404_container"},_w={class:"fcom_404_content"};function mw(e,t,s,u,o,i){const m=O,f=Wo;return n(),r("div",uw,[l("div",_w,[a(f,{icon:s.icon,title:s.title},{"sub-title":c(()=>[l("p",null,d(s.message),1)]),extra:c(()=>[K(e.$slots,"actions",{},()=>[(n(!0),r(T,null,x(i.displayActions,(h,g)=>(n(),v(m,{key:g,class:D(["el-button",h.class]),onClick:k=>h.action&&h.action()},{default:c(()=>[M(d(h.text),1)]),_:2},1032,["class","onClick"]))),128))])]),_:3},8,["icon","title"])])])}const Io=P(dw,[["render",mw]]),hw={name:"SpaceView",components:{NotFoundResult:Io,RenderSpaceLinks:ms,AboutSpace:So,Layout:we,AppLayout:Se,SpaceHeader:z2,RecentActivities:Ut,CreateSpaceForm:ds,SpaceMenu:$o,LockscreenView:cw,SpaceIcon:ze},setup(){return{spaceStore:He()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0,notFound:!1}},computed:{hasEnabledSpaceLinks(){var t,s;return(((s=(t=this.space_profile)==null?void 0:t.settings)==null?void 0:s.links)||[]).some(u=>u.enabled!=="no")},space_profile(){return this.spaceStore.getCurrentSpace},loading(){return this.spaceStore.isLoading(this.space)},has_permission(){return this.space_profile?!!this.space_profile.permissions.can_view_posts:!1},isDefaultScreen(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="no"},isCustomLockScreen(){var e;return!!((e=this.space_profile)!=null&&e.lockscreen_config)&&!this.hasSpaceModeratorAccess(this.space_profile)},isNonMember(){var e,t;return(t=(e=this.space_profile)==null?void 0:e.permissions)==null?void 0:t.is_non_member},showSpaceHeader(){var e;return!this.isCustomLockScreen&&this.$route.name=="space_feeds"&&((e=this.space_profile)==null?void 0:e.cover_photo)},notFoundActions(){var e;return(e=this.auth)!=null&&e.username?[]:[{text:this.$t("Log in"),class:"fcom_primary_button",action:()=>{window.location.href=this.getCurrentAuthUrl()}},{text:this.$t("Go to Home"),class:"fcom_secondary_button",action:()=>this.$router.push({name:"all_feeds"})}]},showSideBar(){var e,t;return this.notFound||this.isCustomLockScreen||((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.show_sidebar)=="no"?!1:this.$route.meta.show_sidebar==="from_page_layout"?!!this.spaceStore.currentPageLayout:!!this.$route.meta.show_sidebar},showSpaceMenu(){return!this.notFound&&!this.isCustomLockScreen},showProfileLogo(){return!this.isCustomLockScreen},feedCssClasses(){var s,u;const e=[];e.push(this.showSideBar?"fcom_has_space_sidebar":"fcom_hide_space_sidebar");let t=((u=(s=this.space_profile)==null?void 0:s.settings)==null?void 0:u.layout_style)||"timeline";return e.push("fcom_layout_"+t),e.push("fcom_route_"+this.$route.name),e},wrapperLayoutClasses(){var e;return["fcom_single_layout","fcom_max_layout","fcom_space_"+((e=this.space_profile)==null?void 0:e.slug),"fcom_space_route_"+this.$route.name]}},watch:{space(){this.search="",this.getSpaceProfile()}},methods:{async getSpaceProfile(){this.notFound=!1;try{const e=await this.spaceStore.fetchSpace(this.space);this.auth.spaces[e.slug]=e,e.pending_count!==void 0&&(this.pending_count=e.pending_count),this.changeTitle(e.title)}catch(e){e.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Space Not Found"))):this.$handleError(e)}},async processJoin(){this.joining=!0;try{const e=await this.spaceStore.joinSpace(this.space);this.$notify.success(e.message),await this.getSpaceProfile()}catch(e){this.$handleError(e)}finally{this.joining=!1}},resetRoute(){this.$nextTick(()=>{})}},async mounted(){const e=this.spaceStore.getSpaceBySlug(this.space);e?(this.spaceStore.setCurrentSpace(this.space),this.changeTitle(e.title)):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},fw=["aria-label"],pw={class:"space_route"},gw={key:0},yw={key:2,class:"space_holder"},vw={key:3};function bw(e,t,s,u,o,i){const m=p("Lock"),f=j,h=p("space-icon"),g=p("router-link"),k=p("space-menu"),b=p("render-space-links"),S=p("space-header"),w=J,$=p("not-found-result"),y=p("lockscreen-view"),C=p("router-view"),L=ut,V=p("AboutSpace"),I=_t,F=mt,R=p("layout"),B=p("app-layout");return n(),v(B,{wrapper_class:i.wrapperLayoutClasses},{default:c(()=>[a(R,{wrapper_class:["no_bg_layout",{custom_lockscreen:i.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:c(()=>[l("h1",{onClick:t[0]||(t[0]=U=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title"},[i.space_profile?(n(),v(g,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:s.space}}},{default:c(()=>[i.isCustomLockScreen?(n(),v(f,{key:0},{default:c(()=>[a(m)]),_:1})):i.showProfileLogo?(n(),v(h,{key:1,space_profile:i.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,d(i.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:c(()=>[i.showSpaceMenu?(n(),v(k,{key:0,space:s.space,space_profile:i.space_profile,onDoSearch:t[1]||(t[1]=U=>{o.search=U}),onRefetch:t[2]||(t[2]=U=>i.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:c(()=>[i.space_profile&&!i.isCustomLockScreen&&i.hasEnabledSpaceLinks?(n(),r("nav",{key:0,"aria-label":e.$t("Space Links"),class:"fcom_sub_header"},[a(b,{links:i.space_profile.settings.links},null,8,["links"])],8,fw)):_("",!0)]),default:c(()=>[i.showSpaceHeader?(n(),v(S,{key:0,onRefetch:t[3]||(t[3]=U=>i.getSpaceProfile()),space:s.space,space_profile:i.space_profile},null,8,["space","space_profile"])):_("",!0),a(F,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:c(()=>[a(L,{class:"fcom_main"},{default:c(()=>[l("div",{class:D([i.feedCssClasses,"fcom_feed_box"])},[l("div",pw,[i.loading?(n(),r("div",gw,[a(w,{class:"white_loaded",rows:10,animated:!0})])):o.notFound?(n(),v($,{key:1,title:e.$t("Space Not Found"),message:e.$t("The space you are looking for does not exist or has been removed."),actions:i.notFoundActions},null,8,["title","message","actions"])):i.space_profile?(n(),r("div",yw,[i.isCustomLockScreen?(n(),v(y,{key:0,space_profile:i.space_profile,joining:o.joining,onJoin:t[4]||(t[4]=U=>i.processJoin())},null,8,["space_profile","joining"])):_("",!0),i.has_permission?(n(),v(C,{key:s.space,search:o.search,onRefetch:t[5]||(t[5]=U=>i.getSpaceProfile()),space_profile:i.space_profile,space_slug:s.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(n(),r("div",vw,[l("h4",null,d(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),i.showSideBar?(n(),v(I,{key:0,class:"fcom_resp_side",width:"306px"},{default:c(()=>[a(V,{has_permission:i.has_permission,space_profile:i.space_profile},null,8,["has_permission","space_profile"])]),_:1})):_("",!0)]),_:1})]),_:1},8,["wrapper_class"])]),_:1},8,["wrapper_class"])}const kw=P(hw,[["render",bw]]),ww={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:It,Feeds:ft},setup(){return{spaceStore:He()}},data(){return{topic_slug:null}},methods:{setTopic(e){this.topic_slug=e;let t=JSON.parse(JSON.stringify(this.$route.query));e?t.topic=e:delete t.topic,this.$router.push({query:t})},watchTopicUrlChanged(e){this.topic_slug==e||!e||(this.topic_slug=e,this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.scrollTo({top:0,behavior:"smooth"})}))}},computed:{layout_style(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.layout_style)||"timeline"},spaceTopics(){var t,s;const e=this.spaceStore.getSpaceTopics(this.space_slug);return e&&e.length>0?e:es((t=this.space_profile)==null?void 0:t.topics)?null:((s=this.space_profile)==null?void 0:s.topics)||null}},created(){this.$route.query.topic&&(this.topic_slug=this.$route.query.topic),this.$eventBus.on("topic_changed",this.watchTopicUrlChanged)},beforeUnmount(){this.$eventBus.off("topic_changed",this.watchTopicUrlChanged)}},Cw={key:0,class:"fcom_space_topics"},$w={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function Sw(e,t,s,u,o,i){var g,k,b;const m=O,f=Pe,h=p("feeds");return n(),r(T,null,[i.spaceTopics?(n(),r("div",Cw,[a(f,null,{default:c(()=>[l("div",$w,[a(m,{onClick:t[0]||(t[0]=S=>i.setTopic("")),class:D({fcom_active_topic:!o.topic_slug})},{default:c(()=>[M(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),r(T,null,x(i.spaceTopics,S=>(n(),v(m,{key:S.slug,onClick:w=>i.setTopic(S.slug),class:D({fcom_active_topic:S.slug==o.topic_slug})},{default:c(()=>[M(d(S.title),1)]),_:2},1032,["onClick","class"]))),128))],512)]),_:1})])):_("",!0),a(h,{feed_name:"space_feed_"+s.space_slug,space:s.space_slug,topic_slug:o.topic_slug,default_search:s.search,layout_style:i.layout_style,can_change_order:((g=s.space_profile.settings)==null?void 0:g.disable_post_sort_by)!=="yes",default_order_by:((k=s.space_profile.settings)==null?void 0:k.default_post_sort_by)||"",can_change_layout:((b=s.space_profile.settings)==null?void 0:b.disable_layout_style)!=="yes",hide_create_form:!s.space_profile.permissions.can_create_post},null,8,["feed_name","space","topic_slug","default_search","layout_style","can_change_order","default_order_by","can_change_layout","hide_create_form"])],64)}const Vw=P(ww,[["render",Sw]]),Mw={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},Lw={name:"InviationForm",emits:["completed"],data(){return{saving:!1,inviatation:{email:"",invitee_name:""}}},props:{space_id:{type:Number,default:null},default_value:{type:Object,default:()=>""}},methods:{sendInvitation(){this.saving=!0,this.$post("invitations",{...this.inviatation,space_id:this.space_id}).then(e=>{this.$notify.success(e.message),this.$emit("completed"),this.inviatation={email:"",invitee_name:""}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.default_value&&(this.inviatation.email=this.default_value)}},Tw={class:"fcom_invitation_form",ref:"inviteForm"};function Fw(e,t,s,u,o,i){const m=ie,f=pe,h=ct,g=dt,k=O,b=ge,S=se("loading");return n(),r("div",Tw,[a(b,{onSubmit:t[2]||(t[2]=q(w=>e.doNothing(),["prevent"])),modelValue:o.inviatation,"onUpdate:modelValue":t[3]||(t[3]=w=>o.inviatation=w),"label-position":"top"},{default:c(()=>[a(g,{gutter:30},{default:c(()=>[a(h,{sm:24,md:12},{default:c(()=>[a(f,{label:e.$t("Invitee email")},{default:c(()=>[a(m,{modelValue:o.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=w=>o.inviatation.email=w),placeholder:e.$t("Enter invitee email"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),a(h,{sm:24,md:12},{default:c(()=>[a(f,{label:e.$t("Invitee Name (optional)")},{default:c(()=>[a(m,{modelValue:o.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=w=>o.inviatation.invitee_name=w),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:c(()=>[Y((n(),v(k,{disabled:o.saving,class:"fcom_primary_button",onClick:i.sendInvitation},{default:c(()=>[M(d(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[S,o.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const Pw=P(Lw,[["render",Fw]]),Iw={name:"AddMemberForm",components:{InviationForm:Pw},props:["modelValue","space_profile"],emits:["completed"],data(){return{users:[],loading:!1,form:this.modelValue||{user_id:"",role:"",editing_user:null},adding:!1,invite_search:"",showingForm:"addByUser"}},methods:{fetchUsers(e=""){this.loading=!0,this.$get("spaces/users/search",{context:"add_member",search:e,space_id:this.space_profile.id}).then(t=>{this.users=t.users.data}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},addMember(){if(!this.form.user_id||!this.form.role){this.$notify.error(this.$t("Please select a user and role"));return}this.adding=!0,this.$post("spaces/"+this.space_profile.slug+"/members",{user_id:this.form.user_id,role:this.form.role}).then(e=>{this.$notify.success(e.message),this.$emit("completed"),this.form={user_id:"",role:"",editing_user:null}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.adding=!1})},invitePerson(){const e=this.$refs.invite_member.inputRef.value;if(!e){this.$notify.error(this.$t("Please enter an email address"));return}this.invite_search=e,this.showingForm="addByInvitations"}},mounted(){var e;(e=this.modelValue)!=null&&e.editing_user||this.fetchUsers()}},Ew={class:"fcom_select_photo",style:{float:"left"}},Aw=["src","alt"],Uw={style:{float:"right",color:"#8492a6","font-size":"13px"}},Bw={key:1},Dw={class:"fcom_spaced_flex"},Rw={key:0},xw={key:1},Ow={key:1},Hw={key:0},jw={key:1};function Nw(e,t,s,u,o,i){const m=ae,f=O,h=re,g=pe,k=ge,b=p("InviationForm"),S=se("loading");return o.showingForm=="addByUser"?(n(),v(k,{key:0,onSubmit:t[4]||(t[4]=q(w=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.form,"onUpdate:modelValue":t[5]||(t[5]=w=>o.form=w)},{default:c(()=>[o.form.editing_user?(n(),r("p",Bw,d(e.$t("Editing manager role for"))+" "+d(o.form.editing_user.display_name),1)):(n(),v(g,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:c(()=>[Y((n(),v(h,{ref:"invite_member",class:"rich_select","fit-input-width":"",filterable:"",remote:"","remote-method":i.fetchUsers,placeholder:e.$t("Select User"),modelValue:o.form.user_id,"onUpdate:modelValue":t[1]||(t[1]=w=>o.form.user_id=w)},{empty:c(()=>[l("p",null,d(e.$t("No existing users found based on your search.")),1),a(f,{disabled:o.adding,loading:o.adding,type:"success",onClick:t[0]||(t[0]=w=>i.invitePerson())},{default:c(()=>[M(d(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:c(()=>[(n(!0),r(T,null,x(o.users,w=>(n(),v(m,{class:"fcom_with_photo_option",key:w.ID,label:w.display_name+" ("+(w.user_email||w.ID)+")",value:w.ID},{default:c(()=>[l("span",Ew,[l("img",{src:w.photo,alt:w.display_name},null,8,Aw),l("span",null,d(w.display_name),1)]),l("span",Uw,d(w.user_email||w.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[S,o.loading]])]),_:1},8,["label"])),a(g,{label:e.$t("Membership Role")},{default:c(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:o.form.role,"onUpdate:modelValue":t[2]||(t[2]=w=>o.form.role=w)},{default:c(()=>[a(m,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(m,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(m,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),K(e.$slots,"after_form",{},()=>[l("div",Dw,[a(f,{class:"fcom_primary_button",loading:o.adding,disabled:o.adding,onClick:t[3]||(t[3]=w=>i.addMember())},{default:c(()=>[o.form.editing_user?(n(),r("span",Rw,d(e.$t("Update Role")),1)):(n(),r("span",xw,d(e.$t("Add as %s",o.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(n(),r("div",Ow,[e.has_pro?(n(),r("div",Hw,[a(b,{space_id:s.space_profile.id,default_value:o.invite_search,onCompleted:t[6]||(t[6]=w=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(n(),r("div",jw,[l("p",null,d(e.$t("Member Invitation feature is only available on the Pro version")),1)]))]))}const zw=P(Iw,[["render",Nw]]),qw={name:"AddMembersForm",components:{SpaceCourseSelector:us},props:{context:{type:String,required:!0},target:{type:Object,required:!0}},emits:["completed","membersAdded"],data(){return{sourceMode:"wp_users",wpUsers:[],wpLoading:!1,currentSearch:"",inviting:!1,selectedUserIds:[],role:"member",saving:!1,selectedSourceId:"",selectedSourceType:"",selectedSourceSlug:"",csvRows:[],csvFileName:"",createMissingUsers:!1,sendWelcomeEmailCsv:!1,sendWelcomeEmailCrm:!1,wpUsersLoaded:!1,crmTags:[],crmTagsLoading:!1,crmTagsLoaded:!1,selectedTagId:null,createMissingCrmUsers:!1,batchRunning:!1,batchProgress:0,batchProcessed:0,batchTotal:0,importDone:null}},computed:{isEmail(){return/^\S+@\S+\.\S+$/.test(this.currentSearch)}},watch:{sourceMode(e){e==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers(),e==="crm_tag"&&this.appVars.pro&&!this.crmTagsLoaded&&this.fetchCrmTags()},createMissingUsers(e){e||(this.sendWelcomeEmailCsv=!1)},createMissingCrmUsers(e){e||(this.sendWelcomeEmailCrm=!1)}},methods:{invitingLabel(e){return e?this.$t("Send Invitation to %s",e):this.$t("Send Invitation")},searchWpUsers(e=""){this.currentSearch=(e||"").trim(),!(e&&e.length<2)&&this.fetchWpUsers(e)},fetchWpUsers(e=""){this.wpLoading=!0;const t=this.context==="course",s=t?`admin/courses/${this.target.id}/users/search`:"spaces/users/search",u=t?{search:e}:{context:"add_member",search:e,space_id:this.target.id};this.$get(s,u).then(o=>{this.wpUsers=o.users.data,this.wpUsersLoaded=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.wpLoading=!1})},addWpUsers(){if(!this.selectedUserIds.length)return;const e=this.context==="course";if(this.selectedUserIds.length===1){this.saving=!0;const u=e?"admin/courses/"+this.target.id+"/students":"spaces/"+this.target.slug+"/members",o=e?{user_id:this.selectedUserIds[0]}:{user_id:this.selectedUserIds[0],role:this.role};this.$post(u,o).then(i=>{this.$notify.success(i.message),this.$emit("completed")}).catch(i=>{this.$handleError(i)}).finally(()=>{this.saving=!1});return}const t=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",s=e?{}:{role:this.role};this.runChunkedImport(this.selectedUserIds,u=>({url:t,data:{user_ids:u,...s}}))},inviteToSpace(){if(this.context!=="space")return;const e=this.currentSearch;this.inviting=!0,this.$post("invitations",{email:e,space_id:this.target.id}).then(t=>{this.$notify.success(t.message||this.$t("Invitation sent.")),this.currentSearch="",this.fetchWpUsers("")}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},importFromSource(){if(!this.selectedSourceId){this.$notify.error(this.$t("Please select a source space or course."));return}const e=this.context==="course",t=this.selectedSourceType==="course";if(t&&!parseInt(this.selectedSourceId,10)){this.$notify.error(this.$t("Invalid source course."));return}if(!t&&!this.selectedSourceSlug){this.$notify.error(this.$t("Invalid source space."));return}const s=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",u=t?{from_course_id:parseInt(this.selectedSourceId,10)}:{from_space_slug:this.selectedSourceSlug};this.runOffsetImport(s,u)},downloadSampleCsv(){this.$exportToCsv([{Name:"John Doe",Email:"john@example.com",Username:"johndoe"},{Name:"Jane Smith",Email:"jane@example.com",Username:"janesmith"},{Name:"Bob Lee",Email:"bob@example.com",Username:"boblee"}],"fcom-bulk-import-sample-"+this.context+".csv")},onCsvFileChange(e){if(e&&e.status&&e.status!=="ready")return;const t=e.raw||e;if(!t)return;this.csvFileName=t.name||"import.csv";const s=new FileReader;s.onload=u=>{this.csvRows=this.parseCsvText(u.target.result.trim()),this.csvRows.length||this.$notify.error(this.$t("No valid rows found. Ensure columns are Name, Email, Username."))},s.readAsText(t)},resetCsvImport(){this.csvRows=[],this.csvFileName=""},splitCsvLine(e){return e.split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(t=>t.trim().replace(/^"|"$/g,"").replace(/""/g,'"'))},parseCsvText(e){const t=e.split(/\r?\n/).map(b=>b.trim()).filter(Boolean);if(!t.length)return[];const s=this.splitCsvLine(t[0]).map(b=>b.toLowerCase()),u=["name","email","username"],o=s.some(b=>u.includes(b));let i=0,m=1,f=2,h=0;o&&(h=1,i=s.indexOf("name"),m=s.indexOf("email"),f=s.indexOf("username"));const g=new Set,k=[];for(let b=h;b<t.length;b++){const S=this.splitCsvLine(t[b]),w=i>=0&&S[i]||"",$=m>=0?(S[m]||"").toLowerCase():"",y=f>=0&&S[f]||"";!$.includes("@")||g.has($)||(g.add($),k.push({name:w,email:$,username:y}))}return k},importCsv(){if(!this.csvRows.length)return;let e=`spaces/${this.target.slug}/members/bulk-import`;this.context==="course"&&(e=`admin/courses/${this.target.id}/students/bulk-import`);const t=100,s=this.csvRows.length,u={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=s,this.batchProcessed=0,this.batchProgress=0;const o=i=>{if(i>=s){this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded");return}const m=this.csvRows.slice(i,i+t);this.$post(e,{rows:m,create_missing:this.createMissingUsers,notify_new_users:this.sendWelcomeEmailCsv}).then(f=>{u.added+=f.added||0,u.skipped+=f.skipped||0,u.failed+=f.failed||0;const h=f.processed&&f.processed>0?f.processed:m.length,g=i+h;this.batchProcessed=Math.min(s,g),this.batchProgress=Math.round(this.batchProcessed/s*100),o(g)}).catch(f=>{this.$handleError(f),this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded")})};o(0)},fetchCrmTags(){this.crmTagsLoading=!0,this.$get("settings/crm-tagging-config").then(e=>{this.crmTags=e.crm_tags||[],this.crmTagsLoaded=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.crmTagsLoading=!1})},addFromCrmTag(){if(!this.selectedTagId)return;const e=this.context==="course",t=e?`admin/courses/${this.target.id}/students/resolve-crm-tag`:`spaces/${this.target.slug}/members/resolve-crm-tag`,s=e?`admin/courses/${this.target.id}/students/bulk-add`:`spaces/${this.target.slug}/members/bulk-add`,u=[];let o=0;this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const i=()=>{this.batchRunning=!1;const f=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:f},this.$emit("membersAdded")},m=f=>{this.$post(t,{tag_id:this.selectedTagId,create_missing:this.createMissingCrmUsers,notify_new_users:this.sendWelcomeEmailCrm,offset:f,per_page:200}).then(h=>{if(h.user_ids&&h.user_ids.length&&u.push(...h.user_ids),o+=h.failed||0,h.has_more){m(h.next_offset);return}if(!u.length){i();return}this.runChunkedImport(u,g=>({url:s,data:{user_ids:g}}),o)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const g=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:g},this.$emit("membersAdded")})};m(0)},runChunkedImport(e,t,s=0){const o=e.length,i={added:0,skipped:0,failed:s},m=o+s;this.batchRunning=!0,this.batchTotal=o,this.batchProcessed=0,this.batchProgress=0;const f=h=>{if(h>=o){this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded");return}const g=e.slice(h,h+500),{url:k,data:b}=t(g);this.$post(k,b).then(S=>{i.added+=S.added||0,i.skipped+=S.skipped||0,i.failed+=S.failed||0;const w=S.processed&&S.processed>0?S.processed:g.length,$=h+w;this.batchProcessed=Math.min(o,$),this.batchProgress=Math.round(this.batchProcessed/o*100),f($)}).catch(S=>{this.$handleError(S),this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded")})};f(0)},runOffsetImport(e,t){const s={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const u=o=>{this.$post(e,{...t,offset:o,per_page:500}).then(i=>{s.added+=i.added||0,s.skipped+=i.skipped||0,s.failed+=i.failed||0,i.total&&!this.batchTotal&&(this.batchTotal=i.total),this.batchProcessed=i.next_offset||o+(i.processed||0),this.batchProgress=this.batchTotal?Math.min(99,Math.round(this.batchProcessed/this.batchTotal*100)):50,i.has_more?u(i.next_offset||this.batchProcessed):(this.batchProgress=100,this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded"))}).catch(i=>{this.$handleError(i),this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded")})};u(0)}},mounted(){this.sourceMode==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers()}},Gw={class:"fcom_add_members_form"},Yw={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},Ww={key:1,class:"fcom_import_done"},Kw={class:"fcom_done_title"},Zw={class:"fcom_done_subtitle"},Jw={class:"fcom_import_summary"},Qw={class:"fcom_import_summary_title"},Xw={class:"fcom_import_summary_row"},e3={class:"fcom_import_summary_row"},t3={key:0,class:"fcom_import_summary_row"},s3={key:1,class:"fcom_import_summary_row"},o3={key:2,class:"fcom_import_progress_wrap"},i3={class:"fcom_help_text fcom_mb_15"},n3={key:0,class:"fcom_muted_text fcom_mt_10"},l3={class:"fcom_select_photo",style:{float:"left"}},a3=["src","alt"],r3={style:{float:"right",color:"#8492a6","font-size":"13px"}},c3={style:{padding:"4px","text-align":"center"}},d3={style:{margin:"0 0 8px"}},u3={key:0},_3={key:1},m3={key:2},h3={key:1,style:{margin:"4px 0 0","font-size":"12px"}},f3={key:0,class:"fcom_help_text fcom_mb_10"},p3=["href"],g3={class:"fcom_help_text fcom_mb_15"},y3={key:0},v3={key:2},b3={class:"fcom_spaced_flex fcom_mb_10"},k3={class:"fcom_csv_drop_inner"},w3={class:"el-upload__text fcom_mt_10"},C3={key:0},$3={class:"el-upload__tip"},S3={class:"fcom_spaced_flex fcom_mb_10"},V3={class:"fcom_muted_text",style:{"margin-left":"8px"}},M3={key:0,class:"fcom_muted_text fcom_mb_10"},L3=["aria-label"],T3={class:"fcom_help_text fcom_mb_15"},F3=["aria-label"],P3={class:"fcom_help_text fcom_mb_15"},I3={key:0};function E3(e,t,s,u,o,i){const m=je,f=be,h=Kt,g=ae,k=O,b=re,S=pe,w=ge,$=p("SpaceCourseSelector"),y=bt,C=Zt,L=Jt,V=ve,I=se("loading");return n(),r("div",Gw,[!o.batchRunning&&!o.importDone?(n(),r("div",Yw,[a(f,{modelValue:o.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=F=>o.sourceMode=F),size:"small"},{default:c(()=>[a(m,{value:"wp_users"},{default:c(()=>[M(d(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:c(()=>[M(d(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:c(()=>[M(d(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(n(),v(m,{key:0,value:"crm_tag"},{default:c(()=>[M(d(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),o.importDone?(n(),r("div",Ww,[t[19]||(t[19]=l("div",{class:"fcom_done_icon_wrap"},[l("div",{class:"fcom_done_circle"},[l("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[l("path",{d:"M4 10l4.5 4.5L16 6",stroke:"white","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"})])])],-1)),l("h3",Kw,d(e.$t("All Done!")),1),l("p",Zw,d(e.$t("Import has been completed. You may close this now.")),1),l("div",Jw,[l("strong",Qw,d(e.$t("Import Summary")),1),l("p",Xw,d(e.$t("Total Records:"))+" "+d(o.importDone.total),1),l("p",e3,d(s.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+d(o.importDone.added),1),o.importDone.skipped?(n(),r("p",t3,d(e.$t("Skipped:"))+" "+d(o.importDone.skipped),1)):_("",!0),o.importDone.failed?(n(),r("p",s3,d(e.$t("Failed:"))+" "+d(o.importDone.failed),1)):_("",!0)])])):o.batchRunning?(n(),r("div",o3,[l("div",i3,[l("p",null,d(e.$t("Importing… Please do not close this window.")),1)]),a(h,{percentage:o.batchProgress,"stroke-width":12},null,8,["percentage"]),o.batchTotal?(n(),r("p",n3,d(o.batchProcessed)+" / "+d(o.batchTotal)+" "+d(e.$t("processed")),1)):_("",!0)])):(n(),r(T,{key:3},[o.sourceMode==="wp_users"?(n(),v(w,{key:0,onSubmit:t[5]||(t[5]=q(()=>{},["prevent"])),"label-position":"top"},{default:c(()=>[a(S,{label:e.$t("Users")},{default:c(()=>[a(b,{class:"rich_select","fit-input-width":"",multiple:"",filterable:"",remote:"","default-first-option":"","reserve-keyword":!1,loading:o.wpLoading,"remote-method":i.searchWpUsers,placeholder:e.$t("Search and select users"),modelValue:o.selectedUserIds,"onUpdate:modelValue":t[2]||(t[2]=F=>o.selectedUserIds=F)},{empty:c(()=>[l("div",c3,[l("p",d3,[i.isEmail?(n(),r("span",u3,[M(d(e.$t("User not registered:"))+" ",1),l("strong",null,d(o.currentSearch),1)])):o.currentSearch?(n(),r("span",_3,d(e.$t("No matching user found.")),1)):(n(),r("span",m3,d(e.$t("No data")),1))]),s.context==="space"?(n(),r(T,{key:0},[i.isEmail?(n(),v(k,{key:0,size:"small",class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,"aria-label":i.invitingLabel(o.currentSearch),onClick:t[1]||(t[1]=F=>i.inviteToSpace())},{default:c(()=>[M(d(e.$t("Send Email Invitation")),1)]),_:1},8,["loading","disabled","aria-label"])):o.currentSearch?(n(),r("p",h3,d(e.$t("Type a valid email to invite.")),1)):_("",!0)],64)):_("",!0)])]),default:c(()=>[(n(!0),r(T,null,x(o.wpUsers,F=>(n(),v(g,{class:"fcom_with_photo_option",key:F.ID,label:`${F.display_name} (${F.user_email||F.ID})`,value:F.ID},{default:c(()=>[l("span",l3,[l("img",{src:F.photo,alt:F.display_name},null,8,a3),l("span",null,d(F.display_name),1)]),l("span",r3,d(F.user_email||F.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),s.context==="space"?(n(),v(S,{key:0,label:e.$t("Membership Role")},{default:c(()=>[a(b,{modelValue:o.role,"onUpdate:modelValue":t[3]||(t[3]=F=>o.role=F),placeholder:e.$t("Select Role")},{default:c(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(S,null,{default:c(()=>[o.selectedUserIds.length>1&&!e.appVars.pro?(n(),r("div",f3,[l("p",null,[M(d(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(n(),r("a",{key:0,href:e.$upgradeUrl("feature_lock_bulk_add_members"),target:"_blank"},d(e.$t("Upgrade")),9,p3)):_("",!0)])])):_("",!0),Y((n(),v(k,{class:"fcom_primary_button",onClick:t[4]||(t[4]=F=>i.addWpUsers())},{default:c(()=>[M(d(s.context==="course"?e.$t("Add Students"):e.$t("Add as %s",o.role)),1)]),_:1})),[[I,o.saving]])]),_:1})]),_:1})):o.sourceMode==="from_source"?(n(),v(w,{key:1,"label-position":"top"},{default:c(()=>[a(S,{label:e.$t("Select Source Space or Course")},{default:c(()=>[a($,{modelValue:o.selectedSourceId,"onUpdate:modelValue":t[6]||(t[6]=F=>o.selectedSourceId=F),placeholder_text:e.$t("Select a space or course..."),memberships:[s.target.id.toString()],onSelectedType:t[7]||(t[7]=F=>o.selectedSourceType=F),onSelectedSlug:t[8]||(t[8]=F=>o.selectedSourceSlug=F)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",g3,[l("p",null,d(s.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(k,{class:"fcom_primary_button",onClick:t[9]||(t[9]=F=>i.importFromSource())},{default:c(()=>[M(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(n(),r("span",y3," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):o.sourceMode==="csv"?(n(),r("div",v3,[o.csvRows.length?(n(),r(T,{key:1},[l("div",S3,[l("div",null,[l("strong",null,d(o.csvFileName),1),l("span",V3,d(o.csvRows.length)+" "+d(e.$t("contacts")),1)]),a(k,{link:"",size:"small",onClick:t[11]||(t[11]=F=>i.resetCsvImport())},{default:c(()=>[M(d(e.$t("Change")),1)]),_:1})]),a(L,{data:o.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:c(()=>[a(C,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a(C,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a(C,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),o.csvRows.length>5?(n(),r("p",M3," + "+d(o.csvRows.length-5)+" "+d(e.$t("more rows")),1)):_("",!0),a(w,{"label-position":"top"},{default:c(()=>[a(S,null,{default:c(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for new email addresses")},[l("div",null,[a(V,{modelValue:o.createMissingUsers,"onUpdate:modelValue":t[12]||(t[12]=F=>o.createMissingUsers=F),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCsv,"onUpdate:modelValue":t[13]||(t[13]=F=>o.sendWelcomeEmailCsv=F),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[vt,o.createMissingUsers]])])],8,L3)]),_:1}),l("div",T3,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(S,null,{default:c(()=>[a(k,{class:"fcom_primary_button",onClick:t[14]||(t[14]=F=>i.importCsv())},{default:c(()=>[M(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(n(),r(T,{key:0},[l("div",b3,[t[20]||(t[20]=l("span",null,null,-1)),e.appVars.pro?(n(),v(k,{key:0,link:"",size:"small",onClick:t[10]||(t[10]=F=>i.downloadSampleCsv())},{default:c(()=>[M("↓ "+d(e.$t("Sample CSV")),1)]),_:1})):_("",!0)]),a(y,{drag:"",accept:".csv,.txt","auto-upload":!1,"show-file-list":!1,"on-change":i.onCsvFileChange,disabled:!e.appVars.pro},{tip:c(()=>[l("div",$3,d(e.$t("Columns: Name, Email, Username")),1)]),default:c(()=>[l("div",k3,[t[22]||(t[22]=l("div",{class:"fcom_csv_drop_arrow"},"↑",-1)),l("div",w3,[M(d(e.$t("Drop CSV here or"))+" ",1),l("em",null,d(e.$t("click to browse")),1),t[21]||(t[21]=M()),e.appVars.pro?_("",!0):(n(),r("span",C3," ("+d(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):o.sourceMode==="crm_tag"?(n(),v(w,{key:3,"label-position":"top"},{default:c(()=>[a(S,{label:e.$t("FluentCRM Tag")},{default:c(()=>[a(b,{modelValue:o.selectedTagId,"onUpdate:modelValue":t[15]||(t[15]=F=>o.selectedTagId=F),loading:o.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:c(()=>[(n(!0),r(T,null,x(o.crmTags,F=>(n(),v(g,{key:F.id,label:F.title,value:F.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a(S,null,{default:c(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for contacts without an existing account")},[l("div",null,[a(V,{modelValue:o.createMissingCrmUsers,"onUpdate:modelValue":t[16]||(t[16]=F=>o.createMissingCrmUsers=F),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCrm,"onUpdate:modelValue":t[17]||(t[17]=F=>o.sendWelcomeEmailCrm=F),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[vt,o.createMissingCrmUsers]])])],8,F3)]),_:1}),l("div",P3,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(k,{class:"fcom_primary_button",onClick:t[18]||(t[18]=F=>i.addFromCrmTag())},{default:c(()=>[M(d(s.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(n(),r("span",I3," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const A3=P(qw,[["render",E3]]),U3={name:"SortDirIcon",props:{dir:{type:String,default:"desc"}},computed:{arrowPath(){return this.dir==="asc"?"M12 12.5 V4 M10 6 L12 4 L14 6":"M12 3.5 V12 M10 10 L12 12 L14 10"}}},B3={viewBox:"0 0 16 16",width:"1em",height:"1em",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},D3=["d"];function R3(e,t,s,u,o,i){return n(),r("svg",B3,[t[0]||(t[0]=l("line",{x1:"2.5",y1:"4",x2:"8.5",y2:"4"},null,-1)),t[1]||(t[1]=l("line",{x1:"2.5",y1:"8",x2:"6.5",y2:"8"},null,-1)),t[2]||(t[2]=l("line",{x1:"2.5",y1:"12",x2:"4.5",y2:"12"},null,-1)),l("path",{d:i.arrowPath},null,8,D3)])}const x3=P(U3,[["render",R3]]);let O3=0;const H3={name:"SortControl",components:{SortDirIcon:x3},emits:["update:field","update:dir","change"],props:{field:{type:String,required:!0},dir:{type:String,default:"desc",validator:e=>["asc","desc"].includes(e)},options:{type:Array,required:!0}},data(){const e=++O3;return{sortLabelId:"fcom_sort_by_"+e,orderLabelId:"fcom_sort_order_"+e}},computed:{currentLabel(){const e=this.options.find(t=>t.value===this.field);return e?e.label:""},ariaLabel(){const e=this.dir==="asc"?this.$t("Ascending"):this.$t("Descending");return this.$t("Sort by")+": "+this.currentLabel+", "+e}},methods:{selectField(e){e.value!==this.field&&(this.$emit("update:field",e.value),this.$emit("update:dir",e.defaultDir||"asc"),this.$emit("change"))},selectDir(e){e!==this.dir&&(this.$emit("update:dir",e),this.$emit("change"))}}},j3={class:"fcom_feed_filter_icon"},N3={class:"fcom_feed_filter_value"},z3={role:"presentation",class:"fcom_feed_filter_group"},q3=["id"],G3=["aria-labelledby"],Y3={role:"presentation",class:"fcom_feed_filter_group"},W3=["id"],K3=["aria-labelledby"],Z3={class:"fcom_sort_option"},J3={class:"fcom_sort_option"};function Q3(e,t,s,u,o,i){const m=p("SortDirIcon"),f=p("ArrowDown"),h=j,g=O,k=We,b=Ke,S=Ze;return n(),v(S,{class:"fcom_feed_filter_dropdown","popper-class":"fcom_feed_filter_pop",trigger:"click",placement:"bottom-end","hide-on-click":!1},{dropdown:c(()=>[a(b,{class:"fcom_feed_filter_menu"},{default:c(()=>[l("li",z3,[l("span",{id:o.sortLabelId,class:"fcom_feed_filter_group_label"},d(e.$t("Sort by")),9,q3),l("ul",{role:"group","aria-labelledby":o.sortLabelId,class:"fcom_feed_filter_group_list"},[(n(!0),r(T,null,x(s.options,w=>(n(),v(k,{key:w.value,role:"menuitemradio","aria-checked":s.field===w.value,"aria-current":s.field===w.value?"true":void 0,class:D({fcom_feed_filter_selected:s.field===w.value}),onClick:$=>i.selectField(w)},{default:c(()=>[M(d(w.label),1)]),_:2},1032,["aria-checked","aria-current","class","onClick"]))),128))],8,G3)]),l("li",Y3,[l("span",{id:o.orderLabelId,class:"fcom_feed_filter_group_label fcom_feed_filter_group_divided"},d(e.$t("Order")),9,W3),l("ul",{role:"group","aria-labelledby":o.orderLabelId,class:"fcom_feed_filter_group_list"},[a(k,{role:"menuitemradio","aria-checked":s.dir==="asc","aria-current":s.dir==="asc"?"true":void 0,class:D({fcom_feed_filter_selected:s.dir==="asc"}),onClick:t[0]||(t[0]=w=>i.selectDir("asc"))},{default:c(()=>[l("span",Z3,[a(m,{dir:"asc"}),M(d(e.$t("Ascending")),1)])]),_:1},8,["aria-checked","aria-current","class"]),a(k,{role:"menuitemradio","aria-checked":s.dir==="desc","aria-current":s.dir==="desc"?"true":void 0,class:D({fcom_feed_filter_selected:s.dir==="desc"}),onClick:t[1]||(t[1]=w=>i.selectDir("desc"))},{default:c(()=>[l("span",J3,[a(m,{dir:"desc"}),M(d(e.$t("Descending")),1)])]),_:1},8,["aria-checked","aria-current","class"])],8,K3)])]),_:1})]),default:c(()=>[a(g,{text:"",class:"fcom_feed_filter_trigger","aria-label":i.ariaLabel},{default:c(()=>[l("span",j3,[a(m,{dir:s.dir},null,8,["dir"])]),l("span",N3,d(i.currentLabel),1),a(h,{class:"fcom_feed_filter_caret"},{default:c(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),_:1})}const Eo=P(H3,[["render",Q3]]),X3={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Fe,Pagination:$e,FollowAction:st,AddMemberForm:zw,AddMembersForm:A3,SortControl:Eo,ActionPopover:et,Drawer:ko},setup(){return{uiStore:St()}},inheritAttrs:!1,data(){return{members:[],loading:!1,pagination:{page:1,per_page:20,total:0},status:"active",sort_by:"created_at",sort_dir:"asc",pending_count:0,workingIds:[],addingNewMember:!1,addingMember:!1,editing_member:{user_id:"",role:"member"},search:"",permission_failed:!1,memberLayout:this.appVars.features.member_list_layout||"classic"}},computed:{sortOptions(){return[{value:"last_activity",label:this.$t("Last Activity"),defaultDir:"desc"},{value:"display_name",label:this.$t("Display Name"),defaultDir:"asc"},{value:"created_at",label:this.$t("Joining Date"),defaultDir:"desc"}]}},methods:{onSortChange(){this.uiStore.setListSort("space-members",this.sort_by,this.sort_dir),this.toSearch()},restoreSortPreference(){const e=this.uiStore.getListSort("space-members");e&&this.sortOptions.some(t=>t.value===e.field)&&(this.sort_by=e.field,this.sort_dir=e.dir==="asc"?"asc":"desc")},handleBulkMemberAdded(){this.fetch(),this.addingNewMember=!1},handleMemberUpdated(){this.fetch(),this.addingMember=!1},fetch(){this.loading=!0,this.$get("spaces/"+this.space+"/members",{page:this.pagination.page,per_page:this.pagination.per_page,status:this.status,search:this.search,sort_by:this.sort_by,sort_dir:this.sort_dir}).then(e=>{this.members=e.members.data,this.pagination.total=e.members.total,e.pending_count&&(this.pending_count=e.pending_count),this.pagination.page!=1&&this.$nextTick(()=>{this.$refs.space_members&&this.$refs.space_members.scrollIntoView({behavior:"smooth"})}),e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{e.permission_failed?this.permission_failed=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},removeMemberPrompt(e,t){this.$confirm(this.$t("Are you sure you want to remove this member from this community?"),this.$t("Remove Member?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"error"}).then(()=>{this.removeMember(e,t)})},removeMember(e,t){this.workingIds.push(e.user_id),this.$post("spaces/"+this.space+"/members/remove",{user_id:e.user_id}).then(s=>{this.$notify.success(s.message);const u=this.members.indexOf(e);u>-1&&this.members.splice(u,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},approveMember(e,t=null){this.workingIds.push(e.user_id),this.$post("spaces/"+this.space+"/members",{user_id:e.user_id}).then(s=>{if(this.$notify.success(s.message),t===null){this.fetch();return}const u=this.members.indexOf(e);u>-1&&this.members.splice(u,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},initAddMember(e){this.editing_member=e?{user_id:e.user_id,role:e.role,editing_user:e.xprofile}:{user_id:"",role:"member"},this.addingMember=!0},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()}},mounted(){this.$route.query.view_pending&&(this.status="pending"),this.restoreSortPreference(),this.fetch()}},e8={ref:"space_members"},t8={key:0,class:"card_header"},s8={class:"member_status"},o8={class:"add_member"},i8={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},n8={class:"permission_failed"},l8=["href"],a8={key:2},r8={class:"search_member fcom_mb_20"},c8={key:0,class:"feed_filters"},d8={class:"card_list"},u8={class:"card_content"},_8={class:"card_avatar"},m8={class:"card_info"},h8={class:"card_name"},f8={class:"info_header"},p8={class:"meta_line"},g8={key:0,class:"card_headline"},y8={class:"feed_meta_info"},v8=["title"],b8=["title"],k8=["title"],w8={key:1,class:"card_description"},C8={class:"card_footer"},$8={class:"card_action"},S8={class:"pagination_wrap"},V8={key:0,class:"loading"},M8={key:1,class:"no_members"};function L8(e,t,s,u,o,i){const m=je,f=be,h=O,g=p("Search"),k=j,b=ie,S=p("SortControl"),w=p("UserAvatar"),$=p("UserRouteLink"),y=De,C=p("FollowAction"),L=p("action-popover"),V=p("Pagination"),I=J,F=p("add-members-form"),R=p("drawer"),B=p("add-member-form"),U=se("loading");return n(),r(T,null,[l("div",e8,null,512),e.hasSpaceAdminAccess(s.space_profile)?(n(),r("div",t8,[l("div",s8,[o.pending_count?(n(),v(f,{key:0,onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=A=>o.status=A),class:"status_group"},{default:c(()=>[a(m,{value:"active"},{default:c(()=>[M(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:c(()=>[M(d(e.$t("Pending"))+" ("+d(o.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",o8,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=A=>o.addingNewMember=!0)},{default:c(()=>[M(d(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=A=>e.$router.push({name:"space_invitations"}))},{default:c(()=>[M(d(e.$t("Invitations")),1)]),_:1})])])):_("",!0),o.permission_failed?(n(),r("div",i8,[l("div",n8,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,l8)])])):(n(),r("div",a8,[l("div",r8,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=A=>o.search=A),placeholder:e.$t("Search...")},{prefix:c(()=>[a(k,null,{default:c(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),o.status!="pending"?(n(),r("div",c8,[t[11]||(t[11]=l("div",{class:"fcom_feed_divider"},null,-1)),a(S,{field:o.sort_by,"onUpdate:field":t[4]||(t[4]=A=>o.sort_by=A),dir:o.sort_dir,"onUpdate:dir":t[5]||(t[5]=A=>o.sort_dir=A),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])])):_("",!0),l("div",{class:D(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[Y((n(),r("div",d8,[(n(!0),r(T,null,x(o.members,(A,N)=>{var H,z,G,ne,E;return Y((n(),r("div",{key:A.id,class:"each_card"},[l("div",u8,[l("div",_8,[a(w,{xprofile:A.xprofile,is_online:e.isOnline(A.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",m8,[l("div",h8,[l("div",f8,[a($,{xprofile:A.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",p8,"@"+d((H=A.xprofile)==null?void 0:H.username),1)]),(G=(z=A.xprofile)==null?void 0:z.meta)!=null&&G.headline?(n(),r("div",g8,d(A.xprofile.meta.headline),1)):_("",!0),l("div",y8,[o.status!="pending"&&A.created_at?(n(),r("div",{key:0,title:A.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(A.created_at))),9,v8)):A.created_at?(n(),r("div",{key:1,title:A.created_at,class:"meta_line"},d(e.$t("Requested %s",e.humanDateDiff(A.created_at))),9,b8)):_("",!0),A.xprofile.last_activity?(n(),r("div",{key:2,title:A.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(A.xprofile.last_activity))),9,k8)):_("",!0)]),(ne=A.xprofile)!=null&&ne.short_description?(n(),r("div",w8,d(e.getExcerpt(((E=A.xprofile.meta)==null?void 0:E.short_description_rendered)||A.xprofile.short_description,120)),1)):_("",!0),A.role!="member"?(n(),v(y,{key:2,type:"success"},{default:c(()=>[M(d(e.$labelize(A.role)),1)]),_:2},1024)):_("",!0)]),o.status=="pending"?(n(),r(T,{key:0},[t[12]||(t[12]=l("div",{class:"card_break"},null,-1)),l("div",C8,[a(h,{class:"fcom_primary_button",onClick:Q=>i.approveMember(A,N)},{default:c(()=>[M(d(e.$t("Approve")),1)]),_:1},8,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:Q=>i.removeMember(A,N)},{default:c(()=>[M(d(e.$t("Decline")),1)]),_:1},8,["onClick"])])],64)):_("",!0)])]),l("div",$8,[a(C,{profile:A.xprofile},null,8,["profile"]),o.status!="pending"&&s.space_profile&&e.hasInPermission("can_remove_member",s.space_profile.permissions)?(n(),v(L,{key:0,placement:"bottom",width:200,items:[{label:e.$t("Remove Member"),action:()=>{i.removeMemberPrompt(A,N)}},{label:e.$t("Change Membership"),action:()=>{i.initAddMember(A)}}]},null,8,["items"])):_("",!0)])])),[[U,o.workingIds.includes(A.user_id)]])}),128))])),[[U,o.loading]]),l("div",S8,[a(V,{hide_on_single:!0,onFetch:t[6]||(t[6]=A=>i.fetch()),pagination:o.pagination},null,8,["pagination"])]),o.loading&&!o.pagination.total?(n(),r("div",V8,[a(I,{class:"white_loaded",rows:3,animated:!0}),a(I,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),r("div",M8,d(e.$t("No %s members found in this community.",o.status)),1)):_("",!0)],2)])),o.addingNewMember?(n(),v(R,{key:3,modelValue:o.addingNewMember,"onUpdate:modelValue":t[8]||(t[8]=A=>o.addingNewMember=A),size:e.drawerWidth,"append-to-body":!0,title:e.$t("Add Member")},{default:c(()=>[o.addingNewMember?(n(),v(F,{key:0,context:"space",target:s.space_profile,onCompleted:i.handleBulkMemberAdded,onMembersAdded:t[7]||(t[7]=A=>i.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0),o.addingMember?(n(),v(R,{key:4,modelValue:o.addingMember,"onUpdate:modelValue":t[10]||(t[10]=A=>o.addingMember=A),size:e.drawerWidth,"append-to-body":!0,"close-on-click-modal":!0,title:o.editing_member.editing_user?e.$t("Update Role"):e.$t("Add Member")},{default:c(()=>[o.addingMember?(n(),v(B,{key:0,space_profile:s.space_profile,modelValue:o.editing_member,"onUpdate:modelValue":t[9]||(t[9]=A=>o.editing_member=A),onCompleted:i.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size","title"])):_("",!0)],64)}const T8=P(X3,[["render",L8]]);const F8={name:"DocumentUploadForm",components:{CreateStatusForm:It},props:["space_profile"],emits:["refetch"],data(){return{post:{title:"",content_type:"document",message:"",media_image:"",topic_ids:[],status:"published",document_ids:[]},post_status:"published"}},watch:{"post.content_type"(){this.post.content_type="document"}},methods:{handleFilesChanged(e){this.post.document_ids=e,this.$refs.createStatusForm.feed.document_ids=e},resetForm(){this.post={title:"",content_type:"document",message:"",media_image:"",topic_ids:[],status:"unlisted",document_ids:[]},this.$emit("refetch")}}},P8={class:"fcom_document_upload_form"};function I8(e,t,s,u,o,i){const m=ve,f=p("CreateStatusForm");return n(),r("div",P8,[a(f,{ref:"createStatusForm",default_placeholder:e.$t("About these files"),initial_placeholder:e.$t("Upload new"),btn_text:e.$t("Upload Files"),editing_feed:o.post,"default-state":"active",disableUpload:!0,space:s.space_profile.slug,onAdded:i.resetForm},{before_submit_btn:c(()=>[a(m,{onChange:t[0]||(t[0]=h=>{e.$refs.createStatusForm.feed.status=h}),"true-value":"published","false-value":"unlisted",modelValue:o.post_status,"onUpdate:modelValue":t[1]||(t[1]=h=>o.post_status=h),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const E8=P(F8,[["render",I8]]),A8={name:"DocumentFeedCard",components:{ChatIcon:Qe,HeartIcon:Xe,DocumentLists:tt,UserRouteLink:Te},props:["feed"],computed:{can_manage(){return this.canEditFeed(this.feed)}}},U8={class:"fcom_document_feed_card feed"},B8={class:"feed_header"},D8={key:0,class:"feed_user"},R8={class:"feed_user_name"},x8={class:"feed_title"},O8={class:"feed_title_heading"},H8=["href"],j8={class:"feed_meta_info"},N8=["href"],z8=["title"],q8=["href"],G8={style:{"margin-left":"5px","margin-right":"7px"}},Y8=["href"],W8={style:{"margin-left":"5px"}},K8={class:"feed_body"};function Z8(e,t,s,u,o,i){var k,b,S,w,$;const m=p("ChatIcon"),f=j,h=p("HeartIcon"),g=p("DocumentLists");return n(),r("div",U8,[l("div",B8,[s.feed.xprofile?(n(),r("div",D8,[l("div",R8,[l("div",x8,[l("h2",O8,[l("a",{href:s.feed.permalink},d(s.feed.title||e.$t("Uploaded %s files",((b=(k=s.feed.meta)==null?void 0:k.document_lists)==null?void 0:b.length)||"--")),9,H8)])])]),l("div",j8,[l("a",{onClick:t[0]||(t[0]=(...y)=>e.gotoFeed&&e.gotoFeed(...y)),href:s.feed.permalink,class:"feed_timestamp"},[l("span",{title:s.feed.created_at,style:{padding:"0 7px 0 0"}},d(e.humanDateDiff(s.feed.created_at))+" "+d(e.$t("by %s",(S=s.feed.xprofile)==null?void 0:S.display_name)),9,z8)],8,N8),s.feed.comments_count?(n(),r("a",{key:0,onClick:t[1]||(t[1]=(...y)=>e.gotoFeed&&e.gotoFeed(...y)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:c(()=>[a(m)]),_:1}),l("span",G8,d(s.feed.comments_count),1)],8,q8)):_("",!0),s.feed.reactions_count?(n(),r("a",{key:1,onClick:t[2]||(t[2]=(...y)=>e.gotoFeed&&e.gotoFeed(...y)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:c(()=>[a(h,{filled:!0})]),_:1}),l("span",W8,d(s.feed.reactions_count),1)],8,Y8)):_("",!0)])])):_("",!0)]),l("div",K8,[a(g,{document_lists:($=(w=s.feed)==null?void 0:w.meta)==null?void 0:$.document_lists,allow_rename:i.can_manage,additional_data:{space_id:s.feed.space_id}},null,8,["document_lists","allow_rename","additional_data"])])])}const J8=P(A8,[["render",Z8]]);const Q8={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:bo,Feed:ot,DocumentUploadForm:E8,UploadFilled:wt,Search:Fe,Pagination:$e,DocumentFeedCard:J8},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:Gt(Fe),permission_failed:!1,show_uploader:!1}},computed:{visibleDocuments(){return this.documents.filter(e=>{var t,s;return(s=(t=e==null?void 0:e.meta)==null?void 0:t.document_lists)==null?void 0:s.length})}},methods:{fetch(e=!1){this.loading=!0,this.$get("documents",{page:this.pagination.page,per_page:this.pagination.per_page,space_id:this.space_profile.id,search:this.search}).then(t=>{e?this.documents=this.documents.concat(t.documents.data):this.documents=t.documents.data,this.pagination.total=t.documents.total,this.pagination.last_page=t.documents.last_page}).catch(t=>{t.permission_failed?this.permission_failed=!0:this.$handleError(t)}).finally(()=>{this.loading=!1})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()},handleLoadMore(e){var i;if(this.pagination.last_page==this.pagination.page)return;let t=document.querySelector(".all_documents_wrap .feed_outer:last-child");if(!t)return;let s=t.getBoundingClientRect(),u=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;!u||s.bottom-u.getBoundingClientRect().bottom-s.height>100||this.loading||(this.loading=!0,this.pagination.page++,this.fetch(!0))}},mounted(){this.has_pro?(this.fetch(),document.addEventListener("fcom_layout_scroll",this.handleLoadMore)):this.permission_failed=!0,this.changeTitle(this.$t("Documents and Files in %s",this.space_profile.title))},beforeUnmount(){document.removeEventListener("fcom_layout_scroll",this.handleLoadMore)}},X8={ref:"space_docs"},e4={class:"card_header"},t4={class:"member_status"},s4={key:0,class:"add_member"},o4={key:0},i4={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},n4={class:"permission_failed"},l4=["href"],a4={key:2},r4={class:"search_member"},c4={class:""},d4={class:"card_list"},u4={class:"all_documents_wrap"},_4={key:0,style:{"margin-top":"20px","text-align":"center"}},m4={key:1,class:"loading"},h4={key:2,class:"no_members"};function f4(e,t,s,u,o,i){var $,y;const m=p("UploadFilled"),f=j,h=O,g=p("document-upload-form"),k=p("Search"),b=ie,S=p("document-feed-card"),w=J;return n(),r(T,null,[l("div",X8,null,512),l("div",e4,[l("div",t4,[l("h3",null,d(e.$t("Documents and Files")),1)]),(y=($=s.space_profile)==null?void 0:$.permissions)!=null&&y.can_upload_documents?(n(),r("div",s4,[o.show_uploader?(n(),v(h,{key:1,plain:"",onClick:t[1]||(t[1]=C=>o.show_uploader=!1),size:"small"},{default:c(()=>[l("span",null,d(e.$t("Cancel")),1)]),_:1})):(n(),v(h,{key:0,onClick:t[0]||(t[0]=C=>o.show_uploader=!0),class:"fcom_primary_button"},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1}),l("span",null,d(e.$t("New Documents")),1)]),_:1}))])):_("",!0)]),o.show_uploader?(n(),r("div",o4,[a(g,{onRefetch:t[2]||(t[2]=()=>{i.toSearch(),o.show_uploader=!1}),space_profile:s.space_profile,reload:i.toSearch},null,8,["space_profile","reload"])])):_("",!0),o.permission_failed?(n(),r("div",i4,[l("div",n4,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,l4)])])):(n(),r("div",a4,[l("div",r4,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=C=>o.search=C),placeholder:e.$t("Search...")},{prefix:c(()=>[a(f,null,{default:c(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",c4,[l("div",d4,[l("div",u4,[(n(!0),r(T,null,x(i.visibleDocuments,C=>(n(),r("div",{key:C.id,class:"feed_outer"},[a(S,{feed:C},null,8,["feed"])]))),128))])]),!o.loading&&o.pagination.last_page!=o.pagination.page?(n(),r("div",_4,[a(h,{class:"fcom_secondary_button",disabled:o.loading,onClick:t[4]||(t[4]=C=>{o.pagination.page++,i.fetch(!0)})},{default:c(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),o.loading?(n(),r("div",m4,[a(w,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!o.loading&&!i.visibleDocuments.length?(n(),r("div",h4,d(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const p4=P(Q8,[["render",f4]]),g4={name:"LightboxMeta",components:{TopRight:ii},props:{author:{type:Object,default:null},authorHref:{type:String,default:""},postDate:{type:String,default:""},permalink:{type:String,default:null}}},y4={class:"fcom_space_media_meta_group"},v4={key:0,class:"fcom_space_media_author_chip"},b4=["src","alt"],k4={class:"fcom_space_media_author_chip_text"},w4=["href"],C4={key:1,class:"fcom_space_media_author_chip_name"},$4={key:2,class:"fcom_space_media_author_chip_date"},S4=["href"];function V4(e,t,s,u,o,i){const m=Ie,f=p("TopRight"),h=j;return n(),r("div",y4,[s.author?(n(),r("div",v4,[s.author.avatar?(n(),r("img",{key:0,src:s.author.avatar,alt:s.author.name||"",class:"fcom_space_media_author_chip_avatar"},null,8,b4)):_("",!0),l("div",k4,[s.authorHref?(n(),v(m,{key:0,content:e.$t("View Profile"),placement:"top","show-after":200},{default:c(()=>[l("a",{href:s.authorHref,class:"fcom_space_media_author_chip_name fcom_space_media_author_chip_link"},d(s.author.name||e.$t("Member")),9,w4)]),_:1},8,["content"])):(n(),r("span",C4,d(s.author.name||e.$t("Member")),1)),s.postDate?(n(),r("span",$4,d(s.postDate),1)):_("",!0)])])):_("",!0),s.permalink?(n(),r("a",{key:1,href:s.permalink,class:"fcom_space_media_viewpost_btn"},[l("span",null,d(e.$t("View post")),1),a(h,{class:"fcom_space_media_viewpost_icon"},{default:c(()=>[a(f)]),_:1})],8,S4)):_("",!0)])}const M4=P(g4,[["render",V4]]),Ee=1,Vs=5,L4=.2,T4=50,Ms=6,F4={data(){return{imageScale:Ee,imageOffsetX:0,imageOffsetY:0,isPanning:!1,panStartX:0,panStartY:0,panOriginX:0,panOriginY:0,touchMoved:!1}},computed:{canZoomOut(){return this.imageScale>Ee},canZoomIn(){return this.imageScale<Vs},canResetZoom(){return this.imageScale!==Ee||this.imageOffsetX!==0||this.imageOffsetY!==0},imageTransformStyle(){return{transform:`translate(${this.imageOffsetX}px, ${this.imageOffsetY}px) scale(${this.imageScale})`,transition:this.isPanning?"none":"transform 0.15s ease-out"}}},created(){this.boundPanMove=this.onImagePanMove.bind(this),this.boundPanEnd=this.onImagePanEnd.bind(this),this.boundWheelHandler=this.handleWheel.bind(this),this.touchValid=!1},methods:{resetImageZoom(){this.imageScale=Ee,this.imageOffsetX=0,this.imageOffsetY=0,this.stopPan()},stepZoom(e){const t=Math.min(Vs,Math.max(Ee,this.imageScale+e*L4));t!==this.imageScale&&(this.imageScale=Number(t.toFixed(2)),this.imageScale<=Ee&&(this.imageOffsetX=0,this.imageOffsetY=0))},toggleImageZoom(){this.imageScale>Ee?this.resetImageZoom():this.imageScale=2},handleWheel(e){this.currentKind==="image"&&(e.preventDefault(),this.stepZoom(e.deltaY<0?1:-1),this.showChrome())},syncWheelListener(){this.detachWheel(),this.modelValue&&this.currentKind==="image"&&document.addEventListener("wheel",this.boundWheelHandler,{passive:!1})},detachWheel(){document.removeEventListener("wheel",this.boundWheelHandler,{passive:!1})},anchorPan(e,t){this.panStartX=e,this.panStartY=t,this.panOriginX=this.imageOffsetX,this.panOriginY=this.imageOffsetY},movePan(e,t){this.imageOffsetX=this.panOriginX+(e-this.panStartX),this.imageOffsetY=this.panOriginY+(t-this.panStartY)},onImagePanStart(e){this.canZoomOut&&(this.isPanning=!0,this.anchorPan(e.clientX,e.clientY),document.addEventListener("mousemove",this.boundPanMove),document.addEventListener("mouseup",this.boundPanEnd))},onImagePanMove(e){this.isPanning&&this.movePan(e.clientX,e.clientY)},onImagePanEnd(){this.stopPan()},stopPan(){this.isPanning=!1,document.removeEventListener("mousemove",this.boundPanMove),document.removeEventListener("mouseup",this.boundPanEnd)},onImageTouchStart(e){if(e.touches.length!==1){this.touchValid=!1,this.isPanning=!1;return}const t=e.touches[0];this.touchValid=!0,this.anchorPan(t.clientX,t.clientY),this.touchMoved=!1,this.isPanning=this.imageScale>Ee,this.showChrome()},onImageTouchMove(e){if(!this.touchValid||e.touches.length!==1)return;const t=e.touches[0];(Math.abs(t.clientX-this.panStartX)>Ms||Math.abs(t.clientY-this.panStartY)>Ms)&&(this.touchMoved=!0),this.isPanning&&this.movePan(t.clientX,t.clientY)},onImageTouchEnd(e){if(!this.touchValid){this.isPanning=!1;return}if(this.isPanning){this.isPanning=!1;return}if(!this.touchMoved)return;const t=e.changedTouches[0],s=(t?t.clientX:this.panStartX)-this.panStartX,u=(t?t.clientY:this.panStartY)-this.panStartY;Math.abs(s)>T4&&Math.abs(s)>Math.abs(u)&&(s<0?this.next():this.prev())}}},P4={name:"MediaLightbox",mixins:[F4],components:{FluentPlayerPreview:Vt,LightboxMeta:M4,Close:kt,ArrowLeftBold:Gs,ArrowRightBold:ni},props:{modelValue:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},initialIndex:{type:Number,default:0}},emits:["update:modelValue"],data(){return{currentIndex:0,fluentPlayerFailed:!1,nativeVideoFailed:!1,chromeVisible:!0}},computed:{dialogOpen:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}},currentItem(){return this.items[this.currentIndex]||null},currentKind(){var e;return((e=this.currentItem)==null?void 0:e.kind)||null},currentMediaUrl(){var e;return((e=this.currentItem)==null?void 0:e.url)||null},hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))},playerMedia(){var s,u,o;const e=this.currentItem;if(!e||e.kind!=="video"&&e.kind!=="audio")return null;const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};return t.src||(t.src=e.url),{media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((s=e.feed)==null?void 0:s.id)||"",share_url:((u=e.feed)==null?void 0:u.permalink)||"",title:t.title||((o=e.feed)==null?void 0:o.title)||""}},author(){var e,t;return((t=(e=this.currentItem)==null?void 0:e.feed)==null?void 0:t.author)||null},authorProfileHref(){var t;const e=(t=this.author)==null?void 0:t.username;return!e||!this.$getRouteLink?"":this.$getRouteLink("u/:username",{username:e})},postDate(){var t,s,u,o,i,m;const e=((u=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.created_at)==null?void 0:u.date)||((i=(o=this.currentItem)==null?void 0:o.feed)==null?void 0:i.created_at)||((m=this.currentItem)==null?void 0:m.created_at);return e?this.humanDateDiff(e):""},safePermalink(){var t,s;const e=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.permalink;if(!e)return null;try{const u=new URL(e,window.location.origin);return u.protocol==="http:"||u.protocol==="https:"?e:null}catch{return null}},metaProps(){return{author:this.author,authorHref:this.authorProfileHref,postDate:this.postDate,permalink:this.safePermalink}},zoomButtons(){return[{label:this.$t("Zoom out"),icon:li,disabled:!this.canZoomOut,action:()=>this.stepZoom(-1)},{label:this.$t("Zoom in"),icon:ai,disabled:!this.canZoomIn,action:()=>this.stepZoom(1)},{label:this.$t("Reset zoom"),icon:Ks,disabled:!this.canResetZoom,action:this.resetImageZoom}]},hasNav(){return this.items.length>1},hasPrev(){return this.hasNav&&this.currentIndex>0},hasNext(){return this.hasNav&&this.currentIndex<this.items.length-1},imageAlt(){var t,s;const e=this.currentItem;return e?(t=e.feed)!=null&&t.title?e.feed.title:(s=this.author)!=null&&s.name?this.$t("Photo by %s",this.author.name):this.$t("Photo %1$s of %2$s",this.currentIndex+1,this.items.length):this.$t("Media")},lightboxWidth(){return{image:"96vw",audio:"min(90vw, 720px)"}[this.currentKind]||"min(90vw, 1100px)"},dialogAriaLabel(){const e={image:"Photo viewer",video:"Video viewer",audio:"Audio viewer"};return this.$t(e[this.currentKind]||"Media viewer")},srAnnounce(){return!this.currentItem||this.items.length<=1?"":this.$t("Item %1$s of %2$s",this.currentIndex+1,this.items.length)}},watch:{modelValue(e){e&&(this.currentIndex=this.initialIndex,this.fluentPlayerFailed=!1,this.nativeVideoFailed=!1,this.resetImageZoom())},currentKind(){this.syncWheelListener()}},created(){this.boundKeydownHandler=this.handleKeydown.bind(this),this.boundMouseMoveHandler=this.onPointerReveal.bind(this),this.boundFocusInHandler=this.showChrome.bind(this),this.chromeIdleTimer=null,this._lastReveal=0},methods:{onOpened(){this.detachDocListeners(),document.addEventListener("keydown",this.boundKeydownHandler),document.addEventListener("mousemove",this.boundMouseMoveHandler),document.addEventListener("focusin",this.boundFocusInHandler),this.syncWheelListener(),this.showChrome()},onClosed(){this.detachDocListeners(),this.stopPan(),this.resetImageZoom(),this.fluentPlayerFailed=!1,this.nativeVideoFailed=!1,this.clearChromeTimer(),this.chromeVisible=!0},detachDocListeners(){document.removeEventListener("keydown",this.boundKeydownHandler),this.detachWheel(),document.removeEventListener("mousemove",this.boundMouseMoveHandler),document.removeEventListener("focusin",this.boundFocusInHandler)},showChrome(){this.chromeVisible=!0,this.scheduleChromeHide()},scheduleChromeHide(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=setTimeout(()=>{const e=document.activeElement,t=e&&typeof e.closest=="function"&&e.closest(".fcom_space_media_video_close, .fcom_space_media_video_nav, .fcom_space_media_lightbox_icon, .fcom_space_media_viewpost_btn, .fcom_space_media_author_chip_link");!this.isPanning&&!t&&(this.chromeVisible=!1)},2e3)},clearChromeTimer(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=null},onPointerReveal(){const e=Date.now();e-this._lastReveal<200||(this._lastReveal=e,this.showChrome())},handleKeydown(e){if(!this.modelValue||e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;const t=e.target;t&&typeof t.closest=="function"&&t.closest('audio, video, media-player, input, textarea, [contenteditable="true"]')||(e.key==="ArrowLeft"?this.prev():this.next())},goTo(e){const t=this.currentIndex+e;t<0||t>this.items.length-1||(this.stopActiveVideo(),this.fluentPlayerFailed=!1,this.nativeVideoFailed=!1,this.resetImageZoom(),this.currentIndex=t,this.showChrome())},prev(){this.goTo(-1)},next(){this.goTo(1)},requestClose(){this.dialogOpen=!1},stopActiveVideo(){const e=this.$refs.mediaBody;e&&e.querySelectorAll("video, audio, media-player").forEach(t=>{try{t.muted=!0,typeof t.pause=="function"&&t.pause()}catch{}})},handleBeforeClose(e){this.stopActiveVideo(),e()}},beforeUnmount(){this.detachDocListeners(),this.stopPan(),this.clearChromeTimer()}},I4=["aria-label"],E4=["aria-label"],A4=["aria-label"],U4={class:"fcom_media_sr_only","aria-live":"polite"},B4=["src","alt"],D4=["src","aria-label"],R4={key:2,class:"fcom_media_load_error"},x4=["src","aria-label"],O4={key:0,class:"fcom_space_media_meta_bar"},H4={key:1,class:"fcom_space_media_image_controls"},j4={class:"fcom_space_media_zoom_bar"},N4=["aria-label","disabled","onClick"];function z4(e,t,s,u,o,i){const m=p("Close"),f=j,h=p("ArrowLeftBold"),g=p("ArrowRightBold"),k=p("fluent-player-preview"),b=p("lightbox-meta"),S=ke;return n(),v(S,{modelValue:i.dialogOpen,"onUpdate:modelValue":t[13]||(t[13]=w=>i.dialogOpen=w),width:i.lightboxWidth,"show-close":!1,"align-center":"","destroy-on-close":"","before-close":i.handleBeforeClose,"aria-label":i.dialogAriaLabel,class:D(["fcom_space_media_lightbox","fcom_space_media_video_dialog",{fcom_space_media_lightbox_image:i.currentKind==="image",fcom_chrome_hidden:!o.chromeVisible,fcom_space_media_panning:e.isPanning}]),onOpened:i.onOpened,onClosed:i.onClosed},{default:c(()=>{var w,$,y,C,L,V,I,F;return[l("button",{type:"button",class:"fcom_space_media_lightbox_icon fcom_space_media_video_close","aria-label":e.$t("Close"),onClick:t[0]||(t[0]=(...R)=>i.requestClose&&i.requestClose(...R))},[a(f,null,{default:c(()=>[a(m)]),_:1})],8,I4),i.hasPrev?(n(),r("button",{key:0,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_prev","aria-label":e.$t("Previous"),onClick:t[1]||(t[1]=(...R)=>i.prev&&i.prev(...R))},[a(f,null,{default:c(()=>[a(h)]),_:1})],8,E4)):_("",!0),i.hasNext?(n(),r("button",{key:1,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_next","aria-label":e.$t("Next"),onClick:t[2]||(t[2]=(...R)=>i.next&&i.next(...R))},[a(f,null,{default:c(()=>[a(g)]),_:1})],8,A4)):_("",!0),l("div",{class:"fcom_space_media_video_stage",onClick:t[12]||(t[12]=q((...R)=>i.requestClose&&i.requestClose(...R),["self"]))},[l("p",U4,d(i.srAnnounce),1),l("div",{ref:"mediaBody",class:D(["fcom_space_media_video_body",{fcom_space_media_zoomed:e.imageScale>1,fcom_space_media_body_image:i.currentKind==="image",fcom_space_media_body_audio:i.currentKind==="audio"}]),onClick:t[11]||(t[11]=q((...R)=>i.requestClose&&i.requestClose(...R),["self"]))},[i.currentKind==="image"?(n(),r("img",{key:0,src:i.currentItem.url,alt:i.imageAlt,draggable:"false",style:me(e.imageTransformStyle),class:D({fcom_space_media_dragging:e.isPanning}),onMousedown:t[3]||(t[3]=q((...R)=>e.onImagePanStart&&e.onImagePanStart(...R),["prevent"])),onTouchstart:t[4]||(t[4]=(...R)=>e.onImageTouchStart&&e.onImageTouchStart(...R)),onTouchmove:t[5]||(t[5]=q((...R)=>e.onImageTouchMove&&e.onImageTouchMove(...R),["prevent"])),onTouchend:t[6]||(t[6]=(...R)=>e.onImageTouchEnd&&e.onImageTouchEnd(...R)),onTouchcancel:t[7]||(t[7]=(...R)=>e.onImageTouchEnd&&e.onImageTouchEnd(...R)),onDblclick:t[8]||(t[8]=(...R)=>e.toggleImageZoom&&e.toggleImageZoom(...R))},null,46,B4)):i.currentKind==="video"||i.currentKind==="audio"?(n(),r(T,{key:1},[i.playerMedia&&i.hasFluentPlayer&&!o.fluentPlayerFailed?(n(),v(k,{key:i.playerMedia.media_id,media:i.playerMedia,onLoadFailed:t[9]||(t[9]=R=>o.fluentPlayerFailed=!0)},null,8,["media"])):i.currentKind==="video"&&i.currentMediaUrl&&!o.nativeVideoFailed?(n(),r("video",{key:1,src:i.currentMediaUrl,"aria-label":(($=(w=i.currentItem)==null?void 0:w.settings)==null?void 0:$.title)||((C=(y=i.currentItem)==null?void 0:y.feed)==null?void 0:C.title)||e.$t("Video"),controls:"",autoplay:"",playsinline:"",onError:t[10]||(t[10]=R=>o.nativeVideoFailed=!0)},null,40,D4)):i.currentKind==="video"&&i.currentMediaUrl?(n(),r("p",R4,d(e.$t("This video could not be played.")),1)):i.currentKind==="audio"&&i.currentMediaUrl?(n(),r("audio",{key:3,src:i.currentMediaUrl,"aria-label":((V=(L=i.currentItem)==null?void 0:L.settings)==null?void 0:V.title)||((F=(I=i.currentItem)==null?void 0:I.feed)==null?void 0:F.title)||e.$t("Audio"),controls:""},null,8,x4)):_("",!0)],64)):_("",!0)],2),i.currentKind==="video"||i.currentKind==="audio"?(n(),r("div",O4,[a(b,gs(ys(i.metaProps)),null,16)])):_("",!0),i.currentItem&&i.currentKind==="image"?(n(),r("div",H4,[a(b,gs(ys(i.metaProps)),null,16),l("div",j4,[(n(!0),r(T,null,x(i.zoomButtons,R=>(n(),r("button",{key:R.label,type:"button",class:"fcom_space_media_lightbox_icon","aria-label":R.label,disabled:R.disabled,onClick:R.action},[a(f,null,{default:c(()=>[(n(),v(qt(R.icon)))]),_:2},1024)],8,N4))),128))])])):_("",!0)])]}),_:1},8,["modelValue","width","before-close","aria-label","class","onOpened","onClosed"])}const q4=P(P4,[["render",z4]]),Ao={data(){return{feedLoadingId:null}},methods:{feedRoute(e){var u,o,i;const t=(u=e.feed)==null?void 0:u.slug,s=((i=(o=e.feed)==null?void 0:o.space)==null?void 0:i.slug)||this.spaceSlug;return s?{name:"space_feed",params:{feed_slug:t,space:s}}:{name:"single_feed",params:{feed_slug:t}}},feedHref(e){var t;if((t=e.feed)!=null&&t.slug)return this.$router.resolve(this.feedRoute(e)).href},openFeed(e,t){var u;const s=(u=e.feed)==null?void 0:u.slug;if(s&&!(t&&(t.metaKey||t.ctrlKey))){if(!this.hasFeature("show_post_modal")){t&&t.preventDefault(),this.$router.push(this.feedRoute(e));return}t&&t.preventDefault(),this.feedLoadingId!==e.feed.id&&(this.feedLoadingId=e.feed.id,this.$get("feeds/"+s+"/by-slug").then(o=>{o!=null&&o.feed&&this.$eventBus.emit("showFeedModal",{feed:o.feed})}).catch(o=>{this.$handleError&&this.$handleError(o)}).finally(()=>{this.feedLoadingId=null}))}}}},G4={name:"MediaAudioList",components:{FluentPlayerPreview:Vt,ExpandIcon:_s},mixins:[Ao],props:{items:{type:Array,default:()=>[]},spaceSlug:{type:String,default:""}},data(){return{visibleIds:{},failedIds:{},reloadKey:0}},computed:{hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))}},methods:{observeRow(e){!e||this.visibleIds[e.dataset.id]||(this._io?this._io.observe(e):this.visibleIds[e.dataset.id]=!0)},onRowVisible(e){e.forEach(t=>{t.isIntersecting&&(this.visibleIds[t.target.dataset.id]=!0,this._io.unobserve(t.target))})},playerMediaFor(e){var u,o,i;if(this._playerMediaCache[e.id])return this._playerMediaCache[e.id];const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};t.src||(t.src=e.url);const s={media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((u=e.feed)==null?void 0:u.id)||"",share_url:((o=e.feed)==null?void 0:o.permalink)||"",title:t.title||((i=e.feed)==null?void 0:i.title)||""};return this._playerMediaCache[e.id]=s,s}},created(){this._playerMediaCache={},typeof IntersectionObserver<"u"&&(this._io=new IntersectionObserver(this.onRowVisible,{rootMargin:"200px"}))},beforeUnmount(){this._io&&(this._io.disconnect(),this._io=null)},activated(){this._activatedOnce&&this.reloadKey++,this._activatedOnce=!0},deactivated(){var e,t;(t=(e=this.$el)==null?void 0:e.querySelectorAll)==null||t.call(e,"audio, video, media-player").forEach(s=>{try{typeof s.pause=="function"&&s.pause()}catch{}})}},Y4={class:"fcom_space_media_audio_list all_media_holder"},W4=["data-id"],K4=["href","aria-label","onClick"],Z4={key:1,class:"fcom_audio_row_placeholder","aria-hidden":"true"},J4=["src","aria-label"];function Q4(e,t,s,u,o,i){const m=p("ExpandIcon"),f=Ie,h=p("fluent-player-preview");return n(),r("div",Y4,[(n(!0),r(T,null,x(s.items,g=>{var k,b,S;return n(),r("div",{key:g.id,ref_for:!0,ref:i.observeRow,"data-id":g.id,class:"fcom_space_media_audio_row"},[(k=g.feed)!=null&&k.slug?(n(),v(f,{key:0,content:e.$t("Open post"),placement:"top","show-after":200},{default:c(()=>[l("a",{href:e.feedHref(g),class:"fcom_audio_row_open","aria-label":e.$t("Open post"),onClick:q(w=>e.openFeed(g,w),["stop"])},[a(m)],8,K4)]),_:2},1032,["content"])):_("",!0),i.hasFluentPlayer&&!o.failedIds[g.id]?(n(),r(T,{key:1},[o.visibleIds[g.id]?(n(),v(h,{key:g.id+"-"+o.reloadKey,media:i.playerMediaFor(g),onLoadFailed:w=>o.failedIds[g.id]=!0},null,8,["media","onLoadFailed"])):(n(),r("div",Z4))],64)):g.url?(n(),r("audio",{key:2,src:g.url,"aria-label":((b=g.settings)==null?void 0:b.title)||((S=g.feed)==null?void 0:S.title)||e.$t("Audio"),controls:"",preload:"none",class:"fcom_audio_row_native"},null,8,J4)):_("",!0)],8,W4)}),128))])}const X4=P(G4,[["render",Q4]]),e5={name:"SpaceMedia",components:{MediaLightbox:q4,MediaAudioList:X4,ExpandIcon:_s},mixins:[Ao],props:["space","space_profile","space_slug"],emits:["refetch"],inheritAttrs:!1,data(){return{hasAudio:!1,items:[],cursor:0,hasMore:!1,loading:!1,fetchToken:0,permission_failed:!1,viewerIndex:0,mediaDialog:!1,failedMedia:{},boundScrollHandler:null,cache:{}}},computed:{activeType:{get(){const e=this.$route.query.type;return["photos","videos","audios"].includes(e)?e:"photos"},set(e){const t={...this.$route.query};e==="photos"?delete t.type:t.type=e,this.$router.push({query:t}).catch(()=>{})}},spaceSlug(){var e;return((e=this.space_profile)==null?void 0:e.slug)||this.space_slug||this.space},isVideoLightboxOpen(){var e;return this.mediaDialog&&((e=this.items[this.viewerIndex])==null?void 0:e.kind)==="video"}},watch:{activeType(){this.loadActiveType()}},methods:{async fetch(e=!1){if(e&&this.loading)return;const t=++this.fetchToken,s=this.activeType;this.loading=!0;try{const u={type:s,per_page:24};e&&this.cursor&&(u.cursor=this.cursor);const o=await this.$get("media-gallery/"+this.spaceSlug,u);if(t!==this.fetchToken||s!==this.activeType)return;const i=o.items||[];this.items=e?this.items.concat(i):i,this.hasMore=!!o.has_more,typeof o.has_audio<"u"&&(this.hasAudio=o.has_audio),this.cursor=o.cursor||0,this.cache[s]={items:this.items,cursor:this.cursor,hasMore:this.hasMore}}catch(u){if(t!==this.fetchToken)return;if(u!=null&&u.permission_failed){this.permission_failed=!0;return}this.$handleError&&this.$handleError(u)}finally{t===this.fetchToken&&(this.loading=!1)}},loadActiveType(){const e=this.cache[this.activeType];if(e){this.items=e.items,this.cursor=e.cursor,this.hasMore=e.hasMore;return}this.items=[],this.cursor=0,this.hasMore=!1,this.fetch(!1)},openItem(e){this.items[e]&&(this.viewerIndex=e,this.mediaDialog=!0)},handleScrollAutoLoad(){var i;if(!this.hasMore||this.loading)return;const e=document.querySelector(".all_media_holder"),t=e&&e.lastElementChild;if(!t)return;const s=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;if(!s)return;const u=t.getBoundingClientRect(),o=s.getBoundingClientRect();u.bottom-o.bottom<100&&this.fetch(!0)}},created(){this.fetch(!1)},mounted(){this.boundScrollHandler=this.handleScrollAutoLoad.bind(this),document.addEventListener("fcom_layout_scroll",this.boundScrollHandler)},beforeUnmount(){this.boundScrollHandler&&document.removeEventListener("fcom_layout_scroll",this.boundScrollHandler)}},t5={class:"card_header"},s5={class:"member_status"},o5={key:0,class:"fcom_space_media_tabs"},i5={key:0,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},n5={class:"permission_failed"},l5=["href"],a5={key:1,class:"fcom_space_media_card"},r5={key:1,class:"fcom_space_media_empty no_members"},c5={key:0},d5={key:1},u5={key:2},_5={key:0,class:"fcom_space_media_grid all_media_holder"},m5=["aria-label","onClick","onKeydown"],h5=["src","alt"],f5=["src","poster","onError"],p5=["src","alt"],g5={key:3,class:"fcom_space_media_play_badge","aria-hidden":"true"},y5=["href","aria-label","onClick"],v5={key:3,class:"fcom_space_media_load_more",style:{"margin-top":"20px","text-align":"center"}};function b5(e,t,s,u,o,i){const m=je,f=be,h=J,g=p("media-audio-list"),k=p("ExpandIcon"),b=Ie,S=O,w=p("media-lightbox");return n(),r("div",{class:D(["fcom_space_media",{fcom_space_media_video_open:i.isVideoLightboxOpen}])},[l("div",t5,[l("div",s5,[l("h3",null,d(e.$t("Media Gallery")),1)]),o.permission_failed?_("",!0):(n(),r("div",o5,[a(f,{modelValue:i.activeType,"onUpdate:modelValue":t[0]||(t[0]=$=>i.activeType=$),size:"default"},{default:c(()=>[a(m,{label:"photos",value:"photos"},{default:c(()=>[M(d(e.$t("Photos")),1)]),_:1}),a(m,{label:"videos",value:"videos"},{default:c(()=>[M(d(e.$t("Videos")),1)]),_:1}),o.hasAudio?(n(),v(m,{key:0,label:"audios",value:"audios","data-testid":"tab-audios"},{default:c(()=>[M(d(e.$t("Audios")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])]))]),o.permission_failed?(n(),r("div",i5,[l("div",n5,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,l5)])])):(n(),r("div",a5,[o.loading&&!o.items.length?(n(),v(h,{key:0,class:"fcom_mt_20 white_loaded",animated:!0,rows:5})):o.items.length?(n(),r(T,{key:2},[(n(),v(Ho,null,[i.activeType==="audios"?(n(),v(g,{key:0,items:o.items,"space-slug":i.spaceSlug},null,8,["items","space-slug"])):_("",!0)],1024)),i.activeType!=="audios"?(n(),r("div",_5,[(n(!0),r(T,null,x(o.items,($,y)=>{var C,L,V,I,F,R,B;return n(),r("div",{key:$.id,class:D(["fcom_space_media_cell",["fcom_kind_"+$.kind]]),role:"button",tabindex:"0","aria-label":((C=$.settings)==null?void 0:C.title)||((L=$.feed)==null?void 0:L.title)||e.$t("Open media"),onClick:U=>i.openItem(y),onKeydown:[te(U=>i.openItem(y),["enter"]),te(q(U=>i.openItem(y),["prevent"]),["space"])]},[$.kind==="image"?(n(),r("img",{key:0,src:$.url,alt:((V=$.feed)==null?void 0:V.title)||"",loading:"lazy"},null,8,h5)):o.failedMedia[$.url]?(F=$.settings)!=null&&F.posterSrc?(n(),r("img",{key:2,src:$.settings.posterSrc,alt:((R=$.feed)==null?void 0:R.title)||"",loading:"lazy"},null,8,p5)):_("",!0):(n(),r("video",{key:1,src:$.url,poster:((I=$.settings)==null?void 0:I.posterSrc)||void 0,preload:"metadata",muted:"",playsinline:"",onError:U=>o.failedMedia[$.url]=!0},null,40,f5)),t[4]||(t[4]=l("span",{class:"fcom_space_media_overlay","aria-hidden":"true"},null,-1)),$.kind==="video"?(n(),r("span",g5)):_("",!0),(B=$.feed)!=null&&B.slug?(n(),v(b,{key:4,content:e.$t("Open post"),placement:"top","show-after":200},{default:c(()=>[l("a",{href:e.feedHref($),class:"fcom_space_media_feed_btn","aria-label":e.$t("Open post"),onClick:q(U=>e.openFeed($,U),["stop"]),onKeydown:t[1]||(t[1]=q(()=>{},["stop"]))},[a(k)],40,y5)]),_:2},1032,["content"])):_("",!0)],42,m5)}),128))])):_("",!0)],64)):(n(),r("div",r5,[i.activeType==="videos"?(n(),r("p",c5,d(e.$t("No videos yet. Videos shared in posts will appear here.")),1)):i.activeType==="audios"?(n(),r("p",d5,d(e.$t("No audios yet. Audio shared in posts will appear here.")),1)):(n(),r("p",u5,d(e.$t("No photos yet. Photos shared in posts will appear here.")),1))])),o.hasMore?(n(),r("div",v5,[a(S,{class:"fcom_secondary_button",disabled:o.loading,loading:o.loading,onClick:t[2]||(t[2]=$=>i.fetch(!0))},{default:c(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)])),a(w,{modelValue:o.mediaDialog,"onUpdate:modelValue":t[3]||(t[3]=$=>o.mediaDialog=$),items:o.items,"initial-index":o.viewerIndex},null,8,["modelValue","items","initial-index"])],2)}const k5=P(e5,[["render",b5]]);const w5={name:"PendingInvitations",components:{Pagination:$e},data(){return{loading:!1,loadingMore:!1,invitations:[],status:"all",pagination:{page:1,total:0,per_page:10},is_mod:!1}},props:{space_id:{type:Number,default:null}},computed:{getEmptyText(){return this.has_pro?this.$t("No Pending Invitations Found"):this.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")}},methods:{getInvitations(){this.loading=!0,this.$get("invitations",{space_id:this.space_id,page:this.pagination.page,per_page:this.pagination.per_page,status:this.status}).then(e=>{this.invitations=e.invitations.data,this.pagination.total=e.invitations.total,this.is_mod=e.is_mod}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleResend(e){this.loading=!0,this.$post("invitations/"+e.id+"/resend").then(t=>{this.$notify.success(t.message||this.$t("Invitation resent successfully"))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},handleDelete(e){this.$confirm(this.$t("Are you sure you want to delete this invitation?"),this.$t("Warning"),{confirmButtonText:this.$t("OK"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.loading=!0,this.$del("invitations/"+e.id).then(t=>{this.getInvitations()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})})}},mounted(){this.has_pro&&this.getInvitations()}},C5={class:"fcom_invitations"},$5={style:{margin:"20px 0"},class:"fcom_spaced_flex"},S5={key:0},V5={key:0,class:"fcom_person_name"},M5={key:1,class:"fcom_person_name"},L5={key:3,style:{margin:"0",padding:"0"}},T5={class:"fcom_person_name"};function F5(e,t,s,u,o,i){const m=ae,f=re,h=p("CopyDocument"),g=j,k=O,b=Zt,S=p("UserRouteLink"),w=p("DeleteFilled"),$=Jt,y=p("Pagination"),C=se("loading");return n(),r("div",C5,[l("div",$5,[l("h4",null,d(e.$t("Invitations")),1),e.has_pro?(n(),r("div",S5,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=L=>{o.pagination.page=1,i.getInvitations()}),modelValue:o.status,"onUpdate:modelValue":t[1]||(t[1]=L=>o.status=L)},{default:c(()=>[(n(),r(T,null,x(["all","pending","accepted","active","expired"],L=>a(m,{key:L,label:e.$labelize(L),value:L},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),Y((n(),v($,{data:o.invitations,border:"","empty-text":i.getEmptyText,style:{width:"100%","border-radius":"8px"}},{default:c(()=>[a(b,{prop:"message",label:e.$t("Invitee"),"min-width":"180"},{default:c(L=>[L.row.message?(n(),r("span",V5,d(L.row.meta.invitee_name)+" <"+d(L.row.message)+"> ",1)):(n(),r("span",M5,d(L.row.meta.title)+" ("+d(e.$t("Invitation Link"))+") ",1)),L.row.access_url?(n(),v(k,{key:2,type:"info",size:"small",text:"",onClick:V=>e.$toClipboard(L.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:c(()=>[a(g,{title:e.$t("Copy Invitation URl")},{default:c(()=>[a(h)]),_:1},8,["title"]),l("span",null,d(e.$t("Copy Link")),1)]),_:1},8,["onClick"])):_("",!0),L.row.message?_("",!0):(n(),r("p",L5,d(L.row.meta.limit?e.$t("Limit")+": "+L.row.meta.limit:"")+" "+d(parseInt(L.row.reactions_count)>0?" | "+e.$t("Usage")+": "+L.row.reactions_count:"")+" "+d(L.row.meta.expire_date?" | "+e.$t("Expire Date")+": "+e.smartDate(L.row.meta.expire_date):""),1))]),_:1},8,["label"]),o.is_mod?(n(),v(b,{key:0,prop:"user_id",label:e.$t("Invited By"),width:"180"},{default:c(L=>[l("span",T5,[a(S,{xprofile:L.row.xprofile},null,8,["xprofile"])])]),_:1},8,["label"])):_("",!0),a(b,{prop:"status",label:e.$t("Status"),width:"120"},{default:c(L=>[l("span",null,d(e.$labelize(L.row.status)),1)]),_:1},8,["label"]),a(b,{label:e.$t("Actions")},{default:c(L=>[L.row.status=="pending"?Y((n(),v(k,{key:0,size:"small",onClick:V=>i.handleResend(L.row)},{default:c(()=>[M(d(e.$t("Resend")),1)]),_:1},8,["onClick"])),[[C,o.loading]]):_("",!0),a(k,{"aria-label":e.$t("Delete invitation"),onClick:V=>i.handleDelete(L.row),plain:"",type:"danger",size:"small"},{default:c(()=>[a(g,{title:e.$t("Delete invitation")},{default:c(()=>[a(w)]),_:1},8,["title"])]),_:1},8,["aria-label","onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[C,o.loading]]),a(y,{hide_on_single:!1,pagination:o.pagination,onFetch:i.getInvitations},null,8,["pagination","onFetch"])])}const P5=P(w5,[["render",F5]]);const I5={name:"CreateInvitationLink",props:["space_profile"],data(){return{form:{title:"",limit:"",expire_date:""},creating:!1,createdItem:null}},methods:{createLink(){this.has_pro&&(this.creating=!0,this.$post("invitations/link",{space_id:this.space_profile.id,...this.form}).then(e=>{this.$notify.success(e.message),this.createdItem=e.invitation,this.form={title:"",limit:"",expire_date:""}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.creating=!1}))}}},E5={class:"fcom_invitation_link_wrap"},A5={class:"fcom_invite_head"},U5={class:"fcom_invite_body"},B5={key:1},D5={key:1,style:{padding:"20px"}},R5={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function x5(e,t,s,u,o,i){const m=ie,f=pe,h=Ye,g=O,k=ge,b=p("CopyDocument"),S=j;return n(),r("div",E5,[l("div",A5,[l("h4",null,d(e.$t("Create an invitation link")),1),l("p",null,d(e.$t("Create a simple link to share with potential members. Anyone with the link can join this space.")),1)]),l("div",U5,[o.createdItem?(n(),r("div",D5,[l("h4",R5,d(e.$t("Please share this url to your audience to join this space")),1),a(m,{modelValue:o.createdItem.access_url,"onUpdate:modelValue":t[6]||(t[6]=w=>o.createdItem.access_url=w),readonly:""},{suffix:c(()=>[a(g,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=w=>e.$toClipboard(o.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:c(()=>[a(S,null,{default:c(()=>[a(b)]),_:1}),l("span",null,d(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(n(),v(k,{key:0,onSubmit:t[3]||(t[3]=q(w=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[4]||(t[4]=w=>o.form=w),"label-position":"top"},{default:c(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:c(()=>[a(m,{modelValue:o.form.title,"onUpdate:modelValue":t[0]||(t[0]=w=>o.form.title=w),placeholder:e.$t("Enter a title for the invitation link")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Limit the number of uses")},{default:c(()=>[a(m,{type:"number",modelValue:o.form.limit,"onUpdate:modelValue":t[1]||(t[1]=w=>o.form.limit=w),placeholder:e.$t("Leave empty for unlimited uses")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Expire Date (Leave empty for no expiration)")},{default:c(()=>[a(h,{style:{"min-width":"300px"},modelValue:o.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=w=>o.form.expire_date=w),type:"date",placeholder:e.$t("Leave empty for no expiration"),"value-format":"YYYY-MM-DD",format:e.siteDateFormat},null,8,["modelValue","placeholder","format"])]),_:1},8,["label"]),a(f,null,{default:c(()=>[e.has_pro?(n(),v(g,{key:0,onClick:i.createLink,loading:o.creating,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(n(),r("div",B5,[l("p",null,d(e.$t("This feature is only available in the Pro version of FluentCommunity. Please upgrade")),1)]))]),_:1})]),_:1},8,["modelValue"]))])])}const O5=P(I5,[["render",x5]]),H5={name:"InviteUser",props:["space_profile"],data(){return{inviteEmail:"",inviteName:"",role:"member",inviting:!1}},methods:{invite(){const e=(this.inviteEmail||"").trim();if(!/^\S+@\S+\.\S+$/.test(e)){this.$notify.error(this.$t("Please enter a valid email address."));return}this.inviting=!0,this.$get("spaces/users/search",{context:"add_member",search:e,space_id:this.space_profile.id}).then(t=>{const s=(t.users.data||[]).find(u=>(u.user_email||"").toLowerCase()===e.toLowerCase());return s?this.$post("spaces/"+this.space_profile.slug+"/members",{user_id:s.ID,role:this.role}).then(u=>{this.$notify.success(u.message),this.resetForm()}):this.$post("invitations",{email:e,invitee_name:(this.inviteName||"").trim(),space_id:this.space_profile.id}).then(u=>{this.$notify.success(u.message||this.$t("Invitation sent.")),this.resetForm(),this.$emit("invited")})}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},resetForm(){this.inviteEmail="",this.inviteName="",this.role="member"}}},j5={class:"fcom_invitation_link_wrap"},N5={class:"fcom_invite_head"},z5={class:"fcom_invite_body"};function q5(e,t,s,u,o,i){const m=ie,f=pe,h=ae,g=re,k=O,b=ge;return n(),r("div",j5,[l("div",N5,[l("h4",null,d(e.$t("Invite a user by email")),1),l("p",null,d(e.$t("If the user already exists, they will be added to the space directly. Otherwise, an email invitation will be sent.")),1)]),l("div",z5,[a(b,{onSubmit:t[6]||(t[6]=q(()=>{},["prevent"])),"label-position":"top"},{default:c(()=>[a(f,{label:e.$t("Email")},{default:c(()=>[a(m,{modelValue:o.inviteEmail,"onUpdate:modelValue":t[0]||(t[0]=S=>o.inviteEmail=S),type:"email",placeholder:e.$t("Enter email address"),onKeyup:t[1]||(t[1]=te(S=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Invitee Name (optional)")},{default:c(()=>[a(m,{modelValue:o.inviteName,"onUpdate:modelValue":t[2]||(t[2]=S=>o.inviteName=S),placeholder:e.$t("Enter invitee Name"),onKeyup:t[3]||(t[3]=te(S=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Membership Role")},{default:c(()=>[a(g,{modelValue:o.role,"onUpdate:modelValue":t[4]||(t[4]=S=>o.role=S),placeholder:e.$t("Select Role")},{default:c(()=>[a(h,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(h,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(h,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:c(()=>[a(k,{class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,onClick:t[5]||(t[5]=S=>i.invite())},{default:c(()=>[M(d(e.$t("Send Invitation")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})])])}const G5=P(H5,[["render",q5]]),Y5={name:"SpaceInviations",components:{CreateInvitationLink:O5,PendingInvitations:P5,InviteUser:G5},props:["space_profile"],data(){return{currentTab:"invitations"}}},W5={key:0,class:"card_header"},K5={class:"permission_failed"},Z5=["href"],J5={key:1};function Q5(e,t,s,u,o,i){const m=p("pending-invitations"),f=Ds,h=p("CreateInvitationLink"),g=p("InviteUser"),k=Rs;return e.hasSpaceAdminAccess(s.space_profile)?(n(),r("div",J5,[a(k,{modelValue:o.currentTab,"onUpdate:modelValue":t[1]||(t[1]=b=>o.currentTab=b),type:"border-card"},{default:c(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:c(()=>[o.currentTab=="invitations"?(n(),v(m,{key:0,space_id:s.space_profile.id},null,8,["space_id"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invitation_links",label:e.$t("New Invitation Link")},{default:c(()=>[o.currentTab=="invitation_links"?(n(),v(h,{key:0,space_profile:s.space_profile},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invite_user",label:e.$t("Invite User")},{default:c(()=>[o.currentTab=="invite_user"?(n(),v(g,{key:0,space_profile:s.space_profile,onInvited:t[0]||(t[0]=b=>o.currentTab="invitations")},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue"])])):(n(),r("div",W5,[l("div",K5,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view invitations")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,Z5)])]))}const X5=P(Y5,[["render",Q5]]),eC={name:"GlobIcon"},tC={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function sC(e,t,s,u,o,i){return n(),r("svg",tC,[...t[0]||(t[0]=[l("path",{d:"M3.1564 3.30236C2.23368 4.26115 1.66634 5.5644 1.66634 7.00016C1.66634 9.9457 4.05415 12.3335 6.99967 12.3335C7.72021 12.3335 8.40741 12.1906 9.03441 11.9316C9.11107 11.4313 8.94287 10.9512 8.87407 10.7832C8.72101 10.4102 8.21574 9.7723 7.37227 8.88736C7.14714 8.6507 7.16161 8.46916 7.24207 7.9297L7.25134 7.86876C7.30601 7.49923 7.39774 7.28076 8.64114 7.08336C9.27281 6.98323 9.43894 7.2357 9.66921 7.5853C9.69467 7.62403 9.72014 7.66203 9.74621 7.7001C9.96494 8.01996 10.127 8.0931 10.3718 8.20443C10.4815 8.25416 10.6183 8.3169 10.8017 8.4211C11.2364 8.6695 11.2364 8.94996 11.2364 9.56496V9.6347C11.2364 9.89576 11.2109 10.125 11.1707 10.3241C11.8982 9.4125 12.333 8.2571 12.333 7.00016C12.333 4.80076 11.0017 2.9123 9.10094 2.09671C8.73214 2.34558 8.22621 2.69834 8.04967 2.94016C7.95941 3.06375 7.83181 3.6946 7.41681 3.74667C7.30807 3.76032 7.16221 3.75076 7.00767 3.74081C6.59334 3.71388 6.02647 3.67754 5.84501 4.17013C5.72981 4.4823 5.70954 5.3298 6.08227 5.7697C6.14194 5.83996 6.15347 5.96996 6.11294 6.11583C6.05967 6.30736 5.95207 6.4239 5.91854 6.44796C5.85427 6.41103 5.72607 6.26223 5.63926 6.16096C5.43003 5.91783 5.16904 5.61505 4.83165 5.52134C4.70897 5.48738 4.57411 5.45928 4.44333 5.43174C4.07727 5.35501 3.66263 5.26772 3.56629 5.06218C3.49595 4.91163 3.49626 4.7043 3.49653 4.48526C3.49653 4.20763 3.49653 3.89369 3.36053 3.58854C3.30798 3.47044 3.2376 3.37647 3.1564 3.30236ZM6.99967 13.6668C3.31777 13.6668 0.333008 10.682 0.333008 7.00016C0.333008 3.31826 3.31777 0.333496 6.99967 0.333496C10.6815 0.333496 13.6663 3.31826 13.6663 7.00016C13.6663 10.682 10.6815 13.6668 6.99967 13.6668Z",fill:"currentColor"},null,-1)])])}const Uo=P(eC,[["render",sC]]),oC={name:"GroupIcon"},iC={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function nC(e,t,s,u,o,i){return n(),r("svg",iC,[...t[0]||(t[0]=[l("path",{d:"M13.8494 12C14.3489 12 14.7462 11.6856 15.103 11.2461C15.8333 10.3463 14.6342 9.62723 14.1769 9.27507C13.712 8.91708 13.1929 8.71428 12.6667 8.66667M12 7.33333C12.9205 7.33333 13.6667 6.58714 13.6667 5.66667C13.6667 4.74619 12.9205 4 12 4",stroke:"currentColor","stroke-linecap":"round"},null,-1),l("path",{d:"M2.15096 12C1.65143 12 1.2541 11.6856 0.897356 11.2461C0.167051 10.3463 1.36611 9.62723 1.82342 9.27507C2.28831 8.91708 2.80738 8.71428 3.33366 8.66667M3.66699 7.33333C2.74652 7.33333 2.00033 6.58714 2.00033 5.66667C2.00033 4.74619 2.74652 4 3.66699 4",stroke:"currentColor","stroke-linecap":"round"},null,-1),l("path",{d:"M5.38953 10.0738C4.70834 10.495 2.92232 11.3551 4.01013 12.4313C4.54151 12.957 5.13334 13.333 5.87741 13.333H10.1232C10.8673 13.333 11.4591 12.957 11.9905 12.4313C13.0783 11.3551 11.2923 10.495 10.6111 10.0738C9.01375 9.08608 6.9869 9.08608 5.38953 10.0738Z",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M10.3337 4.99984C10.3337 6.2885 9.28899 7.33317 8.00033 7.33317C6.71166 7.33317 5.66699 6.2885 5.66699 4.99984C5.66699 3.71117 6.71166 2.6665 8.00033 2.6665C9.28899 2.6665 10.3337 3.71117 10.3337 4.99984Z",stroke:"currentColor"},null,-1)])])}const Bt=P(oC,[["render",nC]]),lC={name:"AllCommunities",components:{User:ri,GlobIcon:Uo,Layout:we,AppLayout:Se,CreateSpaceForm:ds,GroupIcon:Bt,Pagination:$e,Search:Fe},setup(){return{spaceStore:He()}},data(){return{communities:[],loading:!0,joining:null,pagination:{page:1,per_page:24,total:0},search:"",type:"all",sort_by:"alphabetical"}},methods:{getCommunities(){this.loading=!0,this.$get("spaces/discover",{type:this.type,search:this.search,sort_by:this.sort_by,page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.communities=e.spaces.data,this.pagination.total=e.spaces.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},goToSpaceFeeds(e){this.$router.push({name:"space_feeds",params:{space:e}})},getSpaceFeedsRoute(e){return{name:"space_feeds",params:{space:e}}},getExcerpt(e,t=50){if(!e)return"";let s=e.replace(/(<([^>]+)>)/ig,"");return typeof DOMParser<"u"&&(s=new DOMParser().parseFromString(s,"text/html").body.textContent||""),s.length>t&&(s=s.substring(0,t)+"..."),s},async join(e){if(e.privacy!="public"||!this.auth.user_id){this.$router.push({name:"space_feeds",params:{space:e.slug}});return}this.joining=e.slug;try{await this.spaceStore.joinSpace(e.slug,e),this.$notify.success(this.$t("Successfully joined the space")),this.$eventBus.emit("reloadMenu"),delete this.spaceStore.spacesBySlug[e.slug],this.$router.push({name:"space_feeds",params:{space:e.slug}})}catch(t){this.$handleError(t)}finally{this.joining=null}},fireCreateSpace(e=null){this.$eventBus.emit("createSpaceModal",e)},goToSpaceGroups(){window.location.href=this.$getRouteLink("admin/settings/space_groups")},SwitchToSpaceView(e){this.type=e,this.getCommunities()},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.getCommunities()},changeSortBy(){this.$storeLocalData("space_sort_by",this.sort_by),this.toSearch()},openCreateSpace(e){e==="yes"&&this.fireCreateSpace()}},created(){this.$eventBus.on("open_create_space_modal",this.openCreateSpace)},mounted(){this.sort_by=this.$getLocalData("space_sort_by","alphabetical"),this.getCommunities(),this.$route.query.create_space=="yes"&&this.fireCreateSpace(),this.changeTitle(this.$t("Spaces"))},beforeUnmount(){this.$eventBus.off("open_create_space_modal",this.openCreateSpace)}},aC={class:"object_menu"},rC={class:"fcom_space_menu_ul"},cC={key:0},dC={key:1},uC={class:"actions_items"},_C={class:"search_member"},mC={class:"feed_filters"},hC={id:"feed_short_by",class:"fcom_feed_filter_label"},fC={class:"fcom_communities"},pC={key:0,class:"fcom_no_items_wrap"},gC={key:1,class:"fcom_box_card_list"},yC=["aria-label"],vC={class:"fcom_box_card_avatar"},bC=["src"],kC=["src"],wC=["alt","src"],CC={class:"fcom_box_card_info"},$C={class:"fcom_box_card_name"},SC={key:0},VC={class:"fcom_box_card_details"},MC={class:"details_item"},LC={key:0,class:"details_item"},TC=["textContent"],FC={class:"fcom_box_card_action"},PC=["disabled","onClick"],IC=["onClick"];function EC(e,t,s,u,o,i){const m=O,f=p("MoreFilled"),h=j,g=fe,k=p("Search"),b=ie,S=ae,w=re,$=p("router-link"),y=De,C=p("GlobIcon"),L=p("Lock"),V=p("GroupIcon"),I=p("pagination"),F=p("layout"),R=p("app-layout"),B=se("loading");return n(),v(R,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a(F,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:c(()=>[l("div",aC,[l("ul",rC,[l("li",null,[l("a",{onClick:t[0]||(t[0]=q(U=>i.SwitchToSpaceView("all"),["prevent"])),class:D(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Spaces")),3)]),e.auth.user_id?(n(),r("li",cC,[l("a",{onClick:t[1]||(t[1]=q(U=>i.SwitchToSpaceView("joined"),["prevent"])),class:D(o.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(n(),r("li",dC,[a(m,{onClick:t[2]||(t[2]=U=>i.fireCreateSpace()),class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(n(),v(g,{key:0,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:c(()=>[a(m,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(h,null,{default:c(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),default:c(()=>[l("ul",uC,[l("li",{onClick:t[3]||(t[3]=(...U)=>i.goToSpaceGroups&&i.goToSpaceGroups(...U))},d(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:c(()=>[l("div",_C,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=U=>o.search=U),placeholder:e.$t("Search Space...")},{prefix:c(()=>[a(h,null,{default:c(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",mC,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",hC,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort Spaces by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=U=>o.sort_by=U),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=U=>i.changeSortBy())},{default:c(()=>[a(S,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(S,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a(S,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),Y((n(),r("div",fC,[!o.loading&&o.communities.length==0?(n(),r("div",pC,[o.search?(n(),r(T,{key:0},[l("h3",null,d(e.$t("No spaces found based on your search criteria")),1),l("p",null,d(e.$t("No spaces match your search criteria. Try adjusting your search terms or browse our space catalog.")),1)],64)):(n(),r(T,{key:1},[l("h3",null,d(e.$t("No spaces found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some spaces for you!")),1)],64))])):(n(),r("div",gC,[(n(!0),r(T,null,x(o.communities,U=>(n(),r("div",{role:"region","aria-label":e.$t("Space Lists"),key:U.id,class:"fcom_each_box_card"},[l("div",vC,[a($,{"aria-label":e.$t("Go to Space"),to:i.getSpaceFeedsRoute(U.slug)},{default:c(()=>{var A;return[(A=U.settings)!=null&&A.og_image?(n(),r("img",{key:0,src:U.settings.og_image,alt:""},null,8,bC)):U.cover_photo?(n(),r("img",{key:1,src:U.cover_photo,alt:""},null,8,kC)):(n(),r("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,wC))]}),_:2},1032,["aria-label","to"])]),l("div",CC,[l("div",$C,[a($,{to:i.getSpaceFeedsRoute(U.slug)},{default:c(()=>[M(d(i.getExcerpt(U.title,24))+" ",1),U.space_pivot?(n(),v(y,{key:0,type:"success"},{default:c(()=>[M(d(e.$labelize(U.space_pivot.role))+" ",1),U.space_pivot.status!="active"?(n(),r("span",SC," ("+d(e.$labelize(U.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",VC,[l("div",MC,[U.privacy==="public"?(n(),v(h,{key:0},{default:c(()=>[a(C)]),_:1})):(n(),v(h,{key:1},{default:c(()=>[a(L)]),_:1})),l("span",null,d(e.$labelize(U.privacy)),1)]),U.members_count?(n(),r("div",LC,[a(h,null,{default:c(()=>[a(V)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(U.members_count))),1)])):_("",!0)]),U.description?(n(),r("div",{key:0,class:"fcom_box_card_description",textContent:d(i.getExcerpt(U.description_rendered,85))},null,8,TC)):_("",!0),l("div",FC,[U.space_pivot?(n(),r("button",{key:1,class:"fcom_card_button",onClick:A=>i.goToSpaceFeeds(U.slug)},d(e.$t("View Space")),9,IC)):Y((n(),r("button",{key:0,class:"fcom_card_button",disabled:o.joining===U.slug,onClick:A=>i.join(U)},[M(d(e.$t("Join")),1)],8,PC)),[[B,o.joining===U.slug]])])])],8,yC))),128))])),a(I,{hide_on_single:!0,onFetch:i.getCommunities,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[B,o.loading]])]),_:1},8,["title"])]),_:1})}const AC=P(lC,[["render",EC]]),UC={name:"UserBadge",props:["badge","is_preview","profile"],computed:{renderingBadges(){var e;if(!this.appVars.user_badges&&!this.is_preview)return null;if(this.profile){let t=this.profile.badge_slugs;if(t||(t=(e=this.profile.meta)==null?void 0:e.badge_slug,typeof t=="string"&&(t=[t])),!t||t.length==0)return null;const s=new Set(t);return Object.keys(this.appVars.user_badges).filter(u=>s.has(u)).map(u=>this.appVars.user_badges[u])}return[this.badge]}}},BC=["src"],DC={key:1,class:"fcom_emoji"},RC={key:2,class:"fcom_shape"},xC={key:1};function OC(e,t,s,u,o,i){const m=j,f=Ie;return i.renderingBadges?(n(!0),r(T,{key:0},x(i.renderingBadges,h=>(n(),r("div",{class:D([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:c(()=>[l("div",{style:me({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(n(),r(T,{key:0},[h.config.logo?(n(),r("img",{key:0,alt:"",src:h.config.logo},null,8,BC)):h.config.emoji?(n(),r("span",DC,d(h.config.emoji),1)):h.config.shape_svg?(n(),r("span",RC,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(n(),r("span",xC,d(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const Bo=P(UC,[["render",OC]]),HC={name:"AddNotificationIcon"},jC={viewBox:"0 0 24 24","aria-hidden":"true",color:"currentColor",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-z80fyv r-19wmn03"};function NC(e,t,s,u,o,i){return n(),r("svg",jC,[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M22 5v2h-3v3h-2V7h-3V5h3V2h2v3h3zm-.86 13h-4.241c-.464 2.281-2.482 4-4.899 4s-4.435-1.719-4.899-4H2.87L4 9.05C4.51 5.02 7.93 2 12 2v2C8.94 4 6.36 6.27 5.98 9.3L5.13 16h13.73l-.38-3h2.02l.64 5zm-6.323 0H9.183c.412 1.164 1.51 2 2.817 2s2.405-.836 2.817-2z"})],-1)])])}const zC=P(HC,[["render",NC]]),qC={name:"NotificationAddedIcon"},GC={viewBox:"0 0 24 24","aria-hidden":"true",color:"currentColor",class:"r-4qtqp9 r-yyyyoo r-dnmrzs r-bnwqim r-lrvibr r-m6rgpd r-z80fyv r-19wmn03"};function YC(e,t,s,u,o,i){return n(),r("svg",GC,[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M12 2C7.93 2 4.51 5.02 4 9.05L2.87 18H7.1c.46 2.28 2.48 4 4.9 4s4.44-1.72 4.9-4h4.24l-.64-5h-2.02l.38 3H5.13l.85-6.7C6.36 6.27 8.94 4 12 4V2zm0 18c-1.31 0-2.42-.83-2.83-2h5.66c-.41 1.17-1.52 2-2.83 2zm.3-12.29l1.41-1.42 1.76 1.76 4.29-4.72 1.48 1.34-5.7 6.28-3.24-3.24z"})],-1)])])}const WC=P(qC,[["render",YC]]),KC={name:"AddUserForm",components:{SpaceIcon:ze,SpaceCourseSelector:us},props:["user_profile"],emits:["completed"],data(){return{loading:!0,saving:!1,selectedId:null,userMemberships:[],role:"member",selectedType:"space",selectedSlug:""}},methods:{updateSelectedType(e){this.selectedType=e},updateSelectedSlug(e){this.selectedSlug=e},fetchUserMemberships(){this.loading=!0,this.$get("profile/"+this.user_profile.username+"/memberships").then(e=>{this.userMemberships=e.memberships}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},addToSpace(){if(this.selectedType==="space"&&!this.role){this.$notify.error(this.$t("Please select a role"));return}this.saving=!0,this.$post("spaces/"+this.selectedSlug+"/members",{user_id:this.user_profile.user_id,role:this.role}).then(e=>{this.$notify.success(e.message),this.selectedId=null,this.role="member",this.$emit("completed")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})},addToCourse(){this.saving=!0,this.$post("admin/courses/"+this.selectedId+"/students",{user_id:this.user_profile.user_id}).then(e=>{this.$notify.success(e.message),this.selectedId=null,this.$emit("completed")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.fetchUserMemberships()}};function ZC(e,t,s,u,o,i){const m=ie,f=pe,h=p("SpaceCourseSelector"),g=ae,k=re,b=O,S=ge,w=se("loading");return n(),v(S,{onSubmit:t[4]||(t[4]=q($=>e.doNothing(),["prevent"])),"label-position":"top"},{default:c(()=>[a(f,{label:e.$t("User")},{default:c(()=>[a(m,{modelValue:s.user_profile.display_name+" ("+s.user_profile.email+")",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Select Space/Course")},{default:c(()=>[Y(a(h,{modelValue:o.selectedId,"onUpdate:modelValue":t[0]||(t[0]=$=>o.selectedId=$),memberships:o.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:i.updateSelectedType,onSelectedSlug:i.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[w,o.loading]])]),_:1},8,["label"]),o.selectedType==="space"?(n(),v(f,{key:0,label:e.$t("Membership Role")},{default:c(()=>[a(k,{placeholder:e.$t("Select Role"),modelValue:o.role,"onUpdate:modelValue":t[1]||(t[1]=$=>o.role=$)},{default:c(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),K(e.$slots,"after_form",{},()=>[a(f,null,{default:c(()=>[o.selectedType==="course"?Y((n(),v(b,{key:0,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[2]||(t[2]=$=>i.addToCourse())},{default:c(()=>[M(d(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[w,o.saving]]):Y((n(),v(b,{key:1,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[3]||(t[3]=$=>i.addToSpace())},{default:c(()=>[M(d(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[w,o.saving]])]),_:1})])]),_:3})}const JC=P(KC,[["render",ZC]]),QC={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:Ue()}},components:{UserBadge:Bo,ImageUploader:Re,BookmarkIcon:yo,FollowAction:st,AddNotificationIcon:zC,NotificationAddedIcon:WC,AddUserForm:JC},props:{profile:{required:!1},username:{required:!1},isOwn:{required:!1}},data(){return{updating:!1,isAddUserOpen:!1}},computed:{user_profile(){return this.profile?this.profile:{ID:0,title:".......",slug:"..",cover_photo:""}},isOwnProfile(){return this.auth&&this.user_profile.username==this.auth.username},level(){if(!this.has_leaderboard)return"";const e=Ae(this.user_profile.total_points);return e?e.level:0},getCoverPhotoButtonText(){return this.user_profile.cover_photo?this.$t("Change Cover"):this.$t("Upload Cover")},isOtherProfile(){var s;const e=this.auth.user_id,t=(s=this.profile)==null?void 0:s.user_id;return t&&e&&t!=e},showActions(){var e,t;return((t=(e=this.profile)==null?void 0:e.profile_nav_actions)==null?void 0:t.length)||this.showFollowAction},showFollowAction(){return this.hasFeature("followers_module")&&this.isOtherProfile},showOtherActions(){return this.isOtherProfile&&this.hasPermission("super_admin")},showBlock(){var t,s;if(!((t=this.profile)!=null&&t.user_id)||this.userStore.isBlocked(this.profile.user_id))return!1;const e=(s=this.profile)==null?void 0:s.follow;return this.showFollowAction&&(!e||String(e)!=="0")},isFollowing(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;if(this.userStore.isFollowing(this.profile.user_id))return!0;const e=(s=this.profile)==null?void 0:s.follow;return e!==void 0&&["1","2"].includes(String(e))},isNotificationOn(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;const e=this.userStore.getFollowLevel(this.profile.user_id);return e!==void 0?String(e)==="2":String((s=this.profile)==null?void 0:s.follow)==="2"},getTitle(){return this.isNotificationOn?this.$t("Turn off Email Notification of This User"):this.$t("Turn on Email Notification of This User")}},methods:{handleCoverPhotoUpload(e){this.profile.cover_photo=e,this.updateProfile({cover_photo:e})},handlePhotoUpload(e){this.profile.avatar=e,this.updateProfile({avatar:e})},removeAvatar(){var t;(t=this.$refs.avatarPopover)==null||t.hide();const e=this.isOwnProfile?this.$t("Are you sure you want to remove your profile photo?"):this.$t("Are you sure you want to remove the profile photo of %s?",this.user_profile.display_name);this.$confirm(e,this.$t("Remove Profile Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.profile.avatar="",this.profile.has_custom_avatar=!1,this.updateProfile({avatar:""})})},removeCoverPhoto(){const e=this.isOwnProfile?this.$t("Are you sure you want to remove your cover photo?"):this.$t("Are you sure you want to remove the cover photo of %s?",this.user_profile.display_name);this.$confirm(e,this.$t("Remove Cover Photo?"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.profile.cover_photo="",this.updateProfile({cover_photo:""})})},confirmAndBlock(){this.$confirm(this.$t("Blocking this user will hide their posts from your feed and prevent them from interacting with you. Are you sure you want to block this user?"),{confirmButtonText:this.$t("Block"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.blockUser()})},blockUser(){this.updating=!0,this.$post("profile/"+this.profile.username+"/block").then(e=>{var t;this.userStore.setFollows({[(t=this.profile)==null?void 0:t.user_id]:"0"}),this.$notify.success(e.message),this.$emit("refetch")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.updating=!1})},toggleNotification(){var t;const e=this.profile.follow=="2"?"1":"2";(t=this.profile)!=null&&t.user_id&&this.userStore.setFollows({[this.profile.user_id]:e})},async updateProfile(e){if(this.user_profile.username){this.updating=!0;try{await this.userStore.updateProfile(e,this.user_profile.username,this.user_profile.username),this.$notify.success(this.$t("Profile updated successfully")),this.$emit("refetch")}catch(t){this.$handleError(t)}finally{this.updating=!1}}},toggleEmailNotification(){this.updating=!0,this.$post("profile/"+this.profile.username+"/notification").then(e=>{this.$notify.success(e.message),this.toggleNotification()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.updating=!1})},openAddToDrawer(){this.isAddUserOpen=!0},userAdded(){this.isAddUserOpen=!1},handleDrawerClose(e){this.$refs.addUserForm&&(this.$refs.addUserForm.selectedId=null,this.$refs.addUserForm.role="member"),e()}}},XC={ref:"fcom_user_profile",class:"object_header user_header"},e6={key:0,class:"object_media_uploader"},t6={class:"object_info"},s6={class:"object_avatar"},o6=["alt","src"],i6=["aria-label"],n6={class:"fcom_avatar_actions"},l6=["aria-label"],a6={class:"object_name"},r6={class:"object_meta"},c6={key:0,class:"object_meta follower"},d6={class:"object_menu"},u6={key:0,class:"fcom_profile_nav"},_6=["href","target"],m6={key:1,class:"fcom_profile_menu_actions"},h6=["target","href"];function f6(e,t,s,u,o,i){var A,N,H,z,G,ne,E,Q,de;const m=O,f=p("image-uploader"),h=p("UploadFilled"),g=j,k=fe,b=p("verified-sign"),S=p("UserBadge"),w=p("router-link"),$=p("FollowAction"),y=p("NotificationAddedIcon"),C=p("AddNotificationIcon"),L=p("MoreFilled"),V=We,I=Ke,F=Ze,R=p("add-user-form"),B=Us,U=se("loading");return Y((n(),r("div",XC,[l("div",{style:me({backgroundImage:`url('${i.user_profile.cover_photo||""}')`}),class:D(["object_cover",{no_cover:!i.user_profile.cover_photo}])},[i.isOwnProfile||e.hasPermission("super_admin")?(n(),r("div",e6,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:c(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:c(()=>[M(d(i.getCoverPhotoButtonText),1)]),_:1},8,["title"])]),_:1},8,["onUploaded"]),i.user_profile.cover_photo?(n(),v(m,{key:0,class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:q(i.removeCoverPhoto,["prevent"])},{default:c(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",t6,[l("div",s6,[l("img",{alt:e.$t("Placeholder Photo"),src:i.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,o6),i.isOwnProfile||e.hasPermission("super_admin")?(n(),v(k,{key:0,ref:"avatarPopover",trigger:"click",placement:"bottom",width:"fit-content","popper-class":"fcom_avatar_popover",teleported:!1},{reference:c(()=>[l("button",{class:"object_avatar_uploader",type:"button","aria-label":e.$t("Change profile photo")},[a(g,{class:"object_avatar_upload"},{default:c(()=>[a(h)]),_:1})],8,i6)]),default:c(()=>[l("div",n6,[a(f,{additionalData:{resize:!0,max_width:200},onUploaded:i.handlePhotoUpload},{trigger:c(()=>[a(m,{size:"small",text:"",class:"fcom_avatar_action_btn"},{default:c(()=>[M(d(e.$t("Upload")),1)]),_:1})]),_:1},8,["onUploaded"]),i.user_profile.has_custom_avatar?(n(),v(m,{key:0,size:"small",text:"",type:"danger",class:"fcom_avatar_action_btn",onClick:i.removeAvatar},{default:c(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])]),_:1},512)):_("",!0),i.level?(n(),r("div",{key:1,style:{position:"absolute",right:"calc(12.5% - 9px)",bottom:"calc(36.5% - 5px)","line-height":"0",background:"rgb(67, 87, 173)",width:"20px",height:"20px","font-size":"12px",display:"flex","align-items":"center","justify-content":"center","border-radius":"50%",color:"#fff",border:"1px solid white"},role:"region","aria-label":e.$t("User Level"),class:"fcom_user_level_mark"},[l("span",null,d(i.level),1)],8,l6)):_("",!0)]),l("div",a6,[l("h3",null,[M(d((A=i.user_profile)==null?void 0:A.display_name)+" ",1),(N=i.user_profile)!=null&&N.is_verified?(n(),v(b,{key:0})):_("",!0),a(S,{profile:i.user_profile},null,8,["profile"])]),l("p",r6,"@"+d((H=i.user_profile)==null?void 0:H.username),1),e.hasFeature("followers_module")?(n(),r("div",c6,[((z=i.user_profile)==null?void 0:z.followings_count)!=null?(n(),v(w,{key:0,to:{name:"user_followings",params:{username:i.user_profile.username}}},{default:c(()=>[l("span",null,d(i.user_profile.followings_count),1),M(" "+d(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((G=i.user_profile)==null?void 0:G.followers_count)!=null?(n(),v(w,{key:1,to:{name:"user_followers",params:{username:i.user_profile.username}}},{default:c(()=>[l("span",null,d(i.user_profile.followers_count),1),M(" "+d(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",d6,[(E=(ne=s.profile)==null?void 0:ne.profile_navs)!=null&&E.length?(n(),r("ul",u6,[(n(!0),r(T,null,x(s.profile.profile_navs,X=>(n(),r("li",{class:D(X.wrapper_class??"")},[X.route?(n(),v(w,{key:0,class:D(X.css_class??""),to:X.route},{default:c(()=>[X.svg_icon?(n(),v(g,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(X.title),1)]),_:2},1032,["class","to"])):(n(),r("a",{key:1,href:X.url,class:D(X.css_class??""),target:X.is_external?"_blank":"_self"},[X.svg_icon?(n(),v(g,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(X.title),1)],10,_6))],2))),256))])):_("",!0),i.showActions?(n(),r("div",m6,[(de=(Q=s.profile)==null?void 0:Q.profile_nav_actions)!=null&&de.length?(n(!0),r(T,{key:0},x(s.profile.profile_nav_actions,X=>(n(),r("a",{class:D(X.css_class),target:X.is_external?"_blank":"_self",href:X.url},[X.svg_icon?(n(),v(g,{key:0,innerHTML:X.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(X.title),1)],10,h6))),256)):_("",!0),i.showFollowAction||i.showOtherActions?(n(),r(T,{key:1},[i.showFollowAction?(n(),r(T,{key:0},[s.profile?(n(),v($,{key:0,profile:s.profile,onRefetch:t[0]||(t[0]=X=>e.$emit("refetch"))},null,8,["profile"])):_("",!0),i.isFollowing?(n(),v(m,{key:1,class:"fcom_secondary_button icon_button",title:i.getTitle,loading:o.updating,disabled:o.updating,onClick:i.toggleEmailNotification},{default:c(()=>[i.isNotificationOn?(n(),v(g,{key:0},{default:c(()=>[a(y)]),_:1})):(n(),v(g,{key:1},{default:c(()=>[a(C)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),i.showBlock||i.showOtherActions?(n(),v(F,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:c(()=>[a(I,null,{default:c(()=>[i.showBlock?(n(),v(V,{key:0,onClick:t[1]||(t[1]=X=>i.confirmAndBlock())},{default:c(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:c(()=>[M(d(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),i.showOtherActions?(n(),v(V,{key:1,onClick:t[2]||(t[2]=X=>i.openAddToDrawer())},{default:c(()=>[a(m,{"aria-label":e.$t("Add User to Space/Course"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"primary"},{default:c(()=>[M(d(e.$t("Add To Space/Course")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0)]),_:1})]),default:c(()=>[a(m,{class:"fcom_dot_menu edit_action",size:"small",text:""},{default:c(()=>[a(g,null,{default:c(()=>[a(L)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(B,{modelValue:o.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=X=>o.isAddUserOpen=X),"close-on-click-modal":!0,"before-close":i.handleDrawerClose,"append-to-body":!0,size:e.modalWidth,direction:"rtl"},{header:c(()=>[l("h4",null,d(e.$t("Add User to Space/Course")),1)]),default:c(()=>[a(R,{ref:"addUserForm",onCompleted:i.userAdded,user_profile:i.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[U,o.updating]])}const p6=P(QC,[["render",f6]]),g6={name:"ProfileAbout",components:{SocialLinks:Pt},props:["profile","isOwn"]},y6={class:"app_side_widget"},v6={class:"widget_header"},b6={key:0,class:"widget_actions"},k6={key:0,class:"widget_body"},w6=["innerHTML"],C6={key:1,style:{"text-align":"center"}},$6=["title"],S6=["title"];function V6(e,t,s,u,o,i){const m=p("EditPen"),f=j,h=O,g=p("SocialLinks"),k=J;return n(),r("div",y6,[l("div",v6,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),r("div",b6,[a(h,{"aria-label":e.$t("Edit Your Profile"),onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])])):_("",!0)]),s.profile?(n(),r("div",k6,[s.profile.short_description_rendered?(n(),r("div",{key:0,class:"space_description feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,w6)):s.isOwn?(n(),r("div",C6,[t[2]||(t[2]=l("hr",null,null,-1)),a(h,{"aria-label":e.$t("Add your profile description"),onClick:t[1]||(t[1]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),type:"info"},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1}),l("span",null,d(e.$t("Add your profile description")),1)]),_:1},8,["aria-label"])])):_("",!0),t[3]||(t[3]=l("hr",null,null,-1)),l("div",{title:s.profile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.profile.created_at))),9,$6),s.profile.last_activity?(n(),r("div",{key:2,title:s.profile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),9,S6)):_("",!0),a(g,{xprofile:s.profile,isOwn:s.isOwn},null,8,["xprofile","isOwn"])])):(n(),v(k,{key:1,animated:!0}))])}const Do=P(g6,[["render",V6]]),M6={name:"FeedProfile",props:["username"],components:{NotFoundResult:Io,SpaceMenu:$o,Layout:we,AppLayout:Se,UserHeader:p6,ProfileAbout:Do,RecentActivities:Ut},setup(){return{userStore:Ue()}},data(){return{defaultRoute:this.appVars.default_profile_tab,notFound:!1}},computed:{profile(){return this.userStore.getProfile(this.username)},loading(){return this.userStore.isLoading(this.username)},isOwn(){return this.profile&&this.profile.user_id==this.auth.user_id},showWidget(){var s;const{disable_sidebar:e}=this.$route.meta||{},t=((s=this.profile)==null?void 0:s.is_restricted)??!1;return!e&&!this.notFound&&!t}},watch:{username(){this.notFound=!1,this.getProfile()}},methods:{async getProfile(e=!1){this.notFound=!1;try{const t=await this.userStore.fetchProfile(this.username,e);this.changeTitle(t==null?void 0:t.display_name),(t==null?void 0:t.user_id)==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score)}catch(t){if(this.username==="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}t.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Profile Not Found"))):this.$handleError(t)}},approveUser(){this.loading=!0,this.$patch("members/"+this.profile.user_id,{status:"active"}).then(e=>{this.$notify.success(e.message),this.profile.status="active",this.getProfile(!0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){if(this.username=="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}this.getProfile();const t={about:"user_profile",posts:"user_profile_feeds",spaces:"user_spaces",comments:"user_comments",courses:"user_courses"}[this.defaultRoute||""];t&&this.$route.name==="user_profile"&&t!==this.$route.name&&this.$router.replace({name:t,params:{username:this.username}})}},L6={key:0},T6={key:1},F6={class:"edit_profile"},P6={class:"fcom_profile_box"},I6={key:1,class:"profile_holder"},E6={key:2},A6={class:"fcom_main_side_wrap"},U6={class:"widget_recent_activities"};function B6(e,t,s,u,o,i){const m=p("router-link"),f=Qt,h=Xt,g=O,k=j,b=p("EditPen"),S=p("user-header"),w=p("not-found-result"),$=p("router-view"),y=J,C=ut,L=p("ProfileAbout"),V=p("RecentActivities"),I=_t,F=mt,R=p("layout"),B=p("app-layout");return n(),v(B,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:c(()=>[a(R,{wrapper_class:"no_bg_layout",title:"...."},{title:c(()=>[a(h,null,{default:c(()=>[a(f,null,{default:c(()=>[a(m,{to:{name:"all_members"}},{default:c(()=>[M(d(e.$t("Members")),1)]),_:1})]),_:1}),i.profile?(n(),v(f,{key:0},{default:c(()=>[i.isOwn?(n(),r("span",L6,d(e.$t("My Profile")),1)):(n(),r("span",T6,d(i.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:c(()=>[i.profile&&e.hasPermission("super_admin")&&i.profile.status!="active"?(n(),r(T,{key:0},[i.profile.status?(n(),r(T,{key:0},[l("span",null,d(e.$labelize(i.profile.status)),1),a(g,{type:"success",onClick:t[0]||(t[0]=U=>e.$confirm(e.$t("Are you sure you want to approve this user?"),e.$t("Warning"),{type:"warning"}).then(()=>{i.approveUser()}))},{default:c(()=>[M(d(e.$t("Approve Account")),1)]),_:1})],64)):(n(),v(g,{key:1,disabled:!0},{default:c(()=>[M(d(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),i.profile&&(i.isOwn||e.hasPermission("super_admin"))?(n(),r(T,{key:1},[a(m,{to:{name:"user_notification_settings",params:{username:i.profile.username}},class:"el-button el-button--text fcom_secondary_button"},{default:c(()=>[a(k,null,{default:c(()=>[...t[4]||(t[4]=[l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[l("path",{fill:"currentColor",d:"M512 128v64H256a64 64 0 0 0-64 64v512a64 64 0 0 0 64 64h512a64 64 0 0 0 64-64V512h64v256a128 128 0 0 1-128 128H256a128 128 0 0 1-128-128V256a128 128 0 0 1 128-128z"}),l("path",{fill:"currentColor",d:"M768 384a128 128 0 1 0 0-256 128 128 0 0 0 0 256m0 64a192 192 0 1 1 0-384 192 192 0 0 1 0 384"})],-1)])]),_:1}),l("span",null,d(e.$t("Notification Settings")),1)]),_:1},8,["to"]),e.$route.name!=="update_profile"?(n(),v(g,{key:0,onClick:t[1]||(t[1]=U=>e.$router.push({name:"update_profile",params:{username:i.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:c(()=>[a(k,null,{default:c(()=>[a(b)]),_:1}),l("span",F6,d(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:c(()=>[o.notFound?_("",!0):(n(),v(S,{key:0,username:s.username,isOwn:i.isOwn,profile:i.profile,onRefetch:i.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(F,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:c(()=>[a(C,{class:"fcom_main"},{default:c(()=>[l("div",P6,[o.notFound?(n(),v(w,{key:0,title:e.$t("Profile Not Found"),message:e.$t("The user profile you are looking for does not exist or has been removed.")},{actions:c(()=>[e.auth.user_id?(n(),v(g,{key:0,onClick:t[2]||(t[2]=U=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:c(()=>[M(d(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(g,{onClick:t[3]||(t[3]=U=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:c(()=>[M(d(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title","message"])):i.profile?(n(),r("div",I6,[a($,{isOwn:i.isOwn,username:s.username,profile:i.profile,onRefetch:i.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):i.loading?(n(),r("div",E6,[a(y,{class:"white_loaded",rows:10,animated:!0})])):_("",!0)])]),_:1}),i.showWidget?(n(),v(I,{key:0,class:"fcom_resp_side",width:"306px"},{default:c(()=>[l("div",A6,[l("div",U6,[e.$route.name!=="user_profile"?(n(),v(L,{key:0,isOwn:i.isOwn,profile:i.profile},null,8,["isOwn","profile"])):i.profile?(n(),v(V,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:i.profile.user_id},prompt_placement:"profile_sidebar"},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const D6=P(M6,[["render",B6]]),R6={name:"LockedProfile"},x6={class:"space_lock_box"},O6={class:"lock_header"},H6={class:"lock_desc"},j6=["href"];function N6(e,t,s,u,o,i){const m=p("Lock"),f=j;return n(),r("div",x6,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("h3",O6,d(e.$t("This profile is private")),1),l("p",H6,d(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login / Signup")),9,j6)):_("",!0)])}const pt=P(R6,[["render",N6]]),z6={name:"ProfileFeeds",components:{AllFeeds:ft,ErrorIcon:uo,LockedProfile:pt},props:["profile","isOwn","username"],emits:["refetch"],methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},q6={key:0,class:"fcom_feed_report_wrap"},G6={class:"fcom_feed_report_content"},Y6={class:"fcom_feed_report_action"};function W6(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("ErrorIcon"),h=O,g=p("all-feeds");return s.profile.is_restricted?(n(),v(m,{key:0})):(n(),r(T,{key:1},[s.profile.scheduled_posts_count?(n(),r("div",q6,[l("div",G6,[a(f),l("span",null,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)]),l("div",Y6,[a(h,{onClick:t[0]||(t[0]=k=>i.openScheduledPosts())},{default:c(()=>[M(d(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(g,{feed_name:"profile_feed",require_space_selection:e.appVars.features.disable_global_posts,user_id:s.profile.user_id,hide_create_form:s.profile.user_id!=e.auth.user_id},null,8,["require_space_selection","user_id","hide_create_form"])],64))}const K6=P(z6,[["render",W6]]),Z6={name:"ScheduledPosts",components:{Feed:ot,Pagination:$e,EditFeed:ls,AlarmClock:ci},props:["profile","isOwn","username"],emits:["refetch"],data(){return{loading:!1,saving:!1,scheduleModalVisible:!1,popoverVisible:null,scheduleForm:this.initScheduleForm(),feeds:[],isEdit:!1,editingFeed:null,pagination:{page:1,per_page:10,total:0,last_page:0}}},computed:{isPostCount(){return this.profile.scheduled_posts_count},isPopoverVisible(){return e=>this.popoverVisible===e.id},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u}},methods:{initScheduleForm(){return{id:null,date:"",time:""}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},cancelReschedule(){this.scheduleModalVisible=!1},initReschedule(e){this.scheduleModalVisible=!0,this.scheduleForm.id=e.id,this.scheduleForm.date=this.dayjs(e.scheduled_at).format("YYYY-MM-DD"),this.scheduleForm.time=this.dayjs(e.scheduled_at).format(this.siteTimeFormat)},togglePopover(e){this.popoverVisible===e.id?this.popoverVisible=null:this.popoverVisible=e.id},hidePopover(e){this.popoverVisible===e.id&&(this.popoverVisible=null)},updateFeed(e){const t=this.feeds.findIndex(s=>s.id===e.id);t!==-1&&(this.feeds[t]=e),this.editingFeed=null},removeFeed(e){this.feeds=this.feeds.filter(t=>t.id!==e)},editItem(e){this.popoverVisible=!1,this.editingFeed=e,this.isEdit=!0},deleteItem(e){this.popoverVisible=!1,this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.saving=!0,this.$del("feeds/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(this.$t("Feed deleted successfully"))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})})},copyFeedLink(e){this.popoverVisible=!1,this.$toClipboard(e.permalink)},publishNow(e){this.saving=!0,this.$post("scheduled-posts/publish/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},reschedulePost(){this.saving=!0;const e=`${this.scheduleForm.date} ${this.convertTo24Hour(this.scheduleForm.time)}:00`;this.$put("scheduled-posts/"+this.scheduleForm.id,{scheduled_at:e}).then(t=>{this.scheduleModalVisible=!1,this.scheduleForm=this.initScheduleForm(),this.updateFeed(t.feed),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},fetchFeeds(){this.loading=!0,this.$get("scheduled-posts",{page:this.pagination.page,per_page:this.pagination.per_page,user_id:this.profile.user_id}).then(e=>{this.feeds=e.feeds.data,this.pagination.total=e.feeds.total,this.pagination.last_page=e.feeds.last_page}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.changeTitle(this.$t("Scheduled Posts")),(this.isAdmin()||this.auth.user_id==this.profile.user_id)&&this.fetchFeeds()}},J6={class:"scheduled_posts_header"},Q6={class:"fcom_scheduled_posts_title"},X6={key:0},e$={key:1},t$={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},s$={class:"all_feeds_holder"},o$={class:"actions_items"},i$=["onClick"],n$=["onClick"],l$=["onClick"],a$={class:"feed_user"},r$={class:"feed_user_name"},c$={class:"feed_meta_info"},d$=["title","href"],u$={key:0},_$={class:"post_actions"},m$={key:2,class:"feed_outer"},h$={class:"feed"},f$={style:{"text-align":"center"},class:"feed_body not_found"},p$={class:"dialog_header"},g$={class:"dialog_left schedule_header_left"},y$={class:"dialog_body"},v$={class:"dialog_footer"};function b$(e,t,s,u,o,i){const m=p("AlarmClock"),f=j,h=J,g=p("MoreFilled"),k=O,b=fe,S=p("UserAvatar"),w=p("UserRouteLink"),$=p("router-link"),y=p("feed"),C=p("edit-feed"),L=Ye,V=pe,I=Es,F=ge,R=ke,B=p("pagination");return n(),r(T,null,[l("div",J6,[a(f,null,{default:c(()=>[a(m)]),_:1}),l("div",Q6,[l("h3",null,d(e.$t("Scheduled Posts")),1),i.isPostCount?(n(),r("p",X6,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)):(n(),r("p",e$,d(e.$t("You have no scheduled posts to be published")),1))])]),o.loading?(n(),v(h,{key:0,class:"fcom_mt_20 white_loaded",rows:5,animated:!0})):o.feeds.length?(n(),r("div",t$,[l("div",s$,[(n(!0),r(T,null,x(o.feeds,U=>(n(),r("div",{key:U.id,class:"feed_outer"},[a(y,{feed:U,layout_style:"timeline",hide_create_form:!0,show_footer:!1,show_actions:!1},{after_feed_actions:c(()=>[a(b,{persistent:!1,ref_for:!0,ref:"actionsPopover",placement:"bottom",width:200,trigger:"click",visible:i.isPopoverVisible(U),teleported:!1,"popper-class":"fcom_menu_below_nav",onHide:A=>i.hidePopover(U)},{reference:c(()=>[a(k,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:A=>i.togglePopover(U)},{default:c(()=>[a(f,null,{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:c(()=>[l("ul",o$,[l("li",{onClick:A=>i.copyFeedLink(U)},d(e.$t("Copy Link")),9,i$),e.canEditFeed(U)?(n(),r("li",{key:0,onClick:A=>i.editItem(U)},d(e.$t("Edit")),9,n$)):_("",!0),e.canDeleteFeed(U)?(n(),r("li",{key:1,onClick:A=>i.deleteItem(U)},d(e.$t("Delete")),9,l$)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:c(()=>[l("div",a$,[a(S,{with_level:!1,xprofile:s.profile},null,8,["xprofile"]),l("div",null,[l("div",r$,[a(w,{show_badge:!0,xprofile:s.profile},null,8,["xprofile"])]),l("div",c$,[l("a",{title:U.created_at,onClick:t[0]||(t[0]=(...A)=>e.gotoFeed&&e.gotoFeed(...A)),href:U.permalink,class:"feed_timestamp"},d(i.getScheduledTime(U.scheduled_at)),9,d$),U.space?(n(),r("span",u$,[a($,{to:i.getSpaceRoute(U.space.slug),class:"feed_timestamp"},{default:c(()=>[M(d(e.$t("Posted in %s",e.getExcerpt(U.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:c(()=>[l("div",_$,[a(k,{class:"fcom_secondary_button",onClick:A=>i.initReschedule(U),disabled:o.saving},{default:c(()=>[M(d(e.$t("Reschedule Post")),1)]),_:1},8,["onClick","disabled"]),a(k,{class:"fcom_secondary_button",onClick:A=>i.publishNow(U),disabled:o.saving},{default:c(()=>[M(d(e.$t("Publish Now")),1)]),_:1},8,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),o.isEdit&&o.editingFeed?(n(),v(C,{key:0,feedSlug:o.editingFeed.slug,dialogVisible:o.isEdit,onUpdated:i.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=U=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(n(),r("div",m$,[l("div",h$,[l("div",f$,[l("p",null,d(e.$t("No scheduled posts found!")),1)])])])),a(R,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=U=>o.scheduleModalVisible=U),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:i.cancelReschedule},{header:c(()=>[l("div",p$,[l("div",g$,[l("h4",null,d(e.$t("Reschedule Post")),1),l("p",null,d(e.$t("Choose a date and time in the future when you want your post to be published")),1)])])]),footer:c(()=>[l("div",v$,[a(k,{class:"fcom_secondary_button",disabled:o.saving,onClick:i.cancelReschedule},{default:c(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(k,{class:"fcom_primary_button",disabled:o.saving,onClick:i.reschedulePost},{default:c(()=>[M(d(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:c(()=>[l("div",y$,[a(F,{"label-position":"top",class:"fcom_schedule_form"},{default:c(()=>[a(V,{label:e.$t("Date")},{default:c(()=>[a(L,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=U=>o.scheduleForm.date=U),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(V,{label:e.$t("Time")},{default:c(()=>[a(I,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=U=>o.scheduleForm.time=U),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","width","onClose"]),a(B,{pagination:o.pagination,onFetch:i.fetchFeeds},null,8,["pagination","onFetch"])],64)}const k$=P(Z6,[["render",b$]]),w$={name:"UserSpaces",props:["profile"],components:{Calendar:di,Baseball:ui,GroupIcon:Bt,GlobIcon:Uo,LockedProfile:pt},data(){return{communities:[],loading:!1}},methods:{getBtnLevel(e){return e=="course"?this.$t("View Course"):this.$t("View Space")},goToSpaceFeeds(e){this.$router.push({name:"space_feeds",params:{space:e}})},getExcerpt(e,t){return e.length>t?e.substring(0,t)+"...":e},removeMembership(e){this.$confirm(this.$t("Are you sure you want to remove this space?"),this.$t("Remove Space")).then(()=>{this.$post("spaces/"+e+"/members/remove",{user_id:this.profile.user_id}).then(()=>{this.fetch()}).catch(t=>{this.$handleError(t)})})},fetch(){this.loading=!0,this.$get("profile/"+this.profile.username+"/spaces").then(e=>{this.communities=e.spaces}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch()}},C$={key:1,class:"user_spaces"},$$={class:"fcom_box_card_list"},S$=["onClick"],V$=["src"],M$=["src"],L$={key:2,class:"fcom_no_image"},T$={class:"fcom_box_card_info"},F$={class:"fcom_box_card_name"},P$={class:"fcom_box_card_details"},I$={class:"details_item"},E$={key:0,class:"details_item"},A$={class:"fcom_box_card_action"},U$=["onClick"],B$={key:0,class:"loading"},D$={key:1},R$={class:"no_members"},x$={key:2,class:"no_members"};function O$(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("router-link"),h=p("MoreFilled"),g=j,k=O,b=We,S=Ke,w=Ze,$=p("GlobIcon"),y=p("Lock"),C=p("GroupIcon"),L=J;return s.profile.is_restricted?(n(),v(m,{key:0})):(n(),r("div",C$,[l("div",$$,[(n(!0),r(T,null,x(o.communities,V=>{var I;return n(),r("div",{key:V.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:F=>i.goToSpaceFeeds(V.slug)},[(I=V.settings)!=null&&I.og_image?(n(),r("img",{key:0,src:V.settings.og_image,alt:""},null,8,V$)):V.cover_photo?(n(),r("img",{key:1,src:V.cover_photo,alt:""},null,8,M$)):(n(),r("div",L$))],8,S$),l("div",T$,[l("div",F$,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:V.slug}}},{default:c(()=>[M(d(i.getExcerpt(V.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(n(),v(w,{key:0,trigger:"click"},{dropdown:c(()=>[a(S,null,{default:c(()=>[a(b,{onClick:F=>i.removeMembership(V.slug)},{default:c(()=>[M(d(e.$t("Remove from space")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:c(()=>[a(k,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",P$,[l("div",I$,[V.privacy==="public"?(n(),v(g,{key:0},{default:c(()=>[a($)]),_:1})):(n(),v(g,{key:1},{default:c(()=>[a(y)]),_:1})),l("span",null,d(V.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),V.members_count?(n(),r("div",E$,[a(g,null,{default:c(()=>[a(C)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(V.members_count))),1)])):_("",!0)]),l("div",A$,[l("button",{class:"fcom_card_button",onClick:F=>i.goToSpaceFeeds(V.slug)},d(i.getBtnLevel(V.type)),9,U$)])])])}),128))]),o.loading?(n(),r("div",B$,[a(L,{class:"white_loaded",rows:3,animated:!0}),a(L,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?!o.loading&&!o.communities.length?(n(),r("div",x$,d(e.$t("No Spaces found.")),1)):_("",!0):(n(),r("div",D$,[l("div",R$,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const H$=P(w$,[["render",O$]]),j$={name:"AccountDeactivation",props:["profile"],data(){return{selection:"init",working:!1}},methods:{deactivateAccount(){this.working=!0,this.$put("profile/"+this.profile.username,{data:{status:"deactivated"}}).then(e=>{this.$notify.success(e.message),window.location.reload(!0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})}}},N$={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},z$={class:"about_header"},q$={class:"about_body fcom_mt_10"},G$={class:"fcom_mt_20"};function Y$(e,t,s,u,o,i){const m=O;return n(),r("div",N$,[l("div",z$,[l("h3",null,d(e.$t("Account Deactivation")),1)]),l("div",q$,[o.selection=="init"?(n(),r(T,{key:0},[l("p",null,d(e.$t("If you no longer wish to keep your community account, click button below to deactivate your account.")),1),a(m,{onClick:t[0]||(t[0]=f=>o.selection="deactivate"),class:"fcom_secondary_button fcom_mt_20"},{default:c(()=>[M(d(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):o.selection=="deactivate"?(n(),r(T,{key:1},[l("h4",null,d(e.$t("This will deactivate your account")),1),l("p",null,d(e.$t("Deactivating your account will make your content and profile invisible to others. You will also lose access to the community until you reactivate your account.")),1),l("div",G$,[a(m,{onClick:t[1]||(t[1]=f=>o.selection="init"),class:"fcom_secondary_button"},{default:c(()=>[M(d(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>i.deactivateAccount()),type:"danger"},{default:c(()=>[M(d(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const W$=P(j$,[["render",Y$]]),K$={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:Et,MarkdownEditor:ns,AccountDeactivation:W$,InfoFilled:$t},setup(){const e=Ue(),t=le();return{userStore:e,cacheStore:t}},data(){return{updating:!1,loading:!1,notification_settings:{email_on_comment:!1},profileData:{},fcom_is_dirty:!1,fcom_dirty_ready:!1,passwordData:{current_password:"",new_password:"",confirm_password:""},changingPassword:!1}},watch:{profile:{handler(e){e&&(this.fcom_dirty_ready=!1,this.profileData={username:e.username,display_name:e.display_name,first_name:e.first_name,last_name:e.last_name,email:e.email,website:e.website,headline:e.headline||"",short_description:e.short_description,user_id:e.user_id,is_verified:e.is_verified,is_flagged:e.is_flagged||"no",social_links:e.social_links||{},badge_slugs:e.badge_slugs,status:e.status,custom_fields:this.getCustomFieldValues(e)},this.$nextTick(()=>{this.fcom_is_dirty=!1,this.fcom_dirty_ready=!0}))},immediate:!0},profileData:{handler(){this.fcom_dirty_ready&&(this.fcom_is_dirty=!0)},deep:!0}},computed:{customFieldGroups(){return this.profile.custom_field_groups||[]},canFlagMember(){return this.has_pro&&this.appVars.moderationConfig&&this.appVars.moderationConfig.is_enabled==="yes"}},methods:{async updateProfile(){this.updating=!0;try{const e=await this.$post(`profile/${this.username}`,{data:this.profileData});if(e.redirect_url){window.location.href=e.redirect_url;return}const t=e.profile;this.username!==t.username&&(delete this.userStore.profilesByUsername[this.username],this.cacheStore.invalidate(`user-profile:${this.username}`)),this.userStore.profilesByUsername[t.username]=t,this.cacheStore.invalidate(`user-profile:${t.username}`),this.fcom_is_dirty=!1,this.$notify.success(this.$t("Profile updated successfully")),t.user_id==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score),this.username!==t.username&&this.$router.push({name:"update_profile",params:{username:t.username}}),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.updating=!1}},async changePassword(){var e;if(!this.passwordData.current_password||!this.passwordData.new_password){this.$notify.error(this.$t("Please fill in all password fields"));return}if(this.passwordData.new_password!==this.passwordData.confirm_password){this.$notify.error(this.$t("New password and confirmation do not match"));return}if(this.passwordData.current_password===this.passwordData.new_password){this.$notify.error(this.$t("New password must be different from your current password"));return}this.changingPassword=!0;try{const t=await this.$post(`profile/${this.username}/change-password`,{data:this.passwordData});t.rest_nonce&&((e=window.fluentComAdmin)!=null&&e.rest)&&(window.fluentComAdmin.rest.nonce=t.rest_nonce),t.ajax_nonce&&window.fluentComAdmin&&(window.fluentComAdmin.ajax_nonce=t.ajax_nonce),this.$notify.success(t.message||this.$t("Password changed successfully")),this.passwordData={current_password:"",new_password:"",confirm_password:""}}catch(t){this.$handleError(t)}finally{this.changingPassword=!1}},isEmpty:es,getCustomFieldValues(e){const t={},s=e.custom_field_groups||[];for(const u of s)for(const o of u.fields||[])o.slug&&(t[o.slug]=o.value!==void 0?o.value:"");return t}},async mounted(){await this.userStore.fetchProfile(this.username,!0)}},Z$={key:0,class:"fcom_sub_group fcom_additional_info"},J$={class:"fcom_sub_group_header"},Q$={key:0},X$={class:"fcom_sub_group_content"},e7={key:0,class:"fcom_sub_group"},t7={class:"fcom_sub_group_header"},s7={class:"fcom_sub_group_content"},o7={key:1,class:"fcom_mb_20"},i7={key:0,class:"fcom_sub_group"},n7={class:"fcom_sub_group_header"},l7={key:0,class:"fcom_help_text"},a7={id:"fcom_flag_member_help"},r7={key:2},c7={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},d7={key:3,class:"help_msg"},u7={class:"fcom_sub_group"},_7={class:"fcom_fixed_bottom_overlay"},m7={key:0,class:"fcom_update_profile fcom_change_password"},h7={class:"fcom_sub_group"},f7={class:"fcom_sub_group_header"},p7={class:"fcom_change_password_content"};function g7(e,t,s,u,o,i){const m=ie,f=pe,h=ct,g=dt,k=p("InfoFilled"),b=j,S=Ie,w=p("markdown-editor"),$=Ye,y=ae,C=re,L=Je,V=be,I=ve,F=p("UserBadge"),R=p("slug-input"),B=O,U=ge,A=p("account-deactivation"),N=se("loading");return n(),r(T,null,[l("div",{class:D([{fcom_is_dirty:o.fcom_is_dirty},"fcom_update_profile"])},[a(U,{onSubmit:t[11]||(t[11]=q(H=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.profileData,"onUpdate:modelValue":t[12]||(t[12]=H=>o.profileData=H)},{default:c(()=>[a(g,{gutter:30},{default:c(()=>[a(h,{xs:24,md:12},{default:c(()=>[a(f,{label:e.$t("First Name"),required:""},{default:c(()=>[a(m,{modelValue:o.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=H=>o.profileData.first_name=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:c(()=>[a(f,{label:e.$t("Last Name")},{default:c(()=>[a(m,{modelValue:o.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=H=>o.profileData.last_name=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(g,{gutter:30},{default:c(()=>[a(h,{xs:24,md:12},{default:c(()=>[a(f,{label:e.$t("Email")},{default:c(()=>[a(m,{disabled:!s.profile.can_change_email,modelValue:o.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=H=>o.profileData.email=H)},null,8,["disabled","modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:c(()=>[a(f,{label:e.$t("Website URL")},{default:c(()=>[a(m,{type:"url",modelValue:o.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=H=>o.profileData.website=H)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{label:c(()=>[M(d(e.$t("Headline"))+" ",1),a(S,{effect:"dark",placement:"top",content:e.$t("A short tagline shown on the members list.")},{default:c(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("A short tagline shown on the members list.")},{default:c(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:c(()=>[a(m,{modelValue:o.profileData.headline,"onUpdate:modelValue":t[4]||(t[4]=H=>o.profileData.headline=H),maxlength:"60","show-word-limit":""},null,8,["modelValue"])]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:c(()=>[a(w,{disable_mention:!0,disable_media:!0,placeholder:e.$t("Write a short bio about yourself"),modelValue:o.profileData.short_description,"onUpdate:modelValue":t[5]||(t[5]=H=>o.profileData.short_description=H)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),(n(!0),r(T,null,x(i.customFieldGroups,H=>(n(),r(T,{key:H.slug},[H.fields&&H.fields.length?(n(),r("div",Z$,[l("div",J$,[l("h5",null,d(H.label),1),H.edit_description?(n(),r("p",Q$,d(H.edit_description),1)):_("",!0)]),l("div",X$,[(n(!0),r(T,null,x(H.fields,z=>(n(),v(f,{key:z.slug,label:z.label,required:z.is_required},{default:c(()=>[z.type==="text"?(n(),v(m,{key:0,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="textarea"?(n(),v(m,{key:1,type:"textarea",rows:3,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="number"?(n(),v(m,{key:2,type:"number",modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="date"?(n(),v($,{key:3,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,type:"date","value-format":"YYYY-MM-DD",placeholder:z.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="select"?(n(),v(C,{key:4,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder,"value-on-clear":"",clearable:""},{default:c(()=>[(n(!0),r(T,null,x(z.options,G=>(n(),v(y,{key:G,label:G,value:G},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="multiselect"?(n(),v(C,{key:5,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder,multiple:!0,clearable:""},{default:c(()=>[(n(!0),r(T,null,x(z.options,(G,ne)=>(n(),v(y,{key:ne,label:G,value:ne},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):z.type==="radio"?(n(),v(V,{key:6,modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G},{default:c(()=>[(n(!0),r(T,null,x(z.options,G=>(n(),v(L,{key:G,value:G},{default:c(()=>[M(d(G),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):z.type==="url"?(n(),v(m,{key:7,type:"url",modelValue:o.profileData.custom_fields[z.slug],"onUpdate:modelValue":G=>o.profileData.custom_fields[z.slug]=G,placeholder:z.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),i.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(n(),r("div",e7,[l("div",t7,[l("h5",null,d(e.$t("Social Links")),1),l("p",null,d(e.$t("Add your social media profile link.")),1)]),l("div",s7,[(n(!0),r(T,null,x(e.appVars.socialLinkProviders,(H,z)=>(n(),v(f,{key:z,label:H.title},{default:c(()=>[a(m,{placeholder:H.placeholder,modelValue:o.profileData.social_links[z],"onUpdate:modelValue":G=>o.profileData.social_links[z]=G},{prepend:c(()=>[a(b,{innerHTML:H.icon_svg},null,8,["innerHTML"]),l("span",null,d(H.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),s.profile.can_change_username?(n(),r("div",o7,[e.hasPermission("super_admin")?(n(),r("div",i7,[l("div",n7,[l("h5",null,d(e.$t("Admin Actions")),1),l("p",null,d(e.$t("Admin tools for account verification and status management.")),1)]),a(f,{label:e.$t("Account Verification"),class:"checkbox_label"},{default:c(()=>[a(I,{"true-value":1,"false-value":0,modelValue:o.profileData.is_verified,"onUpdate:modelValue":t[6]||(t[6]=H=>o.profileData.is_verified=H),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Mark this account as verified")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),i.canFlagMember?(n(),v(f,{key:0,class:"checkbox_label"},{label:c(()=>[M(d(e.$t("Moderate Posts and Comments"))+" ",1),a(S,{effect:"dark",placement:"top",content:e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:c(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:c(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:c(()=>[a(I,{disabled:s.profile.is_moderator==="yes","aria-describedby":s.profile.is_moderator==="yes"?"fcom_flag_member_help":null,"true-value":"yes","false-value":"no",modelValue:o.profileData.is_flagged,"onUpdate:modelValue":t[7]||(t[7]=H=>o.profileData.is_flagged=H),class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Require approval for new posts and comments")),1)]),_:1},8,["disabled","aria-describedby","modelValue"]),s.profile.is_moderator==="yes"?(n(),r("div",l7,[l("p",a7,d(e.$t("Admin or moderator accounts cannot be moderated")),1)])):_("",!0)]),_:1})):_("",!0),e.appVars.user_badges?(n(),v(f,{key:1,label:e.$t("Profile Badges")},{default:c(()=>[a(C,{clearable:"",multiple:!0,modelValue:o.profileData.badge_slugs,"onUpdate:modelValue":t[8]||(t[8]=H=>o.profileData.badge_slugs=H),placeholder:e.$t("User Profile Badge")},{default:c(()=>[(n(!0),r(T,null,x(e.appVars.user_badges,H=>(n(),v(y,{key:H.slug,label:H.title,value:H.slug},{default:c(()=>[a(F,{badge:H,is_preview:!0},null,8,["badge"])]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(f,{label:e.$t("Access Status")},{default:c(()=>[a(V,{modelValue:o.profileData.status,"onUpdate:modelValue":t[9]||(t[9]=H=>o.profileData.status=H),class:"fcom_radio_group"},{default:c(()=>[a(L,{value:"active"},{default:c(()=>[M(d(e.$t("Active")),1)]),_:1}),a(L,{value:"pending"},{default:c(()=>[M(d(e.$t("Pending")),1)]),_:1}),a(L,{value:"blocked"},{default:c(()=>[M(d(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.profileData.status?o.profileData.status!="active"?(n(),r("div",d7,[l("p",null,d(e.$t("The user cannot access the portal.")),1)])):_("",!0):(n(),r("div",r7,[l("p",c7,d(e.$t("This user deactivated his/her account from the self managed profile section. if you want to reactivate the account, please select an updated status.")),1)]))])):_("",!0),l("div",u7,[a(f,{label:e.$t("Community Account Username")},{default:c(()=>[a(R,{is_inital_inactive:!0,modelValue:o.profileData.username,"onUpdate:modelValue":t[10]||(t[10]=H=>o.profileData.username=H),prefix:"@","pop-message":e.$t("Are you sure you want to change username?"),edit_notice:e.$t("Please choose a username matching with your first/last name or full name"),placeholder:e.$t("Username")},null,8,["modelValue","pop-message","edit_notice","placeholder"])]),_:1},8,["label"])])])):_("",!0),a(f,null,{default:c(()=>[l("div",_7,[Y((n(),v(B,{class:"fcom_primary_button",onClick:i.updateProfile,disabled:o.updating},{default:c(()=>[M(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[N,o.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),s.profile.username==e.appVars.auth.username&&s.profile.can_change_password?(n(),r("div",m7,[a(U,{onSubmit:t[16]||(t[16]=q(()=>{},["prevent"])),"label-position":"top"},{default:c(()=>[l("div",h7,[l("div",f7,[l("h5",null,d(e.$t("Change Password")),1),l("p",null,d(e.$t("Update the password you use to log in.")),1)]),l("div",p7,[a(f,{label:e.$t("Current Password"),required:""},{default:c(()=>[a(m,{type:"password","show-password":"",autocomplete:"current-password",modelValue:o.passwordData.current_password,"onUpdate:modelValue":t[13]||(t[13]=H=>o.passwordData.current_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("New Password"),required:""},{default:c(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.new_password,"onUpdate:modelValue":t[14]||(t[14]=H=>o.passwordData.new_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Confirm New Password"),required:""},{default:c(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.confirm_password,"onUpdate:modelValue":t[15]||(t[15]=H=>o.passwordData.confirm_password=H)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,null,{default:c(()=>[Y((n(),v(B,{class:"fcom_primary_button",onClick:i.changePassword,disabled:o.changingPassword},{default:c(()=>[M(d(e.$t("Change Password")),1)]),_:1},8,["onClick","disabled"])),[[N,o.changingPassword]])]),_:1})])])]),_:1})])):_("",!0),e.hasFeature("can_deactivate_account")&&s.profile.username==e.appVars.auth.username?(n(),v(A,{key:1,profile:s.profile},null,8,["profile"])):_("",!0)],64)}const y7=P(K$,[["render",g7]]),v7={name:"UserAbout",props:["profile","isOwn"],components:{Timer:Zs,CalendarIcon:po,LockedProfile:pt},computed:{hasSocialLinks(){return this.socialLinks.length>0},visibleGroups(){return(this.profile.custom_field_groups||[]).filter(t=>t.fields&&t.fields.some(s=>this.hasFieldValue(s.value)))},socialLinks(){var u,o;let e=(u=this.profile)==null?void 0:u.social_links;e||(e=(o=this.profile.meta)==null?void 0:o.social_links);const t=[];if(this.profile.website&&t.push({title:this.$t("Website"),icon:'<svg viewBox="0 0 40 20" fill="currentColor"><path d="M3.8 10C3.8 6.58 6.58 3.8 10 3.8H18V0H10C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20H18V16.2H10C6.58 16.2 3.8 13.42 3.8 10ZM12 12H28V8H12V12ZM30 0H22V3.8H30C33.42 3.8 36.2 6.58 36.2 10C36.2 13.42 33.42 16.2 30 16.2H22V20H30C35.52 20 40 15.52 40 10C40 4.48 35.52 0 30 0Z"></path></svg>',text:this.profile.website,url:this.profile.website}),!e)return t;const s=this.appVars.socialLinkProviders;return Object.entries(s).forEach(([i,m])=>{e[i]&&t.push({title:m.title,icon:m.icon_svg,text:e[i],url:m.domain+e[i]})}),t}},methods:{goToUpdateProfile(){this.$router.push({name:"update_profile",params:{username:this.profile.username}})},hasFieldValue(e){return Array.isArray(e)?e.length>0:e!=null&&e!==""},formatFieldValue(e){return e.type==="multiselect"&&Array.isArray(e.value)&&e.options?e.value.map(t=>e.options[t]||t).join(", "):e.value}}},b7={key:1,class:"about_wrap"},k7={class:"about_header"},w7={key:0,class:"about_body"},C7=["innerHTML"],$7={key:1},S7={class:"about_items"},V7=["title"],M7=["title"],L7={class:"items_title"},T7={key:0,class:"about_item"},F7={class:"about_item_label"},P7=["href"],I7={key:2,class:"about_items"},E7={key:0,class:"items_title"},A7=["href","title"];function U7(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("EditPen"),h=j,g=O,k=p("CalendarIcon"),b=p("Timer"),S=J;return s.profile.is_restricted?(n(),v(m,{key:0})):(n(),r("div",b7,[l("div",k7,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),v(g,{key:0,"aria-label":e.$t("Edit your profile description"),onClick:i.goToUpdateProfile,text:""},{default:c(()=>[a(h,null,{default:c(()=>[a(f)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0)]),s.profile?(n(),r("div",w7,[s.profile.short_description_rendered?(n(),r("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,C7)):s.isOwn?(n(),r("div",$7,[a(g,{class:"fcom_plain_button",onClick:t[0]||(t[0]=w=>e.$router.push({name:"update_profile",params:{username:s.profile.username}}))},{default:c(()=>[l("span",null,d("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",S7,[s.profile.created_at?(n(),r("div",{key:0,title:s.profile.created_at,class:"about_item"},[a(h,null,{default:c(()=>[a(k)]),_:1}),l("span",null,d(e.$t("Joined %s",e.humanDateDiff(s.profile.created_at))),1)],8,V7)):_("",!0),s.profile.last_activity?(n(),r("div",{key:1,title:s.profile.last_activity,class:"about_item"},[a(h,null,{default:c(()=>[a(b)]),_:1}),M(" "+d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),1)],8,M7)):_("",!0)]),(n(!0),r(T,null,x(i.visibleGroups,w=>(n(),r("div",{key:w.slug,class:"about_items"},[l("div",L7,d(w.label),1),(n(!0),r(T,null,x(w.fields,$=>(n(),r(T,{key:$.slug},[i.hasFieldValue($.value)?(n(),r("div",T7,[l("span",F7,d($.label)+":",1),$.type==="url"&&$.value?(n(),r("a",{key:0,href:$.value,target:"_blank",rel:"noopener noreferrer"},d($.value),9,P7)):(n(),r("span",{key:1,class:D({about_item_multiline:$.type==="textarea"})},d(i.formatFieldValue($)),3))])):_("",!0)],64))),128))]))),128)),i.hasSocialLinks||s.isOwn?(n(),r("div",I7,[i.hasSocialLinks?(n(),r("div",E7,d(e.$t("Social Links")),1)):_("",!0),(n(!0),r(T,null,x(i.socialLinks,w=>(n(),r("a",{target:"_blank",rel:"noopener noreferrer",href:w.url,key:w.title,title:w.title,class:"about_item"},[a(h,{innerHTML:w.icon},null,8,["innerHTML"]),M(" "+d(w.text),1)],8,A7))),128)),s.isOwn&&!i.hasSocialLinks?(n(),v(g,{key:1,class:"fcom_plain_button",onClick:i.goToUpdateProfile},{default:c(()=>[l("span",null,d("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(n(),v(S,{key:1,animated:!0}))]))}const B7=P(v7,[["render",U7]]),D7={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:$e,Check:Js,ImageIcon:os,FeedMdContent:Tt,LockedProfile:pt},data(){return{comments:[],loading:!0,pagination:{page:1,per_page:10,total:0},working:!1,replyingComemnt:null,isReplying:!1,expandedMap:{},canExpandMap:{}}},methods:{fetchComments(){this.loading=!0,this.$get("profile/"+this.username+"/comments",{page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.comments=e.comments.data,this.pagination.total=e.comments.total,this.expandedMap={},this.canExpandMap={},window.scrollTo(0,0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1,this.$nextTick(()=>{this.checkOverflow()})})},deleteComment(e,t){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),"Warning",{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+e.post_id+"/comments/"+e.id).then(s=>{this.comments.splice(t,1),this.$notify.success(s.message)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})})},initCommentReply(e){this.replyingComemnt=e,this.$nextTick(()=>{this.isReplying=!0})},limitCharacters(e,t){return e.slice(0,t)+(e.length>t?"...":"")},getPostRoute(e){var s;let t=(s=e.post)==null?void 0:s.type;return!t||!e.post?{name:"all_feeds"}:t=="text"||t=="article"?{name:"single_feed",params:{feed_slug:e.post.slug},query:{comment_id:e.id}}:t=="course_lesson"&&e.post.space?{name:"view_lesson",params:{course_slug:e.post.space.slug,lesson_slug:e.post.slug},query:{comment_id:e.id}}:{name:"all_feeds",query:{comment_id:e.id,post_id:e.post.id}}},getPostHref(e){return this.$router.resolve(this.getPostRoute(e)).href},canOpenInModal(e){var t,s;return!this.hasFeature("show_post_modal")||((t=e.post)==null?void 0:t.type)!="text"?!1:!!((s=e.post)!=null&&s.permalink)},openPost(e,t){if(!(t.ctrlKey||t.metaKey||t.shiftKey||t.button===1)){if(t.preventDefault(),!this.canOpenInModal(e)){this.$router.push(this.getPostRoute(e));return}this.$eventBus.emit("showFeedModal",{feed:e.post,view:"comments",highlight_comment_id:e.id})}},getPostExcerpt(e){if(!e)return"";let t=e.type;t=="text"&&(t="");let s="";return e.title?s=e.title:s=this.getExcerpt(e.message,50),s+(t?" ("+t+")":"")},contentClass(e){return"comment_text_body"+(this.expandedMap[e]?"":" clamped")},toggleExpand(e){this.expandedMap={...this.expandedMap,[e]:!this.expandedMap[e]}},checkOverflow(){const e=this.$refs.commentBody||[],t=this.comments.filter(u=>u.message_rendered),s={};e.forEach((u,o)=>{var f;const i=(f=u==null?void 0:u.$refs)==null?void 0:f.content,m=t[o];i&&m&&(s[m.id]=i.scrollHeight>i.clientHeight+1)}),this.canExpandMap=s}},mounted(){this.profile.is_restricted||this.fetchComments()}},R7={key:1,class:"white_loaded"},x7={class:"course_comments feed_comments user_comments"},O7={class:"comment_text_head"},H7=["title"],j7={class:"comment_action"},N7={class:"comment_text_head_post"},z7=["href","aria-haspopup","onClick"],q7={class:"comment_text"},G7=["onClick"],Y7={key:1,class:"comment_text_body feed_md_content media_only_content"},W7={key:0};function K7(e,t,s,u,o,i){const m=p("LockedProfile"),f=J,h=p("Delete"),g=j,k=O,b=p("FeedMdContent"),S=p("ImageIcon"),w=p("pagination");return s.profile.is_restricted?(n(),v(m,{key:0})):o.loading?(n(),r("div",R7,[a(f,{row:5})])):(n(),r(T,{key:2},[l("div",x7,[(n(!0),r(T,null,x(o.comments,($,y)=>(n(),r("div",{key:$.id,class:"fcom_course_comment each_comment"},[t[0]||(t[0]=l("span",{class:"comment_icon"},null,-1)),l("div",O7,[l("div",{title:$.created_at,class:"comment_text_head_time"},d(e.humanDateDiff($.created_at)),9,H7),l("div",j7,[s.isOwn?(n(),v(k,{key:0,class:"fcom_plain_button",onClick:C=>i.deleteComment($,y)},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0)])]),l("div",N7,[l("a",{class:"post_link",href:i.getPostHref($),"aria-haspopup":i.canOpenInModal($)?"dialog":null,onClick:C=>i.openPost($,C)},d(i.getPostExcerpt($.post)),9,z7)]),l("div",q7,[$.message_rendered?(n(),r(T,{key:0},[a(b,{ref_for:!0,ref:"commentBody",class_name:i.contentClass($.id),content:$.message_rendered},null,8,["class_name","content"]),o.canExpandMap[$.id]?(n(),r("button",{key:0,type:"button",class:"fcom_see_more_btn",onClick:C=>i.toggleExpand($.id)},d(o.expandedMap[$.id]?e.$t("See less"):e.$t("See more")),9,G7)):_("",!0)],64)):(n(),r("div",Y7,[a(S,{class:"fcom_status_img_icon"})]))])]))),128)),o.pagination.total?_("",!0):(n(),r("div",W7,[l("h5",null,d(e.$t("%s did not add any comment to any posts yet",s.profile.display_name)),1)]))]),a(w,{pagination:o.pagination,onFetch:i.fetchComments},null,8,["pagination","onFetch"])],64))}const Z7=P(D7,[["render",K7]]),J7={name:"UserCourses",props:["profile","isOwn"],components:{MoreFilled:Qs,GroupIcon:Bt,LockedProfile:pt},data(){return{courses:[],loading:!1}},watch:{"profile.user_id"(e,t){!e||e===t||(this.courses=[],this.hasFeature("has_course")&&!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch())}},methods:{goToCourse(e){this.$router.push({name:"view_course",params:{course_slug:e}})},removeMembership(e){this.$confirm(this.$t("Are you sure you want to remove this course?"),this.$t("Remove Course")).then(()=>{this.$post("spaces/"+e+"/members/remove",{user_id:this.profile.user_id}).then(()=>{this.fetch()}).catch(t=>{this.$handleError(t)})})},fetch(){this.loading=!0,this.$get("profile/"+this.profile.username+"/courses").then(e=>{this.courses=e.courses||[]}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){if(!this.hasFeature("has_course")){this.$router.replace({name:"user_profile",params:{username:this.profile.username}});return}!this.profile.is_restricted&&this.profile.canViewUserSpaces&&this.fetch()}},Q7={key:1,class:"user_courses"},X7={key:0,class:"fcom_box_card_list"},e9=["onClick"],t9=["src","alt","onError"],s9={key:1,class:"fcom_no_image"},o9={class:"fcom_box_card_info"},i9={class:"fcom_box_card_name"},n9={class:"fcom_box_card_details"},l9={class:"inline_details"},a9={key:0,class:"inline_details"},r9={key:0,class:"fcom_box_card_description"},c9=["innerHTML"],d9={class:"fcom_box_card_action"},u9=["onClick"],_9=["onClick"],m9={key:1,class:"loading"},h9={key:2},f9={class:"no_members"},p9={key:3,class:"fcom_no_items_wrap"},g9={key:0},y9={key:1};function v9(e,t,s,u,o,i){const m=p("LockedProfile"),f=De,h=p("router-link"),g=p("MoreFilled"),k=j,b=O,S=We,w=Ke,$=Ze,y=p("GroupIcon"),C=J;return s.profile.is_restricted?(n(),v(m,{key:0})):(n(),r("div",Q7,[o.courses.length?(n(),r("div",X7,[(n(!0),r(T,null,x(o.courses,L=>(n(),r("div",{key:L.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:V=>i.goToCourse(L.slug)},[L.cover_photo&&!L.coverError?(n(),r("img",{key:0,src:L.cover_photo,alt:L.title,onError:V=>L.coverError=!0},null,40,t9)):(n(),r("div",s9))],8,e9),l("div",o9,[l("div",i9,[a(h,{class:"course_route",to:{name:"view_course",params:{course_slug:L.slug}}},{default:c(()=>[M(d(L.title)+" ",1),L.status=="draft"?(n(),v(f,{key:0,type:"info"},{default:c(()=>[M(d(L.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"]),e.isAdmin()?(n(),v($,{key:0,trigger:"click"},{dropdown:c(()=>[a(w,null,{default:c(()=>[a(S,{onClick:V=>i.removeMembership(L.slug)},{default:c(()=>[M(d(e.$t("Remove from course")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:c(()=>[a(b,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(k,null,{default:c(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",n9,[l("div",l9,[l("span",null,d(e.$_n("%d Section","%d Sections",L.sectionsCount)),1),t[0]||(t[0]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,d(e.$_n("%d Lesson","%d Lessons",L.lessonsCount)),1)]),L.studentsCount?(n(),r("div",a9,[a(k,null,{default:c(()=>[a(y)]),_:1}),M(" "+d(e.$_n("%s student","%s students",e.$formatNumber(L.studentsCount))),1)])):_("",!0)]),L.description?(n(),r("div",r9,d(e.getExcerpt(L.description)),1)):_("",!0),L.custom_html?(n(),r("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:L.custom_html},null,8,c9)):_("",!0),l("div",d9,[L.isEnrolled?(n(),r("button",{key:0,class:"fcom_card_button",onClick:V=>i.goToCourse(L.slug)},d(e.$t("%s Completed",L.progress+"%")),9,u9)):(n(),r("button",{key:1,class:"fcom_card_button",onClick:V=>i.goToCourse(L.slug)},d(e.$t("View Course")),9,_9))])])]))),128))])):_("",!0),o.loading?(n(),r("div",m9,[a(C,{class:"white_loaded",rows:3,animated:!0}),a(C,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?o.courses.length?_("",!0):(n(),r("div",p9,[l("h3",null,d(e.$t("No courses yet")),1),s.isOwn?(n(),r("p",g9,d(e.$t("Courses you enroll in will appear here.")),1)):(n(),r("p",y9,d(e.$t("This member has not enrolled in any courses yet.")),1))])):(n(),r("div",h9,[l("div",f9,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const b9=P(J7,[["render",v9]]),k9={name:"GroupUsersIcon"},w9={viewBox:"0 0 128 128",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function C9(e,t,s,u,o,i){return n(),r("svg",w9,[...t[0]||(t[0]=[Le('<g><path d="M64,42c-13.2,0-24,10.8-24,24s10.8,24,24,24s24-10.8,24-24S77.2,42,64,42z M64,82c-8.8,0-16-7.2-16-16s7.2-16,16-16s16,7.2,16,16S72.8,82,64,82z"></path><path d="M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"></path><path d="M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"></path><path d="M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"></path><path d="M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"></path><path d="M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"></path></g>',1)])])}const $9=P(k9,[["render",C9]]),S9={name:"NotificationPref",components:{NotificationOnboard:ss,Notification:_i,GroupUsersIcon:$9},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:"",crm_email_status:"",push_available:!1,reconfirming:!1,reconfirm_sent:!1}},computed:{isOwn(){return this.username===this.auth.username},showPush(){return this.push_available},channelRows(){return[{key:"comment",label:this.$t("Someone comments on my post"),mail:"com_my_post_mail",push:"com_my_post_push"},{key:"reply",label:this.$t("Someone replies to my comment"),mail:"reply_my_com_mail",push:"reply_my_com_push"},{key:"mention",label:this.$t("Someone mentions me"),mail:"mention_mail",push:"mention_push"},{key:"co_comment",label:this.$t("Someone also comments on a post I commented on"),push:"co_com_push"},{key:"digest",label:this.$t("Weekly digest on %s",this.digestEmailDay),mail:"digest_mail",push:""}]},visibleChannelRows(){return this.channelRows.filter(e=>e.mail||e.push&&this.showPush)},notificationRows(){const e=[];return this.spaceGroups.forEach(t=>{e.push({__group:!0,id:t.id,title:t.title}),t.spaces.forEach(s=>{e.push(s)})}),e},fcom_is_dirty(){return this.initialState?JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)!=this.initialState:!1}},methods:{getPrefs(){this.loading||(this.loading=!0,this.$get(`profile/${this.username}/notification-preferences`).then(e=>{this.pref=e.user_globals,this.spaceGroups=e.spaceGroups,this.digestEmailDay=e.digestEmailDay,this.default_messaging_email_frequency=e.default_messaging_email_frequency,this.crm_email_status=e.crm_email_status||"",this.push_available=!!e.push_available,this.initialState=JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)}).catch(e=>{this.error=e==null?void 0:e.message,this.$handleError(e)}).finally(()=>{this.loading=!1}))},reconfirmEmail(){this.reconfirming=!0,this.$post(`profile/${this.username}/reconfirm-email`).then(e=>{this.reconfirm_sent=!0,this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.reconfirming=!1})},saveSettings(){if(this.saving)return;this.saving=!0;let e={};this.spaceGroups.forEach(t=>{t.spaces.forEach(s=>{e[s.id]=s.pref})}),this.$post(`profile/${this.username}/notification-preferences`,{user_globals:this.pref,space_prefs:e}).then(t=>{this.$notify.success(t.message),this.initialState=JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})}},mounted(){this.isOwn||this.hasPermission("super_admin")?this.getPrefs():this.error=this.$t("You can only manage your own notification preferences.")}},V9={class:"fcom_notification_config"},M9={key:0},L9=["innerHTML"],T9={key:1,class:"white_loaded"},F9={class:"fcom_notification_card"},P9={class:"fcom_notification_card__header"},I9={class:"fcom_notification_card__title"},E9={key:0,class:"fcom_gn_alert_wrap"},A9={style:{margin:"0 0 10px 0","font-size":"12px"}},U9={key:0,style:{margin:"0","font-weight":"500"}},B9={class:"fcom_gn_table_wrap"},D9={class:"fcom_gn_event"},R9={class:"fcom_gn_cell_checks"},x9={key:1,class:"fcom_input_wrap fcom_gn_freq"},O9={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},H9={key:0,class:"fcom_not_enabled"},j9={key:1,class:"fcom_not_enabled"},N9={key:2,class:"fcom_not_enabled"},z9={class:"fcom_notification_card"},q9={class:"fcom_notification_card__header"},G9={class:"fcom_notification_card__title"},Y9={class:"fcom_np_table_wrap"},W9={key:0,class:"fcom_np_group_title"},K9={key:1,class:"fcom_np_space"},Z9=["innerHTML"],J9=["innerHTML"],Q9={key:2,class:"fcom_np_icon fcom_no_avatar"},X9={class:"fcom_np_name"},eS={class:"fcom_sr_only"},tS={class:"fcom_sr_only"},sS={class:"fcom_sr_only"},oS={key:0,class:"fcom_np_cell_radios"},iS={key:0,class:"fcom_notification_card fcom_fixed_bottom_overlay"},nS={key:3},lS={key:0},aS=["href"];function rS(e,t,s,u,o,i){const m=J,f=p("NotificationOnboard"),h=p("Notification"),g=j,k=O,b=Yt,S=Zt,w=ve,$=Jt,y=Je,C=be,L=p("GroupUsersIcon");return n(),r("div",V9,[o.error?(n(),r("div",M9,[l("p",{innerHTML:o.error},null,8,L9)])):o.loading?(n(),r("div",T9,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&o.pref?(n(),r("div",{key:2,class:D([{fcom_is_dirty:i.fcom_is_dirty},"fcom_notification_config_body"])},[a(f,{placement:"profile_notification_prefs","should-show-close-button":!1}),l("div",F9,[l("div",P9,[a(g,{style:{"font-size":"30px"}},{default:c(()=>[a(h)]),_:1}),l("div",I9,[l("h3",null,d(e.$t("Global Notifications")),1),l("p",null,d(e.$t("These settings will be applied across all spaces you're a member of.")),1)])]),o.crm_email_status?(n(),r("div",E9,[a(b,{class:"fcom_email_paused_alert",type:"warning",closable:!1,"show-icon":""},{title:c(()=>[M(d(e.$t("Your email notifications are currently paused")),1)]),default:c(()=>[l("p",A9,d(e.$t("Emails to your address previously failed to deliver, so notification emails are paused for your account. Please re-confirm your email address to resume them.")),1),o.reconfirm_sent?(n(),r("p",U9,d(e.$t("Confirmation email sent! Please check your inbox and click the confirmation link.")),1)):(n(),v(k,{key:1,size:"small",type:"warning",loading:o.reconfirming,onClick:i.reconfirmEmail},{default:c(()=>[M(d(e.$t("Re-confirm my email address")),1)]),_:1},8,["loading","onClick"]))]),_:1})])):_("",!0),l("div",B9,[a($,{data:i.visibleChannelRows,class:"fcom_gn_table fcom_table"},{default:c(()=>[a(S,{label:e.$t("Notify me when"),"min-width":e.isMobile?180:220,fixed:""},{default:c(({row:V})=>[l("span",D9,d(V.label),1)]),_:1},8,["label","min-width"]),e.isMobile?(n(),v(S,{key:1,label:e.$t("Notifications"),"min-width":"170"},{default:c(({row:V})=>[l("div",R9,[V.mail?(n(),v(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.mail],"onUpdate:modelValue":I=>o.pref[V.mail]=I,class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Email")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])):_("",!0),i.showPush&&V.push?(n(),v(w,{key:1,"true-value":"yes","false-value":"no",modelValue:o.pref[V.push],"onUpdate:modelValue":I=>o.pref[V.push]=I,class:"fcom_checkbox"},{default:c(()=>[M(d(e.$t("Push")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])):_("",!0)])]),_:1},8,["label"])):(n(),r(T,{key:0},[a(S,{label:e.$t("Email"),align:"center",width:"150"},{default:c(({row:V})=>[V.mail?(n(),v(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.mail],"onUpdate:modelValue":I=>o.pref[V.mail]=I,class:"fcom_checkbox fcom_gn_check","aria-label":V.label},null,8,["modelValue","onUpdate:modelValue","aria-label"])):_("",!0)]),_:1},8,["label"]),i.showPush?(n(),v(S,{key:0,label:e.$t("Push"),align:"center",width:"150"},{default:c(({row:V})=>[V.push?(n(),v(w,{key:0,"true-value":"yes","false-value":"no",modelValue:o.pref[V.push],"onUpdate:modelValue":I=>o.pref[V.push]=I,class:"fcom_checkbox fcom_gn_check","aria-label":V.label},null,8,["modelValue","onUpdate:modelValue","aria-label"])):_("",!0)]),_:1},8,["label"])):_("",!0)],64))]),_:1},8,["data"])]),e.appVars.has_chat&&o.default_messaging_email_frequency!="no"?(n(),r("div",x9,[l("p",O9,d(e.$t("Email sending frequency for one-to-one messages")),1),a(C,{modelValue:o.pref.message_email_frequency,"onUpdate:modelValue":t[0]||(t[0]=V=>o.pref.message_email_frequency=V),class:"fcom_radio_group"},{default:c(()=>[o.default_messaging_email_frequency!=="disabled"?(n(),v(y,{key:0,value:"default",label:e.$t("Community Default")},null,8,["label"])):_("",!0),a(y,{value:"hourly",label:e.$t("Hourly")},null,8,["label"]),a(y,{value:"daily",label:e.$t("Daily")},null,8,["label"]),a(y,{value:"weekly",label:e.$t("Weekly")},null,8,["label"]),a(y,{value:"disabled",label:e.$t("Disable")},null,8,["label"])]),_:1},8,["modelValue"]),o.pref.message_email_frequency=="disabled"?(n(),r("p",H9,d(e.$t("You will not get any email on new messages from any members")),1)):o.pref.message_email_frequency=="default"?(n(),r("p",j9,[o.default_messaging_email_frequency=="disabled"?(n(),r(T,{key:0},[M(d(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(n(),r(T,{key:1},[M(d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.default_messaging_email_frequency))),1)],64))])):(n(),r("p",N9,d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.pref.message_email_frequency))),1))])):_("",!0)]),l("div",z9,[l("div",q9,[a(g,{style:{"font-size":"30px"}},{default:c(()=>[a(L)]),_:1}),l("div",G9,[l("h3",null,d(e.$t("New Posts Notifications")),1),l("p",null,d(e.$t("Subscribe to new posts notifications by space")),1)])]),l("div",Y9,[a($,{data:i.notificationRows,"row-class-name":({row:V})=>V.__group?"fcom_np_group_row":"",class:"fcom_np_table fcom_table"},{empty:c(()=>[M(d(e.$t("No spaces found")),1)]),default:c(()=>[a(S,{label:e.$t("Space"),"min-width":e.isMobile?180:220,fixed:""},{default:c(({row:V})=>[V.__group?(n(),r("div",W9,d(V.title),1)):(n(),r("div",K9,[V.icon?(n(),v(g,{key:0,class:"fcom_np_icon"},{default:c(()=>[l("span",{innerHTML:V.icon},null,8,Z9)]),_:2},1024)):V.shape_svg?(n(),r("span",{key:1,class:"fcom_np_icon",innerHTML:V.shape_svg},null,8,J9)):(n(),r("span",Q9)),l("span",X9,d(V.title),1)]))]),_:1},8,["label","min-width"]),e.isMobile?(n(),v(S,{key:1,label:e.$t("Notifications"),"min-width":"200"},{default:c(({row:V})=>[V.__group?_("",!0):(n(),r("div",oS,[a(y,{modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"",name:"space-pref-"+V.id},{default:c(()=>[M(d(e.$t("Email Disabled")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]),a(y,{modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"admin_only_posts",name:"space-pref-"+V.id},{default:c(()=>[M(d(e.$t("Notify only for Admin Posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]),a(y,{modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"all_member_posts",name:"space-pref-"+V.id},{default:c(()=>[M(d(e.$t("Notify for all posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"])]))]),_:1},8,["label"])):(n(),r(T,{key:0},[a(S,{label:e.$t("Email Disabled"),align:"center",width:"180"},{default:c(({row:V})=>[V.__group?_("",!0):(n(),v(y,{key:0,modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:c(()=>[l("span",eS,d(e.$t("Email Disabled")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(S,{label:e.$t("Notify only for Admin Posts"),align:"center",width:"220"},{default:c(({row:V})=>[V.__group?_("",!0):(n(),v(y,{key:0,modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"admin_only_posts",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:c(()=>[l("span",tS,d(e.$t("Notify only for Admin Posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(S,{label:e.$t("Notify for all posts"),align:"center",width:"180"},{default:c(({row:V})=>[V.__group?_("",!0):(n(),v(y,{key:0,modelValue:V.pref,"onUpdate:modelValue":I=>V.pref=I,value:"all_member_posts",name:"space-pref-"+V.id,class:"fcom_np_radio"},{default:c(()=>[l("span",sS,d(e.$t("Notify for all posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"])],64))]),_:1},8,["data","row-class-name"])])]),i.isOwn?(n(),r("div",iS,[a(k,{onClick:i.saveSettings,disabled:o.saving,loading:o.saving,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])):_("",!0)],2)):(n(),r("div",nS,[l("h3",null,d(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(n(),r("div",lS,[l("p",null,d(e.$t("Please login to access this page.")),1),l("a",{href:e.appVars.auth_url,class:"el-button fcom_primary_button link_button"},d(e.$t("Login")),9,aS)]))]))])}const cS=P(S9,[["render",rS]]),dS={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:cS}},uS={class:"fcom_routed_notification_settings"};function _S(e,t,s,u,o,i){const m=p("notification-pref-form");return n(),r("div",uS,[a(m,{username:s.username},null,8,["username"])])}const mS=P(dS,[["render",_S]]),hS={name:"UserFollowers",components:{Pagination:$e,FollowAction:st},props:["isOwn","profile"],emits:["refetch"],data(){return{loading:!1,follows:[],search:"",sort_by:"id",pagination:{page:1,per_page:20,total:0}}},watch:{profile(e){this.fetchFollowers()}},computed:{showPagination(){return this.pagination.total>this.pagination.per_page}},methods:{handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchFollowers()},fetchFollowers(){this.loading=!0,this.$get("profile/"+this.profile.username+"/followers",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,sort_by:this.sort_by}).then(e=>{this.follows=e.followers.data,this.pagination.total=e.followers.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchFollowers(),this.changeTitle(this.$t("Followers"))}},fS={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},pS={class:"search_member"},gS={class:"feed_filters"},yS={id:"feed_short_by",class:"fcom_feed_filter_label"},vS={key:0,class:"loading"},bS={key:1,class:"no_follow"},kS={key:2,class:"card_list"},wS=["aria-label"],CS={class:"card_avatar"},$S={class:"card_info"},SS={class:"info_header"},VS={class:"meta_line"},MS={key:0,class:"card_headline"},LS={class:"feed_meta_info"},TS=["title"],FS=["title"],PS={key:1,class:"card_description"},IS={class:"card_action"},ES=["aria-label"];function AS(e,t,s,u,o,i){const m=p("Search"),f=j,h=ie,g=ae,k=re,b=J,S=p("UserAvatar"),w=p("UserRouteLink"),$=p("FollowAction"),y=p("Pagination");return n(),r("div",fS,[l("div",pS,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=C=>o.search=C),placeholder:e.$t("Search Followers...")},{prefix:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",gS,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",yS,d(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followers by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=C=>o.sort_by=C),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=C=>i.toSearch())},{default:c(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),r("div",vS,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),r("div",bS,[o.search?(n(),r(T,{key:0},[M(d(e.$t("No results found")),1)],64)):(n(),r(T,{key:1},[M(d(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(n(),r("div",kS,[(n(!0),r(T,null,x(o.follows,C=>{var L,V,I,F,R,B,U,A,N,H;return n(),r("div",{key:C.followed_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",CS,[a(S,{is_online:e.isOnline((L=C.follower)==null?void 0:L.last_activity),xprofile:C.follower},null,8,["is_online","xprofile"])]),l("div",$S,[l("div",SS,[a(w,{show_pop:!0,show_badge:!0,xprofile:C.follower,show_follow:!0},null,8,["xprofile"]),l("div",VS,"@"+d((V=C.follower)==null?void 0:V.username),1)]),(F=(I=C.follower)==null?void 0:I.meta)!=null&&F.headline?(n(),r("div",MS,d(C.follower.meta.headline),1)):_("",!0),l("div",LS,[(R=C.follower)!=null&&R.created_at?(n(),r("div",{key:0,title:(B=C.follower)==null?void 0:B.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(C.follower.created_at))),9,TS)):_("",!0),(U=C.follower)!=null&&U.last_activity?(n(),r("div",{key:1,title:(A=C.follower)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(C.follower.last_activity))),9,FS)):_("",!0)]),(N=C.follower)!=null&&N.short_description?(n(),r("div",PS,d(e.getExcerpt(((H=C.follower.meta)==null?void 0:H.short_description_rendered)||C.follower.short_description,120)),1)):_("",!0)])],8,wS),l("div",IS,[a($,{profile:C.follower,onRefetch:t[3]||(t[3]=z=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(y,{hide_on_single:!0,onFetch:t[4]||(t[4]=C=>i.fetchFollowers()),pagination:o.pagination},null,8,["pagination"])],8,ES)):_("",!0)])}const US=P(hS,[["render",AS]]),BS={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:$e,FollowAction:st},data(){return{loading:!1,follows:[],search:"",sort_by:"id",pagination:{page:1,per_page:20,total:0}}},computed:{showPagination(){return this.pagination.total>this.pagination.per_page}},methods:{handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchFollowings()},fetchFollowings(){this.loading=!0,this.$get("profile/"+this.profile.username+"/followings",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,sort_by:this.sort_by}).then(e=>{this.follows=e.followings.data,this.pagination.total=e.followings.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.fetchFollowings(),this.changeTitle(this.$t("Followings"))}},DS={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},RS={class:"search_member"},xS={class:"feed_filters"},OS={id:"feed_short_by",class:"fcom_feed_filter_label"},HS={key:0,class:"loading"},jS={key:1,class:"no_follow"},NS={key:2,class:"card_list"},zS=["aria-label"],qS={class:"card_avatar"},GS={class:"card_info"},YS={class:"info_header"},WS={class:"meta_line"},KS={key:0,class:"card_headline"},ZS={class:"feed_meta_info"},JS=["title"],QS=["title"],XS={key:1,class:"card_description"},eV={class:"card_action"},tV=["aria-label"];function sV(e,t,s,u,o,i){const m=p("Search"),f=j,h=ie,g=ae,k=re,b=J,S=p("UserAvatar"),w=p("UserRouteLink"),$=p("FollowAction"),y=p("Pagination");return n(),r("div",DS,[l("div",RS,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=C=>o.search=C),placeholder:e.$t("Search Followings...")},{prefix:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",xS,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",OS,d(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followings by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=C=>o.sort_by=C),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=C=>i.toSearch())},{default:c(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),r("div",HS,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),r("div",jS,[o.search?(n(),r(T,{key:0},[M(d(e.$t("No results found")),1)],64)):s.isOwn?(n(),r(T,{key:1},[M(d(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(n(),r(T,{key:2},[M(d(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(n(),r("div",NS,[(n(!0),r(T,null,x(o.follows,C=>{var L,V,I,F,R,B,U,A,N,H;return n(),r("div",{key:C.followed_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",qS,[a(S,{is_online:e.isOnline((L=C.followed)==null?void 0:L.last_activity),xprofile:C.followed},null,8,["is_online","xprofile"])]),l("div",GS,[l("div",YS,[a(w,{show_pop:!0,show_badge:!0,xprofile:C.followed,show_follow:!0},null,8,["xprofile"]),l("div",WS,"@"+d((V=C.followed)==null?void 0:V.username),1)]),(F=(I=C.followed)==null?void 0:I.meta)!=null&&F.headline?(n(),r("div",KS,d(C.followed.meta.headline),1)):_("",!0),l("div",ZS,[(R=C.followed)!=null&&R.created_at?(n(),r("div",{key:0,title:(B=C.followed)==null?void 0:B.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(C.followed.created_at))),9,JS)):_("",!0),(U=C.followed)!=null&&U.last_activity?(n(),r("div",{key:1,title:(A=C.followed)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(C.followed.last_activity))),9,QS)):_("",!0)]),(N=C.followed)!=null&&N.short_description?(n(),r("div",XS,d(e.getExcerpt(((H=C.followed.meta)==null?void 0:H.short_description_rendered)||C.followed.short_description,120)),1)):_("",!0)])],8,zS),l("div",eV,[a($,{profile:C.followed,onRefetch:t[3]||(t[3]=z=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(y,{hide_on_single:!0,onFetch:t[4]||(t[4]=C=>i.fetchFollowings()),pagination:o.pagination},null,8,["pagination"])],8,tV)):_("",!0)])}const oV=P(BS,[["render",sV]]),iV={props:["profile","username","isOwn"],emits:["refetch"],data(){return{currentRoute:this.$route.name}},watch:{$route(e,t){this.currentRoute=e.name}},methods:{isActive(e){return this.currentRoute==e},switchRoute(e){this.currentRoute=e,this.$router.push({name:e,params:{username:this.username}})}}},nV={class:"follow_header"},lV={class:"fcom_filter_menu"},aV={class:"fcom_filter_menu_ul"},rV={key:0},cV={key:1},dV={class:"follow_body"};function uV(e,t,s,u,o,i){var f,h;const m=p("router-view");return n(),r(T,null,[l("div",nV,[l("div",lV,[l("ul",aV,[((f=s.profile)==null?void 0:f.followings_count)!=null?(n(),r("li",rV,[l("a",{href:"#",onClick:t[0]||(t[0]=q(g=>i.switchRoute("user_followings"),["prevent"])),class:D({"router-link-exact-active":i.isActive("user_followings")})},d(e.$t("Following")),3)])):_("",!0),((h=s.profile)==null?void 0:h.followers_count)!=null?(n(),r("li",cV,[l("a",{href:"#",onClick:t[1]||(t[1]=q(g=>i.switchRoute("user_followers"),["prevent"])),class:D({"router-link-exact-active":i.isActive("user_followers")})},d(e.$t("Followers")),3)])):_("",!0)])])]),l("div",dV,[a(m,{isOwn:s.isOwn,profile:s.profile,onRefetch:t[2]||(t[2]=g=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const _V=P(iV,[["render",uV]]),mV={name:"MemberAction",props:["member","openedMemberId"],data(){return{status:this.member.status,working:!1,isOpened:!1}},watch:{openedMemberId(e){this.isOpened=e===this.member.user_id}},methods:{changeMemberStatus(){this.working=!0,this.$patch("members/"+this.member.user_id,{status:this.status}).then(e=>{this.member.status=this.status,this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1,this.isOpened=!1})},togglePopover(){this.$emit("togglePopover")}}};function hV(e,t,s,u,o,i){const m=p("MoreFilled"),f=j,h=O,g=je,k=be,b=pe,S=ge,w=fe,$=se("loading");return n(),v(w,{persistent:!1,placement:"bottom",width:270,visible:o.isOpened,onHide:t[2]||(t[2]=y=>o.isOpened=!1)},{reference:c(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:i.togglePopover,size:"small",text:""},{default:c(()=>[a(f,{class:"fcom_more_icon"},{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:c(()=>[a(S,{onSubmit:t[1]||(t[1]=q(y=>e.doNothing(),["prevent"])),"label-position":"top"},{default:c(()=>[a(b,{label:e.$t("Status")},{default:c(()=>[a(k,{modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=y=>o.status=y)},{default:c(()=>[a(g,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(g,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(g,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:c(()=>[Y((n(),v(h,{disabled:o.working,onClick:i.changeMemberStatus,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[$,o.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const fV=P(mV,[["render",hV]]),pV={name:"AllMembers",components:{SocialLinks:Pt,Layout:we,AppLayout:Se,Pagination:$e,MemberAction:fV,FollowAction:st,SortControl:Eo},setup(){return{uiStore:St()}},data(){return{loading:!1,members:[],pagination:{page:1,per_page:24,total:0},permission_failed:!1,search:"",status:"active",sort_by:"last_activity",sort_dir:"desc",workingIds:[],openedMemberId:null,memberLayout:this.appVars.features.member_list_layout||"classic"}},computed:{sortOptions(){return[{value:"last_activity",label:this.$t("Last Activity"),defaultDir:"desc"},{value:"display_name",label:this.$t("Display Name"),defaultDir:"asc"},{value:"created_at",label:this.$t("Joining Date"),defaultDir:"desc"}]}},methods:{onSortChange(){this.uiStore.setListSort("members",this.sort_by,this.sort_dir),this.fetch()},restoreSortPreference(){const e=this.uiStore.getListSort("members");e&&this.sortOptions.some(t=>t.value===e.field)&&(this.sort_by=e.field,this.sort_dir=e.dir==="asc"?"asc":"desc")},fetch(){this.loading=!0,this.$get("members",{per_page:this.pagination.per_page,page:this.pagination.page,search:this.search,status:this.status,sort_by:this.sort_by,sort_dir:this.sort_dir}).then(e=>{window.scrollTo({top:0,behavior:"smooth"}),this.members=e.members.data,this.pagination.total=e.members.total,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{e.permission_failed?this.permission_failed=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},changeMemberStatus(e,t){this.workingIds.push(e.user_id),this.$patch("members/"+e.user_id,{status:t}).then(s=>{this.$notify.success(s.message),e.status=t}).catch(s=>{this.$handleError(s)}).finally(()=>{this.workingIds=this.workingIds.filter(s=>s!==e.user_id)})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()},handleTogglePopover(e){this.openedMemberId=this.openedMemberId===e?null:e}},mounted(){const e=["active","pending","blocked"];this.hasFeature("can_deactivate_account")&&e.push("deactivated");const t=this.$route.query.status,s=this.$route.query.inactives?"blocked":null,u=t||s;u&&e.includes(u)&&(this.status=u),this.restoreSortPreference(),this.fetch(),this.changeTitle(this.$t("All Members"))}},gV={key:0,class:"card_header"},yV=["aria-label"];const vV={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},bV={class:"permission_failed"},kV=["href"],wV={class:"search_member"},CV={class:"feed_filters"},$V={key:0,class:"loading"},SV={key:1,class:"no_members"},VV={key:2,class:"card_list"},MV=["aria-label"],LV={class:"card_avatar"},TV={class:"card_info"},FV={class:"info_header"},PV={class:"meta_line"},IV={key:0,class:"card_headline"},EV={class:"feed_meta_info"},AV=["title"],UV=["title"],BV={key:1,class:"card_description"},DV={key:2,class:"card_footer"},RV={class:"card_action"},xV=["aria-label"];function OV(e,t,s,u,o,i){const m=je,f=be,h=O,g=p("Search"),k=j,b=ie,S=p("SortControl"),w=J,$=p("UserAvatar"),y=p("UserRouteLink"),C=p("SocialLinks"),L=p("FollowAction"),V=p("MemberAction"),I=p("Pagination"),F=p("layout"),R=p("app-layout");return n(),v(R,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a(F,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(typeof o.pagination.total=="number"?" ("+e.$formatNumber(o.pagination.total)+")":"")},{default:c(()=>[e.isAdmin()?(n(),r("div",gV,[l("div",{role:"region","aria-label":e.$t("Member Navigation"),class:"member_status"},[a(f,{onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=B=>o.status=B),class:"status_group"},{default:c(()=>[a(m,{value:"active"},{default:c(()=>[M(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:c(()=>[M(d(e.$t("Pending")),1)]),_:1}),a(m,{value:"blocked"},{default:c(()=>[M(d(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(n(),v(m,{key:0,value:"deactivated"},{default:c(()=>[M(d(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])],8,yV),_("",!0)])):_("",!0),o.permission_failed?(n(),r("div",vV,[l("div",bV,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,kV)])])):(n(),r(T,{key:2},[l("div",wV,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=B=>o.search=B),placeholder:e.$t("Search Members...")},{prefix:c(()=>[a(k,null,{default:c(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",CV,[t[6]||(t[6]=l("div",{class:"fcom_feed_divider"},null,-1)),a(S,{field:o.sort_by,"onUpdate:field":t[3]||(t[3]=B=>o.sort_by=B),dir:o.sort_dir,"onUpdate:dir":t[4]||(t[4]=B=>o.sort_dir=B),options:i.sortOptions,onChange:i.onSortChange},null,8,["field","dir","options","onChange"])]),l("div",{class:D(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[o.loading?(n(),r("div",$V,[a(w,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),r("div",SV,d(e.$t("No members found")),1)):(n(),r("div",VV,[(n(!0),r(T,null,x(o.members,(B,U)=>{var A,N;return n(),r("div",{key:B.user_id,class:"each_card"},[l("div",{role:"region","aria-label":e.$t("User Info"),class:"card_content"},[l("div",LV,[a($,{is_online:e.isOnline(B.last_activity),xprofile:B},null,8,["is_online","xprofile"])]),l("div",TV,[l("div",FV,[a(y,{show_pop:!0,show_badge:!0,xprofile:B,show_follow:!0},null,8,["xprofile"]),l("div",PV,"@"+d(B.username),1)]),(A=B.meta)!=null&&A.headline?(n(),r("div",IV,d(B.meta.headline),1)):_("",!0),l("div",EV,[B.created_at?(n(),r("div",{key:0,title:B.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(B.created_at))),9,AV)):_("",!0),B.last_activity?(n(),r("div",{key:1,title:B.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(B.last_activity))),9,UV)):_("",!0)]),B.short_description?(n(),r("div",BV,d(e.getExcerpt(((N=B.meta)==null?void 0:N.short_description_rendered)||B.short_description,120)),1)):_("",!0),a(C,{style:{"justify-content":"left"},xprofile:B,isOwn:!1},null,8,["xprofile"]),B.status!="active"?(n(),r("div",DV,[l("div",{style:me({color:B.status==="pending"?"var(--el-color-warning)":"var(--el-color-danger)",display:"flex",gap:"10px"}),class:"meta_line"},[B.status==="pending"?(n(),r(T,{key:0},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(B.status)),1),a(h,{onClick:H=>i.changeMemberStatus(B,"active"),type:"primary",size:"small",disabled:o.workingIds.includes(B.user_id),loading:o.workingIds.includes(B.user_id)},{default:c(()=>[M(d(e.$t("Approve")),1)]),_:1},8,["onClick","disabled","loading"])],64)):B.status==="blocked"?(n(),r(T,{key:1},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(B.status)),1),a(h,{onClick:H=>i.changeMemberStatus(B,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(B.user_id),loading:o.workingIds.includes(B.user_id)},{default:c(()=>[M(d(e.$t("Unblock")),1)]),_:1},8,["onClick","disabled","loading"])],64)):(n(),r(T,{key:2},[l("span",null,d(e.$t("Status:"))+" "+d(e.$t("Self Deactivated")),1),a(h,{onClick:H=>i.changeMemberStatus(B,"active"),type:"danger",size:"small",disabled:o.workingIds.includes(B.user_id),loading:o.workingIds.includes(B.user_id)},{default:c(()=>[M(d(e.$t("Reactivate")),1)]),_:1},8,["onClick","disabled","loading"])],64))],4)])):_("",!0)])],8,MV),l("div",RV,[a(L,{profile:B},null,8,["profile"]),e.isAdmin()?(n(),v(V,{key:0,member:B,openedMemberId:o.openedMemberId,onTogglePopover:H=>i.handleTogglePopover(B.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),o.pagination.total?(n(),r("div",{key:3,role:"region","aria-label":e.$t("Pagination"),class:"pagination_wrap"},[a(I,{hide_on_single:!0,onFetch:t[5]||(t[5]=B=>i.fetch()),pagination:o.pagination},null,8,["pagination"])],8,xV)):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const HV=P(pV,[["render",OV]]),jV={name:"Notifications",components:{AppLayout:Se,Layout:we,NotificationsBlock:oo,Pagination:$e},setup(){return{notificationStore:ts()}},data(){return{status:"all",loading:!1,notifications:[],pagination:{page:1,per_page:20,total:0},working:!1,notification_type:"all"}},methods:{switchType(e){e==="unread"?(this.notification_type="all",this.status="unread"):(this.notification_type=e,this.status="all"),this.pagination.page=1,this.fetch()},fetch(){this.loading=!0,this.$get("notifications",{per_page:this.pagination.per_page,page:this.pagination.page,status:this.status,notification_type:this.notification_type}).then(e=>{this.notifications=e.notifications.data,this.pagination.total=e.notifications.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1,window.scrollTo(0,0)})},async markAllRead(){this.working=!0;try{await this.notificationStore.markAllAsRead(),this.$notify.success(this.$t("All notifications marked as read")),this.fetch()}catch(e){this.$handleError(e)}finally{this.working=!1}}},mounted(){this.fetch(),this.changeTitle(this.$t("All Notifications")),window.scrollTo(0,0)}},NV={class:"fcom_filter_menu"},zV={class:"fcom_filter_menu_ul fcom_notification_types"},qV={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},GV={key:0,class:"notifications notifications_wrap"},YV={class:"pagination_wrap"},WV={key:1,style:{"margin-top":"15px"}},KV={key:2};function ZV(e,t,s,u,o,i){const m=Ko,f=O,h=p("notifications-block"),g=p("Pagination"),k=J,b=p("layout"),S=p("app-layout"),w=se("loading");return n(),v(S,{wrapper_class:"fcom_single_layout"},{default:c(()=>[a(b,{content_class:"no_bg_layout notification_layout",title:e.$t("Notifications")},{actions:c(()=>[a(m,{onChange:t[0]||(t[0]=$=>i.fetch()),style:{"--el-switch-on-color":"#2271b1"},"active-value":"unread","inactive-value":"all","active-text":e.$t("Unread only"),modelValue:o.status,"onUpdate:modelValue":t[1]||(t[1]=$=>o.status=$),class:"fcom_switch"},null,8,["active-text","modelValue"]),a(f,{class:"fcom_primary_button",disabled:o.working,onClick:t[2]||(t[2]=$=>i.markAllRead())},{default:c(()=>[M(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:c(()=>[l("div",NV,[l("ul",zV,[l("li",null,[l("a",{onClick:t[3]||(t[3]=q($=>i.switchType("all"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="all"&&o.status!="unread"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=q($=>i.switchType("unread"),["prevent"])),class:D({"router-link-exact-active":o.status=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[5]||(t[5]=q($=>i.switchType("mentioned"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[6]||(t[6]=q($=>i.switchType("following"),["prevent"])),class:D({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),l("div",qV,[o.notifications.length?Y((n(),r("div",GV,[a(h,{notifications:o.notifications},null,8,["notifications"]),l("div",YV,[a(g,{hide_on_single:!0,onFetch:t[7]||(t[7]=$=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])])),[[w,o.loading]]):o.loading?(n(),r("div",KV,[a(k,{animated:!0,rows:5})])):(n(),r("div",WV,[l("p",null,d(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const JV=P(jV,[["render",ZV]]),QV={name:"Bookmarks",components:{Feeds:ft,AppLayout:Se,Layout:we},data(){return{search:""}},methods:{handleSearch(){this.search&&this.search.length<3||this.$router.replace({query:{...this.$route.query,search:this.search}})}},computed:{feed_base_url(){return"feeds/bookmarks"}},mounted(){this.changeTitle(this.$t("Your Bookmarks"))}},XV={style:{"margin-bottom":"16px"}},eM={class:"search_member"},tM={key:1};function sM(e,t,s,u,o,i){const m=p("Search"),f=j,h=ie,g=p("feeds"),k=p("layout"),b=p("app-layout");return n(),v(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:c(()=>[a(k,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:c(()=>[l("h4",XV,d(e.$t("Your saved posts")),1),l("div",eM,[a(h,{clearable:"",onClear:i.handleSearch,onKeydown:te(i.handleSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=S=>o.search=S),placeholder:e.$t("Search Posts...")},{prefix:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),e.appVars.auth.user_id?(n(),v(g,{key:0,feed_base_url:i.feed_base_url,hide_create_form:!0,space:"",feed_name:"all_feeds",context_suffix:"bookmarks",layout_style:e.appVars.features.default_feed_layout,default_order_by:e.appVars.features.default_feed_sort_by||"",can_change_order:e.appVars.features.disable_feed_sort_by!=="yes",can_change_layout:e.appVars.features.can_switch_layout},null,8,["feed_base_url","layout_style","default_order_by","can_change_order","can_change_layout"])):(n(),r("div",tM,[l("p",null,d(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const oM=P(QV,[["render",sM]]);const iM={name:"AllCourses",components:{AppLayout:Se,Layout:we,GroupIcon:Bt,Pagination:$e,Search:Fe},data(){return{courses:[],loading:!0,pagination:{page:1,per_page:24,total:0},type:"all",newCourseModal:!1,is_admin:!1,courseCategories:null,topic_slug:null,search:"",sort_by:"alphabetical"}},methods:{fetchCourses(){this.loading=!0,this.$get("courses",{type:this.type,search:this.search,sort_by:this.sort_by,topic_slug:this.topic_slug,page:this.pagination.page,per_page:this.pagination.per_page,with_categories:!this.courseCategories}).then(e=>{this.courses=e.courses.data,this.is_admin=e.is_admin,this.pagination.total=e.courses.total,e.course_categories&&e.course_categories.length&&(this.courseCategories=e.course_categories)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},setTopic(e){this.topic_slug=e;let t=JSON.parse(JSON.stringify(this.$route.query));e?(t.topic=e,this.$router.push({query:t})):(delete t.topic,this.$router.push({query:t})),this.fetchCourses()},SwitchToCourseView(e){this.type=e,this.$router.push({name:"courses",query:{type:e}}),this.fetchCourses()},getExcerpt(e){if(!e)return"";let t=e.replace(/(<([^>]+)>)/ig,"");return t.length>200&&(t=t.substring(0,200)+"..."),t},emitCreateCourse(){this.$eventBus.emit("createSpaceModal",{course_config:!0})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetchCourses()},changeSortBy(){this.$storeLocalData("course_sort_by",this.sort_by),this.toSearch()},watchTopicUrlChanged(e){this.setTopic(e),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.scrollTo({top:0,behavior:"smooth"})})}},created(){this.$eventBus.on("topic_changed",this.watchTopicUrlChanged)},mounted(){this.$route.query.type&&(this.type=this.$route.query.type),this.$route.query.topic&&(this.topic_slug=this.$route.query.topic),this.sort_by=this.$getLocalData("course_sort_by","alphabetical"),this.changeTitle(this.$t("Courses")),this.hasFeature("has_course")?this.fetchCourses():this.loading=!1},beforeUnmount(){this.$eventBus.off("topic_changed",this.watchTopicUrlChanged)}},nM={class:"object_menu"},lM={class:"fcom_space_menu_ul"},aM={key:0},rM={key:1},cM={key:0,class:"fcom_space_topics"},dM={class:"fcom_topics_filters"},uM={class:"search_member"},_M={class:"feed_filters"},mM={id:"feed_short_by",class:"fcom_feed_filter_label"},hM={class:"fcom_courses"},fM={key:0,class:"fcom_no_items_wrap"},pM={key:2},gM=["href"],yM={class:"fcom_box_card_list"},vM=["onClick"],bM=["src","onError"],kM={key:1,class:"fcom_no_image"},wM={class:"fcom_box_card_info"},CM={class:"fcom_box_card_name"},$M={class:"fcom_box_card_details"},SM={class:"inline_details"},VM={key:0,class:"inline_details"},MM={key:0,class:"fcom_box_card_description"},LM=["innerHTML"],TM={class:"fcom_box_card_action"},FM=["onClick"],PM=["onClick"];function IM(e,t,s,u,o,i){const m=O,f=Pe,h=p("Search"),g=j,k=ie,b=ae,S=re,w=De,$=p("router-link"),y=p("GroupIcon"),C=p("pagination"),L=p("layout"),V=p("app-layout"),I=se("loading");return n(),v(V,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a(L,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:c(()=>[l("div",nM,[l("ul",lM,[l("li",null,[l("a",{onClick:t[0]||(t[0]=q(F=>i.SwitchToCourseView("all"),["prevent"])),class:D(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Courses")),3)]),e.auth.user_id?(n(),r("li",aM,[l("a",{onClick:t[1]||(t[1]=q(F=>i.SwitchToCourseView("enrolled"),["prevent"])),class:D(o.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(n(),r("li",rM,[a(m,{onClick:t[2]||(t[2]=F=>i.emitCreateCourse()),class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:c(()=>[o.courseCategories&&o.courseCategories.length?(n(),r("div",cM,[a(f,null,{default:c(()=>[l("div",dM,[a(m,{onClick:t[3]||(t[3]=F=>i.setTopic("")),class:D({fcom_active_topic:!o.topic_slug})},{default:c(()=>[M(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),r(T,null,x(o.courseCategories,F=>(n(),v(m,{key:F.slug,onClick:R=>i.setTopic(F.slug),class:D({fcom_active_topic:F.slug==o.topic_slug})},{default:c(()=>[M(d(F.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",uM,[a(k,{clearable:"",onClear:i.toSearch,onKeydown:te(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=F=>o.search=F),placeholder:e.$t("Search Courses...")},{prefix:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",_M,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",mM,d(e.$t("Sort by:")),1),a(S,{"aria-label":e.$t("Sort Courses by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=F=>o.sort_by=F),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=F=>i.changeSortBy())},{default:c(()=>[a(b,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(b,{value:"latest",label:e.$t("Latest Courses")},null,8,["label"]),a(b,{value:"oldest",label:e.$t("Oldest Courses")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),Y((n(),r("div",hM,[!o.loading&&!o.courses.length?(n(),r("div",fM,[o.topic_slug?(n(),r(T,{key:0},[l("h3",null,d(e.$t("No courses found in this topic")),1),l("p",null,d(e.$t("No courses found based on your search criteria")),1)],64)):o.type=="all"?(n(),r(T,{key:1},[o.search?(n(),r(T,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.isAdmin()?(n(),r(T,{key:1},[l("h3",null,d(e.$t("Create your first course")),1),l("p",null,d(e.$t("Deliver engaging & high-performance learning experiences in your community.")),1),a(m,{onClick:t[7]||(t[7]=F=>i.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:c(()=>[M(d(e.$t("Create a Course")),1)]),_:1})],64)):(n(),r("div",pM,[l("h3",null,d(e.$t("No published courses found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some courses for you!")),1)]))],64)):(n(),r(T,{key:2},[o.search?(n(),r(T,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.auth.user_id?(n(),r(T,{key:2},[l("h3",null,d(e.$t("Your enrolled courses will be shown here")),1),l("p",null,d(e.$t("Once you enroll some courses, those will be shown here")),1),l("a",{onClick:t[8]||(t[8]=q(F=>i.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},d(e.$t("View all courses")),1)],64)):(n(),r(T,{key:1},[l("h3",null,d(e.$t("Login to see your courses")),1),l("p",null,d(e.$t("Once you login, your enrolled courses will be shown here.")),1),l("a",{href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login")),9,gM)],64))],64))])):_("",!0),l("div",yM,[(n(!0),r(T,null,x(o.courses,F=>(n(),r("div",{key:F.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:R=>e.$router.push({name:"view_course",params:{course_slug:F.slug}})},[F.cover_photo&&!F.coverError?(n(),r("img",{key:0,src:F.cover_photo,alt:"",onError:R=>F.coverError=!0},null,40,bM)):(n(),r("div",kM))],8,vM),l("div",wM,[l("div",CM,[a($,{class:"course_route",to:{name:"view_course",params:{course_slug:F.slug}}},{default:c(()=>[M(d(F.title)+" ",1),F.status=="draft"?(n(),v(w,{key:0,type:"info"},{default:c(()=>[M(d(F.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",$M,[l("div",SM,[l("span",null,d(e.$_n("%d Section","%d Sections",F.sectionsCount)),1),t[10]||(t[10]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,d(e.$_n("%d Lesson","%d Lessons",F.lessonsCount)),1)]),F.studentsCount?(n(),r("div",VM,[a(g,null,{default:c(()=>[a(y)]),_:1}),M(" "+d(e.$_n("%s student","%s students",e.$formatNumber(F.studentsCount))),1)])):_("",!0)]),F.description?(n(),r("div",MM,d(i.getExcerpt(F.description)),1)):_("",!0),F.custom_html?(n(),r("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:F.custom_html},null,8,LM)):_("",!0),l("div",TM,[F.isEnrolled?(n(),r("button",{key:0,class:D(["fcom_card_button",F.progress>=100?"fcom_card_button_success":"fcom_card_button_progress"]),onClick:R=>e.$router.push({name:"view_course",params:{course_slug:F.slug}})},d(e.$t("%s Completed",F.progress+"%")),11,FM)):(n(),r("button",{key:1,class:"fcom_card_button",onClick:R=>e.$router.push({name:"view_course",params:{course_slug:F.slug}})},d(e.$t("View Course")),9,PM))])])]))),128))]),a(C,{hide_on_single:!0,onFetch:i.fetchCourses,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[I,o.loading]])]),_:1},8,["title"])]),_:1})}const EM=P(iM,[["render",IM],["__scopeId","data-v-6ac627c3"]]),AM={name:"ViewCoursesRoute",components:{Layout:we,AppLayout:Se},props:["course_slug"],data(){return{course:{},sections:[],track:{},loading:!1,currentLessonIndex:null,currentLesson:null}},watch:{course_slug(){this.fetchCourse()}},computed:{allLessons(){let e=[];return Oe(this.sections,t=>{Oe(t.lessons,s=>{e.push(s)})}),e},lessonsCount(){return this.allLessons.length}},methods:{fetchCourse(){this.loading=!0,this.$get("courses/"+this.course_slug+"/by-slug",{intended_lesson_slug:this.$route.params.lesson_slug||null}).then(e=>{this.sections=e.sections,this.track=e.track,this.$route.params.lesson_slug&&this.goToLesson(this.$route.params.lesson_slug,!0),this.course=e.course,this.changeTitle(this.course.title)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleNextLesson(){let e=null;if(this.currentLessonIndex===null){if(Oe(this.allLessons,(t,s)=>{if(!this.track.completed_lessons.includes(t.id.toString()))return e=t,!1}),!e)if(this.allLessons.length)e=this.allLessons[0];else return this.$notify.error(this.$t("Sorry, no lesson found")),!1}else Oe(this.allLessons,(t,s)=>{if(s>this.currentLessonIndex)return e=t,!1});e&&this.goToLesson(e.slug)},setPrevLesson(){let e=this.currentLessonIndex-1;if(e<0||!this.allLessons[e])return this.$notify.error(this.$t("Sorry, no lesson found")),!1;let t=this.allLessons[e];t&&this.goToLesson(t.slug)},goToLesson(e,t=!1){let s=null,u=null;Oe(this.allLessons,(o,i)=>{if(o.slug==e)return s=o,u=i,!1}),s&&(this.loading=!0,this.currentLesson=null,this.currentLessonIndex=null,this.$nextTick(()=>{this.currentLessonIndex=u,this.currentLesson=s,this.currentLesson.lazy_load&&(this.currentLesson.content_loading=!0,this.fetchLesson(s.slug,o=>{o.slug==this.currentLesson.slug&&(this.currentLesson.can_view=o.can_view,this.currentLesson.is_locked=o.is_locked,this.currentLesson.lock_type=o.lock_type,this.currentLesson.access_message=o.access_message,this.currentLesson.meta=o.meta,this.currentLesson.content=o.content,this.currentLesson.content_loading=!1)})),this.changeTitle(this.currentLesson.title),this.$router.push({name:"view_lesson",params:{lesson_slug:s.slug},query:t?this.$route.query:{}}),this.loading=!1}))},fetchLesson(e,t=null){this.$get("courses/"+this.course.slug+"/lessons/"+e+"/by-slug").then(s=>{t&&t(s.lesson)}).catch(s=>{this.$handleError(s),t&&t({slug:e,content:"<p>"+this.$t("Sorry, the lesson content could not be loaded.")+"</p>"})})}},created(){this.fetchCourse()}},UM={key:0},BM={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},DM={key:1},RM={key:2,style:{padding:"1rem 2rem"}};function xM(e,t,s,u,o,i){const m=Qt,f=Xt,h=J,g=p("layout"),k=p("app-layout"),b=p("router-view");return o.loading?(n(),r("div",UM,[a(k,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a(g,{title:"...."},{title:c(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:c(()=>[a(m,{to:{name:"courses"}},{default:c(()=>[M(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:c(()=>[...t[1]||(t[1]=[M("....",-1)])]),_:1})]),_:1})]),default:c(()=>[l("div",BM,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):o.course.id?(n(),r("div",DM,[a(b,{track:o.track,course:o.course,sections:o.sections,lessonsCount:i.lessonsCount,currentLesson:o.currentLesson,currentLessonIndex:o.currentLessonIndex,onSetNextLesson:i.handleNextLesson,onSetPrevLesson:i.setPrevLesson,onGoToLesson:i.goToLesson,onReload:i.fetchCourse,onUpdateTrack:t[0]||(t[0]=S=>{o.track=S})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(n(),r("div",RM,[l("h3",null,d(e.$t("Sorry, the course could not be loaded.")),1)]))}const OM=P(AM,[["render",xM]]),HM={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},jM={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function NM(e,t,s,u,o,i){return n(),r("svg",jM,[...t[0]||(t[0]=[l("path",{d:"M10 13.7497V12.083",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),l("path",{d:"M3.55618 15.704C3.74358 17.0958 4.89645 18.1863 6.29939 18.2508C7.4799 18.305 8.67909 18.3333 9.99967 18.3333C11.3203 18.3333 12.5194 18.305 13.7 18.2508C15.1029 18.1863 16.2558 17.0958 16.4432 15.704C16.5655 14.7956 16.6663 13.8647 16.6663 12.9167C16.6663 11.9686 16.5655 11.0378 16.4432 10.1294C16.2558 8.73752 15.1029 7.64707 13.7 7.58258C12.5194 7.52831 11.3203 7.5 9.99967 7.5C8.67909 7.5 7.4799 7.52831 6.29939 7.58258C4.89645 7.64707 3.74358 8.73752 3.55618 10.1294C3.43388 11.0378 3.33301 11.9686 3.33301 12.9167C3.33301 13.8647 3.43388 14.7956 3.55618 15.704Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),l("path",{d:"M6.25 7.50033V5.41699C6.25 3.34592 7.92893 1.66699 10 1.66699C12.0711 1.66699 13.75 3.34592 13.75 5.41699V7.50033",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const zM=P(HM,[["render",NM]]),qM={name:"WelcomeBanner",components:{MediaPreview:xe},props:{config:{type:Object,default:null},closeKey:{type:String,default:""},wrapperClass:{type:String,default:""},contentClass:{type:String,default:""}},data(){return{dismissed:!1}},computed:{effectiveConfig(){return this.config!==null?this.config:this.appVars.welcome_banner},showMedia(){return this.effectiveConfig&&this.effectiveConfig.mediaType=="video"&&this.effectiveConfig.bannerVideo},showCtaButtons(){var e;return this.effectiveConfig&&((e=this.effectiveConfig.ctaButtons)==null?void 0:e.length)&&this.effectiveConfig.ctaButtons.some(t=>t.link&&t.label)},isRemovable(){return this.effectiveConfig&&this.effectiveConfig.allowClose=="yes"},effectiveCloseKey(){return this.closeKey?this.closeKey:this.appVars.user_id?"fcom_welcome_banner_closed_auth":"fcom_welcome_banner_closed_guest"},showBanner(){if(this.dismissed)return!1;if(!this.isRemovable)return!0;const e=this.Storage.get(this.effectiveCloseKey,!1);return e?new Date().getTime()>e:!0}},methods:{closeBanner(){const e=new Date().getTime()+6048e5;this.Storage.set(this.effectiveCloseKey,e),this.dismissed=!0}}},GM={key:0,class:"fcom_welcome_title"},YM=["innerHTML"],WM={key:2,class:"fcom_welcome_cta_buttons"},KM=["href","target"];function ZM(e,t,s,u,o,i){const m=p("media-preview"),f=Be,h=p("MoreFilled"),g=j,k=O,b=We,S=Ke,w=Ze;return i.effectiveConfig&&i.showBanner?(n(),r("div",{key:0,class:D(["fcom_welcome_box",s.wrapperClass])},[i.showMedia?(n(),v(m,{key:0,media_item:i.effectiveConfig.bannerVideo},null,8,["media_item"])):i.effectiveConfig.bannerImage?(n(),v(f,{key:1,class:"feed_media",alt:e.$t("Image Preview"),src:i.effectiveConfig.bannerImage},null,8,["alt","src"])):_("",!0),l("div",{class:D(s.contentClass)},[i.effectiveConfig.title?(n(),r("h2",GM,d(i.effectiveConfig.title),1)):_("",!0),i.effectiveConfig.description_rendered?(n(),r("div",{key:1,class:"fcom_welcome_sub",innerHTML:i.effectiveConfig.description_rendered},null,8,YM)):_("",!0),i.showCtaButtons?(n(),r("div",WM,[(n(!0),r(T,null,x(i.effectiveConfig.ctaButtons,$=>(n(),r(T,null,[$.link&&$.label?(n(),r("a",{key:0,href:$.link,target:$.newTab=="yes"?"_blank":"",class:D({"el-button fcom_primary_button":$.type=="primary","el-button fcom_secondary_button":$.type=="secondary","el-button is-text":$.type=="text","el-link fcom_link_button":$.type=="link"})},d($.label),11,KM)):_("",!0)],64))),256))])):_("",!0)],2),i.isRemovable?(n(),v(w,{key:2,trigger:"click",class:"fcom_welcome_close"},{dropdown:c(()=>[a(S,null,{default:c(()=>[a(b,{onClick:i.closeBanner},{default:c(()=>[M(d(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:c(()=>[a(k,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:c(()=>[a(g,null,{default:c(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)],2)):_("",!0)}const fs=P(qM,[["render",ZM]]),JM={name:"LockscreenView",components:{CustomLockscreenView:Fo,DefaultLockscreenPaywall:Po,WelcomeBanner:fs},props:["space_profile","sections"],emits:["join"],data(){return{isRedirecting:!1}},created(){var e,t,s,u;((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="redirect"&&((u=(s=this.space_profile)==null?void 0:s.settings)!=null&&u.onboard_redirect_url)&&(this.isRedirecting=!0,window.location.href=this.space_profile.settings.onboard_redirect_url)}},QM={key:0,style:{"text-align":"center",margin:"50px 0"}},XM={key:0,class:"space_default_lockscreen"},eL={class:"space_lock_box space_default_lock_box"},tL={key:0,class:"lock_desc"},sL={key:1,class:"lock_desc"},oL=["href"],iL={key:1,class:"space_lock_box"},nL={key:2,class:"space_lock_box"},lL=["href"];function aL(e,t,s,u,o,i){var b;const m=p("welcome-banner"),f=p("Lock"),h=j,g=p("default-lockscreen-paywall"),k=p("custom-lockscreen-view");return o.isRedirecting?(n(),r("h3",QM,d(e.$t("Please wait...")),1)):(n(),r(T,{key:1},[s.space_profile.lockscreen_config?(n(),r(T,{key:0},[s.space_profile.lockscreen_config.showCustom?(n(),v(k,{key:1,sections:s.sections,profile:s.space_profile},null,8,["sections","profile"])):(n(),r("div",XM,[s.space_profile.welcome_banner&&s.space_profile.lockscreen_config.showWelcomeBanner?(n(),v(m,{key:0,config:s.space_profile.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.space_profile.id+(s.space_profile.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",eL,[a(h,null,{default:c(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("This is a private course")),1),s.space_profile.lockscreen_config.showPaywalls?(n(),r("p",tL,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),r("p",sL,d(e.$t("Members have to be invited to this course.")),1)),e.auth.user_id?_("",!0):(n(),r("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,oL))]),s.space_profile.lockscreen_config.showPaywalls?(n(),v(g,{key:1,space_id:(b=s.space_profile)==null?void 0:b.id},null,8,["space_id"])):_("",!0)]))],64)):s.space_profile.permissions.is_pending?(n(),r("div",iL,[a(h,null,{default:c(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("Your request to join this course is pending")),1)])):e.auth.user_id?_("",!0):(n(),r("div",nL,[a(h,null,{default:c(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("Please login/signup to enroll this course")),1),l("a",{href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,lL)]))],64))}const rL=P(JM,[["render",aL]]),cL={name:"CollapseIcon"},dL={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function uL(e,t,s,u,o,i){return n(),r("svg",dL,[...t[0]||(t[0]=[l("path",{d:"M16 4V13H18.25L15.25 16.75L12.25 13H14.5V4H16ZM10 14.5V16H3.25V14.5H10ZM11.5 9.25V10.75H3.25V9.25H11.5ZM11.5 4V5.5H3.25V4H11.5Z",fill:"currentColor"},null,-1)])])}const _L=P(cL,[["render",uL]]),mL={name:"ViewCourse",components:{VideoPlay:Xs,RenderSpaceLinks:ms,LockScreenView:rL,AppLayout:Se,Layout:we,CircleIcon:hs,LockIcon:zM,SocialLinks:Pt,PlayIcon:Mo,LessonIcon:Vo,PlayPlaceholderIcon:Lo,CollapseIcon:_L,WelcomeBanner:fs,ActionPopover:et},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1,restarting:!1}},computed:{hasEnabledCourseLinks(){var t,s;return(((s=(t=this.course)==null?void 0:t.settings)==null?void 0:s.links)||[]).some(u=>u.enabled!=="no")},sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},isCustomLockScreen(){var e,t;return((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)==="yes"},showCourseSections(){return this.track.isEnrolled||this.course.is_course_admin||!this.course.lockscreen_config},isModernLayout(){var e,t;return this.has_pro&&((t=(e=this.course)==null?void 0:e.settings)==null?void 0:t.course_layout)==="modern"},lessonDuration(){return e=>{const t=e.lessons.reduce((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}},isCollapsed(){return this.sections.some(e=>e.is_closed)},showSidebar(){return!this.isMobile&&(this.track.isEnrolled||this.course.creator)}},methods:{toggleAllSections(){const e=this.isCollapsed;this.sections.forEach(t=>{t.is_closed=!e})},isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(!!(t!=null&&t.html)||(t==null?void 0:t.type)=="fluent_player")},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},isLockLesson(e,t){return!t.can_view&&!this.isFreePreview(t)},editLessonLink(){return this.$getRouteLink("admin/manage-courses/edit/:course_id/lessons",{course_id:this.course.id})},enroll(){this.enrolling=!0,this.$post("courses/"+this.course.id+"/enroll").then(e=>{this.$emit("reload"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.enrolling=!1})},continueCourse(){this.$emit("setNextLesson")},handleRestartCourse(e){!this.track.progress||this.restarting||(e(),this.restartCourse())},restartCourse(){this.$confirm(this.$t("This will reset your progress for this course to 0%. Continue?"),this.$t("Restart Course"),{confirmButtonText:this.$t("Yes, restart"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.restarting=!0,this.$del("courses/"+this.course.id+"/progress").then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.restarting=!1})}).catch(()=>{})},maybeGotoLesson(e,t,s){if(e.can_view){this.$emit("goToLesson",e.slug);return}if(!t.isEnrolled){this.$notify.info({message:this.$t("You need to enroll in this course to access this lesson"),type:"info"});return}if(s.is_locked){s.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",s.unlock_date),type:"info"});return}if(e.lock_type==="sequential"){this.$notify.info({message:this.$t("Complete the previous lesson to unlock this one."),type:"info"});return}this.$notify.info({message:this.$t("This lesson is locked."),type:"info"})},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}},mounted(){this.appVars.course_sections_collapsed=="yes"&&this.toggleAllSections()}},hL=["href"],fL={class:"fcom_course_actions"},pL=["href"];const gL={key:0,class:"fcom_sub_header"},yL={key:0,class:"fcom_notice"},vL={class:"fcom_feed_box course_box"},bL={class:"fcom_course_sections"},kL={class:"fcom_course_intro"},wL={class:"fcom_course_labels"},CL={class:"fcom_course_info"},$L=["innerHTML"],SL={class:"fcom_card_sections"},VL={class:"fcom_section_items"},ML=["onClick"],LL={class:"fcom_section_primary_item_title"},TL={class:"title_line_container"},FL={class:"title_line"},PL={key:0,class:"section_lock_badge"},IL={class:"fcom_meta_text"},EL={key:0,class:"fcom_meta_text"},AL={class:"fcom_section_primary_item_actions"},UL=["onClick"],BL={class:"fcom_heading_item clickable"},DL={class:"lesson_feature_media"},RL=["src","alt"],xL=["src","alt"],OL={class:"lesson_title"},HL=["innerHTML"],jL={class:"lesson_duration"},NL={key:0},zL={key:1},qL=["innerHTML"],GL={key:0,class:"fcom_section_item_actions"},YL={class:"fcom_meta_text"},WL={class:"fcom_main_side_wrap"},KL={class:"fcom_side_box"},ZL={key:0,class:"app_side_widget course_widget"},JL={class:"widget_header"},QL={class:"widget_body"},XL={class:"progress_label"},eT={key:0,style:{margin:"20px 0"}},tT={key:1,class:"app_side_widget course_widget"},sT={class:"widget_header"},oT={class:"widget_body"},iT={class:"creator_details"},nT={class:"creator_details_item"},lT={class:"creator_details_info"},aT={class:"info_text"},rT={class:"details_name"},cT={class:"details_meta"},dT={class:"fcom_meta_text"},uT={key:0,class:"fcom_meta_text"},_T=["innerHTML"],mT={key:2};function hT(e,t,s,u,o,i){const m=Qt,f=Xt,h=O,g=p("action-popover"),k=p("render-space-links"),b=p("welcome-banner"),S=p("CollapseIcon"),w=p("Lock"),$=j,y=p("ArrowRight"),C=p("ArrowDown"),L=p("SuccessFilled"),V=p("LockIcon"),I=p("CircleIcon"),F=p("PlayPlaceholderIcon"),R=p("LessonIcon"),B=p("PlayIcon"),U=p("VideoPlay"),A=ut,N=Kt,H=p("UserAvatar"),z=p("UserRouteLink"),G=p("SocialLinks"),ne=_t,E=mt,Q=p("LockScreenView"),de=p("layout"),X=p("app-layout"),Ve=se("loading");return n(),v(X,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:c(()=>[a(de,{wrapper_class:["no_bg_layout",{custom_lockscreen:!i.showCourseSections}],title:e.$t("Courses")},{title:c(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:c(()=>[a(m,{to:{name:"courses"}},{default:c(()=>[M(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:c(()=>[M(d(s.course.title)+" ",1),s.course.is_course_admin?(n(),r("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:i.editLessonLink()},d(e.$t("Edit Lessons")),9,hL)):_("",!0)]),_:1})]),_:1})]),actions:c(()=>[l("div",fL,[e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),v(h,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):s.track.isEnrolled?(n(),r(T,{key:2},[s.track.progress!=100?(n(),v(h,{key:0,class:"fcom_primary_button",onClick:i.continueCourse},{default:c(()=>[M(d(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0),_("",!0)],64)):_("",!0):(n(),r(T,{key:0},[i.isCustomLockScreen?_("",!0):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,pL))],64))])]),sub_header:c(()=>[s.course&&i.showCourseSections&&i.hasEnabledCourseLinks?(n(),r("div",gL,[a(k,{links:s.course.settings.links},null,8,["links"])])):_("",!0)]),default:c(()=>[s.course.status==="draft"?(n(),r("div",yL,[l("p",null,d(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),i.showCourseSections?(n(),v(E,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:c(()=>[a(A,{class:"fcom_main"},{default:c(()=>{var ee;return[s.course.welcome_banner?(n(),v(b,{key:0,config:s.course.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.course.id+(s.course.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",vL,[l("div",bL,[l("div",kL,[l("div",wL,[l("h3",null,d(s.course.title),1),l("p",CL,[M(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),M(" "+d(e.$_n("%s Lesson","%s Lessons",s.lessonsCount)),1)])])]),(ee=s.course.settings)!=null&&ee.course_details_rendered?(n(),r("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:s.course.settings.course_details_rendered},null,8,$L)):_("",!0),l("div",{class:D(["course_contents_header",{is_collapsed:i.isCollapsed}])},[l("h4",null,d(e.$t("Course Contents")),1),i.sectionsCount>1?(n(),v(S,{key:0,class:"collapse_icon clickable",onClick:i.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",SL,[l("div",VL,[(n(!0),r(T,null,x(s.sections,Z=>(n(),r("div",{key:Z.id,class:"fcom_section_primary"},[l("div",{onClick:oe=>Z.is_closed=!Z.is_closed,class:D(["clickable fcom_section_primary_item",{is_closed:Z.is_closed}])},[l("div",LL,[l("div",TL,[l("div",FL,[l("h4",null,d(Z.title),1),Z.unlock_date?(n(),r("span",PL,[Z.is_locked?(n(),v($,{key:0},{default:c(()=>[a(w)]),_:1})):_("",!0),l("span",null," ("+d(e.$t("will unlock at %s",e.smartDate(Z.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",IL,d(e.$_n("%s lesson","%s lessons",Z.lessons.length)),1),i.lessonDuration(Z)?(n(),r("span",EL," • "+d(i.lessonDuration(Z)),1)):_("",!0)])]),l("div",AL,[a($,null,{default:c(()=>[Z.is_closed?(n(),v(y,{key:0,class:"fcom_arrow_icon"})):(n(),v(C,{key:1}))]),_:2},1024)])],10,ML),Z.is_closed?_("",!0):(n(!0),r(T,{key:0},x(Z.lessons,oe=>(n(),r("div",{key:oe.id,class:D(["fcom_section_item",{is_locked:i.isLockLesson(Z,oe)}])},[l("div",{onClick:gt=>i.maybeGotoLesson(oe,s.track,Z),class:"fcom_section_item_title"},[l("p",BL,[s.track.completed_lessons.includes(oe.id.toString())?(n(),v($,{key:0,style:{color:"#008a2e"}},{default:c(()=>[a(L)]),_:1})):i.isLockLesson(Z,oe)?(n(),v($,{key:1},{default:c(()=>[a(V)]),_:1})):(n(),v($,{key:2},{default:c(()=>[a(I)]),_:1})),i.isModernLayout?(n(),r(T,{key:3},[l("span",DL,[oe.featured_image?(n(),r("img",{key:0,src:oe.featured_image,alt:oe.title},null,8,RL)):i.hasMediaImage(oe)?(n(),r("img",{key:1,src:oe.meta.media.image,alt:oe.title},null,8,xL)):i.hasMediaVideo(oe)?(n(),v(F,{key:2})):(n(),v(R,{key:3})),i.showPlayIcon(oe)?(n(),v(B,{key:4,class:"play_icon"})):_("",!0)]),l("span",OL,[l("span",{innerHTML:oe.title},null,8,HL),l("span",jL,[oe.meta.video_length?(n(),r("span",NL,d(i.formatSeconds(oe.meta.video_length)),1)):(n(),r("span",zL,d("---")))])])],64)):(n(),r("span",{key:4,innerHTML:oe.title},null,8,qL))])],8,UL),!i.isModernLayout&&oe.meta.enable_media=="yes"&&oe.meta.video_length?(n(),r("div",GL,[l("span",YL,[oe.meta.video_length?(n(),v(h,{key:0,onClick:gt=>i.maybeGotoLesson(oe,s.track,Z),text:""},{default:c(()=>[a($,{class:"fcom_play_btn_icon"},{default:c(()=>[a(U)]),_:1}),l("span",null,d(i.formatSeconds(oe.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),i.showSidebar?(n(),v(ne,{key:0,class:"fcom_resp_side",width:"306px"},{default:c(()=>[l("div",WL,[l("div",KL,[s.track.isEnrolled?(n(),r("div",ZL,[l("div",JL,[l("h3",null,d(e.$t("Course progress")),1)]),l("div",QL,[l("div",XL,[l("p",null,d(e.$t("Completed %1$s of %2$s",s.track.completed_lessons.length,s.lessonsCount)),1),l("span",null,d(parseInt(s.track.progress))+"%",1)]),a(N,{class:"fcom_progress","stroke-width":10,percentage:parseInt(s.track.progress),"show-text":!1},null,8,["percentage"]),s.track.progress==100?(n(),r("div",eT,[l("h5",null,d(e.$t("Congratulations! Course completed! 🎉")),1)])):_("",!0)])])):_("",!0),s.course.creator?(n(),r("div",tT,[l("div",sT,[l("h3",null,d(e.$t("Course Instructor")),1)]),l("div",oT,[l("div",iT,[l("div",nT,[l("div",lT,[a(H,{with_level:!1,xprofile:s.course.creator},null,8,["xprofile"]),l("div",aT,[l("div",rT,[a(z,{show_badge:!0,xprofile:s.course.creator},null,8,["xprofile"])]),l("div",cT,[l("span",dT,d(e.$_n("%d Course","%d Courses",s.course.creator.total_courses)),1),s.course.creator.total_students?(n(),r("span",uT," • "+d(e.$_n("%d Student","%d Students",s.course.creator.total_students)),1)):_("",!0)])])]),s.course.creator.short_description_rendered?(n(),r("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:s.course.creator.short_description_rendered},null,8,_T)):_("",!0)]),a(G,{xprofile:s.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),i.showCourseSections?_("",!0):(n(),r("div",mT,[a(Q,{space_profile:s.course,sections:s.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const fT=P(mL,[["render",hT]]),pT={name:"CommentBox",mixins:[Ft],components:{FeedComments:fo,FeedTextComposer:ht},props:{feed:{type:Object,required:!0},showAll:{type:Boolean,default:!0},checkPermission:{type:Boolean,default:!0},is_single:{type:Boolean,default:!0},show_comment_form:{type:Boolean,default:!0}},data(){return{show_all_comments:this.showAll,commenting:!1,comment:{message:"",media_images:[]},saving:!1,showCommentBox:!0,sortBy:"oldest"}},methods:{postComment(){var t,s,u;const e=((t=this.comment.media_images)==null?void 0:t.length)>0||((u=(s=this.comment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.comment.message&&!e||(this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(o=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.unshift(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.commenting=!1,this.comment=null,this.showCommentBox=!1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id),this.comment={message:"",media_image:""}}),this.showCommentBox=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1}))},showCommentForm(){this.show_all_comments=!0,this.commenting=!0,this.$nextTick(()=>{this.$refs.commentInput&&this.$refs.commentInput.focus()})},showAllComments(){this.show_all_comments=!0,this.commenting=!0},getSpaceId(){var e,t;return((e=this.feed)==null?void 0:e.course_id)||((t=this.feed)==null?void 0:t.space_id)},changeCommentsSortBy(){this.$storeLocalData("comments_sort_by",this.sortBy)}},mounted(){let e=this.feed.default_comment_sort_by||"oldest";this.sortBy=this.$getLocalData("comments_sort_by",e)}},gT=["id"],yT={key:0,class:"feed_commenting"},vT={class:"person_avatar"},bT=["src"],kT={key:0,class:"feed_comment_input"},wT={key:1,class:""},CT={style:{padding:"0",margin:"0","text-align":"center"}},$T={key:0,class:"fcom_comment_sorting"};function ST(e,t,s,u,o,i){const m=O,f=p("feed-text-composer"),h=p("router-link"),g=ae,k=re,b=p("feed-comments");return n(),r("div",{class:D(["fcom_comment_box","fcom_comment_box_"+s.feed.type])},[K(e.$slots,"before_comment_box"),(o.commenting||s.is_single)&&s.show_comment_form?(n(),r("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment"},[!s.checkPermission||e.hasCommentPermission(s.feed)?(n(),r(T,{key:0},[o.comment?(n(),r("div",yT,[l("div",vT,[l("img",{alt:"",src:e.auth.avatar},null,8,bT)]),o.showCommentBox?(n(),r("div",kT,[a(f,{context:"comment",mentionQuery:{space_id:i.getSpaceId()},autofocus_changed:o.commenting,autofocus:o.commenting,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:c(()=>[a(m,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=S=>i.postComment())},{default:c(()=>[M(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(n(),r("div",wT,[l("p",CT,[M(d(e.$t("Please join the Space to post a comment."))+" ",1),s.feed.space?(n(),v(h,{key:0,to:{name:"space_feeds",params:{space:s.feed.space.slug}}},{default:c(()=>[M(d(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,gT)):_("",!0),a(b,{sortBy:o.sortBy,checkPermission:s.checkPermission,onForceShowAll:i.showAllComments,show_all:o.show_all_comments,feed:s.feed},{before_comments_start:c(()=>[s.feed.comments_count>=2?(n(),r("div",$T,[a(k,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=S=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[2]||(t[2]=S=>o.sortBy=S),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:c(()=>[a(g,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(g,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(g,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(g,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])])):_("",!0)]),_:1},8,["sortBy","checkPermission","onForceShowAll","show_all","feed"]),K(e.$slots,"after_comment_box")],2)}const VT=P(pT,[["render",ST]]),MT={name:"ExitFullScreen"},LT={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"};function TT(e,t,s,u,o,i){return n(),r("svg",LT,[...t[0]||(t[0]=[l("path",{d:"M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5zm5 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 10 4.5v-4a.5.5 0 0 1 .5-.5zM0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5zm10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4z"},null,-1)])])}const FT=P(MT,[["render",TT]]),PT={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:Js},data(){return{userResult:{},answers:this.initAnswers(),isNew:!1,submitting:!1,loading:!1}},computed:{alreadyAttempted(){var e;return(e=this.userResult)==null?void 0:e.id},isAllAnswersSelected(){return this.questions.every(e=>this.isSingleChoice(e)?this.answers[e.slug]!==null:this.isWrittenAnswer(e)?this.answers[e.slug]&&this.answers[e.slug].trim()!=="":this.answers[e.slug]&&this.answers[e.slug].length>0)},quizSettings(){return this.lesson.meta},showResult(){var e;return this.quizSettings.hide_result=="no"&&((e=this.userResult)==null?void 0:e.id)},isPassed(){var e;return((e=this.userResult)==null?void 0:e.status)==="passed"}},methods:{initAnswers(){return this.questions.reduce((e,t)=>(t.type=="single_choice"?e[t.slug]=null:t.type=="written_answer"?e[t.slug]="":e[t.slug]=[],e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&Qi.each(e,(s,u)=>{this.answers[u]=s.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0},showQuestion(e){var s;if(!this.alreadyAttempted)return!0;const t=((s=this.userResult)==null?void 0:s.message)||[];return!!(this.isNew||t[e.slug])},isSingleChoice(e){return e.type=="single_choice"},isMultipleChoice(e){return e.type=="multiple_choice"},isWrittenAnswer(e){return e.type=="written_answer"},isExactMatchQuestion(e){return e.grading_mode==="exact_match"},freeTextBadgeClass(e){return this.isExactMatchQuestion(e)?this.isQuestionCorrect(e)?"correct":"incorrect":"correct"},showQuestionImage(e){return e.image_enabled&&e.image_url},isQuestionCorrect(e){var t,s,u;return(u=(s=(t=this.userResult)==null?void 0:t.message)==null?void 0:s[e.slug])==null?void 0:u.is_correct},isOptionSelected(e,t){return this.isSingleChoice(e)?this.answers[e.slug]===t.label:(this.answers[e.slug]||[]).includes(t.label)},handleOptionChange(e,t){if(this.isSingleChoice(e)&&(this.answers[e.slug]===t.label?this.answers[e.slug]=null:this.answers[e.slug]=t.label),this.isMultipleChoice(e)){const s=this.answers[e.slug]||[];s.indexOf(t.label)>-1?this.answers[e.slug]=s.filter(o=>o!==t.label):this.answers[e.slug]=[...s,t.label]}},fetchAnswers(){this.loading=!0,this.$get("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/result").then(e=>{this.userResult=e.result||{},this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},submitQuiz(){this.has_pro&&(this.submitting=!0,this.$post("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/submit",{course_id:this.lesson.course_id,lesson_id:this.lesson.id,answers:this.answers}).then(e=>{this.$notify.success(e.message),this.userResult=e.result,this.isNew=!1,this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.submitting=!1}))}},mounted(){this.isEnrolled&&this.has_pro&&this.fetchAnswers()}},IT={key:0,class:"fcom_questions_wrap"},ET={key:0,class:"fcom_quiz_result"},AT={class:"result_status"},UT={key:0,class:"result_status_text"},BT={key:0},DT={key:1},RT={class:"result_score"},xT={class:"score_part"},OT={class:"part_label"},HT={class:"part_value"},jT={class:"score_part"},NT={class:"part_label"},zT={class:"part_value"},qT={key:0,class:"fcom_question_image"},GT={class:"fcom_question_header"},YT=["innerHTML"],WT={class:"fcom_question_body"},KT={key:0,class:"correct_text"},ZT={key:1,class:"correct_text"},JT={class:"fcom_written_answer_answer"},QT={key:1,class:"fcom_user_answer_text"},XT={key:0,class:"correct_text"},eF={key:1,class:"correct_text"},tF={class:"fcom_question_options"},sF={key:2,class:"question_help_text"},oF={key:2,class:"fcom_quiz_footer"},iF={key:0},nF={key:1},lF={key:0};function aF(e,t,s,u,o,i){var $,y;const m=O,f=Be,h=p("Check"),g=j,k=p("Close"),b=ie,S=ve,w=J;return n(),r(T,null,[o.loading?(n(),v(w,{key:1,rows:5,animated:""})):(n(),r("div",IT,[i.alreadyAttempted?(n(),r("div",ET,[l("div",AT,[["passed","failed"].includes(o.userResult.status)?(n(),r("div",UT,[l("p",null,[i.isPassed?(n(),r("span",BT,"🎉 ")):(n(),r("span",DT,"😞 ")),l("span",null,d(e.$t("You")),1),l("span",{style:me({color:i.isPassed?"green":"red"})},d(i.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,d(e.$t("the quiz.")),1)]),l("p",null,d(i.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(n(),r(T,{key:1},[l("p",null,d(e.$t("We have saved your quiz results.")),1),l("p",null,d(e.$t("Please await the grading.")),1)],64)),a(m,{class:"fcom_secondary_button",onClick:i.retakeQuiz},{default:c(()=>[M(d(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",RT,[l("div",xT,[l("span",OT,d(e.$t("Score")),1),l("span",HT,d(o.userResult.score)+"%",1)]),l("div",jT,[l("span",NT,d(e.$t("Correct Answers")),1),l("span",zT,d((($=o.userResult.meta)==null?void 0:$.correct_answers)+" / "+((y=o.userResult.meta)==null?void 0:y.total_questions)),1)])])])):_("",!0),(n(!0),r(T,null,x(s.questions,C=>(n(),r(T,{key:C.slug},[i.showQuestion(C)?(n(),r("div",{key:0,class:D(["fcom_question",C.type])},[i.showQuestionImage(C)?(n(),r("div",qT,[a(f,{src:C.image_url},null,8,["src"])])):_("",!0),l("div",GT,[l("div",{innerHTML:C.label_rendered,class:"fcom_question_label"},null,8,YT)]),l("div",WT,[i.isWrittenAnswer(C)?(n(),r(T,{key:0},[i.showResult?(n(),r("div",{key:0,class:D(["fcom_is_correct",i.freeTextBadgeClass(C)])},[i.isExactMatchQuestion(C)?(n(),r("p",KT,[i.isQuestionCorrect(C)?(n(),r(T,{key:0},[a(g,null,{default:c(()=>[a(h)]),_:1}),M(" "+d(e.$t("Correct")),1)],64)):(n(),r(T,{key:1},[a(g,null,{default:c(()=>[a(k)]),_:1}),M(" "+d(e.$t("Incorrect")),1)],64))])):(n(),r("p",ZT,[a(g,null,{default:c(()=>[a(h)]),_:1}),M(" "+d(e.$t("Answered")),1)]))],2)):_("",!0),l("div",JT,[!i.alreadyAttempted||o.isNew?(n(),r(T,{key:0},[i.isExactMatchQuestion(C)?(n(),v(b,{key:0,type:"text",modelValue:o.answers[C.slug],"onUpdate:modelValue":L=>o.answers[C.slug]=L,placeholder:e.$t("Type your answer"),maxlength:500},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(n(),v(b,{key:1,type:"textarea",rows:4,modelValue:o.answers[C.slug],"onUpdate:modelValue":L=>o.answers[C.slug]=L,placeholder:e.$t("Write your answer here..."),maxlength:1e4,"show-word-limit":""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))],64)):(n(),r("div",QT,d(o.answers[C.slug]),1))])],64)):(n(),r(T,{key:1},[i.showResult?(n(),r("div",{key:0,class:D(["fcom_is_correct",i.isQuestionCorrect(C)?"correct":"incorrect"])},[i.isQuestionCorrect(C)?(n(),r("p",XT,[a(g,null,{default:c(()=>[a(h)]),_:1}),M(" "+d(e.$t("Correct")),1)])):(n(),r("p",eF,[a(g,null,{default:c(()=>[a(k)]),_:1}),M(" "+d(e.$t("Incorrect")),1)]))],2)):_("",!0),l("div",tF,[(n(!0),r(T,null,x(C.options,L=>(n(),r("div",{key:L.label,class:"fcom_question_option"},[a(S,{class:D({single_choice:i.isSingleChoice(C)}),"model-value":i.isOptionSelected(C,L),onChange:V=>i.handleOptionChange(C,L)},{default:c(()=>[M(d(L.label),1)]),_:2},1032,["class","model-value","onChange"])]))),128))])],64)),C.help_text?(n(),r("div",sF,d(C.help_text),1)):_("",!0)])],2)):_("",!0)],64))),128))])),!o.loading&&!i.alreadyAttempted?(n(),r("div",oF,[s.isEnrolled?(n(),r("p",nF,d(e.$t("Answer all questions to submit")),1)):(n(),r("p",iF,d(e.$t("You need to enroll in this course to take this quiz.")),1)),a(m,{class:"fcom_primary_button",onClick:i.submitQuiz,loading:o.submitting,disabled:o.submitting||!s.isEnrolled||!i.isAllAnswersSelected},{default:c(()=>[M(d(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(n(),r("span",lF," ("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"])])):_("",!0)],64)}const rF=P(PT,[["render",aF]]),cF={name:"ViewLesson",components:{PaperClipIcon:co,DocumentLists:tt,CircleIcon:hs,AppLayout:Se,Layout:we,MediaPreview:xe,CommentBox:VT,ChatIcon:Qe,ExitFullScreen:FT,QuizView:rF},props:["course","sections","track","currentLesson","lessonsCount","lesson_slug","currentLessonIndex"],emits:["setNextLesson","setPrevLesson","goToLesson","reload"],data(){return{completing:!1,isFullScreen:!1,sm_side_show:!1,isTransiting:!1,enrolling:!1,lightboxImages:[],lightboxIndex:0,_lightboxHandler:null}},watch:{currentLessonIndex(){this.sm_side_show=!1},lesson_slug(){this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this.currentLesson.slug&&this.currentLesson.slug!=this.lesson_slug&&this.gotoLesson({slug:this.lesson_slug})},"currentLesson.content":{handler(e){e&&this.$nextTick(()=>{var t;e.includes("<media-player")&&e.includes("fluent-player")&&document.dispatchEvent(new CustomEvent("FComMediaReady",{detail:{media:((t=this.currentLesson.meta)==null?void 0:t.media)||{},feed:this.currentLesson}})),this.setupLightboxImages()})},immediate:!0}},computed:{isCompleted(){return this.track.completed_lessons.includes(this.currentLesson.id.toString())},isQuizContent(){return this.currentLesson.content_type=="quiz"},commentsEnabled(){return this.course.settings.disable_comments!="yes"&&this.currentLesson.can_view&&this.currentLesson.meta.enable_comments==="yes"},containerHeight(){if(!this.isFullScreen){const e=document.querySelector(".fcom_mobile_menu");return`calc(100dvh - (var(--fcom-header-height, 0px) + ${e?e.offsetHeight:0}px))`}return"100dvh !important"},hasDocuments(){return this.currentLesson.meta.document_lists&&this.currentLesson.meta.document_lists.length>0},showMediaPreview(){var e,t,s,u,o,i;return((s=(t=(e=this.currentLesson)==null?void 0:e.meta)==null?void 0:t.media)==null?void 0:s.url)||((i=(o=(u=this.currentLesson)==null?void 0:u.meta)==null?void 0:o.media)==null?void 0:i.html)},isVideoGated(){var e,t;return!!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.is_video_gated)},isVideoGateLocked(){var e,t;return this.isCompleted||this.course.is_course_admin?!1:this.isVideoGated&&!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.video_watched)}},methods:{markAsComplete(){if(this.isVideoGateLocked||this.completing)return;this.completing=!0;let e=this.isCompleted?"incomplete":"completed";this.$put("courses/"+this.course.id+"/lessons/"+this.currentLesson.id+"/completion",{state:e}).then(t=>{this.track.completed_lessons=t.track.completed_lessons,this.$emit("updateTrack",t.track),e=="completed"?this.$emit("setNextLesson"):this.isVideoGated&&(this.currentLesson.meta.video_watched=!1,document.dispatchEvent(new CustomEvent("FComLessonVideoUnwatched",{detail:{lessonId:this.currentLesson.id}})))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.completing=!1})},toggleFullScreen(){this.isFullScreen=!this.isFullScreen,this.$storeLocalData("lesson_fs",this.isFullScreen?"yes":"no")},onFullScreenKeydown(e){e.key==="Escape"&&this.isFullScreen&&this.toggleFullScreen()},scrollToComments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_comments.offsetTop-100})},enroll(){this.enrolling=!0,this.$post("courses/"+this.course.id+"/enroll").then(e=>{this.$emit("reload"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.enrolling=!1})},scrollToDocuments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_documents.offsetTop-100})},gotoLesson(e){this.$emit("goToLesson",e.slug)},setupLightboxImages(){const e=this.$refs.lessonContent;if(!e)return;const t=e.querySelectorAll(".wp-lightbox-container img");if(!t.length)return;const s=Array.from(t).map(u=>u.src).filter(Boolean);s.length&&(this._lightboxHandler&&e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=u=>{const o=u.target.closest("img");u.target.closest(".wp-lightbox-container")&&o&&(u.preventDefault(),u.stopPropagation(),this.lightboxImages=s,this.lightboxIndex=Math.max(0,s.indexOf(o.src)))},e.addEventListener("click",this._lightboxHandler))},setSidebarScroll(){let e=document.getElementById("fcom_lesson_title_"+this.currentLesson.id),t=this.$refs.lesson_index_sidebar.wrapRef;const s=e.getBoundingClientRect(),u=t.getBoundingClientRect();s.top>=u.top&&s.bottom<=u.bottom&&s.left>=u.left&&s.right<=u.right||e.scrollIntoView({behavior:"instant",block:"center"})}},mounted(){this.isFullScreen=this.$getLocalData("lesson_fs",this.appVars.course_lesson_fullscreen)=="yes",window.scrollTo(0,0),this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(0),this.$route.query.comment_id&&setTimeout(()=>{let t=document.getElementById("comment_"+this.$route.query.comment_id);t&&(this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(t.offsetTop),t.classList.add("fcom_highlight_comment"))},500),document.body.classList.add("fcom-no-scroll"),document.addEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler=t=>{var s,u,o;((s=t.detail)==null?void 0:s.lessonId)==((u=this.currentLesson)==null?void 0:u.id)&&((o=this.currentLesson)!=null&&o.meta)&&(this.currentLesson.meta.video_watched=!0)},document.addEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler=t=>{var o,i,m,f,h;const s=(o=t.detail)==null?void 0:o.lessonId;if(s!=((i=this.currentLesson)==null?void 0:i.id)||!((f=(m=this.currentLesson)==null?void 0:m.meta)!=null&&f.video_auto_complete)||!this.track.isEnrolled||this.isCompleted||this._autoCompleteTimer)return;const u=parseInt((h=window.fcomLessonVideoGate)==null?void 0:h.auto_complete_delay);this._autoCompleteTimer=setTimeout(()=>{var g;this._autoCompleteTimer=null,((g=this.currentLesson)==null?void 0:g.id)==s&&!this.isCompleted&&this.markAsComplete()},(isNaN(u)?3:u)*1e3)},document.addEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this.setSidebarScroll();const e=document.getElementById("fcom_lesson_inline_css");if(e&&e.remove(),this.currentLesson.inline_css){const t=document.createElement("style");t.type="text/css",t.id="fcom_lesson_inline_css",t.appendChild(document.createTextNode(this.currentLesson.inline_css)),document.head.appendChild(t)}},beforeUnmount(){document.body.classList.remove("fcom-no-scroll"),document.removeEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler&&document.removeEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler&&document.removeEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this._lightboxHandler&&this.$refs.lessonContent&&this.$refs.lessonContent.removeEventListener("click",this._lightboxHandler)}},dF={key:0},uF={class:"fcom_back_space"},_F={class:"fcom_lesson_details",style:{padding:"2rem"}},mF={class:"fcom_back_space"},hF={class:"fcom_lesson_name"},fF={class:"fcom_lesson_nav"},pF={key:1},gF=["href"],yF={class:"fcom_lesson_details"},vF={class:"fcom_lesson_header"},bF={class:"fcom_lesson_title"},kF={class:"fcom_lesson_number"},wF=["href"],CF=["innerHTML"],$F={class:"fcom_lesson_nav"},SF=["innerHTML"],VF={class:"fcom_lesson_body feed_texts"},MF={key:0,class:"fcom_lesson_content"},LF=["innerHTML"],TF={key:0,class:"fcom_lesson_quiz"},FF={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},PF={class:"fcom_lesson_documents_header"},IF={key:0,class:"fcom_lesson_documents_list"},EF={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},AF={class:"fcom_lesson_comment_box"},UF={key:0,style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},BF={style:{padding:"0",margin:"0 0 20px"}},DF=["href"],RF={class:"fcom_section_sidebar_title"},xF={class:"fcom_section_items"},OF={class:"fcom_section_primary_item"},HF={class:"fcom_section_primary_item_title"},jF=["id","onClick"],NF={class:"fcom_heading_item clickable"},zF=["innerHTML"],qF={key:0,class:"fcom_section_footer course_progress_footer_wrap"},GF={class:"fcom_course_progress_footer"};function YF(e,t,s,u,o,i){const m=J,f=p("ArrowLeft"),h=j,g=p("FullScreen"),k=p("ExitFullScreen"),b=O,S=p("ChatIcon"),w=p("PaperClipIcon"),$=p("Lock"),y=p("ArrowRight"),C=Ie,L=p("Operation"),V=p("media-preview"),I=p("QuizView"),F=p("DocumentLists"),R=p("CommentBox"),B=Pe,U=ut,A=p("Close"),N=p("ArrowDown"),H=p("SuccessFilled"),z=p("CircleIcon"),G=Kt,ne=_t,E=Is,Q=mt,de=p("layout"),X=p("app-layout"),Ve=se("loading");return n(),v(X,{class:D({fcom_full_screen:o.isFullScreen,fcom_show_right_aside:o.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:c(()=>[s.course&&s.currentLesson?(n(),v(de,{key:0,wrapper_class:"no_bg_layout"},{default:c(()=>[a(Q,{class:"fcom_lesson_container fcom_resp_container"},{default:c(()=>[a(U,{style:me({height:i.containerHeight}),class:"fcom_lesson_wrap"},{default:c(()=>[o.isTransiting?(n(),r("div",dF,[Y((n(),r("div",uF,[...t[7]||(t[7]=[M(" ...... ",-1)])])),[[Ve,!0]]),l("div",_F,[a(m,{rows:10,animated:!0})])])):(n(),v(B,{key:1,ref:"lesson_scroller"},{default:c(()=>{var ee;return[l("div",mF,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=Z=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:c(()=>[a(f)]),_:1}),l("span",hF,d(s.course.title),1)]),l("div",fF,[a(b,{title:o.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:i.toggleFullScreen,size:"small",text:""},{default:c(()=>[a(h,null,{default:c(()=>[o.isFullScreen?(n(),v(k,{key:1})):(n(),v(g,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),s.currentLesson.can_view?(n(),r(T,{key:0},[i.commentsEnabled?(n(),v(b,{key:0,"aria-label":e.$t("Comments"),onClick:i.scrollToComments,bg:"",size:"small",text:""},{default:c(()=>[a(h,null,{default:c(()=>[a(S)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),i.hasDocuments?(n(),v(b,{key:1,"aria-label":e.$t("Documents"),onClick:i.scrollToDocuments,bg:"",size:"small",text:""},{default:c(()=>[a(h,null,{default:c(()=>[a(w)]),_:1})]),_:1},8,["aria-label","onClick"])):_("",!0),s.track.isEnrolled?(n(),v(C,{key:2,disabled:!i.isVideoGateLocked,content:e.$t("Watch the video to complete this lesson"),trigger:["hover","focus"],placement:"bottom"},{default:c(()=>[a(b,{class:D([i.isCompleted||i.isVideoGateLocked?"":"fcom_primary_button",{"is-disabled":i.isVideoGateLocked}]),"aria-disabled":i.isVideoGateLocked?"true":void 0,"aria-label":i.isVideoGateLocked?e.$t("Watch the video to complete this lesson"):void 0,loading:o.completing,style:{"margin-left":"15px"},type:"info",onClick:i.markAsComplete,size:"small"},{default:c(()=>[i.isCompleted?(n(),r("span",pF,d(e.$t("Completed")),1)):(n(),r(T,{key:0},[i.isVideoGateLocked?(n(),v(h,{key:0},{default:c(()=>[a($)]),_:1})):_("",!0),l("span",null,d(e.$t("Complete Lesson")),1),i.isVideoGateLocked?_("",!0):(n(),v(h,{key:1,class:"fcom_arrow_icon"},{default:c(()=>[a(y)]),_:1}))],64))]),_:1},8,["class","aria-disabled","aria-label","loading","onClick"])]),_:1},8,["disabled","content"])):e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),v(b,{key:4,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),r("a",{key:3,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,gF))],64)):_("",!0),s.sections&&s.sections.length?(n(),v(b,{key:1,style:{"margin-left":"15px"},size:"small",text:"",class:"fcom_toc_control","aria-label":e.$t("Toggle lessons"),onClick:t[1]||(t[1]=Z=>o.sm_side_show=!o.sm_side_show)},{default:c(()=>[a(h,null,{default:c(()=>[a(L)]),_:1})]),_:1},8,["aria-label"])):_("",!0)])]),l("div",yF,[l("div",vF,[l("div",bF,[l("p",kF,[M(d(e.$t("Lesson %1$s of %2$s",s.currentLessonIndex+1,s.lessonsCount))+" ",1),e.isAdmin()?(n(),r("a",{key:0,target:"_blank",rel:"noopener",style:{"margin-left":"8px"},class:"el-button el-button--small",href:e.$getRouteLink("admin/manage-courses/edit/:course_id/lessons?lesson_id=:lesson_id",{course_id:s.course.id,lesson_id:s.currentLesson.id})},d(i.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,wF)):_("",!0)]),l("h1",{innerHTML:s.currentLesson.title},null,8,CF)]),l("div",$F,[a(b,{"aria-label":e.$t("Previous lesson"),onClick:t[2]||(t[2]=Z=>e.$emit("setPrevLesson")),disabled:s.currentLessonIndex===0,size:"small"},{default:c(()=>[a(h,{class:"fcom_arrow_icon"},{default:c(()=>[a(f)]),_:1})]),_:1},8,["aria-label","disabled"]),a(b,{"aria-label":e.$t("Next lesson"),onClick:t[3]||(t[3]=Z=>e.$emit("setNextLesson")),disabled:s.currentLessonIndex+1===s.lessonsCount,size:"small"},{default:c(()=>[a(h,{class:"fcom_arrow_icon"},{default:c(()=>[a(y)]),_:1})]),_:1},8,["aria-label","disabled"])])]),s.currentLesson.can_view?(n(),r(T,{key:1},[i.showMediaPreview?(n(),v(V,{key:0,media_item:s.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",VF,[s.currentLesson.content_loading?(n(),r("div",MF,[a(m,{rows:5,animated:!0})])):(n(),r(T,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:s.currentLesson.content},null,8,LF),(ee=s.currentLesson.meta)!=null&&ee.quiz_questions?(n(),r("div",TF,[a(I,{lesson:s.currentLesson,isEnrolled:s.track.isEnrolled,questions:s.currentLesson.meta.quiz_questions},null,8,["lesson","isEnrolled","questions"])])):_("",!0)],64))]),i.hasDocuments&&!s.currentLesson.content_loading?(n(),r("div",FF,[l("div",PF,[l("h3",null,d(e.$t("Documents & Files")),1)]),e.has_pro?(n(),r("div",IF,[a(F,{class:"fcom_boxed_documents",document_lists:s.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(n(),r("div",{key:0,class:"fcom_locked_container",innerHTML:s.currentLesson.access_message},null,8,SF))]),i.commentsEnabled&&!s.currentLesson.content_loading?(n(),r("div",EF,[l("div",AF,[a(R,{show_comment_form:s.track.isEnrolled,feed:s.currentLesson,showAll:!0,checkPermission:!0},ye({before_comment_box:c(()=>[l("h3",null,d(e.$t("Lesson Discussions")),1)]),_:2},[s.track.isEnrolled?void 0:{name:"after_comment_box",fn:c(()=>[!e.auth.user_id||s.course.can_self_enroll?(n(),r("div",UF,[l("p",BF,d(e.$t("Please enroll the course to join the conversation.")),1),e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),v(b,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:c(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Ve,o.enrolling]]):_("",!0):(n(),r("a",{key:0,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login to enroll this course")),9,DF))])):_("",!0)]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),o.sm_side_show?(n(),r("div",{key:0,class:"fcom_toc_backdrop fcom_toc_control",onClick:t[4]||(t[4]=ee=>o.sm_side_show=!1)})):_("",!0),a(ne,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:c(()=>[a(B,{ref:"lesson_index_sidebar",height:i.containerHeight},{default:c(()=>[l("div",RF,[l("h3",null,d(e.$t("Lessons")),1),a(b,{class:"fcom_toc_control fcom_toc_close",text:"","aria-label":e.$t("Close"),onClick:t[5]||(t[5]=ee=>o.sm_side_show=!1)},{default:c(()=>[a(h,null,{default:c(()=>[a(A)]),_:1})]),_:1},8,["aria-label"])]),l("div",xF,[(n(!0),r(T,null,x(s.sections,ee=>(n(),r("div",{key:ee.id,class:"fcom_section_primary"},[l("div",OF,[l("div",HF,[a(h,{class:"clickable",onClick:Z=>ee.is_closed=!ee.is_closed},{default:c(()=>[ee.is_closed?(n(),v(y,{key:0,class:"fcom_arrow_icon"})):(n(),v(N,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,d(ee.title),1)])]),ee.is_closed?_("",!0):(n(!0),r(T,{key:0},x(ee.lessons,Z=>(n(),r("div",{class:D([{fcom_current_lesson:Z.id==s.currentLesson.id},"fcom_section_item"]),key:Z.id},[l("div",{id:"fcom_lesson_title_"+Z.id,onClick:oe=>i.gotoLesson(Z),class:"fcom_section_item_title"},[l("p",NF,[s.track.completed_lessons.includes(Z.id.toString())?(n(),v(h,{key:0,style:{color:"#008a2e"}},{default:c(()=>[a(H)]),_:1})):Z.can_view?(n(),v(h,{key:2},{default:c(()=>[a(z)]),_:1})):(n(),v(h,{key:1},{default:c(()=>[a($)]),_:1})),l("span",{innerHTML:Z.title},null,8,zF)])],8,jF)],2))),128))]))),128))]),s.track.progress?(n(),r("div",qF,[l("div",GF,[l("p",null,d(e.$t("Course progress")),1),a(G,{class:"fcom_progress","stroke-width":8,percentage:parseInt(s.track.progress)},null,8,["percentage"])])])):_("",!0)]),_:1},8,["height"])]),_:1}),o.lightboxImages.length?(n(),v(E,{key:1,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,"show-progress":o.lightboxImages.length>1,onClose:t[6]||(t[6]=ee=>o.lightboxImages=[])},null,8,["url-list","initial-index","show-progress"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const WF=P(cF,[["render",YF]]),KF={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},ZF={class:"fcom_box_list"},JF={class:"fcom_box_list_header"},QF={class:"fcom_box_list_body"},XF={class:"fcom_person_lists"},eP={class:"fcom_leader"},tP={key:0,class:"fcom_serial_suffix"},sP={key:0,class:"fcom_leader_stat"};function oP(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink");return n(),r("div",ZF,[l("div",JF,d(s.leaders.title),1),l("div",QF,[l("ul",XF,[(n(!0),r(T,null,x(s.leaders.items,(h,g)=>(n(),r("li",{key:h.user_id},[l("div",eP,[l("div",{class:D(["fcom_serial_"+(g+1),"fcom_serial"])},[l("span",null,d(g+1),1),g<3?(n(),r("div",tP,[...t[0]||(t[0]=[l("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M0 0L11 0V10.0442L5.73392 6.32786L0 10.0442L0 0Z",fill:"currentColor"})],-1)])])):_("",!0)],2),a(m,{with_level:!1,xprofile:h.xprofile},null,8,["xprofile"]),a(f,{show_badge:!0,xprofile:h.xprofile,show_follow:!0},null,8,["xprofile"])]),parseInt(h.total_points)?(n(),r("div",sP,[Y(l("span",null,"+",512),[[vt,!i.isAll]]),M(" "+d(h.total_points),1)])):_("",!0)]))),128))])])])}const iP=P(KF,[["render",oP]]),nP={name:"LeaderTooltip",components:{InfoFilled:$t},props:{levelChunks:{type:Array,required:!0}}},lP={class:"fcoml_tooltip_content"},aP={class:"fcoml_tooltip_title"},rP={class:"fcoml_tooltip_subtitle"},cP=["innerHTML"],dP={class:"fcoml_tooltip_subtitle"},uP={class:"fcoml_tooltip_desc"},_P={class:"fcoml_tooltip_levels"},mP={class:"levels_list"},hP={class:"level_title"},fP={class:"level_points"};function pP(e,t,s,u,o,i){const m=p("InfoFilled"),f=j,h=O,g=fe;return n(),v(g,{persistent:!1,"popper-class":"fcoml_tooltip_popover",width:550,effect:"dark",trigger:"click"},{reference:c(()=>[a(h,{"aria-label":e.$t("More info"),text:""},{default:c(()=>[a(f,null,{default:c(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:c(()=>[l("div",lP,[l("h5",aP,d(e.$t("Leaderboard Points")),1),l("p",rP,d(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,cP),l("p",dP,d(e.$t("Levels")),1),l("p",uP,d(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",_P,[(n(!0),r(T,null,x(s.levelChunks,(k,b)=>(n(),r("div",{key:b},[l("ul",mP,[(n(!0),r(T,null,x(k,S=>(n(),r("li",{key:S.level,class:"level_item"},[l("div",hP,d(S.title),1),l("div",fP,d(e.$_n("%d point","%d points",S.min_points)),1)]))),128))])]))),128))])])]),_:1})}const gP=P(nP,[["render",pP]]),yP={name:"LeaderBoard",components:{InfoFilled:$t,LeaderLists:iP,AppLayout:Se,Layout:we,LeaderTooltip:gP},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Ae(this.appVars.auth.total_points):null},requiredPoints(){return parseInt(this.userLevel.max_points)-parseInt(this.appVars.auth.total_points)+1},levelChunks(){let e=Object.values(this.appVars.leaderboard_levels);const t=Math.ceil(e.length/3);return e.reduce((s,u,o)=>{const i=Math.floor(o/t);return s[i]||(s[i]=[]),s[i].push(u),s},[])}},methods:{fetchLeaders(){this.loading=!0,this.$get("leaderboard").then(e=>{this.leaderboard=e.leaderboard,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.appVars.view_leaderboard_members&&this.fetchLeaders(),this.changeTitle(this.$t("Leaderboard"))}},vP={key:0,style:{"text-align":"center",padding:"20px 20px 40px"}},bP={class:"permission_failed"},kP=["href"],wP={key:0,class:"fcom_leaderboard_profile"},CP={class:"fcom_leaderboard_profile_inner"},$P={class:"fcom_profile_header"},SP={class:"fcom_profile_info"},VP={class:"info_avatar"},MP={class:"info_user"},LP={class:"fcom_level_name"},TP={class:"fcoml_level_sub"},FP={class:"fcoml_level_sub_icon"},PP={class:"fcoml_level_sub_text"},IP={class:"fcom_leaderboard_profile_avatar"},EP={class:"fcom_leaderboard_levels"},AP=["title"],UP={key:1},BP={class:"fcoml_level_detail"},DP={class:"fcoml_level_title"},RP={class:"fcoml_level_sub"},xP={class:"fcom_leaderboard_items"},OP={key:1,class:"white_loaded"};function HP(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=p("LeaderTooltip"),g=p("Lock"),k=j,b=ct,S=dt,w=p("leader-lists"),$=J,y=p("layout"),C=p("app-layout");return n(),v(C,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:c(()=>[a(y,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:c(()=>[e.appVars.view_leaderboard_members?(n(),r(T,{key:1},[i.userLevel?(n(),r("div",wP,[l("div",CP,[l("div",$P,[l("div",SP,[l("div",VP,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",MP,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",LP,d(i.userLevel.title),1)])]),l("div",TP,[l("div",FP,[l("span",null,"🏆 "+d(e.auth.total_points),1),t[0]||(t[0]=M(" | ",-1)),l("span",null,d(e.$t("Level %d",i.userLevel.level)),1)]),l("div",PP,[M(d(e.$t("%d points to level up!",i.requiredPoints))+" ",1),a(h,{levelChunks:i.levelChunks},null,8,["levelChunks"])])])]),l("div",IP,[a(S,{gutter:20},{default:c(()=>[(n(!0),r(T,null,x(i.levelChunks,L=>(n(),v(b,{sm:24,md:8},{default:c(()=>[l("ul",EP,[(n(!0),r(T,null,x(L,V=>(n(),r("li",null,[l("div",{title:`${V.min_points} points`,class:D(["fcom_level_icon",{fcom_is_in_level:i.userLevel.max_points>=V.max_points}])},[i.userLevel.max_points<V.max_points?(n(),v(k,{key:0},{default:c(()=>[a(g)]),_:1})):(n(),r("span",UP,d(V.level),1))],10,AP),l("div",BP,[l("div",DP,d(V.title),1),l("div",RP,d(V.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",xP,[a(S,{gutter:20},{default:c(()=>[(n(!0),r(T,null,x(o.leaderboard,L=>(n(),v(b,{key:L.key,md:8,sm:24},{default:c(()=>[a(w,{leaders:L},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),o.loading?(n(),r("div",OP,[a($,{rows:16,animated:!0})])):_("",!0)],64)):(n(),r("div",vP,[l("div",bP,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view the leaderboard")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,kP)])]))]),_:1},8,["title"])]),_:1})}const jP=P(yP,[["render",HP]]),NP=[{name:"dashboard",path:"/dashboard",component:p0,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:g2,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:V2},{name:"single_feed",path:"post/:feed_slug",component:Ss,props:!0}]},{path:"/feed-settings",component:()=>he(()=>import("./FeedSettingsRoute.js?ver=2.10.0"),[]),redirect:()=>({name:"feed_settings_links"}),meta:{active_menu:"dashboard"},children:[{name:"feed_settings_welcome_banner",path:"welcome-banner",component:()=>he(()=>import("./WelcomeBannerConfig.js?ver=2.10.0"),[])},{name:"feed_settings_links",path:"links",component:()=>he(()=>import("./ManageFeedLinks.js?ver=2.10.0"),[])}]},{path:"/space/:space/settings",component:()=>he(()=>import("./SpaceSettingsRoute.js?ver=2.10.0"),[]),props:!0,redirect:e=>({name:"space_settings_general",params:e.params}),meta:{in_space:!0,back_route:"space_feeds"},children:[{name:"space_settings_general",path:"general",component:()=>he(()=>import("./SpaceGeneralTab.js?ver=2.10.0"),[])},{name:"space_settings_paywalls",path:"paywalls",component:()=>he(()=>import("./ManagePaywalls.js?ver=2.10.0"),[])},{name:"space_settings_lockscreen",path:"lock-screen",component:()=>he(()=>import("./SpaceLockscreen.js?ver=2.10.0"),[])},{name:"space_settings_links",path:"links",component:()=>he(()=>import("./ManageSpaceLinks.js?ver=2.10.0"),[])},{name:"space_settings_pages",path:"pages",component:()=>he(()=>import("./ManageSpacePages.js?ver=2.10.0"),[])}]},{path:"/space/:space/",component:kw,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:Mw,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:Vw,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:So,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_feed",path:"post/:feed_slug",component:Ss,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_members",path:"members",component:T8,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:X5,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:p4,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_media",path:"media",component:k5,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_page",path:"page/:page_slug",component:()=>he(()=>import("./ViewSpacePage.js?ver=2.10.0"),[]),props:!0,meta:{in_space:!0,show_sidebar:"from_page_layout",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{name:"space_not_found",path:":pathMatch(.*)*",component:()=>he(()=>import("./SpaceNotFound.js?ver=2.10.0"),[]),props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:AC,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:HV,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:D6,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:B7,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:H$,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:y7,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:Do,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:K6,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:k$,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:Z7,meta:{active_menu:"all_members"}},{name:"user_courses",path:"courses",component:b9,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_notification_settings",path:"notification-settings",component:mS,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_follows",path:"follow",component:_V,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:US,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:oV,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:JV,meta:{}},{name:"bookmarks",path:"/bookmarks",component:oM,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:EM,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:OM,props:!0,meta:{active_menu:"courses",in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{props:!0,path:"lessons",component:fT,name:"view_course",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{props:!0,path:"lessons/:lesson_slug/view",component:WF,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:jP,meta:{active_menu:"leaderboards"}}],zP={name:"NotFound",data(){return{message:this.$t("Please wait while we redirect you to the appropriate page..."),is404:!1,require_auth:!1}},methods:{lookForPost(e){this.$get("feeds/"+e+"/by-slug").then(t=>{this.$router.push({name:"single_feed",params:{feed_slug:e}})}).catch(t=>{this.$router.push({name:"all_feeds"}),this.is404=!0})}},mounted(){let e=this.$route.path;if(!e){this.message=this.$t("The requested page could not be found");return}e=e.replace(/^\/+/,"");let s=e.split("/")[0];if(s=="community"){e=e.replace(/^community\//,"/space/"),this.$router.push(e);return}else if(s=="fcom_route"){if(this.$route.query.route=="user_notification_settings")if(this.auth.username){this.$router.push({name:"user_notification_settings",params:{username:this.auth.username}});return}else{window.location.href=this.getCurrentAuthUrl();return}}else if(s=="u")if(this.auth.username){this.$router.push({name:"user_profile",params:{username:this.auth.username}});return}else{window.location.href=this.appVars.auth_url;return}this.lookForPost(s)}};function qP(e,t,s,u,o,i){return n(),r("h1",null,d(o.message),1)}const GP=P(zP,[["render",qP]]),YP=(e,{maxWaitMs:t=600,signal:s}={})=>new Promise(u=>{if(s!=null&&s.aborted)return u();const o=performance.now()+t,i=()=>{var h;if(s!=null&&s.aborted)return u();const m=(h=window.fcomLayoutRef)==null?void 0:h.wrapRef;m&&m.scrollHeight-m.clientHeight>=e||performance.now()>=o?u():requestAnimationFrame(i)};requestAnimationFrame(i)}),WP={name:"VerifiedSign"},KP={class:"fcom_verified"},ZP=["aria-label"];function JP(e,t,s,u,o,i){const m=Ie;return n(),v(m,{content:e.$t("Verified"),placement:"top"},{default:c(()=>[l("span",KP,[(n(),r("svg",{viewBox:"0 0 22 22","aria-label":e.$t("Verified account"),role:"img","data-testid":"icon-verified"},[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"})],-1)])],8,ZP))])]),_:1},8,["content"])}const QP=P(WP,[["render",JP]]),XP=[hi,Ys,fi,pi,zs,gi,yi,vi,bi,ki,wi,Ci,$i,Si,Vi,Mi,Li,Ti,Ws,Ks,Fi,Pi,Ii,Zs,Ei,Ai,Ui,Qs,wt,Bi,Di,Ri,xi,kt,Oi,Hi,ji,Ni,Ns,zi,qi,qs,Gi,$t,Fe,Yi,Xs];function rt(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const s in e)t.push(rt(e[s]));else if(typeof e=="object"&&e.join!==void 0)for(const s in e)t.push(rt(e[s]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("<br />")}function eI(e){let t;try{t=new URL(e)}catch{t=new URL(e,"https://fluentcommunity.co")}let s=t.pathname;return s=s.replace(/^\//,""),s.split("/")[0]||""}const ce=jo(n0),ps=Xo();ps.use(ei);ps.use(({store:e})=>{e.$api={get:(t,s)=>window.FluentCommunityUtil.Rest.get(t,s),post:(t,s)=>window.FluentCommunityUtil.Rest.post(t,s),put:(t,s)=>window.FluentCommunityUtil.Rest.put(t,s),patch:(t,s)=>window.FluentCommunityUtil.Rest.patch(t,s),delete:t=>window.FluentCommunityUtil.Rest.delete(t)}});ce.use(ps);ce.use(Zo);var Ts,Fs;ce.use(mi,{loading:(((Ts=window.fluentComAdmin)==null?void 0:Ts.assets_url)||"")+"images/image-loader.svg",error:(((Fs=window.fluentComAdmin)==null?void 0:Fs.assets_url)||"")+"images/image-placeholder.png",lifecycle:{loading:e=>{e.classList.add("fcom-img-loading")},loaded:e=>{e.classList.remove("fcom-img-loading"),e.classList.add("fcom-img-loaded")},error:e=>{e.classList.remove("fcom-img-loading"),e.classList.add("fcom-img-error")}}});ce.config.globalProperties.appVars=window.fluentComAdmin;ce.config.globalProperties.auth=window.fluentComAdmin.auth;ce.config.globalProperties.has_pro=!!window.fluentComAdmin.pro;let Nt="40%",zt="60%",Ro="500px";window.innerWidth<600?(zt="95%",Nt="90%",Ro="90%"):window.innerWidth<800&&(zt="80%",Nt="80%");XP.forEach(e=>{ce.component(e.name,e)});ce.component("VerifiedSign",QP);ce.component("UserAvatar",as);ce.component("UserRouteLink",Te);ce.component("WelcomeBanner",fs);ce.component("UserBadge",Bo);function Ls(){var k,b,S,w,$;if(window.fluentFrameworkApp){console.warn("FluentCommunity: the portal app is already mounted, skipping duplicate initialization.");return}ce.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;ce.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:Nt,dialogWidth:zt,modalWidth:Ro,feedMonitorCache:{},mounted:!1,isMobile:window.innerWidth<=768,has_leaderboard:this.appVars.features.leaderboard}},computed:{siteDateFormat(){return this.appVars.date_formatter||"MMM D, YYYY"},siteTimeFormat(){return this.appVars.time_formatter||"HH:mm"},siteDateTimeFormat(){return this.appVars.date_time_formatter||"MMM D, YYYY HH:mm"}},methods:{$get:e.get,$post:e.post,$uploadFile:e.uploadFile,$put:e.put,$del:e.delete,$patch:e.patch,$ajax:e.ajax,changeTitle(y){document.title=y+" - "+this.appVars.site_title},$handleError(y){let C="";typeof y=="string"?C=y:y&&y.message?C=y.message:C=rt(y),C||(C="Something is wrong!"),typeof C!="string"&&(C=rt(C)),this.$notify({type:"error",title:this.$t("Error"),message:C,dangerouslyUseHTMLString:!0})},convertToText:rt,$t(y){y=window.fluentComAdmin.i18n[y]||y;const C=Array.prototype.slice.call(arguments,1);if(C.length===0)return y;const L=/%(\d*)\$?s|%d/g;let V=0;return y=y.replace(L,(I,F)=>{if(F){const R=parseInt(F,10)-1;return R<C.length?C[R]:I}else return V<C.length?C[V++]:I}),y},$_n(y,C,L){return parseInt(L.toString().replace(/,/g,""),10)>1?this.$t(C,L):this.$t(y,L)},$labelize(y){return y?(y=y.charAt(0).toUpperCase()+y.slice(1),window.fluentComAdmin.i18n[y]?window.fluentComAdmin.i18n[y]:y.replace(/_/g," ").replace(/\b\w/g,C=>C.toUpperCase())):""},$toClipboard(y,C="Copied to clipboard"){navigator.clipboard.writeText(y).then(()=>{this.$notify.success(this.$t(C))}).catch(L=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(y){return dayjs.utc(y).local().fromNow()},$storeLocalData(y,C){this.Storage.set(y,C)},$getLocalData(y,C=""){return this.Storage.get(y,C)},ucFirst(y){return y?y.charAt(0).toUpperCase()+y.slice(1):""},convertTo24Hour(y){if(!y)return y;const C=y.match(/^(\d{1,2}):(\d{2})(?::\d{2})?\s*([AaPp][Mm])?$/);if(!C){const F=dayjs(y,this.siteTimeFormat);return F.isValid()?F.format("HH:mm"):y}let L=parseInt(C[1],10);const V=C[2],I=C[3];if(I){const F=I.toUpperCase()==="PM";F&&L!==12&&(L+=12),!F&&L===12&&(L=0)}return String(L).padStart(2,"0")+":"+V},ucWords(y){return y?y.replace(/\b[a-z]/g,function(C){return C.toUpperCase()}):""},smartDate(y,C=!1,L=!1){if(!y)return"";const V=this.siteTimeFormat;let I="D MMM, YYYY";dayjs(y).isSame(new Date,"year")?(I="D MMM",C&&(Math.abs(dayjs(y).diff(new Date,"days"))<=5||L)&&(I="D MMM, "+V)):C&&L&&(I="D MMM, YYYY, "+V);const F=dayjs(y);return F.isValid()?F.format(I):null},hasPermission(y){return this.appVars.permissions[y]},isAdmin(){return!!this.appVars.permissions.community_admin},hasCourseAdminAccess(){return!!this.appVars.permissions.course_admin},hasCourseCreatorAccess(){return!!this.appVars.permissions.course_creator},hasSpaceAdminAccess(y=null){return this.hasPermissionOrInCurrentSpace("community_admin")||y&&this.isSpaceAdmin(y)},hasSpaceModeratorAccess(y=null){return this.hasPermissionOrInCurrentSpace("community_moderator")||y&&this.isSpaceModerator(y)},canDeleteFeed(y){return this.auth.user_id&&(y.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_feed"))},canEditFeed(y){return this.auth.user_id&&(y.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_feed"))},canDeleteComment(y){return this.auth.user_id&&(y.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_comment"))},canEditComment(y){return this.auth.user_id&&(y.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_comment"))},hasSpaceAccess(y){return y?this.appVars.user_membership_slugs.indexOf(y)!==-1:!0},$upgradeUrl(y,C){const L=this.appVars&&this.appVars.upgrade_url;if(!L)return L;try{const V=new URL(L);return y&&V.searchParams.set("utm_content",y),C&&V.searchParams.set("utm_campaign",C),V.toString()}catch{return L}},hasInPermission(y,C){return!C||typeof C!="object"?!1:C[y]},hasCurrentSpacePermission(y){return window.fcom_current_community?this.hasInPermission(y,window.fcom_current_community.permissions):!1},hasPermissionOrInCurrentSpace(y){return this.hasPermission(y)?!0:this.hasCurrentSpacePermission(y)},humanDateDiff(y){if(!y)return"";const C=dayjs.utc(y,"YYYY-MM-DD HH:mm:ss");if(!C.isValid())return"";const L=C.add(this.appVars.date_offset,"s");return dayjs(L.format("YYYY-MM-DD HH:mm:ss")).from(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},isToday(y){return dayjs(y).isSame(dayjs(),"day")},isPastDate(y){if(!y)return!0;const C=dayjs.utc(y,"YYYY-MM-DD HH:mm:ss");if(!C.isValid())return!0;const L=C.add(this.appVars.date_offset,"s");return dayjs(L.format("YYYY-MM-DD HH:mm:ss")).isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},formattedDate(y){return dayjs(y).format(this.siteDateFormat)},formattedTime(y){return dayjs(y).format(this.siteTimeFormat)},formattedDateTime(y){return dayjs(y).format(this.siteDateTimeFormat)},hasCommentPermission(y){var C;return this.auth.user_id?!y.space_id&&!y.course_id?this.auth.user_id&&(y.user_id==this.auth.user_id||y.privacy=="public"):this.hasSpaceAccess((C=y.space)==null?void 0:C.slug):!1},getExcerpt(y,C=250){if(!y)return"";let L=y.replace(/(<([^>]+)>)/ig,"");return L=L.replace(/(\*\*|__)(.*?)\1/g,"$2"),L=L.replace(/(#+)(.*)/g,"$2"),L=L.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),typeof DOMParser<"u"&&(L=new DOMParser().parseFromString(L,"text/html").body.textContent||""),L.length>C&&(L=L.substring(0,C)+"..."),L},mdToHtml(y){return y?(y=y.replace(" ","",y),y=y.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>"),y=y.replace(/\*(.*?)\*/g,"<em>$1</em>"),y=y.replace(/\~\~(.*?)\~\~/g,"<del>$1</del>"),y=y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),y=y.replace(/<(https?:\/\/[^\s>]+)>/g,'<a href="$1">$1</a>'),y=y.replace(/^##\s+(.*?)$/gm,"<h2>$1</h2>"),y=y.replace(/^###\s+(.*?)$/gm,"<h3>$1</h3>"),y=y.replace(/^####\s+(.*?)$/gm,"<h4>$1</h4>"),y=y.replace(/^>\s+(.*?)$/gm,"<blockquote>$1</blockquote>"),y=y.replace(/`{3}([\s\S]*?)`{3}/g,"<pre><code>$1</code></pre>"),y=y.replace(/`([^`]+)`/g,"<code>$1</code>"),y=y.replace(/^([\*\-])\s+(.*)$/gm,"<li>$2</li>"),y=y.replace(/(<li>.*?<\/li>(?:\n<li>.*?<\/li>)*)/g,function(C){return"<ul>"+C.replace(/\n/g,"")+"</ul>"}),y=y.replace(/\n/g,"<br>"),y):""},$convertToBoolean(y){return y==="true"||y===!0||y===1||y==="1"||y==="yes"||y==="on"},each:Oe,hasFeature(y){return this.appVars.features[y]},isCommunityModerator(){return window.fluentComAdmin.auth.community_roles.some(y=>y==="admin"||y==="moderator")},isSpaceModerator(y){var L,V;return["admin","moderator"].includes((V=(L=y==null?void 0:y.membership)==null?void 0:L.pivot)==null?void 0:V.role)},isSpaceAdmin(y){var C,L;return((L=(C=y==null?void 0:y.membership)==null?void 0:C.pivot)==null?void 0:L.role)=="admin"},isModerator(y){if(this.isCommunityModerator())return!0;if(!y)return!1;const C=this.auth.spaces[y];return this.isSpaceModerator(C)},getCurrentAuthUrl(){let y=window.location.href,C=this.appVars.auth_url;return C=C.replace(/(\?|&)redirect_to=[^&]+/,""),C.indexOf("?")===-1?C+="?":C+="&",C+"redirect_to="+encodeURIComponent(y)},$formatNumber(y){return y&&y.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(y,C={}){return Oe(C,(L,V)=>{y=y.replace(":"+V,L)}),this.appVars.portal_url+y},isOnline(y){if(!y)return!1;const L=dayjs.utc(y,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return L<=5&&L>=0},setFollowIds(y){Ue().setFollows(y)},$exportToCsv(y,C="fcom-export.csv"){if(!y||!Array.isArray(y)||y.length===0){this.$notify({type:"error",title:this.$t("Error"),message:this.$t("No data available to export.")});return}const L=Object.keys(y[0]),V=[L.join(",")];y.forEach(B=>{const U=L.map(A=>`"${String(B[A]??"").replace(/"/g,'""')}"`);V.push(U.join(","))});const I="\uFEFF"+V.join(` |