| 1 |
import{D as i,F as c,K as l,ae as g,ab as R,L as H,S as a,I as r,E as v,O as _,Q as d,R as M,af as J,J as G,P as V,a7 as z,B as q,ak as ve,ay as Pe,W as le,aj as he,M as Wt,V as ws,a5 as Zt,G as $o,T as rt,a2 as So,U as yt,at as Vo,ar as Lo}from"./vue.js?ver=2.6.0";import{c as fs,a as Mo,b as Fo}from"./vue-router.js?ver=2.6.0";import{E as j,a as To,b as x,c as Y,d as fe,e as ut,f as X,g as pe,h as Ye,i as _t,j as mt,k as Ie,l as We,m as be,n as $e,o as Cs,p as Ue,q as ke,r as ee,s as te,t as vt,u as de,v as $s,w as ue,x as Ze,y as Ke,z as Je,A as Ss,B as bt,C as kt,D as wt,F as Ct,G as Vs,H as Ae,I as Kt,J as Po,K as Ls,L as Ms,M as Io,N as Fs,O as Uo,P as Ts,Q as Me,R as xe,S as Qe,T as Jt,U as Qt,V as Ps,W as Is,X as Xt,Y as es,Z as Eo,_ as Bo,$ as Ao,a0 as jt}from"./element-plus.js?ver=2.6.0";import"./dayjs.js?ver=2.6.0";import{d as Oe,m as Do,a as Us,c as Ro,s as Ho}from"./pinia.js?ver=2.6.0";import{bc as xo,bd as $t,a5 as Nt,az as ps,a0 as St,be as Oo,bf as Te,l as jo,bg as No,bh as Es,n as Bs,bi as zo,bj as qo,m as Go,bk as Yo,bl as As,U as Ds,R as Rs,bm as Wo,bn as Hs,b as ts,bo as Zo,bp as Ko,bq as Jo,br as Qo,bs as Xo,bt as ei,bu as ti,bv as si,bw as oi,bx as ii,by as ni,bz as li,bA as ai,v as ri,j as ci,bB as di,bC as ui,bD as _i,J as mi,bE as hi,s as fi,D as pi,C as gi,p as yi,bF as vi,bG as bi,bH as ki,bI as wi,bJ as Ci,g as $i,bK as Si,bL as Vi,$ as Li,bM as Mi,bN as Fi,bO as Ti,bP as Pi,a1 as Ii,N as Ui,bQ as Ei}from"./vendor.js?ver=2.6.0";import{_ as I,P as Bi,E as Ai}from"./emoji-picker.js?ver=2.6.0";import{u as Di,v as ss,w as Ri,x as Re,y as Hi}from"./lodash.js?ver=2.6.0";import{H as xi,O as Oi,m as ji,s as Ni,c as zi,a as qi,h as Gi,b as Yi,x as Wi,P as Zi,W as Ki,U as Ji,d as Qi,_ as Xi,u as zt,$ as en,w as tn,r as sn,L as it,e as on}from"./milkdown.js?ver=2.6.0";const ie=Oe("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 o=this.cache[e];if(!o)return this.stats.misses++,null;const u=Date.now()-o.timestamp,s=o.ttl||t||5*60*1e3;return u>s?(delete this.cache[e],this.stats.misses++,this.stats.size=Object.keys(this.cache).length,null):(this.stats.hits++,o.hits=(o.hits||0)+1,o.lastAccessed=Date.now(),o.data)},set(e,t,o=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:o},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(o=>{o.includes(e)&&(delete this.cache[o],t++)}),this.stats.size=Object.keys(this.cache).length,t},pruneLRU(e){const t=Object.entries(this.cache).map(([o,u])=>({key:o,lastAccessed:u.lastAccessed||u.timestamp})).sort((o,u)=>o.lastAccessed-u.lastAccessed).slice(0,e);return t.forEach(({key:o})=>{delete this.cache[o]}),this.stats.size=Object.keys(this.cache).length,t.length},pruneExpired(e=15*60*1e3){let t=0;const o=Date.now();return Object.entries(this.cache).forEach(([u,s])=>{o-s.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,o])=>{this.set(t,o)})}}}),Ge=Oe("ui",{state:()=>({lastScrollPath:null,lastScrollPosition:0,lastViewedFeed:{},layoutStyle:null,sortBy:null,layoutStyleByContext:{},sortByContext:{},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},saveLastViewedFeed(e,t,o){this.lastViewedFeed[e]={feedId:t,index:o,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(o){console.error("Failed to save layout style:",o)}},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(o){console.error("Failed to save sort preference:",o)}},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))}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}}}),Be=Oe("user",{state:()=>({currentUser:null,profilesByUsername:{},follows:{},followers:[],loading:{},lastFetched:{}}),getters:{getProfile:e=>t=>e.profilesByUsername[t]||null,isFollowing:e=>t=>{const o=e.follows[String(t)];return o!==void 0&&["1","2"].includes(String(o))},isBlocked:e=>t=>{const o=e.follows[String(t)];return o!==void 0&&String(o)==="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,o]of Object.entries(e)){const u=String(t);o==null?delete this.follows[u]:this.follows[u]=String(o)}},removeFollow(e){delete this.follows[String(e)]},async fetchProfile(e,t=!1){const o=ie(),u=`user-profile:${e}`;if(!t){const s=o.get(u);if(s)return this.profilesByUsername[e]=s,s.follow!==void 0&&s.user_id&&this.setFollows({[s.user_id]:s.follow}),s}this.loading[e]=!0;try{const s=await this.$api.get(`profile/${e}`),n=s.profile;return n.follow!==void 0&&n.user_id&&this.setFollows({[n.user_id]:n.follow}),s.current_user_follows&&this.setFollows(s.current_user_follows),this.profilesByUsername[e]=n,this.lastFetched[e]=Date.now(),o.set(u,n,5*60*1e3),this.loading[e]=!1,n}catch(s){throw this.loading[e]=!1,console.error("Failed to fetch user profile:",s),s}},async updateProfile(e,t=null,o=null){var s;const u=ie();try{const n=o?await this.$api.put(`profile/${o}`,{data:e}):await this.$api.put("profile",e),m=n.profile||n.user||n;return this.currentUser={...this.currentUser,...m},t&&t!==m.username&&(delete this.profilesByUsername[t],u.invalidate(`user-profile:${t}`)),m.username&&(this.profilesByUsername[m.username]=m,u.invalidate(`user-profile:${m.username}`)),(s=window.fluentComAdmin)!=null&&s.auth&&(window.fluentComAdmin.auth={...window.fluentComAdmin.auth,...m}),m}catch(n){throw console.error("Failed to update profile:",n),n}},async toggleFollow(e,t=null){var f,h,y;const o=ie(),u=String(e),s=this.follows[u],n=s!==void 0&&["1","2"].includes(String(s)),m=s;n?(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 w=n?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(w);return n?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),o.invalidate(`user-profile:${t}`)),(y=window.fluentFrameworkApp)!=null&&y.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!n}),b}catch(w){throw n?(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:",w),w}},async fetchFollowing(){const e=ie(),t="user-following",o=e.get(t);if(o)return o;try{const u=await this.$api.get("profile/following"),s=u.following||u;return u.current_user_follows&&this.setFollows(u.current_user_follows),e.set(t,s,5*60*1e3),s}catch(u){throw console.error("Failed to fetch following:",u),u}},invalidateProfile(e){ie().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=ie();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Le=Oe("feed",{state:()=>({feedsByContext:{},feedsById:{},stickyFeeds:{},loading:{},pagination:{},filters:{},tickerIntervals:{},tickerEnabled:{},lastTickerCheck:{},tickerPending:{},newPostsCount:{},ticker:{count:0,lastFetched:0},executionTimes:{},_pendingRequests:{}}),getters:{getFeedsByContext:e=>t=>{const o=e.feedsByContext[t];return o?o.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(o=>{var u;t+=((u=o.data)==null?void 0:u.length)||0}),t},disableAutoLoad:e=>t=>{const o=e.loading[t]||!1,u=e.pagination[t];return u?o||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,o={};Object.keys(e.feedsByContext).forEach(n=>{var f,h;const m=((h=(f=e.feedsByContext[n])==null?void 0:f.data)==null?void 0:h.length)||0;o[n]=m,t+=m});const u=Object.keys(e.feedsById).length,s=(t*5/1024).toFixed(2);return{totalFeeds:t,feedsByContextCount:o,feedsByIdCount:u,estimatedMemoryMB:s,contexts:Object.keys(e.feedsByContext).length}}},actions:{async fetchFeeds(e,t={},o=!1){var h,y,w;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:o,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(h=this.pagination[e])==null?void 0:h.page}),this.loading[e]){console.log("[Feed Store] Already loading for context:",e,"- ignoring duplicate request");return}const u=o?(((y=this.pagination[e])==null?void 0:y.page)||0)+1:t.page||1,s={...t,page:u,per_page:t.per_page||10},n=`feeds:${e}:${JSON.stringify(s)}`,m=ie();if(!o&&u===1){const b=m.get(n,3e5);if(b)return this.feedsByContext[e]=b.feedsByContext,this.pagination[e]=b.pagination,this.executionTimes[e]=b.executionTime,b.stickyFeed&&!window["viewed_sticky_posts_"+b.stickyFeed.id]?this.stickyFeeds[e]=b.stickyFeed:(this.stickyFeeds[e]=null,b.stickyFeed&&((w=this.feedsByContext[e])!=null&&w.data)&&(this.feedsByContext[e].data.some(C=>C.id===b.stickyFeed.id)||this.feedsByContext[e].data.unshift(b.stickyFeed))),b.feedsByContext.data.forEach(C=>{this.feedsById[C.id]=C}),this.loading[e]=!1,b}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",s).then(b=>{var C,p,k,$;if(b.sticky){const S="viewed_sticky_posts_"+b.sticky.id;window[S]?(b.feeds.data.some(T=>T.id===b.sticky.id)||b.feeds.data.unshift(b.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=b.sticky}else u===1&&(this.stickyFeeds[e]=null);if(o){const S=((C=this.feedsByContext[e])==null?void 0:C.data)||[];this.feedsByContext[e]={data:[...S,...b.feeds.data],timestamp:Date.now()}}else this.feedsByContext[e]={data:b.feeds.data,timestamp:Date.now()};if(this.pagination[e]={page:u,per_page:s.per_page,total:b.feeds.total,last_page:b.feeds.last_page,has_more:b.feeds.has_more},console.log("[Feed Store] Updated pagination:",{context:e,page:u,has_more:b.feeds.has_more,total:b.feeds.total}),b.execution_time&&(this.executionTimes[e]=b.execution_time),b.feeds.data.forEach(S=>{this.feedsById[S.id]={...S,timestamp:Date.now()}}),o){const S=((k=(p=this.feedsByContext[e])==null?void 0:p.data)==null?void 0:k.length)||0;S>500&&(console.log("[Feed Store] Pruning feeds, count:",S),this.pruneOldFeeds(e))}return b.last_fetched_timestamp&&(this.ticker.lastFetched=b.last_fetched_timestamp,($=window.fluentFrameworkApp)!=null&&$.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:b.last_fetched_timestamp})),b.current_user_follows&&Be().setFollows(b.current_user_follows),!o&&u===1&&m.set(n,{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(b=>{throw console.error("[Feed Store] Failed to fetch feeds:",b),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after error for context:",e),b})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,o=ie(),u=o.get(t,10*60*1e3);if(u)return this.feedsById[u.id]=u,u;try{const n=(await this.$api.get(`feeds/${e}/by-slug`)).feed;return this.feedsById[n.id]={...n,timestamp:Date.now()},o.set(t,n),window.appVars&&(window.appVars.last_feed_id=n.id),n}catch(s){throw console.error("Failed to fetch feed:",s),s}},async createFeed(e,t){var o,u,s,n,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 w=C=>{this.feedsByContext[C]||(this.feedsByContext[C]={data:[],timestamp:Date.now()}),this.stickyFeeds[C]&&(this.feedsByContext[C].data.some(k=>k.id===this.stickyFeeds[C].id)||this.feedsByContext[C].data.unshift(this.stickyFeeds[C]),this.stickyFeeds[C]=null);const p=this.feedsByContext[C].data.findIndex(k=>k.id===h.id);p===-1&&this.feedsByContext[C].data.unshift(h),this.pagination[C]?p===-1&&this.pagination[C].total++:this.pagination[C]={page:1,per_page:10,total:1,last_page:1,has_more:!1}};w(e),h.space_id&&e!=="global"&&(w("global"),ie().invalidatePattern("feeds:global"));const b=`user-${h.user_id}`;this.feedsByContext[b]&&e!==b&&w(b),(u=(o=window.fluentFrameworkApp)==null?void 0:o.$eventBus)==null||u.emit("recent_activities_refresh")}return f.last_fetched_timestamp&&(this.ticker.lastFetched=f.last_fetched_timestamp,(s=window.FluentCommunityUtil)!=null&&s.eventBus&&((m=(n=window.fluentFrameworkApp)==null?void 0:n.$eventBus)==null||m.emit("newest_feed_fetched",{last_fetched_timestamp:f.last_fetched_timestamp}))),ie().invalidatePattern(`feeds:${e}`),f}catch(f){throw console.error("Failed to create feed:",f),f}},async updateFeed(e,t){const o=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 s=this.feedsByContext[u].data.findIndex(n=>n.id===e);s!==-1&&(this.feedsByContext[u].data[s]={...this.feedsByContext[u].data[s],...t})});try{const s=(await this.$api.patch(`feeds/${e}`,t)).feed;return this.feedsById[e]={...this.feedsById[e],...s,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],...s})}),ie().invalidatePattern("feed:"),s}catch(u){throw o&&(this.feedsById[e]=o,Object.keys(this.feedsByContext).forEach(s=>{const n=this.feedsByContext[s].data.findIndex(m=>m.id===e);n!==-1&&(this.feedsByContext[s].data[n]=o)})),console.error("Failed to update feed:",u),u}},async deleteFeed(e,t,o=null){try{return await this.$api.delete(`feeds/${t}`),delete this.feedsById[t],o!==null&&this.feedsByContext[e]?this.feedsByContext[e].data.splice(o,1):Object.keys(this.feedsByContext).forEach(s=>{var n;(n=this.feedsByContext[s])!=null&&n.data&&(this.feedsByContext[s].data=this.feedsByContext[s].data.filter(m=>m.id!==t))}),this.pagination[e]&&this.pagination[e].total--,ie().invalidatePattern("feed:"),!0}catch(u){throw console.error("Failed to delete feed:",u),u}},async toggleBookmark(e){const t=this.feedsById[e];if(!t)return;const o=t.is_bookmarked;t.is_bookmarked=!o,Object.keys(this.feedsByContext).forEach(u=>{var n;const s=(n=this.feedsByContext[u].data)==null?void 0:n.findIndex(m=>m.id===e);s!==-1&&(this.feedsByContext[u].data[s].is_bookmarked=!o)});try{const u=await this.$api.post(`feeds/${e}/toggle-bookmark`);return t.is_bookmarked=u.is_bookmarked,Object.keys(this.feedsByContext).forEach(s=>{var m;const n=(m=this.feedsByContext[s].data)==null?void 0:m.findIndex(f=>f.id===e);n!==-1&&(this.feedsByContext[s].data[n].is_bookmarked=u.is_bookmarked)}),u}catch(u){throw t.is_bookmarked=o,Object.keys(this.feedsByContext).forEach(s=>{var m;const n=(m=this.feedsByContext[s].data)==null?void 0:m.findIndex(f=>f.id===e);n!==-1&&(this.feedsByContext[s].data[n].is_bookmarked=o)}),u}},async fetchTicker(e){var t,o,u;try{const s=e||this.ticker.lastFetched;console.log("[Legacy Ticker] Fetching ticker with timestamp:",s);const n=await this.$api.get("feeds/ticker",{last_fetched_timestamp:s});if(console.log("[Legacy Ticker] Response:",{has_changes:n.has_changes,feeds:((t=n.feeds)==null?void 0:t.length)||0,new_items_count:n.new_items_count}),this.ticker={count:n.new_items_count||0,lastFetched:n.last_fetched_timestamp||Date.now()},console.log("[Legacy Ticker] Checking if we should process feeds:",{has_changes:n.has_changes,feeds_exists:!!n.feeds,feeds_length:((o=n.feeds)==null?void 0:o.length)||0,feeds_data:n.feeds}),n.has_changes&&n.feeds&&n.feeds.length>0){console.log(`[Legacy Ticker] ✅ Processing ${n.feeds.length} feed updates`);const m={};n.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",n),this.ticker}catch(s){throw console.error("[Legacy Ticker] Failed to fetch ticker:",s),s}},resetTicker(){this.ticker.count=0},markStickyAsViewed(e,t){const o=this.stickyFeeds[e];o&&o.id===t&&(window["viewed_sticky_posts_"+t]=!0,this.feedsByContext[e]&&(this.feedsByContext[e].data.some(u=>u.id===o.id)||this.feedsByContext[e].data.unshift(o)),this.stickyFeeds[e]=null)},pruneOldFeeds(e=null){(e?[e]:Object.keys(this.feedsByContext)).forEach(u=>{var n;const s=((n=this.feedsByContext[u])==null?void 0:n.data)||[];if(s.length>500){const m=s.slice(0,s.length-500);this.feedsByContext[u].data=s.slice(s.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(y=>{var w;return(w=y.data)==null?void 0:w.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]="",ie().invalidatePattern(`feeds:${e}`)},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 s;console.log(`[processTickerUpdates] Called for context: ${e} with ${t.length} updates`),console.log("[processTickerUpdates] Updates:",t);const o=[],u=[];if(t.forEach(n=>{console.log("[processTickerUpdates] Processing update:",{id:n.id,action:n.action,updated_at:n.updated_at});const m=this.feedsById[n.id];console.log("[processTickerUpdates] Existing feed in store:",m?{id:m.id,updated_at:m.updated_at}:"NOT IN STORE"),n.action==="deleted"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${n.id} for DELETION`),u.push(n.id)):n.action==="created"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${n.id} for FETCH (CREATED)`),o.push(n.id)):n.action==="updated"&&(!m||new Date(m.updated_at)<new Date(n.updated_at)?(console.log(`[processTickerUpdates] ➡️ Marking feed ${n.id} for FETCH (UPDATED - ${m?"outdated":"not in store"})`),o.push(n.id)):console.log(`[processTickerUpdates] ⏭️ Skipping feed ${n.id} - already have latest version`))}),console.log("[processTickerUpdates] Summary:",{toFetch:o.length,toDelete:u.length,fetchIds:o,deleteIds:u}),u.length>0&&(console.log(`[processTickerUpdates] 🗑️ Deleting ${u.length} feeds from ${e}`),this.deleteFeedsFromStore(e,u)),o.length>0){console.log(`[processTickerUpdates] 📥 Fetching ${o.length} feeds for ${e}`),await this.fetchFeedsByIds(e,o);const n=t.filter(m=>m.action==="created").length;n>0&&(this.newPostsCount[e]=(this.newPostsCount[e]||0)+n)}(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:e,added:o.filter(n=>!this.feedsById[n]).length,updated:o.filter(n=>this.feedsById[n]).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 o=20;try{if(t.length>o){console.log(`[Feed Store] Batching ${t.length} feeds into chunks of ${o}`);for(let u=0;u<t.length;u+=o){const s=t.slice(u,u+o);await this.fetchFeedBatch(e,s)}}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 o=await this.$api.post("feeds/batch",{feed_ids:t,context:e});if(console.log("[Feed Store] API response:",o),!o||!Array.isArray(o.feeds)){console.error("[Feed Store] Invalid response from /feeds/batch:",o);return}console.log(`[Feed Store] Received ${o.feeds.length} feeds for context: ${e}`),o.feeds.forEach(u=>{this.feedsById[u.id]=u,this.feedsByContext[e]||(this.feedsByContext[e]={data:[],timestamp:Date.now()});const s=this.feedsByContext[e].data,n=s.findIndex(m=>m.id===u.id);n===-1?s.unshift(u):s[n]=u})}catch(o){throw console.error("[Feed Store] Failed to fetch batch for context:",e,o),o}},deleteFeedsFromStore(e,t){t.forEach(o=>{var s;delete this.feedsById[o],(s=this.feedsByContext[e])!=null&&s.data&&(this.feedsByContext[e].data=this.feedsByContext[e].data.filter(n=>n.id!==o)),ie().invalidate(`feed:${o}`)}),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=Oe("space",{state:()=>({spacesBySlug:{},currentSpace: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(o=>o.slug===t),getMySpaces:e=>[...e.mySpaces].sort((t,o)=>t.title.localeCompare(o.title)),isLoading:e=>t=>e.loading[t]||!1,joinedSpacesCount:e=>e.mySpaces.length},actions:{async fetchSpace(e,t=!1){const o=ie(),u=`space:${e}`;if(!t){const s=o.get(u);if(s)return this.spacesBySlug[e]=s,this.currentSpace=s,s}this.loading[e]=!0;try{const s=await this.$api.get(`spaces/${e}/by-slug`),n=s.space||s;return this.spacesBySlug[e]=n,this.currentSpace=n,this.lastFetched[e]=Date.now(),s.topics&&(this.topicsBySpace[e]=s.topics),s.pending_count!==void 0&&(n.pending_count=s.pending_count),o.set(u,n,15*60*1e3),typeof window<"u"&&(window.fcom_current_community=n),this.loading[e]=!1,n}catch(s){throw this.loading[e]=!1,console.error("Failed to fetch space:",s),s}},async fetchMySpaces(e=!1){const t=ie(),o="my-spaces";if(!e){const u=t.get(o);if(u)return this.mySpaces=u,u}this.mySpacesLoading=!0;try{const u=await this.$api.get("spaces/my-spaces"),s=u.spaces||u;return this.mySpaces=s,s.forEach(n=>{this.spacesBySlug[n.slug]=n}),t.set(o,s,10*60*1e3),this.mySpacesLoading=!1,s}catch(u){throw this.mySpacesLoading=!1,console.error("Failed to fetch my spaces:",u),u}},async joinSpace(e,t=null){var n,m,f;const o=ie(),u=t||this.spacesBySlug[e];if(!u)throw new Error("Space not found");const s=((n=u.user_status)==null?void 0:n.status)==="active";s||(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`),y=(m=h.membership)==null?void 0:m.status;if(y&&(u.user_status.status=y),y&&y!=="active"&&!s){u.members_count=Math.max(0,(u.members_count||1)-1);const w=this.mySpaces.findIndex(b=>b.slug===e);w!==-1&&this.mySpaces.splice(w,1)}return o.invalidate(`space:${e}`),o.invalidate("my-spaces"),(f=window.fluentFrameworkApp)!=null&&f.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_joined",u),h}catch(h){if(!s){u.user_status.status=null,u.members_count=Math.max(0,(u.members_count||1)-1);const y=this.mySpaces.findIndex(w=>w.slug===e);y!==-1&&this.mySpaces.splice(y,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,y;const t=ie(),o=this.spacesBySlug[e];if(!o)throw new Error("Space not found");const u=((m=o.user_status)==null?void 0:m.status)==="active",s=(f=o.user_status)==null?void 0:f.status,n=o.members_count;if(u){o.user_status.status=null,o.members_count=Math.max(0,(o.members_count||1)-1);const w=this.mySpaces.findIndex(b=>b.slug===e);w!==-1&&this.mySpaces.splice(w,1)}try{const w=await this.$api.post(`spaces/${e}/leave`),b=w.space||w;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"),(y=window.fluentFrameworkApp)!=null&&y.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(w){throw u&&(o.user_status.status=s,o.members_count=n,this.mySpaces.push(o)),console.error("Failed to leave space:",w),w}},async fetchSpaceTopics(e,t=!1){const o=ie(),u=`space-topics:${e}`;if(!t){const s=o.get(u);if(s)return this.topicsBySpace[e]=s,s}try{const s=await this.$api.get(`spaces/${e}/topics`),n=s.topics||s;return this.topicsBySpace[e]=n,o.set(u,n,30*60*1e3),n}catch(s){throw console.error("Failed to fetch space topics:",s),s}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=ie();t.invalidate(`space:${e}`),t.invalidate(`space-topics:${e}`),delete this.lastFetched[e]},clearAll(){this.spacesBySlug={},this.currentSpace=null,this.mySpaces=[],this.topicsBySpace={},this.loading={},this.mySpacesLoading=!1,this.lastFetched={};const e=ie();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),os=Oe("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 o=await this.$api.get("notifications",{page:t,per_page:this.pagination.per_page});return e?this.notifications=[...this.notifications,...o.notifications.data]:this.notifications=o.notifications.data,this.pagination={page:t,per_page:this.pagination.per_page,total:o.notifications.total,has_more:o.notifications.has_more},this.unreadCount=o.unread_count||0,this.lastFetched=Date.now(),this.loading=!1,o}catch(o){throw this.loading=!1,console.error("Failed to fetch notifications:",o),o}},async fetchUnreadCount(){try{const e=await this.$api.get("notifications/unread-count");return this.unreadCount=e.count||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 o;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{await this.$api.post(`notifications/${e}/mark-read`),(o=window.fluentFrameworkApp)!=null&&o.$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(s=>s.object_id===e&&!s.is_read),o=this.unreadCount;t.forEach(s=>{s.is_read=!0}),this.unreadCount=Math.max(0,this.unreadCount-t.length);try{await this.$api.post(`notifications/mark-read-by-feed/${e}`),(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feed_notifications_read",e)}catch(s){throw t.forEach(n=>{n.is_read=!1}),this.unreadCount=o,console.error("Failed to mark feed notifications as read:",s),s}},async markAllAsRead(){var o;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"),(o=window.fluentFrameworkApp)!=null&&o.$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"))},async deleteNotification(e){const t=this.notifications.findIndex(u=>u.id===e);let o=null;t!==-1&&(o=this.notifications[t],this.notifications.splice(t,1),o.is_read||(this.unreadCount=Math.max(0,this.unreadCount-1)));try{await this.$api.delete(`notifications/${e}`)}catch(u){throw o&&t!==-1&&(this.notifications.splice(t,0,o),o.is_read||this.unreadCount++),console.error("Failed to delete notification:",u),u}},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()}}}),xs=Oe("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,paused:!1,visibilityHandler:null}),getters:{isActive:e=>e.enabled&&e.tickerInterval!==null,isPaused:e=>e.paused},actions:{start(e=45e3,t=75e3,o=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: ${o}ms)`),this.setupVisibilityHandler(),console.log(`[Global Ticker] First check scheduled in ${(o/1e3).toFixed(1)} seconds`),setTimeout(()=>{this.enabled&&(this.check(),this.scheduleNextCheck())},o)},scheduleNextCheck(){const 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(()=>{this.paused||this.check(),this.enabled&&this.scheduleNextCheck()},e)},stop(){this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null,this.enabled=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),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 n;const{feeds:t=[],notifications:o={},spaces:u=[],has_changes:s=!1}=e;if(o&&o.unread_count!==void 0&&this.processNotificationUpdates(o),!!s&&(console.log("[Global Ticker] Processing updates:",{feeds:t.length,notifications:o.unread_count||0,spaces:u.length}),t.length>0&&await this.processFeedUpdates(t),u.length>0&&this.processSpaceUpdates(u),(n=window.fluentFrameworkApp)!=null&&n.$eventBus)){const m={...e,unread_notification_count:o.unread_count||0};window.fluentFrameworkApp.$eventBus.emit("ticker_updated",m)}},async processFeedUpdates(e){console.log("[Ticker Debug] processFeedUpdates called with:",e);const t=Le();e.forEach(o=>{var m;const u=o.context||"global",s=o.id,n=[u];if(o.action!=="deleted"&&(u.startsWith("space-")&&n.push("global"),o.user_id&&n.push(`user-${o.user_id}`)),o.action==="deleted")console.log(`[Global Ticker] Deleting feed ${s} from contexts:`,n),n.forEach(f=>{t.deleteFeedsFromStore(f,[s])});else if(o.feed_data){const f=o.feed_data;console.log(`[Global Ticker] Updating feed ${s} in contexts:`,n),n.forEach(h=>{t.feedsById[f.id]=f,t.feedsByContext[h]||(t.feedsByContext[h]={data:[],timestamp:Date.now()});const y=t.feedsByContext[h].data,w=y.findIndex(b=>b.id===f.id);w===-1?(y.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),o.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(y[w]=f,console.log(`[Global Ticker] Updated feed ${f.id} in ${h}`))}),(m=window.fluentFrameworkApp)!=null&&m.$eventBus&&n.forEach(h=>{window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:h,added:o.action==="created"?1:0,updated:o.action==="updated"?1:0,removed:0})})}else console.warn(`[Global Ticker] Feed ${s} has no feed_data, skipping update`)})},processNotificationUpdates(e){const t=os();e.unread_count!==void 0&&(t.unreadCount=e.unread_count),e.new_count>0&&console.log("[Global Ticker] New notifications:",e.new_count)},processSpaceUpdates(e){console.log("[Global Ticker] Space updates:",e.length)},handleError(e){e.xhr_status!==404&&console.error("[Global Ticker] Check failed:",e),this.errorCount++;const t=Math.min(6e4,1e3*Math.pow(2,this.errorCount));console.warn(`[Global Ticker] Backing off for ${t}ms`),setTimeout(()=>{this.enabled&&!this.paused&&this.check()},t)},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))}}}),nn={name:"ChatIcon"},ln={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function an(e,t,o,u,s,n){return i(),c("svg",ln,[...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 Xe=I(nn,[["render",an]]),rn={name:"HeartIcon",props:{filled:{default:!1}}},cn={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},dn={key:1,viewBox:"0 0 24 24","aria-hidden":"true"};function un(e,t,o,u,s,n){return o.filled?(i(),c("svg",cn,[...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)])])):(i(),c("svg",dn,[...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 et=I(rn,[["render",un]]),_n={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:Xe,HeartIcon:et},props:["notifications"],methods:{markRead(e){e.subscriber&&e.subscriber.is_read==1||this.$post("notifications/mark-read/"+e.id).then(t=>{const o=e.feed_id;this.notifications.forEach(u=>{u.subscriber&&(u.id===e.id||o&&u.feed_id===o)&&(u.subscriber.is_read=1)}),this.$eventBus.emit("notification_count_updated",t.unread_count)})},getNotificationRoute(e){const{route:t,action:o,object_id:u,feed_id:s}=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:s}}[o]??t.query??{}}}}},mn={class:"notification_avatar"},hn={class:"fcom_notification_type"},fn={class:"notification_content"},pn=["innerHTML"],gn=["title"];function yn(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("ChatIcon"),h=j,y=g("HeartIcon"),w=g("router-link");return i(!0),c(M,null,R(o.notifications,(b,C)=>{var p;return i(),c("div",{class:H(["notification_wrap",{notification_wrap_unread:((p=b==null?void 0:b.subscriber)==null?void 0:p.is_read)=="0"}])},[a(w,{onClick:k=>n.markRead(b,C),to:n.getNotificationRoute(b),class:"notification_item"},{default:r(()=>[l("div",mn,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",hn,[b.action=="comment_added"||b.action=="child_comment_added"?(i(),v(h,{key:0,class:"fcom_nt_comment"},{default:r(()=>[a(f)]),_:1})):b.action=="feed/react_added"||b.action=="comment/react_added"?(i(),v(h,{key:1,class:"fcom_nt_heart"},{default:r(()=>[a(y,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(i(),v(h,{key:2,class:"fcom_nt_mention"},{default:r(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(i(),v(h,{key:3,class:"fcom_new_post"},{default:r(()=>[...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",fn,[l("div",{innerHTML:b.content},null,8,pn),l("span",{title:b.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(b.updated_at)),9,gn)])]),_:2},1032,["onClick","to"])],2)}),256)}const Os=I(_n,[["render",yn]]),vn={name:"NotificationIcon"},bn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function kn(e,t,o,u,s,n){return i(),c("svg",bn,[...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 wn=I(vn,[["render",kn]]),Cn={name:"Notifications",components:{NotificationsBlock:Os,NotificationIcon:wn},data(){return{unread_notifications:[],unread_count:parseInt(this.appVars.unread_notification_count),loading:!1,working:!1,visible:!1,notification_type:"all"}},methods:{switchType(e){this.notification_type=e,this.fetchUnread()},toggleNotifications(){this.loading=!0,this.visible=!this.visible,this.visible?this.fetchUnread():this.loading=!1},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 o;this.unread_notifications=((o=t.notifications)==null?void 0:o.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",t=>{this.appVars.unread_notification_count=t.unread_notification_count,this.unread_count=t.unread_notification_count}),this.$eventBus.on("notification_count_updated",t=>{this.appVars.unread_notification_count=t,this.unread_count=t}),this.$eventBus.on("feed_interaction",t=>{t=t+"",this.appVars.unread_feed_ids&&this.appVars.unread_feed_ids.indexOf(t)!==-1&&this.$post("notifications/mark-read/"+t+"/by-feed-id").then(o=>{this.unread_count=o.unread_notification_count,this.appVars.unread_feed_ids=o.unread_feed_ids})})},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this._scrollClose&&document.removeEventListener("fcom_layout_scroll",this._scrollClose)}},$n={class:"fcom_menu_button",ref:"notification_icon"},Sn={class:"notifications_wrap unread_notifications"},Vn={class:"norification_pop_header"},Ln={class:"fcom_filter_menu"},Mn={class:"fcom_filter_menu_ul"},Fn={key:2,class:"fcom_no_unread_notifications"};function Tn(e,t,o,u,s,n){const m=g("NotificationIcon"),f=j,h=To,y=x,w=Y,b=g("notifications-block"),C=g("router-link"),p=fe,k=J("loading");return i(),v(p,{popperClass:"notification_pop","popper-options":{strategy:"fixed"},onBeforeEnter:t[7]||(t[7]=$=>n.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:r(()=>[a(h,{max:20,hidden:!s.unread_count,value:s.unread_count,class:"item"},{default:r(()=>[l("button",$n,[a(f,null,{default:r(()=>[a(m)]),_:1})],512)]),_:1},8,["hidden","value"])]),default:r(()=>[l("div",Sn,[l("div",Vn,[l("h3",null,d(e.$t("Recent Notifications")),1),l("div",null,[G((i(),v(y,{disabled:s.working,size:"small",onClick:t[0]||(t[0]=$=>n.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[k,s.working]])])]),l("div",Ln,[l("ul",Mn,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z($=>n.switchType("all"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="all"}),href:"#"},d(e.$t("Recent")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z($=>n.switchType("unread"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z($=>n.switchType("mentioned"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z($=>n.switchType("following"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),s.loading?(i(),v(w,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):s.unread_notifications.length?(i(),c("div",{key:1,onClick:t[6]||(t[6]=$=>e.$refs.notification_pop.hide()),class:"notifications fcom_thin_scrollbar"},[a(b,{onClose:t[5]||(t[5]=$=>n.handleClose()),notifications:s.unread_notifications},null,8,["notifications"])])):(i(),c("div",Fn,[l("p",null,d(e.$t("No notifications found")),1)])),a(C,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:n.handleClose},{default:r(()=>[a(y,{class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"])])]),_:1},512)}const Pn=I(Cn,[["render",Tn]]),In={name:"ImageUploader",emits:["uploaded","completed","uploading"],data(){return{loading:!1}},props:{button_text:{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 Un(e,t,o,u,s,n){const m=x,f=ut,h=g("CloseBold"),y=j,w=J("loading");return i(),c(M,null,[a(f,{class:H(o.className),multiple:o.isMultiple,action:n.action_url,headers:n.headers,accept:"image/*",data:o.additionalData,"on-success":n.handleSuccess,"on-progress":n.inProgress,"on-error":n.handleError,"show-file-list":!1},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[G((i(),v(m,{disabled:s.loading,text:o.isTextBtn,class:"fcom_plain_button"},{default:r(()=>[V(d(o.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[w,s.loading]])])])]),_:3},8,["class","multiple","action","headers","data","on-success","on-progress","on-error"]),o.can_remove?(i(),v(m,{key:0,class:"remove_img",size:"small",type:"danger",plain:"",onClick:n.handleRemove,text:o.isTextBtn},{default:r(()=>[q(e.$slots,"remove",{},()=>[o.removeIcon?(i(),v(y,{key:0},{default:r(()=>[a(h)]),_:1})):_("",!0),l("span",null,d(e.$t("Remove")),1)])]),_:3},8,["onClick","text"])):_("",!0)],64)}const je=I(In,[["render",Un]]),En={name:"ImageIcon"},Bn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function An(e,t,o,u,s,n){return i(),c("svg",Bn,[...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 is=I(En,[["render",An]]),Dn={name:"PollIcon"},Rn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Hn(e,t,o,u,s,n){return i(),c("svg",Rn,[...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 xn=I(Dn,[["render",Hn]]),On={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)}}},jn={class:"fcom_compose_app_form"},Nn={class:"fcom_app_header"},zn={class:"fcom_app_options"},qn={class:"fcom_app_pref"},Gn={class:"fcom_app_footer"},Yn={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function Wn(e,t,o,u,s,n){const m=x,f=X,h=g("Plus"),y=j,w=pe,b=Ye;return i(),c("div",jn,[l("div",Nn,[l("h5",null,d(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=C=>e.$emit("cancel")),size:"small",text:""},{default:r(()=>[V(d(e.$t("cancel")),1)]),_:1})])]),l("div",zn,[(i(!0),c(M,null,R(o.form.options,(C,p)=>(i(),c("div",{class:"fcom_app_option",key:"option_"+p},[a(f,{modelValue:C.label,"onUpdate:modelValue":k=>C.label=k,type:"text",placeholder:e.$t("Your option text")},ve({_:2},[!C.slug&&p!==0?{name:"suffix",fn:r(()=>[a(m,{onClick:k=>n.removeOption(p),text:"",size:"small"},{default:r(()=>[...t[3]||(t[3]=[V("x",-1)])]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",qn,[a(m,{onClick:n.addOption,text:"",size:"small"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",Gn,[l("h5",null,d(e.$t("Poll Settings")),1),o.is_editing?_("",!0):(i(),v(w,{key:0,modelValue:o.form.type,"onUpdate:modelValue":t[1]||(t[1]=C=>o.form.type=C),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),t[4]||(t[4]=l("br",null,null,-1)),l("label",Yn,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:o.form.end_date,"onUpdate:modelValue":t[2]||(t[2]=C=>o.form.end_date=C),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const Zn=I(On,[["render",Wn]]),Kn={name:"GiphyIcon"},Jn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Qn(e,t,o,u,s,n){return i(),c("svg",Jn,[...t[0]||(t[0]=[Pe('<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 Xn=I(Kn,[["render",Qn]]),el={name:"Giphy",components:{GiphyIcon:Xn},data(){return{gifs:[],searchQuery:"",offset:0,limit:20,loading:!1}},methods:{loadGifs(){var t,o;if(((o=(t=this.$gloablStorage)==null?void 0:t.gifs)==null?void 0:o.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:Di(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()}}},tl={class:"fcom_giphy_composer"},sl={class:"search-container"},ol=["onLoad","src","alt","onClick"],il={key:0,class:"img_loading"},nl={key:1,class:"no_result"};function ll(e,t,o,u,s,n){const m=X,f=_t,h=mt,y=g("GiphyIcon"),w=j,b=x,C=fe,p=J("loading");return i(),c("div",tl,[a(C,{placement:"bottom-end",width:300,persistent:!1,trigger:"click","popper-class":"fcom_giphy_popover",ref:"popover"},{reference:r(()=>[a(b,{"aria-label":"Pick GIF",text:"",onClick:n.handleGiphyClick},{default:r(()=>[a(w,{class:H(["fcom_apps_icon"])},{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClick"])]),default:r(()=>[G((i(),c("div",sl,[a(m,{modelValue:s.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=k=>s.searchQuery=k),placeholder:e.$t("Search Gifs"),onInput:n.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...k)=>n.handleScroll&&n.handleScroll(...k))},[s.gifs.length>0?(i(),v(h,{key:0,gutter:5},{default:r(()=>[(i(!0),c(M,null,R(s.gifs,k=>(i(),v(f,{span:12,key:k.id,class:"gif_item"},{default:r(()=>[l("img",{alt:"",onLoad:$=>k.loaded=!0,src:k.images.preview_gif.url,onClick:$=>n.selectGiphy(k)},null,40,ol),k.loaded?_("",!0):(i(),c("p",il))]),_:2},1024))),128))]),_:1})):(i(),c("p",nl,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))])),[[p,s.loading]])]),_:1},512)])}const al=I(el,[["render",ll]]),rl={name:"VideoIcon"},cl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function dl(e,t,o,u,s,n){return i(),c("svg",cl,[...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 ul=I(rl,[["render",dl]]);const _l={name:"FluentPlayerPreview",emits:["load-failed"],props:{media:{type:Object,required:!0}},data(){return{html:"",loading:!1,playerInstanceKey:""}},watch:{"media.url"(){this.loadFluentPlayerContent()}},async mounted(){await this.loadFluentPlayerContent()},methods:{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,s,n,m,f,h,y,w,b,C,p,k;const e=Number.parseInt((u=this.media)==null?void 0:u.media_id,10);if(Number.isSafeInteger(e)&&e>0)return e;const t=[(s=this.media)==null?void 0:s.media_key,(n=this.media)==null?void 0:n.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,(y=this.media)==null?void 0:y.url,(w=this.media)==null?void 0:w.html,(b=this.media)==null?void 0:b.title,(C=this.media)==null?void 0:C.player,(p=this.media)==null?void 0:p.type,(k=this.media)==null?void 0:k.provider].filter(Boolean).join("|");if(!t)return 1;let o=5381;for(let $=0;$<t.length;$++)o=(o<<5)+o+t.charCodeAt($)>>>0;return o||1},async loadFluentPlayerContent(){this.loading=!0;try{if(!this.appVars.features.has_fluent_player||this.appVars.features.enable_fluent_player!=="yes"){this.$emit("load-failed");return}const e=this.getStableMediaId(),t=await this.$get("fluent-player/video-content/"+e,{...this.media,media_id:e,player_instance_key:this.getPlayerInstanceKey()});t.html?(this.html=t.html,this.$nextTick(()=>{const o=this.$el.querySelector(".fluent-player");document.dispatchEvent(new CustomEvent("InitSingleFluentPlayer",{detail:{container:o,playerData:{media:t.media}}}))})):this.$emit("load-failed")}catch(e){console.warn("Failed to load fluent-player assets:",e),this.$emit("load-failed")}finally{this.loading=!1}}}},ml={class:"fluent-player-preview"},hl={key:0,class:"player-container"},fl=["innerHTML"];function pl(e,t,o,u,s,n){const m=Y;return i(),c("div",ml,[s.html?(i(),c("div",hl,[l("div",{innerHTML:s.html},null,8,fl)])):_("",!0),s.loading?(i(),v(m,{key:1,animated:"",rows:5})):_("",!0)])}const gl=I(_l,[["render",pl],["__scopeId","data-v-53b0e6e6"]]);const yl={name:"MediaPreview",components:{Postcard:xo,FluentPlayerPreview:gl},props:["feed","media_item","is_single"],data(){return{is_error:!1,isPlaying:!1,fluentPlayerFailed:!1}},watch:{"media.url"(){this.fluentPlayerFailed=!1}},computed:{media(){var e;return this.feed?(e=this.feed.meta)==null?void 0:e.media_preview:this.media_item},playerMedia(){var e,t,o,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:((o=this.feed)==null?void 0:o.permalink)||((u=this.media)==null?void 0:u.share_url)||""}},isVideoMedia(){return["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:{getDomainName(e){return e?e.split("/")[2].replace("www.",""):""},isSupportedByFluentPlayer(){var o,u;const e=((u=(o=this.media)==null?void 0:o.settings)==null?void 0:u.src)||this.media.url;return!e||!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)(\?.*)?$/i}].some(s=>s.regex.test(e))},getAspectRatio(e,t){if(e&&t){let o=e/t;return o<1?16/9:o}return 16/9},handleImageError(){this.is_error=!0},getVideoType(e){const t={mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg"},o=e.split(".").pop().toLowerCase();return t[o]||"video/mp4"},playVideo(){this.$refs.nativeVideo&&this.$refs.nativeVideo.play()},onVideoPause(){this.$refs.nativeVideo&&this.$refs.nativeVideo.currentTime>0&&(this.isPlaying=!0)}}},vl={key:0},bl={key:1},kl=["innerHTML"],wl=["controls","preload","poster"],Cl=["src","type"],$l=["href"],Sl={key:0,class:"feed_media_image"},Vl={key:1,class:"feed_media_content"},Ll={class:"media_domain"},Ml={class:"feed_media_title"},Fl={key:0,class:"feed_media_description"},Tl={class:"feed_meta_desc"};function Pl(e,t,o,u,s,n){const m=g("fluent-player-preview"),f=Y,h=Ie;return i(),c("div",{class:H(["feed_media","feed_media_"+n.media.type])},[n.isVideoMedia?(i(),c(M,{key:0},[n.hasFluentPlayer&&n.isSupportedByFluentPlayer()&&!s.fluentPlayerFailed?(i(),c("div",vl,[a(m,{media:n.playerMedia,onLoadFailed:t[0]||(t[0]=y=>s.fluentPlayerFailed=!0)},null,8,["media"])])):n.media.html?(i(),c("div",bl,[l("div",{class:"feed_media_ext_video",innerHTML:n.media.html},null,8,kl)])):n.media.url?(i(),c("div",{key:2,class:H(["native_video_wrapper",{video_playing:s.isPlaying}])},[l("video",{ref:"nativeVideo",class:"native_video_player",controls:s.isPlaying,preload:o.is_single?"metadata":"none",poster:n.media.thumbnail,onPlay:t[1]||(t[1]=y=>s.isPlaying=!0),onPause:t[2]||(t[2]=(...y)=>n.onVideoPause&&n.onVideoPause(...y)),onEnded:t[3]||(t[3]=y=>s.isPlaying=!1)},[l("source",{src:n.media.url,type:n.getVideoType(n.media.url)},null,8,Cl)],40,wl),s.isPlaying?_("",!0):(i(),c("div",{key:0,class:"native_video_overlay",onClick:t[4]||(t[4]=(...y)=>n.playVideo&&n.playVideo(...y))},[...t[6]||(t[6]=[l("div",{class:"native_play_button"},[l("svg",{viewBox:"0 0 24 24",fill:"currentColor"},[l("path",{d:"M8 5v14l11-7z"})])],-1)])]))],2)):_("",!0)],64)):n.media.type=="image"||n.media.is_uploaded?(i(),c("div",{key:1,class:H(["feed_media_provider_"+n.media.provider,"feed_media_image feed_custom_uploaded"])},[n.media.image&&!s.is_error?(i(),v(h,{key:0,alt:"",style:le({width:"100%",aspectRatio:n.getAspectRatio(n.media.width,n.media.height)}),src:n.media.image,lazy:!0,previewSrcList:[n.media.image],loading:"lazy",onError:n.handleImageError,"zoom-rate":1.2,"max-scale":7,"hide-on-click-modal":!0,"preview-teleported":!0,"min-scale":.2,"initial-index":1,class:H("fcom_media_provider_"+n.media.provider),fit:"scale-down"},{placeholder:r(()=>[a(f,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(i(),c("a",{key:2,href:n.media.url,target:"_blank",rel:"noopener",class:"feed_media_link"},[n.media.image&&!s.is_error?(i(),c("div",Sl,[a(h,{onError:t[5]||(t[5]=y=>n.handleImageError()),style:{width:"100%"},src:n.media.image},{error:r(()=>[...t[7]||(t[7]=[l("span",null,null,-1)])]),_:1},8,["src"])])):_("",!0),n.media.title?(i(),c("div",Vl,[l("div",Ll,d(n.getDomainName(n.media.url)),1),l("div",Ml,d(e.getExcerpt(n.media.title,88)),1),n.media.description?(i(),c("div",Fl,[l("div",Tl,d(e.getExcerpt(n.media.description,160)),1)])):_("",!0)])):_("",!0)],8,$l))],2)}const De=I(yl,[["render",Pl],["__scopeId","data-v-c28b0c69"]]);const Il=[{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)(\?.*)?$/i}],Ul={name:"FluentPlayerUploader",components:{UploadFilled:$t},emits:["video-added","completed","uploading"],props:{className:{type:String,default:"video-uploader"},type:{type:String,default:"url"}},data(){return{videoUrl:"",processing:!1}},computed:{uploadData(){return{context:"fluent_player"}},action_url(){return this.appVars.rest.url+"/fluent-player/video-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{async handleUrlSubmit(){if(!this.videoUrl)return;const e=Il.some(o=>o.regex.test(this.videoUrl));let t={};e?t={type:"oembed",url:this.videoUrl,html:"",content_type:"video",player:"fluent_player",media_id:new Date().getTime()}:t={type:"oembed",url:this.videoUrl,html:"",content_type:"video"},this.$emit("video-added",t)},handleVideoUploadSuccess(e){var t;try{if(!e||!e.media||!e.media.url)throw new Error("Invalid response: missing media.url");const{media:o}=e,u={type:"upload",url:o.url,player:"fluent_player",provider:"upload",content_type:"video",html:"",title:((t=o.settings)==null?void 0:t.title)||"",media_id:o.media_id};this.$emit("video-added",u)}catch(o){console.error("[FluentPlayerUploader] handleVideoUploadSuccess error:",o,e)}finally{this.$emit("completed",e),this.processing=!1}},handleError(e){try{const t=(e==null?void 0:e.message)||e;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}}},El=["element-loading-text"],Bl={key:0,class:"upload-options"},Al={class:"uploader-content"},Dl={class:"el-upload__text"},Rl={key:1,class:"url-input-section"};function Hl(e,t,o,u,s,n){const m=g("upload-filled"),f=j,h=x,y=ut,w=X,b=J("loading");return G((i(),c("div",{class:"fluent-player-uploader","element-loading-text":e.$t("Uploading video..."),"element-loading-background":"rgba(255, 255, 255, 0.85)"},[o.type==="upload"?(i(),c("div",Bl,[a(y,{drag:"",class:H([o.className,"video-drag-uploader"]),multiple:!1,action:n.action_url,headers:n.headers,accept:"video/*",data:n.uploadData,"on-success":n.handleVideoUploadSuccess,"on-progress":n.inProgress,"on-error":n.handleError,"show-file-list":!1,disabled:s.processing},{default:r(()=>[l("div",Al,[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",Dl,[V(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:s.processing,disabled:s.processing},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[V(d(s.processing?e.$t("Uploading..."):e.$t("Upload Video")),1)])])]),_:3},8,["loading","disabled"])])]),_:3},8,["class","action","headers","data","on-success","on-progress","on-error","disabled"])])):(i(),c("div",Rl,[a(w,{modelValue:s.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=C=>s.videoUrl=C),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:r(()=>[a(h,{onClick:n.handleUrlSubmit,loading:s.processing},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,El)),[[b,s.processing]])}const xl=I(Ul,[["render",Hl]]),Ol={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:De,FluentPlayerUploader:xl},computed:{showPreview(){return this.media.html&&!this.showInput},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},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}},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(){this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1},handleFluentPlayerVideo(e){if(Object.assign(this.media,e),this.media.player==="fluent_player"&&this.media.type==="upload"){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()}},jl={key:0},Nl={key:0,class:"fcom_media_editor_actions"},zl={key:1,class:"fcom_media_editor fcom_media_embeder"},ql={key:0},Gl={key:1},Yl={key:2,class:"fcom_course_media"};function Wl(e,t,o,u,s,n){var p;const m=x,f=We,h=be,y=X,w=g("fluent-player-uploader"),b=g("media-preview"),C=J("loading");return s.appReady?G((i(),c("div",jl,[o.has_iframe||n.hasUpload?(i(),c("div",Nl,[n.showPreview?(i(),v(m,{key:0,onClick:t[0]||(t[0]=k=>s.showInput=!0),type:"danger",size:"small",text:""},{default:r(()=>[V(d(e.$t("Edit media")),1)]),_:1})):(i(),v(h,{key:1,onChange:t[1]||(t[1]=k=>{o.media.html="",o.media.url="",s.showInput=!0}),size:"small",modelValue:o.media.type,"onUpdate:modelValue":t[2]||(t[2]=k=>o.media.type=k)},{default:r(()=>[a(f,{label:e.$t("Oembed"),value:"oembed"},null,8,["label"]),o.has_iframe?(i(),v(f,{key:0,label:e.$t("HTML Code"),value:"iframe_html"},null,8,["label"])):_("",!0),n.hasUpload?(i(),v(f,{key:1,label:e.$t("Upload Video"),value:"upload"},null,8,["label"])):_("",!0)]),_:1},8,["modelValue"]))])):_("",!0),n.showPreview?(i(),c("div",Yl,[a(b,{media_item:o.media},null,8,["media_item"])])):(i(),c("div",zl,[o.media.type=="iframe_html"&&o.has_iframe?(i(),c(M,{key:0},[l("h3",null,d(e.$t("Add Video from custom HTML Code")),1),a(y,{rows:5,modelValue:o.media.html,"onUpdate:modelValue":t[3]||(t[3]=k=>o.media.html=k),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]=k=>n.handleAddCustomHtml())},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1})],64)):(i(),c(M,{key:1},[l("h3",null,d(o.box_title||e.$t("Featured media")),1),n.hasFluentPlayerInstalled&&o.media.type==="upload"?(i(),c("p",ql,d(e.$t("The file must be a valid video type (MP4, M3U8, MPD, WebM, MOV)")),1)):(i(),c("p",Gl,d(o.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),n.hasFluentPlayer&&(o.media.type==="upload"||n.playEmbeddedVideos)?(i(),v(w,{key:2,type:((p=o.media)==null?void 0:p.type)==="upload"?"upload":"url",onVideoAdded:n.handleFluentPlayerVideo},null,8,["type","onVideoAdded"])):(i(),v(y,{key:3,onKeydown:he(n.fetchData,["enter"]),size:"large",modelValue:o.media.url,"onUpdate:modelValue":t[5]||(t[5]=k=>o.media.url=k),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:r(()=>[a(m,{onClick:n.fetchData,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[C,s.fetching]]):_("",!0)}const ns=I(Ol,[["render",Wl]]),Zl={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:ns,VideoIcon:ul},data(){return{videoUrl:"",showVideoPop:!1,media:{type:"oembed",url:"",inner_html:"",content_type:"video"}}},methods:{show(){this.showVideoPop=!0},embeded(e){this.$emit("embeded",e),this.showVideoPop=!1,this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}}}},Kl={class:"fcom_video_embeder"};function Jl(e,t,o,u,s,n){const m=g("VideoIcon"),f=j,h=x,y=g("media-embeder"),w=$e;return i(),c("div",Kl,[a(h,{"aria-label":"Add Video",text:"",onClick:n.show},{default:r(()=>[a(f,{class:H(["fcom_apps_icon"])},{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClick"]),s.showVideoPop?(i(),v(w,{key:0,title:e.$t("Attach Video"),modelValue:s.showVideoPop,"onUpdate:modelValue":t[0]||(t[0]=b=>s.showVideoPop=b),width:e.dialogWidth,style:{"max-width":"600px"},"append-to-body":!0},{default:r(()=>[a(y,{box_title:e.$t("Add Featured Video for this post"),has_iframe:o.is_admin,is_feed:!0,onEmbeded:n.embeded,space:o.space,media:s.media},null,8,["box_title","has_iframe","onEmbeded","space","media"])]),_:1},8,["title","modelValue","width"])):_("",!0)])}const Ql=I(Zl,[["render",Jl]]),Xl="modulepreload",ea=function(e){return"/"+e},gs={},nt=function(t,o,u){if(!o||o.length===0)return t();const s=document.getElementsByTagName("link");return Promise.all(o.map(n=>{if(n=ea(n),n in gs)return;gs[n]=!0;const m=n.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let w=s.length-1;w>=0;w--){const b=s[w];if(b.href===n&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${f}`))return;const y=document.createElement("link");if(y.rel=m?"stylesheet":Xl,m||(y.as="script",y.crossOrigin=""),y.href=n,document.head.appendChild(y),m)return new Promise((w,b)=>{y.addEventListener("load",w),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>t()).catch(n=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=n,window.dispatchEvent(m),!m.defaultPrevented)throw n})};var js=(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))(js||{});const ta={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function sa(e,t,o){switch(e){case"link-tooltip":{const{defineFeature:u}=await nt(()=>import("./index.js?ver=2.6.0"),[]);return u(t,o)}case"block-edit":{const{defineFeature:u}=await nt(()=>import("./index2.js?ver=2.6.0"),[]);return u(t,o)}case"placeholder":{const{defineFeature:u}=await nt(()=>import("./index3.js?ver=2.6.0"),[]);return u(t,o)}case"toolbar":{const{defineFeature:u}=await nt(()=>import("./index4.js?ver=2.6.0"),[]);return u(t,o)}case"image-block":{const{defineFeature:u}=await nt(()=>import("./index5.js?ver=2.6.0"),[]);return u(t,o)}}}const oa=xi([],"FeaturesCtx");function ia(e){return t=>{t.inject(oa,e)}}var ls=(e,t,o)=>{if(!t.has(e))throw TypeError("Cannot "+o)},ge=(e,t,o)=>(ls(e,t,"read from private field"),o?o.call(e):t.get(e)),ze=(e,t,o)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,o)},lt=(e,t,o,u)=>(ls(e,t,"write to private field"),u?u.call(e,o):t.set(e,o),o),na=(e,t,o)=>(ls(e,t,"access private method"),o),Ce,at,ct,gt,qe,qt,Ns;class zs{constructor({root:t,features:o={},featureConfigs:u={},defaultValue:s="",onUpdate:n=f=>{},handleCommonActions:m=(f,h)=>{}}){var w;ze(this,qt),ze(this,Ce,void 0),ze(this,at,void 0),ze(this,ct,void 0),ze(this,gt,!0),ze(this,qe,null);const f=Object.entries({...ta,...o}).filter(([,b])=>b).map(([b])=>b);lt(this,ct,(typeof t=="string"?document.querySelector(t):t)??document.body),lt(this,Ce,Oi.make().config(ia(f)).config(b=>{b.set(ji,ge(this,ct)),b.set(Ni,s),b.set(zi,{editable:()=>ge(this,gt)})}).config(b=>{const C=async(p,k)=>await m("handleFileUpload",{ctx:b,files:p,schema:k});b.update(qi.key,p=>({...p,uploader:C}))}).config(b=>{const C=b.get(Gi);C.markdownUpdated((p,k,$)=>{k!==$&&n(k)}),C.updated((p,k,$)=>{m("editor_updated",p)})}).use(Yi).use(Wi).use(Zi).use(Ki).use(Ji).use(Qi).use(Xi));const h=(w=u==null?void 0:u["block-edit"])==null?void 0:w.canAddImage;h&&ge(this,Ce).use(zt(()=>new Nt({filterTransaction:b=>b.docChanged?!b.steps.some(p=>{var $,S;let k=!1;return(S=($=p.slice)==null?void 0:$.content)==null||S.forEach(T=>{var F;T.type.name.includes("image")&&(k=!0),(F=T.content)==null||F.forEach(B=>{B.type.name.includes("image")&&(k=!0)})}),k})||h():!0}))),ge(this,Ce).use(zt(()=>new Nt({props:{handleTextInput(b,C,p,k){const $=b.state.schema.marks.link;if(k!==" "||!$)return!1;const S=b.state.doc.resolve(C),T=/(?:^|\s)((?:https?:\/\/|www\.)\S+)$/.exec(S.parent.textBetween(0,S.parentOffset,void 0,""));if(!T)return!1;const F=T[1].replace(/[.,)]+$/,""),B=C-T[1].length,L=B+F.length;if(b.state.doc.rangeHasMark(B,L,$))return!1;const D=(F.startsWith("http")?"":"https://")+F,A=b.state.tr.insertText(k,C).addMark(B,L,$.create({href:D})).removeStoredMark($);return b.dispatch(A),!0}},appendTransaction:(b,C,p)=>{const k=p.schema.marks.link,$=p.selection.$cursor;if(!k||!$||!b.some(A=>A.docChanged))return null;const S=A=>A==null?void 0:A.marks.find(U=>U.type===k);if((p.storedMarks??$.marks()).some(A=>A.type===k)&&!S($.nodeBefore)&&!S($.nodeAfter))return p.tr.removeStoredMark(k);const B=$.pos;if(B<1||p.doc.textBetween(B-1,B)!==" "||!p.doc.rangeHasMark(B-1,B,k))return null;const L=S(p.doc.resolve(B-1).nodeBefore),D=S(p.doc.resolve(B).nodeAfter);return D&&(L==null?void 0:L.attrs.href)===D.attrs.href?null:p.tr.removeMark(B-1,B,k).removeStoredMark(k)}}))),ge(this,Ce).use(zt(()=>{let b=!1,C=!1;return new Nt({view:p=>({update(){var L;const k=p.state.schema.marks.link,$=p.state.selection.$cursor,S=D=>D.type===k,T=!!k&&!!($!=null&&$.marks().some(S)),F=document.querySelector("milkdown-link-preview"),B=(F==null?void 0:F.style.display)==="none"&&!C;if(T&&!B){F&&C&&(F.style.display=""),C=!1;const D=p.coordsAtPos((L=$.nodeBefore)!=null&&L.marks.some(S)?$.pos-1:$.pos);p.dom.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,clientX:D.left+1,clientY:(D.top+D.bottom)/2}))}else!T&&b&&(p.dom.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0})),F&&(F.style.display="none"),C=!0);b=T}})})}));const y=[];f.forEach(b=>{const C=u[b];y.push(sa(b,ge(this,Ce),C))}),lt(this,at,Promise.all(y))}async create(){await ge(this,at);const t=await ge(this,Ce).create();return na(this,qt,Ns).call(this),t}async destroy(){var t;return(t=ge(this,qe))==null||t.disconnect(),await ge(this,at),ge(this,Ce).destroy()}get editor(){return ge(this,Ce)}setReadonly(t){return lt(this,gt,!t),this}getMarkdown(){return ge(this,Ce).action(en())}getEditor(){return ge(this,Ce)}destroyEditor(){this.destroy()}}Ce=new WeakMap;at=new WeakMap;ct=new WeakMap;gt=new WeakMap;qe=new WeakMap;qt=new WeakSet;Ns=function(){const e=ge(this,ct),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},o=u=>{const s=e.querySelector(u);s&&(ge(this,qe).observe(s,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(s),0))};lt(this,qe,new MutationObserver(u=>{const s=u[0];s.type==="childList"?(o("milkdown-link-edit"),o("milkdown-link-preview")):t(s.target)})),ge(this,qe).observe(e,{childList:!0,subtree:!0})};zs.Feature=js;const la={name:"CrepeEditor",emits:["update:modelValue","handleMediaUpload","editorCreated"],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:tn,ProsemirrorAdapterProvider:sn},data(){return{editor:null,currentContent:"",showMentionPop:!1,currentMentionSearch:"",mentionResults:[],justReplaced:!1,searchingMention:!1,hasUnsavedChanges:!1,pendingNavigation:null,activeUploadBlock:null}},watch:{autofocus_changed(e){e&&this.focusOnEditor()},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:{clearContent(){this.editor&&(this.editor.action(e=>{const t=e.get(it),{state:o}=t,u=o.tr.replaceWith(0,o.doc.content.size,o.schema.nodes.paragraph.create());t.dispatch(u)}),this.currentContent="")},updateContent(e){this.editor.action(t=>{const o=t.get(it),{state:u}=o,{from:s}=u.selection,n=e,m=u.tr.insertText(n,s),f=s+n.length,h=m.setSelection(ps.create(m.doc,f));o.dispatch(h),o.focus()})},initEditor(){const e=this,t=new zs({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 o=>{if(!this.onInlineUpload)return null;this.activeUploadBlock&&this.activeUploadBlock.classList.add("uploading");try{return await this.onInlineUpload(o)}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")}},onUpdate(o){o=o.replace(/!\[[^\]]*\]\(\s*\)/g,""),e.$emit("update:modelValue",o),e.currentContent=o},async handleCommonActions(o,u){if(o==="editor_updated"){if(e.disable_mention)return!1;e.checkforMention(u)}else if(o==="handleFileUpload")return e.disable_media?[]:await e.handleFileUpload(u)}});t.create().then(()=>{this.editor=t.getEditor(),this.focusOnEditor(),this.$emit("editorCreated")})},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const o=t.get(it),{state:u}=o;let s=null;e&&u.doc.descendants((m,f)=>{if(m.isText&&m.text){const h=m.text.lastIndexOf(e);h!==-1&&(s=f+h+e.length+1)}});const n=s!==null?Math.min(s,u.doc.content.size-1):Math.max(1,u.doc.content.size-1);o.dispatch(u.tr.setSelection(ps.create(u.doc,n))),o.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const o=e.get(it),{state:u}=o,{selection:s}=u;if(!s)return;const m=u.doc.textBetween(0,s.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(),y=this.defaultMentions.filter(w=>w.username.toLowerCase().includes(h)||w.display_name.toLowerCase().includes(h));y.length&&(this.currentMentionSearch=f,this.mentionResults=y,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)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+" "),this.editor.action(on(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 o=0;o<t.length;o++){const u=t.item(o);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)return;this.editor.action(o=>{const u=o.get(it),{state:s}=u,n=s.schema.nodes["image-block"];if(!n)return;const m=n.create({src:t,caption:"",ratio:1}),{$from:f}=s.selection,h=f.after(1),y=s.tr.insert(h,m);u.dispatch(y),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 o=t.getAttribute("href"),u=this.appVars.portal_url;if(!o)return;const s=o.startsWith(u)||o.startsWith("/"),n=o===window.location.href;s&&!n&&(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()))}},mounted(){this.initEditor(),window.addEventListener("beforeunload",this.handleBeforeUnload),document.addEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&this.$refs.crepe_editor_vue.addEventListener("click",this.handleImageBlockClick,!0),this.$eventBus.on("unsavedChangesProceeded",()=>{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)}})},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),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0))}},aa={style:{position:"relative"},class:"fcom_md_editor"},ra={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},ca={class:"fcom_mention_pop_wrap"},da={key:0},ua={key:0},_a=["onClick"],ma=["src"],ha={key:1};function fa(e,t,o,u,s,n){const m=g("ProsemirrorAdapterProvider"),f=g("MilkdownProvider"),h=fe;return i(),c(M,null,[a(f,null,{default:r(()=>[a(m,null,{default:r(()=>[l("div",aa,[l("div",ra,null,512)])]),_:1})]),_:1}),l("div",ca,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:s.showMentionPop,width:300,persistent:!1},{reference:r(()=>[...t[0]||(t[0]=[l("span",{style:{}},null,-1)])]),default:r(()=>[s.justReplaced?_("",!0):(i(),c("div",da,[s.mentionResults.length?(i(),c("ul",ua,[(i(!0),c(M,null,R(s.mentionResults,y=>(i(),c("li",{key:y.user_id,onClick:w=>n.addMention("@"+y.username)},[y.avatar?(i(),c("img",{key:0,alt:"",src:y.avatar},null,8,ma)):_("",!0),l("span",null,d(y.display_name)+" (@"+d(y.username)+")",1)],8,_a))),128))])):s.searchingMention?_("",!0):(i(),c("div",ha,[l("p",null,d(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const Vt=I(la,[["render",fa]]);const pa={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}},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 o,u,s,n,m;const t=(u=(o=this.$refs.popoverRef)==null?void 0:o.popperRef)==null?void 0:u.contentRef;t!=null&&t.contains(e.target)||(s=this.$refs.triggerRef)!=null&&s.contains(e.target)||(m=(n=e.target).closest)!=null&&m.call(n,".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 o=t[(e+t.length)%t.length];(u=o==null?void 0:o.focus)==null||u.call(o)},hideAndFocusTrigger(){this.hide(),this.$nextTick(()=>{var o,u;const e=this.$refs.triggerRef,t=((o=e==null?void 0:e.querySelector)==null?void 0:o.call(e,"button, a, [tabindex]"))||e;(u=t==null?void 0:t.focus)==null||u.call(t)})}},beforeUnmount(){document.removeEventListener("click",this.onClickOutside,!0)}},ga=["onClick","onKeydown"];function ya(e,t,o,u,s,n){const m=g("MoreFilled"),f=j,h=x,y=fe;return i(),v(y,{trigger:"manual",placement:o.placement,persistent:o.persistent,width:o.width,visible:s.visible,onAfterEnter:n.focusFirstItem,ref:"popoverRef"},{reference:r(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...w)=>n.toggle&&n.toggle(...w))},[q(e.$slots,"trigger",{},()=>[a(h,{"aria-label":e.$t("View actions"),"aria-haspopup":"menu","aria-expanded":s.visible,class:"fcom_action_popover_default_trigger_button",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded"])])],512)]),default:r(()=>[q(e.$slots,"default",{hide:n.hide},()=>[l("ul",{class:"actions_items",role:"menu","aria-orientation":"vertical",onKeydown:t[1]||(t[1]=he(z((...w)=>n.hideAndFocusTrigger&&n.hideAndFocusTrigger(...w),["prevent","stop"]),["esc"]))},[(i(!0),c(M,null,R(o.items,(w,b)=>(i(),c("li",{key:b,ref_for:!0,ref:"menuItems",class:H(["fcom_action_popover_item",w.type?"fcom_action_popover_item_"+w.type:""]),role:"menuitem",tabindex:"0",onClick:C=>n.handleAction(w),onKeydown:[he(z(C=>n.handleAction(w),["prevent"]),["enter"]),he(z(C=>n.handleAction(w),["prevent"]),["space"]),he(z(C=>n.focusItem(b+1),["prevent"]),["down"]),he(z(C=>n.focusItem(b-1),["prevent"]),["up"])]},d(w.label),43,ga))),128))],32)])]),_:3},8,["placement","persistent","width","visible","onAfterEnter"])}const as=I(pa,[["render",ya]]),va={name:"SmilyIcon"},ba={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ka(e,t,o,u,s,n){return i(),c("svg",ba,[...t[0]||(t[0]=[Pe('<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 wa=I(va,[["render",ka]]),Ca={name:"EmojiPicker",components:{Picker:Bi,ActionPopover:as,SmilyIcon:wa},emits:["emoji-selected"],props:{close_on_select:{type:Boolean,default:!1}},data(){return{emojiIndex:null,emojiLoading:!1,errorMessage:"",isLoading:!1}},methods:{onEmojiSelect(e,t){this.$emit("emoji-selected",e.native),this.close_on_select&&t&&t()},loadEmojiAssets(){if(this.isLoading)return;if(window.fcomEmojiIndex){this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1;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 Ai(t),this.emojiIndex=window.fcomEmojiIndex,this.emojiLoading=!1):this.errorMessage=this.$t("Emoji loading failed")}).catch(()=>{this.errorMessage=this.$t("Emoji loading failed")}).finally(()=>{this.isLoading=!1})}}},$a={class:"ffcom_emoji"},Sa={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},Va={key:0},La={style:{"text-align":"center","margin-bottom":"20px"}},Ma={key:1,class:"fcom_emoji_holder"};function Fa(e,t,o,u,s,n){const m=g("SmilyIcon"),f=j,h=x,y=Y,w=g("Picker"),b=g("action-popover");return i(),v(b,{ref:"fcom_emoji_popover","close-on-click-outside":!0,placement:"bottom",persistent:!1,"trigger-interactive":!0,width:350,onShow:n.loadEmojiAssets},{trigger:r(()=>[a(h,{"aria-label":"Pick Imoji",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(({hide:C})=>[l("div",$a,[s.emojiLoading?(i(),c("div",Sa,[s.errorMessage?(i(),c("div",Va,d(s.errorMessage),1)):(i(),c(M,{key:1},[l("div",La,d(e.$t("Loading.....")),1),a(y,{animated:!0,rows:3})],64))])):s.emojiIndex?(i(),c("div",Ma,[a(w,{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:s.emojiIndex,set:"twitter",onSelect:p=>n.onEmojiSelect(p,C),emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)])]),_:1},8,["onShow"])}const qs=I(Ca,[["render",Fa]]),Ta={name:"DocumentsUploader",components:{UploadFilled:$t,Document:St},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 o,u;(u=(o=t==null?void 0:t.response)==null?void 0:o.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))}}},Pa={class:"fcom_documents_uploader"},Ia={class:"el-upload__text"},Ua={key:0},Ea={class:"fcom_document_lists"},Ba={class:"fcom_each_document"},Aa={class:"fcom_document_info"},Da={class:"fcom_document_icon"},Ra={class:"fcom_document_title"},Ha={class:"fcom_document_actions"};function xa(e,t,o,u,s,n){const m=g("UploadFilled"),f=j,h=ut,y=g("Document"),w=x;return i(),c("div",Pa,[a(h,{action:n.action_url,headers:n.headers,"file-list":s.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>s.fileList=b),accept:"*/*",drag:"",class:"fcom_document_upload",multiple:o.is_multiple,data:o.additional_data,"show-file-list":o.showLists,"on-change":n.handleChange,"on-success":n.handleSuccess,"on-error":n.handleError,"on-remove":n.handleChange},{default:r(()=>[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",Ia,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"]),!o.showLists&&n.uploadingFiles.length?(i(),c("div",Ua,[l("div",Ea,[(i(!0),c(M,null,R(n.uploadingFiles,b=>(i(),c("div",Ba,[l("div",Aa,[l("div",Da,[a(f,null,{default:r(()=>[a(y)]),_:1})]),l("span",Ra,d(b.name),1)]),l("div",Ha,[a(w,{text:"",size:"small",loading:!0},{default:r(()=>[V(d(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const Oa=I(Ta,[["render",xa]]),ja={name:"PdfIcon"},Na={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function za(e,t,o,u,s,n){return i(),c("svg",Na,[...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 qa=I(ja,[["render",za]]),Ga={name:"ZipIcon"},Ya={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Wa(e,t,o,u,s,n){return i(),c("svg",Ya,[...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 Za=I(Ga,[["render",Wa]]),Ka={name:"AudioIcon"},Ja={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Qa(e,t,o,u,s,n){return i(),c("svg",Ja,[...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 Xa=I(Ka,[["render",Qa]]),er={name:"DocIcon"},tr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function sr(e,t,o,u,s,n){return i(),c("svg",tr,[...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 or=I(er,[["render",sr]]),ir={name:"VideoFileIcon"},nr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function lr(e,t,o,u,s,n){return i(),c("svg",nr,[...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 ar=I(ir,[["render",lr]]);const rr={name:"DocumentLists",components:{Document:St,Download:Oo,PdfIcon:qa,ImageIcon:is,ZipIcon:Za,AudioIcon:Xa,DocIcon:or,VideoFileIcon:ar},props:["document_lists","additional_data","is_editable"],emits:["fileRemoved","documentsUpdated"],data(){return{editingIndex:null,isSaving:!1}},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(o=>{this.$notify.success(o.message),this.document_lists.splice(e,1),this.$emit("documentsUpdated",this.document_lists)}).catch(o=>{this.$handleError(o)}).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"},saveDoc(e){this.isSaving=!0,this.$post("documents/update",{id:e.id,title:e.title,...this.additional_data}).then(t=>{this.$notify.success(t.message),this.isSaving=!1,this.editingIndex=null,this.$emit("documentsUpdated",this.document_lists)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.isSaving=!1})}}},cr={class:"fcom_document_lists"},dr={class:"fcom_each_document"},ur={class:"fcom_document_info"},_r={class:"fcom_document_icon"},mr=["href"],hr=["onClick"],fr={class:"fcom_document_actions"},pr=["href"];function gr(e,t,o,u,s,n){const m=j,f=g("EditPen"),h=x,y=X,w=g("Download"),b=g("DeleteFilled"),C=J("loading");return i(),c("div",cr,[(i(!0),c(M,null,R(o.document_lists,(p,k)=>(i(),c("div",dr,[l("div",ur,[l("div",_r,[a(m,null,{default:r(()=>[(i(),v(Wt(n.getIcon(p.type))))]),_:2},1024)]),o.is_editable?(i(),c(M,{key:1},[s.editingIndex!=k?(i(),c("span",{key:0,style:{cursor:"pointer"},onClick:$=>s.editingIndex=k,class:"fcom_document_title"},[l("span",null,d(p.title),1),a(m,{style:{"margin-left":"10px","font-size":"80%"}},{default:r(()=>[a(f)]),_:1})],8,hr)):(i(),v(y,{key:1,readonly:s.isSaving,size:"small",style:{width:"80%"},modelValue:p.title,"onUpdate:modelValue":$=>p.title=$},{append:r(()=>[a(h,{disabled:s.isSaving,loading:s.isSaving,onClick:$=>n.saveDoc(p)},{default:r(()=>[l("span",null,d(e.$t("Update")),1)]),_:1},8,["disabled","loading","onClick"])]),_:2},1032,["readonly","modelValue","onUpdate:modelValue"]))],64)):(i(),c("a",{key:0,href:p.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},d(p.title),9,mr))]),G((i(),c("div",fr,[!o.is_editable&&p.url?(i(),c("a",{key:0,href:p.url+"&force_download=1",target:"_blank",class:"el-button el-button--text"},[a(m,null,{default:r(()=>[a(w)]),_:1})],8,pr)):_("",!0),o.is_editable?(i(),v(h,{key:1,onClick:$=>n.removeDocument(k,p),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])):_("",!0)])),[[C,s.isSaving]])]))),256))])}const tt=I(rr,[["render",gr]]);const yr={name:"DocumentUploaderPop",components:{DocumentLists:tt,DocumentsUploader:Oa,Document:St},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="")}}},vr={class:"fcom_inline_docs_form"},br={class:"fcom_doc_upload_modal"};function kr(e,t,o,u,s,n){var y;const m=x,f=g("documents-uploader"),h=g("document-lists");return i(),c("div",vr,[l("div",br,[a(m,{onClick:t[0]||(t[0]=w=>n.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(f,{style:{"margin-bottom":"20px"},showLists:!1,additional_data:{space_id:o.space_id},is_multiple:!0,onFileAdded:n.fileAdded},null,8,["additional_data","onFileAdded"]),a(h,{class:"fcom_boxed_documents",additional_data:{space_id:o.space_id,feed_id:o.feed.id},is_editable:!0,document_lists:(y=o.feed)==null?void 0:y.document_ids,onFileRemoved:n.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const wr=I(yr,[["render",kr]]),Cr={name:"PaperClipIcon"},$r={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Sr(e,t,o,u,s,n){return i(),c("svg",$r,[...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 Gs=I(Cr,[["render",Sr]]),Vr=window.fluentComAdmin.auth,Lr={name:"FeedTextComposer",components:{PaperClipIcon:Gs,DocumentLists:tt,DocumentUploaderPop:wr,Document:St,MediaPreview:De,Giphy:al,ImageUploader:je,SurveyEditForm:Zn,MarkdownEditor:Vt,EmojiPicker:qs,VideoEmbeder:Ql,ImageIcon:is,PollIcon:xn},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+Vr.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"}},data(){return{mentionResults:[],mentionSearch:"",uploading:!1,isEmojiPickerVisible:!1,maxMediaPerPost:this.appVars.features.max_media_per_post}},methods:{cencelSurvey(){this.content.survey=null},insertEmoji(e){this.$refs.markdownEditor&&this.$refs.markdownEditor.updateContent(e)},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 o=e.clipboardData.items[t];if(o.kind=="file"&&o.type.startsWith("image/")){const u=o.getAsFile(),s=e.clipboardData.getData("text")||"clipboard-image.png";this.uploadImage(new File([u],s,{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 o=new FormData;return o.append("file",e),o.append("max_width",1400),o.append("context",this.context),o.append("resize",!0),this.$uploadFile("feeds/media-upload",o).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 o,u;if(this.content.media_images||(this.content.media_images=[]),(u=(o=this.content)==null?void 0:o.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.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 o,u;this.content.meta||(this.content.meta=[]),(o=this.content)!=null&&o.media_images&&(this.content.media_images=[]),(u=this.content)!=null&&u.media&&(this.content.media=null);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){this.content.media_images=[],this.content.meta=[],this.content.media=e},getInlineImageCount(){var t,o;const e=(o=(t=this.$refs.markdownEditor)==null?void 0:t.$refs)==null?void 0:o.crepe_editor_vue;return e?e.querySelectorAll('img[src^="http"]').length:0},canAddImage(){var o;return(((o=this.content.media_images)==null?void 0:o.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(){this.autofocus&&this.$nextTick(()=>{this.$refs.create_status&&this.$refs.create_status.focus()})}},Mr={class:"fcom_text_composer"},Fr={class:"fcom_editor status_text_input"},Tr={key:1,style:{position:"relative","text-align":"center"}},Pr={key:2,class:"fcom_media_items"},Ir={key:0,class:"fcom_media_images"},Ur=["src","alt"],Er={key:1,class:"fcrom_media_images"},Br={class:"fcrom_media_image"},Ar=["src","alt"],Dr={key:3,class:"fcrom_media_images"},Rr=["src","alt"],Hr={key:4,class:"fcrom_media_images"},xr={class:"fcrom_media_image"},Or=["src","alt"],jr={class:"fcom_composer_footer"},Nr={class:"fcom_composer_apps"},zr={key:0},qr={class:"fcom_composer_actions"};function Gr(e,t,o,u,s,n){var D,A,U,P,O,N,Q,_e,ne;const m=g("MarkdownEditor"),f=g("DocumentUploaderPop"),h=g("SurveyEditForm"),y=x,w=g("media-preview"),b=g("CloseBold"),C=j,p=g("ImageIcon"),k=g("image-uploader"),$=g("video-embeder"),S=g("PaperClipIcon"),T=g("PollIcon"),F=g("EmojiPicker"),B=g("Giphy"),L=J("loading");return i(),c(M,null,[l("div",Mr,[l("div",Fr,[q(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:o.content.message,"onUpdate:modelValue":t[0]||(t[0]=E=>o.content.message=E),context:o.context,is_modal:o.is_modal,autofocus:o.autofocus,placeholder:o.placeholder,mentionQuery:o.mentionQuery,defaultMentions:o.defaultMentions,autofocus_changed:o.autofocus_changed,onInlineUpload:n.hasInlineImageUpload?E=>n.uploadImage(E,!1):null,canAddImage:n.canAddImage,onHandleMediaUpload:n.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")})},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload"]),q(e.$slots,"after_input")]),o.content.content_type=="document"?(i(),c(M,{key:0},[o.config.documentsApp&&o.config.space_id?(i(),v(f,{key:0,is_inline:!0,feed:o.content,space_id:o.config.space_id},null,8,["feed","space_id"])):_("",!0)],64)):(i(),c(M,{key:1},[o.content.survey?(i(),v(h,{key:0,onCancel:n.cencelSurvey,form:o.content.survey,is_editing:o.is_editing},null,8,["onCancel","form","is_editing"])):_("",!0),(A=(D=o.content)==null?void 0:D.media)!=null&&A.type?(i(),c("div",Tr,[a(y,{onClick:t[2]||(t[2]=E=>{o.content.media=null}),text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Remove Media")),1)]),_:1}),a(w,{media_item:o.content.media},null,8,["media_item"])])):(U=o.content)!=null&&U.meta?(i(),c("div",Pr,[(O=(P=o.content.meta)==null?void 0:P.media_items)!=null&&O.length?(i(!0),c(M,{key:0},R(o.content.meta.media_items,(E,K)=>(i(),c("div",{key:K},[E.type=="image"?(i(),c("div",Ir,[l("img",{class:"fcom_media_image",src:E.url,alt:e.$t("Media image")},null,8,Ur),a(y,{class:"fcom_media_images_cross_button",link:"",onClick:ae=>o.content.meta.media_items.splice(K,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])])):_("",!0)]))),128)):((Q=(N=o.content.meta)==null?void 0:N.media_preview)==null?void 0:Q.type)=="image"||(ne=(_e=o.content.meta)==null?void 0:_e.media_preview)!=null&&ne.image?(i(),c("div",Er,[l("div",Br,[l("img",{src:o.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,Ar),a(y,{link:"",onClick:t[3]||(t[3]=E=>o.content.meta.media_preview=null)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])])):_("",!0)])):o.content.media_images&&o.content.media_images.length?(i(),c("div",Dr,[(i(!0),c(M,null,R(o.content.media_images,(E,K)=>(i(),c("div",{class:"fcrom_media_image",key:K},[l("img",{src:E.url,alt:e.$t("Media image")},null,8,Rr),a(y,{link:"",onClick:ae=>o.content.media_images.splice(K,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])]))),128))])):n.checkHasImageForCommentsEdit(o.content)?(i(),c("div",Hr,[l("div",xr,[l("img",{src:o.content.media.media_url,alt:e.$t("Media image")},null,8,Or),a(y,{link:"",onClick:t[4]||(t[4]=E=>n.removeImageFromComments())},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])])):_("",!0)],64))]),q(e.$slots,"before_composer_footer"),G((i(),c("div",jr,[l("div",Nr,[n.hasActiveApp?_("",!0):(i(),c(M,{key:0},[s.maxMediaPerPost?(i(),v(k,{key:0,additionalData:{resize:!0,context:o.context,max_width:1400},isMultiple:o.config.multipleMedia,onUploading:t[5]||(t[5]=()=>{s.uploading=!0}),onCompleted:t[6]||(t[6]=()=>{s.uploading=!1}),onUploaded:n.handleMediaUpload},{default:r(()=>[a(y,{"aria-label":"Upload Media",loading:s.uploading,text:""},{default:r(()=>[a(C,{class:"fcom_status_img_icon"},{default:r(()=>[a(p)]),_:1}),s.uploading?(i(),c("span",zr,d(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),o.config.videoApp&&e.hasFeature("video_embeder")?(i(),v($,{key:1,space:o.config.spaceSlug,is_admin:o.config.is_admin,onEmbeded:n.handleVideoAttachment},null,8,["space","is_admin","onEmbeded"])):_("",!0),o.config.documentsApp&&o.config.space_id?(i(),v(y,{key:2,"aria-label":e.$t("Add Documents"),title:e.$t("Upload Documents"),text:"",onClick:t[7]||(t[7]=E=>o.content.content_type="document")},{default:r(()=>[a(C,{class:H(["fcom_apps_icon"])},{default:r(()=>[a(S)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),o.config.surveyApp&&e.hasFeature("has_survey_poll")?(i(),v(y,{key:3,"aria-label":"Create Poll",onClick:n.initSurveyForm,text:""},{default:r(()=>[a(C,{class:"fcom_apps_icon"},{default:r(()=>[a(T)]),_:1})]),_:1},8,["onClick"])):_("",!0),e.hasFeature("emoji_app")?(i(),v(F,{key:4,onEmojiSelected:n.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(i(),v(B,{key:5,onSelectedGiphy:n.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",qr,[q(e.$slots,"default")])])),[[L,s.uploading]]),q(e.$slots,"after_composer_footer")],64)}const ht=I(Lr,[["render",Gr]]),Yr={name:"ImageCarousel",props:["feed","is_single"],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}}},Wr={class:"fcom_image_carousel"},Zr={key:0},Kr=["preload","poster"],Jr=["src","type"],Qr={key:1,class:"fcom_image_wrap"},Xr={key:0,class:"fcom_image_overlay"};function ec(e,t,o,u,s,n){const m=Ie;return i(),c("div",Wr,[l("div",{class:H([n.carouselClass+" "+o.feed.type,"fcom_image_carousel__container"])},[(i(!0),c(M,null,R(n.visibleMedia,(f,h)=>(i(),c("div",{class:H(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(i(),c("div",Zr,[l("video",{style:{width:"100%","aspect-ratio":"16/9"},controls:"",preload:o.is_single?"":"none",poster:f.thumbnail},[l("source",{src:f.url,type:n.getVideoType(f.url)},null,8,Jr)],8,Kr)])):(i(),c("div",Qr,[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":n.srcList,"show-progress":"",fit:"cover"},null,8,["src","initial-index","preview-src-list"]),n.isOverflowSlot(h)?(i(),c("div",Xr,"+"+d(n.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const Lt=I(Yr,[["render",ec]]),tc={name:"ErrorIcon"},sc={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 oc(e,t,o,u,s,n){return i(),c("svg",sc,[...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 Ys=I(tc,[["render",oc]]),ic={name:"ReportReview",components:{ErrorIcon:Ys},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,o;((t=e.content)==null?void 0:t.id)==((o=this.feed)==null?void 0:o.id)&&this.$emit("updated",e.content)}},mounted(){this.$eventBus.on("updateModerationReport",this.handleReportUpdate)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.handleReportUpdate)}},nc={class:"fcom_feed_report_wrap"},lc={class:"fcom_feed_report_content"},ac={key:0},rc={key:1},cc={key:2},dc={class:"fcom_feed_report_action"};function uc(e,t,o,u,s,n){const m=g("ErrorIcon"),f=x;return i(),c("div",nc,[l("div",lc,[a(m),o.feed.meta.auto_flagged=="yes"?(i(),c("span",ac,d(e.$t("This %s has been flagged automatically by the site rule.",o.type)),1)):o.feed.meta.reports_count>1?(i(),c("span",rc,d(e.$t("This %1$s has been flagged with %2$s reports",o.type,o.feed.meta.reports_count)),1)):(i(),c("span",cc,d(e.$t("This %1$s has been flagged with %2$s report",o.type,o.feed.meta.reports_count)),1))]),l("div",dc,[a(f,{onClick:t[0]||(t[0]=h=>n.openReportDetails())},{default:r(()=>[V(d(e.$t("Review")),1)]),_:1})])])}const Ws=I(ic,[["render",uc]]),_c={name:"StickyIcon"},mc={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 hc(e,t,o,u,s,n){return i(),c("svg",mc,[...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 Mt=I(_c,[["render",hc]]),fc={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(o=>{const u=o.getAttribute("href"),s=(u==null?void 0:u.startsWith(this.appVars.portal_url))&&u.match(t);if(!s)return;const n=s[1];o._mentionEnter=()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.$eventBus.emit("show_mention_popover",{username:n,triggerElement:o})},500)},o._mentionLeave=()=>{clearTimeout(this.hoverTimeout),this.$eventBus.emit("hide_mention_popover")},o.addEventListener("mouseenter",o._mentionEnter),o.addEventListener("mouseleave",o._mentionLeave)}),this._clickHandler=o=>{var m;const u=o.target.closest('img[src^="http"]');if(u){o.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 s=o.target.closest(".fcom_copy_code_btn");if(!s)return;o.stopPropagation();const n=(m=s.parentElement)==null?void 0:m.querySelector("pre");n&&this.$toClipboard((n.querySelector("code")||n).innerText,"Code copied")},e.addEventListener("click",this._clickHandler),e.querySelectorAll("pre").forEach(o=>{var s;if((s=o.parentElement)!=null&&s.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>',o.replaceWith(u),u.prepend(o)})},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()}},pc=["innerHTML"];function gc(e,t,o,u,s,n){const m=Cs;return i(),c(M,null,[l("div",{ref:"content",class:H(["feed_md_content",o.class_name]),innerHTML:o.content},null,10,pc),s.lightboxImages.length?(i(),v(m,{key:0,"url-list":s.lightboxImages,"initial-index":s.lightboxIndex,"hide-on-click-modal":!0,onClose:t[0]||(t[0]=f=>s.lightboxImages=[])},null,8,["url-list","initial-index"])):_("",!0)],64)}const Ft=I(fc,[["render",gc]]),yc=80,vc=20,bc=5e3,Tt={methods:{scrollCommentIntoView(e,t=null){var f;const o=this.$el instanceof Element?this.$el:(f=this.$el)==null?void 0:f.parentElement,u=(o==null?void 0:o.closest(".feed"))||document,s=h=>h&&u.querySelector("#comment_"+h),n=s(e)||s(t);if(!n)return;const m=n.querySelector(".comment_text")||n;m.classList.add("fcom_highlight_glow"),setTimeout(()=>m.classList.remove("fcom_highlight_glow"),bc),setTimeout(()=>{const h=n.getBoundingClientRect();h.top>=yc&&h.bottom<=window.innerHeight-vc||n.scrollIntoView({behavior:"smooth",block:"center"})},50)}}},kc={name:"SingleComment",mixins:[Tt],components:{ImageCarousel:Lt,FeedTextComposer:ht,MediaPreview:De,ReportReview:Ws,StickyIcon:Mt,FeedMdContent:Ft},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&&((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}}},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,o,u,s;const e=((t=this.editingComment.media_images)==null?void 0:t.length)>0||((u=(o=this.editingComment.meta)==null?void 0:o.media_preview)==null?void 0:u.image);if(!((s=this.editingComment.message)!=null&&s.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(n=>{this.$notify.success((n==null?void 0:n.message)||this.$t("Comment updated successfully")),Object.assign(this.comment,n.comment),this.comment.media_images=[],this.isEdit=!1,this.$nextTick(()=>{this.scrollCommentIntoView(this.comment.id)})}).catch(n=>{this.$handleError(n),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 o=/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/.exec(e);if(o&&o[1]){let n=o[1];if(n){let m=`<div class="feed_media_ext_video"><iframe src="https://www.youtube.com/embed/${n}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;e+=m}}let u=window.location.origin,s=new RegExp(u,"g");return e=e.replace(/<a(.*?)href="(.*?)"(.*?)>/g,(n,m,f,h)=>f.match(s)?`<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,o;if(this.expanded)return;const e=(o=(t=this.$refs.commentBody)==null?void 0:t.$refs)==null?void 0:o.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"))}}},wc={key:1,class:"person_avatar"},Cc={class:"comment_wrap"},$c={key:0,class:"comment_text"},Sc={key:0,class:"comment_text_head"},Vc={class:"comment_text_head_name"},Lc=["title"],Mc={key:0,class:"comment_text_head_status"},Fc={class:"comment_actions"},Tc={class:"actions_items"},Pc={key:2,class:"comment_text_media"},Ic={key:3,class:"comment_text_media"};function Uc(e,t,o,u,s,n){const m=g("ReportReview"),f=g("UserAvatar"),h=g("UserRouteLink"),y=Ue,w=g("StickyIcon"),b=j,C=x,p=g("MoreFilled"),k=fe,$=g("FeedMdContent"),S=g("MediaPreview"),T=g("ImageCarousel"),F=g("feed-text-composer"),B=J("loading");return i(),c(M,null,[n.showReport?(i(),v(m,{key:0,feed:n.getReportComment,type:"comment",onUpdated:n.reportUpdated},null,8,["feed","onUpdated"])):_("",!0),o.show_header&&o.comment.xprofile?(i(),c("div",wc,[a(f,{with_level:!1,xprofile:o.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),G((i(),c("div",Cc,[s.isEdit?(i(),c("div",{key:1,onKeydown:t[10]||(t[10]=he((...L)=>n.maybeSave&&n.maybeSave(...L),["enter"])),class:"comment_text"},[a(F,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:s.editingComment,autofocus:!0,autofocus_changed:s.focusTrigger},{default:r(()=>[l("div",null,[a(C,{onClick:t[8]||(t[8]=L=>s.isEdit=!1),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(C,{class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>n.updateComment(s.editingComment))},{default:r(()=>[V(d(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(i(),c("div",$c,[o.show_header?(i(),c("div",Sc,[l("div",Vc,[a(h,{show_badge:!0,xprofile:o.comment.xprofile,show_follow:!0},null,8,["xprofile"]),l("div",{title:o.comment.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(o.comment.created_at)),9,Lc),o.comment.status=="pending"?(i(),c("div",Mc,[a(y,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Fc,[o.comment.is_sticky?(i(),v(C,{key:0,onClick:t[0]||(t[0]=L=>n.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(b,{title:e.$t("Unpin from Top"),class:"fcom_sticky"},{default:r(()=>[a(w)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a(k,{persistent:!1,placement:"bottom",ref:"comment_actions",width:200,trigger:"click"},{reference:r(()=>[a(C,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(p)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Tc,[l("li",{onClick:t[1]||(t[1]=L=>n.copyCommentLink(o.comment))},d(e.$t("Copy Link")),1),n.showStickyOption?(i(),c(M,{key:0},[o.comment.is_sticky?(i(),c("li",{key:0,onClick:t[2]||(t[2]=L=>n.toggleSticky())},d(e.$t("Unpin from Top")),1)):(i(),c("li",{key:1,onClick:t[3]||(t[3]=L=>n.toggleSticky())},d(e.$t("Pin to Top")),1))],64)):_("",!0),n.showReportOption?(i(),c("li",{key:1,onClick:t[4]||(t[4]=L=>n.reportComment(o.comment))},d(e.$t("Report Comment")),1)):_("",!0),e.canEditComment(o.comment)?(i(),c("li",{key:2,onClick:t[5]||(t[5]=L=>n.editComment())},d(e.$t("Edit")),1)):_("",!0),e.canDeleteComment(o.comment)?(i(),c("li",{key:3,onClick:t[6]||(t[6]=L=>n.deleteComment())},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)])])):_("",!0),a($,{ref:"commentBody",class_name:n.contentClass,content:n.renderedComment(o.comment.message_rendered)},null,8,["class_name","content"]),s.canExpand?(i(),c("button",{key:1,type:"button",class:"fcom_see_more_btn",onClick:t[7]||(t[7]=(...L)=>n.toggleExpand&&n.toggleExpand(...L))},d(s.expanded?e.$t("See less"):e.$t("See more")),1)):_("",!0),o.comment.meta.media_preview?(i(),c("div",Pc,[a(S,{media_item:o.comment.meta.media_preview},null,8,["media_item"])])):o.comment.meta.media_items?(i(),c("div",Ic,[o.comment.meta.media_items?(i(),v(T,{key:0,feed:o.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),q(e.$slots,"after_comment_text")])),[[B,s.working]])],64)}const Zs=I(kc,[["render",Uc]]);function Z(e){return window.fluentComAdmin.i18n[e]||e}const Ks={public:{label:Z("Public"),description:Z("__PUBLIC_SPACE_DESC"),space_description:Z("__PIBLIC_SPACE_DESC_2")},private:{label:Z("Private"),description:Z("__PRIVATE_SPACE_DESC"),space_description:Z("__PRIVATE_SPACE_DESC_2")},secret:{label:Z("Secret"),description:Z("Only invited members can view and post."),space_description:Z("__SECRET_SPACE_DESC_2")}},Ec={public:{label:Z("Public"),description:Z("Anyone can view and enroll the course for free")},private:{label:Z("Private"),description:Z("__PRIVATE_COURSE_DESC")},secret:{label:Z("Secret"),description:Z("Only invited students can view and enroll the course content.")}},Bc={self_paced:{label:Z("Self Paced"),description:Z("__SELF_PAED_COURSE_DESC")},structured:{label:Z("Structured"),description:Z("__STRUCTURED_COURSE_DESC")},scheduled:{label:Z("Scheduled"),description:Z("Course starts on a specific date. Sections are dripped relative to that date.")}};Z("Leaderboard Settings"),Z("Settings for Leaderboard & Gamification features"),Z("Get Leaderboard & Gamification Module"),Z("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),Z("Emoji Module"),Z("Settings for Emoji & Reaction features"),Z("Get Emoji & Reaction Module"),Z("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),Z("Giphy Module"),Z("Customize Your Giphy Module Settings"),Z("Get Giphy Module"),Z("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),Z("User Badge Module"),Z("Add a badge next to user profile name to highlight valued users"),Z("Get User Badge Module"),Z("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."),Z("Media Module"),Z("Add a badge next to user profile name to highlight valued users"),Z("Get Media Module"),Z("Choose where to store your media files. Options include Local File System, Amazon S3, or Cloudflare R2 for storing and serving your media assets");const Ee=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let o=0;o<t.length;o++)if(e>=t[o].min_points&&e<=t[o].max_points)return t[o];return t[t-1]},Ac={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),ss(t))return e;const o=this.appVars.socialLinkProviders;return o&&this.each(o,(s,n)=>{t[n]&&e.push({title:s.title,icon:s.icon_svg,url:s.domain+t[n]})}),e}}},Dc={key:0,class:"fcom_social_links"},Rc=["href","title"];function Hc(e,t,o,u,s,n){const m=j,f=g("router-link");return n.hasSocialLinks?(i(),c("div",Dc,[(i(!0),c(M,null,R(n.socialLinks,h=>(i(),c("a",{rel:"noopener nofollow",target:"_blank",href:h.url,key:h.title,title:h.title},[a(m,{innerHTML:h.icon},null,8,["innerHTML"])],8,Rc))),128)),o.isOwn&&!n.hasSocialLinks?(i(),v(f,{key:0,to:{name:"update_profile",params:{username:o.xprofile.username}}},{default:r(()=>[V(d("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Pt=I(Ac,[["render",Hc]]),xc={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:Be()}},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 o;const e=(o=this.profile)==null?void 0:o.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{await this.userStore.toggleFollow(this.profile.user_id,this.profile.username),this.$notify.success(this.$t("Successfully followed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},async unfollowUser(){this.loading=!0;try{await this.userStore.toggleFollow(this.profile.user_id,this.profile.username),this.$notify.success(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})}}},Oc={key:0},jc={key:1},Nc={key:0},zc={key:1};function qc(e,t,o,u,s,n){const m=x;return n.showFollowAction?(i(),c(M,{key:0},[n.isBlocked?(i(),v(m,{key:0,class:"fcom_secondary_button danger_button",loading:s.loading,disabled:s.loading,style:{"min-width":"90px","max-height":"30px"},onClick:n.unblockUser,onMouseenter:t[0]||(t[0]=f=>s.hovering=!0),onMouseleave:t[1]||(t[1]=f=>s.hovering=!1)},{default:r(()=>[s.hovering?(i(),c("span",jc,d(e.$t("Unblock")),1)):(i(),c("span",Oc,d(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):n.isFollowing?(i(),v(m,{key:1,onClick:n.confirmUnfollow,class:H(["fcom_secondary_button",{danger_button:s.hovering}]),style:{"min-width":"95px","max-height":"30px"},loading:s.loading,disabled:s.loading,onMouseenter:t[2]||(t[2]=f=>s.hovering=!0),onMouseleave:t[3]||(t[3]=f=>s.hovering=!1)},{default:r(()=>[s.hovering?(i(),c("span",zc,d(e.$t("Unfollow")),1)):(i(),c("span",Nc,d(e.$t("Following")),1))]),_:1},8,["onClick","class","loading","disabled"])):(i(),v(m,{key:2,onClick:n.followUser,class:"fcom_color_button",style:{"max-height":"30px"},loading:s.loading,disabled:s.loading},{default:r(()=>[l("span",null,d(n.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const st=I(xc,[["render",qc]]),Gc={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)?Ee(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)}},Yc=["href"],Wc={class:"fcom_user_display_name"},Zc={key:1,class:"user_route"},Kc=["href"],Jc={class:"fcom_user_display_name"},Qc={class:"fcom_profile_pop_avatar"},Xc={key:0,class:"fcom_prfile_tagline"},ed={class:"fcom_level_name"},td={style:{display:"block"},class:"fcoml_level_sub meta_line"},sd={class:"fcom_profile_pop_info"},od={class:"pop_info_header"},id={class:"header_name"},nd=["href"],ld={class:"fcom_user_display_name"},ad={class:"fcom_user_name"},rd={key:0,class:"header_actions"},cd={key:0,class:"fcom_profile_pop_bio"},dd=["title"],ud=["title"],_d={class:"pop_info_btns"},md=["href"],hd=["href"];function fd(e,t,o,u,s,n){const m=g("verified-sign"),f=g("UserBadge"),h=g("UserAvatar"),y=_t,w=g("follow-action"),b=g("SocialLinks"),C=mt,p=fe;return o.show_pop?(i(),c("span",Zc,[a(p,{ref:"popoverRef",visible:o.virtualRef?!0:null,"virtual-ref":o.virtualRef,"virtual-triggering":!!o.virtualRef,width:500,"show-after":o.virtualRef?0:500,trigger:o.virtualRef?null:"hover",onShow:n.initShow,onHide:n.onHide,persistent:!1,"popper-class":"fcom_profile_popper",placement:"top","popper-style":"padding: 0;"},{reference:r(()=>[q(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[l("p",Jc,d(o.xprofile.display_name),1)],8,Kc)])]),default:r(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=k=>o.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=k=>o.virtualRef&&e.$emit("popover-mouseleave"))},[o.xprofile&&o.xprofile.username?(i(),v(C,{key:0,gutter:20},{default:r(()=>[a(y,{sm:24,md:8},{default:r(()=>[l("div",Qc,[a(h,{xprofile:o.xprofile},null,8,["xprofile"]),n.userLevel?(i(),c("div",Xc,[l("div",ed,d(n.userLevel.title),1),l("div",td,d(n.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(y,{sm:24,md:16},{default:r(()=>{var k,$;return[l("div",sd,[l("div",od,[l("div",id,[l("a",{href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[l("p",ld,d(o.xprofile.display_name),1),o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)],8,nd),l("span",ad," @"+d(o.xprofile.username),1)]),o.show_follow?(i(),c("div",rd,[a(w,{profile:o.xprofile},null,8,["profile"])])):_("",!0)]),(k=o.xprofile.meta)!=null&&k.short_description_rendered||o.xprofile.short_description_rendered?(i(),c("div",cd,d(e.getExcerpt((($=o.xprofile.meta)==null?void 0:$.short_description_rendered)||o.xprofile.short_description_rendered,160)),1)):_("",!0),o.xprofile.created_at?(i(),c("div",{key:1,title:o.xprofile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(o.xprofile.created_at))),9,dd)):_("",!0),o.xprofile.last_activity?(i(),c("div",{key:2,title:o.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(o.xprofile.last_activity))),9,ud)):_("",!0),l("div",_d,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:o.xprofile.username})},d(e.$t("View Profile")),9,md),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(i(),c("a",{key:0,class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("chat/?user_id=:user_id",{user_id:o.xprofile.user_id})},d(e.$t("Message")),9,hd)):_("",!0)]),a(b,{style:{"justify-content":"left"},xprofile:o.xprofile,isOwn:!1},null,8,["xprofile"])])]}),_:1})]),_:1})):_("",!0)],32)]),_:3},8,["visible","virtual-ref","virtual-triggering","show-after","trigger","onShow","onHide"]),o.show_verified&&o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)])):(i(),c("a",{key:0,href:e.$getRouteLink("u/:username",{username:o.xprofile.username}),class:"user_route"},[q(e.$slots,"default",{},()=>[l("p",Wc,d(o.xprofile.display_name),1)]),o.show_verified&&o.xprofile.is_verified?(i(),v(m,{key:0})):_("",!0),o.show_badge?(i(),v(f,{key:1,profile:o.xprofile},null,8,["profile"])):_("",!0)],8,Yc))}const Fe=I(Gc,[["render",fd]]),pd={name:"CommentReacts",components:{UserRouteLink:Fe},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}))}}},gd={style:{"margin-left":"5px"}},yd={key:0},vd={key:1},bd={class:"fcom_user_lists"},kd={key:2};function wd(e,t,o,u,s,n){const m=Y,f=g("UserAvatar"),h=g("UserRouteLink"),y=ke,w=fe;return i(),v(w,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:n.getReactions},{reference:r(()=>[l("span",gd,d(o.comment.reactions_count),1)]),default:r(()=>[s.loading?(i(),c("div",yd,[a(m,{animated:!0,rows:1})])):s.reactions?(i(),c("div",vd,[a(y,{"max-height":"300px"},{default:r(()=>[l("ul",bd,[(i(!0),c(M,null,R(s.reactions,b=>(i(),c("li",null,[b.xprofile?(i(),c(M,{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})])):(i(),c("div",kd,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const Cd=I(pd,[["render",wd]]),$d={name:"NestedReplyBox",mixins:[Tt],components:{SingleComment:Zs,FeedTextComposer:ht,CommentReactions:Cd,HeartIcon:et},props:["comment","feed","checkPermission","show_reacts_only","defaultMentions"],emits:["commented","copyLink"],data(){return{open:!1,autofocusInput:!1,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,o,u;const e=((t=this.commentReply.media_images)==null?void 0:t.length)>0||((u=(o=this.commentReply.meta)==null?void 0:o.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(s=>{var n;this.comment.comments||(this.comment.comments=[]),this.commentReply={message:"",media_images:[]},(n=this.$refs.composer)==null||n.clearContent(),this.comment.comments.push(s.comment),Array.isArray(this.feed.comments)&&this.feed.comments.push(s.comment),this.$emit("commented",s.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.$nextTick(()=>{this.scrollCommentIntoView(s.comment.id,this.comment.id)})}).catch(s=>{this.$handleError(s)}).finally(()=>{this.submitting=!1}))},toggleCommentBox(e,t=!0){var u;if(!this.hasCommentPermission(this.feed)){this.$notify({message:this.$t("Please join the Space to post a comment."),type:"warning"});return}this.open=!this.open,this.autofocusInput=this.open&&t;let o=(u=e==null?void 0:e.xprofile)==null?void 0:u.username;this.open&&t&&o&&e.user_id!=this.auth.user_id&&(this.commentReply.message=`@${o} `)},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(o=>o.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(o=>{e.liked=o.liked,e.reactions_count=o.reactions_count}).catch(o=>{this.$handleError(o)})},emitCopyLink(e){this.$emit("copyLink",e)}}},Sd={key:0,class:"reply_box"},Vd={class:"fcom_comments_react fcom_reaction_list"},Ld={class:"child_comments"},Md=["id"],Fd={key:0,class:"reply_box"},Td=["onClick"],Pd={class:"fcom_comments_react fcom_reaction_list"},Id={key:0,class:"child_reply_wrap"},Ud={class:"feed_commenting"},Ed={class:"person_avatar"},Bd=["alt","src"];function Ad(e,t,o,u,s,n){var C;const m=g("HeartIcon"),f=j,h=g("CommentReactions"),y=g("single-comment"),w=x,b=g("feed-text-composer");return i(),c(M,null,[n.canComment?(i(),c("div",Sd,[((C=o.feed.meta)==null?void 0:C.comments_disabled)!=="yes"?(i(),c("span",{key:0,onClick:t[0]||(t[0]=p=>n.toggleCommentBox(o.comment)),class:"reply_btn"},d(e.$t("Reply")),1)):_("",!0),l("span",{class:H([{fcom_is_liked:o.comment.liked},"reply_btn"])},[l("div",Vd,[a(f,{class:H({user_reacted:o.comment.liked}),onClick:t[1]||(t[1]=p=>n.toggleLike(o.comment))},{default:r(()=>[a(m,{filled:o.comment.liked},null,8,["filled"])]),_:1},8,["class"]),parseInt(o.comment.reactions_count)?(i(),v(h,{key:0,comment:o.comment},null,8,["comment"])):_("",!0)])],2),q(e.$slots,"after_reply_box_text",{toggleOpen:()=>n.toggleCommentBox(o.comment,!1)})])):_("",!0),!o.show_reacts_only||s.open?(i(),c(M,{key:1},[l("div",Ld,[(i(!0),c(M,null,R(o.comment.comments,(p,k)=>(i(),c("div",{id:"comment_"+p.id,class:"each_comment"},[a(y,{onCopyLink:n.emitCopyLink,onDeleted:$=>n.handleCommentDelete(k),comment:p,show_report:!0},{after_comment_text:r(()=>{var $;return[n.canComment?(i(),c("div",Fd,[(($=o.feed.meta)==null?void 0:$.comments_disabled)!=="yes"?(i(),c("span",{key:0,onClick:S=>n.toggleCommentBox(p),class:"reply_btn"},d(e.$t("Reply")),9,Td)):_("",!0),l("span",{class:H([{fcom_is_liked:p.liked},"reply_btn"])},[l("div",Pd,[a(f,{class:H({user_reacted:p.liked}),onClick:S=>n.toggleLike(p)},{default:r(()=>[a(m,{filled:p.liked},null,8,["filled"])]),_:2},1032,["class","onClick"]),parseInt(p.reactions_count)?(i(),v(h,{key:0,comment:p},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,Md))),256))]),s.open?(i(),c("div",Id,[l("div",Ud,[l("div",Ed,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,Bd)]),l("div",{onKeydown:t[3]||(t[3]=he((...p)=>n.maybeSave&&n.maybeSave(...p),["enter"])),class:"feed_comment_input comment_text"},[a(b,{ref:"composer",config:{multipleMedia:!0},context:"comment",defaultMentions:o.defaultMentions?o.defaultMentions:[],disabled:s.submitting,autofocus:s.autofocusInput,mentionQuery:{space_id:o.feed.space_id},content:s.commentReply,placeholder:e.$t("Leave a reply")},{default:r(()=>[a(w,{loading:s.submitting,disabled:s.submitting,onClick:t[2]||(t[2]=p=>n.addComment()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Reply")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["defaultMentions","disabled","autofocus","mentionQuery","content","placeholder"])],32)])])):_("",!0)],64)):_("",!0)],64)}const Dd=I($d,[["render",Ad]]),Rd={name:"FeedComments",components:{SingleComment:Zs,NestedReplyBox:Dd},props:["feed","show_all","checkPermission","defaultMentions","sortBy","is_single"],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={},o=[],u={};let s=null;for(let h=0;h<e.length;h++){const y=e[h];!s&&y.is_sticky&&(s=y),y.parent_id?(t[y.parent_id]||(t[y.parent_id]=[]),t[y.parent_id].push(y)):(o.push(y.id),u[y.id]=y)}for(const h of o)u[h].comments=t[h]||void 0;if(s&&u[s.id]){s=u[s.id];const h=o.indexOf(s.id);h!==-1&&o.splice(h,1),delete u[s.id]}const n=s||(o.length?u[o[o.length-1]]:null);if(!o.length&&!s)return{list:[],lastComment:null};const m=this.sortBy;if(this._lastSortBy!==m){let h=[...o];m==="oldest"||!m?h.sort((y,w)=>y-w):m==="latest"?h.sort((y,w)=>w-y):m==="popular"?h.sort((y,w)=>{var b,C;return(((b=u[w])==null?void 0:b.reactions_count)||0)-(((C=u[y])==null?void 0:C.reactions_count)||0)}):m==="most_replied"&&h.sort((y,w)=>{var b,C;return(((b=t[w])==null?void 0:b.length)||0)-(((C=t[y])==null?void 0:C.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(o),y=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(w=>h.has(w)&&u[w]).map(w=>u[w]);for(let w=o.length-1;w>=0;w--)y.has(o[w])||f.unshift(u[o[w]])}else f=o.map(h=>u[h]);return s&&f.unshift(s),{list:f,lastComment:n}},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,this.feed.type=="text"&&this.$eventBus.emit("feed_interaction",this.feed.id)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},collectCommentIds(e){var u;const t=new Set([e.id]),o=e.comments?[...e.comments]:[];for(;o.length;){const s=o.pop();t.add(s.id),(u=s.comments)!=null&&u.length&&o.push(...s.comments)}return t},handleCommentDelete(e){const t=this.collectCommentIds(e);this.feed.comments=this.feed.comments.filter(o=>!t.has(o.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 o=this.$router.resolve(t),u=this.appVars.urls.portal_base;u=u.replace(/\/$/,"");let s=u+o.fullPath;navigator.clipboard.writeText(s).then(()=>{this.$notify.success(this.$t("Link copied to clipboard"))}).catch(n=>{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()}},Hd={key:0,class:"feed_comments"},xd=["id"],Od={key:1,class:"feed_comments"},jd=["id"],Nd=["onClick"];function zd(e,t,o,u,s,n){const m=Y,f=g("nested-reply-box"),h=g("single-comment");return o.show_all?(i(),c("div",Hd,[s.loading?(i(),v(m,{key:0,row:5,class:"feed_comments_skeleton"})):(i(),c(M,{key:1},[q(e.$slots,"before_comments_start"),(i(!0),c(M,null,R(n.displayComments,(y,w)=>(i(),c("div",{class:"each_comment",key:y.id,id:"comment_"+y.id},[a(h,{comment:y,space_id:o.feed.space_id,show_report:!0,onCopyLink:n.copyCommentLink,onReload:n.fetchComments,onDeleted:b=>n.handleCommentDelete(y)},ve({_:2},[y.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{feed:o.feed,comment:y,checkPermission:o.checkPermission,defaultMentions:o.defaultMentions?o.defaultMentions:[],onCopyLink:n.copyCommentLink},null,8,["feed","comment","checkPermission","defaultMentions","onCopyLink"])]),key:"0"}]),1032,["comment","space_id","onCopyLink","onReload","onDeleted"])],8,xd))),128))],64))])):n.lastComment?(i(),c("div",Od,[l("div",{class:"each_comment",id:"comment_"+n.lastComment.id},[a(h,{comment:n.lastComment,space_id:o.feed.space_id,show_report:!0,onCopyLink:n.copyCommentLink,onDeleted:t[0]||(t[0]=y=>n.handleCommentDelete(n.lastComment))},ve({_:2},[n.lastComment.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{defaultMentions:o.defaultMentions?o.defaultMentions:[],onCopyLink:n.copyCommentLink,show_reacts_only:!0,checkPermission:o.checkPermission,feed:o.feed,comment:n.lastComment},{after_reply_box_text:r(({toggleOpen:y})=>[n.lastComment.comments&&n.lastComment.comments.length?(i(),c("span",{key:0,onClick:w=>y(),class:"reply_btn last_comment_reply_txt"},d(e.$_n("%d reply","%d replies",n.lastComment.comments.length)),9,Nd)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])],8,jd),o.feed.comments_count>1?(i(),c("div",{key:0,onClick:t[1]||(t[1]=y=>n.maybeShowAllComments()),class:"each_comment show_all_comments"},d(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const Js=I(Rd,[["render",zd]]);const qd={name:"ReactedUsers",components:{UserRouteLink:Fe},data(){return{centerDialogVisible:!1,reactions:null,loading:!1}},props:{feed:{type:Object,required:!0,default:()=>({})}},computed:{reactedProfiles(){let e=[],t=null;return this.feed.has_user_react&&(t=this.auth.user_id,e.push({user_id:t,avatar:this.auth.avatar})),this.each(this.feed.reactions,o=>{o.user_id!=t&&o.xprofile&&e.push({user_id:o.user_id,avatar:o.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,o,u,s;(s=(u=(o=(t=this.$refs.reactedPopover)==null?void 0:t.popperRef)==null?void 0:o.popperInstanceRef)==null?void 0:u.update)==null||s.call(u)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},Gd=["title"],Yd={key:0,class:"reactions_avatars"},Wd=["alt","src"],Zd={key:0},Kd={key:1},Jd={class:"fcom_user_lists"},Qd={key:2};function Xd(e,t,o,u,s,n){const m=Y,f=g("UserAvatar"),h=g("UserRouteLink"),y=ke,w=fe;return i(),v(w,{ref:"reactedPopover",persistent:!1,"popper-class":"fcom_feed_reacted_user_list",placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:n.getReactions},{reference:r(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[n.reactedProfiles&&n.reactedProfiles.length?(i(),c("div",Yd,[(i(!0),c(M,null,R(n.reactedProfiles,b=>(i(),c("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(i(),c("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,Wd)):_("",!0)]))),128))])):_("",!0),l("span",null,d(e.$_n("%s like","%s likes",o.feed.reactions_count)),1)],8,Gd)]),default:r(()=>[s.loading?(i(),c("div",Zd,[a(m,{animated:!0,rows:3})])):s.reactions?(i(),c("div",Kd,[a(y,{"max-height":"300px"},{default:r(()=>[l("ul",Jd,[(i(!0),c(M,null,R(s.reactions,b=>(i(),c("li",null,[b.xprofile?(i(),c(M,{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})])):(i(),c("div",Qd,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const eu=I(qd,[["render",Xd]]),tu={name:"FeedFooter",mixins:[Tt],components:{ReactedUsers:eu,FeedComments:Js,FeedTextComposer:ht,ChatIcon:Xe,HeartIcon:et},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(o=>{this.feed.has_user_react=t,this.feed.reactions_count=o.new_count}).catch(o=>{this.$handleError(o)})},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 o=this.feed.comments.slice(-30);this.each(o,u=>{u.user_id!=e&&t.push(u.xprofile)}),this.defaultMentions=Ri(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)}},su={ref:"feed_footer",class:"feed_footer"},ou={class:"fcom_feed_footer_actions"},iu={class:"fcom_sr_only"},nu={class:"fcom_feed_footer_meta"},lu={key:0},au={key:0,class:"fcom_reactions_count feed_reaction_meta"},ru={class:"feed_comment_count"},cu={key:2,class:"feed_reaction_meta"},du={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},uu=["id"],_u={key:0,style:{padding:"0",margin:"0","text-align":"center"}},mu={key:1,class:"feed_commenting"},hu={class:"person_avatar"},fu=["src"],pu={key:2,class:""},gu={style:{padding:"0",margin:"0","text-align":"center"}},yu={key:0,style:{margin:"10px 0"}},vu=["href"];function bu(e,t,o,u,s,n){var $,S,T,F;const m=g("HeartIcon"),f=j,h=g("ChatIcon"),y=g("ReactedUsers"),w=ee,b=te,C=g("feed-comments"),p=x,k=g("feed-text-composer");return i(),c(M,null,[l("div",su,[l("div",ou,[l("ul",null,[l("li",{class:H(["fcom_reaction fcom_reaction_list",{react_active:o.feed.has_user_react}]),onClick:t[0]||(t[0]=B=>n.toggleReact())},[a(f,{class:H({user_reacted:o.feed.has_user_react})},{default:r(()=>[a(m,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"])],2),(($=o.feed.meta)==null?void 0:$.comments_disabled)!=="yes"?(i(),c("li",{key:0,class:"fcom_comment_btn_wrap",onClick:t[1]||(t[1]=B=>n.showCommentForm())},[a(f,null,{default:r(()=>[a(h)]),_:1}),l("span",null,[l("span",iu,d(e.$t("Comment")),1)])])):_("",!0)])]),l("div",nu,[o.feed.reactions_count||o.feed.comments_count||((S=o.feed.meta)==null?void 0:S.comments_disabled)==="yes"?(i(),c("ul",lu,[o.feed.reactions_count?(i(),c("li",au,[a(y,{feed:o.feed},null,8,["feed"])])):_("",!0),o.feed.comments_count>0?(i(),c("li",{key:1,onClick:t[2]||(t[2]=(...B)=>n.maybeShowFeedModal&&n.maybeShowFeedModal(...B)),class:"feed_reaction_meta"},[l("div",ru,d(e.$_n("%d comment","%d comments",o.feed.comments_count)),1)])):((T=o.feed.meta)==null?void 0:T.comments_disabled)==="yes"?(i(),c("li",cu,d(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a(C,{sortBy:s.sortBy,defaultMentions:s.defaultMentions,onForceShowAll:n.showAll,show_all:s.show_all_comments,feed:o.feed,is_single:o.is_single},{before_comments_start:r(()=>[o.feed.comments_count>=2?(i(),c("div",du,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[3]||(t[3]=B=>n.changeCommentsSortBy()),modelValue:s.sortBy,"onUpdate:modelValue":t[4]||(t[4]=B=>s.sortBy=B),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(w,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(w,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(w,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(w,{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"]),s.commenting||o.is_single?(i(),c("div",{key:0,id:"feed_comment_form_"+o.feed.id,class:"feed_comment feed_commentbox_main"},[((F=o.feed.meta)==null?void 0:F.comments_disabled)==="yes"?(i(),c(M,{key:0},[o.feed.comments_count?(i(),c("p",_u,d(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(o.feed)?(i(),c("div",mu,[l("div",hu,[l("img",{alt:"",src:e.auth.photo},null,8,fu)]),s.showCommentBox?(i(),c("div",{key:0,onKeydown:t[6]||(t[6]=he((...B)=>n.maybeSave&&n.maybeSave(...B),["enter"])),class:"feed_comment_input"},[a(k,{ref:"composer",context:"comment",is_modal:o.is_modal,config:{multipleMedia:!0},mentionQuery:{space_id:o.feed.space_id},autofocus_changed:s.commenting,defaultMentions:s.defaultMentions,autofocus:s.isAutoFocus,disabled:s.saving,placeholder:e.$t("Write a comment"),content:s.comment},{default:r(()=>[a(p,{loading:s.saving,disabled:s.saving,class:"fcom_primary_button",onClick:t[5]||(t[5]=B=>n.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(i(),c("div",pu,[l("p",gu,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(i(),c("div",yu,[a(p,{class:"fcom_primary_button",onClick:t[7]||(t[7]=()=>{e.$emit("joinSpace")})},{default:r(()=>[V(d(e.$t("Join Space")),1)]),_:1})])):(i(),c("a",{key:1,href:e.getCurrentAuthUrl()},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,vu))])]))],8,uu)):_("",!0)],64)}const ku=I(tu,[["render",bu]]),wu={name:"SpaceIcon",props:["space_profile"]},Cu=["alt","src"],$u={key:1,class:"fcom_emoji"},Su={key:2,class:"fcom_shape"},Vu={key:3,class:"fcom_no_avatar"};function Lu(e,t,o,u,s,n){var f,h,y,w;const m=j;return o.space_profile.logo?(i(),c("img",{key:0,alt:e.$t("Space Logo"),src:o.space_profile.logo},null,8,Cu)):(f=o.space_profile.settings)!=null&&f.emoji?(i(),c("span",$u,d((h=o.space_profile.settings)==null?void 0:h.emoji),1)):(y=o.space_profile.settings)!=null&&y.shape_svg?(i(),c("span",Su,[a(m,{innerHTML:(w=o.space_profile.settings)==null?void 0:w.shape_svg},null,8,["innerHTML"])])):(i(),c("span",Vu))}const Ne=I(wu,[["render",Lu]]);const Mu={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)}}},Fu=["value","maxlength","placeholder"];function Tu(e,t,o,u,s,n){return i(),c("textarea",{value:o.modelValue,onInput:t[0]||(t[0]=(...m)=>n.onInput&&n.onInput(...m)),onKeydown:t[1]||(t[1]=he(z(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:o.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:o.placeholder},null,40,Fu)}const Pu=I(Mu,[["render",Tu]]),Iu={name:"EyeIcon"},Uu={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Eu(e,t,o,u,s,n){return i(),c("svg",Uu,[...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 Bu=I(Iu,[["render",Eu]]),Au={name:"CalendarIcon"},Du={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ru(e,t,o,u,s,n){return i(),c("svg",Du,[...t[0]||(t[0]=[Pe('<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 Qs=I(Au,[["render",Ru]]);const Hu={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"})},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:Ne,FeedTextComposer:ht,SingleLineTextarea:Pu,EyeIcon:Bu,CalendarIcon:Qs},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:{...Do(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 o=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":o+":"+(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 o;let e=this.currentSpaceSlug;if(!e)return[];let t=((o=this.allSpaces[e])==null?void 0:o.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:{...Us(Le,["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"}},schedulePost(){if(this.scheduleModalVisible=!1,!this.scheduleForm.date||!this.scheduleForm.time){this.feed.scheduled_at=null;return}this.feed.scheduled_at=`${this.scheduleForm.date} ${this.scheduleForm.time}: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=""},async postStatus(e){var t;this.posting=!0;try{const u=await Le().createFeed(this.feedContext,e);if(u.scheduled_at||(this.$notify.success(u.message),this.$emit("added",u.feed),this.$nextTick(()=>{const s=document.getElementById("feed_id_"+u.feed.id);s&&(s.classList.add("fcom_highlight_glow"),setTimeout(()=>{s.classList.remove("fcom_highlight_glow")},4500))})),this.feed=this.initFeed(),this.state="idle",u.scheduled_at){const s=this.formattedDateTime(u.scheduled_at);this.$notify.success(this.$t("Your post has been scheduled for %s. Please find the scheduled post from your profile",s))}this.editorReady=!1}catch(o){this.$handleError(o),(t=o==null?void 0:o.shakes)!=null&&t.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,o=[],u=[];this.each(t,f=>{let h=e.filter(y=>{let w=y.parent_id==f.id&&y.permissions&&y.permissions.can_create_post;return w&&u.push(y.slug),w});h.length&&o.push({label:f.title,spaces:h})});let s=e.filter(f=>!f.parent_id&&f.permissions&&f.permissions.can_create_post);s&&s.length&&o.push({label:this.$t("Others"),spaces:s}),this.globalDisabled||o.unshift({label:"",spaces:[{title:this.$t("On my profile"),slug:"__self__post__"}]}),this.postableSpaces=o;const n=this.appVars.default_post_space;!this.feed.space&&n&&["all_feeds","user_profile_feeds"].includes((m=this.$route)==null?void 0:m.name)&&this.postableSpaces.some(f=>f.spaces.some(h=>h.slug===n))&&(this.feed.space=n)}},mounted(){(this.editing_feed.id||this.defaultState=="active")&&(this.editorReady=!0)}},xu={class:"person_avatar"},Ou=["alt","src"],ju={class:"create_header_content"},Nu={key:0,class:"fcom_create_status_box_header"},zu={class:"user_infos"},qu={class:"feed_user_name"},Gu={class:"feed_meta_info"},Yu={key:1,class:"feed_timestamp"},Wu={class:"create_header_action"},Zu={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},Ku={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},Ju={key:0,class:"fcom_meta_text"},Qu={class:"fcom_post_actions"},Xu={key:0,class:"fcom_post_space_name"},e_={class:"target_label"},t_={ref:"fcom_posting_space",style:{"margin-right":"10px"}},s_={key:0,class:"fcom_space_title"},o_={key:1},i_={class:"fcom_empty_spaces_dropdown"},n_={key:0,class:"fcom_composer_admin_actions"},l_={key:0},a_={class:"dialog_header"},r_={class:"dialog_left schedule_header_left"},c_={class:"dialog_body"},d_={class:"fcom_input_help"},u_={class:"dialog_footer"};function __(e,t,o,u,s,n){const m=g("EditPen"),f=j,h=g("CalendarIcon"),y=x,w=g("EyeIcon"),b=g("Close"),C=g("SingleLineTextarea"),p=ee,k=te,$=g("SpaceIcon"),S=vt,T=pe,F=g("feed-text-composer"),B=Ye,L=de,D=$s,A=ue,U=$e;return n.canPost?(i(),c("div",{key:0,class:H([{state_active:n.isStateActive},"create_status_holder"])},[l("div",{class:H(["create_header",{state_active:n.isStateActive}])},[l("div",xu,[l("img",{alt:o.author.name||e.$t("Your Photo"),src:o.author.avatar||e.auth.avatar},null,8,Ou)]),l("div",ju,[n.isStateActive?_("",!0):(i(),c("div",{key:0,onClick:t[0]||(t[0]=(...P)=>n.makeActive&&n.makeActive(...P)),class:"form_placeholder"},d(n.currentPlaceHolder),1)),l("div",{class:H([{fcom_editor_with_title:s.hasPostTitle,"is-active":n.isStateActive},"fcom_create_status_box"])},[n.isStateActive?(i(),c("div",Nu,[l("div",zu,[l("div",qu,d(n.getPostTitle),1),l("div",Gu,[!o.editing_feed.id&&n.showScheduleInfo?(i(),c("div",{key:0,onClick:t[1]||(t[1]=(...P)=>n.openScheduleModal&&n.openScheduleModal(...P)),class:"feed_scheduled_info"},[l("span",null,d(n.getScheduleLabel),1),a(f,null,{default:r(()=>[a(m)]),_:1})])):(i(),c("span",Yu,d(o.editing_feed.id?e.humanDateDiff(o.editing_feed.created_at):e.dayjs().format(e.appVars.date_time_formatter)),1))])]),l("div",Wu,[n.showScheduleIcon?(i(),v(y,{key:0,onClick:n.openScheduleModal,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0),a(y,{onClick:n.previewPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClick"]),n.isEditing?_("",!0):(i(),v(y,{key:1,class:"close_btn",onClick:n.cancelPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"]))])])):_("",!0),s.editorReady?(i(),v(F,{key:1,context:"feed",placeholder:n.currentPlaceHolder,config:{surveyApp:!0,space_id:n.currentSpaceId,is_admin:n.isCurrentSpaceAdmin||n.isCommunityAdmin,spaceSlug:n.currentSpaceSlug,disableUpload:o.disableUpload,multipleMedia:!0,documentsApp:n.canUploadDoc,videoApp:!0},autofocus:s.isAutoFocus||!s.hasPostTitle,onEditorCreated:t[9]||(t[9]=()=>{s.isAutoFocus=!0}),mentionQuery:n.currentSpaceSlug&&n.currentSpaceSlug!=="__self__post__"?{space:n.currentSpaceSlug}:{},disabled:s.posting,autofocus_changed:s.autofocus_changed,is_editing:!!n.isEditing,content:s.feed},{before_input:r(()=>[s.hasPostTitle?(i(),v(C,{key:0,maxlength:120,autofocus:!0,isActive:n.isStateActive,modelValue:s.feed.title,"onUpdate:modelValue":t[2]||(t[2]=P=>s.feed.title=P),onEnter:t[3]||(t[3]=P=>n.changeAutoFocus()),placeholder:s.hasPostTitle=="required"?e.$t("Short title of this post"):e.$t("Title (optional)")},null,8,["isActive","modelValue","placeholder"])):_("",!0)]),before_composer_footer:r(()=>[q(e.$slots,"before_footer")]),after_input:r(()=>[e.has_pro&&n.currentTopics.length?(i(),c("div",Zu,[a(k,{"popper-class":"fcom_topics_select","multiple-limit":e.appVars.topicsConfig.max_topics_per_post,modelValue:s.feed.topic_ids,"onUpdate:modelValue":t[4]||(t[4]=P=>s.feed.topic_ids=P),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:n.getPlaceholder},{default:r(()=>[(i(!0),c(M,null,R(n.currentTopics,P=>(i(),v(p,{key:P.slug,label:P.title,value:P.id},{default:r(()=>[l("span",Ku,d(P.title),1),P.description?(i(),c("span",Ju,d(P.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["multiple-limit","modelValue","multiple","placeholder"])],512)):_("",!0)]),after_composer_footer:r(()=>[e.hasFeature("mention_mail")&&n.isCurrentSpaceAdmin&&s.feed.send_announcement_email?(i(),c("div",n_,[a(T,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:s.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=P=>s.feed.send_announcement_email=P)},{default:r(()=>[V(d(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(i(),c("span",l_,"("+d(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:r(()=>[l("div",Qu,[o.space&&n.isStateActive?(i(),c("div",Xu,[l("span",null,"#"+d(o.space),1)])):_("",!0),!o.space&&!o.disableSpace?(i(),c(M,{key:1},[l("span",e_,d(e.$t("Posting in:")),1),l("span",t_,[a(k,{modelValue:s.feed.space,"onUpdate:modelValue":t[5]||(t[5]=P=>s.feed.space=P),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]=P=>n.feedSpaceChanged())},{empty:r(()=>[l("p",i_,d(Object.keys(n.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:r(()=>[(i(!0),c(M,null,R(s.postableSpaces,P=>(i(),v(S,{key:P.label,label:P.label},{default:r(()=>[(i(!0),c(M,null,R(P.spaces,O=>(i(),v(p,{key:O.slug,label:O.title,value:O.slug},{default:r(()=>[O.id?(i(),c("span",s_,[a($,{space_profile:O},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(O.title,30)),1)])):(i(),c("span",o_,d(e.getExcerpt(O.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),q(e.$slots,"before_submit_btn"),a(y,{onClick:t[7]||(t[7]=P=>n.post()),disabled:s.posting||n.isEditing&&o.saving,loading:n.isEditing?o.saving:s.posting,class:H(["fcom_primary_button",{fcom_update_button:n.isEditing}])},{default:r(()=>[V(d(n.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),q(e.$slots,"after_composer")],2)])],2),a(U,{modelValue:s.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=P=>s.scheduleModalVisible=P),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:r(()=>[l("div",a_,[l("div",r_,[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:r(()=>[l("div",u_,[a(y,{class:"fcom_secondary_button",onClick:n.cancelSchedule},{default:r(()=>[V(d(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(y,{class:"fcom_primary_button",disabled:n.isScheduleDisabled,onClick:n.schedulePost},{default:r(()=>[V(d(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",c_,[a(A,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(L,{label:e.$t("Date")},{default:r(()=>[a(B,{modelValue:s.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=P=>s.scheduleForm.date=P),type:"date","value-format":"YYYY-MM-DD",format:"YYYY-MM-DD",placeholder:e.$t("Select Date"),"disabled-date":n.isDateDisabled},null,8,["modelValue","placeholder","disabled-date"])]),_:1},8,["label"]),a(L,{label:e.$t("Time")},{default:r(()=>[a(D,{modelValue:s.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=P=>s.scheduleForm.time=P),disabled:!s.scheduleForm.date,style:{width:"210px"},step:"00:10",start:n.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","start","placeholder"])]),_:1},8,["label"])]),_:1}),a(L,null,{default:r(()=>[l("p",d_,d(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const It=I(Hu,[["render",__]]),m_={name:"EditFeed",components:{SpaceIcon:Ne,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,makePublish:!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}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleUpdatePost(e){var o;let t={id:e.id,title:e.title,message:e.message,space:(o=e==null?void 0:e.space)==null?void 0:o.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),this.makePublish&&(t.status="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()}},h_={class:"fcom_feed_edit"},f_={class:"fcom_feed_edit_dialog_header"},p_={key:0,class:"fcom_feed_edit_dialog_body"},g_={key:0},y_={key:0,style:{"margin-top":"5px"}},v_={class:"fcom_space_title"};function b_(e,t,o,u,s,n){const m=g("Close"),f=j,h=pe,y=ee,w=g("SpaceIcon"),b=te,C=g("create-status-form"),p=Y,k=$e,$=J("loading");return i(),c("div",h_,[a(k,{class:"fcom_feed_edit_dialog",modelValue:s.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=S=>s.localDialogVisible=S),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:r(()=>{var S,T;return[G((i(),c("div",null,[l("div",f_,[l("span",null,d(e.$t("Edit Feed")),1),a(f,{onClick:n.handleClose},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),s.feed.id?(i(),c("div",p_,[!(o.hide_create_form&&e.auth.user_id)||e.canEditFeed(s.feed)?(i(),v(C,{key:0,"default-state":"active",btn_text:e.$t("Update"),editing_feed:s.feed,author:o.author,onUpdatePost:n.handleUpdatePost,saving:s.saving,disableSpace:!0,space:(T=(S=s.feed)==null?void 0:S.space)==null?void 0:T.slug},{after_composer:r(()=>[n.canMovePost?(i(),c("div",g_,[a(h,{modelValue:s.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=F=>s.changeSpace=F)},{default:r(()=>[V(d(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),s.changeSpace?(i(),c("div",y_,[a(b,{modelValue:s.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=F=>s.newSpaceId=F),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:r(()=>[a(y,{value:"profile",label:n.profileOptionLabel,disabled:!s.feed.space_id},{default:r(()=>[l("span",null,d(n.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(i(!0),c(M,null,R(e.appVars.auth.spaces,F=>(i(),v(y,{disabled:s.feed.space_id==F.id,key:F.id,label:F.title,value:F.id},{default:r(()=>[l("span",v_,[a(w,{space_profile:F},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(F.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:r(()=>[s.feed.status=="unlisted"?(i(),v(h,{key:0,modelValue:s.makePublish,"onUpdate:modelValue":t[2]||(t[2]=F=>s.makePublish=F)},{default:r(()=>[V(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])):_("",!0)]),_:1},8,["btn_text","editing_feed","author","onUpdatePost","saving","space"])):_("",!0)])):(i(),v(p,{key:1,rows:5,animated:!0}))])),[[$,s.loading]])]}),_:1},8,["modelValue","width"])])}const rs=I(m_,[["render",b_]]),k_={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=Ee(this.xprofile.total_points);return e?e.level:0},withCompletion(){var o;if(!this.with_completion||!((o=this.xprofile)!=null&&o.total_points))return!1;const e=Ee(this.xprofile.total_points),t=Ee(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Ee(this.xprofile.total_points),t=Ee(e.max_points+1),o=this.xprofile.total_points-e.min_points,u=t.min_points-e.min_points,n=o/u*100/100*360;return{backgroundImage:`conic-gradient(rgb(56, 117, 223) ${n}deg, #D9D9D9 ${n}deg)`}}},methods:{setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}}},w_=["src"],C_={key:1,class:"fcom_no_image"},$_={key:0,role:"region","aria-label":"User Level",class:"fcom_user_level_mark"};function S_(e,t,o,u,s,n){return i(),c("div",{class:H([{fcom_avatar_is_rounded:o.is_rounded,is_member_online:o.is_online},"fcom_user_avatar"])},[l("span",{style:le(n.getOutlineStyle),class:H({fcom_compilation_avatar:n.withCompletion})},[o.xprofile?(i(),c("img",{key:0,onError:t[0]||(t[0]=(...m)=>n.setAltImg&&n.setAltImg(...m)),src:o.xprofile.avatar,alt:""},null,40,w_)):(i(),c("span",C_))],6),n.level||o.is_online?(i(),c("div",$_,[l("span",null,d(n.level),1)])):_("",!0)],2)}const cs=I(k_,[["render",S_]]),V_={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Fe,UserAvatar:cs},data(){return{voters:[],loading:!1,showVotersDialog:!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 e;this.loading=!0,this.$get(`feeds/${this.feed.id}/apps/survey-voters/${(e=this.option)==null?void 0:e.slug}`).then(t=>{this.voters=t.voters}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.loadVoters()}},L_={class:"dialog_header"},M_={class:"fcom_filter_menu"},F_={class:"fcom_filter_menu_ul"},T_=["onClick"],P_={key:1},I_={class:"feed_meta_info survey_voters_meta"},U_={class:"meta_line"},E_={class:"meta_line"},B_={class:"voters_list"},A_={class:"voter_avatar"},D_={class:"voter_info"},R_=["title"],H_={key:2,class:"not_found"};function x_(e,t,o,u,s,n){const m=Y,f=g("UserAvatar"),h=g("UserRouteLink"),y=ke,w=$e;return i(),v(w,{modelValue:s.showVotersDialog,"onUpdate:modelValue":t[0]||(t[0]=b=>s.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:n.closeDialog},{header:r(({close:b})=>[l("div",L_,[l("div",M_,[l("ul",F_,[(i(!0),c(M,null,R(o.options,C=>(i(),c("li",{key:C.slug},[l("a",{onClick:z(p=>n.switchOption(C.slug),["prevent"]),class:H({"router-link-exact-active":o.option.slug==C.slug}),href:"#"},d(C.label),11,T_)]))),128))])])])]),default:r(()=>[s.loading?(i(),v(m,{key:0,animated:"",rows:4})):s.voters.length?(i(),c("div",P_,[l("div",I_,[l("span",U_,d(n.getVotePercentage),1),l("span",E_,d(e.$_n("%s Vote","%s Votes",o.option.vote_counts)),1)]),a(y,{"max-height":"800px"},{default:r(()=>[l("div",B_,[(i(!0),c(M,null,R(s.voters,b=>(i(),c("div",{key:b.id,class:"voter_item"},[b.xprofile?(i(),c(M,{key:0},[l("div",A_,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",D_,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(i(),c("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},d(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,R_)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(i(),c("div",H_,[l("p",null,d(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const O_=I(V_,[["render",x_]]),j_={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:O_},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,o={width:t+"%"};return t>0&&t<100&&(o["border-top-right-radius"]=0,o["border-bottom-right-radius"]=0),o},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,o=>{o.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,o=>{e.push(o),o.vote_counts&&(t+=parseInt(o.vote_counts))}),this.formattedOptions=e,this.totalCount=t,this.endingDate=this.feed.meta.survey_config.end_date)}},mounted(){this.setupData()}},N_={class:"fcom_app_options"},z_=["onClick"],q_={class:"fcom_app_text"},G_={class:"fcom_app_input_wrap"},Y_={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},W_={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},Z_=["onClick"],K_={key:0},J_={class:"feed_meta_info"},Q_={key:0,class:"meta_line"},X_=["title"],em=["title"];function tm(e,t,o,u,s,n){const m=g("ArrowRight"),f=j,h=g("SurveyVoters");return i(),c(M,null,[l("div",{class:H(["fcom_app_render",{"no-border":n.shouldHideBorder}])},[l("div",N_,[(i(!0),c(M,null,R(s.formattedOptions,(y,w)=>(i(),c("div",{key:y.slug,onClick:b=>n.toggleVote(w),class:H([y.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",q_,[l("span",G_,[l("span",{class:H("fcom_input_"+s.inputType)},[s.inputType=="single_choice"?(i(),c("svg",Y_,[...t[1]||(t[1]=[l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1)])])):(i(),c("svg",W_,[...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(y.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>n.showVoters(y)},[V(d(y.vote_counts?Math.floor(y.vote_counts/s.totalCount*100)+"%":"")+" ",1),y.vote_counts?(i(),c("span",K_,"("+d(y.vote_counts)+")",1)):_("",!0),y.vote_counts?(i(),v(f,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(m)]),_:1})):_("",!0)],8,Z_),s.totalCount?(i(),c("span",{key:0,style:le(n.getVoteStyle(y.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,z_))),128))]),l("div",J_,[s.totalCount?(i(),c("span",Q_,d(e.$_n("%d vote","%d votes",s.totalCount)),1)):_("",!0),s.endingDate?(i(),c(M,{key:1},[n.isEnded?(i(),c("span",{key:0,title:e.$t("Ended at: %s",s.endingDate),class:"meta_line"},d(n.endedDateLabel),9,X_)):(i(),c("span",{key:1,title:e.$t("Will end at: %s",s.endingDate),class:"meta_line"},d(n.endingDateLabel),9,em))],64)):_("",!0)])],2),s.showVotersDialog?(i(),v(h,{key:0,feed:o.feed,option:s.selectedOption,options:s.formattedOptions,totalCount:s.totalCount,onUpdateOption:n.updateOption,onClose:t[0]||(t[0]=y=>s.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const Xs=I(j_,[["render",tm]]),sm={name:"BookmarkIcon",props:["is_active"]},om={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"},im={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function nm(e,t,o,u,s,n){return o.is_active?(i(),c("svg",om,[...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)])])):(i(),c("svg",im,[...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 eo=I(sm,[["render",nm]]);const lm={name:"RenderChildPost",components:{ImageCarousel:Lt,SurveyRenderer:Xs,DocumentLists:tt,UserRouteLink:Fe,MediaPreview:De,FeedMdContent:Ft},props:["feed_id"],data(){return{feed:null,loading:!1,notFound:null,in_space:this.$route.params.space,hasOverflowContent:!1}},computed:{hasTopMedia(){var t,o,u,s,n,m;if(this.appVars.features.post_layout!="modern"||!this.feed)return!1;let e=["oembed","iframe_html"].includes((o=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:o.type);return e||(e=(s=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:s.is_uploaded),e||(e=((m=(n=this.feed.meta)==null?void 0:n.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()}},am=["id"],rm={key:0,class:"fcom_top_media"},cm={class:"fcom_feed_header_wrap"},dm={class:"feed_header"},um={key:0,class:"feed_user"},_m={class:"feed_user_name"},mm={class:"feed_meta_info"},hm={key:0,class:"meta_line"},fm=["title","href"],pm={key:1,class:"feed_timestamp"},gm={key:0,class:"feed_title"},ym={class:"feed_title_heading"},vm={key:1,class:"expand-button"};function bm(e,t,o,u,s,n){var k,$,S,T,F,B,L,D,A,U;const m=g("media-preview"),f=g("UserAvatar"),h=g("UserRouteLink"),y=g("FeedMdContent"),w=x,b=g("DocumentLists"),C=g("SurveyRenderer"),p=g("ImageCarousel");return s.feed?(i(),c("div",{key:0,onClick:t[0]||(t[0]=(...P)=>n.handleFeedClick&&n.handleFeedClick(...P)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+s.feed.id,class:H([n.feedClasses,"feed"])},[n.hasTopMedia?(i(),c("div",rm,[s.feed.meta&&s.feed.meta.media_preview?(i(),v(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",cm,[l("div",dm,[s.feed.xprofile?(i(),c("div",um,[a(f,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",_m,[a(h,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",mm,[s.feed.content_type=="survey"&&((T=(S=($=(k=s.feed)==null?void 0:k.meta)==null?void 0:$.survey_config)==null?void 0:S.options)!=null&&T.length)?(i(),c("span",hm,d(e.$t("created a poll")),1)):_("",!0),l("a",{title:s.feed.created_at,href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,fm),!s.in_space&&s.feed.space?(i(),c("span",pm,d(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:H([{feed_is_overflow_content:s.hasOverflowContent},"feed_body"])},[s.feed.title?(i(),c("div",gm,[l("h2",ym,d(s.feed.title),1)])):_("",!0),a(y,{class_name:"feed_texts",content:s.feed.message_rendered},null,8,["content"]),s.hasOverflowContent?(i(),c("div",vm,[a(w,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="document"?(i(),v(b,{key:1,document_lists:((B=(F=s.feed)==null?void 0:F.meta)==null?void 0:B.document_lists)||[]},null,8,["document_lists"])):(i(),c(M,{key:2},[s.feed.content_type=="survey"&&((U=(A=(D=(L=s.feed)==null?void 0:L.meta)==null?void 0:D.survey_config)==null?void 0:A.options)!=null&&U.length)?(i(),v(C,{key:0,feed:s.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),s.feed.meta?(i(),c(M,{key:1},[s.feed.meta.media_items?(i(),v(p,{key:0,feed:s.feed},null,8,["feed"])):!n.hasTopMedia&&s.feed.meta.media_preview?(i(),v(m,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,am)])):_("",!0)}const km=I(lm,[["render",bm]]),wm={name:"CustomAppMeta",components:{RenderChildPost:km},props:{feed:{type:Object,required:!0}}},Cm={ref:"fcom_custom_app"},$m={key:0},Sm=["innerHTML"];function Vm(e,t,o,u,s,n){const m=g("RenderChildPost");return i(),c("div",Cm,[o.feed.meta.custom_app_preview.app_name=="child_post"&&o.feed.meta.custom_app_preview.feed_id?(i(),c("div",$m,[a(m,{feed_id:o.feed.meta.custom_app_preview.feed_id},null,8,["feed_id"])])):o.feed.meta.custom_app_preview.custom_html?(i(),c("div",{key:1,innerHTML:o.feed.meta.custom_app_preview.custom_html},null,8,Sm)):_("",!0)],512)}const Lm=I(wm,[["render",Vm]]),Mm={name:"FeedAction",components:{EditFeed:rs},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,o;return!(((t=this.feed)==null?void 0:t.user_id)==((o=this.auth)==null?void 0:o.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}))},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(o=>{var s;let u=((s=o.feed.meta)==null?void 0:s.comments_disabled)=="yes";this.$notify.success(u?this.$t("Comments have been disabled."):this.$t("Comments have been enabled.")),this.feed.meta.comments_disabled=o.feed.meta.comments_disabled}).catch(o=>{this.$handleError(o)}).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(()=>{}))}}},Fm={class:"actions_items"},Tm={key:0},Pm={key:1},Im={key:0},Um={key:1},Em={key:0},Bm={key:1};function Am(e,t,o,u,s,n){var b,C;const m=g("MoreFilled"),f=j,h=x,y=fe,w=g("EditFeed");return i(),c(M,null,[a(y,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(h,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>{var p,k;return[l("ul",Fm,[q(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=$=>n.copyFeedLink())},d(e.$t("Copy Link")),1),n.showReportOption?(i(),c("li",{key:0,onClick:t[1]||(t[1]=$=>n.reportPost())},d(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(o.feed)?(i(),c(M,{key:1},[l("li",{onClick:t[2]||(t[2]=$=>n.editItem())},d(e.$t("Edit")),1),o.feed.space&&e.hasSpaceAdminAccess(o.feed.space)?(i(),c(M,{key:0},[l("li",{onClick:t[3]||(t[3]=$=>n.toggleSticky())},[o.feed.is_sticky?(i(),c("span",Tm,d(e.$t("Unpin from Top")),1)):(i(),c("span",Pm,d(e.$t("Pin to top")),1))]),l("li",{onClick:t[4]||(t[4]=$=>n.toggleSidebarPin())},[o.feed.priority?(i(),c("span",Um,d(e.$t("Unpin from sidebar")),1)):(i(),c("span",Im,d(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(p=o.feed.meta)!=null&&p.media_preview?(i(),c("li",{key:1,onClick:t[5]||(t[5]=$=>n.removePreview())},d(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(o.feed.space)?(i(),c("li",{key:2,onClick:t[6]||(t[6]=$=>n.toggleCommentStatus())},[((k=o.feed.meta)==null?void 0:k.comments_disabled)=="yes"?(i(),c("span",Em,d(e.$t("Enable comments")),1)):(i(),c("span",Bm,d(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(o.feed)?(i(),c("li",{key:2,onClick:t[7]||(t[7]=$=>n.deleteItem())},d(e.$t("Delete")),1)):_("",!0),q(e.$slots,"after_feed_actions_pop")])]}),_:3},512),s.isEdit?(i(),v(w,{key:0,feedSlug:o.feed.slug,dialogVisible:s.isEdit,hide_create_form:o.hide_create_form,author:{name:(b=o.feed.xprofile)==null?void 0:b.display_name,avatar:(C=o.feed.xprofile)==null?void 0:C.avatar},onUpdated:n.handleUpdate,onClose:t[8]||(t[8]=p=>s.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const to=I(Mm,[["render",Am]]);const Dm={name:"Feed",components:{DocumentLists:tt,CustomAppMeta:Lm,BookmarkIcon:eo,StickyIcon:Mt,UserRouteLink:Fe,EditFeed:rs,FeedFooter:ku,MediaPreview:De,ImageCarousel:Lt,SurveyRenderer:Xs,ReportReview:Ws,FeedAction:to,FeedMdContent:Ft},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&&((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,o,u,s,n,m;if(this.appVars.features.post_layout!="modern")return!1;let e=["oembed","iframe_html"].includes((o=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:o.type);return e||(e=(s=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:s.is_uploaded),e||(e=((m=(n=this.feed.meta)==null?void 0:n.media_items)==null?void 0:m.length)==1),e}},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},showFullContent(e){if(!this.hasFeature("show_post_modal")){this.hasOverflowContent=!1,this.isExpanded=!0;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 o=e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,n,m,f)=>s.startsWith("<a")&&!s.includes('target="_blank"')?s.includes(window.location.origin)?s:s.replace("<a",'<a target="_blank" rel="noopener noreferrer nofollow"'):n&&!this.isInsideHtmlTag(f,m)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${n}">#${n}</a>`:s);return o.indexOf('<span class="fcom_dynamic_prop" data-type="timestamp"')===-1?o:(s=>s.replace(/<span class="fcom_dynamic_prop" data-type="timestamp" data-timestamp="(\d+)">([^<]+)<\/span>/g,(n,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return n;const w=h.local().format("D MMM YYYY, LT (")+this.currentTimeZoneName+")";return`<span class="fcom_timestamp" title="${f}">${w}</span>`}catch{return n}}))(o)},isInsideHtmlTag(e,t){let o=!1;for(let u=0;u<t;u++)e[u]==="<"&&(o=!0),e[u]===">"&&(o=!1);return o},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})}},created(){this.$eventBus.on("updateModerationReport",e=>{var t,o;((t=e.content)==null?void 0:t.id)==((o=this.feed)==null?void 0:o.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)))})},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)}},Rm=["id"],Hm={key:1,class:"fcom_top_media"},xm={key:2,class:"fcom_feed_header_wrap"},Om={class:"feed_actions fcom_concat_buttons"},jm={key:0,class:"fcom_feed_topics"},Nm={class:"feed_header"},zm={key:0,class:"feed_user"},qm={class:"feed_user_info"},Gm={class:"feed_user_name"},Ym={key:0,class:"feed_status"},Wm={key:1,class:"feed_status"},Zm={class:"feed_meta_info"},Km={key:0,class:"meta_line"},Jm=["title","href"],Qm=["title","href"],Xm={key:3},eh={key:0,class:"feed_title"},th={key:0,class:"feed_title_heading"},sh=["href"],oh={key:1,class:"feed_title_heading"};function ih(e,t,o,u,s,n){var P,O,N,Q,_e,ne,E,K,ae,W,re,oe,se;const m=g("report-review"),f=g("media-preview"),h=x,y=g("StickyIcon"),w=j,b=g("BookmarkIcon"),C=g("FeedAction"),p=g("router-link"),k=g("UserAvatar"),$=g("UserRouteLink"),S=Ue,T=g("FeedMdContent"),F=g("SurveyRenderer"),B=g("ImageCarousel"),L=g("DocumentLists"),D=g("CustomAppMeta"),A=g("feed-footer"),U=J("loading");return G((i(),c("div",{id:"feed_id_"+((P=o.feed)==null?void 0:P.id),class:H([n.feedClasses,"feed"])},[n.showReport?(i(),v(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0),n.hasTopMedia?(i(),c("div",Hm,[o.feed.meta&&o.feed.meta.media_preview?(i(),v(f,{key:0,feed:o.feed,is_preview:o.is_preview},null,8,["feed","is_preview"])):_("",!0)])):_("",!0),o.show_header?(i(),c("div",xm,[l("div",Om,[e.auth.user_id&&!e.hasSpaceAccess((O=o.feed.space)==null?void 0:O.slug)&&!o.is_single&&!o.isSingleSpacePage?(i(),v(h,{key:0,loading:s.joiningSpace,class:"fcom_secondary_button join_button",onClick:t[0]||(t[0]=me=>n.joinSpace())},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),o.show_actions?(i(),c(M,{key:1},[o.feed.is_sticky&&s.in_space?(i(),v(h,{key:0,onClick:t[1]||(t[1]=me=>n.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(w,{class:"fcom_sticky"},{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])):_("",!0),e.auth.user_id?(i(),v(h,{key:1,"aria-label":e.$t("Toggle Bookmark"),size:"small",text:"",onClick:t[2]||(t[2]=me=>n.toggleBookmark()),class:H([{bookmark_active:o.feed.bookmarked},"feed_bookmark no_pad_btn"]),title:o.feed.bookmarked?e.$t("Remove From Bookmark"):e.$t("Bookmark this post")},{default:r(()=>[a(w,{style:{"font-size":"14px"}},{default:r(()=>[a(b,{is_active:o.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a(C,{feed:o.feed,hide_create_form:o.hide_create_form,onUpdated:n.handleUpdate,onDeleted:n.handleDelete},{before_feed_actions_pop:r(()=>[o.is_route?(i(),c("li",{key:0,onClick:t[3]||(t[3]=me=>e.$emit("reload"))},d(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),q(e.$slots,"after_feed_actions")]),((N=e.appVars.topicsConfig)==null?void 0:N.show_on_post_card)=="yes"&&o.feed.terms&&o.feed.terms.length?(i(),c("div",jm,[(i(!0),c(M,null,R(o.feed.terms,me=>(i(),v(p,{onClick:z(sI=>n.gotoTopicUrl(me.slug),["prevent"]),key:me.slug,to:n.getTopicRoute(me.slug),class:"feed_timestamp"},{default:r(()=>[V("#"+d(me.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",Nm,[o.feed.xprofile?(i(),c("div",zm,[a(k,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",qm,[l("div",Gm,[a($,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"]),o.feed.status=="pending"?(i(),c("span",Ym,[a(S,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0),o.feed.status=="scheduled"?(i(),c("span",Wm,[a(S,{type:"warning"},{default:r(()=>[V(d(e.$t("Scheduled")),1)]),_:1})])):_("",!0)]),l("div",Zm,[o.feed.content_type=="survey"&&((E=(ne=(_e=(Q=o.feed)==null?void 0:Q.meta)==null?void 0:_e.survey_config)==null?void 0:ne.options)!=null&&E.length)?(i(),c("span",Km,d(e.$t("created a poll")),1)):_("",!0),o.feed.status=="scheduled"?(i(),c("a",{key:1,title:o.feed.scheduled_at,onClick:t[4]||(t[4]=(...me)=>n.gotoFeed&&n.gotoFeed(...me)),href:o.feed.permalink,class:"feed_timestamp"},d(n.getScheduledTime(o.feed.scheduled_at)),9,Jm)):(i(),c("a",{key:2,title:o.feed.created_at,onClick:t[5]||(t[5]=(...me)=>n.gotoFeed&&n.gotoFeed(...me)),href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,Qm)),!s.in_space&&o.feed.space?(i(),c("span",Xm,[a(p,{to:n.getSpaceRoute(o.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),q(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:H([{feed_is_overflow_content:s.hasOverflowContent},"feed_body"])},[o.feed.title?(i(),c("div",eh,[o.is_single?(i(),c("h2",oh,d(o.feed.title),1)):(i(),c("h2",th,[l("a",{onClick:t[6]||(t[6]=z((...me)=>n.showFullContent&&n.showFullContent(...me),["prevent"])),href:o.feed.permalink},d(o.feed.title),9,sh)]))])):_("",!0),a(T,{class_name:"feed_texts",content:n.parseMessage(o.feed.message_rendered)},null,8,["content"]),s.hasOverflowContent&&!s.isExpanded?(i(),c("div",{key:1,onClick:t[7]||(t[7]=me=>n.showFullContent()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:r(()=>[V(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="survey"&&((re=(W=(ae=(K=o.feed)==null?void 0:K.meta)==null?void 0:ae.survey_config)==null?void 0:W.options)!=null&&re.length)?(i(),c(M,{key:3},[a(F,{feed:o.feed,is_preview:o.is_preview,hasTopMedia:n.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),o.feed.meta.media_items?(i(),v(B,{key:0,is_single:o.is_single,feed:o.feed},null,8,["is_single","feed"])):!n.hasTopMedia&&o.feed.meta.media_preview?(i(),v(f,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):o.feed.content_type=="document"?(i(),v(L,{key:4,document_lists:((se=(oe=o.feed)==null?void 0:oe.meta)==null?void 0:se.document_lists)||[]},null,8,["document_lists"])):o.feed.meta?(i(),c(M,{key:5},[o.feed.meta.media_items?(i(),v(B,{key:0,is_single:o.is_single,feed:o.feed},null,8,["is_single","feed"])):!n.hasTopMedia&&o.feed.meta.media_preview?(i(),v(f,{key:1,feed:o.feed},null,8,["feed"])):_("",!0),o.feed.meta.custom_app_preview?(i(),v(D,{key:2,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),o.show_footer?(i(),v(A,{key:6,feed:o.feed,is_modal:o.is_modal,is_single:o.is_single,space_slug:n.space_slug,onJoinSpace:t[8]||(t[8]=()=>{n.joinSpace()}),onCommented:t[9]||(t[9]=me=>{e.$emit("commented",me)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),q(e.$slots,"after_feed_footer")],10,Rm)),[[U,s.working]])}const ot=I(Dm,[["render",ih]]),nh={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()}},lh={name:"FeedCard",mixins:[nh],components:{UserRouteLink:Fe,ChatIcon:Xe,HeartIcon:et,StickyIcon:Mt,MediaPreview:De,ImageCarousel:Lt,UserAvatar:cs,FeedAction:to},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},placeholderImageSrc(){const e=this.isDarkMode?"feed-placeholder-dark.png":"feed-placeholder.png";return this.appVars.assets_url+"images/"+e},cardImage(){var t,o,u,s,n;const e=this.feed.meta;return e?(t=e.media_preview)!=null&&t.image?e.media_preview.image:(u=(o=e.media_items)==null?void 0:o[0])!=null&&u.url?e.media_items[0].url:((s=e.media_preview)==null?void 0:s.type)==="iframe_html"&&((n=e.media_preview)!=null&&n.html)?this.extractIframeThumbnail(e.media_preview.html)||this.placeholderImageSrc:this.placeholderImageSrc:this.placeholderImageSrc}},data(){return{in_space:this.$route.params.space}},methods:{extractIframeThumbnail(e){const t=e.match(/src=["']([^"']+)["']/);if(!t)return null;const o=t[1],u=[[/youtube\.com\/embed\/([^?/]+)/,s=>"https://img.youtube.com/vi/"+s+"/hqdefault.jpg"],[/player\.vimeo\.com\/video\/([^?/]+)/,s=>"https://vumbnail.com/"+s+".jpg"],[/fast\.wistia\.net\/embed\/iframe\/([^?/]+)/,s=>"https://fast.wistia.net/embed/medias/"+s+"/swatch"],[/dailymotion\.com\/(?:embed\/video|player\.html\?video=)\/?([^?/&]+)/,s=>"https://www.dailymotion.com/thumbnail/video/"+s]];for(const[s,n]of u){const m=o.match(s);if(m)return n(m[1])}return null},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(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})}}},ah=["id"],rh={class:"fcom_feed_card_header"},ch=["src","alt"],dh={class:"feed_card_user"},uh={class:"feed_card_body"},_h={class:"fcom_feed_title_row"},mh=["innerHTML"],hh={key:0,class:"feed_status"},fh={class:"card_description feed_meta_info"},ph=["title","href"],gh={key:0},yh={class:"fcom_feed_card_footer"},vh={class:"num_label"},bh={class:"num_label"},kh={class:"fcom_feed_card_action"};function wh(e,t,o,u,s,n){var $;const m=g("UserAvatar"),f=Ue,h=g("UserRouteLink"),y=g("router-link"),w=g("HeartIcon"),b=j,C=x,p=g("ChatIcon"),k=g("FeedAction");return i(),c("div",{id:"feed_id_"+(($=o.feed)==null?void 0:$.id),class:"fcom_feed_card"},[l("div",rh,[l("div",{onClick:t[0]||(t[0]=(...S)=>n.goToFeedView&&n.goToFeedView(...S)),class:"feed_card_cover"},[l("img",{src:n.cardImage,class:"card_image",alt:o.feed.title||e.$t("Placeholder image")},null,8,ch)]),l("div",dh,[a(m,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"])]),l("div",uh,[l("div",_h,[l("div",{onClick:t[1]||(t[1]=(...S)=>n.goToFeedView&&n.goToFeedView(...S)),class:"card_title feed_texts feed_md_content",innerHTML:e.getExcerpt(o.feed.title||o.feed.message_rendered,60)},null,8,mh),o.feed.status=="pending"?(i(),c("span",hh,[a(f,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",fh,[a(h,{xprofile:o.feed.xprofile,show_verified:!1,show_follow:!0},null,8,["xprofile"]),l("a",{title:o.feed.created_at,onClick:t[2]||(t[2]=(...S)=>n.goToFeedView&&n.goToFeedView(...S)),href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,ph),!s.in_space&&o.feed.space?(i(),c("span",gh,[a(y,{to:n.getSpaceRoute(o.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t(e.getExcerpt(o.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",yh,[a(C,{text:""},{default:r(()=>[a(b,{class:H({user_reacted:o.feed.has_user_react}),onClick:t[3]||(t[3]=S=>n.toggleReact())},{default:r(()=>[a(w,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",vh,d(o.feed.reactions_count),1)]),_:1}),a(C,{onClick:t[4]||(t[4]=S=>n.goToFeedView(S,!0)),text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(p)]),_:1}),l("span",bh,d(o.feed.comments_count),1)]),_:1})]),l("div",kh,[a(k,{feed:o.feed,hide_create_form:o.hide_create_form,onUpdated:n.handleUpdate,onDeleted:n.handleDelete},null,8,["feed","hide_create_form","onUpdated","onDeleted"])])],8,ah)}const Ch=I(lh,[["render",wh]]),$h={name:"FeedListItem",components:{UserRouteLink:Fe,ChatIcon:Xe,HeartIcon:et,StickyIcon:Mt},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,(o,u,s,n)=>o.startsWith("<a")&&!o.includes('target="_blank"')?o.includes(window.location.origin)?o:o.replace("<a",'<a target="_blank" rel="noopener"'):u&&!this.isInsideHtmlTag(n,s)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${u}">#${u}</a>`:o)},isInsideHtmlTag(e,t){let o=!1;for(let u=0;u<t;u++)e[u]==="<"&&(o=!0),e[u]===">"&&(o=!1);return o},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})}}},Sh=["id"],Vh={class:"fcom_feed_data"},Lh={key:0,class:"fcom_sticky"},Mh={class:"feed_user"},Fh=["href"],Th=["href"],Ph={class:"fcom_feed_title_row"},Ih=["innerHTML"],Uh={key:0,class:"feed_status"},Eh={class:"fcom_feed_meta"},Bh={key:0},Ah={class:"feed_actions"},Dh={class:"num_label"},Rh={class:"num_label"};function Hh(e,t,o,u,s,n){var p,k,$;const m=g("StickyIcon"),f=j,h=g("UserAvatar"),y=Ue,w=g("HeartIcon"),b=x,C=g("ChatIcon");return i(),c("div",{id:"feed_id_"+((p=o.feed)==null?void 0:p.id),class:"fcom_feed_list"},[l("div",Vh,[o.feed.is_sticky?(i(),c("div",Lh,[a(f,{class:"fcom_sticky"},{default:r(()=>[a(m)]),_:1})])):_("",!0),l("div",Mh,[l("a",{href:n.getFeedHref(),onClick:t[0]||(t[0]=(...S)=>n.goToFeedView&&n.goToFeedView(...S))},[a(h,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"])],8,Fh)]),l("a",{href:n.getFeedHref(),onClick:t[1]||(t[1]=(...S)=>n.goToFeedView&&n.goToFeedView(...S)),class:"feed_body"},[l("div",Ph,[l("div",{class:"feed_texts feed_md_content",innerHTML:e.getExcerpt(o.feed.title||o.feed.message_rendered,250)},null,8,Ih),o.feed.status=="pending"?(i(),c("span",Uh,[a(y,{type:"warning"},{default:r(()=>[V(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Eh,[V(d((($=(k=o.feed)==null?void 0:k.xprofile)==null?void 0:$.display_name)||"No Name")+" • "+d(e.humanDateDiff(o.feed.created_at))+" ",1),!s.in_space&&o.feed.space?(i(),c("span",Bh,"• #"+d(o.feed.space.slug),1)):_("",!0)])],8,Th)]),l("div",Ah,[a(b,{text:""},{default:r(()=>[a(f,{class:H({user_reacted:o.feed.has_user_react}),onClick:t[2]||(t[2]=S=>n.toggleReact())},{default:r(()=>[a(w,{filled:o.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Dh,d(o.feed.reactions_count),1)]),_:1}),a(b,{onClick:t[3]||(t[3]=S=>n.goToFeedView(S,!0)),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(C)]),_:1}),l("span",Rh,d(o.feed.comments_count),1)]),_:1})])],8,Sh)}const so=I($h,[["render",Hh]]),xh={name:"SwitchTimelineIcon"},Oh={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function jh(e,t,o,u,s,n){return i(),c("svg",Oh,[...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 Nh=I(xh,[["render",jh]]),zh={name:"SwitchListIcon"},qh={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"};function Gh(e,t,o,u,s,n){return i(),c("svg",qh,[...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 Yh=I(zh,[["render",Gh]]),Wh={name:"SwitchCardIcon"},Zh={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"};function Kh(e,t,o,u,s,n){return i(),c("svg",Zh,[...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 Jh=I(Wh,[["render",Kh]]),Qh={name:"DoubleChevronUpIcon",props:{fill:{type:String,default:"currentColor"}}},Xh=["fill"];function ef(e,t,o,u,s,n){return i(),c("svg",{fill:o.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,Xh)}const tf=I(Qh,[["render",ef]]),sf={name:"ScrollToTop",components:{DoubleChevronUpIcon:tf},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)}},of=["aria-label"],nf={class:"fcom_scroll_to_top_icon"};function lf(e,t,o,u,s,n){const m=g("DoubleChevronUpIcon");return i(),v(ws,{"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:r(()=>[s.visible?(i(),c("button",{key:0,type:"button",class:"fcom_scroll_to_top","aria-label":e.$t("Scroll to top"),onClick:t[0]||(t[0]=(...f)=>n.scrollToTop&&n.scrollToTop(...f))},[l("span",nf,[a(m)])],8,of)):_("",!0)]),_:1})}const af=I(sf,[["render",lf]]),rf={name:"AllFeeds",emits:["refetch","update:loading"],inheritAttrs:!1,setup(){const e=Le(),t=Ge();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:Ch,FeedListItem:so,SwitchTimelineIcon:Nh,SwitchListIcon:Yh,SwitchCardIcon:Jh,ScrollToTop:af},watch:{space(e){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}},data(){return{appReady:!0,sort_by:"",search:this.$route.query.search||"",custom_layout_style:this.layout_style,disable_sticky:!1,boundHandler:null}},methods:{...Us(Le,["fetchFeeds","createFeed","updateFeed","deleteFeed","resetContext"]),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,search_in:this.searchIn},e)}catch(t){this.$handleError(t)}},handleSortByChange(){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(o){this.$handleError(o)}},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(o){this.$handleError(o)}},handleLoadMore(){var s;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(),o=(s=window.fcomLayoutRef)==null?void 0:s.wrapRef;!o||t.bottom-o.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.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(){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.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}}))}),this.$nextTick(()=>{var t;const e=this.uiStore.restoreScrollPosition(this.$route.path);e>0&&((t=window.fcomLayoutRef)!=null&&t.wrapRef)&&setTimeout(()=>{window.fcomLayoutRef.setScrollTop(e)},100)})},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()}},cf={key:1,class:"feed_filters"},df={id:"feed_short_by",class:"fcom_feed_filter_label"},uf={key:1,class:"fcom_layout_switch"},_f={class:"fcom_icon_menu"},mf={class:"fcom_icon_menu"},hf={class:"fcom_icon_menu"},ff={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},pf={key:0},gf={key:3,class:"fcom_sticky_feed"},yf={class:"all_feeds_holder"},vf={key:0,style:{"margin-top":"20px","text-align":"center"}},bf={key:5},kf={class:"feed_outer"},wf={class:"feed"},Cf={style:{"text-align":"center"},class:"feed_body not_found"},$f={key:0},Sf={key:1},Vf={key:2};function Lf(e,t,o,u,s,n){const m=g("create-status-form"),f=ee,h=te,y=g("SwitchCardIcon"),w=g("SwitchListIcon"),b=g("SwitchTimelineIcon"),C=j,p=x,k=Ze,$=Ke,S=Je,T=g("feed"),F=g("FeedListItem"),B=g("FeedCard"),L=Y,D=g("ScrollToTop");return i(),c(M,null,[q(e.$slots,"before_create_form"),!o.hide_create_form&&e.auth.user_id?(i(),v(m,{key:0,space:o.space,btn_text:e.$t("Post")},null,8,["space","btn_text"])):_("",!0),q(e.$slots,"before_feeds"),o.hide_filters?_("",!0):(i(),c("div",cf,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),o.can_change_order?(i(),c(M,{key:0},[l("span",df,d(e.$t("Sort by:")),1),a(h,{modelValue:s.sort_by,"onUpdate:modelValue":t[0]||(t[0]=A=>s.sort_by=A),"aria-label":e.$t("Posts Order by"),class:"fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Latest Posts"),onChange:t[1]||(t[1]=A=>n.handleSortByChange())},{default:r(()=>[(i(!0),c(M,null,R(n.computedPostOrderOptions,(A,U)=>(i(),v(f,{key:U,value:U,label:A},null,8,["value","label"]))),128))]),_:1},8,["modelValue","aria-label","placeholder"])],64)):_("",!0),o.can_change_layout&&o.feed_name&&e.hasFeature("can_switch_layout")?(i(),c("div",uf,[a(S,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a($,{class:"fcom_layout_dropdown_menu"},{default:r(()=>[a(k,{onClick:t[2]||(t[2]=A=>n.switchView("card")),class:H({selected_layout:s.custom_layout_style==="card"})},{default:r(()=>[l("div",_f,[a(y),l("span",null,d(e.$t("Card")),1)])]),_:1},8,["class"]),a(k,{onClick:t[3]||(t[3]=A=>n.switchView("list")),class:H({selected_layout:s.custom_layout_style==="list"})},{default:r(()=>[l("div",mf,[a(w),l("span",null,d(e.$t("List")),1)])]),_:1},8,["class"]),a(k,{onClick:t[4]||(t[4]=A=>n.switchView("timeline")),class:H({selected_layout:s.custom_layout_style==="timeline"})},{default:r(()=>[l("div",hf,[a(b),l("span",null,d(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:r(()=>[a(p,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:r(()=>[a(C,{class:H(["fcom_layout_icon",s.custom_layout_style])},{default:r(()=>[s.custom_layout_style=="card"?(i(),v(y,{key:0})):s.custom_layout_style=="list"?(i(),v(w,{key:1})):(i(),v(b,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),n.pagination.total&&s.search?(i(),c("div",ff,[V(d(e.$_n("%s result found","%s results found",n.pagination.total))+" ",1),n.execution_time?(i(),c("span",pf,d(e.$t("in %ss",n.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),n.sticky?(i(),c("div",gf,[a(T,{onReload:t[5]||(t[5]=A=>{n.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[6]||(t[6]=A=>{n.sticky=A}),onDeleted:t[7]||(t[7]=()=>{n.sticky=null}),feed:n.sticky,isSingleSpacePage:!!o.space},null,8,["feed","isSingleSpacePage"])])):_("",!0),n.feeds.length?(i(),c("div",{key:4,ref:"all_feeds_wrap",class:H(["fcom_feed_style_"+n.currentLayoutStyle,"all_feeds"])},[l("div",yf,[(i(!0),c(M,null,R(n.feeds,(A,U)=>(i(),c("div",{key:A.id,class:"feed_outer"},[n.currentLayoutStyle=="list"?(i(),v(F,{key:0,feed:A},null,8,["feed"])):n.currentLayoutStyle=="card"?(i(),v(B,{key:1,feed:A,hide_create_form:o.hide_create_form,onUpdated:P=>n.handleUpdate(P,U),onDeleted:()=>n.handleDelete(U),onRemoved:()=>n.handleRemoveFromList(U)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(i(),v(T,{key:2,feed:A,isSingleSpacePage:!!o.space,show_report:!0,layout_style:n.currentLayoutStyle,hide_create_form:o.hide_create_form,onUpdated:P=>n.handleUpdate(P,U),onDeleted:()=>n.handleDelete(U),onRemoved:()=>n.handleRemoveFromList(U)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),n.disableAutoLoad?_("",!0):(i(),c("div",vf,[a(p,{class:"fcom_secondary_button",disabled:n.loading,loading:n.loading,onClick:t[8]||(t[8]=A=>n.fetchFeedsFromStore(!0))},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])]))],2)):!n.loading&&!n.sticky?(i(),c("div",bf,[l("div",kf,[l("div",wf,[l("div",Cf,[s.search?(i(),c("p",$f,d(e.$t("No results found based on your search criteria")),1)):o.topic_slug?(i(),c("p",Sf,d(e.$t("No posts found for the selected topic")),1)):(i(),c("p",Vf,d(e.$t("No posts found!")),1))])])])])):_("",!0),n.loading&&!n.feeds.length?(i(),c(M,{key:6},[a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),n.pagination.page==1?(i(),c(M,{key:0},[a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})],64)):_("",!0)],64)):_("",!0),a(D,{threshold:500})],64)}const ft=I(rf,[["render",Lf]]),Mf={name:"SearchBar",components:{SpaceIcon:Ne,AllFeeds:ft,SearchIcon:Te,Loading:jo},data(){return{search:"",SearchIcon:Zt(Te),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:{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 o=this.$refs.feedsRef;!o.loading&&o.pagination.page<o.pagination.last_page&&(o.pagination.page++,o.fetchFeeds(!0))}},keyBind(e){e.key==="k"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.showingSearch?this.showingSearch=!1:this.openSearch())},handleOpen(){this.formatSearchGroups(),this.$nextTick(()=>{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,o=[];this.each(t,u=>{let s=e.filter(n=>n.parent_id==u.id&&n.permissions&&n.permissions.can_view_posts);s.length&&o.push({label:u.title,spaces:s})}),this.searchGroups=o}},mounted(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("route_updated",()=>{this.showingSearch=!1})},beforeUnmount(){document.removeEventListener("keydown",this.keyBind)}},Ff={class:"fcom_search_header"},Tf={key:0,class:"fcom_space_title"},Pf={key:1},If={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},Uf={key:0,class:"fcom_search_results"},Ef={key:1,class:"fcom_search_welcome"};function Bf(e,t,o,u,s,n){const m=g("SearchIcon"),f=j,h=g("Loading"),y=ee,w=g("SpaceIcon"),b=vt,C=te,p=X,k=pe,$=Ss,S=g("all-feeds"),T=ke,F=$e;return i(),c(M,null,[l("button",{class:"fcom_menu_button",onClick:t[0]||(t[0]=B=>n.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:r(()=>[a(m)]),_:1})]),s.showingSearch?(i(),v(F,{key:0,top:"60px","append-to-body":!0,"lock-scroll":!0,"modal-class":"fcom_search_bar_visible",modelValue:s.showingSearch,"onUpdate:modelValue":t[5]||(t[5]=B=>s.showingSearch=B),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:r(()=>[l("div",Ff,[a(p,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",modelValue:s.search,"onUpdate:modelValue":t[2]||(t[2]=B=>s.search=B),placeholder:n.placeholder,onKeyup:he(n.toSearch,["enter"]),onClear:n.onClear,clearable:""},ve({prefix:r(()=>[a(f,{onClick:n.toSearch},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),append:r(()=>[a(C,{class:"fcom_minimal_select fcom_global_search_append",modelValue:s.search_space,"onUpdate:modelValue":t[1]||(t[1]=B=>s.search_space=B),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:r(()=>[a(y,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(i(!0),c(M,null,R(s.searchGroups,B=>(i(),v(b,{key:B.label,label:B.label},{default:r(()=>[(i(!0),c(M,null,R(B.spaces,L=>(i(),v(y,{key:L.slug,label:L.title,value:L.slug},{default:r(()=>[L.id?(i(),c("span",Tf,[a(w,{space_profile:L},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(L.title,30)),1)])):(i(),c("span",Pf,d(e.getExcerpt(L.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:2},[s.searching?{name:"suffix",fn:r(()=>[a(f,{class:"is-loading fcom_search_spinner"},{default:r(()=>[a(h)]),_:1})]),key:"0"}:void 0]),1032,["modelValue","placeholder","onKeyup","onClear"]),l("div",If,[l("span",null,d(e.$t("Search in:")),1),a($,{modelValue:s.searchIn,"onUpdate:modelValue":t[3]||(t[3]=B=>s.searchIn=B),class:"fcom_search_in"},{default:r(()=>[a(k,{value:"post_content",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Post Title & Content")),1)]),_:1}),a(k,{value:"post_comments",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:r(()=>[s.perform_search?(i(),c("div",Uf,[a(T,{ref:"feedsScroller",onScroll:n.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:r(()=>[a(S,{searchIn:s.searchIn,layout_style:"list",feed_name:"search_results",context_suffix:"search",space:s.search_space!="__all__"?s.search_space:"",ref:"feedsRef",default_search:s.search,hide_filters:!1,hide_create_form:!0,"onUpdate:loading":t[4]||(t[4]=B=>s.searching=B)},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(i(),c("div",Ef,[a(f,null,{default:r(()=>[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,[V(d(e.$t("Tip: Quick-launch search with"))+" ",1),t[6]||(t[6]=l("b",null,"⌘ + K",-1)),V(" (Mac) "+d(e.$t("or"))+" ",1),t[7]||(t[7]=l("b",null,"Ctrl + K",-1)),t[8]||(t[8]=V(" (Windows/Linux)",-1))])]))]),_:1},8,["modelValue","width"])):_("",!0)],64)}const Af=I(Mf,[["render",Bf]]),Df={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 o=this.closeConfirmationMessage||this.$t("Are you sure you want to close this?");this.$confirm(o,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()}}},Rf=["id"];function Hf(e,t,o,u,s,n){const m=bt;return i(),v(m,$o({"model-value":o.modelValue,"onUpdate:modelValue":t[0]||(t[0]=f=>e.$emit("update:modelValue",f)),direction:n.elDirection,size:o.size,modal:o.modal,"modal-class":o.modalClass,class:o.drawerClass,"close-on-click-modal":o.closeOnClickModal,"append-to-body":o.appendToBody,"destroy-on-close":o.destroyOnClose,"show-close":o.showClose,"with-header":o.withHeader,"lock-scroll":o.lockScroll,"open-delay":o.openDelay,"close-delay":o.closeDelay},o.zIndex!==null?{"z-index":o.zIndex}:{},{id:o.id,"before-close":n.handleBeforeClose}),ve({default:r(()=>[l("div",{class:H(o.bodyClass)},[q(e.$slots,"default")],2)]),_:2},[o.withHeader?{name:"header",fn:r(({close:f,titleId:h,titleClass:y})=>[q(e.$slots,"header",{close:f,titleId:h,titleClass:y},()=>[o.title?(i(),c("h4",{key:0,id:h,class:H([y,o.headerClass]),style:{margin:"0"}},d(o.title),11,Rf)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:r(()=>[l("div",{class:H(o.footerClass)},[q(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 oo=I(Df,[["render",Hf]]);const xf={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])}}},Of={class:"fcom_svg_generator"},jf={class:"fcom_form_item"},Nf={class:"fcom_form_item"},zf=["innerHTML"];function qf(e,t,o,u,s,n){const m=kt,f=We,h=be;return i(),c("div",Of,[l("div",jf,[l("label",null,d(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:s.currentColor,"onUpdate:modelValue":t[0]||(t[0]=y=>s.currentColor=y),onActiveChange:n.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",Nf,[l("label",null,d(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=y=>n.selectShape(s.selectedShape)),modelValue:s.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=y=>s.selectedShape=y)},{default:r(()=>[(i(!0),c(M,null,R(n.svgShapes,(y,w)=>(i(),v(f,{key:w,value:w},{default:r(()=>[l("div",{innerHTML:y},null,8,zf)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const Gf=I(xf,[["render",qf]]),Yf={name:"LogoEmojiSelector",components:{EmojiPicker:qs,ImageUploader:je,SvgShapeGenerator:Gf,ActionPopover:as},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"}}},Wf=["innerHTML"];function Zf(e,t,o,u,s,n){const m=x,f=g("EmojiPicker"),h=X,y=wt,w=g("SvgShapeGenerator"),b=Ie,C=g("ImageUploader"),p=Ct,k=g("action-popover");return i(),v(k,{ref:"iconPicker","close-on-click-outside":!0,"trigger-interactive":!0,width:e.modalWidth},{trigger:r(()=>[a(m,{"aria-label":"Pick Emoji",style:{padding:"4px 16px",display:"flex","justify-content":"center","align-items":"center"}},{default:r(()=>[l("span",{class:"logo_emoji_holder",style:{cursor:"pointer"},innerHTML:n.currentMark||""},null,8,Wf)]),_:1})]),default:r(({hide:$})=>[l("div",null,[a(p,{modelValue:s.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=S=>s.selectedTab=S),type:"border-card"},{default:r(()=>[a(y,{name:"emoji",label:e.$t("Emoji")},{default:r(()=>[a(h,{onChange:t[1]||(t[1]=S=>n.setData("emoji")),modelValue:s.emoji,"onUpdate:modelValue":t[2]||(t[2]=S=>s.emoji=S),placeholder:e.$t("Select or paste your emoji here"),style:{width:"100%"}},ve({_:2},[e.has_pro?{name:"append",fn:r(()=>[a(f,{close_on_select:!0,onEmojiSelected:t[0]||(t[0]=S=>{s.emoji=S,n.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(y,{name:"shape",label:e.$t("Shape")},{default:r(()=>[a(w,{onUpdate:n.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),o.custom_svg?(i(),v(y,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:r(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=S=>n.setData("shape_svg")),modelValue:s.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=S=>s.shape_svg=S),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(y,{name:"logo",label:e.$t("Custom Image")},{default:r(()=>[s.logo?(i(),v(b,{key:0,alt:e.$t("Logo"),src:s.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a(C,{can_remove:!!s.logo,additionalData:{resize:!0,max_width:400},onUploaded:n.handleLogoPhotoUpload},null,8,["can_remove","onUploaded"])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(m,{onClick:S=>$(),type:"success",plain:"",class:"fcom_mt_20"},{default:r(()=>[V(d(e.$t("Close")),1)]),_:1},8,["onClick"])])]),_:1},8,["width"])}const Ut=I(Yf,[["render",Zf]]),Kf={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})}}},Jf={key:0,class:"fcom_slug_input_info"},Qf=["innerHTML"],Xf={key:1,class:"fcom_help_text"};function ep(e,t,o,u,s,n){const m=x,f=X;return i(),c(M,null,[a(f,{class:"fcom_slug_input",disabled:o.disabled,readonly:s.showEdit,modelValue:s.model,"onUpdate:modelValue":t[1]||(t[1]=h=>s.model=h),ref:"input",placeholder:o.placeholder,onInput:n.updateSlug},ve({_:2},[o.prefix?{name:"prepend",fn:r(()=>[l("span",null,d(o.prefix),1)]),key:"0"}:void 0,s.showEdit?{name:"append",fn:r(()=>[a(m,{onClick:t[0]||(t[0]=h=>n.confirmEditInit()),text:"",type:"info"},{default:r(()=>[V(d(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!s.showEdit&&o.edit_notice?(i(),c("div",Jf,[l("p",{innerHTML:o.edit_notice},null,8,Qf)])):_("",!0),o.description?(i(),c("div",Xf,[l("p",null,d(o.description),1)])):_("",!0)],64)}const Et=I(Kf,[["render",ep]]),tp={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},sp={class:"fcom_errors_alert_list"};function op(e,t,o,u,s,n){const m=Vs;return o.errors.length&&!s.dismissed?(i(),v(m,{key:0,type:"warning",closable:o.dismissable,"show-icon":"",onClose:t[0]||(t[0]=f=>s.dismissed=!0)},{title:r(()=>[l("ul",sp,[(i(!0),c(M,null,R(o.errors,(f,h)=>(i(),c("li",{key:h},d(f),1))),128))])]),_:1},8,["closable"])):_("",!0)}const Bt=I(tp,[["render",op]]),ye=e=>{var t,o;return((o=(t=window.fluentComAdmin)==null?void 0:t.i18n)==null?void 0:o[e])||e},ip=e=>{const t=[];return!e||!e.trim()?(t.push(ye("Path cannot be empty.")),{valid:!1,type:"path",errors:t}):(e=e.trim(),e.startsWith("/")||t.push(ye("Path must start with /")),/\s/.test(e)&&t.push(ye("Path cannot contain spaces.")),/[<>{}|\\^`"']/.test(e)&&t.push(ye("Path contains invalid characters: < > { } | \\ ^ ` \" '")),e.includes("..")&&t.push(ye('Path cannot contain ".." (directory traversal).')),/#.*#/.test(e)&&t.push(ye("Path cannot contain multiple hash fragments.")),{valid:t.length===0,type:"path",errors:t})},io=e=>{const t=[];if(!e||!e.trim())return t.push(ye("URL cannot be empty.")),{valid:!1,type:"url",errors:t};if(e=e.trim(),!/^https?:\/\//i.test(e))return t.push(ye("URL must start with http:// or https://")),{valid:!1,type:"url",errors:t};/\s/.test(e)&&t.push(ye("URL cannot contain spaces."));const o=e.replace(/^https?:\/\//i,"");(!o||o==="/")&&t.push(ye("URL must have a domain name (e.g. example.com)."));const u=o.split("/")[0].split("?")[0].split("#")[0],s=u.split(":")[0];if(!(s==="localhost"||s.startsWith("localhost."))&&!/^[a-zA-Z0-9][a-zA-Z0-9\-]*(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,}$/.test(s)&&t.push(ye("Domain must include a valid TLD (e.g. .com, .org).")),/[^a-zA-Z0-9.\-:]/.test(u)&&t.push(ye("Domain contains invalid characters. Only letters, numbers, dots, hyphens, and port are allowed.")),u.includes(":")){const m=u.split(":")[1];m&&!/^\d+$/.test(m)&&t.push(ye("Port must be a number (e.g. :8080)."))}return(/javascript:/i.test(e)||/data:/i.test(e)||/vbscript:/i.test(e))&&t.push(ye("URL contains a blocked protocol (javascript:, data:, vbscript:).")),{valid:t.length===0,type:"url",errors:t}},At=e=>!e||!e.trim()?{valid:!1,type:null,errors:[ye("URL or path cannot be empty.")]}:(e=e.trim(),e.startsWith("/")?ip(e):io(e)),np={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:Et,ActionPopover:as,ErrorAlerts:Bt},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(){if(this.newTopicErrors=[],(!this.newTopic.title||!this.newTopic.title.trim())&&this.newTopicErrors.push(this.$t("Topic title is required.")),this.newTopic.slug&&this.newTopic.slug.trim()){const e=At("/"+this.newTopic.slug);e.valid||e.errors.forEach(t=>{this.newTopicErrors.push(this.$t(t))})}return 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(o=>{this.$notify.success(o.message),this.fetchTopics(),this.selected.push(o.topic.id),e()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.creatingTopic=!1})}},watch:{selected(){this.$emit("update:modelValue",this.selected)}},mounted(){this.fetchTopics()}},lp={class:"fcom_topic_selector"},ap={key:0,class:"fcom_meta_text"};function rp(e,t,o,u,s,n){const m=ee,f=te,h=g("Plus"),y=j,w=x,b=X,C=de,p=g("slug-input"),k=g("error-alerts"),$=ue,S=g("action-popover"),T=J("loading");return i(),c("div",lp,[G((i(),v(f,{modelValue:s.selected,"onUpdate:modelValue":t[0]||(t[0]=F=>s.selected=F),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":n.maxTopicsPerSpace,placeholder:n.getTopicsPlaceholder()},{default:r(()=>[(i(!0),c(M,null,R(s.topics,F=>(i(),v(m,{key:F.slug,label:F.title,value:F.id},{default:r(()=>[l("span",null,d(F.title),1),F.description?(i(),c("span",ap,d(F.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[T,s.loading]]),e.isAdmin()&&o.creatable?(i(),v(S,{key:0,placement:"left",width:400,onShow:n.initCreatetopic},{trigger:r(()=>[a(w,{disabled:n.isTopicLimitReached,class:"fcom_secondary_button"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1},8,["disabled"])]),default:r(({hide:F})=>[a($,{modelValue:s.newTopic,"onUpdate:modelValue":t[4]||(t[4]=B=>s.newTopic=B),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[a(C,{label:e.$t("Title"),required:""},{default:r(()=>[a(b,{modelValue:s.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=B=>s.newTopic.title=B),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Slug (optional)")},{default:r(()=>[a(p,{modelValue:s.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>s.newTopic.slug=B),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(C,{label:e.$t("Description (optional)")},{default:r(()=>[a(b,{modelValue:s.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=B=>s.newTopic.description=B),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{errors:s.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:B=>n.createTopic(F),loading:s.creatingTopic},{default:r(()=>[V(d(e.$t("Create")),1)]),_:1},8,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const no=I(np,[["render",rp]]),cp={name:"ListViewIcon"},dp={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function up(e,t,o,u,s,n){return i(),c("svg",dp,[...t[0]||(t[0]=[Pe('<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 _p=I(cp,[["render",up]]),mp={name:"TimelineViewIcon"},hp={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function fp(e,t,o,u,s,n){return i(),c("svg",hp,[...t[0]||(t[0]=[Pe('<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 pp=I(mp,[["render",fp]]),gp={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 yp(e,t,o,u,s,n){const m=ee,f=te,h=J("loading");return G((i(),v(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:s.selected,"onUpdate:modelValue":t[0]||(t[0]=y=>s.selected=y)},{default:r(()=>[(i(!0),c(M,null,R(s.groups,y=>(i(),v(m,{key:y.id,value:y.id.toString(),label:y.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,s.loading]])}const ds=I(gp,[["render",yp]]),vp={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)}}},bp={class:"fcom_form_builder"},kp=["innerHTML"],wp={key:8},Cp={key:9,class:"fcom_help_text"},$p=["innerHTML"];function Sp(e,t,o,u,s,n){const m=X,f=Ae,h=be,y=ee,w=te,b=pe,C=Ss,p=Ye,k=kt,$=de,S=x,T=ue;return i(),c("div",bp,[a(T,{"label-position":"top",model:o.formData,onSubmit:z(e.doNothing,["prevent"])},{default:r(()=>[(i(!0),c(M,null,R(o.formFields,(F,B)=>(i(),v($,{key:e.index,label:F.label},ve({default:r(()=>[F.type=="text"?(i(),v(m,{key:0,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L,placeholder:F.placeholder,type:F.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):F.type=="radio"?(i(),v(h,{key:1,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L},{default:r(()=>[(i(!0),c(M,null,R(F.options,(L,D)=>(i(),v(f,{key:D,value:L.value,label:L.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):F.type=="select"?(i(),v(w,{key:2,class:"fcom_select",multiple:F.is_multiple,clearable:"",filterable:"",modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L,placeholder:F.placeholder},{default:r(()=>[(i(!0),c(M,null,R(F.options,(L,D)=>(i(),v(y,{key:D,label:L.label,value:L.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):F.type=="checkbox"?(i(),v(C,{key:3,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L},{default:r(()=>[(i(!0),c(M,null,R(F.options,(L,D)=>(i(),v(b,{key:D,value:L.value,label:L.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):F.type=="inline_checkbox"?(i(),v(b,{key:4,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L,"true-value":F.true_value||"yes","false-value":F.false_value||"no"},{default:r(()=>[V(d(F.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):F.type=="date"?(i(),v(p,{key:5,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L,type:F.data_type||"date","value-format":F.value_format||"YYYY-MM-DD",format:F.value_format||"YYYY-MM-DD",placeholder:F.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):F.type=="color_picker"?(i(),v(k,{key:6,modelValue:o.formData[B],"onUpdate:modelValue":L=>o.formData[B]=L},null,8,["modelValue","onUpdate:modelValue"])):F.type=="raw_html"?(i(),c("div",{key:7,innerHTML:F.content},null,8,kp)):(i(),c("div",wp,[l("pre",null,d(F),1)])),F.help_text?(i(),c("div",Cp,[l("p",{innerHTML:F.help_text},null,8,$p)])):_("",!0)]),_:2},[F.label?{name:"label",fn:r(()=>[V(d(F.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),o.disableSubmit?_("",!0):(i(),v($,{key:0},{default:r(()=>[a(S,{class:"fcom_primary_button",onClick:z(n.handleSubmit,["prevent"])},{default:r(()=>[V(d(o.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const lo=I(vp,[["render",Sp]]),Vp={name:"CardViewIcon"},Lp={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"};function Mp(e,t,o,u,s,n){return i(),c("svg",Lp,[...t[0]||(t[0]=[Pe('<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 Fp=I(Vp,[["render",Mp]]),Tp={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:ds,SlugInput:Et,ImageUploader:je,LogoEmojiSelector:Ut,TopicSelector:no,ListViewIcon:_p,TimelineViewIcon:pp,FormBuilder:lo,ErrorAlerts:Bt,CardViewIcon:Fp},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:Ks,formErrors:[],form:{title:"",slug:"",privacy:"private",parent_id:"",description:"",settings:{custom_lock_screen:"no",restricted_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",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,o;const e=[];if((!this.form.title||!this.form.title.trim())&&e.push(this.$t("Space title is required.")),this.form.slug&&this.form.slug.trim()){const u=At("/"+this.form.slug);u.valid||u.errors.forEach(s=>e.push(this.$t(s)))}return((t=this.form.settings)==null?void 0:t.topic_required)==="yes"&&!((o=this.form.topic_ids)!=null&&o.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},o=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}},o=this.$put,this.metaSettings)){let u={};this.each(this.metaSettings,(s,n)=>{u[n]=s.settings}),t.meta_settings=u}o(e,t).then(u=>{if(this.$eventBus.emit("reloadMenu"),!this.form.id&&!this.disable_redirect){let s=this.$router.resolve({name:"space_feeds",params:{space:u.space.slug}}).href;window.location.href=s;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}},Pp={key:0},Ip={class:"fcom_form_section"},Up={class:"fcom_help_text"},Ep={class:"fcom_form_section"},Bp={style:{"font-weight":"bold"}},Ap=["innerHTML"],Dp={key:0},Rp={class:"fcom_help_text"},Hp={key:0},xp={key:1,class:"fcom_form_section"},Op={class:"fcom_lined_checkboxes"},jp={key:0,class:"fcom_pro_feature"},Np={key:0,style:{background:"var(--fcom-active-bg, #f0f3f5)",padding:"10px 15px","margin-bottom":"10px","border-radius":"8px"}},zp={class:"fcom_form_section"},qp={class:"fcom_svg_radio_item"},Gp={class:"svg_radio_label"},Yp={class:"fcom_svg_radio_item"},Wp={class:"svg_radio_label"},Zp={class:"fcom_svg_radio_item"},Kp={class:"svg_radio_label"},Jp={class:"fcom_help_text"},Qp={key:0},Xp={key:1},e1={class:"fcom_form_section"},t1={class:"fcom_help_text"},s1=["href"],o1={class:"fcom_image_uploader_wrapper"},i1={class:"fcom_help_text"},n1={class:"fcom_image_uploader_wrapper"},l1={class:"fcom_help_text"},a1={class:"fcom_space_form_bottom"},r1={class:"fcom_space_form_bottom"},c1={key:0},d1={class:"fcom_form_section fcom_mt_20"};function u1(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=g("SlugInput"),w=g("space-group-selector"),b=ee,C=te,p=Ae,k=be,$=pe,S=g("TimelineViewIcon"),T=g("ListViewIcon"),F=g("CardViewIcon"),B=g("topic-selector"),L=Ie,D=g("EditPen"),A=j,U=x,P=g("Delete"),O=g("ImageUploader"),N=g("error-alerts"),Q=ue,_e=g("form-builder"),ne=J("loading");return i(),c("div",null,[a(Q,{onSubmit:t[29]||(t[29]=z(E=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[30]||(t[30]=E=>s.form=E),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[s.showingSections.indexOf("basic")!==-1?(i(),c(M,{key:0},[s.form.id?_("",!0):(i(),c("h4",Pp,d(e.$t("Basic Info")),1)),l("div",Ip,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Space Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Space Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>s.form.title=E)},{prepend:r(()=>{var E,K;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=ae=>{s.form.settings.emoji=ae.emoji,s.form.logo=ae.logo,s.form.settings.shape_svg=ae.shape_svg}),config:{logo:s.form.logo,emoji:((E=s.form.settings)==null?void 0:E.emoji)||"",shape_svg:((K=s.form.settings)==null?void 0:K.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(y,{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:!!s.form.id,modelValue:s.form.slug,"onUpdate:modelValue":t[2]||(t[2]=E=>s.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:r(()=>[a(f,{type:"textarea",rows:3,placeholder:e.$t("Space Description"),modelValue:s.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>s.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[s.dataLoaded?(i(),v(w,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=E=>s.form.parent_id=E),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Up,[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",Ep,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(C,{"popper-class":"rich_select",modelValue:s.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=E=>s.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:r(()=>[(i(!0),c(M,null,R(s.privacies,(E,K)=>(i(),v(b,{key:K,label:E.label,value:K},{default:r(()=>[l("span",Bp,d(e.$labelize(E.label)),1),l("p",{innerHTML:E.description},null,8,Ap)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s.form.privacy=="private"?(i(),c(M,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(k,{modelValue:s.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=E=>s.form.settings.custom_lock_screen=E),class:""},{default:r(()=>[a(p,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom Lock Screen")),1)]),_:1}),a(p,{value:"no"},{default:r(()=>[V(d(e.$t("Default Lock Screen")),1)]),_:1}),a(p,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(i(),c("span",Dp,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(i(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:s.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=E=>s.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",Rp,[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),n.isDefaultLockscreen?(i(),v(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=E=>s.form.settings.can_request_join=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),n.isDefaultLockscreen?(i(),v(h,{key:2},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=E=>s.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:r(()=>[V(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:r(()=>[a(C,{modelValue:s.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=E=>s.form.settings.members_page_status=E)},{default:r(()=>[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),s.showingSections.indexOf("customization")!==-1?(i(),c(M,{key:1},[s.form.id?_("",!0):(i(),c("h4",Hp,d(e.$t("Customization")),1)),s.form.settings?(i(),c("div",xp,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",Op,[a($,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=E=>s.form.settings.restricted_post_only=E)},{default:r(()=>[V(d(e.$t("Only admin or moderators can create post")),1)]),_:1},8,["modelValue"]),a($,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.show_sidebar,"onUpdate:modelValue":t[12]||(t[12]=E=>s.form.settings.show_sidebar=E)},{default:r(()=>[V(d(e.$t("Show Right Sidebar on Space")),1)]),_:1},8,["modelValue"]),a($,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_members_count,"onUpdate:modelValue":t[13]||(t[13]=E=>s.form.settings.hide_members_count=E)},{default:r(()=>[V(d(e.$t("Hide Members count from spaces page (when members page access unavailable)")),1)]),_:1},8,["modelValue"]),a($,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:s.form.settings.document_library,"onUpdate:modelValue":t[14]||(t[14]=E=>s.form.settings.document_library=E)},{default:r(()=>[V(d(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(i(),c("span",jp," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"])])]),_:1}),s.form.settings.document_library=="yes"?(i(),c("div",Np,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:r(()=>[a(k,{modelValue:s.form.settings.document_access,"onUpdate:modelValue":t[15]||(t[15]=E=>s.form.settings.document_access=E),class:"fcom_radio_group_inline"},{default:r(()=>[a(p,{value:"members_only"},{default:r(()=>[V(d(e.$t("Members of this space")),1)]),_:1}),a(p,{value:"logged_in"},{default:r(()=>[V(d(e.$t("Any Logged in users")),1)]),_:1}),a(p,{value:"everybody"},{default:r(()=>[V(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Who can upload the documents?")},{default:r(()=>[a(k,{style:{"margin-bottom":"0"},modelValue:s.form.settings.document_upload,"onUpdate:modelValue":t[16]||(t[16]=E=>s.form.settings.document_upload=E),class:"fcom_radio_group_inline"},{default:r(()=>[a(p,{value:"members_only"},{default:r(()=>[V(d(e.$t("Any Members")),1)]),_:1}),a(p,{value:"admin_only"},{default:r(()=>[V(d(e.$t("Admin/Moderators Only")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0),a(h,{label:e.$t("Default Post Sort By")},{default:r(()=>[a(C,{modelValue:s.form.settings.default_post_sort_by,"onUpdate:modelValue":t[17]||(t[17]=E=>s.form.settings.default_post_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:r(()=>[(i(!0),c(M,null,R(s.postOrderOptions,(E,K)=>(i(),v(b,{key:K,value:K,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_post_sort_by,"onUpdate:modelValue":t[18]||(t[18]=E=>s.form.settings.disable_post_sort_by=E)},{default:r(()=>[V(d(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:r(()=>[a(C,{modelValue:s.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[19]||(t[19]=E=>s.form.settings.default_comment_sort_by=E),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:r(()=>[(i(!0),c(M,null,R(s.commentOrderOptions,(E,K)=>(i(),v(b,{key:K,value:K,label:E},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",zp,[l("h4",null,d(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:r(()=>[a(k,{modelValue:s.form.settings.layout_style,"onUpdate:modelValue":t[20]||(t[20]=E=>s.form.settings.layout_style=E),class:"fcom_svg_radio_group"},{default:r(()=>[l("div",qp,[a(p,{value:"timeline"},{default:r(()=>[a(S,{style:{width:"100px",height:"auto"}}),l("p",Gp,d(e.$t("Timeline")),1)]),_:1})]),l("div",Yp,[a(p,{value:"list"},{default:r(()=>[a(T,{style:{width:"100px",height:"auto"}}),l("p",Wp,d(e.$t("List")),1)]),_:1})]),l("div",Zp,[a(p,{value:"card"},{default:r(()=>[a(F,{style:{width:"100px",height:"auto"}}),l("p",Kp,d(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:r(()=>[a($,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_layout_style,"onUpdate:modelValue":t[21]||(t[21]=E=>s.form.settings.disable_layout_style=E)},{default:r(()=>[V(d(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",Jp,[s.form.settings.disable_layout_style==="yes"?(i(),c("p",Qp,d(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(i(),c("p",Xp,d(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",e1,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(B,{creatable:!0,space_id:s.form.id,modelValue:s.form.topic_ids,"onUpdate:modelValue":t[22]||(t[22]=E=>s.form.topic_ids=E)},null,8,["space_id","modelValue"]),l("div",t1,[l("p",null,[V(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()?(i(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics.")),9,s1)):_("",!0)])]),a($,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.topic_required,"onUpdate:modelValue":t[23]||(t[23]=E=>s.form.settings.topic_required=E)},{default:r(()=>[V(d(e.$t("Make members select a topic")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),e.appVars.has_chat?(i(),v(h,{key:1,label:e.$t("Group Chat?")},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:s.form.group_chat_support,"onUpdate:modelValue":t[24]||(t[24]=E=>s.form.group_chat_support=E)},{default:r(()=>[V(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:r(()=>[s.form.settings.og_image?(i(),v(L,{key:0,alt:e.$t("Thumbnail / Open Graph Image"),src:s.form.settings.og_image,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",o1,[a(O,{isTextBtn:!1,removeIcon:!0,can_remove:!!s.form.settings.og_image,confirm_remove:!0,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:t[25]||(t[25]=E=>{s.form.settings.og_image=E})},ve({remove:r(()=>[a(A,null,{default:r(()=>[a(P)]),_:1})]),_:2},[s.form.settings.og_image?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(A,null,{default:r(()=>[a(D)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",i1,[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:r(()=>[s.form.cover_photo?(i(),v(L,{key:0,src:s.form.cover_photo,alt:e.$t("Featured Image Preview"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",n1,[a(O,{isTextBtn:!1,removeIcon:!0,can_remove:!!s.form.cover_photo,confirm_remove:!0,additionalData:{resize:!0,max_width:1600},onUploaded:n.handleCoverPhotoUpload},ve({remove:r(()=>[a(A,null,{default:r(()=>[a(P)]),_:1})]),_:2},[s.form.cover_photo?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(A,null,{default:r(()=>[a(D)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",l1,[l("p",null,d(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),a(N,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),s.form.id?_("",!0):(i(),v(h,{key:2,style:{"margin-top":"45px"}},{default:r(()=>[l("div",a1,[s.showingSections.indexOf("basic")===-1?(i(),v(U,{key:0,class:"plain_button",text:"",onClick:t[26]||(t[26]=()=>{s.showingSections=["basic"]})},{default:r(()=>[l("span",null,d(e.$t("Go Back")),1)]),_:1})):_("",!0),G((i(),v(U,{class:"fcom_primary_button",disabled:s.saving,onClick:t[27]||(t[27]=E=>n.submit())},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled"])),[[ne,s.saving]])])]),_:1}))])],64)):(i(),c(M,{key:2},[a(N,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:r(()=>[l("div",r1,[t[31]||(t[31]=l("span",null,null,-1)),a(U,{onClick:t[28]||(t[28]=E=>n.goToCustomization()),class:"fcom_primary_button"},{default:r(()=>[l("span",null,d(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),G((i(),c("div",null,[s.metaSettings&&Object.keys(s.metaSettings).length>0?(i(),c("div",c1,[(i(!0),c(M,null,R(s.metaSettings,E=>(i(),c("div",d1,[l("h4",null,d(E.section_title),1),a(_e,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,s.fetchingMetaBoxes]])])}const Dt=I(Tp,[["render",u1]]),_1={name:"CreateCorseForm",components:{FormBuilder:lo,SpaceGroupSelector:ds,TopicSelector:no,SlugInput:Et,ImageUploader:je,LogoEmojiSelector:Ut,ErrorAlerts:Bt,CrepeEditor:Vt},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:Ec,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:Bc,dataLoaded:!1,metaSettings:null,fetchingMetaBoxes:!1,appReady:!1,courseInstructors:[],fetchingInstructors:!1}},watch:{savingCount(){this.submit(!0)}},methods:{getValidationErrors(){var t;const e=[];if((!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.")),(t=this.form.slug)!=null&&t.trim()){const o=At("/"+this.form.slug);o.valid||o.errors.forEach(u=>e.push(this.$t(u)))}return e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(e=!1){if(this.form.id){const s=this.getValidationErrors();if(s.length){this.$notify.error(s[0]);return}}else if(!this.validateForm())return;this.saving=!0;let t="admin/courses",o=this.form,u=this.$post;if(this.form.id&&(t+="/"+this.form.id,o={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()&&(o.created_by=this.form.created_by),this.metaSettings)){let s={};this.each(this.metaSettings,(n,m)=>{s[m]=n.settings}),o.meta_settings=s}u(t,o).then(s=>{if(!this.form.id&&!this.disable_redirect){let n=this.$getRouteLink("admin/manage-courses/edit/"+s.course.id+"/lessons");window.location.href=n,this.form={};return}this.$eventBus.emit("reloadMenu"),this.$notify.success(s.message||this.$t("Course has been created successfully")),this.$emit("completed",s.course),e&&this.$emit("close")}).catch(s=>{this.$handleError(s)}).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,o,u,s,n;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=(o=(t=this.course)==null?void 0:t.settings)==null?void 0:o.course_type;e&&!((u=this.form)!=null&&u.course_type)&&(this.form.course_type=e),(!((n=(s=this.form)==null?void 0:s.settings)!=null&&n.course_layout)||!this.has_pro)&&(this.form.settings.course_layout="classic"),this.dataLoaded=!0,this.$nextTick(()=>{this.appReady=!0})}},m1={key:0},h1={class:"fcom_form_section"},f1={class:"fcom_help_text"},p1={class:"fcom_help_text"},g1={class:"fcom_form_section"},y1={style:{"font-weight":"bold"}},v1={key:0},b1={class:"fcom_help_text"},k1={style:{"font-weight":"bold"}},w1={class:"fcom_form_section"},C1={class:"fcom_lined_checkboxes"},$1={class:"fcom_checkbox_with_tooltip"},S1={key:0},V1={key:0},L1={class:"fcom_help_text"},M1={key:0,class:"fcom_form_section"},F1={class:"fcom_select_photo",style:{float:"left"}},T1=["src","alt"],P1={style:{float:"right",color:"#8492a6","font-size":"13px"}},I1={class:"fcom_lined_checkboxes"},U1={class:"fcom_form_section"},E1={class:"fcom_help_text"},B1=["href"],A1={class:"fcom_image_uploader_wrapper"},D1={class:"fcom_help_text"},R1={class:"fcom_space_form_bottom"},H1={key:0},x1={class:"fcom_form_section fcom_mt_20"},O1={key:1},j1=["href"];function N1(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=g("SlugInput"),w=g("crepe-editor"),b=g("space-group-selector"),C=Ae,p=be,k=ee,$=te,S=pe,T=g("InfoFilled"),F=j,B=Kt,L=g("topic-selector"),D=Ie,A=g("EditPen"),U=x,P=g("Delete"),O=g("ImageUploader"),N=g("error-alerts"),Q=ue,_e=g("form-builder"),ne=J("loading");return e.hasFeature("has_course")?(i(),c("div",m1,[a(Q,{onSubmit:t[23]||(t[23]=z(E=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[24]||(t[24]=E=>s.form=E),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[l("div",h1,[l("h4",null,d(e.$t("General")),1),a(h,{label:e.$t("Course Title"),required:""},{default:r(()=>[a(f,{type:"text",ref:"titleInput",placeholder:e.$t("Your Course Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=E=>s.form.title=E)},{prepend:r(()=>{var E,K;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,config:{logo:s.form.logo,emoji:(E=s.form.settings)==null?void 0:E.emoji,shape_svg:((K=s.form.settings)==null?void 0:K.shape_svg)||""},onUpdate:t[0]||(t[0]=ae=>{s.form.settings.emoji=ae.emoji,s.form.logo=ae.logo,s.form.settings.shape_svg=ae.shape_svg})},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(y,{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:!!s.form.id,modelValue:s.form.slug,"onUpdate:modelValue":t[2]||(t[2]=E=>s.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:r(()=>[a(f,{type:"textarea",placeholder:e.$t("Course Description"),modelValue:s.form.description,"onUpdate:modelValue":t[3]||(t[3]=E=>s.form.description=E)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:r(()=>[s.appReady?(i(),v(w,{key:0,modelValue:s.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=E=>s.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",f1,[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:r(()=>[s.dataLoaded?(i(),v(b,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=E=>s.form.parent_id=E),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",p1,[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:r(()=>[a(p,{modelValue:s.form.status,"onUpdate:modelValue":t[6]||(t[6]=E=>s.form.status=E),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"published"},{default:r(()=>[V(d(e.$t("Published")),1)]),_:1}),a(C,{value:"draft"},{default:r(()=>[V(d(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",g1,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a($,{"popper-class":"rich_select",modelValue:s.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=E=>s.form.privacy=E),placeholder:e.$t("Select Privacy")},{default:r(()=>[(i(!0),c(M,null,R(s.privacies,(E,K)=>(i(),v(k,{key:K,label:E.label,value:K},{default:r(()=>[l("span",y1,d(E.label),1),l("p",null,d(E.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),s.form.privacy=="private"?(i(),c(M,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(p,{modelValue:s.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=E=>s.form.settings.custom_lock_screen=E),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"yes"},{default:r(()=>[V(d(e.$t("Custom")),1)]),_:1}),a(C,{value:"no"},{default:r(()=>[V(d(e.$t("Default")),1)]),_:1}),a(C,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[V(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(i(),c("span",v1,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(i(),v(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:s.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=E=>s.form.settings.onboard_redirect_url=E),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",b1,[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),s.form.settings.custom_lock_screen=="no"?(i(),v(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=E=>s.form.settings.show_paywalls=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show Paywalls in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),s.form.settings.custom_lock_screen=="no"?(i(),v(h,{key:2},{default:r(()=>[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_welcome_banner,"onUpdate:modelValue":t[11]||(t[11]=E=>s.form.settings.show_welcome_banner=E),class:"fcom_checkbox"},{default:r(()=>[V(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:r(()=>[a($,{"popper-class":"rich_select",modelValue:s.form.course_type,"onUpdate:modelValue":t[12]||(t[12]=E=>s.form.course_type=E),placeholder:e.$t("Select Type")},{default:r(()=>[(i(!0),c(M,null,R(s.courseTypes,(E,K)=>(i(),v(k,{key:K,label:E.label,value:K},{default:r(()=>[l("span",k1,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",w1,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",C1,[s.form.privacy=="public"&&s.form.course_type=="self_paced"?(i(),v(S,{key:0,"true-value":"yes","false-value":"no",modelValue:s.form.settings.public_lesson_view,"onUpdate:modelValue":t[13]||(t[13]=E=>s.form.settings.public_lesson_view=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.disable_comments,"onUpdate:modelValue":t[14]||(t[14]=E=>s.form.settings.disable_comments=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_members_count,"onUpdate:modelValue":t[15]||(t[15]=E=>s.form.settings.hide_members_count=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"]),l("div",$1,[a(S,{disabled:!e.has_pro,"true-value":"yes","false-value":"no","model-value":e.has_pro?s.form.settings.sequential_lesson_order:"no","onUpdate:modelValue":t[16]||(t[16]=E=>{s.form.settings.sequential_lesson_order=E}),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Lesson order enforcement"))+" ",1),e.has_pro?_("",!0):(i(),c("span",S1,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled","model-value"]),a(B,{class:"box-item fcom_checkbox_tooltip",effect:"dark",placement:"right-end"},{content:r(()=>[V(d(e.$t("Your members will have to complete each lesson")),1),t[25]||(t[25]=l("br",null,null,-1)),V(" "+d(e.$t("in order before moving onto the next one.")),1)]),default:r(()=>[a(F,null,{default:r(()=>[a(T)]),_:1})]),_:1})])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:r(()=>[a(p,{modelValue:s.form.settings.course_layout,"onUpdate:modelValue":t[17]||(t[17]=E=>s.form.settings.course_layout=E),class:"fcom_radio_group"},{default:r(()=>[a(C,{value:"classic"},{default:r(()=>[V(d(e.$t("Classic")),1)]),_:1}),a(C,{disabled:!e.has_pro,value:"modern"},{default:r(()=>[V(d(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(i(),c("span",V1,"("+d(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",L1,[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"])]),s.form.id?(i(),c("div",M1,[l("h4",null,d(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:r(()=>[a($,{disabled:!e.isAdmin(),class:"rich_select",filterable:"",remote:"",loading:s.fetchingInstructors,"remote-method":n.searchUsers,placeholder:e.$t("Select User"),modelValue:s.form.created_by,"onUpdate:modelValue":t[18]||(t[18]=E=>s.form.created_by=E)},{default:r(()=>[(i(!0),c(M,null,R(s.courseInstructors,E=>(i(),v(k,{class:"fcom_with_photo_option",key:E.ID,label:E.display_name+" ("+(E.user_email||E.ID)+")",value:E.ID},{default:r(()=>[l("span",F1,[l("img",{src:E.photo,alt:E.display_name},null,8,T1),l("span",null,d(E.display_name),1)]),l("span",P1,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:r(()=>[l("div",I1,[a(S,{"true-value":"yes","false-value":"no",modelValue:s.form.settings.hide_instructor_view,"onUpdate:modelValue":t[19]||(t[19]=E=>s.form.settings.hide_instructor_view=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),s.form.settings.hide_instructor_view!="yes"?(i(),v(S,{key:0,"true-value":"yes","false-value":"no",modelValue:s.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[20]||(t[20]=E=>s.form.settings.show_instructor_students_count=E),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",U1,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&s.dataLoaded?(i(),v(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(L,{modelValue:s.form.category_ids,"onUpdate:modelValue":t[21]||(t[21]=E=>s.form.category_ids=E),creatable:!0},null,8,["modelValue"]),l("div",E1,[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()?(i(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics")),9,B1)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[s.form.cover_photo?(i(),v(D,{key:0,alt:e.$t("Cover Photo"),src:s.form.cover_photo,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",A1,[a(O,{isTextBtn:!1,can_remove:!!s.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:n.handlePhotoUpload},ve({remove:r(()=>[a(F,null,{default:r(()=>[a(P)]),_:1})]),_:2},[s.form.cover_photo?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(F,null,{default:r(()=>[a(A)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",D1,[l("p",null,d(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(N,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),s.form.id?_("",!0):(i(),v(h,{key:1,style:{"margin-top":"45px"}},{default:r(()=>[l("div",R1,[t[26]||(t[26]=l("span",null,null,-1)),a(U,{class:"fcom_primary_button",disabled:s.saving,onClick:t[22]||(t[22]=E=>n.submit()),loading:s.saving},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),G((i(),c("div",null,[s.metaSettings&&Object.keys(s.metaSettings).length>0?(i(),c("div",H1,[(i(!0),c(M,null,R(s.metaSettings,E=>(i(),c("div",x1,[l("h4",null,d(E.section_title),1),a(_e,{formData:E.settings,formFields:E.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[ne,s.fetchingMetaBoxes]])])):(i(),c("div",O1,[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,j1)]))}const z1=I(_1,[["render",N1]]),q1={name:"SpaceCourseSelector",components:{SpaceIcon:Ne},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(o=>o.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,o=[],u=[];this.each(t,n=>{let m=e.filter(f=>{let h=f.parent_id==n.id;return h&&u.push(f.slug),h});m.length&&o.push({label:n.title,spaces:m})});let s=e.filter(n=>n.parent_id===null);s&&s.length&&o.push({label:this.$t("Uncategorized"),spaces:s}),this.formattedSpaceGroups=o}},mounted(){this.is_multiple?this.selected_spaces=Array.isArray(this.modelValue)?this.modelValue:[]:this.selected_spaces=this.modelValue||"",this.fetch(),this.app_ready=!0}},G1={key:0,class:"fcom_space_title"},Y1={key:0},W1={key:1};function Z1(e,t,o,u,s,n){const m=g("SpaceIcon"),f=ee,h=vt,y=te,w=J("loading");return s.app_ready?(i(),v(y,{key:0,onChange:n.emitChanges,modelValue:s.selected_spaces,"onUpdate:modelValue":t[0]||(t[0]=b=>s.selected_spaces=b),filterable:"",multiple:o.is_multiple,placeholder:o.placeholder_text,style:{width:"100%"}},{default:r(()=>[(i(!0),c(M,null,R(s.formattedSpaceGroups,b=>G((i(),v(h,{key:b.label,label:b.label},{default:r(()=>[(i(!0),c(M,null,R(b.spaces,C=>(i(),v(f,{key:C.slug,label:C.title,disabled:n.isMemberOfSpace(C.id),value:C.id.toString()},{default:r(()=>[C.id?(i(),c("span",G1,[a(m,{space_profile:C},null,8,["space_profile"]),l("span",null,[V(d(e.getExcerpt(C.title,50))+" ",1),C.type=="course"?(i(),c("span",Y1," ("+d(e.$t("course"))+")",1)):_("",!0)])])):(i(),c("span",W1,d(e.getExcerpt(C.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[w,s.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const Rt=I(q1,[["render",Z1]]),K1={name:"SidebarLinkForm",components:{SpaceGroupSelector:ds,LogoEmojiSelector:Ut,SpaceCourseSelector:Rt,ErrorAlerts:Bt},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(){this.formErrors=[],(!this.form.title||!this.form.title.trim())&&this.formErrors.push(this.$t("Link title is required."));const e=io(this.form.settings.permalink);return e.valid||e.errors.forEach(t=>{this.formErrors.push(this.$t(t))}),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}},J1={class:"fcom_form_section"},Q1={class:"fcom_help_text"},X1={class:"fcom_help_text"},eg={class:"fcom_help_text"},tg={key:0},sg={key:1};function og(e,t,o,u,s,n){const m=g("logo-emoji-selector"),f=X,h=de,y=pe,w=g("space-group-selector"),b=Ae,C=be,p=g("SpaceCourseSelector"),k=g("error-alerts"),$=x,S=ue,T=J("loading");return i(),v(S,{onSubmit:t[8]||(t[8]=z(F=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[9]||(t[9]=F=>s.form=F),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[l("div",J1,[a(h,{label:e.$t("Link Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:s.form.title,"onUpdate:modelValue":t[1]||(t[1]=F=>s.form.title=F)},{prepend:r(()=>{var F,B;return[s.dataLoaded?(i(),v(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=L=>{s.form.settings.emoji=L.emoji,s.form.logo=L.logo,s.form.settings.shape_svg=L.shape_svg}),config:{logo:s.form.logo,emoji:((F=s.form.settings)==null?void 0:F.emoji)||"",shape_svg:((B=s.form.settings)==null?void 0:B.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Permalink"),required:""},{default:r(()=>[a(f,{placeholder:e.$t("URL of the link"),modelValue:s.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=F=>s.form.settings.permalink=F)},null,8,["placeholder","modelValue"]),l("div",Q1,[a(y,{modelValue:s.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=F=>s.form.settings.new_tab=F),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[s.dataLoaded?(i(),v(w,{key:0,modelValue:s.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=F=>s.form.parent_id=F),space_id:s.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",X1,[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:r(()=>[a(C,{modelValue:s.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=F=>s.form.privacy=F)},{default:r(()=>[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",eg,[l("p",null,d(e.$t("Select who can see this link.")),1)])]),_:1},8,["label"]),s.form.privacy=="members_only"?(i(),v(h,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(p,{modelValue:s.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=F=>s.form.settings.membership_ids=F),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a(k,{errors:s.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:r(()=>[G((i(),v($,{class:"fcom_primary_button",disabled:s.saving,onClick:t[7]||(t[7]=F=>n.saveSettings())},{default:r(()=>[s.form.id?(i(),c("span",tg,d(e.$t("Update")),1)):(i(),c("span",sg,d(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[T,s.saving]])]),_:1})])]),_:1},8,["modelValue"])}const ig=I(K1,[["render",og]]),ng={name:"SpaceIcon"},lg={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"};function ag(e,t,o,u,s,n){return i(),c("svg",lg,[...t[0]||(t[0]=[Pe('<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 rg=I(ng,[["render",ag]]),cg={name:"CourseIcon"},dg={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function ug(e,t,o,u,s,n){return i(),c("svg",dg,[...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 _g=I(cg,[["render",ug]]),mg={name:"SpaceCreateModal",components:{Drawer:oo,CreateSpaceForm:Dt,CreateCourseForm:z1,SidebarLinkForm:ig,ArrowLeftBold:No,SpaceIcon:rg,CourseIcon:_g,Link:Es},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,...o}=this.$route.query;e===void 0&&t===void 0||this.$router.replace({query:o})},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})})}},hg={class:"dialog_header"},fg={class:"dialog_left"},pg={class:"dialog_body"},gg={key:0,class:"space-type-selector"},yg={class:"space-cards"},vg={class:"space-card-label"},bg={class:"space-card-label"},kg={key:0,class:"space-card-note"},wg={class:"space-card-label"},Cg={key:0,class:"space-card-note"},$g={class:"dialog_footer"};function Sg(e,t,o,u,s,n){const m=g("ArrowLeftBold"),f=j,h=x,y=g("SpaceIcon"),w=g("CourseIcon"),b=g("Link"),C=g("create-space-form"),p=g("create-course-form"),k=g("sidebar-link-form"),$=g("Drawer");return i(),v($,{modelValue:s.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=S=>s.showCreateSpaceModal=S),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":s.enteredForm,"close-confirmation-message":n.leaveMessage,drawerClass:"fcom_space_create_drawer"},ve({header:r(()=>[l("div",hg,[l("div",fg,[s.step!="choose_type"?(i(),v(h,{key:0,onClick:t[0]||(t[0]=S=>s.step="choose_type"),text:"",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})):_("",!0),l("h4",null,d(n.currentTitle),1)])])]),default:r(()=>[l("div",pg,[s.step=="choose_type"?(i(),c("div",gg,[l("div",yg,[l("div",{onClick:t[1]||(t[1]=S=>s.select_type="space_form"),class:H([{"is-active":s.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(y)]),_:1}),l("span",vg,d(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=S=>!!e.hasFeature("has_course")&&(s.select_type="course_form")),class:H([{"is-active":s.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(w)]),_:1}),l("span",bg,d(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(i(),c("span",kg,d(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=S=>!!e.appVars.pro&&(s.select_type="link_form")),class:H([{"is-active":s.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(b)]),_:1}),l("span",wg,d(e.$t("Link")),1),e.appVars.pro?_("",!0):(i(),c("span",Cg,d(e.$t("Pro Required")),1))],2)])])):s.step=="space_form"?(i(),v(C,{key:1,disable_redirect:s.disable_redirect,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):s.step=="course_form"?(i(),v(p,{key:2,disable_redirect:s.disable_redirect,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):s.step=="link_form"?(i(),v(k,{key:3,parent_id:s.parent_id,onCompleted:n.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[s.step=="choose_type"?{name:"footer",fn:r(()=>[l("div",$g,[a(h,{disabled:!s.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=S=>n.handleNextStep())},{default:r(()=>[V(d(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const Vg=I(mg,[["render",Sg]]),Lg={name:"ExpandIcon"},Mg={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Fg(e,t,o,u,s,n){return i(),c("svg",Mg,[...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 Tg=I(Lg,[["render",Fg]]),Pg={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)}},Ig={class:"dialog_header"},Ug={class:"dialog_left"},Eg={class:"dialog_body"},Bg={class:"fcom_report_content_form"},Ag={class:"dialog_footer"};function Dg(e,t,o,u,s,n){const m=ee,f=te,h=de,y=X,w=ue,b=x,C=$e;return s.showModal?(i(),v(C,{key:0,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,width:e.drawerWidth,modelValue:s.showModal,"onUpdate:modelValue":t[4]||(t[4]=p=>s.showModal=p),direction:"rtl",onClose:n.closeModal},{header:r(()=>[l("div",Ig,[l("div",Ug,[l("h4",null,d(n.currentTitle),1)])])]),footer:r(()=>[l("div",Ag,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=p=>n.closeModal())},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=p=>n.validateAndSubmit()),loading:s.saving},{default:r(()=>[V(d(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:r(()=>[l("div",Eg,[l("div",Bg,[a(w,{ref:"reportForm","label-position":"top"},{default:r(()=>[a(h,{label:e.$t("Reason")},{default:r(()=>[a(f,{modelValue:s.reportReason,"onUpdate:modelValue":t[0]||(t[0]=p=>s.reportReason=p),placeholder:e.$t("Please select a reason for reporting this content")},{default:r(()=>[(i(!0),c(M,null,R(e.appVars.report_reasons,(p,k)=>(i(),v(m,{key:k,label:p,value:k},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:r(()=>[a(y,{modelValue:s.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=p=>s.reportExplanation=p),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 Rg=I(Pg,[["render",Dg]]),Hg={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")}}},xg={class:"fcom_pagination_wrap"};function Og(e,t,o,u,s,n){const m=Po;return i(),c("div",xg,[a(m,{background:!1,size:"small","pager-count":5,layout:n.pager_layout,onCurrentChange:n.changePage,onSizeChange:n.changeSize,"hide-on-single-page":o.hide_on_single,"current-page":o.pagination.page,"page-sizes":n.page_sizes,"page-size":o.pagination.per_page,total:o.pagination.total},null,8,["layout","onCurrentChange","onSizeChange","hide-on-single-page","current-page","page-sizes","page-size","total"])])}const Se=I(Hg,[["render",Og]]),jg={name:"ReportReviewModal",components:{Pagination:Se},data(){return{isOpen:!1,loading:!1,content:{},postReports:[],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.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(o=>{this.postReports=o.reports.data,this.report=o.reports.data[0],this.pagination.total=o.reports.total}).catch(o=>{this.$handleError(o)}).finally(()=>{this.loading=!1})},ignoreReport(){var e;this.ignoring=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(e=this.content)==null?void 0:e.space_id,status:"ignored"}).then(t=>{this.$notify.success(t.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:t.content,action:"ignored",type:this.type}),this.closeModal()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.ignoring=!1})},unpublishReport(){var e;this.unpublishing=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(e=this.content)==null?void 0:e.space_id,status:"unpublished"}).then(t=>{this.$notify.success(t.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:t.content,action:"unpublished",type:this.type}),this.closeModal()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.unpublishing=!1})}},created(){this.$eventBus.on("showReportReviewModal",this.showReportReviewModal)}},Ng={class:"dialog_body"},zg={class:"report_details"},qg={class:"report_details_header"},Gg={class:"report_details_header_left"},Yg={class:"report_details_header_right"},Wg={key:0},Zg={key:1},Kg={key:1},Jg={class:"report_reason"},Qg=["title"],Xg={key:0,class:"report_details_body"},ey=["innerHTML"],ty={key:2,role:"region","aria-label":"Pagination",class:"pagination_wrap"},sy={class:"dialog_footer report_footer"};function oy(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink"),h=Y,y=g("Pagination"),w=x,b=$e;return i(),v(b,{modelValue:s.isOpen,"onUpdate:modelValue":t[3]||(t[3]=C=>s.isOpen=C),"modal-class":"fcom_common_dialog",id:"fluent_comminity_body",width:e.dialogWidth,"append-to-body":!0,"close-on-click-modal":!1,direction:"rtl",onClose:n.closeModal},{footer:r(()=>[l("div",sy,[a(w,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=C=>n.unpublishReport()),loading:s.unpublishing},{default:r(()=>[V(d(n.getUnpublishBtnText),1)]),_:1},8,["loading"]),a(w,{class:"fcom_primary_button",onClick:t[2]||(t[2]=C=>n.ignoreReport()),loading:s.ignoring},{default:r(()=>[V(d(n.getPublishBtnText),1)]),_:1},8,["loading"])])]),default:r(()=>{var C,p;return[l("div",Ng,[l("h4",null,d(e.$t("Reports")+" ("+((p=(C=s.content)==null?void 0:C.meta)==null?void 0:p.reports_count)+")"),1),l("div",zg,[s.loading?(i(),v(h,{key:1,rows:5,animated:!0})):(i(!0),c(M,{key:0},R(s.postReports,k=>(i(),c("div",{key:k.id,class:"report_details_item"},[l("div",qg,[l("div",Gg,[k.reporter?(i(),v(m,{key:0,with_level:!1,xprofile:k.reporter},null,8,["xprofile"])):_("",!0)]),l("div",Yg,[!k.reporter&&!n.getReason(k.reason)?(i(),c("div",Wg,d(e.$t("Flagged automatically by the site rule")),1)):(i(),c("div",Zg,[k.reporter?(i(),v(f,{key:0,show_verified:!1,xprofile:k.reporter},null,8,["xprofile"])):(i(),c("span",Kg,d(e.$t("By System ")),1)),n.getReason(k.reason)?(i(),c(M,{key:2},[l("span",null,d(e.$t("reported for ")),1),l("span",Jg,d(n.getReason(k.reason)),1)],64)):_("",!0)])),l("div",{title:k.created_at,class:"meta_line"},d(e.humanDateDiff(k.created_at)),9,Qg)])]),k.explanation?(i(),c("div",Xg,[l("div",{innerHTML:k.explanation},null,8,ey)])):_("",!0)]))),128)),s.pagination.total?(i(),c("div",ty,[a(y,{hide_on_single:!0,onFetch:t[0]||(t[0]=k=>n.getPostReports()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const iy=I(jg,[["render",oy]]),ny={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(o=>this.currentTopics(e==null?void 0:e.space).find(u=>u.id==o))):[]},currentTopics(e){var o;if(!e)return[];let t=((o=this.allSpaces[e])==null?void 0:o.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)}};function ly(e,t,o,u,s,n){const m=Y,f=x,h=g("Feed"),y=ke,w=$e;return s.previewData?(i(),v(w,{key:0,modelValue:s.isOpen,"onUpdate:modelValue":t[0]||(t[0]=b=>s.isOpen=b),class:"fcom_feed_modal",width:e.dialogWidth,"align-center":!0,"append-to-body":!0,"close-on-click-modal":!1,onClose:n.closeModal},{default:r(()=>[a(y,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[s.loading?(i(),v(m,{key:0,rows:4,animated:!0})):(i(),v(h,{key:1,feed:s.previewData,is_single:!0,is_preview:!0,show_actions:!1,show_footer:!1},{after_feed_actions:r(()=>[a(f,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:n.closeModal,text:""},null,8,["onClick"])]),_:1},8,["feed"]))]),_:1},512)]),_:1},8,["modelValue","width","onClose"])):_("",!0)}const ay=I(ny,[["render",ly]]),ry={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)}},cy={class:"dialog_header"},dy={class:"dialog_left"},uy={class:"dialog_body"},_y={class:"dialog_footer"};function my(e,t,o,u,s,n){const m=x,f=$e;return i(),v(f,{"modal-class":"fcom_common_dialog fcom_editor_unfinished_dialog",modelValue:s.isVisible,"onUpdate:modelValue":t[0]||(t[0]=h=>s.isVisible=h),width:e.modalWidth,"close-on-click-modal":!1,"close-on-press-escape":!1,"append-to-body":!0,"show-close":!1},{header:r(()=>[l("div",cy,[l("div",dy,[l("h4",null,d(e.$t("Leave Page?")),1)])])]),footer:r(()=>[l("div",_y,[a(m,{class:"fcom_secondary_button",onClick:n.handleCancel},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:n.handleProceed},{default:r(()=>[V(d(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:r(()=>[l("div",uy,[l("span",null,d(s.message),1)])]),_:1},8,["modelValue","width"])}const hy=I(ry,[["render",my]]),fy={name:"MentionPopover",components:{UserRouteLink:Fe},setup(){return{userStore:Be()}},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 o=++this.requestId;let u=this.getCached(e);if(!u){try{u=await this.userStore.fetchProfile(e)}catch{return}this.setCache(e,u)}o===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 py(e,t,o,u,s,n){const m=g("UserRouteLink");return s.virtualRef&&s.xprofile?(i(),v(m,{key:0,xprofile:s.xprofile,virtualRef:s.virtualRef,show_badge:!0,show_follow:!0,onPopoverMouseenter:n.cancelHide,onPopoverMouseleave:n.startHideTimeout},null,8,["xprofile","virtualRef","onPopoverMouseenter","onPopoverMouseleave"])):_("",!0)}const gy=I(fy,[["render",py]]);let yy=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(yy))Ls.el[e]=t;const vy={name:"PortalApplication",components:{NotificationsPop:Pn,SearchBar:Af,Feed:ot,SpaceCreateModal:Vg,ReportContentModal:Rg,ElConfigProvider:Ms,ExpandIcon:Tg,ReportReviewModal:iy,PreviewPostModal:ay,UnfinishedChangesModal:hy,MentionPopover:gy},setup(){const e=xs(),t=Le();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,enLang:Ls,loadedStyles:{},tickerDismissed:!1}},computed:{newFeedsCount(){return this.feedStore.getNewPostsCount("global")||0}},watch:{$route(e,t){var n,m;if(this.popFeed&&(this.prevUrl=e.href,this.closeFeedModal()),(n=e.meta)!=null&&n.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 y=0,w=h.length;y<w;y++)h[y].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 o=e.name;document.body.setAttribute("data-route",o),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 s=(f,h)=>{var y;if(h)try{(y=document.querySelector(f+h))==null||y.classList.add("router-link-exact-active")}catch(w){console.error(w)}};e.meta.in_course&&s(".fcom_space_",e.params.course_slug),e.meta.in_space&&s(".space_contents a.fcom_space_",e.params.space)}},methods:{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){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 u;let t=(u=this.$refs.feed_dialog_scroller)==null?void 0:u.wrapRef;if(!t)return;let o=t.querySelector(".feed_footer");o&&t.scrollTo({top:o.offsetTop-100,behavior:"smooth"})},100)})},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")},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 o=document.createElement("link");o.rel="stylesheet",o.href=this.appVars.lazy_styles[t],o.type="text/css",o.id=t,o.media="all",document.head.appendChild(o)})}},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 o=t.space;o||(o="__all"),this.feedMonitorCache[o]=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.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},by={key:0,class:"fcom_new_ticker"},ky={key:1,class:"fcom_mobile_menu"},wy={class:"focm_menu_items"},Cy=["innerHTML"],$y=["innerHTML"],Sy=["href"],Vy=["innerHTML"],Ly=["innerHTML"];function My(e,t,o,u,s,n){const m=g("router-view"),f=j,h=g("router-link"),y=Io,w=g("ExpandIcon"),b=x,C=g("feed"),p=ke,k=$e,$=g("search-bar"),S=g("notifications-pop"),T=g("space-create-modal"),F=g("unfinished-changes-modal"),B=g("preview-post-modal"),L=g("report-content-modal"),D=g("report-review-modal"),A=g("mention-popover"),U=Ms;return i(),v(U,{locale:s.enLang},{default:r(()=>[a(m,{class:H(e.appVars.route_classes)},null,8,["class"]),(i(),v(rt,{to:"body"},[u.tickerStore.isActive&&n.newFeedsCount>0&&!s.tickerDismissed?(i(),c("div",by,[l("div",{onClick:t[0]||(t[0]=P=>n.routeToAllFeeds()),class:"fcom_ticker_menu"},d(e.$_n("A new post is available","%s new posts available",n.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=P=>n.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),s.mobileMenuItems&&s.mobileMenuItems.length?(i(),c("div",ky,[l("div",wy,[(i(!0),c(M,null,R(s.mobileMenuItems,P=>(i(),c("div",null,[P.route?(i(),v(h,{key:0,"aria-label":e.$t("Go to %s",P.title),class:"focm_menu_item",to:P.route},{default:r(()=>[a(f,null,{default:r(()=>[P.icon?(i(),v(Wt(P.icon),{key:0})):P.icon_svg?(i(),c("span",{key:1,innerHTML:P.icon_svg},null,8,Cy)):_("",!0)]),_:2},1024),P.html?(i(),c("span",{key:0,innerHTML:P.html},null,8,$y)):_("",!0)]),_:2},1032,["aria-label","to"])):(i(),c("a",{key:1,href:P.permalink,class:"focm_menu_item"},[P.icon_svg?(i(),v(f,{key:0},{default:r(()=>[l("span",{innerHTML:P.icon_svg},null,8,Vy)]),_:2},1024)):_("",!0),l("span",{innerHTML:P.html},null,8,Ly)],8,Sy))]))),256))])])):_("",!0),a(k,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:s.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=P=>s.shopPopFeed=P),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{n.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:r(()=>[a(p,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[s.popFeed?(i(),v(C,{key:0,onDeleted:n.handleModalFeedDelete,is_single:!0,feed:s.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:r(()=>[a(y,{direction:"vertical"}),a(b,{onClick:n.gotToFeed,class:"no_pad_btn",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClick"]),a(b,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:n.closeFeedModal,text:""},null,8,["onClick"])]),_:1},8,["onDeleted","feed"])):_("",!0)]),_:1},512)]),_:1},8,["modelValue","before-close"])])),s.hasSearchHolder?(i(),v(rt,{key:0,to:".fcom_search_holder"},[a($)])):_("",!0),s.hasNotificationHolder?(i(),v(rt,{key:1,to:".fcom_notification_holder"},[a(S)])):_("",!0),e.isAdmin?(i(),v(T,{key:2})):_("",!0),a(F,{ref:"unfinishedChangesModal",onProceed:n.proceedCloseFeedModal},null,8,["onProceed"]),a(B),a(L),a(D),a(A)]),_:1},8,["locale"])}const Fy=I(vy,[["render",My]]),Ty={name:"ContentLayout",props:["title","content_class","wrapper_class"]},Py={key:0,class:"fhr_content_layout_header"},Iy={role:"region","aria-label":"Actions",class:"fhr_page_actions"};function Uy(e,t,o,u,s,n){return i(),c("div",{class:H([o.wrapper_class,"fhr_content_layout"])},[q(e.$slots,"header",{},()=>[o.title?(i(),c("div",Py,[q(e.$slots,"title",{},()=>[l("h1",{role:"region","aria-label":"Page Title",style:{cursor:"pointer"},onClick:t[0]||(t[0]=m=>e.$eventBus.emit("toTop")),class:"fhr_page_title"},d(o.title),1)]),l("div",Iy,[q(e.$slots,"actions")])])):_("",!0)]),q(e.$slots,"sub_header"),l("div",{class:H([o.content_class,"fhr_content_layout_body"])},[q(e.$slots,"default")],2)],2)}const we=I(Ty,[["render",Uy]]),Ey={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"})}},By={key:0,class:"dashboard_actions"},Ay=["innerHTML"],Dy={key:1};function Ry(e,t,o,u,s,n){const m=g("layout");return i(),v(m,{title:s.greetings},{default:r(()=>[s.notices.length?(i(),c("div",By,[l("h4",null,d(e.$t("Action required")),1),l("ul",null,[(i(!0),c(M,null,R(s.notices,f=>(i(),c("li",{innerHTML:f},null,8,Ay))),256))])])):(i(),c("div",Dy,[l("p",null,d(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const Hy=I(Ey,[["render",Ry]]),xy={name:"AppLayout",props:["wrapper_class"]},Oy={class:"feeds_main"};function jy(e,t,o,u,s,n){const m=g("router-view");return i(),c("div",{class:H([o.wrapper_class,"feeds"])},[l("div",Oy,[q(e.$slots,"before_route_view"),q(e.$slots,"default",{},()=>[a(m)]),q(e.$slots,"after_route_view")])],2)}const Ve=I(xy,[["render",jy]]),Ny={name:"NotificationOnboard",data(){return{pushEnabled:!1,permission:"",requestInProgress:!1,confirmed:!1}},computed:{hasPush(){return this.appVars.has_push_notification&&this.pushEnabled&&this.permission!=="granted"}},methods:{async processSubscribe(){if(this.permission==="denied"){let t=`<div style="text-align: center; margin-bottom: 15px;"> |
| 2 |
<img src="${window.fluentNotifyPublic.assets_url+"images/instruction-unblock.png"}" alt="Unblock Notifications Instructions" style="max-width: 100%; height: auto; border: 1px solid #ddd; border-radius: 4px;"/> |
| 3 |
</div>`;this.$messageBox.alert(this.$t('You have blocked or denied notifications for this site. Please reset permission and then click "Retry Button" to receive push notifications.')+t,this.$t("Notifications Blocked"),{dangerouslyUseHTMLString:!0,confirmButtonText:this.$t("Retry")}).then(()=>{window.fluentNotify&&(this.permission=window.fluentNotify.getPermission(),this.processSubscribe())});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)}},zy={key:0,class:"app_side_widget widget_push_notification"},qy={class:"widget_header"},Gy={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},Yy={class:"widget_body notifications_wrap"},Wy={class:"onboard_actions fcom_mt_10"},Zy={key:0},Ky={key:1},Jy={key:0},Qy={key:1,class:"app_side_widget widget_push_notification"};function Xy(e,t,o,u,s,n){const m=j,f=x;return n.hasPush?(i(),c("div",zy,[l("div",qy,[l("h3",Gy,[a(m,{style:{"font-size":"120%"}},{default:r(()=>[...t[1]||(t[1]=[l("svg",{width:"24px",height:"24px","stroke-width":"1.5",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",color:"currentColor"},[l("path",{d:"M18.1336 11C18.7155 16.3755 21 18 21 18H3C3 18 6 15.8667 6 8.4C6 6.70261 6.63214 5.07475 7.75736 3.87452C8.88258 2.67428 10.4087 2 12 2C12.3373 2 12.6717 2.0303 13 2.08949",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M19 8C20.6569 8 22 6.65685 22 5C22 3.34315 20.6569 2 19 2C17.3431 2 16 3.34315 16 5C16 6.65685 17.3431 8 19 8Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])]),_:1}),l("span",null,d(e.$t("Never Miss a Reply")),1)])]),l("div",Yy,[l("p",null,d(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",Wy,[a(f,{loading:s.requestInProgress,type:"primary",onClick:t[0]||(t[0]=h=>n.processSubscribe())},{default:r(()=>[s.requestInProgress?(i(),c("span",Ky,d(e.$t("Processing...")),1)):(i(),c("span",Zy,d(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),s.requestInProgress?(i(),c("p",Jy,d(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):s.confirmed?(i(),c("div",Qy,[l("p",null,d(e.$t("You will get push notifications on replies and important updates.")),1)])):_("",!0)}const ao=I(Ny,[["render",Xy]]),ev={name:"RecentActivities",components:{NotificationOnboard:ao},props:{context:{default(){return{}}},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 o=this.appVars.urls.portal_base;return o=o.replace(/\/$/,""),o+t.fullPath}},mounted(){this.getActivities(),this.$eventBus.on("recent_activities_refresh",this.getActivities)},beforeUnmount(){this.$eventBus.off("recent_activities_refresh",this.getActivities)}},tv=["innerHTML"],sv={key:1,class:"app_side_widget fcom_widget_highlight"},ov={class:"widget_header"},iv={role:"region","aria-label":"Pending Members"},nv={class:"widget_body"},lv={key:2,role:"region","aria-label":"Featured Posts",class:"app_side_widget widget_recent_activities"},av={class:"widget_header"},rv={class:"widget_body notifications_wrap"},cv={class:"notification_wrap"},dv=["href"],uv={class:"notification_item"},_v={class:"notification_avatar"},mv={class:"notification_content"},hv=["innerHTML"],fv={style:{"margin-top":"5px"},class:"feed_timestamp"},pv={role:"region","aria-label":"Space Activities",class:"app_side_widget widget_recent_activities"},gv={class:"widget_header"},yv={class:"widget_body notifications_wrap"},vv={class:"notification_wrap"},bv=["href"],kv={class:"notification_avatar"},wv={class:"notification_content"},Cv=["innerHTML"],$v=["title"],Sv={key:2,class:"notification_wrap"},Vv={class:"notification_item"},Lv={class:"notification_content"},Mv={class:"no_notifications"},Fv=["innerHTML"];function Tv(e,t,o,u,s,n){const m=g("NotificationOnboard"),f=x,h=g("UserAvatar"),y=Y;return i(),c(M,null,[s.before_contents?(i(),c("div",{key:0,innerHTML:s.before_contents},null,8,tv)):_("",!0),a(m),s.pending_count&&o.with_pending_count?(i(),c("div",sv,[l("div",ov,[l("h3",iv,d(e.$t("Pending Members")),1)]),l("div",nv,[l("p",null,d(e.$t("%s people requested to join the community.",s.pending_count)),1)]),a(f,{role:"link","aria-label":"View pending members",onClick:t[0]||(t[0]=w=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:r(()=>[V(d(e.$t("View pending members")),1)]),_:1})])):_("",!0),o.with_pins&&s.pinned_posts.length?(i(),c("div",lv,[l("div",av,[l("h3",null,d(o.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",rv,[(i(!0),c(M,null,R(s.pinned_posts,w=>{var b;return i(),c("div",cv,[l("a",{class:"no_style_link",href:w.permalink},[l("div",uv,[l("div",_v,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",mv,[l("div",{innerHTML:w.message},null,8,hv),l("span",fv,d((b=w.xprofile)==null?void 0:b.display_name),1)])])],8,dv)])}),256))])])):_("",!0),l("div",pv,[l("div",gv,[l("h3",null,d(o.widget_title||e.$t("Recent Activities")),1)]),l("div",yv,[s.loading?(i(),v(y,{key:0,style:{"min-width":"320px"},animated:!0,rows:5})):s.activities.length?(i(!0),c(M,{key:1},R(s.activities,w=>(i(),c("div",vv,[l("a",{href:n.getActivityLink(w),class:"notification_item"},[l("div",kv,[a(h,{with_level:!1,xprofile:w.xprofile},null,8,["xprofile"])]),l("div",wv,[l("div",{innerHTML:w.message},null,8,Cv),l("span",{title:w.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(w.updated_at)),9,$v)])],8,bv)]))),256)):(i(),c("div",Sv,[l("div",Vv,[l("div",Lv,[l("div",Mv,d(e.$t("No recent activities found")),1)])])]))])]),s.after_contents?(i(),c("div",{key:3,innerHTML:s.after_contents},null,8,Fv)):_("",!0)],64)}const Ht=I(ev,[["render",Tv]]),Pv={name:"BgImageUpload",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1},button_text:{type:String,default(){return""}},can_remove:{type:Boolean,default:!1},is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})}},data(){return{imageUrl:this.modelValue}},computed:{action_url(){return this.appVars.rest.url+"/feeds/media-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{handleSuccess(e){this.imageUrl=e.media.url,this.$emit("update:modelValue",this.imageUrl)},handleError(e){this.$handleError(JSON.parse(e.message))},removeImage(){this.imageUrl="",this.$emit("update:modelValue","")}}};function Iv(e,t,o,u,s,n){const m=Ie,f=x,h=ut,y=g("CloseBold"),w=j;return i(),c(M,null,[a(h,{action:n.action_url,headers:n.headers,accept:"image/*",class:"fcom_bg_upload",multiple:o.is_multiple,data:o.additional_data,"show-file-list":!1,"on-success":n.handleSuccess,"on-error":n.handleError},{default:r(()=>[q(e.$slots,"trigger",{},()=>[q(e.$slots,"default",{},()=>[s.imageUrl?(i(),v(m,{key:0,alt:e.$t("Image Preview"),src:s.imageUrl},null,8,["alt","src"])):(i(),v(f,{key:1,class:"fcom_btn_upload",text:""},{default:r(()=>[V(d(o.button_text||e.$t("Upload Image")),1)]),_:1}))])])]),_:3},8,["action","headers","multiple","data","on-success","on-error"]),s.imageUrl&&o.can_remove?(i(),v(f,{key:0,class:"fcom_bg_remove",text:"",size:"small",onClick:n.removeImage},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClick"])):_("",!0)],64)}const ro=I(Pv,[["render",Iv]]),Uv={name:"WelcomeBannerConfig",props:["savingCount"],emits:["saved"],components:{MediaEmbeder:ns,BgImageUpload:ro,CrepeEditor:Vt},data(){return{saving:!1,loading:!1,currentTab:"login",appReady:!1,bannerData:{login:{enable:"no",mediaType:"image",title:"",description:"",allowClose:"yes",bannerImage:"",ctaButtons:[],bannerVideo:{}},logout:{enable:"no",mediaType:"image",title:"",description:"",bannerImage:"",ctaButtons:[],bannerVideo:{}}}}},watch:{savingCount(){this.saveSettings()}},computed:{isEnabled(){return this.bannerData[this.currentTab].enabled=="yes"}},methods:{switchOption(e){this.appReady=!1,this.currentTab=e,this.$nextTick(()=>{this.appReady=!0})},addButton(){this.bannerData[this.currentTab].ctaButtons.push({label:"",link:"",type:"primary",newTab:"yes"})},removeButton(e){this.bannerData[this.currentTab].ctaButtons.splice(e,1)},getSettings(){this.loading=!0,this.$get("admin/welcome-banner").then(e=>{this.bannerData=e.settings,this.appReady=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveSettings(){this.saving=!0,this.$post("admin/welcome-banner",{settings:this.bannerData}).then(e=>{this.$notify.success(e.message),this.$emit("saved"),this.Storage.remove("fcom_welcome_banner_closed_auth"),this.Storage.remove("fcom_welcome_banner_closed_guest")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.getSettings()}},Ev={class:"fcom_customizer_container"},Bv={class:"fcom_wc_banner_header"},Av={class:"fcom_wc_banner_options"},Dv={class:"fcom_filter_menu"},Rv={class:"fcom_filter_menu_ul"},Hv={key:0,class:"fcom_wc_banner_content"},xv={class:"fcom_wc_banner_content_header"},Ov={class:"fcom_wc_banner_media_type"},jv={key:0,class:"fcom_banner_image_holder"},Nv={key:1,class:"fcom_banner_image_preview"},zv={key:0,class:"fcom_wc_banner_cta_buttons"},qv={class:"fcom_wc_help_text"},Gv={class:"fcom_wc_banner_content_footer"};function Yv(e,t,o,u,s,n){const m=Fs,f=Ae,h=be,y=g("BgImageUpload"),w=Ie,b=g("CloseBold"),C=j,p=x,k=g("media-embeder"),$=X,S=de,T=g("crepe-editor"),F=ee,B=te,L=Uo,D=pe,A=ue,U=Y;return i(),c("div",Ev,[l("div",Bv,[l("h4",null,d(e.$t("Welcome Banner")),1)]),l("div",Av,[l("div",Dv,[l("ul",Rv,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(P=>n.switchOption("login"),["prevent"])),class:H({"router-link-exact-active":s.currentTab=="login"}),href:"#"},d(e.$t("Logged in")),3)]),l("li",null,[l("a",{onClick:t[1]||(t[1]=z(P=>n.switchOption("logout"),["prevent"])),class:H({"router-link-exact-active":s.currentTab=="logout"}),href:"#"},d(e.$t("Logged out")),3)])])])]),s.loading?(i(),v(U,{key:1,rows:5})):(i(),c("div",Hv,[l("div",xv,[l("h4",null,d(s.currentTab==="login"?e.$t("Enable for logged in members"):e.$t("Enable for logged out members")),1),a(m,{modelValue:s.bannerData[s.currentTab].enabled,"onUpdate:modelValue":t[2]||(t[2]=P=>s.bannerData[s.currentTab].enabled=P),"active-value":"yes","inactive-value":"no",class:"fcom_switch"},null,8,["modelValue"])]),l("div",{class:H(["fcom_wc_banner_content_body",{fcom_wc_disabled:!n.isEnabled}])},[l("div",Ov,[l("p",null,d(e.$t("Media type")),1),a(h,{modelValue:s.bannerData[s.currentTab].mediaType,"onUpdate:modelValue":t[3]||(t[3]=P=>s.bannerData[s.currentTab].mediaType=P),class:"fcom_radio_group"},{default:r(()=>[a(f,{label:e.$t("Image"),value:"image"},null,8,["label"]),a(f,{label:e.$t("Video"),value:"video"},null,8,["label"])]),_:1},8,["modelValue"])]),s.bannerData[s.currentTab].mediaType==="image"?(i(),c(M,{key:0},[s.bannerData[s.currentTab].bannerImage?(i(),c("div",Nv,[a(w,{alt:e.$t("Image Preview"),src:s.bannerData[s.currentTab].bannerImage},null,8,["alt","src"]),a(p,{class:"fcom_secondary_button",text:"",onClick:t[5]||(t[5]=P=>s.bannerData[s.currentTab].bannerImage="")},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1})])):(i(),c("div",jv,[l("h4",null,d(e.$t("Featured Image")),1),l("p",null,d(e.$t("Set a featured image at the top of the welcome banner. Recommended image dimension: 1680x600")),1),a(y,{modelValue:s.bannerData[s.currentTab].bannerImage,"onUpdate:modelValue":t[4]||(t[4]=P=>s.bannerData[s.currentTab].bannerImage=P)},null,8,["modelValue"])]))],64)):_("",!0),s.bannerData[s.currentTab].mediaType==="video"?(i(),v(k,{key:1,media:s.bannerData[s.currentTab].bannerVideo},null,8,["media"])):_("",!0),a(A,{onSubmit:t[9]||(t[9]=z(P=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(S,{label:e.$t("Title")},{default:r(()=>[a($,{modelValue:s.bannerData[s.currentTab].title,"onUpdate:modelValue":t[6]||(t[6]=P=>s.bannerData[s.currentTab].title=P)},null,8,["modelValue"])]),_:1},8,["label"]),a(S,{label:e.$t("Description")},{default:r(()=>[s.appReady?(i(),v(T,{key:0,modelValue:s.bannerData[s.currentTab].description,"onUpdate:modelValue":t[7]||(t[7]=P=>s.bannerData[s.currentTab].description=P)},null,8,["modelValue"])):_("",!0)]),_:1},8,["label"]),a(S,{label:e.$t("Call to Action")},{default:r(()=>{var P;return[((P=s.bannerData[s.currentTab].ctaButtons)==null?void 0:P.length)>0?(i(),c("div",zv,[(i(!0),c(M,null,R(s.bannerData[s.currentTab].ctaButtons,(O,N)=>(i(),c("div",{key:N,class:"fcom_wc_banner_cta_button"},[a(S,{label:N?"":e.$t("Button Label")},{default:r(()=>[a($,{modelValue:O.label,"onUpdate:modelValue":Q=>O.label=Q},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(S,{label:N?"":e.$t("Button Link")},{default:r(()=>[a($,{modelValue:O.link,"onUpdate:modelValue":Q=>O.link=Q},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(S,{label:N?"":e.$t("Button Type"),class:"fcom_wc_banner_select"},{default:r(()=>[a(B,{modelValue:O.type,"onUpdate:modelValue":Q=>O.type=Q,class:"fcom_select",placeholder:e.$t("Select type")},{default:r(()=>[a(F,{label:e.$t("Primary"),value:"primary"},null,8,["label"]),a(F,{label:e.$t("Secondary"),value:"secondary"},null,8,["label"]),a(F,{label:e.$t("Text"),value:"text"},null,8,["label"]),a(F,{label:e.$t("Link"),value:"link"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"]),a(S,{label:N?"":e.$t("Open in new tab"),class:"fcom_wc_banner_select"},{default:r(()=>[a(B,{modelValue:O.newTab,"onUpdate:modelValue":Q=>O.newTab=Q,class:"fcom_select"},{default:r(()=>[a(F,{label:e.$t("Yes"),value:"yes"},null,8,["label"]),a(F,{label:e.$t("No"),value:"no"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(p,{text:"",class:"wc_button_remove",onClick:Q=>n.removeButton(N)},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])]))),128)),a(L,{underline:!1,onClick:n.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"])])):(i(),v(L,{key:1,underline:!1,onClick:n.addButton},{default:r(()=>[V(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"]))]}),_:1},8,["label"]),s.currentTab=="login"?(i(),v(S,{key:0},{default:r(()=>[a(D,{modelValue:s.bannerData[s.currentTab].allowClose,"onUpdate:modelValue":t[8]||(t[8]=P=>s.bannerData[s.currentTab].allowClose=P),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Allow members to close the welcome banner")),1)]),_:1},8,["modelValue"]),l("span",qv,d(e.$t("If allowed, members will be able to hide the banner")),1)]),_:1})):_("",!0)]),_:1})],2),l("div",Gv,[a(p,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveSettings},{default:r(()=>[V(d(e.$t("Update Info")),1)]),_:1},8,["disabled","loading","onClick"])])]))])}const Wv=I(Uv,[["render",Yv]]);const Zv={name:"FluentDnD",props:{items:{type:Array,required:!0},itemClass:{type:String},itemStyle:{type:String},rowKey:{type:String,default:"id"},group:{type:String,default:""},gap:{type:String,default:""},draggable:{type:Boolean,default:!0}},emits:["drop","crossDrop","drag-start"],data(){return{draggingIndex:null,startIndex:null,snapshotBeforeDrag:null}},methods:{dragStart(e,t){e._fluentDndHandled||(e._fluentDndHandled=!0,this.draggingIndex=t,this.startIndex=t,this.snapshotBeforeDrag=[...this.items],this.$emit("drag-start",{index:t,items:this.items}),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",this.items[t][this.rowKey]),this.group&&e.dataTransfer.setData("source-group",this.group))},dragEnd(){this.snapshotBeforeDrag&&(this.items.splice(0,this.items.length,...this.snapshotBeforeDrag),this.snapshotBeforeDrag=null),this.draggingIndex=null},dragOver(e,t){if(e.preventDefault(),!this.group&&e.dataTransfer.types.includes("source-group")||this.draggingIndex===null)return;const o=this.items[this.draggingIndex],u=this.items[t];if(o===u)return;const s=e.currentTarget.getBoundingClientRect(),n=s.top+s.height/2,m=e.clientY;(this.draggingIndex<t&&m>n||this.draggingIndex>t&&m<n)&&(this.reorderItems(this.draggingIndex,t),this.draggingIndex=t)},dropEnd(e,t){const o=e.dataTransfer.getData("source-group");if(!(!this.group&&o)){if(this.group&&o&&o!==this.group){e.stopPropagation();const u=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:u,sourceGroup:o,targetGroup:this.group,targetIndex:t});return}this.startIndex===null||this.startIndex===t||(e.stopPropagation(),this.snapshotBeforeDrag=null,this.draggingIndex=null,this.startIndex=null,this.$emit("drop",{index:t,newItems:this.items}))}},onContainerDragOver(e){e.preventDefault()},onContainerDrop(e){if(!this.group)return;const t=e.dataTransfer.getData("source-group");if(!t||t===this.group)return;const o=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:o,sourceGroup:t,targetGroup:this.group,targetIndex:this.items.length})},reorderItems(e,t){const o=this.items.splice(e,1)[0];this.items.splice(t,0,o)}}},Kv=["onDragstart","onDragover","onDrop","draggable"];function Jv(e,t,o,u,s,n){return i(),c("div",{class:"drag-container",onDragover:t[1]||(t[1]=z((...m)=>n.onContainerDragOver&&n.onContainerDragOver(...m),["prevent"])),onDrop:t[2]||(t[2]=z((...m)=>n.onContainerDrop&&n.onContainerDrop(...m),["prevent"]))},[a(So,{name:"flip-list",tag:"div",class:"drag-group",style:le(o.gap?{display:"flex",flexDirection:"column",gap:o.gap}:{})},{default:r(()=>[(i(!0),c(M,null,R(o.items,(m,f)=>(i(),c("div",{key:m[o.rowKey],onDragstart:h=>n.dragStart(h,f),onDragend:t[0]||(t[0]=(...h)=>n.dragEnd&&n.dragEnd(...h)),onDragover:z(h=>n.dragOver(h,f),["prevent"]),onDrop:z(h=>n.dropEnd(h,f),["prevent"]),draggable:o.draggable,class:H(["drag-item",o.itemClass,{dragging:s.draggingIndex===f}]),style:le(o.itemStyle)},[q(e.$slots,"item",{data:m,index:f},void 0,!0)],46,Kv))),128))]),_:3},8,["style"])],32)}const Qv=I(Zv,[["render",Jv],["__scopeId","data-v-97dc50e4"]]),Xv={name:"MenuGroupSettings",components:{SpaceCourseSelector:Rt,FluentDnD:Qv,LogoEmojiSelector:Ut,Drawer:oo},data(){return{editingItem:null,originalItem:null,openEditLinkDrawer:!1,isDragging:!1,isSpaceDragging:!1,draggingIndex:null,draggedSpaceIndex:null,mode:null,urlErrors:[],validationAttempt:0}},computed:{isDirty(){return!this.editingItem||!this.originalItem?!1:JSON.stringify(this.editingItem)!==JSON.stringify(this.originalItem)}},emits:["save"],props:{menuItems:{type:Array,required:!0},saving:{type:Boolean,default:!1},title:{type:String,required:!0},has_svg:{type:Boolean,default:!0},use_icon_selector:{type:Boolean,default:!1},has_enable_disable:{type:Boolean,default:!0},custom_svg:{type:Boolean,default:!1}},methods:{validateLinkForm(){if(this.urlErrors=[],this.validationAttempt++,(!this.editingItem.title||!this.editingItem.title.trim())&&this.urlErrors.push(this.$t("Link title cannot be empty.")),this.editingItem.is_system!=="yes"){const e=At(this.editingItem.permalink);e.valid||this.urlErrors.push(...e.errors)}return this.urlErrors.length===0},initEditLink(e,t="create"){!e.is_system&&!e.privacy&&(e.privacy="public",e.membership_ids=[]),this.mode=t,this.urlErrors=[],this.originalItem=e,this.editingItem=JSON.parse(JSON.stringify(e||{})),this.$nextTick(()=>{this.openEditLinkDrawer=!0})},removeLink(e){this.$confirm(this.$t("Are you sure you want to remove this link?"),this.$t("Warning"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.menuItems.splice(e,1),this.saveMenuItems({customSuccessMessage:this.$t("Link deleted successfully.")})})},createOrUpdateLink(){if(!this.saving&&this.validateLinkForm()){if(!this.editingItem.slug)this.editingItem.slug="fcom_custom_"+this.editingItem.title.toLowerCase().replace(/[^a-z0-9]/g,"_"),this.menuItems.push(this.editingItem);else{const e=this.menuItems.findIndex(t=>t.slug===this.editingItem.slug);e!==-1?Object.assign(this.menuItems[e],this.editingItem):this.menuItems.push(this.editingItem)}this.openEditLinkDrawer=!1,this.editingItem=null,this.saveMenuItems()}},saveMenuItems({customSuccessMessage:e=null}={}){this.$emit("save",{customSuccessMessage:e})},drop({index:e}){this.draggingIndex=null,this.saveMenuItems()},beforeCloseDrawer(e){if(this.saving){this.$notify.info(this.$t("Please wait to complete."));return}this.editingItem=null,this.originalItem=null,this.mode=null,e()}}},e0={key:0,class:"fcom_section_primary"},t0={class:"fcom_section_primary_item"},s0={class:"fcom_section_primary_item_title"},o0={class:"fcom_heading_item"},i0={class:"fcom_section_item_actions"},n0={class:"fcom_section_items menu-items-container"},l0={key:0,style:{padding:"1rem"}},a0={class:"fcom_section_item_title"},r0={class:"fcom_heading_item"},c0={key:0,class:"community_avatar"},d0=["src"],u0={key:1,class:"fcom_emoji"},_0={key:2,class:"fcom_shape"},m0=["innerHTML"],h0={class:"fcom_section_item_actions"},f0={key:0},p0={key:1},g0={key:0},y0={class:"fcom_help_text"},v0={class:"fcom_help_text"};function b0(e,t,o,u,s,n){const m=x,f=j,h=Ue,y=g("FluentDnD"),w=g("logo-emoji-selector"),b=X,C=de,p=pe,k=Ae,$=be,S=g("SpaceCourseSelector"),T=Vs,F=ue,B=g("drawer");return i(),c(M,null,[o.menuItems?(i(),c("div",e0,[l("div",t0,[l("div",s0,[l("div",o0,[q(e.$slots,"title",{},()=>[l("h4",null,d(o.title),1)])])]),l("div",i0,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=L=>n.initEditLink({enabled:"yes",privacy:"public",membership_ids:[],new_tab:"yes"}))},{default:r(()=>[V(d(e.$t("Add New Link")),1)]),_:1})])]),l("div",n0,[o.menuItems.length?_("",!0):(i(),c("div",l0,[l("p",null,d(e.$t("No link has been added for this section")),1)])),a(y,{items:o.menuItems,"row-key":"slug",onDrop:n.drop,"item-class":"fcom_section_item"+(o.saving?"":" fcom_cursor_move"),"item-style":"padding: 15px 15px 15px 35px"},{item:r(({data:L,index:D})=>[l("div",a0,[l("p",r0,[o.use_icon_selector?(i(),c(M,{key:0},[t[12]||(t[12]=l("div",{class:"fcom_drag_handle"}," ⋮⋮ ",-1)),L.icon_image?(i(),c("div",c0,[a(f,null,{default:r(()=>[l("img",{alt:"",style:{"max-width":"16px","max-height":"16px"},src:L.icon_image},null,8,d0)]),_:2},1024)])):L.emoji?(i(),c("span",u0,d(L.emoji),1)):L.shape_svg?(i(),c("span",_0,[a(f,{innerHTML:L.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):L.icon_svg?(i(),v(f,{key:1},{default:r(()=>[l("span",{innerHTML:L.icon_svg},null,8,m0)]),_:2},1024)):_("",!0),l("span",null,d(L.title),1),L.is_unavailable=="yes"?(i(),v(h,{key:2,type:"danger"},{default:r(()=>[V(d(e.$t("unavailable")),1)]),_:1})):L.enabled=="yes"?(i(),v(h,{key:3,type:"success"},{default:r(()=>[V(d(e.$t("enabled")),1)]),_:1})):(i(),v(h,{key:4,type:"info"},{default:r(()=>[V(d(e.$t("disabled")),1)]),_:1}))])]),l("div",h0,[l("div",null,[a(m,{onClick:A=>n.initEditLink(L,"edit"),size:"small"},{default:r(()=>[V(d(e.$t("Edit")),1)]),_:1},8,["onClick"]),L.is_system!="yes"?(i(),v(m,{key:0,onClick:A=>n.removeLink(D),type:"danger",plain:"",size:"small"},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["onClick"])):_("",!0)])])]),_:1},8,["items","onDrop","item-class"])])])):_("",!0),a(B,{modelValue:s.openEditLinkDrawer,"onUpdate:modelValue":t[11]||(t[11]=L=>s.openEditLinkDrawer=L),size:e.drawerWidth,"before-close":n.beforeCloseDrawer,id:"fluent_comminity_body","close-on-click-modal":!0,"has-close-confirmation":n.isDirty&&!o.saving,"close-confirmation-message":e.$t("Closing will discard your changes. Are you sure?")},{header:r(()=>[s.mode==="edit"?(i(),c("h4",f0,d(e.$t("Edit Link")),1)):(i(),c("h4",p0,d(e.$t("Add Custom Link")),1))]),default:r(()=>[s.editingItem?(i(),c("div",g0,[a(F,{onSubmit:t[10]||(t[10]=z(L=>e.doNothing(),["prevent"])),"label-position":"top",disabled:o.saving},{default:r(()=>[a(C,{label:e.$t("Name of the Link")},{default:r(()=>[a(b,{disabled:o.saving,placeholder:e.$t("Public Name of the item"),modelValue:s.editingItem.title,"onUpdate:modelValue":t[2]||(t[2]=L=>s.editingItem.title=L)},ve({_:2},[o.use_icon_selector?{name:"prepend",fn:r(()=>[a(w,{custom_svg:o.custom_svg,fallback_mark:"<span style='font-size: 20px;'>☺</span>",onUpdate:t[1]||(t[1]=L=>{o.saving||(s.editingItem.emoji=L.emoji,s.editingItem.icon_image=L.logo,s.editingItem.shape_svg=L.shape_svg)}),config:{logo:s.editingItem.icon_image,emoji:s.editingItem.emoji||"",shape_svg:s.editingItem.shape_svg||""}},null,8,["custom_svg","config"])]),key:"0"}:void 0]),1032,["disabled","placeholder","modelValue"])]),_:1},8,["label"]),a(C,{label:e.$t("URL")},{default:r(()=>[a(b,{disabled:o.saving||s.editingItem.is_system=="yes",type:"text",placeholder:e.$t("URL or path (e.g. https://example.com or /members)"),modelValue:s.editingItem.permalink,"onUpdate:modelValue":t[3]||(t[3]=L=>s.editingItem.permalink=L)},null,8,["disabled","placeholder","modelValue"]),l("div",y0,[l("p",null,d(e.$t("For internal links, start with / (e.g. /members).")),1)])]),_:1},8,["label"]),o.has_svg?(i(),v(C,{key:0,label:e.$t("SVG Code for Icon (Simplified SVG Code) / Emoji")},{default:r(()=>[a(b,{disabled:o.saving,placeholder:e.$t("SVG Code. No url please / You can use emoji"),type:"textarea",rows:3,modelValue:s.editingItem.icon_svg,"onUpdate:modelValue":t[4]||(t[4]=L=>s.editingItem.icon_svg=L)},null,8,["disabled","placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),o.has_enable_disable?(i(),v(C,{key:1,style:{"margin-bottom":"5px"}},{default:r(()=>[a(p,{disabled:o.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.enabled,"onUpdate:modelValue":t[5]||(t[5]=L=>s.editingItem.enabled=L),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Enable this link")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),s.editingItem.is_system?_("",!0):(i(),c(M,{key:2},[a(C,null,{default:r(()=>[a(p,{disabled:o.saving,"true-value":"yes","false-value":"no",modelValue:s.editingItem.new_tab,"onUpdate:modelValue":t[6]||(t[6]=L=>s.editingItem.new_tab=L),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Open this link in a new tab.")),1)]),_:1},8,["disabled","modelValue"])]),_:1}),a(C,{label:e.$t("Visibility")},{default:r(()=>[a($,{disabled:o.saving,modelValue:s.editingItem.privacy,"onUpdate:modelValue":t[7]||(t[7]=L=>s.editingItem.privacy=L)},{default:r(()=>[a(k,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(k,{label:e.$t("Logged-in only"),value:"logged_in"},null,8,["label"]),a(k,{label:e.$t("Public only"),value:"logged_out_only"},null,8,["label"]),a(k,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["disabled","modelValue"]),l("div",v0,d(e.$t("Select who can see this link.")),1)]),_:1},8,["label"]),s.editingItem.privacy=="members_only"?(i(),v(C,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(S,{disabled:o.saving,modelValue:s.editingItem.membership_ids,"onUpdate:modelValue":t[8]||(t[8]=L=>s.editingItem.membership_ids=L),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["disabled","modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0)],64)),s.urlErrors.length?(i(),v(T,{key:s.validationAttempt,type:"warning",closable:!0,"show-icon":"",style:{margin:"8px 0"}},{title:r(()=>[l("div",null,[l("ul",null,[(i(!0),c(M,null,R(s.urlErrors,(L,D)=>(i(),c("li",{style:{"margin-bottom":"0"},key:D},d(L),1))),128))])])]),_:1})):_("",!0),a(C,null,{default:r(()=>[a(m,{disabled:o.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>n.createOrUpdateLink())},{default:r(()=>[V(d(o.saving?e.$t("Saving..."):e.$t("Save")),1)]),_:1},8,["disabled"])]),_:1})]),_:1},8,["disabled"])])):_("",!0)]),_:1},8,["modelValue","size","before-close","has-close-confirmation","close-confirmation-message"])],64)}const co=I(Xv,[["render",b0]]),k0={name:"ManageFeedLinks",components:{MenuGroupSettings:co},props:["savingCount"],emits:["saved"],data(){return{loading:!1,menuItems:[]}},watch:{savingCount(){this.saveMenuItems()}},methods:{getMenuItems(){this.loading=!0,this.$get("feeds/links").then(e=>{this.menuItems=e.links}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},saveMenuItems(){let e="feeds/links";this.$post(e,{links:this.menuItems}).then(t=>{this.$notify.success(t.message),this.menuItems=t.links,this.$emit("saved")}).catch(t=>{this.$handleError(t)})}},mounted(){this.getMenuItems()}},w0={class:"fcom_customizer_container"},C0={key:0,class:"fcom_card_sections"};function $0(e,t,o,u,s,n){const m=g("menu-group-settings"),f=Y;return i(),c("div",w0,[s.loading?_("",!0):(i(),c("div",C0,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,title:e.$t("Manage Links"),menuItems:s.menuItems,onSave:t[0]||(t[0]=h=>n.saveMenuItems())},null,8,["title","menuItems"])])),s.loading?(i(),v(f,{key:1,rows:5,animated:""})):_("",!0)])}const S0=I(k0,[["render",$0]]),V0={name:"FeedCustomizer",props:["customize_tab"],components:{WelcomeBannerConfig:Wv,ManageFeedLinks:S0},data(){return{saving:!1,savingCount:0,changesExist:!1,currentTab:this.customize_tab}},methods:{savedData(){this.saving=!1,this.changesExist=!0},saveChanges(){this.changesExist=!0,this.savingCount=this.savingCount+1},handleBack(){this.$emit("updated",this.changesExist)}}},L0={class:"fcom_full_editor"},M0={class:"fcom_full_editor_header"},F0={class:"fcom_editor_menu object_menu"},T0={class:"fcom_space_menu_ul"},P0={class:"full_editor_actions"};function I0(e,t,o,u,s,n){const m=g("ArrowLeft"),f=j,h=x,y=Ts,w=g("welcome-banner-config"),b=ke,C=Me,p=g("manage-feed-links"),k=xe;return i(),c("div",L0,[a(k,null,{default:r(()=>[a(y,{class:"fcom_full_editor_header_wrap"},{default:r(()=>[l("div",M0,[l("div",{onClick:t[0]||(t[0]=(...$)=>n.handleBack&&n.handleBack(...$)),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(e.$t("Feed")),1)]),l("div",F0,[l("ul",T0,[e.has_pro?(i(),c("li",{key:0,onClick:t[1]||(t[1]=$=>s.currentTab="welcome")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="welcome"}),href:"#"},d(e.$t("Welcome Banner")),3)])):_("",!0),l("li",{onClick:t[2]||(t[2]=$=>s.currentTab="manage_links")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="manage_links"}),href:"#"},d(e.$t("Feed Links")),3)])])]),l("div",P0,[a(h,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveChanges},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"])])])]),_:1}),a(k,{class:"fcom_full_editor_container"},{default:r(()=>[s.currentTab=="welcome"?(i(),v(C,{key:0,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(w,{savingCount:s.savingCount,onSaved:n.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):s.currentTab=="manage_links"?(i(),v(C,{key:1,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(p,{savingCount:s.savingCount,onSaved:n.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):_("",!0)]),_:1})]),_:1})])}const U0=I(V0,[["render",I0]]),E0={name:"FeedMenu",components:{FeedCustomizer:U0},data(){return{customizeTab:"welcome",customizeSpace:!1,popoverVisible:!1}},methods:{openCustomizer(e){this.popoverVisible=!1,this.customizeTab=e,this.customizeSpace=!0},togglePopover(){this.popoverVisible=!this.popoverVisible},updatedFeedSettings(e){this.customizeSpace=!1,e&&location.reload()}}},B0={class:"actions_items"},A0={key:0};function D0(e,t,o,u,s,n){const m=g("MoreFilled"),f=j,h=x,y=fe,w=g("feed-customizer");return i(),c(M,null,[l("div",null,[a(y,{placement:"bottom",ref:"feed_actions",persistent:!1,visible:s.popoverVisible,onHide:t[2]||(t[2]=b=>s.popoverVisible=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:n.togglePopover},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[l("ul",B0,[e.has_pro?(i(),c("li",{key:0,onClick:t[0]||(t[0]=b=>n.openCustomizer("welcome"))},d(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=b=>n.openCustomizer("manage_links"))},d(e.$t("Manage Links")),1)])]),_:1},8,["visible"])]),s.customizeSpace?(i(),c("div",A0,[(i(),v(rt,{to:"body"},[a(w,{customize_tab:s.customizeTab,onClose:t[3]||(t[3]=b=>s.customizeSpace=!1),onUpdated:n.updatedFeedSettings},null,8,["customize_tab","onUpdated"])]))])):_("",!0)],64)}const R0=I(E0,[["render",D0]]),H0={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")}}},x0={class:"object_menu"},O0={class:"fcom_space_menu_ul"},j0=["target","href"],N0=["src"],z0={key:1,class:"fcom_emoji"},q0={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function G0(e,t,o,u,s,n){const m=j;return i(),c("div",x0,[l("ul",O0,[(i(!0),c(M,null,R(n.enabledLinks,f=>(i(),c("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",href:f.permalink},[f.icon_image?(i(),c("img",{key:0,alt:"",src:f.icon_image},null,8,N0)):f.emoji?(i(),c("span",z0,d(f.emoji),1)):f.shape_svg?(i(),c("span",q0,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,d(f.title),1)],8,j0)]))),128))])])}const us=I(H0,[["render",G0]]),Y0={name:"FeedsRoute",components:{SpaceIcon:Ne,Layout:we,AppLayout:Ve,RecentActivities:Ht,FeedMenu:R0,RenderSpaceLinks:us},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)}},W0={key:0,"aria-label":"Feed Links",class:"fcom_sub_header"},Z0={key:0,class:"fcom_profile_complete_btn_wrap"},K0={key:1},J0={key:0,class:"fcom_feed_box"},Q0={key:0,class:"fcom_main_side_wrap"},X0={class:"fcom_side_box"};function e2(e,t,o,u,s,n){const m=g("render-space-links"),f=x,h=g("feed-menu"),y=g("router-view"),w=Me,b=g("recent-activities"),C=Qe,p=xe,k=g("layout"),$=g("app-layout");return i(),v($,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(k,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=S=>{e.$eventBus.emit("toTop"),n.resetRoute()}),class:"fcom_page_title clickable"},d(e.$t("Feed")),1)]),sub_header:r(()=>{var S;return[((S=e.appVars.feed_links)==null?void 0:S.length)>0?(i(),c("nav",W0,[a(m,{links:e.appVars.feed_links},null,8,["links"])])):_("",!0)]}),actions:r(()=>[e.auth.compilation_score<100?(i(),c("div",Z0,[a(f,{onClick:n.goToProfile,type:"danger"},{default:r(()=>[V(d(e.$t("Complete your profile"))+" ("+d(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(i(),c("div",K0,[a(h)])):_("",!0)]),default:r(()=>[a(p,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(w,{class:"fcom_main"},{default:r(()=>[s.transiting?_("",!0):(i(),c("div",J0,[a(y)]))]),_:1}),a(C,{class:"fcom_resp_side",width:"306px"},{default:r(()=>[e.isMobile?_("",!0):(i(),c("div",Q0,[l("div",X0,[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 t2=I(Y0,[["render",e2]]);const s2={name:"NewPostsBanner",components:{ArrowUp:Bs},props:{context:{type:String,default:"global"},minScrollToShow:{type:Number,default:500}},setup(){return{feedStore:Le()}},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}}},o2={class:"fcom_new_posts_text"};function i2(e,t,o,u,s,n){const m=g("ArrowUp"),f=j;return i(),v(ws,{name:"slide-down"},{default:r(()=>[s.show?(i(),c("div",{key:0,class:"fcom_new_posts_banner",onClick:t[0]||(t[0]=(...h)=>n.scrollToTop&&n.scrollToTop(...h))},[a(f,{class:"fcom_new_posts_icon"},{default:r(()=>[a(m)]),_:1}),l("span",o2,d(s.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:s.count})),1)])):_("",!0)]),_:1})}const n2=I(s2,[["render",i2],["__scopeId","data-v-e4ec71f4"]]),l2={name:"AllFeeds",components:{Feeds:ft,NewPostsBanner:n2},setup(){const e=xs(),t=Ge();return{tickerStore:e,uiStore:t}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},mounted(){var e,t;if(this.changeTitle(this.$t("All Feeds")),(e=this.appVars.features)!=null&&e.enable_feed_ticker){const o=((t=this.appVars.features)==null?void 0:t.ticker_interval)||3e4;this.tickerStore.start(o)}},beforeUnmount(){var e;(e=this.appVars.features)!=null&&e.enable_feed_ticker&&this.tickerStore.stop()}},a2={key:0,class:"notices fcom_notice_wrap"},r2=["innerHTML"];function c2(e,t,o,u,s,n){var y;const m=g("WelcomeBanner"),f=g("NewPostsBanner"),h=g("feeds");return i(),c(M,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(i(),c("div",a2,[(i(!0),c(M,null,R(e.appVars.portal_notices,w=>(i(),c("div",{innerHTML:w},null,8,r2))),256))])):_("",!0),e.appVars.welcome_banner?(i(),v(m,{key:1})):_("",!0),(y=e.appVars.features)!=null&&y.enable_feed_ticker?(i(),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 d2=I(l2,[["render",c2]]),u2={name:"ViewFeed",components:{Feed:ot},props:["feed_slug"],setup(){return{feedStore:Le()}},data(){return{loading:!0,feed:null,notFound:!1}},watch:{feed_slug(){this.feed=null,this.$nextTick(()=>{this.getFeed()})}},methods:{getFeed(){this.feed=null,this.loading=!0,this.$get("feeds/"+this.feed_slug+"/by-slug").then(e=>{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()}),this.$eventBus.emit("feed_interaction",this.feed.id)}).catch(e=>{this.$handleError(e),typeof e=="object"&&e.xhr_status==404&&(this.notFound=!0)}).finally(()=>{this.loading=!1})},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);const o=(e=window.history.state)==null?void 0:e.back;o?this.$router.push(o):this.$router.push({name:"all_feeds"})}catch(t){this.$handleError(t)}},checkCommentScroll(){this.$route.query.comment_id?setTimeout(()=>{const e=document.getElementById("comment_"+this.$route.query.comment_id);e?(e.classList.add("fcom_highlight_comment"),e.style.scrollMarginTop="100px",e.scrollIntoView({behavior:"instant"})):this.$eventBus.emit("toTop",0)},100):this.$eventBus.emit("toTop",0)}},mounted(){window.__showing_feed&&window.__showing_feed.slug==this.feed_slug?(this.feed=window.__showing_feed,window.__showing_feed=null,this.$nextTick(()=>{this.changeFeedTitle(),this.checkCommentScroll()}),this.$eventBus.emit("feed_interaction",this.feed.id)):this.getFeed()}},_2={key:0,class:"fcom_feed_report_wrap"},m2={class:"fcom_feed_report_content"},h2={key:1,class:"feed_outer"},f2={key:3,class:"error-container"},p2={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},g2={class:"error-title"},y2={class:"error-message"},v2={class:"error-explanation"},b2={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},k2={class:"error-actions"},w2=["href"];function C2(e,t,o,u,s,n){const m=g("Feed"),f=Y;return i(),c("div",null,[s.feed&&s.feed.status=="unpublished"?(i(),c("div",_2,[l("div",m2,[l("span",null,d(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),s.feed?(i(),c("div",h2,[a(m,{is_single:!0,is_route:!0,show_report:!0,feed:s.feed,onReload:n.getFeed,onRemoved:n.getFeed,onDeleted:n.handleDelete},null,8,["feed","onReload","onRemoved","onDeleted"])])):s.loading?(i(),v(f,{key:2,rows:5,animated:!0,class:"white_loaded"})):s.notFound?(i(),c("div",f2,[l("div",p2,[l("h1",g2,d(e.$t("Post Not Found")),1),l("p",y2,d(e.$t("Sorry, the requested post could not be found.")),1),l("p",v2,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",k2,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},d(e.$t("Back to home")),9,w2)])])])):_("",!0)])}const ys=I(u2,[["render",C2]]),$2={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:je},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})}},S2={key:0,class:"object_header space_header"},V2={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function L2(e,t,o,u,s,n){const m=x,f=g("image-uploader"),h=J("loading");return n.profile.cover_photo?G((i(),c("div",S2,[l("div",{style:le({backgroundImage:"url("+n.profile.cover_photo+")"}),class:"object_cover"},[n.isMod?(i(),c("div",V2,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:n.handleCoverPhotoUpload},{default:r(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(n.removeCoverPhoto,["prevent"])},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])])):_("",!0)],4)])),[[h,s.updating]]):_("",!0)}const M2=I($2,[["render",L2]]),F2={name:"SpaceMenuItems",props:["space","profile"]},T2={"aria-label":"Space menu"},P2={class:"fcom_space_menu_ul"},I2=["innerHTML"],U2=["href","target","innerHTML"],E2={key:1};function B2(e,t,o,u,s,n){var f,h;const m=g("router-link");return i(),c("nav",T2,[l("ul",P2,[(h=(f=o.profile)==null?void 0:f.header_links)!=null&&h.length?(i(!0),c(M,{key:0},R(o.profile.header_links,y=>(i(),c("li",null,[y.route?(i(),v(m,{key:0,to:y.route},{default:r(()=>[l("span",{innerHTML:y.title},null,8,I2)]),_:2},1032,["to"])):(i(),c("a",{key:1,class:H(y.css_class??""),href:y.url,target:y.is_external?"_blank":"_self",innerHTML:y.title},null,10,U2))]))),256)):_("",!0),e.isMobile?(i(),c("li",E2,[a(m,{to:{name:"space_about"}},{default:r(()=>[V(d(e.$t("About")),1)]),_:1})])):_("",!0)])])}const A2=I(F2,[["render",B2]]),D2={name:"ImagePlaceholder"},R2={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H2(e,t,o,u,s,n){return i(),c("svg",R2,[...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 xt=I(D2,[["render",H2]]),x2={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:xt},props:{field:{type:Object,required:!0},space_id:{type:[String,Number],required:!0}},data(){return{loading:!1,editTab:"paywall",availablePaywalls:[]}},methods:{initAddPaywall(){this.field.paywalls=this.field.paywalls||[],this.field.paywalls.push("")},removePaywall(e){const t=this.field.paywalls||[];t.splice(t.indexOf(e),1),this.field.paywalls=t},isPaywallAdded(e){var t;return(t=this.field.paywalls)==null?void 0:t.includes(e.toString())},getAvailablePaywalls(){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.getAvailablePaywalls()}},O2={key:0,class:"fcom_paywalls"},j2={class:"fcom_paywall"},N2={class:"fcom_select_photo",style:{float:"left"}},z2=["src"],q2={key:0,class:"fcom_description"},G2={class:"fcom_paywall_actions"},Y2={class:"fcom_color_input_wrap"},W2={class:"fcom_color_input_wrap"},Z2={class:"fcom_color_input_wrap"},K2={class:"fcom_color_input_wrap"};function J2(e,t,o,u,s,n){const m=g("image-placeholder"),f=ee,h=vt,y=te,w=g("Delete"),b=j,C=x,p=Y,k=wt,$=X,S=de,T=pe,F=ue,B=kt,L=Ct;return i(),v(L,{modelValue:s.editTab,"onUpdate:modelValue":t[12]||(t[12]=D=>s.editTab=D)},{default:r(()=>[a(k,{label:e.$t("Paywalls"),name:"paywall"},{default:r(()=>[s.loading?(i(),v(p,{key:1,rows:2,animated:""})):(i(),c("div",O2,[(i(!0),c(M,null,R(o.field.paywalls,(D,A)=>(i(),c("div",j2,[a(y,{modelValue:o.field.paywalls[A],"onUpdate:modelValue":U=>o.field.paywalls[A]=U,placeholder:e.$t("Select Paywall")},{default:r(()=>[(i(!0),c(M,null,R(s.availablePaywalls,U=>(i(),v(h,{key:U.ID,label:U.post_title},{default:r(()=>[(i(!0),c(M,null,R(U.variants,P=>(i(),v(f,{key:P.id,value:P.id.toString(),label:P.variation_title,disabled:n.isPaywallAdded(P.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",N2,[P.photo?(i(),c("img",{key:0,src:P.photo},null,8,z2)):(i(),v(m,{key:1})),l("span",null,d(P.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),a(b,{onClick:U=>n.removePaywall(D)},{default:r(()=>[a(w)]),_:1},8,["onClick"])]))),256)),!o.field.paywalls||Object.keys(o.field.paywalls).length<1?(i(),c("div",q2,[l("p",null,d(e.$t("Please add paywall pricing options")),1)])):_("",!0),l("div",G2,[a(C,{style:{width:"100%"},class:"fcom_plain_button",onClick:n.initAddPaywall},{default:r(()=>[l("span",null,d("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),a(k,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(F,{onSubmit:t[2]||(t[2]=z(D=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(S,{label:e.$t("Button Label")},{default:r(()=>[a($,{modelValue:o.field.button_text,"onUpdate:modelValue":t[0]||(t[0]=D=>o.field.button_text=D),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(S,null,{default:r(()=>[a(T,{modelValue:o.field.show_description,"onUpdate:modelValue":t[1]||(t[1]=D=>o.field.show_description=D),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),a(k,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(F,{onSubmit:t[11]||(t[11]=z(D=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(S,{label:e.$t("Background Color")},{default:r(()=>[l("div",Y2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.background_color,"onUpdate:modelValue":t[3]||(t[3]=D=>o.field.background_color=D)},null,8,["predefine","modelValue"]),a($,{modelValue:o.field.background_color,"onUpdate:modelValue":t[4]||(t[4]=D=>o.field.background_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(S,{label:e.$t("Text Color")},{default:r(()=>[l("div",W2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.text_color,"onUpdate:modelValue":t[5]||(t[5]=D=>o.field.text_color=D)},null,8,["predefine","modelValue"]),a($,{modelValue:o.field.text_color,"onUpdate:modelValue":t[6]||(t[6]=D=>o.field.text_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(S,{label:e.$t("Button Label")},{default:r(()=>[l("div",Z2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.button_text_color,"onUpdate:modelValue":t[7]||(t[7]=D=>o.field.button_text_color=D)},null,8,["predefine","modelValue"]),a($,{modelValue:o.field.button_text_color,"onUpdate:modelValue":t[8]||(t[8]=D=>o.field.button_text_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(S,{label:e.$t("Button Background")},{default:r(()=>[l("div",K2,[a(B,{predefine:e.appVars.suggestedColors,modelValue:o.field.button_color,"onUpdate:modelValue":t[9]||(t[9]=D=>o.field.button_color=D),"show-alpha":""},null,8,["predefine","modelValue"]),a($,{modelValue:o.field.button_color,"onUpdate:modelValue":t[10]||(t[10]=D=>o.field.button_color=D)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const Q2=I(x2,[["render",J2]]),X2={name:"LockscreenMeta",components:{BgImageUpload:ro,LockscreenPaywallMeta:Q2},props:["lockscreen","space_id"],emits:["editField","updatePaywalls"],data(){return{loading:!1,editing:!1,editTab:"content",editingField:null,availablePaywalls:[]}},computed:{lockscreenFields(){return this.lockscreen},getFieldIcon(){return e=>{const t={image:"Picture",block:"Tickets",lesson:"Memo",paywall:"Money",welcome_banner:"VideoPlay"};return e.name=="action"?"Iphone":t[e.type]}}},methods:{toggleHidden(e){e.hidden=!e.hidden,e.type=="paywall"&&!e.hidden&&this.updateField(e)},updateField(e){this.editing=!0,this.editingField=e;const t=e.type=="block"?e:null;this.$emit("editField",t)},backToFields(){this.editing=!1,this.editingField=null,this.$emit("editField",null)},moveUp(e){if(e==0)return;const t=this.lockscreen[e],o=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,t,o)},moveDown(e){if(e==this.lockscreen.length-1)return;const t=this.lockscreen[e],o=this.lockscreen[e+1];this.lockscreen.splice(e,2,o,t)}}},eb={key:0,class:"fcom_lockscreen_meta"},tb={class:"fcom_meta_section lockscreen_meta"},sb={class:"fcom_description"},ob={class:"fcom_meta_section lockscreen_meta"},ib={class:"fcom_meta_label"},nb={class:"fcom_meta_content"},lb={class:"fcom_meta_block"},ab={class:"fcom_block_label"},rb={class:"fcom_meta_sorting"},cb={class:"fcom_block_action"},db={key:1,class:"fcom_lockscreen_meta"},ub={class:"fcom_edit_title"},_b={class:"fcom_edit_content"},mb={class:"fcom_color_input_wrap"},hb={class:"fcom_color_input_wrap"},fb={class:"fcom_color_input_wrap"},pb={class:"fcom_color_input_wrap"},gb={class:"fcom_color_input_wrap"},yb={key:1,class:"fcom_description"},vb={key:2,class:"fcom_description"},bb={key:3,class:"fcom_description"};function kb(e,t,o,u,s,n){const m=j,f=g("Top"),h=g("Bottom"),y=g("EditPen"),w=g("Hide"),b=g("View"),C=g("Back"),p=X,k=de,$=pe,S=ue,T=wt,F=g("BgImageUpload"),B=kt,L=Ct,D=g("lockscreen-paywall-meta");return s.editing?(i(),c("div",db,[l("div",ub,[a(m,{onClick:n.backToFields},{default:r(()=>[a(C)]),_:1},8,["onClick"]),l("p",null,d(e.$labelize(s.editingField.label)),1)]),l("div",_b,[s.editingField.type=="image"?(i(),v(L,{key:0,modelValue:s.editTab,"onUpdate:modelValue":t[18]||(t[18]=A=>s.editTab=A)},{default:r(()=>[a(T,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(S,{onSubmit:t[5]||(t[5]=z(A=>e.doNothing(),["prevent"])),model:s.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(k,{label:e.$t("Heading")},{default:r(()=>[a(p,{modelValue:s.editingField.heading,"onUpdate:modelValue":t[0]||(t[0]=A=>s.editingField.heading=A),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Description")},{default:r(()=>[a(p,{modelValue:s.editingField.description,"onUpdate:modelValue":t[1]||(t[1]=A=>s.editingField.description=A),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Button Label")},{default:r(()=>[a(p,{modelValue:s.editingField.button_text,"onUpdate:modelValue":t[2]||(t[2]=A=>s.editingField.button_text=A),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(k,{label:e.$t("Button Link")},{default:r(()=>[a(p,{modelValue:s.editingField.button_link,"onUpdate:modelValue":t[3]||(t[3]=A=>s.editingField.button_link=A)},null,8,["modelValue"])]),_:1},8,["label"]),s.editingField.type=="image"?(i(),v(k,{key:0},{default:r(()=>[a($,{modelValue:s.editingField.new_tab,"onUpdate:modelValue":t[4]||(t[4]=A=>s.editingField.new_tab=A),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Open in New Tab")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)]),_:1},8,["model"])]),_:1},8,["label"]),a(T,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(S,{onSubmit:t[17]||(t[17]=z(A=>e.doNothing(),["prevent"])),model:s.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(k,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:r(()=>[a(F,{modelValue:s.editingField.background_image,"onUpdate:modelValue":t[6]||(t[6]=A=>s.editingField.background_image=A),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),a(k,{label:e.$t("Overlay Color")},{default:r(()=>[l("div",mb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.overlay_color,"onUpdate:modelValue":t[7]||(t[7]=A=>s.editingField.overlay_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.overlay_color,"onUpdate:modelValue":t[8]||(t[8]=A=>s.editingField.overlay_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Heading Color")},{default:r(()=>[l("div",hb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.heading_color,"onUpdate:modelValue":t[9]||(t[9]=A=>s.editingField.heading_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.heading_color,"onUpdate:modelValue":t[10]||(t[10]=A=>s.editingField.heading_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Text Color")},{default:r(()=>[l("div",fb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.text_color,"onUpdate:modelValue":t[11]||(t[11]=A=>s.editingField.text_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.text_color,"onUpdate:modelValue":t[12]||(t[12]=A=>s.editingField.text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Button Label")},{default:r(()=>[l("div",pb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.button_text_color,"onUpdate:modelValue":t[13]||(t[13]=A=>s.editingField.button_text_color=A)},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.button_text_color,"onUpdate:modelValue":t[14]||(t[14]=A=>s.editingField.button_text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a(k,{label:e.$t("Button Background")},{default:r(()=>[l("div",gb,[a(B,{predefine:e.appVars.suggestedColors,modelValue:s.editingField.button_color,"onUpdate:modelValue":t[15]||(t[15]=A=>s.editingField.button_color=A),"show-alpha":""},null,8,["predefine","modelValue"]),a(p,{modelValue:s.editingField.button_color,"onUpdate:modelValue":t[16]||(t[16]=A=>s.editingField.button_color=A)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):s.editingField.type=="block"?(i(),c("div",yb,d(e.$t("Edit the field from block editor ")),1)):s.editingField.type=="lesson"?(i(),c("div",vb,d(e.$t("Edit lessons from lesson editor ")),1)):s.editingField.type=="welcome_banner"?(i(),c("div",bb,d(e.$t("__COURSE_BANNER_SOURCE_DESC")),1)):s.editingField.type=="paywall"?(i(),v(D,{key:4,field:s.editingField,space_id:o.space_id},null,8,["field","space_id"])):_("",!0)])])):(i(),c("div",eb,[l("div",tb,[l("div",sb,[l("p",null,d(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),l("div",ob,[l("div",ib,d(e.$t("Page Blocks")),1),l("div",nb,[l("ul",lb,[(i(!0),c(M,null,R(n.lockscreenFields,(A,U)=>(i(),c("li",{class:H(["fcom_block_list",{block_hidden:A.hidden}])},[l("div",ab,[a(m,{class:"fcom_el_icon"},{default:r(()=>[(i(),v(Wt(n.getFieldIcon(A))))]),_:2},1024),l("p",null,d(e.$labelize(A.label)),1)]),l("div",rb,[a(m,{onClick:P=>n.moveUp(U)},{default:r(()=>[a(f)]),_:1},8,["onClick"]),a(m,{onClick:P=>n.moveDown(U)},{default:r(()=>[a(h)]),_:1},8,["onClick"])]),l("div",cb,[a(m,{onClick:P=>n.updateField(A)},{default:r(()=>[a(y)]),_:1},8,["onClick"]),A.hidden?(i(),v(m,{key:0,onClick:P=>n.toggleHidden(A)},{default:r(()=>[a(w)]),_:1},8,["onClick"])):(i(),v(m,{key:1,onClick:P=>n.toggleHidden(A)},{default:r(()=>[a(b)]),_:1},8,["onClick"]))])],2))),256))])])])]))}const wb=I(X2,[["render",kb]]),Cb={name:"BlockEditor",emits:["update:modelValue"],props:{modelValue:{type:String,required:!1}},data(){return{loading:!0,has_error:!1,all_loaded:!1,html:this.modelValue}},methods:{attach(){const e=this.$refs.block_editor;this.loading=!1,this.all_loaded=!0,window.wp.attachEditor(e,{iso:{toolbar:{undo:!0,navigation:!0,documentInspector:null},blocks:{allowBlocks:["core/button","core/buttons","core/code","core/column","core/columns","core/embed","core/group","core/heading","core/image","core/list","core/list-item","core/missing","core/paragraph","core/preformatted","core/pullquote","core/quote","core/separator","core/spacer","core/table","core/verse","core/html"]},__experimentalOnChange:function(t){console.log(t)},sidebar:{inserter:!1,inspector:!0}},editor:{__experimentalOnChange:function(t){console.log(t)},__experimentalOnInput(t){console.log(t)},__experimentalOnSelection(t){console.log(t)},onSaveContent:function(t){console.log(t)}}}),e.addEventListener("change",t=>{this.html=t.target.value,this.$emit("update:modelValue",t.target.value)})},loadScript(e){return new Promise((t,o)=>{const u=document.createElement("script");u.src=e,u.onload=t,u.onerror=o,document.head.append(u)})},async loadScripts(){const e=this.appVars.block_editor_assets.scripts;for(const t in e)try{await this.loadScript(e[t]),console.log(`${t} JS loaded`)}catch(o){this.has_error=!0,console.error(`Failed to load js ${t}:`,o)}this.attach()},loadCSSFile(e){return new Promise((t,o)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=e,u.onload=t,u.onerror=o,document.head.append(u)})},async loadCSSFiles(){const t=this.appVars.block_editor_assets.styles.map(this.loadCSSFile);try{await Promise.all(t),console.log("All CSS files loaded")}catch(o){console.error("Failed to load some CSS files:",o)}}},mounted(){window.fl_block_editor_loaded?this.attach():(this.loadCSSFiles(),this.loadScripts(),window.fl_block_editor_loaded=!0)},beforeUnmount(){window.wp.detachEditor(this.$refs.block_editor)}},$b={class:"fcom_block_editor"};function Sb(e,t,o,u,s,n){const m=Y;return i(),c("div",$b,[G(l("div",null,[l("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"}," "+d(s.html)+` |
| 4 |
`,513)],512),[[yt,s.all_loaded]]),s.all_loaded?_("",!0):(i(),v(m,{key:0,class:"white_loaded",rows:7,animated:!0}))])}const Vb=I(Cb,[["render",Sb]]);const Lb={name:"FullEditorFrame",emits:["update:modelValue","titleUpdated","featuredMediaUpdated","metaUpdated","manageDocuments","useAlternateEditor"],props:{editorPath:{type:String,default:"/editor"},modelValue:{type:String,default:""},editorParams:{type:Object,default:()=>({})},frameHeight:{type:String,default:"500px"},documentTitle:{type:String,default:""},featured_image_id:{type:[String,Number],default:""},metaSettings:{type:Object,default:()=>null}},data(){return{editorData:{content:""},editorFrame:null,editorOrigin:null,lastUpdate:"No updates yet",dataSent:!1,isFailing:!1}},computed:{notLoading(){return!this.dataSent&&this.isFailing}},mounted(){setTimeout(()=>{this.isFailing=!0},1e4),this.editorData.content=this.modelValue,this.editorData.title=this.documentTitle,this.editorData.featured_image_id=this.featured_image_id,this.metaSettings&&(this.editorData.metaSettings=this.metaSettings),this.createEditorIframe(),window.addEventListener("message",this.handleEditorMessage)},beforeUnmount(){window.removeEventListener("message",this.handleEditorMessage),this.editorFrame&&(this.editorFrame.onload=null,this.$refs.iframeContainer.removeChild(this.editorFrame),this.editorFrame=null)},methods:{createEditorIframe(){const e=new URL(this.editorPath,window.location.origin);this.editorOrigin=e.origin,this.editorFrame=document.createElement("iframe");let t=this.appVars.wp_lesson_editor_frame;if(this.editorParams){const o=new URLSearchParams(this.editorParams);t+="&"+o.toString()}this.editorFrame.src=t,this.editorFrame.style.width="100%",this.editorFrame.style.height=this.frameHeight,this.$refs.iframeContainer.appendChild(this.editorFrame)},editorFailed(){this.$emit("useAlternateEditor")},sendDataToEditor(){if(this.editorFrame&&this.editorFrame.contentWindow){const e=JSON.parse(JSON.stringify(this.editorData));this.editorFrame.contentWindow.postMessage({type:"UPDATE_EDITOR",data:e},"*"),this.dataSent=!0}else alert("Editor frame is not loaded or contentWindow is not accessible.")},syncMetaToEditor(e){this.editorFrame&&this.editorFrame.contentWindow&&this.editorFrame.contentWindow.postMessage({type:"SYNC_META",data:JSON.parse(JSON.stringify(e))},"*")},handleEditorMessage(e){const{action:t,content:o}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorData.content=o,this.$emit("update:modelValue",o)):t==="TITLE_UPDATED"?(this.editorData.title=o,this.$emit("titleUpdated",o)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",o):t==="META_UPDATED"?this.$emit("metaUpdated",o):t==="MANAGE_DOCUMENTS"?this.$emit("manageDocuments"):t==="EDITOR_READY"&&(console.log("EDITOR_READY"),this.sendDataToEditor())}}},Mb={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},Fb=["element-loading-text"],Tb={ref:"iframeContainer",class:"iframe-container"};function Pb(e,t,o,u,s,n){const m=x,f=Y,h=J("loading");return i(),c(M,null,[n.notLoading?(i(),c("div",Mb,[l("p",null,d(e.$t("Problem with loading the editor?")),1),a(m,{onClick:t[0]||(t[0]=y=>n.editorFailed())},{default:r(()=>[V(d(e.$t("Use Alternative Editor")),1)]),_:1})])):_("",!0),G((i(),c("div",{"element-loading-text":e.$t("Loading editor. Please wait...."),class:"editor-container"},[s.dataSent?_("",!0):(i(),v(f,{key:0,style:{margin:"50px"},animated:!0,rows:2})),l("div",Tb,null,512)],8,Fb)),[[h,!s.dataSent]])],64)}const Ib=I(Lb,[["render",Pb],["__scopeId","data-v-ba29dde7"]]),Ub={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},Eb=["fill"];function Bb(e,t,o,u,s,n){return i(),c("svg",{fill:o.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,Eb)}const _s=I(Ub,[["render",Bb]]),Ab={name:"LessonIcon"},Db={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Rb(e,t,o,u,s,n){return i(),c("svg",Db,[...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 uo=I(Ab,[["render",Rb]]),Hb={name:"PlayIcon"},xb={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ob(e,t,o,u,s,n){return i(),c("svg",xb,[...t[0]||(t[0]=[Pe('<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 _o=I(Hb,[["render",Ob]]),jb={name:"PlayPlaceholderIcon"},Nb={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function zb(e,t,o,u,s,n){return i(),c("svg",Nb,[...t[0]||(t[0]=[Pe('<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 mo=I(jb,[["render",zb]]),qb={name:"_LockscreenLessonEditor",components:{CircleIcon:_s,LessonIcon:uo,PlayIcon:_o,PlayPlaceholderIcon:mo},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((o,u)=>o+(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 o;const t=(o=e.meta)==null?void 0:o.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,o;return this.isEnabledMedia(e)&&((o=(t=e.meta)==null?void 0:t.media)==null?void 0:o.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),o=Math.floor(e%3600/60),u=e%60,s="";return t>0&&(s+=this.$t("%dh ",t)),o>0&&(s+=this.$t("%dm ",o)),u>0&&(s+=this.$t("%ds",u)),s.trim()||null}}},Gb={class:"fcom_course_sections"},Yb={class:"fcom_course_intro"},Wb={class:"fcom_course_labels"},Zb={class:"fcom_course_info"},Kb={class:"fcom_card_sections"},Jb={class:"fcom_section_items"},Qb=["onClick"],Xb={class:"fcom_section_primary_item_title"},ek={class:"title_line_container"},tk={class:"title_line"},sk={class:"fcom_meta_text"},ok={key:0,class:"fcom_meta_text"},ik={class:"fcom_section_primary_item_actions"},nk=["onClick"],lk={class:"fcom_heading_item clickable"},ak={class:"lesson_feature_media"},rk=["src","alt"],ck=["src","alt"],dk={class:"lesson_title"},uk=["innerHTML"],_k={class:"lesson_duration"},mk={key:0},hk={key:1},fk=["innerHTML"];function pk(e,t,o,u,s,n){const m=g("ArrowRight"),f=g("ArrowDown"),h=j,y=g("CircleIcon"),w=g("Lock"),b=g("PlayPlaceholderIcon"),C=g("LessonIcon"),p=g("PlayIcon");return i(),c("div",Gb,[l("div",Yb,[l("div",Wb,[l("h3",null,d(e.$t("Course Content")),1),l("p",Zb,[V(d(e.$_n("%s Topic","%s Topics",n.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),V(" "+d(e.$_n("%s Lesson","%s Lessons",n.lessonsCount)),1)])])]),l("div",Kb,[l("div",Jb,[(i(!0),c(M,null,R(o.sections,k=>(i(),c("div",{key:k.id,class:"fcom_section_primary"},[k.lessons.length?(i(),c("div",{key:0,onClick:$=>k.is_closed=!k.is_closed,class:H(["clickable fcom_section_primary_item",{is_closed:k.is_closed}])},[l("div",Xb,[l("div",ek,[l("div",tk,[l("h4",null,d(k.title),1)]),l("span",sk,d(e.$t("%d lessons",k.lessons.length)),1),n.lessonDuration(k)?(i(),c("span",ok," • "+d(n.lessonDuration(k)),1)):_("",!0)])]),l("div",ik,[a(h,{class:"clickable"},{default:r(()=>[k.is_closed?(i(),v(m,{key:0,class:"fcom_arrow_icon"})):(i(),v(f,{key:1}))]),_:2},1024)])],10,Qb)):_("",!0),k.is_closed?_("",!0):(i(!0),c(M,{key:1},R(k.lessons,$=>(i(),c("div",{key:$.id,class:H(["fcom_section_item",{is_locked:!n.isFreePreview($)}])},[l("div",{onClick:S=>n.maybeGotoLesson($,k),class:"fcom_section_item_title"},[l("p",lk,[a(h,null,{default:r(()=>[n.isFreePreview($)?(i(),v(y,{key:0})):(i(),v(w,{key:1}))]),_:2},1024),n.isModernLayout?(i(),c(M,{key:0},[l("span",ak,[$.featured_image?(i(),c("img",{key:0,src:$.featured_image,alt:$.title},null,8,rk)):n.hasMediaImage($)?(i(),c("img",{key:1,src:$.meta.media.image,alt:$.title},null,8,ck)):n.hasMediaVideo($)?(i(),v(b,{key:2})):(i(),v(C,{key:3})),n.showPlayIcon($)?(i(),v(p,{key:4,class:"play_icon"})):_("",!0)]),l("span",dk,[l("span",{innerHTML:$.title},null,8,uk),l("span",_k,[$.meta.video_length?(i(),c("span",mk,d(n.formatSeconds($.meta.video_length)),1)):(i(),c("span",hk,d("---")))])])],64)):(i(),c("span",{key:1,innerHTML:$.title},null,8,fk))])],8,nk)],2))),128))]))),128))])])])}const ho=I(qb,[["render",pk]]),gk={name:"LockscreenPaywallView",components:{ImagePlaceholder:xt},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 o=t.variants.find(u=>String(u.id)===String(e));if(o)return{...o,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()}},yk={class:"fcom_paywall_cards"},vk={class:"paywall_header"},bk={class:"paywall_body"},kk=["innerHTML"],wk={key:0,class:"subscription"},Ck={class:"paywall_footer"},$k={key:0,class:"fcom_mb_10"},Sk=["href"];function Vk(e,t,o,u,s,n){const m=Y,f=Jt,h=g("ImagePlaceholder");return i(),c("div",yk,[s.loading?(i(),v(m,{key:0,rows:3,animated:!0})):(i(!0),c(M,{key:1},R(n.filteredPaywalls,y=>(i(),c("div",{key:y.id,class:"fcom_paywall",style:le(n.cardStyles)},[l("div",vk,[y.photo?(i(),v(f,{key:0,src:y.photo},null,8,["src"])):(i(),v(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(y.variation_title),1)]),l("div",bk,[l("span",{innerHTML:y.total_price},null,8,kk),n.isSubscriptionPaywall(y)?(i(),c("span",wk," / "+d(n.getRepeatInterval(y)),1)):_("",!0)]),l("div",Ck,[o.field.show_description=="yes"&&(y!=null&&y.description)?(i(),c("span",$k,d(y.description),1)):_("",!0),o.editable?G((i(),c("input",{key:1,class:"el-button fcom_primary_button link_button",style:le(n.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=w=>o.field.button_text=w)},null,4)),[[Vo,o.field.button_text]]):(i(),c("a",{key:2,class:"el-button fcom_primary_button link_button",style:le(n.buttonStyles),href:y.checkout_url},d(o.field.button_text),13,Sk))])],4))),128))])}const fo=I(gk,[["render",Vk]]),Lk={name:"LockScreenEditor",props:["title","lockscreen","sections","saving","loading","space_id","settings"],emits:["save","close"],components:{LockscreenLessonEditor:ho,MediaEmbeder:ns,BlockEditor:Vb,LockscreenMeta:wb,LockscreenPaywallView:fo,FullEditorFrame:Ib},data(){return{editingField:null,useClassic:!1}},computed:{lockscreenFields(){return this.lockscreen.filter(e=>!e.hidden)},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})}},methods:{updateHeading(e,t){t.heading=e.target.innerText},updateDescription(e,t){t.description=e.target.innerText},updateButtonLabel(e,t){t.button_text=e.target.innerText},visibleBlock(e){this.editingField=e},updateEditField(e){this.editingField=e,(e==null?void 0:e.type)==="block"&&setTimeout(()=>{const t=document.getElementById("fcomBlockContent");t&&t.scrollIntoView({behavior:"smooth"})},300)},saveChanges(){this.editingField=null,this.$emit("save")},switchToClassic(){this.useClassic=!0}}},Mk={class:"fcom_editor_topbar"},Fk={class:"fcom_editor_content"},Tk={class:"fcom_item"},Pk={class:"fcom_content"},Ik=["onBlur"],Uk=["onBlur"],Ek=["onBlur"],Bk={key:1,class:"fcom_content_wrap"},Ak={id:"fcomBlockContent"},Dk={key:2,class:"fcom_content_wrap"},Rk={key:1,class:"fcom_description"},Hk={key:3,class:"fcom_content_wrap"},xk={key:4,class:"fcom_paywall_wrap"};function Ok(e,t,o,u,s,n){const m=g("lockscreen-meta"),f=Qe,h=g("Lock"),y=j,w=g("block-editor"),b=g("FullEditorFrame"),C=g("welcome-banner"),p=g("lockscreen-lesson-editor"),k=Y,$=g("lockscreen-paywall-view"),S=ke,T=Me;return i(),c(M,null,[a(f,{class:"fcom_full_editor_side lockscreen_editor",width:"250px"},{default:r(()=>[q(e.$slots,"before_meta"),a(m,{lockscreen:o.lockscreen,space_id:o.space_id,onEditField:n.updateEditField},null,8,["lockscreen","space_id","onEditField"])]),_:3}),a(T,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(S,null,{default:r(()=>[l("div",Mk,[a(y,null,{default:r(()=>[a(h)]),_:1}),l("h3",null,d(o.title),1)]),l("div",Fk,[(i(!0),c(M,null,R(n.lockscreenFields,F=>{var B;return i(),c("div",Tk,[F.type=="image"?(i(),c("div",{key:0,class:"fcom_image_wrap",style:le(n.imageStyles(F))},[l("div",Pk,[l("h2",{style:le(n.headingStyles(F)),contenteditable:"true",onBlur:L=>n.updateHeading(L,F)},d(F.heading),45,Ik),F.description?(i(),c("p",{key:0,style:le(n.descriptionStyles(F)),contenteditable:"true",onBlur:L=>n.updateDescription(L,F)},d(F.description),45,Uk)):_("",!0),F.button_text?(i(),c("button",{key:1,class:"fcom_btn",style:le(n.buttonStyles(F)),contenteditable:"true",onBlur:L=>n.updateButtonLabel(L,F)},d(F.button_text),45,Ek)):_("",!0)])],4)):_("",!0),F.type=="block"?(i(),c("div",Bk,[l("div",Ak,[s.useClassic?(i(),v(w,{key:0,modelValue:F.content,"onUpdate:modelValue":L=>F.content=L},null,8,["modelValue","onUpdate:modelValue"])):(i(),v(b,{key:1,ref_for:!0,ref:"fullEditorFrame",onUseAlternateEditor:n.switchToClassic,editorParams:{context:"lockscreen",space_id:o.space_id},frameHeight:"calc(100vh - 160px)",documentTitle:"",modelValue:F.content,"onUpdate:modelValue":L=>F.content=L},null,8,["onUseAlternateEditor","editorParams","modelValue","onUpdate:modelValue"]))])])):_("",!0),F.type=="welcome_banner"?(i(),c("div",Dk,[F.banner?(i(),v(C,{key:0,config:F.banner,"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config"])):(i(),c("div",Rk,d(e.$t("__COURSE_BANNER_EMPTY_DESC")),1))])):_("",!0),F.type=="lesson"?(i(),c("div",Hk,[o.loading?(i(),v(k,{key:1,rows:5,animated:!0})):(i(),v(p,{key:0,sections:o.sections,is_editor:!0,settings:o.settings},null,8,["sections","settings"]))])):_("",!0),F.type=="paywall"&&((B=F.paywalls)==null?void 0:B.length)>0?(i(),c("div",xk,[a($,{space_id:o.space_id,field:F,editable:!0},null,8,["space_id","field"])])):_("",!0)])}),256))])]),_:1})]),_:1})],64)}const jk=I(Lk,[["render",Ok]]),Nk={name:"SpaceLockscreen",props:["spaceProfile","savingCount"],emits:["close"],components:{LockScreenEditor:jk},data(){return{saving:!1,loading:!1,lockscreen:null}},watch:{savingCount(){this.saveChanges()}},methods:{saveChanges(){this.lockscreen&&(this.saving=!0,this.$put("spaces/"+this.spaceProfile.slug+"/lockscreens",{lockscreen:this.lockscreen}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1}))},getLockscreen(){this.loading=!0,this.$get("spaces/"+this.spaceProfile.slug+"/lockscreens").then(e=>{this.lockscreen=e.lockscreen}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.getLockscreen()}},zk={key:0,class:"fcom_lockscreen_meta"},qk={class:"fcom_description"},Gk={class:"white_loaded"};function Yk(e,t,o,u,s,n){const m=g("lock-screen-editor"),f=Y,h=Me;return s.lockscreen?(i(),v(m,{key:0,title:o.spaceProfile.title,space_id:o.spaceProfile.id,settings:o.spaceProfile.settings,lockscreen:s.lockscreen,saving:s.saving,loading:s.loading,onSave:n.saveChanges,onClose:t[0]||(t[0]=y=>e.$emit("close"))},{before_meta:r(()=>[o.spaceProfile.settings.custom_lock_screen!="yes"?(i(),c("div",zk,[l("div",qk,[l("p",null,d(e.$t("__LOCK_SCRREN_DESC")),1)])])):_("",!0)]),_:1},8,["title","space_id","settings","lockscreen","saving","loading","onSave"])):s.loading?(i(),v(h,{key:1,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[l("div",Gk,[a(f,{animated:!0,rows:10})])]),_:1})):_("",!0)}const Wk=I(Nk,[["render",Yk]]),Zk={name:"ManageSpaceLinks",components:{MenuGroupSettings:co},props:["spaceProfile","savingCount"],emits:["close"],data(){return{saving:!1}},watch:{savingCount(){this.saveMenuItems(!0)}},methods:{saveMenuItems(e=!1){this.saving=!0;let t="spaces/"+this.spaceProfile.slug+"/links";this.spaceProfile.type=="course"&&(t="admin/courses/"+this.spaceProfile.id+"/links"),this.$post(t,{links:this.spaceProfile.settings.links,space_id:this.spaceProfile.id}).then(o=>{this.$notify.success(o.message),this.spaceProfile.settings.links=o.links,e&&this.$emit("close")}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1})}}},Kk={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},Jk={class:"fcom_card_sections"};function Qk(e,t,o,u,s,n){const m=g("menu-group-settings"),f=ke,h=Me;return i(),v(h,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(f,null,{default:r(()=>[l("div",Kk,[l("div",Jk,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,onSave:t[0]||(t[0]=y=>n.saveMenuItems()),title:e.$t("Manage Links"),menuItems:o.spaceProfile.settings.links},null,8,["title","menuItems"])])])]),_:1})]),_:1})}const Xk=I(Zk,[["render",Qk]]),ew={name:"AddPaywallModal",props:{modelValue:{type:Boolean,default:!1},spaceProfile:{type:Object,required:!0}},emits:["update:modelValue","added"],data(){return{products:[],productID:null,saving:!1,creatingProduct:!1,fetchingProducts:!1,newPaywall:{title:"",price:0}}},computed:{addPaywallModal:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}}},methods:{isProductAdded(e){var t,o;return(o=(t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)==null?void 0:o.includes(e)},initCreateProduct(){this.productID=null,this.newPaywall={title:"",price:0}},createProduct(){var e,t;this.creatingProduct=!0,this.$post("cart/products/create",{title:(e=this.newPaywall)==null?void 0:e.title,price:(t=this.newPaywall)==null?void 0:t.price}).then(o=>{var u;this.products.push(o.product),this.productID=(u=o.product)==null?void 0:u.id,this.productID&&this.addPaywall()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.creatingProduct=!1})},searchProducts(e=""){e&&e.length<3||this.fetchProducts(e)},fetchProducts(e=""){this.fetchingProducts=!0,this.$get("cart/products/search",{search:e}).then(t=>{this.products=t.products}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingProducts=!1})},addPaywall(){this.saving=!0,this.$post("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.productID,space_id:this.spaceProfile.id}).then(e=>{var t;this.$notify.success(e.message),this.$emit("added",(t=e.paywall)==null?void 0:t.ID),this.addPaywallModal=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},mounted(){this.fetchProducts()}},tw={class:"fcom_topic_selector"},sw={class:"fcom_select_photo",style:{float:"left"}},ow=["src","alt"],iw=["innerHTML"];function nw(e,t,o,u,s,n){const m=ee,f=te,h=g("Plus"),y=j,w=x,b=X,C=de,p=ue,k=fe,$=bt,S=J("loading");return i(),v($,{"modal-class":"fcom_common_dialog",class:"fcom_high_drawer",size:e.drawerWidth,modelValue:n.addPaywallModal,"onUpdate:modelValue":t[6]||(t[6]=T=>n.addPaywallModal=T),"close-on-click-modal":!1,visible:n.addPaywallModal,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Paywall")),1)]),default:r(()=>[a(p,{onSubmit:t[5]||(t[5]=z(T=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(C,null,{default:r(()=>[l("div",tw,[G((i(),v(f,{style:{width:"100%"},modelValue:s.productID,"onUpdate:modelValue":t[0]||(t[0]=T=>s.productID=T),filterable:"",clearable:"",remote:"",loading:s.fetchingProducts,"remote-method":n.searchProducts,placeholder:e.$t("Search Product")},{default:r(()=>[(i(!0),c(M,null,R(s.products,T=>(i(),v(m,{key:T.id,label:T.title,value:T.id,disabled:n.isProductAdded(T.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",sw,[l("img",{src:T.image,alt:T.title},null,8,ow),l("span",null,d(T.title),1)]),l("span",{style:{float:"right",color:"#8492a6","font-size":"13px"},innerHTML:T.price},null,8,iw)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","loading","remote-method","placeholder"])),[[S,s.fetchingProducts]]),a(k,{ref:"creating_product_ref",onShow:n.initCreateProduct,placement:"bottom",width:400,trigger:"click"},{reference:r(()=>[a(w,{class:"fcom_secondary_button"},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1})]),default:r(()=>[a(p,{modelValue:s.newPaywall,"onUpdate:modelValue":t[4]||(t[4]=T=>s.newPaywall=T),"label-position":"top"},{default:r(()=>[a(C,{label:e.$t("Title")},{default:r(()=>[a(b,{modelValue:s.newPaywall.title,"onUpdate:modelValue":t[1]||(t[1]=T=>s.newPaywall.title=T),placeholder:e.$t("Title of the product")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Price")},{default:r(()=>[a(b,{modelValue:s.newPaywall.price,"onUpdate:modelValue":t[2]||(t[2]=T=>s.newPaywall.price=T),type:"number",placeholder:e.$t("Price of the product"),min:0},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:t[3]||(t[3]=T=>n.createProduct()),loading:s.creatingProduct,disabled:s.creatingProduct},{default:r(()=>[V(d(e.$t("Create")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["onShow"])])]),_:1}),a(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",loading:s.saving,onClick:n.addPaywall},{default:r(()=>[V(d(e.$t("Add")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["size","modelValue","visible"])}const lw=I(ew,[["render",nw]]),aw={name:"ManagePaywalls",components:{ImagePlaceholder:xt,AddPaywallModal:lw},props:["spaceProfile","savingCount"],emits:["close"],data(){return{paywalls:[],loading:!1,removing:!1,addPaywallModal:!1,removePaywallModal:!1,revokeAccess:!1,removePaywall:null,installing:!1,hasFluentCart:this.hasFeature("has_fluentcart")}},computed:{spaceType(){return this.spaceProfile.type=="course"?this.$t("courses"):this.$t("spaces")}},methods:{copyCheckoutUrl(e){this.$toClipboard(e,this.$t("Checkout URL copied to clipboard"))},initRemovePaywall(e){this.$nextTick(()=>{this.removePaywallModal=!0,this.removePaywall=e})},initAddPaywall(){this.$nextTick(()=>{this.addPaywallModal=!0})},resetPaywall(){var t;const e=((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[];e.splice(e.indexOf(this.removePaywall.ID),1),this.spaceProfile.settings.cart_product_ids=e,this.removePaywall=null,this.revokeAccess=!1,this.getPaywalls()},paywallAdded(e){var o;const t=((o=this.spaceProfile.settings)==null?void 0:o.cart_product_ids)||[];t.includes(e)||t.push(e),this.spaceProfile.settings.cart_product_ids=t,this.getPaywalls()},getPaywalls(){this.loading=!0,this.$get("cart/spaces/"+this.spaceProfile.id+"/paywalls",{space_id:this.spaceProfile.id}).then(e=>{this.paywalls=e.paywalls}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},deletePaywall(){this.removing=!0,this.$del("cart/spaces/"+this.spaceProfile.id+"/paywalls",{cart_product_id:this.removePaywall.ID,revoke_access:this.revokeAccess}).then(e=>{this.$notify.success(e.message),this.removePaywallModal=!1,this.resetPaywall()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.removing=!1})},installPlugin(){this.installing=!0,this.$post("settings/install_plugin",{plugin:"fluent-cart"}).then(e=>{e.is_installed?this.$notify.success(e.message):this.$handleError(this.$t("Sorry, FluentCart could not be installed")),this.hasFluentCart=!0,this.getPaywalls()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.installing=!1})}},mounted(){var t;(((t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)||[])&&this.hasFluentCart&&this.getPaywalls()}},rw={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},cw={class:"fcom_card_sections"},dw={class:"fcom_card_section_heading"},uw={class:"fcom_section_primary_item_title"},_w={class:"fcom_heading_item"},mw={key:0,class:"fcom_section_item_actions"},hw={class:"fcom_section_primary"},fw={class:"fcom_section_primary_item"},pw={class:"fcom_section_primary_item_title"},gw={class:"fcom_heading_item"},yw={class:"fcom_shape"},vw={class:"fcom_section_item_actions"},bw=["href"],kw=["href"],ww={class:"fcom_section_items"},Cw={class:"fcom_section_item_title"},$w={class:"fcom_heading_item"},Sw={class:"fcom_shape"},Vw={class:"fcom_section_item_actions"},Lw=["innerHTML"],Mw={key:2,style:{padding:"1rem"}},Fw={key:1,class:"fcom_section_item"},Tw={class:"fcom_section_primary"},Pw={class:"fcom_section_primary_item"},Iw=["disabled"],Uw={class:"dialog_header"},Ew={class:"dialog_left"},Bw={class:"dialog_body"},Aw={style:{"text-align":"center"}},Dw={class:"fcom_heading_item",style:{"justify-content":"center"}},Rw={class:"fcom_shape"},Hw={style:{margin:"1rem 0px 0.8rem"}},xw={class:"dialog_footer"};function Ow(e,t,o,u,s,n){const m=x,f=Y,h=Jt,y=g("MoreFilled"),w=j,b=Ze,C=Ke,p=Je,k=g("ImagePlaceholder"),$=ke,S=Me,T=g("AddPaywallModal"),F=pe,B=$e,L=J("loading");return i(),c(M,null,[a(S,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a($,null,{default:r(()=>[l("div",rw,[l("div",cw,[l("div",dw,[l("div",uw,[l("div",_w,[q(e.$slots,"title",{},()=>[l("h4",null,d(e.$t("Manage Paywalls")),1)])])]),s.hasFluentCart?(i(),c("div",mw,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=D=>n.initAddPaywall())},{default:r(()=>[V(d(e.$t("Add Paywall")),1)]),_:1})])):_("",!0)]),s.hasFluentCart?(i(),c(M,{key:0},[s.loading||s.removing?(i(),v(f,{key:0,class:"white_loaded",rows:5,animated:!0})):s.paywalls.length?(i(!0),c(M,{key:1},R(s.paywalls,D=>(i(),c("div",{class:"fcom_section_item",key:D.ID},[l("div",hw,[l("div",fw,[l("div",pw,[l("h4",gw,[l("span",yw,[a(h,{src:D==null?void 0:D.thumbnail},null,8,["src"])]),l("span",null,d((D==null?void 0:D.post_title)||""),1)])]),l("div",vw,[a(p,{trigger:"click","popper-class":"fcom_pop_action"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,null,{default:r(()=>[l("a",{href:D==null?void 0:D.view_url,target:"_blank",rel:"noopener"},d(e.$t("View Product")),9,bw)]),_:2},1024),a(b,null,{default:r(()=>[l("a",{href:D==null?void 0:D.admin_url,target:"_blank",rel:"noopener"},d(e.$t("Edit Product")),9,kw)]),_:2},1024),a(b,{type:"danger",onClick:A=>n.initRemovePaywall(D)},{default:r(()=>[V(d(e.$t("Delete Paywall")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:""},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]),l("div",ww,[(i(!0),c(M,null,R(D.variants,A=>(i(),c("div",{class:"fcom_section_item",key:A.id},[l("div",Cw,[l("div",$w,[l("span",Sw,[A.photo?(i(),v(h,{key:0,src:A.photo},null,8,["src"])):(i(),v(h,{key:1},{default:r(()=>[a(k)]),_:1}))]),l("span",null,d(A.variation_title),1)])]),l("div",Vw,[l("span",{class:"fcom_price",innerHTML:A.total_price},null,8,Lw),a(p,{trigger:"click"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:U=>n.copyCheckoutUrl(A.checkout_url)},{default:r(()=>[V(d(e.$t("Copy Checkout URL")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(m,{"aria-label":e.$t("View actions"),size:"small",class:"fcom_dot_menu",text:"",style:{padding:"0 6px"}},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]))),128))])])]))),128)):(i(),c("div",Mw,[l("p",null,d(e.$t("No paywall has been added yet")),1)]))],64)):(i(),c("div",Fw,[l("div",Tw,[l("div",Pw,[l("span",null,[V(d(e.$t("To monetize your ")+n.spaceType+", ")+" ",1),G((i(),c("a",{disabled:s.installing,onClick:t[1]||(t[1]=(...D)=>n.installPlugin&&n.installPlugin(...D)),class:"fcom_link"},[V(d(e.$t("click here")),1)],8,Iw)),[[L,s.installing]]),V(" "+d(e.$t("to install and activate FluentCart.")),1)])])])]))])])]),_:3})]),_:3}),s.addPaywallModal?(i(),v(T,{key:0,modelValue:s.addPaywallModal,"onUpdate:modelValue":t[2]||(t[2]=D=>s.addPaywallModal=D),spaceProfile:o.spaceProfile,onAdded:n.paywallAdded},null,8,["modelValue","spaceProfile","onAdded"])):_("",!0),a(B,{"modal-class":"fcom_common_dialog","close-on-click-modal":!1,"append-to-body":!0,width:e.drawerWidth,modelValue:s.removePaywallModal,"onUpdate:modelValue":t[5]||(t[5]=D=>s.removePaywallModal=D),direction:"rtl",onClose:t[6]||(t[6]=D=>s.removePaywallModal=!1)},{header:r(()=>[l("div",Uw,[l("div",Ew,[l("h4",null,d(e.$t("Delete Paywall")),1)])])]),footer:r(()=>[l("div",xw,[a(m,{class:"fcom_primary_button",disabled:s.removing,onClick:n.deletePaywall},{default:r(()=>[V(d(e.$t("Delete")),1)]),_:1},8,["disabled","onClick"]),a(m,{class:"fcom_secondary_button",onClick:t[4]||(t[4]=D=>s.removePaywallModal=!1)},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1})])]),default:r(()=>{var D,A;return[l("div",Bw,[l("div",Aw,[l("h4",Dw,[l("span",Rw,[a(h,{src:(D=s.removePaywall)==null?void 0:D.thumbnail},null,8,["src"])]),l("span",null,d((A=s.removePaywall)==null?void 0:A.post_title),1)]),l("p",Hw,d(e.$t("Are you sure you want to delete this paywall? This action cannot be undone.")),1),a(F,{modelValue:s.revokeAccess,"onUpdate:modelValue":t[3]||(t[3]=U=>s.revokeAccess=U),"true-value":"yes","false-value":"no"},{default:r(()=>[V(d(e.$t("Also remove the this space from the product integration?")),1)]),_:1},8,["modelValue"])])])]}),_:1},8,["width","modelValue"])],64)}const jw=I(aw,[["render",Ow]]),Nw={name:"SpaceCustomizer",props:["space_profile"],emits:["close","completed"],components:{SpaceLockscreen:Wk,CreateSpaceForm:Dt,ManageSpaceLinks:Xk,ManagePaywalls:jw},data(){return{saving:!1,currentTab:"general",savingCount:0,hasPro:window.fluentComAdmin.pro}},methods:{saveChanges(){if(!this.hasPro&&this.currentTab=="lock_screen"){this.$notify({title:this.$t("Pro Required"),message:this.$t("This feature is only available in the pro version."),type:"error"});return}this.savingCount=this.savingCount+1}},mounted(){this.$router.push({query:{...this.$route.query,customize_space:1}})},unmounted(){const e={...this.$route.query};delete e.customize_space,this.$router.push({query:e})}},zw={key:0,class:"fcom_full_editor"},qw={class:"fcom_full_editor_header fcom_space_settings_nav"},Gw={class:"fcom_editor_menu object_menu"},Yw={class:"fcom_space_menu_ul"},Ww={class:"full_editor_actions"},Zw={style:{"max-width":"800px",margin:"0 auto"},class:"fcom_full_editor_content"};function Kw(e,t,o,u,s,n){const m=g("ArrowLeft"),f=j,h=x,y=Ts,w=g("create-space-form"),b=ke,C=Me,p=g("space-lockscreen"),k=g("manage-space-links"),$=g("manage-paywalls"),S=xe;return o.space_profile?(i(),c("div",zw,[a(S,null,{default:r(()=>[a(y,{class:"fcom_full_editor_header_wrap"},{default:r(()=>{var T;return[l("div",qw,[l("div",{onClick:t[0]||(t[0]=F=>e.$emit("completed")),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),V(" "+d(o.space_profile.title),1)]),l("div",Gw,[l("ul",Yw,[l("li",{onClick:t[1]||(t[1]=F=>s.currentTab="general")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="general"}),href:"#"},d(e.$t("General Settings")),3)]),l("li",{onClick:t[2]||(t[2]=F=>s.currentTab="paywalls")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="paywalls"}),href:"#"},d(e.$t("Paywalls")),3)]),o.space_profile.privacy=="private"&&((T=o.space_profile.settings)==null?void 0:T.custom_lock_screen)=="yes"?(i(),c("li",{key:0,onClick:t[3]||(t[3]=F=>s.currentTab="lock_screen")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="lock_screen"}),href:"#"},d(e.$t("Lock Screen")),3)])):_("",!0),l("li",{onClick:t[4]||(t[4]=F=>s.currentTab="manage_links")},[l("a",{class:H({"router-link-exact-active":s.currentTab==="manage_links"}),href:"#"},d(e.$t("Space Links")),3)])])]),l("div",Ww,[a(h,{class:"fcom_primary_button",disabled:s.saving,loading:s.saving,onClick:n.saveChanges},{default:r(()=>[V(d(!s.hasPro&&s.currentTab=="lock_screen"?e.$t("Save Changes (Pro Required)"):e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{onClick:t[5]||(t[5]=F=>e.$emit("completed")),text:""},{default:r(()=>[...t[9]||(t[9]=[V(" X ",-1)])]),_:1})])])]}),_:1}),a(S,{class:"fcom_full_editor_container editor_customizer_container"},{default:r(()=>[s.currentTab=="general"?(i(),v(C,{key:0,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(b,null,{default:r(()=>[l("div",Zw,[a(w,{savingCount:s.savingCount,community:o.space_profile},null,8,["savingCount","community"])])]),_:1})]),_:1})):s.currentTab=="lock_screen"?(i(),v(p,{key:1,savingCount:s.savingCount,onClose:t[6]||(t[6]=T=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):s.currentTab=="manage_links"?(i(),v(k,{key:2,savingCount:s.savingCount,onClose:t[7]||(t[7]=T=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):s.currentTab=="paywalls"?(i(),v($,{key:3,savingCount:s.savingCount,onClose:t[8]||(t[8]=T=>e.$emit("close")),spaceProfile:o.space_profile},null,8,["savingCount","spaceProfile"])):_("",!0)]),_:1})]),_:1})])):_("",!0)}const Jw=I(Nw,[["render",Kw]]),Qw={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:je,SpaceMenuItems:A2,SpaceCustomizer:Jw},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:Zt(Te),customizeSpace:!1,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}},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)})},initEdit(){this.customizeSpace=!0},performSearch(){this.$eventBus.emit("doGlobalSearch",this.search_term)}},mounted(){this.$eventBus.on("doGlobalSearch",e=>{this.search_term=e}),this.$route.query.customize_space&&(this.customizeSpace=!0)}},Xw={class:"space_header"},e3={class:"object_menu"},t3={key:0,class:"menu_actions"},s3=["href"],o3={class:"actions_items"},i3={key:0};function n3(e,t,o,u,s,n){const m=g("space-menu-items"),f=x,h=g("MoreFilled"),y=j,w=fe,b=g("space-customizer"),C=J("loading");return i(),c(M,null,[G((i(),c("div",Xw,[l("div",e3,[a(m,{space:o.space,profile:n.profile,class:"fcom_desktop_only"},null,8,["space","profile"]),n.profile.id?(i(),c("div",t3,[e.auth.user_id?n.profile.membership?_("",!0):(i(),v(f,{key:1,disabled:s.joining,loading:s.joining,onClick:t[0]||(t[0]=p=>n.join()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},d(e.$t("Join")),9,s3)),n.showActions?(i(),v(w,{key:2,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(f,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[a(m,{space:o.space,profile:n.profile,class:"fcom_linked_menus fcom_sm_only"},null,8,["space","profile"]),l("ul",o3,[e.hasSpaceAdminAccess(n.profile)?(i(),c(M,{key:0},[l("li",{onClick:t[1]||(t[1]=()=>{n.initEdit(),e.$refs.space_actions.hide()})},d(e.$t("Space Settings")),1),t[6]||(t[6]=l("li",{class:"fcom_li_separator"},null,-1))],64)):_("",!0),n.profile.membership?(i(),c("li",{key:1,onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),n.leave()})},d(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(i(),c("li",{key:2,onClick:t[3]||(t[3]=(...p)=>n.initDeleteSpace&&n.initDeleteSpace(...p))},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[C,s.updating]]),s.customizeSpace&&o.space_profile?(i(),c("div",i3,[(i(),v(rt,{to:"body"},[a(b,{space_profile:o.space_profile,onClose:t[4]||(t[4]=p=>s.customizeSpace=null),onCompleted:t[5]||(t[5]=p=>{s.customizeSpace=!1,e.$emit("refetch")})},null,8,["space_profile"])]))])):_("",!0)],64)}const po=I(Qw,[["render",n3]]),l3={name:"AboutSpace",components:{RecentActivities:Ht},props:["space_profile","has_permission"],data(){return{privacies:Ks}}},a3={class:"fcom_main_side_wrap"},r3={role:"region","aria-label":"About Space",class:"app_side_widget widget_recent_activities"},c3={class:"widget_header"},d3={key:0,class:"widget_body"},u3=["innerHTML"],_3={class:"space_meta"},m3={class:"space_meta_item"},h3={class:"meta_label"},f3={class:"meta_desc"};function p3(e,t,o,u,s,n){var w,b,C;const m=g("Guide"),f=j,h=Y,y=g("recent-activities");return i(),c("div",a3,[l("div",r3,[l("div",c3,[l("h3",null,d(e.$t("About")),1)]),o.space_profile?(i(),c("div",d3,[l("div",{class:"space_description",innerHTML:o.space_profile.description_rendered},null,8,u3),l("div",_3,[l("div",m3,[l("div",h3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d((w=s.privacies[o.space_profile.privacy])==null?void 0:w.label),1)]),l("div",f3,d((b=s.privacies[o.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(i(),v(h,{key:1,animated:!0}))]),o.space_profile&&o.has_permission?(i(),v(y,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:(C=o.space_profile)==null?void 0:C.slug,space_id:o.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const go=I(l3,[["render",p3]]),g3={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:ho,LockscreenPaywallView:fo},computed:{lockscreenFields(){var e,t;return(t=(e=this.profile)==null?void 0:e.lockscreen_config.lockScreen)==null?void 0:t.filter(o=>!o.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})}}},y3={class:"fcom_custom_lockscreen"},v3={class:"fcom_lockscreen_content"},b3={class:"fcom_item"},k3={class:"fcom_content"},w3=["href","target"],C3={key:1,class:"fcom_content_wrap"},$3=["innerHTML"],S3={key:2,class:"fcom_content_wrap"},V3={key:3,class:"fcom_content_wrap"},L3={key:4,class:"fcom_paywall_wrap"};function M3(e,t,o,u,s,n){const m=g("welcome-banner"),f=g("lockscreen-lesson-editor"),h=g("lockscreen-paywall-view");return i(),c("div",y3,[l("div",v3,[(i(!0),c(M,null,R(n.lockscreenFields,y=>{var w;return i(),c("div",b3,[y.type=="image"?(i(),c("div",{key:0,class:"fcom_image_wrap",style:le(n.imageStyles(y))},[l("div",k3,[l("h2",{style:le(n.headingStyles(y))},d(y.heading),5),l("p",{style:le(n.descriptionStyles(y))},d(y.description),5),y.button_text?(i(),c("a",{key:0,class:"fcom_btn",href:n.buttonLink(y),style:le(n.buttonStyles(y)),target:y.new_tab=="yes"?"_blank":"_self"},d(y.button_text),13,w3)):_("",!0)])],4)):_("",!0),y.type=="block"&&y.content?(i(),c("div",C3,[l("div",{class:"fcom_custom_editor_html",innerHTML:y.content},null,8,$3)])):_("",!0),y.type=="welcome_banner"&&y.banner?(i(),c("div",S3,[a(m,{config:y.banner,"close-key":"fcom_course_welcome_banner_closed_"+o.profile.id+"_not_enrolled","wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])])):_("",!0),y.type=="lesson"?(i(),c("div",V3,[a(f,{sections:o.sections,settings:o.profile.settings},null,8,["sections","settings"])])):_("",!0),y.type=="paywall"&&((w=y.paywalls)==null?void 0:w.length)>0?(i(),c("div",L3,[a(h,{space_id:o.profile.id,field:y},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const yo=I(g3,[["render",M3]]),F3={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:xt},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()}},T3={class:"space_default_lock_box fcom_paywall_cards"},P3={class:"paywall_header"},I3={class:"paywall_body"},U3=["innerHTML"],E3={key:0,class:"subscription"},B3={class:"paywall_footer"},A3={key:0,class:"fcom_mb_10"},D3=["href"];function R3(e,t,o,u,s,n){const m=Y,f=Jt,h=g("ImagePlaceholder");return i(),c("div",T3,[s.loading?(i(),v(m,{key:0,rows:3,animated:!0})):(i(!0),c(M,{key:1},R(s.availablePaywalls,y=>(i(),c(M,{key:y.ID},[(i(!0),c(M,null,R(y.variants,w=>(i(),c("div",{key:w.id,class:"fcom_paywall"},[l("div",P3,[w.photo?(i(),v(f,{key:0,src:w.photo},null,8,["src"])):(i(),v(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(w.variation_title),1)]),l("div",I3,[l("span",{innerHTML:w.total_price},null,8,U3),n.isSubscriptionPaywall(w)?(i(),c("span",E3," / "+d(n.getRepeatInterval(w)),1)):_("",!0)]),l("div",B3,[w!=null&&w.description?(i(),c("span",A3,d(y.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:w.checkout_url},d(e.$t("Join Now")),9,D3)])]))),128))],64))),128))])}const vo=I(F3,[["render",R3]]),H3={name:"LockscreenView",components:{CustomLockscreenView:yo,DefaultLockscreenPaywall:vo},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)}},x3={key:0,style:{margin:"30px","text-align":"center"}},O3={key:0,class:"space_lock_box space_default_lock_box"},j3={class:"space_lock_box space_default_lock_box"},N3={class:"lock_desc"},z3=["href"],q3={key:0,class:"lock_desc"},G3={key:1,class:"lock_desc"},Y3=["href"],W3={key:2},Z3={key:2,class:"space_lock_box"},K3={class:"lock_desc"},J3=["href"];function Q3(e,t,o,u,s,n){var b,C;const m=g("Lock"),f=j,h=x,y=g("default-lockscreen-paywall"),w=g("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(i(),c("h3",x3,d(e.$t("Please wait....")),1)):o.space_profile.lockscreen_config?(i(),c(M,{key:1},[o.space_profile.permissions&&o.space_profile.permissions.is_pending?(i(),c("div",O3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Membership Request Under Review")),1)])):o.space_profile.lockscreen_config.showCustom?(i(),c("div",W3,[a(w,{profile:o.space_profile},null,8,["profile"])])):(i(),c(M,{key:1},[l("div",j3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private space")),1),o.space_profile.lockscreen_config.canSendRequest?(i(),c(M,{key:0},[l("p",N3,d(e.$t("Please send a join request and an admin will review your join request.")),1),e.auth.user_id?(i(),v(h,{key:0,disabled:o.joining,loading:o.joining,class:"fcom_primary_button",onClick:t[0]||(t[0]=p=>e.$emit("join"))},{default:r(()=>[V(d(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(i(),c("a",{key:1,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary fcom_primary_button"},d(e.$t("Login or Signup")),9,z3))],64)):(i(),c(M,{key:1},[o.space_profile.lockscreen_config.showPaywalls?(i(),c("p",q3,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(i(),c("p",G3,d(e.$t("Members have to be invited to this space.")),1)),e.auth.user_id?_("",!0):(i(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,Y3))],64))]),o.space_profile.lockscreen_config.showPaywalls?(i(),v(y,{key:0,space_id:(C=o.space_profile)==null?void 0:C.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(i(),c("div",Z3,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to join this community")),1),l("p",K3,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,J3)]))}const X3=I(H3,[["render",Q3]]),e8={name:"SpaceView",components:{RenderSpaceLinks:us,AboutSpace:go,Layout:we,AppLayout:Ve,SpaceHeader:M2,RecentActivities:Ht,CreateSpaceForm:Dt,SpaceMenu:po,LockscreenView:X3,SpaceIcon:Ne},setup(){return{spaceStore:He()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0}},computed:{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)},showSideBar(){var e,t;return!this.isCustomLockScreen&&this.$route.meta.show_sidebar&&((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.show_sidebar)!="no"},showSpaceMenu(){return!this.isCustomLockScreen},showProfileLogo(){return!this.isCustomLockScreen},feedCssClasses(){var o,u;const e=[];e.push(this.showSideBar?"fcom_has_space_sidebar":"fcom_hide_space_sidebar");let t=((u=(o=this.space_profile)==null?void 0:o.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(){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),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(window.fcomLayoutRef.setScrollTop(0),console.log("[SpaceRoute] Scrolled to top"))})}catch(e){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),this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(window.fcomLayoutRef.setScrollTop(0),console.log("[SpaceRoute] Scrolled to top (cached)"))})):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},t8={key:0,"aria-label":"Space Links",class:"fcom_sub_header"},s8={class:"space_route"},o8={key:0},i8={key:1,class:"space_holder"},n8={key:2};function l8(e,t,o,u,s,n){const m=g("Lock"),f=j,h=g("space-icon"),y=g("router-link"),w=g("space-menu"),b=g("render-space-links"),C=g("space-header"),p=Y,k=g("lockscreen-view"),$=g("router-view"),S=Me,T=g("AboutSpace"),F=Qe,B=xe,L=g("layout"),D=g("app-layout");return i(),v(D,{wrapper_class:n.wrapperLayoutClasses},{default:r(()=>[a(L,{wrapper_class:["no_bg_layout",{custom_lockscreen:n.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=A=>{e.$eventBus.emit("toTop"),n.resetRoute()}),class:"fcom_page_title"},[n.space_profile?(i(),v(y,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:o.space}}},{default:r(()=>[n.isCustomLockScreen?(i(),v(f,{key:0},{default:r(()=>[a(m)]),_:1})):n.showProfileLogo?(i(),v(h,{key:1,space_profile:n.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,d(n.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:r(()=>[n.showSpaceMenu?(i(),v(w,{key:0,space:o.space,space_profile:n.space_profile,onDoSearch:t[1]||(t[1]=A=>{s.search=A}),onRefetch:t[2]||(t[2]=A=>n.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:r(()=>{var A,U;return[n.space_profile&&!n.isCustomLockScreen&&((U=(A=n.space_profile)==null?void 0:A.settings)!=null&&U.links.length)?(i(),c("nav",t8,[a(b,{links:n.space_profile.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[n.showSpaceHeader?(i(),v(C,{key:0,onRefetch:t[3]||(t[3]=A=>n.getSpaceProfile()),space:o.space,space_profile:n.space_profile},null,8,["space","space_profile"])):_("",!0),a(B,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(S,{class:"fcom_main"},{default:r(()=>[l("div",{class:H([n.feedCssClasses,"fcom_feed_box"])},[l("div",s8,[n.loading?(i(),c("div",o8,[a(p,{class:"white_loaded",rows:10,animated:!0})])):n.space_profile?(i(),c("div",i8,[n.isCustomLockScreen?(i(),v(k,{key:0,space_profile:n.space_profile,joining:s.joining,onJoin:t[4]||(t[4]=A=>n.processJoin())},null,8,["space_profile","joining"])):_("",!0),n.has_permission?(i(),v($,{key:o.space,search:s.search,onRefetch:t[5]||(t[5]=A=>n.getSpaceProfile()),space_profile:n.space_profile,space_slug:o.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(i(),c("div",n8,[l("h4",null,d(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),n.showSideBar?(i(),v(F,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[a(T,{has_permission:n.has_permission,space_profile:n.space_profile},null,8,["has_permission","space_profile"])]),_:1})):_("",!0)]),_:1})]),_:1},8,["wrapper_class"])]),_:1},8,["wrapper_class"])}const a8=I(e8,[["render",l8]]),r8={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:It,Feeds:ft},setup(){const e=He(),t=Ge();return{spaceStore:e,uiStore:t}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},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,o;const e=this.spaceStore.getSpaceTopics(this.space_slug);return e&&e.length>0?e:ss((t=this.space_profile)==null?void 0:t.topics)?null:((o=this.space_profile)==null?void 0:o.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)}},c8={key:0,class:"fcom_space_topics"},d8={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function u8(e,t,o,u,s,n){var y,w,b;const m=x,f=ke,h=g("feeds");return i(),c(M,null,[n.spaceTopics?(i(),c("div",c8,[a(f,null,{default:r(()=>[l("div",d8,[a(m,{onClick:t[0]||(t[0]=C=>n.setTopic("")),class:H({fcom_active_topic:!s.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(i(!0),c(M,null,R(n.spaceTopics,C=>(i(),v(m,{key:C.slug,onClick:p=>n.setTopic(C.slug),class:H({fcom_active_topic:C.slug==s.topic_slug})},{default:r(()=>[V(d(C.title),1)]),_:2},1032,["onClick","class"]))),128))],512)]),_:1})])):_("",!0),a(h,{feed_name:"space_feed_"+o.space_slug,space:o.space_slug,topic_slug:s.topic_slug,default_search:o.search,layout_style:n.layout_style,can_change_order:((y=o.space_profile.settings)==null?void 0:y.disable_post_sort_by)!=="yes",default_order_by:((w=o.space_profile.settings)==null?void 0:w.default_post_sort_by)||"",can_change_layout:((b=o.space_profile.settings)==null?void 0:b.disable_layout_style)!=="yes",hide_create_form:!o.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 _8=I(r8,[["render",u8]]),m8={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},h8={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)}},f8={class:"fcom_invitation_form",ref:"inviteForm"};function p8(e,t,o,u,s,n){const m=X,f=de,h=_t,y=mt,w=x,b=ue,C=J("loading");return i(),c("div",f8,[a(b,{onSubmit:t[2]||(t[2]=z(p=>e.doNothing(),["prevent"])),modelValue:s.inviatation,"onUpdate:modelValue":t[3]||(t[3]=p=>s.inviatation=p),"label-position":"top"},{default:r(()=>[a(y,{gutter:30},{default:r(()=>[a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee email")},{default:r(()=>[a(m,{modelValue:s.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=p=>s.inviatation.email=p),placeholder:e.$t("Enter invitee email"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee Name (optional)")},{default:r(()=>[a(m,{modelValue:s.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=p=>s.inviatation.invitee_name=p),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:r(()=>[G((i(),v(w,{disabled:s.saving,class:"fcom_primary_button",onClick:n.sendInvitation},{default:r(()=>[V(d(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[C,s.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const g8=I(h8,[["render",p8]]),y8={name:"AddMemberForm",components:{InviationForm:g8},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()}},v8={class:"fcom_select_photo",style:{float:"left"}},b8=["src","alt"],k8={style:{float:"right",color:"#8492a6","font-size":"13px"}},w8={key:1},C8={class:"fcom_spaced_flex"},$8={key:0},S8={key:1},V8={key:1},L8={key:0},M8={key:1};function F8(e,t,o,u,s,n){const m=ee,f=x,h=te,y=de,w=ue,b=g("InviationForm"),C=J("loading");return s.showingForm=="addByUser"?(i(),v(w,{key:0,onSubmit:t[4]||(t[4]=z(p=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:s.form,"onUpdate:modelValue":t[5]||(t[5]=p=>s.form=p)},{default:r(()=>[s.form.editing_user?(i(),c("p",w8,d(e.$t("Editing manager role for"))+" "+d(s.form.editing_user.display_name),1)):(i(),v(y,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:r(()=>[G((i(),v(h,{ref:"invite_member",class:"rich_select",filterable:"",remote:"","remote-method":n.fetchUsers,placeholder:e.$t("Select User"),modelValue:s.form.user_id,"onUpdate:modelValue":t[1]||(t[1]=p=>s.form.user_id=p)},{empty:r(()=>[l("p",null,d(e.$t("No existing users found based on your search.")),1),a(f,{disabled:s.adding,loading:s.adding,type:"success",onClick:t[0]||(t[0]=p=>n.invitePerson())},{default:r(()=>[V(d(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:r(()=>[(i(!0),c(M,null,R(s.users,p=>(i(),v(m,{class:"fcom_with_photo_option",key:p.ID,label:p.display_name+" ("+(p.user_email||p.ID)+")",value:p.ID},{default:r(()=>[l("span",v8,[l("img",{src:p.photo,alt:p.display_name},null,8,b8),l("span",null,d(p.display_name),1)]),l("span",k8,d(p.user_email||p.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[C,s.loading]])]),_:1},8,["label"])),a(y,{label:e.$t("Membership Role")},{default:r(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:s.form.role,"onUpdate:modelValue":t[2]||(t[2]=p=>s.form.role=p)},{default:r(()=>[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"]),q(e.$slots,"after_form",{},()=>[l("div",C8,[a(f,{class:"fcom_primary_button",loading:s.adding,disabled:s.adding,onClick:t[3]||(t[3]=p=>n.addMember())},{default:r(()=>[s.form.editing_user?(i(),c("span",$8,d(e.$t("Update Role")),1)):(i(),c("span",S8,d(e.$t("Add as %s",s.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(i(),c("div",V8,[e.has_pro?(i(),c("div",L8,[a(b,{space_id:o.space_profile.id,default_value:s.invite_search,onCompleted:t[6]||(t[6]=p=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(i(),c("div",M8,[l("p",null,d(e.$t("Member Invitation feature is only available on the Pro version")),1)]))]))}const T8=I(y8,[["render",F8]]),P8={name:"AddMembersForm",components:{SpaceCourseSelector:Rt},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",o=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(o,u).then(s=>{this.wpUsers=s.users.data,this.wpUsersLoaded=!0}).catch(s=>{this.$handleError(s)}).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",s=e?{user_id:this.selectedUserIds[0]}:{user_id:this.selectedUserIds[0],role:this.role};this.$post(u,s).then(n=>{this.$notify.success(n.message),this.$emit("completed")}).catch(n=>{this.$handleError(n)}).finally(()=>{this.saving=!1});return}const t=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",o=e?{}:{role:this.role};this.runChunkedImport(this.selectedUserIds,u=>({url:t,data:{user_ids:u,...o}}))},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 o=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(o,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 o=new FileReader;o.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."))},o.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 o=this.splitCsvLine(t[0]).map(b=>b.toLowerCase()),u=["name","email","username"],s=o.some(b=>u.includes(b));let n=0,m=1,f=2,h=0;s&&(h=1,n=o.indexOf("name"),m=o.indexOf("email"),f=o.indexOf("username"));const y=new Set,w=[];for(let b=h;b<t.length;b++){const C=this.splitCsvLine(t[b]),p=n>=0&&C[n]||"",k=m>=0?(C[m]||"").toLowerCase():"",$=f>=0&&C[f]||"";!k.includes("@")||y.has(k)||(y.add(k),w.push({name:p,email:k,username:$}))}return w},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,o=this.csvRows.length,u={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=o,this.batchProcessed=0,this.batchProgress=0;const s=n=>{if(n>=o){this.batchRunning=!1,this.importDone={...u,total:o},this.$emit("membersAdded");return}const m=this.csvRows.slice(n,n+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,y=n+h;this.batchProcessed=Math.min(o,y),this.batchProgress=Math.round(this.batchProcessed/o*100),s(y)}).catch(f=>{this.$handleError(f),this.batchRunning=!1,this.importDone={...u,total:o},this.$emit("membersAdded")})};s(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`,o=e?`admin/courses/${this.target.id}/students/bulk-add`:`spaces/${this.target.slug}/members/bulk-add`,u=[];let s=0;this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const n=()=>{this.batchRunning=!1;const f=u.length+s;this.importDone={added:0,skipped:0,failed:s,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),s+=h.failed||0,h.has_more){m(h.next_offset);return}if(!u.length){n();return}this.runChunkedImport(u,y=>({url:o,data:{user_ids:y}}),s)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const y=u.length+s;this.importDone={added:0,skipped:0,failed:s,total:y},this.$emit("membersAdded")})};m(0)},runChunkedImport(e,t,o=0){const s=e.length,n={added:0,skipped:0,failed:o},m=s+o;this.batchRunning=!0,this.batchTotal=s,this.batchProcessed=0,this.batchProgress=0;const f=h=>{if(h>=s){this.batchRunning=!1,this.importDone={...n,total:m},this.$emit("membersAdded");return}const y=e.slice(h,h+500),{url:w,data:b}=t(y);this.$post(w,b).then(C=>{n.added+=C.added||0,n.skipped+=C.skipped||0,n.failed+=C.failed||0;const p=C.processed&&C.processed>0?C.processed:y.length,k=h+p;this.batchProcessed=Math.min(s,k),this.batchProgress=Math.round(this.batchProcessed/s*100),f(k)}).catch(C=>{this.$handleError(C),this.batchRunning=!1,this.importDone={...n,total:m},this.$emit("membersAdded")})};f(0)},runOffsetImport(e,t){const o={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const u=s=>{this.$post(e,{...t,offset:s,per_page:500}).then(n=>{o.added+=n.added||0,o.skipped+=n.skipped||0,o.failed+=n.failed||0,n.total&&!this.batchTotal&&(this.batchTotal=n.total),this.batchProcessed=n.next_offset||s+(n.processed||0),this.batchProgress=this.batchTotal?Math.min(99,Math.round(this.batchProcessed/this.batchTotal*100)):50,n.has_more?u(n.next_offset||this.batchProcessed):(this.batchProgress=100,this.batchRunning=!1,this.importDone={...o,total:this.batchTotal||o.added+o.skipped+o.failed},this.$emit("membersAdded"))}).catch(n=>{this.$handleError(n),this.batchRunning=!1,this.importDone={...o,total:this.batchTotal||o.added+o.skipped+o.failed},this.$emit("membersAdded")})};u(0)}},mounted(){this.sourceMode==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers()}},I8={class:"fcom_add_members_form"},U8={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},E8={key:1,class:"fcom_import_done"},B8={class:"fcom_done_title"},A8={class:"fcom_done_subtitle"},D8={class:"fcom_import_summary"},R8={class:"fcom_import_summary_title"},H8={class:"fcom_import_summary_row"},x8={class:"fcom_import_summary_row"},O8={key:0,class:"fcom_import_summary_row"},j8={key:1,class:"fcom_import_summary_row"},N8={key:2,class:"fcom_import_progress_wrap"},z8={class:"fcom_help_text fcom_mb_15"},q8={key:0,class:"fcom_muted_text fcom_mt_10"},G8={class:"fcom_select_photo",style:{float:"left"}},Y8=["src","alt"],W8={style:{float:"right",color:"#8492a6","font-size":"13px"}},Z8={style:{padding:"4px","text-align":"center"}},K8={style:{margin:"0 0 8px"}},J8={key:0},Q8={key:1},X8={key:2},e4={key:1,style:{margin:"4px 0 0","font-size":"12px"}},t4={key:0,class:"fcom_help_text fcom_mb_10"},s4=["href"],o4={class:"fcom_help_text fcom_mb_15"},i4={key:0},n4={key:2},l4={class:"fcom_spaced_flex fcom_mb_10"},a4={class:"fcom_csv_drop_inner"},r4={class:"el-upload__text fcom_mt_10"},c4={key:0},d4={class:"el-upload__tip"},u4={class:"fcom_spaced_flex fcom_mb_10"},_4={class:"fcom_muted_text",style:{"margin-left":"8px"}},m4={key:0,class:"fcom_muted_text fcom_mb_10"},h4=["aria-label"],f4={class:"fcom_help_text fcom_mb_15"},p4=["aria-label"],g4={class:"fcom_help_text fcom_mb_15"},y4={key:0};function v4(e,t,o,u,s,n){const m=We,f=be,h=Qt,y=ee,w=x,b=te,C=de,p=ue,k=g("SpaceCourseSelector"),$=ut,S=Ps,T=Is,F=pe,B=J("loading");return i(),c("div",I8,[!s.batchRunning&&!s.importDone?(i(),c("div",U8,[a(f,{modelValue:s.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=L=>s.sourceMode=L),size:"small"},{default:r(()=>[a(m,{value:"wp_users"},{default:r(()=>[V(d(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:r(()=>[V(d(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:r(()=>[V(d(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(i(),v(m,{key:0,value:"crm_tag"},{default:r(()=>[V(d(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),s.importDone?(i(),c("div",E8,[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",B8,d(e.$t("All Done!")),1),l("p",A8,d(e.$t("Import has been completed. You may close this now.")),1),l("div",D8,[l("strong",R8,d(e.$t("Import Summary")),1),l("p",H8,d(e.$t("Total Records:"))+" "+d(s.importDone.total),1),l("p",x8,d(o.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+d(s.importDone.added),1),s.importDone.skipped?(i(),c("p",O8,d(e.$t("Skipped:"))+" "+d(s.importDone.skipped),1)):_("",!0),s.importDone.failed?(i(),c("p",j8,d(e.$t("Failed:"))+" "+d(s.importDone.failed),1)):_("",!0)])])):s.batchRunning?(i(),c("div",N8,[l("div",z8,[l("p",null,d(e.$t("Importing… Please do not close this window.")),1)]),a(h,{percentage:s.batchProgress,"stroke-width":12},null,8,["percentage"]),s.batchTotal?(i(),c("p",q8,d(s.batchProcessed)+" / "+d(s.batchTotal)+" "+d(e.$t("processed")),1)):_("",!0)])):(i(),c(M,{key:3},[s.sourceMode==="wp_users"?(i(),v(p,{key:0,onSubmit:t[5]||(t[5]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(C,{label:e.$t("Users")},{default:r(()=>[a(b,{class:"rich_select",multiple:"",filterable:"",remote:"","default-first-option":"","reserve-keyword":!1,loading:s.wpLoading,"remote-method":n.searchWpUsers,placeholder:e.$t("Search and select users"),modelValue:s.selectedUserIds,"onUpdate:modelValue":t[2]||(t[2]=L=>s.selectedUserIds=L)},{empty:r(()=>[l("div",Z8,[l("p",K8,[n.isEmail?(i(),c("span",J8,[V(d(e.$t("User not registered:"))+" ",1),l("strong",null,d(s.currentSearch),1)])):s.currentSearch?(i(),c("span",Q8,d(e.$t("No matching user found.")),1)):(i(),c("span",X8,d(e.$t("No data")),1))]),o.context==="space"?(i(),c(M,{key:0},[n.isEmail?(i(),v(w,{key:0,size:"small",class:"fcom_primary_button",loading:s.inviting,disabled:s.inviting,"aria-label":n.invitingLabel(s.currentSearch),onClick:t[1]||(t[1]=L=>n.inviteToSpace())},{default:r(()=>[V(d(e.$t("Send Email Invitation")),1)]),_:1},8,["loading","disabled","aria-label"])):s.currentSearch?(i(),c("p",e4,d(e.$t("Type a valid email to invite.")),1)):_("",!0)],64)):_("",!0)])]),default:r(()=>[(i(!0),c(M,null,R(s.wpUsers,L=>(i(),v(y,{class:"fcom_with_photo_option",key:L.ID,label:`${L.display_name} (${L.user_email||L.ID})`,value:L.ID},{default:r(()=>[l("span",G8,[l("img",{src:L.photo,alt:L.display_name},null,8,Y8),l("span",null,d(L.display_name),1)]),l("span",W8,d(L.user_email||L.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),o.context==="space"?(i(),v(C,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(b,{modelValue:s.role,"onUpdate:modelValue":t[3]||(t[3]=L=>s.role=L),placeholder:e.$t("Select Role")},{default:r(()=>[a(y,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(y,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(y,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(C,null,{default:r(()=>[s.selectedUserIds.length>1&&!e.appVars.pro?(i(),c("div",t4,[l("p",null,[V(d(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(i(),c("a",{key:0,href:e.appVars.upgrade_url,target:"_blank"},d(e.$t("Upgrade")),9,s4)):_("",!0)])])):_("",!0),G((i(),v(w,{class:"fcom_primary_button",onClick:t[4]||(t[4]=L=>n.addWpUsers())},{default:r(()=>[V(d(o.context==="course"?e.$t("Add Students"):e.$t("Add as %s",s.role)),1)]),_:1})),[[B,s.saving]])]),_:1})]),_:1})):s.sourceMode==="from_source"?(i(),v(p,{key:1,"label-position":"top"},{default:r(()=>[a(C,{label:e.$t("Select Source Space or Course")},{default:r(()=>[a(k,{modelValue:s.selectedSourceId,"onUpdate:modelValue":t[6]||(t[6]=L=>s.selectedSourceId=L),placeholder_text:e.$t("Select a space or course..."),memberships:[o.target.id.toString()],onSelectedType:t[7]||(t[7]=L=>s.selectedSourceType=L),onSelectedSlug:t[8]||(t[8]=L=>s.selectedSourceSlug=L)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",o4,[l("p",null,d(o.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(w,{class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>n.importFromSource())},{default:r(()=>[V(d(o.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(i(),c("span",i4," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):s.sourceMode==="csv"?(i(),c("div",n4,[s.csvRows.length?(i(),c(M,{key:1},[l("div",u4,[l("div",null,[l("strong",null,d(s.csvFileName),1),l("span",_4,d(s.csvRows.length)+" "+d(e.$t("contacts")),1)]),a(w,{link:"",size:"small",onClick:t[11]||(t[11]=L=>n.resetCsvImport())},{default:r(()=>[V(d(e.$t("Change")),1)]),_:1})]),a(T,{data:s.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:r(()=>[a(S,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a(S,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a(S,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),s.csvRows.length>5?(i(),c("p",m4," + "+d(s.csvRows.length-5)+" "+d(e.$t("more rows")),1)):_("",!0),a(p,{"label-position":"top"},{default:r(()=>[a(C,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for new email addresses")},[l("div",null,[a(F,{modelValue:s.createMissingUsers,"onUpdate:modelValue":t[12]||(t[12]=L=>s.createMissingUsers=L)},{default:r(()=>[V(d(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),l("div",null,[G(a(F,{modelValue:s.sendWelcomeEmailCsv,"onUpdate:modelValue":t[13]||(t[13]=L=>s.sendWelcomeEmailCsv=L)},{default:r(()=>[V(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[yt,s.createMissingUsers]])])],8,h4)]),_:1}),l("div",f4,[l("p",null,d(o.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(C,null,{default:r(()=>[a(w,{class:"fcom_primary_button",onClick:t[14]||(t[14]=L=>n.importCsv())},{default:r(()=>[V(d(o.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(i(),c(M,{key:0},[l("div",l4,[t[20]||(t[20]=l("span",null,null,-1)),e.appVars.pro?(i(),v(w,{key:0,link:"",size:"small",onClick:t[10]||(t[10]=L=>n.downloadSampleCsv())},{default:r(()=>[V("↓ "+d(e.$t("Sample CSV")),1)]),_:1})):_("",!0)]),a($,{drag:"",accept:".csv,.txt","auto-upload":!1,"show-file-list":!1,"on-change":n.onCsvFileChange,disabled:!e.appVars.pro},{tip:r(()=>[l("div",d4,d(e.$t("Columns: Name, Email, Username")),1)]),default:r(()=>[l("div",a4,[t[22]||(t[22]=l("div",{class:"fcom_csv_drop_arrow"},"↑",-1)),l("div",r4,[V(d(e.$t("Drop CSV here or"))+" ",1),l("em",null,d(e.$t("click to browse")),1),t[21]||(t[21]=V()),e.appVars.pro?_("",!0):(i(),c("span",c4," ("+d(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):s.sourceMode==="crm_tag"?(i(),v(p,{key:3,"label-position":"top"},{default:r(()=>[a(C,{label:e.$t("FluentCRM Tag")},{default:r(()=>[a(b,{modelValue:s.selectedTagId,"onUpdate:modelValue":t[15]||(t[15]=L=>s.selectedTagId=L),loading:s.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:r(()=>[(i(!0),c(M,null,R(s.crmTags,L=>(i(),v(y,{key:L.id,label:L.title,value:L.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a(C,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for contacts without an existing account")},[l("div",null,[a(F,{modelValue:s.createMissingCrmUsers,"onUpdate:modelValue":t[16]||(t[16]=L=>s.createMissingCrmUsers=L)},{default:r(()=>[V(d(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),l("div",null,[G(a(F,{modelValue:s.sendWelcomeEmailCrm,"onUpdate:modelValue":t[17]||(t[17]=L=>s.sendWelcomeEmailCrm=L)},{default:r(()=>[V(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[yt,s.createMissingCrmUsers]])])],8,p4)]),_:1}),l("div",g4,[l("p",null,d(o.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(w,{class:"fcom_primary_button",onClick:t[18]||(t[18]=L=>n.addFromCrmTag())},{default:r(()=>[V(d(o.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(i(),c("span",y4," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const b4=I(P8,[["render",v4]]),k4={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Te,Pagination:Se,FollowAction:st,AddMemberForm:T8,AddMembersForm:b4},inheritAttrs:!1,data(){return{members:[],loading:!1,pagination:{page:1,per_page:20,total:0},status:"active",pending_count:0,working:!1,addingNewMember:!1,addingMember:!1,editing_member:{user_id:"",role:"member"},search:"",permission_failed:!1,memberLayout:this.appVars.features.member_list_layout||"classic"}},methods:{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}).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.working=!0,this.$post("spaces/"+this.space+"/members/remove",{user_id:e.user_id}).then(o=>{this.$notify.success(o.message),this.members.splice(t,1),this.members.length||this.fetch()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},approveMember(e,t=null){this.working=!0,this.$post("spaces/"+this.space+"/members",{user_id:e.user_id}).then(o=>{if(this.$notify.success(o.message),t===null){this.fetch();return}this.members.splice(t,1),this.members.length||this.fetch()}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},initAddMember(e,t=null){this.editing_member=e?{user_id:e.user_id,role:e.role,editing_user:e.xprofile}:{user_id:"",role:"member"},e&&this.$refs.edit_member_pop&&this.$refs.edit_member_pop.hide(),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.fetch()}},w4={ref:"space_members"},C4={key:0,class:"card_header"},$4={class:"member_status"},S4={class:"add_member"},V4={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},L4={class:"permission_failed"},M4=["href"],F4={key:2},T4={class:"search_member fcom_mb_20"},P4={class:"card_list"},I4={class:"card_content"},U4={class:"card_avatar"},E4={class:"card_info"},B4={class:"card_name"},A4={class:"info_header"},D4={class:"meta_line"},R4={class:"feed_meta_info"},H4=["title"],x4=["title"],O4=["title"],j4={key:0,class:"card_description"},N4={class:"card_footer"},z4={class:"card_action"},q4={class:"actions_items"},G4=["onClick"],Y4=["onClick"],W4={class:"pagination_wrap"},Z4={key:0,class:"loading"},K4={key:1,class:"no_members"},J4={key:0},Q4={key:1};function X4(e,t,o,u,s,n){const m=We,f=be,h=x,y=g("Search"),w=j,b=X,C=g("UserAvatar"),p=g("UserRouteLink"),k=Ue,$=g("FollowAction"),S=g("MoreFilled"),T=fe,F=g("Pagination"),B=Y,L=g("add-members-form"),D=bt,A=g("add-member-form"),U=J("loading");return i(),c(M,null,[l("div",w4,null,512),e.hasSpaceAdminAccess(o.space_profile)?(i(),c("div",C4,[l("div",$4,[s.pending_count?(i(),v(f,{key:0,onChange:n.toSearch,modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=P=>s.status=P),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending"))+" ("+d(s.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",S4,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=P=>s.addingNewMember=!0)},{default:r(()=>[V(d(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=P=>e.$router.push({name:"space_invitations"}))},{default:r(()=>[V(d(e.$t("Invitations")),1)]),_:1})])])):_("",!0),s.permission_failed?(i(),c("div",V4,[l("div",L4,[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:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,M4)])])):(i(),c("div",F4,[l("div",T4,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[3]||(t[3]=P=>s.search=P),placeholder:e.$t("Search...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",{class:H(["fcom_dir_layout_"+s.memberLayout,"space_members fcom_dir_layout"])},[G((i(),c("div",P4,[(i(!0),c(M,null,R(s.members,(P,O)=>{var N,Q,_e;return G((i(),c("div",{key:P.id,class:"each_card"},[l("div",I4,[l("div",U4,[a(C,{xprofile:P.xprofile,is_online:e.isOnline(P.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",E4,[l("div",B4,[l("div",A4,[a(p,{xprofile:P.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",D4,"@"+d((N=P.xprofile)==null?void 0:N.username),1)]),l("div",R4,[s.status!="pending"&&P.created_at?(i(),c("div",{key:0,title:P.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(P.created_at))),9,H4)):P.created_at?(i(),c("div",{key:1,title:P.created_at,class:"meta_line"},d(e.$t("Requested %s",e.humanDateDiff(P.created_at))),9,x4)):_("",!0),P.xprofile.last_activity?(i(),c("div",{key:2,title:P.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(P.xprofile.last_activity))),9,O4)):_("",!0)]),(Q=P.xprofile)!=null&&Q.short_description?(i(),c("div",j4,d(e.getExcerpt(((_e=P.xprofile.meta)==null?void 0:_e.short_description_rendered)||P.xprofile.short_description,120)),1)):_("",!0),P.role!="member"?(i(),v(k,{key:1,type:"success"},{default:r(()=>[V(d(e.$labelize(P.role)),1)]),_:2},1024)):_("",!0)]),s.status=="pending"?(i(),c(M,{key:0},[t[9]||(t[9]=l("div",{class:"card_break"},null,-1)),l("div",N4,[a(h,{class:"fcom_primary_button",onClick:ne=>n.approveMember(P,O)},{default:r(()=>[V(d(e.$t("Approve")),1)]),_:1},8,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:ne=>n.removeMember(P,O)},{default:r(()=>[V(d(e.$t("Decline")),1)]),_:1},8,["onClick"])])],64)):_("",!0)])]),l("div",z4,[a($,{profile:P.xprofile},null,8,["profile"]),s.status!="pending"&&o.space_profile&&e.hasInPermission("can_remove_member",o.space_profile.permissions)?(i(),v(T,{key:0,placement:"bottom",width:200,trigger:"click",persistent:!1,ref_for:!0,ref:"userPopoverRef_"+P.user_id},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),size:"small",text:""},{default:r(()=>[a(w,{class:"fcom_more_icon"},{default:r(()=>[a(S)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",q4,[l("li",{onClick:ne=>n.removeMemberPrompt(P,O)},d(e.$t("Remove Member")),9,G4),l("li",{onClick:ne=>n.initAddMember(P,ne)},d(e.$t("Change Membership")),9,Y4)])]),_:2},1536)):_("",!0)])])),[[U,s.working]])}),128))])),[[U,s.loading]]),l("div",W4,[a(F,{hide_on_single:!0,onFetch:t[4]||(t[4]=P=>n.fetch()),pagination:s.pagination},null,8,["pagination"])]),s.loading&&!s.pagination.total?(i(),c("div",Z4,[a(B,{class:"white_loaded",rows:3,animated:!0}),a(B,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!s.loading&&!s.members.length?(i(),c("div",K4,d(e.$t("No %s members found in this community.",s.status)),1)):_("",!0)],2)])),s.addingNewMember?(i(),v(D,{key:3,modelValue:s.addingNewMember,"onUpdate:modelValue":t[6]||(t[6]=P=>s.addingNewMember=P),"close-on-click-modal":!1,"append-to-body":!0,size:e.drawerWidth,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Member")),1)]),default:r(()=>[s.addingNewMember?(i(),v(L,{key:0,context:"space",target:o.space_profile,onCompleted:n.handleBulkMemberAdded,onMembersAdded:t[5]||(t[5]=P=>n.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0),s.addingMember?(i(),v(D,{key:4,modelValue:s.addingMember,"onUpdate:modelValue":t[8]||(t[8]=P=>s.addingMember=P),"close-on-click-modal":!1,"append-to-body":!0,size:e.drawerWidth,direction:"rtl"},{header:r(()=>[s.editing_member.editing_user?(i(),c("h4",J4,d(e.$t("Update Role")),1)):(i(),c("h4",Q4,d(e.$t("Add Member")),1))]),default:r(()=>[s.addingMember?(i(),v(A,{key:0,space_profile:o.space_profile,modelValue:s.editing_member,"onUpdate:modelValue":t[7]||(t[7]=P=>s.editing_member=P),onCompleted:n.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0)],64)}const e5=I(k4,[["render",X4]]);const t5={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")}}},s5={class:"fcom_document_upload_form"};function o5(e,t,o,u,s,n){const m=pe,f=g("CreateStatusForm");return i(),c("div",s5,[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:s.post,"default-state":"active",disableUpload:!0,space:o.space_profile.slug,onAdded:n.resetForm},{before_submit_btn:r(()=>[a(m,{onChange:t[0]||(t[0]=h=>{e.$refs.createStatusForm.feed.status=h}),"true-value":"published","false-value":"unlisted",modelValue:s.post_status,"onUpdate:modelValue":t[1]||(t[1]=h=>s.post_status=h)},{default:r(()=>[V(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const i5=I(t5,[["render",o5]]),n5={name:"DocumentFeedCard",components:{ChatIcon:Xe,HeartIcon:et,DocumentLists:tt,UserRouteLink:Fe},props:["feed"]},l5={class:"fcom_document_feed_card feed"},a5={class:"feed_header"},r5={key:0,class:"feed_user"},c5={class:"feed_user_name"},d5={class:"feed_title"},u5={class:"feed_title_heading"},_5=["href"],m5={class:"feed_meta_info"},h5=["href"],f5=["title"],p5=["href"],g5={style:{"margin-left":"5px","margin-right":"7px"}},y5=["href"],v5={style:{"margin-left":"5px"}},b5={class:"feed_body"};function k5(e,t,o,u,s,n){var w,b,C,p,k;const m=g("ChatIcon"),f=j,h=g("HeartIcon"),y=g("DocumentLists");return i(),c("div",l5,[l("div",a5,[o.feed.xprofile?(i(),c("div",r5,[l("div",c5,[l("div",d5,[l("h2",u5,[l("a",{href:o.feed.permalink},d(o.feed.title||e.$t("Uploaded %s files",((b=(w=o.feed.meta)==null?void 0:w.document_lists)==null?void 0:b.length)||"--")),9,_5)])])]),l("div",m5,[l("a",{onClick:t[0]||(t[0]=(...$)=>e.gotoFeed&&e.gotoFeed(...$)),href:o.feed.permalink,class:"feed_timestamp"},[l("span",{title:o.feed.created_at,style:{padding:"0 7px 0 0"}},d(e.humanDateDiff(o.feed.created_at))+" "+d(e.$t("by %s",(C=o.feed.xprofile)==null?void 0:C.display_name)),9,f5)],8,h5),o.feed.comments_count?(i(),c("a",{key:0,onClick:t[1]||(t[1]=(...$)=>e.gotoFeed&&e.gotoFeed(...$)),href:o.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(m)]),_:1}),l("span",g5,d(o.feed.comments_count),1)],8,p5)):_("",!0),o.feed.reactions_count?(i(),c("a",{key:1,onClick:t[2]||(t[2]=(...$)=>e.gotoFeed&&e.gotoFeed(...$)),href:o.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(h,{filled:!0})]),_:1}),l("span",v5,d(o.feed.reactions_count),1)],8,y5)):_("",!0)])])):_("",!0)]),l("div",b5,[a(y,{document_lists:(k=(p=o.feed)==null?void 0:p.meta)==null?void 0:k.document_lists},null,8,["document_lists"])])])}const w5=I(n5,[["render",k5]]);const C5={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:so,Feed:ot,DocumentUploadForm:i5,UploadFilled:$t,Search:Te,Pagination:Se,DocumentFeedCard:w5},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:Zt(Te),permission_failed:!1,show_uploader:!1}},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 n;if(this.pagination.last_page==this.pagination.page)return;let t=document.querySelector(".all_documents_wrap .feed_outer:last-child");if(!t)return;let o=t.getBoundingClientRect(),u=(n=window.fcomLayoutRef)==null?void 0:n.wrapRef;!u||o.bottom-u.getBoundingClientRect().bottom-o.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))}},$5={ref:"space_docs"},S5={class:"card_header"},V5={class:"member_status"},L5={key:0,class:"add_member"},M5={key:0},F5={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},T5={class:"permission_failed"},P5=["href"],I5={key:2},U5={class:"search_member"},E5={class:""},B5={class:"card_list"},A5={class:"all_documents_wrap"},D5={key:0,style:{"margin-top":"20px","text-align":"center"}},R5={key:1,class:"loading"},H5={key:2,class:"no_members"};function x5(e,t,o,u,s,n){var k,$;const m=g("UploadFilled"),f=j,h=x,y=g("document-upload-form"),w=g("Search"),b=X,C=g("document-feed-card"),p=Y;return i(),c(M,null,[l("div",$5,null,512),l("div",S5,[l("div",V5,[l("h3",null,d(e.$t("Documents and Files")),1)]),($=(k=o.space_profile)==null?void 0:k.permissions)!=null&&$.can_upload_documents?(i(),c("div",L5,[s.show_uploader?(i(),v(h,{key:1,plain:"",onClick:t[1]||(t[1]=S=>s.show_uploader=!1),size:"small"},{default:r(()=>[l("span",null,d(e.$t("Cancel")),1)]),_:1})):(i(),v(h,{key:0,onClick:t[0]||(t[0]=S=>s.show_uploader=!0),class:"fcom_primary_button"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("New Documents")),1)]),_:1}))])):_("",!0)]),s.show_uploader?(i(),c("div",M5,[a(y,{onRefetch:t[2]||(t[2]=()=>{n.toSearch(),s.show_uploader=!1}),space_profile:o.space_profile,reload:n.toSearch},null,8,["space_profile","reload"])])):_("",!0),s.permission_failed?(i(),c("div",F5,[l("div",T5,[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:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,P5)])])):(i(),c("div",I5,[l("div",U5,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[3]||(t[3]=S=>s.search=S),placeholder:e.$t("Search...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",E5,[l("div",B5,[l("div",A5,[(i(!0),c(M,null,R(s.documents,S=>(i(),c("div",{key:S.id,class:"feed_outer"},[a(C,{feed:S},null,8,["feed"])]))),128))])]),!s.loading&&s.pagination.last_page!=s.pagination.page?(i(),c("div",D5,[a(h,{class:"fcom_secondary_button",disabled:s.loading,onClick:t[4]||(t[4]=S=>{s.pagination.page++,n.fetch(!0)})},{default:r(()=>[V(d(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),s.loading?(i(),c("div",R5,[a(p,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!s.loading&&!s.documents.length?(i(),c("div",H5,d(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const O5=I(C5,[["render",x5]]);const j5={name:"PendingInvitations",components:{Pagination:Se},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()}},N5={class:"fcom_invitations"},z5={style:{margin:"20px 0"},class:"fcom_spaced_flex"},q5={key:0},G5={key:0,class:"fcom_person_name"},Y5={key:1,class:"fcom_person_name"},W5={key:3,style:{margin:"0",padding:"0"}},Z5={class:"fcom_person_name"};function K5(e,t,o,u,s,n){const m=ee,f=te,h=g("CopyDocument"),y=j,w=x,b=Ps,C=g("UserRouteLink"),p=g("DeleteFilled"),k=Is,$=g("Pagination"),S=J("loading");return i(),c("div",N5,[l("div",z5,[l("h4",null,d(e.$t("Invitations")),1),e.has_pro?(i(),c("div",q5,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=T=>{s.pagination.page=1,n.getInvitations()}),modelValue:s.status,"onUpdate:modelValue":t[1]||(t[1]=T=>s.status=T)},{default:r(()=>[(i(),c(M,null,R(["all","pending","accepted","active","expired"],T=>a(m,{key:T,label:e.ucFirst(T),value:T},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),G((i(),v(k,{data:s.invitations,border:"","empty-text":n.getEmptyText,style:{width:"100%","border-radius":"8px"}},{default:r(()=>[a(b,{prop:"message",label:e.$t("Invitee"),"min-width":"180"},{default:r(T=>[T.row.message?(i(),c("span",G5,d(T.row.meta.invitee_name)+" <"+d(T.row.message)+"> ",1)):(i(),c("span",Y5,d(T.row.meta.title)+" ("+d(e.$t("Invitation Link"))+") ",1)),T.row.access_url?(i(),v(w,{key:2,type:"info",size:"small",text:"",onClick:F=>e.$toClipboard(T.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:r(()=>[a(y,{title:e.$t("Copy Invitation URl")},{default:r(()=>[a(h)]),_:1},8,["title"]),l("span",null,d(e.$t("Copy Link")),1)]),_:1},8,["onClick"])):_("",!0),T.row.message?_("",!0):(i(),c("p",W5,d(T.row.meta.limit?e.$t("Limit")+": "+T.row.meta.limit:"")+" "+d(parseInt(T.row.reactions_count)>0?" | "+e.$t("Usage")+": "+T.row.reactions_count:"")+" "+d(T.row.meta.expire_date?" | "+e.$t("Expire Date")+": "+e.smartDate(T.row.meta.expire_date):""),1))]),_:1},8,["label"]),s.is_mod?(i(),v(b,{key:0,prop:"user_id",label:e.$t("Invited By"),width:"180"},{default:r(T=>[l("span",Z5,[a(C,{xprofile:T.row.xprofile},null,8,["xprofile"])])]),_:1},8,["label"])):_("",!0),a(b,{prop:"status",label:e.$t("Status"),width:"120"},{default:r(T=>[l("span",null,d(e.$labelize(T.row.status)),1)]),_:1},8,["label"]),a(b,{label:e.$t("Actions")},{default:r(T=>[T.row.status=="pending"?G((i(),v(w,{key:0,size:"small",onClick:F=>n.handleResend(T.row)},{default:r(()=>[V(d(e.$t("Resend")),1)]),_:1},8,["onClick"])),[[S,s.loading]]):_("",!0),a(w,{"aria-label":e.$t("Delete invitation"),onClick:F=>n.handleDelete(T.row),plain:"",type:"danger",size:"small"},{default:r(()=>[a(y,{title:e.$t("Delete invitation")},{default:r(()=>[a(p)]),_:1},8,["title"])]),_:1},8,["aria-label","onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[S,s.loading]]),a($,{hide_on_single:!1,pagination:s.pagination,onFetch:n.getInvitations},null,8,["pagination","onFetch"])])}const J5=I(j5,[["render",K5]]);const Q5={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}))}}},X5={class:"fcom_invitation_link_wrap"},e6={class:"fcom_invite_head"},t6={class:"fcom_invite_body"},s6={key:1},o6={key:1,style:{padding:"20px"}},i6={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function n6(e,t,o,u,s,n){const m=X,f=de,h=Ye,y=x,w=ue,b=g("CopyDocument"),C=j;return i(),c("div",X5,[l("div",e6,[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",t6,[s.createdItem?(i(),c("div",o6,[l("h4",i6,d(e.$t("Please share this url to your audience to join this space")),1),a(m,{modelValue:s.createdItem.access_url,"onUpdate:modelValue":t[6]||(t[6]=p=>s.createdItem.access_url=p),readonly:""},{suffix:r(()=>[a(y,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=p=>e.$toClipboard(s.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:r(()=>[a(C,null,{default:r(()=>[a(b)]),_:1}),l("span",null,d(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(i(),v(w,{key:0,onSubmit:t[3]||(t[3]=z(p=>e.doNothing(),["prevent"])),modelValue:s.form,"onUpdate:modelValue":t[4]||(t[4]=p=>s.form=p),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:r(()=>[a(m,{modelValue:s.form.title,"onUpdate:modelValue":t[0]||(t[0]=p=>s.form.title=p),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:r(()=>[a(m,{type:"number",modelValue:s.form.limit,"onUpdate:modelValue":t[1]||(t[1]=p=>s.form.limit=p),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:r(()=>[a(h,{style:{"min-width":"300px"},modelValue:s.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=p=>s.form.expire_date=p),type:"date",placeholder:e.$t("Leave empty for no expiration"),"value-format":"YYYY-MM-DD",format:"YYYY-MM-DD"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[e.has_pro?(i(),v(y,{key:0,onClick:n.createLink,loading:s.creating,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(i(),c("div",s6,[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 l6=I(Q5,[["render",n6]]),a6={name:"SpaceInviations",components:{CreateInvitationLink:l6,PendingInvitations:J5},props:["space_profile"],data(){return{currentTab:"invitations"}}},r6={key:0,class:"card_header"},c6={class:"permission_failed"},d6=["href"],u6={key:1};function _6(e,t,o,u,s,n){const m=g("pending-invitations"),f=wt,h=g("CreateInvitationLink"),y=Ct;return e.hasSpaceAdminAccess(o.space_profile)?(i(),c("div",u6,[a(y,{modelValue:s.currentTab,"onUpdate:modelValue":t[0]||(t[0]=w=>s.currentTab=w),type:"border-card"},{default:r(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:r(()=>[s.currentTab=="invitations"?(i(),v(m,{key:0,space_id:o.space_profile.id},null,8,["space_id"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invitation_links",label:e.$t("New Invitation Link")},{default:r(()=>[s.currentTab=="invitation_links"?(i(),v(h,{key:0,space_profile:o.space_profile},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue"])])):(i(),c("div",r6,[l("div",c6,[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:o.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,d6)])]))}const m6=I(a6,[["render",_6]]),h6={name:"GlobIcon"},f6={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function p6(e,t,o,u,s,n){return i(),c("svg",f6,[...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 bo=I(h6,[["render",p6]]),g6={name:"GroupIcon"},y6={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function v6(e,t,o,u,s,n){return i(),c("svg",y6,[...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 Ot=I(g6,[["render",v6]]),b6={name:"AllCommunities",components:{User:zo,GlobIcon:bo,Layout:we,AppLayout:Ve,CreateSpaceForm:Dt,GroupIcon:Ot,Pagination:Se,Search:Te},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,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 o=e.replace(/(<([^>]+)>)/ig,"");return o.length>t&&(o=o.substring(0,t)+"..."),o},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)}},k6={class:"object_menu"},w6={class:"fcom_space_menu_ul"},C6={key:0},$6={key:1},S6={class:"actions_items"},V6={class:"search_member"},L6={class:"feed_filters"},M6={id:"feed_short_by",class:"fcom_feed_filter_label"},F6={class:"fcom_communities"},T6={key:0,class:"fcom_no_items_wrap"},P6={key:1,class:"fcom_box_card_list"},I6={class:"fcom_box_card_avatar"},U6=["src"],E6=["src"],B6=["alt","src"],A6={class:"fcom_box_card_info"},D6={class:"fcom_box_card_name"},R6={key:0},H6={class:"fcom_box_card_details"},x6={class:"details_item"},O6={key:0,class:"details_item"},j6=["innerHTML"],N6={class:"fcom_box_card_action"},z6=["disabled","onClick"],q6=["onClick"];function G6(e,t,o,u,s,n){const m=x,f=g("MoreFilled"),h=j,y=fe,w=g("Search"),b=X,C=ee,p=te,k=g("router-link"),$=Ue,S=g("GlobIcon"),T=g("Lock"),F=g("GroupIcon"),B=g("pagination"),L=g("layout"),D=g("app-layout"),A=J("loading");return i(),v(D,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(L,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(s.pagination.total?" ("+e.$formatNumber(s.pagination.total)+")":"")},{actions:r(()=>[l("div",k6,[l("ul",w6,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(U=>n.SwitchToSpaceView("all"),["prevent"])),class:H(s.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Spaces")),3)]),e.auth.user_id?(i(),c("li",C6,[l("a",{onClick:t[1]||(t[1]=z(U=>n.SwitchToSpaceView("joined"),["prevent"])),class:H(s.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(i(),c("li",$6,[a(m,{onClick:t[2]||(t[2]=U=>n.fireCreateSpace()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(i(),v(y,{key:0,persistent:!1,ref:"space_actions",placement:"bottom",width:200,trigger:"click"},{reference:r(()=>[a(m,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",S6,[l("li",{onClick:t[3]||(t[3]=(...U)=>n.goToSpaceGroups&&n.goToSpaceGroups(...U))},d(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:r(()=>[l("div",V6,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[4]||(t[4]=U=>s.search=U),placeholder:e.$t("Search Space...")},{prefix:r(()=>[a(h,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",L6,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",M6,d(e.$t("Sort by:")),1),a(p,{"aria-label":e.$t("Sort Spaces by"),modelValue:s.sort_by,"onUpdate:modelValue":t[5]||(t[5]=U=>s.sort_by=U),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=U=>n.changeSortBy())},{default:r(()=>[a(C,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(C,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a(C,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),G((i(),c("div",F6,[!s.loading&&s.communities.length==0?(i(),c("div",T6,[s.search?(i(),c(M,{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)):(i(),c(M,{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))])):(i(),c("div",P6,[(i(!0),c(M,null,R(s.communities,U=>(i(),c("div",{role:"region","aria-label":"Space Lists",key:U.id,class:"fcom_each_box_card"},[l("div",I6,[a(k,{"aria-label":"Go to Space",to:n.getSpaceFeedsRoute(U.slug)},{default:r(()=>{var P;return[(P=U.settings)!=null&&P.og_image?(i(),c("img",{key:0,src:U.settings.og_image,alt:""},null,8,U6)):U.cover_photo?(i(),c("img",{key:1,src:U.cover_photo,alt:""},null,8,E6)):(i(),c("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,B6))]}),_:2},1032,["to"])]),l("div",A6,[l("div",D6,[a(k,{to:n.getSpaceFeedsRoute(U.slug)},{default:r(()=>[V(d(n.getExcerpt(U.title,24))+" ",1),U.space_pivot?(i(),v($,{key:0,type:"success"},{default:r(()=>[V(d(e.$labelize(U.space_pivot.role))+" ",1),U.space_pivot.status!="active"?(i(),c("span",R6," ("+d(e.$labelize(U.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",H6,[l("div",x6,[U.privacy==="public"?(i(),v(h,{key:0},{default:r(()=>[a(S)]),_:1})):(i(),v(h,{key:1},{default:r(()=>[a(T)]),_:1})),l("span",null,d(e.$labelize(U.privacy)),1)]),U.members_count?(i(),c("div",O6,[a(h,null,{default:r(()=>[a(F)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(U.members_count))),1)])):_("",!0)]),U.description?(i(),c("div",{key:0,class:"fcom_box_card_description",innerHTML:n.getExcerpt(U.description_rendered,85)},null,8,j6)):_("",!0),l("div",N6,[U.space_pivot?(i(),c("button",{key:1,class:"fcom_card_button",onClick:P=>n.goToSpaceFeeds(U.slug)},d(e.$t("View Space")),9,q6)):G((i(),c("button",{key:0,class:"fcom_card_button",disabled:s.joining===U.slug,onClick:P=>n.join(U)},[V(d(e.$t("Join")),1)],8,z6)),[[A,s.joining===U.slug]])])])]))),128))])),a(B,{hide_on_single:!0,onFetch:n.getCommunities,pagination:s.pagination},null,8,["onFetch","pagination"])])),[[A,s.loading]])]),_:1},8,["title"])]),_:1})}const Y6=I(b6,[["render",G6]]),W6={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;let o=[];for(let u=0;u<t.length;u++){let s=this.appVars.user_badges[t[u]];s&&o.push(s)}return o}return[this.badge]}}},Z6=["src"],K6={key:1,class:"fcom_emoji"},J6={key:2,class:"fcom_shape"},Q6={key:1};function X6(e,t,o,u,s,n){const m=j,f=Kt;return n.renderingBadges?(i(!0),c(M,{key:0},R(n.renderingBadges,h=>(i(),c("div",{class:H([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:r(()=>[l("div",{style:le({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(i(),c(M,{key:0},[h.config.logo?(i(),c("img",{key:0,alt:"",src:h.config.logo},null,8,Z6)):h.config.emoji?(i(),c("span",K6,d(h.config.emoji),1)):h.config.shape_svg?(i(),c("span",J6,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(i(),c("span",Q6,d(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const ko=I(W6,[["render",X6]]),eC={name:"AddNotificationIcon"},tC={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 sC(e,t,o,u,s,n){return i(),c("svg",tC,[...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 oC=I(eC,[["render",sC]]),iC={name:"NotificationAddedIcon"},nC={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 lC(e,t,o,u,s,n){return i(),c("svg",nC,[...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 aC=I(iC,[["render",lC]]),rC={name:"AddUserForm",components:{SpaceIcon:Ne,SpaceCourseSelector:Rt},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 cC(e,t,o,u,s,n){const m=X,f=de,h=g("SpaceCourseSelector"),y=ee,w=te,b=x,C=ue,p=J("loading");return i(),v(C,{onSubmit:t[4]||(t[4]=z(k=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("User")},{default:r(()=>[a(m,{modelValue:o.user_profile.display_name+" ("+o.user_profile.email+")",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Select Space/Course")},{default:r(()=>[G(a(h,{modelValue:s.selectedId,"onUpdate:modelValue":t[0]||(t[0]=k=>s.selectedId=k),memberships:s.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:n.updateSelectedType,onSelectedSlug:n.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[p,s.loading]])]),_:1},8,["label"]),s.selectedType==="space"?(i(),v(f,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(w,{placeholder:e.$t("Select Role"),modelValue:s.role,"onUpdate:modelValue":t[1]||(t[1]=k=>s.role=k)},{default:r(()=>[a(y,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(y,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(y,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),q(e.$slots,"after_form",{},()=>[a(f,null,{default:r(()=>[s.selectedType==="course"?G((i(),v(b,{key:0,class:"fcom_primary_button",disabled:s.saving||!s.selectedId,onClick:t[2]||(t[2]=k=>n.addToCourse())},{default:r(()=>[V(d(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[p,s.saving]]):G((i(),v(b,{key:1,class:"fcom_primary_button",disabled:s.saving||!s.selectedId,onClick:t[3]||(t[3]=k=>n.addToSpace())},{default:r(()=>[V(d(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[p,s.saving]])]),_:1})])]),_:3})}const dC=I(rC,[["render",cC]]),uC={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:Be()}},components:{UserBadge:ko,ImageUploader:je,BookmarkIcon:eo,FollowAction:st,AddNotificationIcon:oC,NotificationAddedIcon:aC,AddUserForm:dC},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=Ee(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 o;const e=this.auth.user_id,t=(o=this.profile)==null?void 0:o.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,o;if(!((t=this.profile)!=null&&t.user_id)||this.userStore.isBlocked(this.profile.user_id))return!1;const e=(o=this.profile)==null?void 0:o.follow;return this.showFollowAction&&(!e||String(e)!=="0")},isFollowing(){var t,o;if(!((t=this.profile)!=null&&t.user_id))return!1;if(this.userStore.isFollowing(this.profile.user_id))return!0;const e=(o=this.profile)==null?void 0:o.follow;return e!==void 0&&["1","2"].includes(String(e))},isNotificationOn(){var t,o;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((o=this.profile)==null?void 0:o.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 %s's profile photo?",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 %s's cover photo?",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()}}},_C={ref:"fcom_user_profile",class:"object_header user_header"},mC={key:0,class:"object_media_uploader"},hC={class:"object_info"},fC={class:"object_avatar"},pC=["alt","src"],gC=["aria-label"],yC={class:"fcom_avatar_actions"},vC={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":"User Level",class:"fcom_user_level_mark"},bC={class:"object_name"},kC={class:"object_meta"},wC={key:0,class:"object_meta follower"},CC={class:"object_menu"},$C={key:0,class:"fcom_profile_nav"},SC=["href","target"],VC={key:1,class:"fcom_profile_menu_actions"},LC=["target","href"];function MC(e,t,o,u,s,n){var P,O,N,Q,_e,ne,E,K,ae;const m=x,f=g("image-uploader"),h=g("UploadFilled"),y=j,w=fe,b=g("verified-sign"),C=g("UserBadge"),p=g("router-link"),k=g("FollowAction"),$=g("NotificationAddedIcon"),S=g("AddNotificationIcon"),T=g("MoreFilled"),F=Ze,B=Ke,L=Je,D=g("add-user-form"),A=bt,U=J("loading");return G((i(),c("div",_C,[l("div",{style:le({backgroundImage:`url('${n.user_profile.cover_photo||""}')`}),class:H(["object_cover",{no_cover:!n.user_profile.cover_photo}])},[n.isOwnProfile||e.hasPermission("super_admin")?(i(),c("div",mC,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:n.handleCoverPhotoUpload},{default:r(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:r(()=>[V(d(n.getCoverPhotoButtonText),1)]),_:1},8,["title"])]),_:1},8,["onUploaded"]),n.user_profile.cover_photo?(i(),v(m,{key:0,class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(n.removeCoverPhoto,["prevent"])},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",hC,[l("div",fC,[l("img",{alt:e.$t("Placeholder Photo"),src:n.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,pC),n.isOwnProfile||e.hasPermission("super_admin")?(i(),v(w,{key:0,ref:"avatarPopover",trigger:"click",placement:"bottom",width:"fit-content","popper-class":"fcom_avatar_popover",teleported:!1},{reference:r(()=>[l("button",{class:"object_avatar_uploader",type:"button","aria-label":e.$t("Change profile photo")},[a(y,{class:"object_avatar_upload"},{default:r(()=>[a(h)]),_:1})],8,gC)]),default:r(()=>[l("div",yC,[a(f,{additionalData:{resize:!0,max_width:200},onUploaded:n.handlePhotoUpload},{trigger:r(()=>[a(m,{size:"small",text:"",class:"fcom_avatar_action_btn"},{default:r(()=>[V(d(e.$t("Upload")),1)]),_:1})]),_:1},8,["onUploaded"]),n.user_profile.has_custom_avatar?(i(),v(m,{key:0,size:"small",text:"",type:"danger",class:"fcom_avatar_action_btn",onClick:n.removeAvatar},{default:r(()=>[V(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])]),_:1},512)):_("",!0),n.level?(i(),c("div",vC,[l("span",null,d(n.level),1)])):_("",!0)]),l("div",bC,[l("h3",null,[V(d((P=n.user_profile)==null?void 0:P.display_name)+" ",1),(O=n.user_profile)!=null&&O.is_verified?(i(),v(b,{key:0})):_("",!0),a(C,{profile:n.user_profile},null,8,["profile"])]),l("p",kC,"@"+d((N=n.user_profile)==null?void 0:N.username),1),e.hasFeature("followers_module")?(i(),c("div",wC,[((Q=n.user_profile)==null?void 0:Q.followings_count)!=null?(i(),v(p,{key:0,to:{name:"user_followings",params:{username:n.user_profile.username}}},{default:r(()=>[l("span",null,d(n.user_profile.followings_count),1),V(" "+d(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((_e=n.user_profile)==null?void 0:_e.followers_count)!=null?(i(),v(p,{key:1,to:{name:"user_followers",params:{username:n.user_profile.username}}},{default:r(()=>[l("span",null,d(n.user_profile.followers_count),1),V(" "+d(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",CC,[(E=(ne=o.profile)==null?void 0:ne.profile_navs)!=null&&E.length?(i(),c("ul",$C,[(i(!0),c(M,null,R(o.profile.profile_navs,W=>(i(),c("li",{class:H(W.wrapper_class??"")},[W.route?(i(),v(p,{key:0,class:H(W.css_class??""),to:W.route},{default:r(()=>[W.svg_icon?(i(),v(y,{key:0,innerHTML:W.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(W.title),1)]),_:2},1032,["class","to"])):(i(),c("a",{key:1,href:W.url,class:H(W.css_class??""),target:W.is_external?"_blank":"_self"},[W.svg_icon?(i(),v(y,{key:0,innerHTML:W.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(W.title),1)],10,SC))],2))),256))])):_("",!0),n.showActions?(i(),c("div",VC,[(ae=(K=o.profile)==null?void 0:K.profile_nav_actions)!=null&&ae.length?(i(!0),c(M,{key:0},R(o.profile.profile_nav_actions,W=>(i(),c("a",{class:H(W.css_class),target:W.is_external?"_blank":"_self",href:W.url},[W.svg_icon?(i(),v(y,{key:0,innerHTML:W.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(W.title),1)],10,LC))),256)):_("",!0),n.showFollowAction||n.showOtherActions?(i(),c(M,{key:1},[n.showFollowAction?(i(),c(M,{key:0},[o.profile?(i(),v(k,{key:0,profile:o.profile,onRefetch:t[0]||(t[0]=W=>e.$emit("refetch"))},null,8,["profile"])):_("",!0),n.isFollowing?(i(),v(m,{key:1,class:"fcom_secondary_button icon_button",title:n.getTitle,loading:s.updating,disabled:s.updating,onClick:n.toggleEmailNotification},{default:r(()=>[n.isNotificationOn?(i(),v(y,{key:0},{default:r(()=>[a($)]),_:1})):(i(),v(y,{key:1},{default:r(()=>[a(S)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),n.showBlock||n.showOtherActions?(i(),v(L,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(B,null,{default:r(()=>[n.showBlock?(i(),v(F,{key:0,onClick:t[1]||(t[1]=W=>n.confirmAndBlock())},{default:r(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:r(()=>[V(d(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),n.showOtherActions?(i(),v(F,{key:1,onClick:t[2]||(t[2]=W=>n.openAddToDrawer())},{default:r(()=>[a(m,{"aria-label":e.$t("Add User to Space/Course"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"primary"},{default:r(()=>[V(d(e.$t("Add To Space/Course")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0)]),_:1})]),default:r(()=>[a(m,{class:"fcom_dot_menu edit_action",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(T)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(A,{modelValue:s.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=W=>s.isAddUserOpen=W),"close-on-click-modal":!0,"before-close":n.handleDrawerClose,"append-to-body":!0,size:e.modalWidth,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add User to Space/Course")),1)]),default:r(()=>[a(D,{ref:"addUserForm",onCompleted:n.userAdded,user_profile:n.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[U,s.updating]])}const FC=I(uC,[["render",MC]]),TC={name:"ProfileAbout",components:{SocialLinks:Pt},props:["profile","isOwn"]},PC={class:"app_side_widget"},IC={class:"widget_header"},UC={key:0,class:"widget_actions"},EC={key:0,class:"widget_body"},BC=["innerHTML"],AC={key:1,style:{"text-align":"center"}},DC=["title"],RC=["title"];function HC(e,t,o,u,s,n){const m=g("EditPen"),f=j,h=x,y=g("SocialLinks"),w=Y;return i(),c("div",PC,[l("div",IC,[l("h3",null,d(e.$t("About")),1),o.isOwn?(i(),c("div",UC,[a(h,{"aria-label":"Edit Your Profile",onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:o.profile.username}})),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})])):_("",!0)]),o.profile?(i(),c("div",EC,[o.profile.short_description_rendered?(i(),c("div",{key:0,class:"space_description feed_md_content",innerHTML:o.profile.short_description_rendered},null,8,BC)):o.isOwn?(i(),c("div",AC,[t[2]||(t[2]=l("hr",null,null,-1)),a(h,{"aria-label":"Add your profile description",onClick:t[1]||(t[1]=b=>e.$router.push({name:"update_profile",params:{username:o.profile.username}})),type:"info"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d(e.$t("Add your profile description")),1)]),_:1})])):_("",!0),t[3]||(t[3]=l("hr",null,null,-1)),l("div",{title:o.profile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(o.profile.created_at))),9,DC),o.profile.last_activity?(i(),c("div",{key:2,title:o.profile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(o.profile.last_activity))),9,RC)):_("",!0),a(y,{xprofile:o.profile,isOwn:o.isOwn},null,8,["xprofile","isOwn"])])):(i(),v(w,{key:1,animated:!0}))])}const wo=I(TC,[["render",HC]]);const xC={name:"FeedProfile",props:["username"],components:{SpaceMenu:po,Layout:we,AppLayout:Ve,UserHeader:FC,ProfileAbout:wo,RecentActivities:Ht},setup(){return{userStore:Be()}},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 o;const{disable_sidebar:e}=this.$route.meta||{},t=((o=this.profile)==null?void 0:o.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 o=this.$route.params;o.username=this.auth.username,this.$router.push({name:this.$route.name,params:o,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 o=this.$route.params;o.username=this.auth.username,this.$router.push({name:this.$route.name,params:o,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}})}},OC={key:0},jC={key:1},NC={class:"edit_profile"},zC={class:"fcom_profile_box"},qC={key:0,class:"fcom_404_container"},GC={class:"fcom_404_content"},YC={key:1,class:"profile_holder"},WC={key:2},ZC={class:"fcom_main_side_wrap"},KC={class:"widget_recent_activities"};function JC(e,t,o,u,s,n){const m=g("router-link"),f=Xt,h=es,y=x,w=j,b=g("EditPen"),C=g("user-header"),p=Eo,k=g("router-view"),$=Y,S=Me,T=g("ProfileAbout"),F=g("RecentActivities"),B=Qe,L=xe,D=g("layout"),A=g("app-layout");return i(),v(A,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:r(()=>[a(D,{wrapper_class:"no_bg_layout",title:"...."},{title:r(()=>[a(h,null,{default:r(()=>[a(f,null,{default:r(()=>[a(m,{to:{name:"all_members"}},{default:r(()=>[V(d(e.$t("Members")),1)]),_:1})]),_:1}),n.profile?(i(),v(f,{key:0},{default:r(()=>[n.isOwn?(i(),c("span",OC,d(e.$t("My Profile")),1)):(i(),c("span",jC,d(n.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:r(()=>[n.profile&&e.hasPermission("super_admin")&&n.profile.status!="active"?(i(),c(M,{key:0},[n.profile.status?(i(),c(M,{key:0},[l("span",null,d(e.$labelize(n.profile.status)),1),a(y,{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(()=>{n.approveUser()}))},{default:r(()=>[V(d(e.$t("Approve Account")),1)]),_:1})],64)):(i(),v(y,{key:1,disabled:!0},{default:r(()=>[V(d(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),n.profile&&(n.isOwn||e.hasPermission("super_admin"))?(i(),c(M,{key:1},[a(m,{to:{name:"user_notification_settings",params:{username:n.profile.username}},class:"el-button el-button--text fcom_secondary_button"},{default:r(()=>[a(w,null,{default:r(()=>[...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"?(i(),v(y,{key:0,onClick:t[1]||(t[1]=U=>e.$router.push({name:"update_profile",params:{username:n.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1}),l("span",NC,d(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:r(()=>[s.notFound?_("",!0):(i(),v(C,{key:0,username:o.username,isOwn:n.isOwn,profile:n.profile,onRefetch:n.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(L,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(S,{class:"fcom_main"},{default:r(()=>[l("div",zC,[s.notFound?(i(),c("div",qC,[l("div",GC,[a(p,{icon:"error",title:e.$t("Profile Not Found")},{"sub-title":r(()=>[l("p",null,d(e.$t("The user profile you are looking for does not exist or has been removed.")),1)]),extra:r(()=>[e.auth.user_id?(i(),v(y,{key:0,onClick:t[2]||(t[2]=U=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:r(()=>[V(d(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(y,{onClick:t[3]||(t[3]=U=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title"])])])):n.profile?(i(),c("div",YC,[a(k,{isOwn:n.isOwn,username:o.username,profile:n.profile,onRefetch:n.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):n.loading?(i(),c("div",WC,[a($,{rows:10,animated:!0})])):_("",!0)])]),_:1}),n.showWidget?(i(),v(B,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",ZC,[l("div",KC,[e.$route.name!=="user_profile"?(i(),v(T,{key:0,isOwn:n.isOwn,profile:n.profile},null,8,["isOwn","profile"])):n.profile?(i(),v(F,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:n.profile.user_id}},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const QC=I(xC,[["render",JC],["__scopeId","data-v-e1eb6fea"]]),XC={name:"LockedProfile"},e$={class:"space_lock_box"},t$={class:"lock_header"},s$={class:"lock_desc"},o$=["href"];function i$(e,t,o,u,s,n){const m=g("Lock"),f=j;return i(),c("div",e$,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",t$,d(e.$t("This profile is private")),1),l("p",s$,d(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(i(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login / Signup")),9,o$)):_("",!0)])}const pt=I(XC,[["render",i$]]),n$={name:"ProfileFeeds",components:{AllFeeds:ft,ErrorIcon:Ys,LockedProfile:pt},props:["profile","isOwn","username"],emits:["refetch"],setup(){return{uiStore:Ge()}},beforeRouteLeave(e,t,o){if(e.name==="single_feed"||e.name==="space_feed"){let s=0;window.fcomLayoutRef&&window.fcomLayoutRef.wrapRef&&(s=window.fcomLayoutRef.wrapRef.scrollTop),this.uiStore.saveScrollPosition(t.path,s)}else this.uiStore.clearScrollPosition();o()},methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},l$={key:0,class:"fcom_feed_report_wrap"},a$={class:"fcom_feed_report_content"},r$={class:"fcom_feed_report_action"};function c$(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("ErrorIcon"),h=x,y=g("all-feeds");return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c(M,{key:1},[o.profile.scheduled_posts_count?(i(),c("div",l$,[l("div",a$,[a(f),l("span",null,d(e.$t("You currently have %s scheduled posts to be published",o.profile.scheduled_posts_count)),1)]),l("div",r$,[a(h,{onClick:t[0]||(t[0]=w=>n.openScheduledPosts())},{default:r(()=>[V(d(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(y,{feed_name:"profile_feed",require_space_selection:e.appVars.features.disable_global_posts,user_id:o.profile.user_id,hide_create_form:o.profile.user_id!=e.auth.user_id},null,8,["require_space_selection","user_id","hide_create_form"])],64))}const d$=I(n$,[["render",c$]]),u$={name:"ScheduledPosts",components:{Feed:ot,Pagination:Se,EditFeed:rs,AlarmClock:qo},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 o=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":o+":"+(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("HH:mm")},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(o=>o.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.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()}},_$={class:"scheduled_posts_header"},m$={class:"fcom_scheduled_posts_title"},h$={key:0},f$={key:1},p$={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},g$={class:"all_feeds_holder"},y$={class:"actions_items"},v$=["onClick"],b$=["onClick"],k$=["onClick"],w$={class:"feed_user"},C$={class:"feed_user_name"},$$={class:"feed_meta_info"},S$=["title","href"],V$={key:0},L$={class:"post_actions"},M$={key:2,class:"feed_outer"},F$={class:"feed"},T$={style:{"text-align":"center"},class:"feed_body not_found"},P$={class:"dialog_header"},I$={class:"dialog_left schedule_header_left"},U$={class:"dialog_body"},E$={class:"dialog_footer"};function B$(e,t,o,u,s,n){const m=g("AlarmClock"),f=j,h=Y,y=g("MoreFilled"),w=x,b=fe,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("router-link"),$=g("feed"),S=g("edit-feed"),T=Ye,F=de,B=$s,L=ue,D=$e,A=g("pagination");return i(),c(M,null,[l("div",_$,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("div",m$,[l("h3",null,d(e.$t("Scheduled Posts")),1),n.isPostCount?(i(),c("p",h$,d(e.$t("You currently have %s scheduled posts to be published",o.profile.scheduled_posts_count)),1)):(i(),c("p",f$,d(e.$t("You have no scheduled posts to be published")),1))])]),s.loading?(i(),v(h,{key:0,rows:5,animated:!0})):s.feeds.length?(i(),c("div",p$,[l("div",g$,[(i(!0),c(M,null,R(s.feeds,U=>(i(),c("div",{key:U.id,class:"feed_outer"},[a($,{feed:U,layout_style:"timeline",hide_create_form:!0,show_footer:!1,show_actions:!1},{after_feed_actions:r(()=>[a(b,{persistent:!1,ref_for:!0,ref:"actionsPopover",placement:"bottom",width:200,trigger:"click",visible:n.isPopoverVisible(U),onHide:P=>n.hidePopover(U)},{reference:r(()=>[a(w,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:P=>n.togglePopover(U)},{default:r(()=>[a(f,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[l("ul",y$,[l("li",{onClick:P=>n.copyFeedLink(U)},d(e.$t("Copy Link")),9,v$),e.canEditFeed(U)?(i(),c("li",{key:0,onClick:P=>n.editItem(U)},d(e.$t("Edit")),9,b$)):_("",!0),e.canDeleteFeed(U)?(i(),c("li",{key:1,onClick:P=>n.deleteItem(U)},d(e.$t("Delete")),9,k$)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:r(()=>[l("div",w$,[a(C,{with_level:!1,xprofile:o.profile},null,8,["xprofile"]),l("div",null,[l("div",C$,[a(p,{show_badge:!0,xprofile:o.profile},null,8,["xprofile"])]),l("div",$$,[l("a",{title:U.created_at,onClick:t[0]||(t[0]=(...P)=>e.gotoFeed&&e.gotoFeed(...P)),href:U.permalink,class:"feed_timestamp"},d(n.getScheduledTime(U.scheduled_at)),9,S$),U.space?(i(),c("span",V$,[a(k,{to:n.getSpaceRoute(U.space.slug),class:"feed_timestamp"},{default:r(()=>[V(d(e.$t("Posted in %s",e.getExcerpt(U.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:r(()=>[l("div",L$,[a(w,{class:"fcom_secondary_button",onClick:P=>n.initReschedule(U),disabled:s.saving},{default:r(()=>[V(d(e.$t("Reschedule Post")),1)]),_:1},8,["onClick","disabled"]),a(w,{class:"fcom_secondary_button",onClick:P=>n.publishNow(U),disabled:s.saving},{default:r(()=>[V(d(e.$t("Publish Now")),1)]),_:1},8,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),s.isEdit&&s.editingFeed?(i(),v(S,{key:0,feedSlug:s.editingFeed.slug,dialogVisible:s.isEdit,onUpdated:n.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=U=>s.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(i(),c("div",M$,[l("div",F$,[l("div",T$,[l("p",null,d(e.$t("No scheduled posts found!")),1)])])])),a(D,{modelValue:s.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=U=>s.scheduleModalVisible=U),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:n.cancelReschedule},{header:r(()=>[l("div",P$,[l("div",I$,[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:r(()=>[l("div",E$,[a(w,{class:"fcom_secondary_button",disabled:s.saving,onClick:n.cancelReschedule},{default:r(()=>[V(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(w,{class:"fcom_primary_button",disabled:s.saving,onClick:n.reschedulePost},{default:r(()=>[V(d(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",U$,[a(L,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(F,{label:e.$t("Date")},{default:r(()=>[a(T,{modelValue:s.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=U=>s.scheduleForm.date=U),type:"date","value-format":"YYYY-MM-DD",format:"YYYY-MM-DD",placeholder:e.$t("Select Date"),"disabled-date":n.isDateDisabled},null,8,["modelValue","placeholder","disabled-date"])]),_:1},8,["label"]),a(F,{label:e.$t("Time")},{default:r(()=>[a(B,{modelValue:s.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=U=>s.scheduleForm.time=U),disabled:!s.scheduleForm.date,style:{width:"210px"},step:"00:10",start:n.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","start","placeholder"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","width","onClose"]),a(A,{pagination:s.pagination,onFetch:n.fetchFeeds},null,8,["pagination","onFetch"])],64)}const A$=I(u$,[["render",B$]]),D$={name:"UserSpaces",props:["profile"],components:{Calendar:Go,Baseball:Yo,GroupIcon:Ot,GlobIcon:bo,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()}},R$={key:1,class:"user_spaces"},H$={class:"fcom_box_card_list"},x$=["onClick"],O$=["src"],j$=["src"],N$={key:2,class:"fcom_no_image"},z$={class:"fcom_box_card_info"},q$={class:"fcom_box_card_name"},G$={class:"fcom_box_card_details"},Y$={class:"details_item"},W$={key:0,class:"details_item"},Z$={class:"fcom_box_card_action"},K$=["onClick"],J$={key:0,class:"loading"},Q$={key:1},X$={class:"no_members"},e7={key:2,class:"no_members"};function t7(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("router-link"),h=g("MoreFilled"),y=j,w=x,b=Ze,C=Ke,p=Je,k=g("GlobIcon"),$=g("Lock"),S=g("GroupIcon"),T=Y;return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c("div",R$,[l("div",H$,[(i(!0),c(M,null,R(s.communities,F=>{var B;return i(),c("div",{key:F.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:L=>n.goToSpaceFeeds(F.slug)},[(B=F.settings)!=null&&B.og_image?(i(),c("img",{key:0,src:F.settings.og_image,alt:""},null,8,O$)):F.cover_photo?(i(),c("img",{key:1,src:F.cover_photo,alt:""},null,8,j$)):(i(),c("div",N$))],8,x$),l("div",z$,[l("div",q$,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:F.slug}}},{default:r(()=>[V(d(n.getExcerpt(F.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(i(),v(p,{key:0,trigger:"click"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:L=>n.removeMembership(F.slug)},{default:r(()=>[V(d(e.$t("Remove from space")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(w,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",G$,[l("div",Y$,[F.privacy==="public"?(i(),v(y,{key:0},{default:r(()=>[a(k)]),_:1})):(i(),v(y,{key:1},{default:r(()=>[a($)]),_:1})),l("span",null,d(F.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),F.members_count?(i(),c("div",W$,[a(y,null,{default:r(()=>[a(S)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(F.members_count))),1)])):_("",!0)]),l("div",Z$,[l("button",{class:"fcom_card_button",onClick:L=>n.goToSpaceFeeds(F.slug)},d(n.getBtnLevel(F.type)),9,K$)])])])}),128))]),s.loading?(i(),c("div",J$,[a(T,{class:"white_loaded",rows:3,animated:!0}),a(T,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):o.profile.canViewUserSpaces?!s.loading&&!s.communities.length?(i(),c("div",e7,d(e.$t("No Spaces found.")),1)):_("",!0):(i(),c("div",Q$,[l("div",X$,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const s7=I(D$,[["render",t7]]),o7={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})}}},i7={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},n7={class:"about_header"},l7={class:"about_body fcom_mt_10"},a7={class:"fcom_mt_20"};function r7(e,t,o,u,s,n){const m=x;return i(),c("div",i7,[l("div",n7,[l("h3",null,d(e.$t("Account Deactivation")),1)]),l("div",l7,[s.selection=="init"?(i(),c(M,{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=>s.selection="deactivate"),class:"fcom_secondary_button fcom_mt_20"},{default:r(()=>[V(d(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):s.selection=="deactivate"?(i(),c(M,{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",a7,[a(m,{onClick:t[1]||(t[1]=f=>s.selection="init"),class:"fcom_secondary_button"},{default:r(()=>[V(d(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>n.deactivateAccount()),type:"danger"},{default:r(()=>[V(d(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const c7=I(o7,[["render",r7]]),d7={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:Et,MarkdownEditor:Vt,AccountDeactivation:c7},setup(){const e=Be(),t=ie();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}},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,short_description:e.short_description,user_id:e.user_id,is_verified:e.is_verified,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||[]}},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}},isEmpty:ss,getCustomFieldValues(e){const t={},o=e.custom_field_groups||[];for(const u of o)for(const s of u.fields||[])s.slug&&(t[s.slug]=s.value!==void 0?s.value:"");return t}},async mounted(){await this.userStore.fetchProfile(this.username,!0),this.$nextTick(()=>{const e=document.querySelector(".object_info");e&&window.scrollTo({top:e.offsetTop-100,behavior:"smooth"})})}},u7={key:0,class:"fcom_sub_group fcom_additional_info"},_7={class:"fcom_sub_group_header"},m7={key:0},h7={class:"fcom_sub_group_content"},f7={key:0,class:"fcom_sub_group"},p7={class:"fcom_sub_group_header"},g7={class:"fcom_sub_group_content"},y7={key:1,class:"fcom_mb_20"},v7={key:0,class:"fcom_sub_group"},b7={class:"fcom_sub_group_header"},k7={key:1},w7={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},C7={key:2,class:"help_msg"},$7={class:"fcom_sub_group"},S7={class:"fcom_fixed_bottom_overlay"};function V7(e,t,o,u,s,n){const m=X,f=de,h=_t,y=mt,w=g("markdown-editor"),b=Ye,C=ee,p=te,k=Ae,$=be,S=j,T=pe,F=g("UserBadge"),B=g("slug-input"),L=x,D=ue,A=g("account-deactivation"),U=J("loading");return i(),c(M,null,[l("div",{class:H([{fcom_is_dirty:s.fcom_is_dirty},"fcom_update_profile"])},[a(D,{onSubmit:t[9]||(t[9]=z(P=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:s.profileData,"onUpdate:modelValue":t[10]||(t[10]=P=>s.profileData=P)},{default:r(()=>[a(y,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("First Name"),required:""},{default:r(()=>[a(m,{modelValue:s.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=P=>s.profileData.first_name=P)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Last Name")},{default:r(()=>[a(m,{modelValue:s.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=P=>s.profileData.last_name=P)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(y,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{disabled:!o.profile.can_change_email,modelValue:s.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=P=>s.profileData.email=P)},null,8,["disabled","modelValue"])]),_:1},8,["label"])]),_:1}),a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Website URL")},{default:r(()=>[a(m,{type:"url",modelValue:s.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=P=>s.profileData.website=P)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:r(()=>[a(w,{disable_mention:!0,disable_media:!0,modelValue:s.profileData.short_description,"onUpdate:modelValue":t[4]||(t[4]=P=>s.profileData.short_description=P)},null,8,["modelValue"])]),_:1},8,["label"]),(i(!0),c(M,null,R(n.customFieldGroups,P=>(i(),c(M,{key:P.slug},[P.fields&&P.fields.length?(i(),c("div",u7,[l("div",_7,[l("h5",null,d(P.label),1),P.edit_description?(i(),c("p",m7,d(P.edit_description),1)):_("",!0)]),l("div",h7,[(i(!0),c(M,null,R(P.fields,O=>(i(),v(f,{key:O.slug,label:O.label,required:O.is_required},{default:r(()=>[O.type==="text"?(i(),v(m,{key:0,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="textarea"?(i(),v(m,{key:1,type:"textarea",rows:3,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="number"?(i(),v(m,{key:2,type:"number",modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="date"?(i(),v(b,{key:3,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,type:"date","value-format":"YYYY-MM-DD",placeholder:O.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="select"?(i(),v(p,{key:4,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder,clearable:""},{default:r(()=>[(i(!0),c(M,null,R(O.options,N=>(i(),v(C,{key:N,label:N,value:N},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="multiselect"?(i(),v(p,{key:5,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder,multiple:!0,clearable:""},{default:r(()=>[(i(!0),c(M,null,R(O.options,(N,Q)=>(i(),v(C,{key:Q,label:N,value:Q},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):O.type==="radio"?(i(),v($,{key:6,modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N},{default:r(()=>[(i(!0),c(M,null,R(O.options,N=>(i(),v(k,{key:N,value:N},{default:r(()=>[V(d(N),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):O.type==="url"?(i(),v(m,{key:7,type:"url",modelValue:s.profileData.custom_fields[O.slug],"onUpdate:modelValue":N=>s.profileData.custom_fields[O.slug]=N,placeholder:O.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),n.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(i(),c("div",f7,[l("div",p7,[l("h5",null,d(e.$t("Social Links")),1),l("p",null,d(e.$t("Add your social media profile link.")),1)]),l("div",g7,[(i(!0),c(M,null,R(e.appVars.socialLinkProviders,(P,O)=>(i(),v(f,{key:O,label:P.title},{default:r(()=>[a(m,{placeholder:P.placeholder,modelValue:s.profileData.social_links[O],"onUpdate:modelValue":N=>s.profileData.social_links[O]=N},{prepend:r(()=>[a(S,{innerHTML:P.icon_svg},null,8,["innerHTML"]),l("span",null,d(P.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),o.profile.can_change_username?(i(),c("div",y7,[e.hasPermission("super_admin")?(i(),c("div",v7,[l("div",b7,[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:r(()=>[a(T,{"true-value":1,"false-value":0,modelValue:s.profileData.is_verified,"onUpdate:modelValue":t[5]||(t[5]=P=>s.profileData.is_verified=P),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Mark this account as verified")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),e.appVars.user_badges?(i(),v(f,{key:0,label:e.$t("Profile Badges")},{default:r(()=>[a(p,{clearable:"",multiple:!0,modelValue:s.profileData.badge_slugs,"onUpdate:modelValue":t[6]||(t[6]=P=>s.profileData.badge_slugs=P),placeholder:e.$t("User Profile Badge")},{default:r(()=>[(i(!0),c(M,null,R(e.appVars.user_badges,P=>(i(),v(C,{key:P.slug,label:P.title,value:P.slug},{default:r(()=>[a(F,{badge:P,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:r(()=>[a($,{modelValue:s.profileData.status,"onUpdate:modelValue":t[7]||(t[7]=P=>s.profileData.status=P),class:"fcom_radio_group"},{default:r(()=>[a(k,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(k,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending")),1)]),_:1}),a(k,{value:"blocked"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),s.profileData.status?s.profileData.status!="active"?(i(),c("div",C7,[l("p",null,d(e.$t("The user cannot access the portal.")),1)])):_("",!0):(i(),c("div",k7,[l("p",w7,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",$7,[a(f,{label:e.$t("Community Account Username")},{default:r(()=>[a(B,{is_inital_inactive:!0,modelValue:s.profileData.username,"onUpdate:modelValue":t[8]||(t[8]=P=>s.profileData.username=P),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:r(()=>[l("div",S7,[G((i(),v(L,{class:"fcom_primary_button",onClick:n.updateProfile,disabled:s.updating},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[U,s.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),e.hasFeature("can_deactivate_account")&&o.profile.username==e.appVars.auth.username?(i(),v(A,{key:0,profile:o.profile},null,8,["profile"])):_("",!0)],64)}const L7=I(d7,[["render",V7]]),M7={name:"UserAbout",props:["profile","isOwn"],components:{Timer:As,CalendarIcon:Qs,LockedProfile:pt},computed:{hasSocialLinks(){return this.socialLinks.length>0},visibleGroups(){return(this.profile.custom_field_groups||[]).filter(t=>t.fields&&t.fields.some(o=>this.hasFieldValue(o.value)))},socialLinks(){var u,s;let e=(u=this.profile)==null?void 0:u.social_links;e||(e=(s=this.profile.meta)==null?void 0:s.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 o=this.appVars.socialLinkProviders;return Object.entries(o).forEach(([n,m])=>{e[n]&&t.push({title:m.title,icon:m.icon_svg,text:e[n],url:m.domain+e[n]})}),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}}},F7={key:1,class:"about_wrap"},T7={class:"about_header"},P7={key:0,class:"about_body"},I7=["innerHTML"],U7={key:1},E7={class:"about_items"},B7=["title"],A7=["title"],D7={class:"items_title"},R7={key:0,class:"about_item"},H7={class:"about_item_label"},x7=["href"],O7={key:1},j7={key:2,class:"about_items"},N7={key:0,class:"items_title"},z7=["href","title"];function q7(e,t,o,u,s,n){const m=g("LockedProfile"),f=g("EditPen"),h=j,y=x,w=g("CalendarIcon"),b=g("Timer"),C=Y;return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c("div",F7,[l("div",T7,[l("h3",null,d(e.$t("About")),1),o.isOwn?(i(),v(y,{key:0,"aria-label":"Edit your profile description",onClick:n.goToUpdateProfile,text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["onClick"])):_("",!0)]),o.profile?(i(),c("div",P7,[o.profile.short_description_rendered?(i(),c("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:o.profile.short_description_rendered},null,8,I7)):o.isOwn?(i(),c("div",U7,[a(y,{class:"fcom_plain_button",onClick:t[0]||(t[0]=p=>e.$router.push({name:"update_profile",params:{username:o.profile.username}}))},{default:r(()=>[l("span",null,d("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",E7,[o.profile.created_at?(i(),c("div",{key:0,title:o.profile.created_at,class:"about_item"},[a(h,null,{default:r(()=>[a(w)]),_:1}),l("span",null,d(e.$t("Joined %s",e.humanDateDiff(o.profile.created_at))),1)],8,B7)):_("",!0),o.profile.last_activity?(i(),c("div",{key:1,title:o.profile.last_activity,class:"about_item"},[a(h,null,{default:r(()=>[a(b)]),_:1}),V(" "+d(e.$t("Last seen: %s",e.humanDateDiff(o.profile.last_activity))),1)],8,A7)):_("",!0)]),(i(!0),c(M,null,R(n.visibleGroups,p=>(i(),c("div",{key:p.slug,class:"about_items"},[l("div",D7,d(p.label),1),(i(!0),c(M,null,R(p.fields,k=>(i(),c(M,{key:k.slug},[n.hasFieldValue(k.value)?(i(),c("div",R7,[l("span",H7,d(k.label)+":",1),k.type==="url"&&k.value?(i(),c("a",{key:0,href:k.value,target:"_blank",rel:"noopener noreferrer"},d(k.value),9,x7)):(i(),c("span",O7,d(n.formatFieldValue(k)),1))])):_("",!0)],64))),128))]))),128)),n.hasSocialLinks||o.isOwn?(i(),c("div",j7,[n.hasSocialLinks?(i(),c("div",N7,d(e.$t("Social Links")),1)):_("",!0),(i(!0),c(M,null,R(n.socialLinks,p=>(i(),c("a",{target:"_blank",rel:"noopener noreferrer",href:p.url,key:p.title,title:p.title,class:"about_item"},[a(h,{innerHTML:p.icon},null,8,["innerHTML"]),V(" "+d(p.text),1)],8,z7))),128)),o.isOwn&&!n.hasSocialLinks?(i(),v(y,{key:1,class:"fcom_plain_button",onClick:n.goToUpdateProfile},{default:r(()=>[l("span",null,d("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(i(),v(C,{key:1,animated:!0}))]))}const G7=I(M7,[["render",q7]]),Y7={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:Se,Check:Ds,ImageIcon:is,FeedMdContent:Ft,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(o=>{this.comments.splice(t,1),this.$notify.success(o.message)}).catch(o=>{this.$handleError(o)}).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 o;let t=(o=e.post)==null?void 0:o.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}}},getPostExcerpt(e){let t=e.type;t=="text"&&(t="");let o="";return e.title?o=e.title:o=this.getExcerpt(e.message,50),o+(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),o={};e.forEach((u,s)=>{var f;const n=(f=u==null?void 0:u.$refs)==null?void 0:f.content,m=t[s];n&&m&&(o[m.id]=n.scrollHeight>n.clientHeight+1)}),this.canExpandMap=o}},mounted(){this.profile.is_restricted||this.fetchComments()}},W7={key:1,class:"white_loaded"},Z7={class:"course_comments feed_comments user_comments"},K7={class:"comment_text_head"},J7=["title"],Q7={class:"comment_action"},X7={class:"comment_text_head_post"},e9={class:"comment_text"},t9=["onClick"],s9={key:1,class:"comment_text_body feed_md_content media_only_content"},o9={key:0};function i9(e,t,o,u,s,n){const m=g("LockedProfile"),f=Y,h=g("Delete"),y=j,w=x,b=g("router-link"),C=g("FeedMdContent"),p=g("ImageIcon"),k=g("pagination");return o.profile.is_restricted?(i(),v(m,{key:0})):s.loading?(i(),c("div",W7,[a(f,{row:5})])):(i(),c(M,{key:2},[l("div",Z7,[(i(!0),c(M,null,R(s.comments,($,S)=>(i(),c("div",{key:$.id,class:"fcom_course_comment each_comment"},[t[0]||(t[0]=l("span",{class:"comment_icon"},null,-1)),l("div",K7,[l("div",{title:$.created_at,class:"comment_text_head_time"},d(e.humanDateDiff($.created_at)),9,J7),l("div",Q7,[o.isOwn?(i(),v(w,{key:0,class:"fcom_plain_button",onClick:T=>n.deleteComment($,S)},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0)])]),l("div",X7,[a(b,{class:"post_link",to:n.getPostRoute($)},{default:r(()=>[V(d(n.getPostExcerpt($.post)),1)]),_:2},1032,["to"])]),l("div",e9,[$.message_rendered?(i(),c(M,{key:0},[a(C,{ref_for:!0,ref:"commentBody",class_name:n.contentClass($.id),content:$.message_rendered},null,8,["class_name","content"]),s.canExpandMap[$.id]?(i(),c("button",{key:0,type:"button",class:"fcom_see_more_btn",onClick:T=>n.toggleExpand($.id)},d(s.expandedMap[$.id]?e.$t("See less"):e.$t("See more")),9,t9)):_("",!0)],64)):(i(),c("div",s9,[a(p,{class:"fcom_status_img_icon"})]))])]))),128)),s.pagination.total?_("",!0):(i(),c("div",o9,[l("h5",null,d(e.$t("%s did not add any comment to any posts yet",o.profile.display_name)),1)]))]),a(k,{pagination:s.pagination,onFetch:n.fetchComments},null,8,["pagination","onFetch"])],64))}const n9=I(Y7,[["render",i9]]),l9={name:"UserCourses",props:["profile","isOwn"],components:{MoreFilled:Rs,GroupIcon:Ot,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()}},a9={key:1,class:"user_courses"},r9={key:0,class:"fcom_box_card_list"},c9=["onClick"],d9=["src","alt"],u9={key:1,class:"fcom_no_image"},_9={class:"fcom_box_card_info"},m9={class:"fcom_box_card_name"},h9={class:"fcom_box_card_details"},f9={class:"inline_details"},p9={key:0,class:"inline_details"},g9={key:0,class:"fcom_box_card_description"},y9={class:"fcom_box_card_action"},v9=["onClick"],b9=["onClick"],k9={key:1,class:"loading"},w9={key:2},C9={class:"no_members"},$9={key:3,class:"fcom_no_items_wrap"},S9={key:0},V9={key:1};function L9(e,t,o,u,s,n){const m=g("LockedProfile"),f=Ue,h=g("router-link"),y=g("MoreFilled"),w=j,b=x,C=Ze,p=Ke,k=Je,$=g("GroupIcon"),S=Y;return o.profile.is_restricted?(i(),v(m,{key:0})):(i(),c("div",a9,[s.courses.length?(i(),c("div",r9,[(i(!0),c(M,null,R(s.courses,T=>(i(),c("div",{key:T.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:F=>n.goToCourse(T.slug)},[T.cover_photo?(i(),c("img",{key:0,src:T.cover_photo,alt:T.title},null,8,d9)):(i(),c("div",u9))],8,c9),l("div",_9,[l("div",m9,[a(h,{class:"course_route",to:{name:"view_course",params:{course_slug:T.slug}}},{default:r(()=>[V(d(T.title)+" ",1),T.status=="draft"?(i(),v(f,{key:0,type:"info"},{default:r(()=>[V(d(T.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"]),e.isAdmin()?(i(),v(k,{key:0,trigger:"click"},{dropdown:r(()=>[a(p,null,{default:r(()=>[a(C,{onClick:F=>n.removeMembership(T.slug)},{default:r(()=>[V(d(e.$t("Remove from course")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(b,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",h9,[l("div",f9,[l("span",null,d(e.$_n("%d Section","%d Sections",T.sectionsCount)),1),t[0]||(t[0]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,d(e.$_n("%d Lesson","%d Lessons",T.lessonsCount)),1)]),T.studentsCount?(i(),c("div",p9,[a(w,null,{default:r(()=>[a($)]),_:1}),V(" "+d(e.$_n("%s student","%s students",e.$formatNumber(T.studentsCount))),1)])):_("",!0)]),T.description?(i(),c("div",g9,d(e.getExcerpt(T.description)),1)):_("",!0),l("div",y9,[T.isEnrolled?(i(),c("button",{key:0,class:"fcom_card_button",onClick:F=>n.goToCourse(T.slug)},d(e.$t("%s Completed",T.progress+"%")),9,v9)):(i(),c("button",{key:1,class:"fcom_card_button",onClick:F=>n.goToCourse(T.slug)},d(e.$t("View Course")),9,b9))])])]))),128))])):_("",!0),s.loading?(i(),c("div",k9,[a(S,{class:"white_loaded",rows:3,animated:!0}),a(S,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):o.profile.canViewUserSpaces?s.courses.length?_("",!0):(i(),c("div",$9,[l("h3",null,d(e.$t("No courses yet")),1),o.isOwn?(i(),c("p",S9,d(e.$t("Courses you enroll in will appear here.")),1)):(i(),c("p",V9,d(e.$t("This member has not enrolled in any courses yet.")),1))])):(i(),c("div",w9,[l("div",C9,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const M9=I(l9,[["render",L9]]);const F9={name:"NotificationPref",components:{NotificationOnboard:ao,Notification:Wo},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:""}},computed:{fcom_is_dirty(){return this.initialState?JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)!=this.initialState:!1}},methods:{getPrefs(){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.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})},saveSettings(){this.saving=!0;let e={};this.spaceGroups.forEach(t=>{t.spaces.forEach(o=>{e[o.id]=o.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.auth.user_id||this.hasPermission("super_admin"))&&this.getPrefs()}},T9={class:"fcom_notification_config"},P9={key:0},I9=["innerHTML"],U9={key:1,class:"white_loaded"},E9={class:"fcom_notification_card"},B9={class:"fcom_notification_card__header"},A9={class:"fcom_notification_card__title"},D9={class:"fcom_notification_card__body"},R9={class:"fcom_input_wrap"},H9={key:0},x9={key:1,class:"fcom_not_enabled"},O9={class:"fcom_input_wrap"},j9={key:0},N9={key:1,class:"fcom_not_enabled"},z9={class:"fcom_input_wrap"},q9={key:0},G9={key:1,class:"fcom_not_enabled"},Y9={class:"fcom_input_wrap"},W9={key:0},Z9={key:1,class:"fcom_not_enabled"},K9={key:0,class:"fcom_input_wrap"},J9={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},Q9={key:0,class:"fcom_not_enabled"},X9={key:1,class:"fcom_not_enabled"},eS={key:2,class:"fcom_not_enabled"},tS={class:"fcom_notification_card"},sS={class:"fcom_notification_card__header"},oS={class:"fcom_notification_card__title"},iS={class:"fcom_card_sections fcom_course_type_structured"},nS={class:"fcom_section_labels"},lS={class:"fcom_lebel fcom_label_lesson"},aS={style:{"text-align":"right"},class:"fcom_lebel fcom_label_actions"},rS={class:"fcom_section_primary"},cS={class:"fcom_section_primary_item"},dS={class:"fcom_section_primary_item_title"},uS={class:"fcom_section_items"},_S={class:"fcom_section_item"},mS={class:"fcom_section_item_title"},hS=["innerHTML"],fS=["innerHTML"],pS={key:2,class:"fcom_no_avatar"},gS={class:"fcom_section_item_actions"},yS={key:1,class:"fcom_section_labels"},vS={class:"fcom_notification_card fcom_fixed_bottom_overlay"},bS={key:3},kS={key:0},wS=["href"];function CS(e,t,o,u,s,n){const m=Y,f=g("NotificationOnboard"),h=g("Notification"),y=j,w=pe,b=Ae,C=be,p=ee,k=te,$=x;return i(),c("div",T9,[s.error?(i(),c("div",P9,[l("p",{innerHTML:s.error},null,8,I9)])):s.loading?(i(),c("div",U9,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&s.pref?(i(),c("div",{key:2,class:H([{fcom_is_dirty:n.fcom_is_dirty},"fcom_notification_config_body"])},[a(f),l("div",E9,[l("div",B9,[a(y,{style:{"font-size":"30px"}},{default:r(()=>[a(h)]),_:1}),l("div",A9,[l("h3",null,d(e.$t("Global Email Notifications")),1),l("p",null,d(e.$t("These settings will be applied across all spaces you're a member of.")),1)])]),l("div",D9,[l("div",R9,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.com_my_post_mail,"onUpdate:modelValue":t[0]||(t[0]=S=>s.pref.com_my_post_mail=S),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone comments on my post")),1)]),_:1},8,["modelValue"]),s.pref.com_my_post_mail=="yes"?(i(),c("p",H9,d(e.$t("You will receive an email when someone leaves a comment on your post.")),1)):(i(),c("p",x9,d(e.$t("No email will be sent for comments on your post.")),1))]),l("div",O9,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.reply_my_com_mail,"onUpdate:modelValue":t[1]||(t[1]=S=>s.pref.reply_my_com_mail=S),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone replies to my comments")),1)]),_:1},8,["modelValue"]),s.pref.reply_my_com_mail=="yes"?(i(),c("p",j9,d(e.$t("You will receive an email when someone replies to your comments.")),1)):(i(),c("p",N9,d(e.$t("No email will be sent when someone replies to your comments.")),1))]),l("div",z9,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.mention_mail,"onUpdate:modelValue":t[2]||(t[2]=S=>s.pref.mention_mail=S),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Email me when someone mentions me in a post or comment")),1)]),_:1},8,["modelValue"]),s.pref.mention_mail=="yes"?(i(),c("p",q9,d(e.$t("You will receive an email when someone mentions you in a comment or post.")),1)):(i(),c("p",G9,d(e.$t("No emails will be sent when someone mentions you.")),1))]),l("div",Y9,[a(w,{"true-value":"yes","false-value":"no",modelValue:s.pref.digest_mail,"onUpdate:modelValue":t[3]||(t[3]=S=>s.pref.digest_mail=S),class:"fcom_checkbox"},{default:r(()=>[V(d(e.$t("Weekly digest on %s",s.digestEmailDay)),1)]),_:1},8,["modelValue"]),s.pref.digest_mail=="yes"?(i(),c("p",W9,d(e.$t("You will get a digest email with curated activities in the community")),1)):(i(),c("p",Z9,d(e.$t("No digest email will be sent.")),1))]),e.appVars.has_chat&&s.default_messaging_email_frequency!="no"?(i(),c("div",K9,[l("p",J9,d(e.$t("Email sending frequency for one-to-one messages")),1),a(C,{modelValue:s.pref.message_email_frequency,"onUpdate:modelValue":t[4]||(t[4]=S=>s.pref.message_email_frequency=S),class:"fcom_radio_group"},{default:r(()=>[s.default_messaging_email_frequency!=="disabled"?(i(),v(b,{key:0,value:"default",label:e.$t("Community Default")},null,8,["label"])):_("",!0),a(b,{value:"hourly",label:e.$t("Hourly")},null,8,["label"]),a(b,{value:"daily",label:e.$t("Daily")},null,8,["label"]),a(b,{value:"weekly",label:e.$t("Weekly")},null,8,["label"]),a(b,{value:"disabled",label:e.$t("Disable")},null,8,["label"])]),_:1},8,["modelValue"]),s.pref.message_email_frequency=="disabled"?(i(),c("p",Q9,d(e.$t("You will not get any email on new messages from any members")),1)):s.pref.message_email_frequency=="default"?(i(),c("p",X9,[s.default_messaging_email_frequency=="disabled"?(i(),c(M,{key:0},[V(d(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(i(),c(M,{key:1},[V(d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(s.default_messaging_email_frequency))),1)],64))])):(i(),c("p",eS,d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(s.pref.message_email_frequency))),1))])):_("",!0)])]),l("div",tS,[l("div",sS,[a(y,{style:{"font-size":"30px"}},{default:r(()=>[...t[5]||(t[5]=[l("svg",{version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"},[l("g",null,[l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"})])],-1)])]),_:1}),l("div",oS,[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",iS,[s.spaceGroups.length>0?(i(),c(M,{key:0},[l("div",nS,[l("div",lS,d(e.$t("Space")),1),l("div",aS,d(e.$t("Notification")),1)]),(i(!0),c(M,null,R(s.spaceGroups,S=>(i(),c("div",{key:S.id},[l("div",rS,[l("div",cS,[l("div",dS,[l("h4",null,d(S.title),1)])])]),l("div",uS,[(i(!0),c(M,null,R(S.spaces,T=>(i(),c("div",_S,[l("div",mS,[T.icon?(i(),v(y,{key:0},{default:r(()=>[l("span",{innerHTML:T.icon},null,8,hS)]),_:2},1024)):T.shape_svg?(i(),c("span",{key:1,innerHTML:T.shape_svg},null,8,fS)):(i(),c("span",pS)),l("span",null,d(T.title),1)]),l("div",gS,[a(k,{size:"small",placeholder:e.$t("Email Disabled"),style:{width:"100%","max-width":"200px"},modelValue:T.pref,"onUpdate:modelValue":F=>T.pref=F},{default:r(()=>[a(p,{label:e.$t("Email Disabled"),value:""},null,8,["label"]),a(p,{label:e.$t("Notify only for Admin Posts"),value:"admin_only_posts"},null,8,["label"]),a(p,{label:e.$t("Notify for all posts"),value:"all_member_posts"},null,8,["label"])]),_:1},8,["placeholder","modelValue","onUpdate:modelValue"])])]))),256))])]))),128))],64)):(i(),c("div",yS,[l("h4",null,d(e.$t("No spaces found")),1)]))])]),l("div",vS,[a($,{onClick:n.saveSettings,disabled:s.saving,loading:s.saving,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])],2)):(i(),c("div",bS,[l("h3",null,d(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(i(),c("div",kS,[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,wS)]))]))])}const $S=I(F9,[["render",CS]]),SS={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:$S},mounted(){this.$nextTick(()=>{const e=document.querySelector(".object_info");e&&window.scrollTo({top:e.offsetTop-100,behavior:"smooth"})})}},VS={class:"fcom_routed_notification_settings"};function LS(e,t,o,u,s,n){const m=g("notification-pref-form");return i(),c("div",VS,[a(m,{username:o.username},null,8,["username"])])}const MS=I(SS,[["render",LS]]),FS={name:"UserFollowers",components:{Pagination:Se,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"))}},TS={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},PS={class:"search_member"},IS={class:"feed_filters"},US={id:"feed_short_by",class:"fcom_feed_filter_label"},ES={key:0,class:"loading"},BS={key:1,class:"no_follow"},AS={key:2,class:"card_list"},DS={role:"region","aria-label":"User Info",class:"card_content"},RS={class:"card_avatar"},HS={class:"card_info"},xS={class:"info_header"},OS={class:"meta_line"},jS={class:"feed_meta_info"},NS=["title"],zS=["title"],qS={key:0,class:"card_description"},GS={class:"card_action"},YS={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function WS(e,t,o,u,s,n){const m=g("Search"),f=j,h=X,y=ee,w=te,b=Y,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("FollowAction"),$=g("Pagination");return i(),c("div",TS,[l("div",PS,[a(h,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=S=>s.search=S),placeholder:e.$t("Search Followers...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",IS,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",US,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followers by"),modelValue:s.sort_by,"onUpdate:modelValue":t[1]||(t[1]=S=>s.sort_by=S),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=S=>n.toSearch())},{default:r(()=>[a(y,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(y,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),s.loading&&!s.follows.length?(i(),c("div",ES,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.follows.length?(i(),c("div",BS,[s.search?(i(),c(M,{key:0},[V(d(e.$t("No results found")),1)],64)):(i(),c(M,{key:1},[V(d(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(i(),c("div",AS,[(i(!0),c(M,null,R(s.follows,S=>{var T,F,B,L,D,A,U,P;return i(),c("div",{key:S.followed_id,class:"each_card"},[l("div",DS,[l("div",RS,[a(C,{is_online:e.isOnline((T=S.follower)==null?void 0:T.last_activity),xprofile:S.follower},null,8,["is_online","xprofile"])]),l("div",HS,[l("div",xS,[a(p,{show_pop:!0,show_badge:!0,xprofile:S.follower,show_follow:!0},null,8,["xprofile"]),l("div",OS,"@"+d((F=S.follower)==null?void 0:F.username),1)]),l("div",jS,[(B=S.follower)!=null&&B.created_at?(i(),c("div",{key:0,title:(L=S.follower)==null?void 0:L.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(S.follower.created_at))),9,NS)):_("",!0),(D=S.follower)!=null&&D.last_activity?(i(),c("div",{key:1,title:(A=S.follower)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(S.follower.last_activity))),9,zS)):_("",!0)]),(U=S.follower)!=null&&U.short_description?(i(),c("div",qS,d(e.getExcerpt(((P=S.follower.meta)==null?void 0:P.short_description_rendered)||S.follower.short_description,120)),1)):_("",!0)])]),l("div",GS,[a(k,{profile:S.follower,onRefetch:t[3]||(t[3]=O=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),n.showPagination?(i(),c("div",YS,[a($,{hide_on_single:!0,onFetch:t[4]||(t[4]=S=>n.fetchFollowers()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])}const ZS=I(FS,[["render",WS]]),KS={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:Se,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"))}},JS={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},QS={class:"search_member"},XS={class:"feed_filters"},eV={id:"feed_short_by",class:"fcom_feed_filter_label"},tV={key:0,class:"loading"},sV={key:1,class:"no_follow"},oV={key:2,class:"card_list"},iV={role:"region","aria-label":"User Info",class:"card_content"},nV={class:"card_avatar"},lV={class:"card_info"},aV={class:"info_header"},rV={class:"meta_line"},cV={class:"feed_meta_info"},dV=["title"],uV=["title"],_V={key:0,class:"card_description"},mV={class:"card_action"},hV={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function fV(e,t,o,u,s,n){const m=g("Search"),f=j,h=X,y=ee,w=te,b=Y,C=g("UserAvatar"),p=g("UserRouteLink"),k=g("FollowAction"),$=g("Pagination");return i(),c("div",JS,[l("div",QS,[a(h,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=S=>s.search=S),placeholder:e.$t("Search Followings...")},{prefix:r(()=>[a(f,null,{default:r(()=>[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",eV,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort followings by"),modelValue:s.sort_by,"onUpdate:modelValue":t[1]||(t[1]=S=>s.sort_by=S),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=S=>n.toSearch())},{default:r(()=>[a(y,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(y,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),s.loading&&!s.follows.length?(i(),c("div",tV,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.follows.length?(i(),c("div",sV,[s.search?(i(),c(M,{key:0},[V(d(e.$t("No results found")),1)],64)):o.isOwn?(i(),c(M,{key:1},[V(d(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(i(),c(M,{key:2},[V(d(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(i(),c("div",oV,[(i(!0),c(M,null,R(s.follows,S=>{var T,F,B,L,D,A,U,P;return i(),c("div",{key:S.followed_id,class:"each_card"},[l("div",iV,[l("div",nV,[a(C,{is_online:e.isOnline((T=S.followed)==null?void 0:T.last_activity),xprofile:S.followed},null,8,["is_online","xprofile"])]),l("div",lV,[l("div",aV,[a(p,{show_pop:!0,show_badge:!0,xprofile:S.followed,show_follow:!0},null,8,["xprofile"]),l("div",rV,"@"+d((F=S.followed)==null?void 0:F.username),1)]),l("div",cV,[(B=S.followed)!=null&&B.created_at?(i(),c("div",{key:0,title:(L=S.followed)==null?void 0:L.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(S.followed.created_at))),9,dV)):_("",!0),(D=S.followed)!=null&&D.last_activity?(i(),c("div",{key:1,title:(A=S.followed)==null?void 0:A.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(S.followed.last_activity))),9,uV)):_("",!0)]),(U=S.followed)!=null&&U.short_description?(i(),c("div",_V,d(e.getExcerpt(((P=S.followed.meta)==null?void 0:P.short_description_rendered)||S.followed.short_description,120)),1)):_("",!0)])]),l("div",mV,[a(k,{profile:S.followed,onRefetch:t[3]||(t[3]=O=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),n.showPagination?(i(),c("div",hV,[a($,{hide_on_single:!0,onFetch:t[4]||(t[4]=S=>n.fetchFollowings()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)])}const pV=I(KS,[["render",fV]]),gV={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}})}}},yV={class:"follow_header"},vV={class:"fcom_filter_menu"},bV={class:"fcom_filter_menu_ul"},kV={key:0},wV={key:1},CV={class:"follow_body"};function $V(e,t,o,u,s,n){var f,h;const m=g("router-view");return i(),c(M,null,[l("div",yV,[l("div",vV,[l("ul",bV,[((f=o.profile)==null?void 0:f.followings_count)!=null?(i(),c("li",kV,[l("a",{href:"#",onClick:t[0]||(t[0]=z(y=>n.switchRoute("user_followings"),["prevent"])),class:H({"router-link-exact-active":n.isActive("user_followings")})},d(e.$t("Following")),3)])):_("",!0),((h=o.profile)==null?void 0:h.followers_count)!=null?(i(),c("li",wV,[l("a",{href:"#",onClick:t[1]||(t[1]=z(y=>n.switchRoute("user_followers"),["prevent"])),class:H({"router-link-exact-active":n.isActive("user_followers")})},d(e.$t("Followers")),3)])):_("",!0)])])]),l("div",CV,[a(m,{isOwn:o.isOwn,profile:o.profile,onRefetch:t[2]||(t[2]=y=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const SV=I(gV,[["render",$V]]),VV={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 LV(e,t,o,u,s,n){const m=g("MoreFilled"),f=j,h=x,y=We,w=be,b=de,C=ue,p=fe,k=J("loading");return i(),v(p,{persistent:!1,placement:"bottom",width:270,visible:s.isOpened,onHide:t[2]||(t[2]=$=>s.isOpened=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:n.togglePopover,size:"small",text:""},{default:r(()=>[a(f,{class:"fcom_more_icon"},{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[a(C,{onSubmit:t[1]||(t[1]=z($=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Status")},{default:r(()=>[a(w,{modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=$=>s.status=$)},{default:r(()=>[a(y,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(y,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(y,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:r(()=>[G((i(),v(h,{disabled:s.working,onClick:n.changeMemberStatus,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[k,s.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const MV=I(VV,[["render",LV]]),FV={name:"AllMembers",components:{SocialLinks:Pt,Layout:we,AppLayout:Ve,Pagination:Se,MemberAction:MV,FollowAction:st},data(){return{loading:!1,members:[],pagination:{page:1,per_page:24,total:0},permission_failed:!1,search:"",status:"active",sort_by:"last_activity",working:!1,openedMemberId:null,memberLayout:this.appVars.features.member_list_layout||"classic"}},methods:{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}).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.working=!0,this.$patch("members/"+e.user_id,{status:t}).then(o=>{this.$notify.success(o.message),e.status=t}).catch(o=>{this.$handleError(o)}).finally(()=>{this.working=!1})},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,o=this.$route.query.inactives?"blocked":null,u=t||o;u&&e.includes(u)&&(this.status=u),this.fetch(),this.changeTitle(this.$t("All Members"))}},TV={key:0,class:"card_header"},PV={role:"region","aria-label":"Member Navigation",class:"member_status"};const IV={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},UV={class:"permission_failed"},EV=["href"],BV={class:"search_member"},AV={class:"feed_filters"},DV={id:"feed_short_by",class:"fcom_feed_filter_label"},RV={key:0,class:"loading"},HV={key:1,class:"no_members"},xV={key:2,class:"card_list"},OV={role:"region","aria-label":"User Info",class:"card_content"},jV={class:"card_avatar"},NV={class:"card_info"},zV={class:"info_header"},qV={class:"meta_line"},GV={class:"feed_meta_info"},YV=["title"],WV=["title"],ZV={key:0,class:"card_description"},KV={key:1,class:"card_footer"},JV={class:"card_action"},QV={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function XV(e,t,o,u,s,n){const m=We,f=be,h=x,y=g("Search"),w=j,b=X,C=ee,p=te,k=Y,$=g("UserAvatar"),S=g("UserRouteLink"),T=g("SocialLinks"),F=g("FollowAction"),B=g("MemberAction"),L=g("Pagination"),D=g("layout"),A=g("app-layout");return i(),v(A,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(D,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(typeof s.pagination.total=="number"?" ("+e.$formatNumber(s.pagination.total)+")":"")},{default:r(()=>[e.isAdmin()?(i(),c("div",TV,[l("div",PV,[a(f,{onChange:n.toSearch,modelValue:s.status,"onUpdate:modelValue":t[0]||(t[0]=U=>s.status=U),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[V(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[V(d(e.$t("Pending")),1)]),_:1}),a(m,{value:"blocked"},{default:r(()=>[V(d(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(i(),v(m,{key:0,value:"deactivated"},{default:r(()=>[V(d(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])]),_("",!0)])):_("",!0),s.permission_failed?(i(),c("div",IV,[l("div",UV,[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,EV)])])):(i(),c(M,{key:2},[l("div",BV,[a(b,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[2]||(t[2]=U=>s.search=U),placeholder:e.$t("Search Members...")},{prefix:r(()=>[a(w,null,{default:r(()=>[a(y)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",AV,[t[6]||(t[6]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",DV,d(e.$t("Sort by:")),1),a(p,{"aria-label":e.$t("Sort members by"),modelValue:s.sort_by,"onUpdate:modelValue":t[3]||(t[3]=U=>s.sort_by=U),class:"fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Latest Posts"),onChange:t[4]||(t[4]=U=>n.fetch())},{default:r(()=>[a(C,{value:"last_activity",label:e.$t("Last Activity")},null,8,["label"]),a(C,{value:"display_name",label:e.$t("Display Name")},null,8,["label"]),a(C,{value:"created_at",label:e.$t("Joining Date")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])]),l("div",{class:H(["fcom_dir_layout_"+s.memberLayout,"space_members fcom_dir_layout"])},[s.loading?(i(),c("div",RV,[a(k,{class:"white_loaded",rows:3,animated:!0})])):!s.loading&&!s.members.length?(i(),c("div",HV,d(e.$t("No members found")),1)):(i(),c("div",xV,[(i(!0),c(M,null,R(s.members,(U,P)=>{var O;return i(),c("div",{key:U.user_id,class:"each_card"},[l("div",OV,[l("div",jV,[a($,{is_online:e.isOnline(U.last_activity),xprofile:U},null,8,["is_online","xprofile"])]),l("div",NV,[l("div",zV,[a(S,{show_pop:!0,show_badge:!0,xprofile:U,show_follow:!0},null,8,["xprofile"]),l("div",qV,"@"+d(U.username),1)]),l("div",GV,[U.created_at?(i(),c("div",{key:0,title:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(U.created_at))),9,YV)):_("",!0),U.last_activity?(i(),c("div",{key:1,title:U.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(U.last_activity))),9,WV)):_("",!0)]),U.short_description?(i(),c("div",ZV,d(e.getExcerpt(((O=U.meta)==null?void 0:O.short_description_rendered)||U.short_description,120)),1)):_("",!0),a(T,{style:{"justify-content":"left"},xprofile:U,isOwn:!1},null,8,["xprofile"]),U.status!="active"?(i(),c("div",KV,[l("div",{style:le({color:U.status==="pending"?"var(--el-color-warning)":"var(--el-color-danger)",display:"flex",gap:"10px"}),class:"meta_line"},[U.status==="pending"?(i(),c(M,{key:0},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:N=>n.changeMemberStatus(U,"active"),type:"primary",size:"small",disabled:s.working,loading:s.working},{default:r(()=>[V(d(e.$t("Approve")),1)]),_:1},8,["onClick","disabled","loading"])],64)):U.status==="blocked"?(i(),c(M,{key:1},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:N=>n.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:s.working,loading:s.working},{default:r(()=>[V(d(e.$t("Unblock")),1)]),_:1},8,["onClick","disabled","loading"])],64)):(i(),c(M,{key:2},[l("span",null,d(e.$t("Status:"))+" "+d(e.$t("Self Deactivated")),1),a(h,{onClick:N=>n.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:s.working,loading:s.working},{default:r(()=>[V(d(e.$t("Reactivate")),1)]),_:1},8,["onClick","disabled","loading"])],64))],4)])):_("",!0)])]),l("div",JV,[a(F,{profile:U},null,8,["profile"]),e.isAdmin()?(i(),v(B,{key:0,member:U,openedMemberId:s.openedMemberId,onTogglePopover:N=>n.handleTogglePopover(U.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),s.pagination.total?(i(),c("div",QV,[a(L,{hide_on_single:!0,onFetch:t[5]||(t[5]=U=>n.fetch()),pagination:s.pagination},null,8,["pagination"])])):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const eL=I(FV,[["render",XV]]),tL={name:"Notifications",components:{AppLayout:Ve,Layout:we,NotificationsBlock:Os,Pagination:Se},setup(){return{notificationStore:os()}},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)}},sL={class:"fcom_filter_menu"},oL={class:"fcom_filter_menu_ul fcom_notification_types"},iL={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},nL={key:0,class:"notifications notifications_wrap"},lL={class:"pagination_wrap"},aL={key:1,style:{"margin-top":"15px"}},rL={key:2};function cL(e,t,o,u,s,n){const m=x,f=Fs,h=g("notifications-block"),y=g("Pagination"),w=Y,b=g("layout"),C=g("app-layout"),p=J("loading");return i(),v(C,{wrapper_class:"fcom_single_layout"},{default:r(()=>[a(b,{content_class:"no_bg_layout notification_layout",title:e.$t("Notifications")},{actions:r(()=>[a(m,{class:"fcom_primary_button",disabled:s.working,onClick:t[0]||(t[0]=k=>n.markAllRead())},{default:r(()=>[V(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:r(()=>[l("div",sL,[l("ul",oL,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z(k=>n.switchType("all"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="all"&&s.status!="unread"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z(k=>n.switchType("unread"),["prevent"])),class:H({"router-link-exact-active":s.status=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z(k=>n.switchType("mentioned"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z(k=>n.switchType("following"),["prevent"])),class:H({"router-link-exact-active":s.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])]),a(f,{onChange:t[5]||(t[5]=k=>n.fetch()),style:{"--el-switch-on-color":"#2271b1"},"active-value":"unread","inactive-value":"all","active-text":e.$t("Unread only"),modelValue:s.status,"onUpdate:modelValue":t[6]||(t[6]=k=>s.status=k),class:"fcom_switch"},null,8,["active-text","modelValue"])]),l("div",iL,[s.notifications.length?G((i(),c("div",nL,[a(h,{notifications:s.notifications},null,8,["notifications"]),l("div",lL,[a(y,{hide_on_single:!0,onFetch:t[7]||(t[7]=k=>n.fetch()),pagination:s.pagination},null,8,["pagination"])])])),[[p,s.loading]]):s.loading?(i(),c("div",rL,[a(w,{animated:!0,rows:5})])):(i(),c("div",aL,[l("p",null,d(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const dL=I(tL,[["render",cL]]),uL={name:"Bookmarks",components:{Feeds:ft,AppLayout:Ve,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"))}},_L={style:{"margin-bottom":"16px"}},mL={class:"search_member"},hL={key:1};function fL(e,t,o,u,s,n){const m=g("Search"),f=j,h=X,y=g("feeds"),w=g("layout"),b=g("app-layout");return i(),v(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:r(()=>[a(w,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:r(()=>[l("h4",_L,d(e.$t("Your saved posts")),1),l("div",mL,[a(h,{clearable:"",onClear:n.handleSearch,onKeydown:he(n.handleSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[0]||(t[0]=C=>s.search=C),placeholder:e.$t("Search Posts...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),e.appVars.auth.user_id?(i(),v(y,{key:0,feed_base_url:n.feed_base_url,hide_create_form:!0,space:"",feed_name:"all_feeds",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"])):(i(),c("div",hL,[l("p",null,d(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const pL=I(uL,[["render",fL]]);const gL={name:"AllCourses",components:{AppLayout:Ve,Layout:we,GroupIcon:Ot,Pagination:Se,Search:Te},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)}},yL={class:"object_menu"},vL={class:"fcom_space_menu_ul"},bL={key:0},kL={key:1},wL={key:0,class:"fcom_space_topics"},CL={class:"fcom_topics_filters"},$L={class:"search_member"},SL={class:"feed_filters"},VL={id:"feed_short_by",class:"fcom_feed_filter_label"},LL={class:"fcom_courses"},ML={key:0,class:"fcom_no_items_wrap"},FL={key:2},TL=["href"],PL={class:"fcom_box_card_list"},IL=["onClick"],UL=["src"],EL={key:1,class:"fcom_no_image"},BL={class:"fcom_box_card_info"},AL={class:"fcom_box_card_name"},DL={class:"fcom_box_card_details"},RL={class:"inline_details"},HL={key:0,class:"inline_details"},xL={key:0,class:"fcom_box_card_description"},OL={class:"fcom_box_card_action"},jL=["onClick"],NL=["onClick"];function zL(e,t,o,u,s,n){const m=x,f=ke,h=g("Search"),y=j,w=X,b=ee,C=te,p=Ue,k=g("router-link"),$=g("GroupIcon"),S=g("pagination"),T=g("layout"),F=g("app-layout"),B=J("loading");return i(),v(F,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(T,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(s.pagination.total?" ("+e.$formatNumber(s.pagination.total)+")":"")},{actions:r(()=>[l("div",yL,[l("ul",vL,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(L=>n.SwitchToCourseView("all"),["prevent"])),class:H(s.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Courses")),3)]),e.auth.user_id?(i(),c("li",bL,[l("a",{onClick:t[1]||(t[1]=z(L=>n.SwitchToCourseView("enrolled"),["prevent"])),class:H(s.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(i(),c("li",kL,[a(m,{onClick:t[2]||(t[2]=L=>n.emitCreateCourse()),class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:r(()=>[s.courseCategories&&s.courseCategories.length?(i(),c("div",wL,[a(f,null,{default:r(()=>[l("div",CL,[a(m,{onClick:t[3]||(t[3]=L=>n.setTopic("")),class:H({fcom_active_topic:!s.topic_slug})},{default:r(()=>[V(d(e.$t("All")),1)]),_:1},8,["class"]),(i(!0),c(M,null,R(s.courseCategories,L=>(i(),v(m,{key:L.slug,onClick:D=>n.setTopic(L.slug),class:H({fcom_active_topic:L.slug==s.topic_slug})},{default:r(()=>[V(d(L.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",$L,[a(w,{clearable:"",onClear:n.toSearch,onKeydown:he(n.toSearch,["enter"]),onInput:n.handleSearch,modelValue:s.search,"onUpdate:modelValue":t[4]||(t[4]=L=>s.search=L),placeholder:e.$t("Search Courses...")},{prefix:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",SL,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",VL,d(e.$t("Sort by:")),1),a(C,{"aria-label":e.$t("Sort Courses by"),modelValue:s.sort_by,"onUpdate:modelValue":t[5]||(t[5]=L=>s.sort_by=L),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=L=>n.changeSortBy())},{default:r(()=>[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"])]),G((i(),c("div",LL,[!s.loading&&!s.courses.length?(i(),c("div",ML,[s.topic_slug?(i(),c(M,{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)):s.type=="all"?(i(),c(M,{key:1},[s.search?(i(),c(M,{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()?(i(),c(M,{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]=L=>n.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:r(()=>[V(d(e.$t("Create a Course")),1)]),_:1})],64)):(i(),c("div",FL,[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)):(i(),c(M,{key:2},[s.search?(i(),c(M,{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?(i(),c(M,{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]=z(L=>n.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},d(e.$t("View all courses")),1)],64)):(i(),c(M,{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,TL)],64))],64))])):_("",!0),l("div",PL,[(i(!0),c(M,null,R(s.courses,L=>(i(),c("div",{key:L.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:D=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},[L.cover_photo?(i(),c("img",{key:0,src:L.cover_photo,alt:""},null,8,UL)):(i(),c("div",EL))],8,IL),l("div",BL,[l("div",AL,[a(k,{class:"course_route",to:{name:"view_course",params:{course_slug:L.slug}}},{default:r(()=>[V(d(L.title)+" ",1),L.status=="draft"?(i(),v(p,{key:0,type:"info"},{default:r(()=>[V(d(L.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",DL,[l("div",RL,[l("span",null,d(e.$_n("%d Section","%d Sections",L.sectionsCount)),1),t[10]||(t[10]=l("span",{class:"fcom_inline_separator"},null,-1)),l("span",null,d(e.$_n("%d Lesson","%d Lessons",L.lessonsCount)),1)]),L.studentsCount?(i(),c("div",HL,[a(y,null,{default:r(()=>[a($)]),_:1}),V(" "+d(e.$_n("%s student","%s students",e.$formatNumber(L.studentsCount))),1)])):_("",!0)]),L.description?(i(),c("div",xL,d(n.getExcerpt(L.description)),1)):_("",!0),l("div",OL,[L.isEnrolled?(i(),c("button",{key:0,class:H(["fcom_card_button",L.progress>=100?"fcom_card_button_success":"fcom_card_button_progress"]),onClick:D=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},d(e.$t("%s Completed",L.progress+"%")),11,jL)):(i(),c("button",{key:1,class:"fcom_card_button",onClick:D=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},d(e.$t("View Course")),9,NL))])])]))),128))]),a(S,{hide_on_single:!0,onFetch:n.fetchCourses,pagination:s.pagination},null,8,["onFetch","pagination"])])),[[B,s.loading]])]),_:1},8,["title"])]),_:1})}const qL=I(gL,[["render",zL],["__scopeId","data-v-6eaa01d3"]]),GL={name:"ViewCoursesRoute",components:{Layout:we,AppLayout:Ve},props:["course_slug"],data(){return{course:{},sections:[],track:{},loading:!1,currentLessonIndex:null,currentLesson:null}},watch:{course_slug(){this.fetchCourse()}},computed:{allLessons(){let e=[];return Re(this.sections,t=>{Re(t.lessons,o=>{e.push(o)})}),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(Re(this.allLessons,(t,o)=>{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 Re(this.allLessons,(t,o)=>{if(o>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 o=null,u=null;Re(this.allLessons,(s,n)=>{if(s.slug==e)return o=s,u=n,!1}),o&&(this.loading=!0,this.currentLesson=null,this.currentLessonIndex=null,this.$nextTick(()=>{this.currentLessonIndex=u,this.currentLesson=o,this.currentLesson.lazy_load&&(this.currentLesson.content_loading=!0,this.fetchLesson(o.slug,s=>{s.slug==this.currentLesson.slug&&(this.currentLesson.can_view=s.can_view,this.currentLesson.is_locked=s.is_locked,this.currentLesson.lock_type=s.lock_type,this.currentLesson.access_message=s.access_message,this.currentLesson.meta=s.meta,this.currentLesson.content=s.content,this.currentLesson.content_loading=!1)})),this.changeTitle(this.currentLesson.title),this.$router.push({name:"view_lesson",params:{lesson_slug:o.slug},query:t?this.$route.query:{}}),this.loading=!1}))},fetchLesson(e,t=null){this.$get("courses/"+this.course.slug+"/lessons/"+e+"/by-slug").then(o=>{t&&t(o.lesson)}).catch(o=>{this.$handleError(o),t&&t({slug:e,content:"<p>"+this.$t("Sorry, the lesson content could not be loaded.")+"</p>"})})}},created(){this.fetchCourse()}},YL={key:0},WL={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},ZL={key:1},KL={key:2,style:{padding:"1rem 2rem"}};function JL(e,t,o,u,s,n){const m=Xt,f=es,h=Y,y=g("layout"),w=g("app-layout"),b=g("router-view");return s.loading?(i(),c("div",YL,[a(w,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(y,{title:"...."},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[...t[1]||(t[1]=[V("....",-1)])]),_:1})]),_:1})]),default:r(()=>[l("div",WL,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):s.course.id?(i(),c("div",ZL,[a(b,{track:s.track,course:s.course,sections:s.sections,lessonsCount:n.lessonsCount,currentLesson:s.currentLesson,currentLessonIndex:s.currentLessonIndex,onSetNextLesson:n.handleNextLesson,onSetPrevLesson:n.setPrevLesson,onGoToLesson:n.goToLesson,onReload:n.fetchCourse,onUpdateTrack:t[0]||(t[0]=C=>{s.track=C})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(i(),c("div",KL,[l("h3",null,d(e.$t("Sorry, the course could not be loaded.")),1)]))}const QL=I(GL,[["render",JL]]),XL={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},eM={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tM(e,t,o,u,s,n){return i(),c("svg",eM,[...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 sM=I(XL,[["render",tM]]),oM={name:"WelcomeBanner",components:{MediaPreview:De},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}}},iM={key:0,class:"fcom_welcome_title"},nM=["innerHTML"],lM={key:2,class:"fcom_welcome_cta_buttons"},aM=["href","target"];function rM(e,t,o,u,s,n){const m=g("media-preview"),f=Ie,h=g("MoreFilled"),y=j,w=x,b=Ze,C=Ke,p=Je;return n.effectiveConfig&&n.showBanner?(i(),c("div",{key:0,class:H(["fcom_welcome_box",o.wrapperClass])},[n.showMedia?(i(),v(m,{key:0,media_item:n.effectiveConfig.bannerVideo},null,8,["media_item"])):n.effectiveConfig.bannerImage?(i(),v(f,{key:1,class:"feed_media",alt:e.$t("Image Preview"),src:n.effectiveConfig.bannerImage},null,8,["alt","src"])):_("",!0),l("div",{class:H(o.contentClass)},[n.effectiveConfig.title?(i(),c("h2",iM,d(n.effectiveConfig.title),1)):_("",!0),n.effectiveConfig.description_rendered?(i(),c("div",{key:1,class:"fcom_welcome_sub",innerHTML:n.effectiveConfig.description_rendered},null,8,nM)):_("",!0),n.showCtaButtons?(i(),c("div",lM,[(i(!0),c(M,null,R(n.effectiveConfig.ctaButtons,k=>(i(),c(M,null,[k.link&&k.label?(i(),c("a",{key:0,href:k.link,target:k.newTab=="yes"?"_blank":"",class:H({"el-button fcom_primary_button":k.type=="primary","el-button fcom_secondary_button":k.type=="secondary","el-button is-text":k.type=="text","el-link fcom_link_button":k.type=="link"})},d(k.label),11,aM)):_("",!0)],64))),256))])):_("",!0)],2),n.isRemovable?(i(),v(p,{key:2,trigger:"click",class:"fcom_welcome_close"},{dropdown:r(()=>[a(C,null,{default:r(()=>[a(b,{onClick:n.closeBanner},{default:r(()=>[V(d(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:r(()=>[a(w,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(y,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)],2)):_("",!0)}const ms=I(oM,[["render",rM]]),cM={name:"LockscreenView",components:{CustomLockscreenView:yo,DefaultLockscreenPaywall:vo,WelcomeBanner:ms},props:["space_profile","sections"],emits:["join"],data(){return{isRedirecting:!1}},created(){var e,t,o,u;((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="redirect"&&((u=(o=this.space_profile)==null?void 0:o.settings)!=null&&u.onboard_redirect_url)&&(this.isRedirecting=!0,window.location.href=this.space_profile.settings.onboard_redirect_url)}},dM={key:0,style:{"text-align":"center",margin:"50px 0"}},uM={key:0,class:"space_default_lockscreen"},_M={class:"space_lock_box space_default_lock_box"},mM={key:0,class:"lock_desc"},hM={key:1,class:"lock_desc"},fM=["href"],pM={key:1,class:"space_lock_box"},gM={key:2,class:"space_lock_box"},yM=["href"];function vM(e,t,o,u,s,n){var b;const m=g("welcome-banner"),f=g("Lock"),h=j,y=g("default-lockscreen-paywall"),w=g("custom-lockscreen-view");return s.isRedirecting?(i(),c("h3",dM,d(e.$t("Please wait....")),1)):(i(),c(M,{key:1},[o.space_profile.lockscreen_config?(i(),c(M,{key:0},[o.space_profile.lockscreen_config.showCustom?(i(),v(w,{key:1,sections:o.sections,profile:o.space_profile},null,8,["sections","profile"])):(i(),c("div",uM,[o.space_profile.welcome_banner&&o.space_profile.lockscreen_config.showWelcomeBanner?(i(),v(m,{key:0,config:o.space_profile.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+o.space_profile.id+(o.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",_M,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("This is a private course")),1),o.space_profile.lockscreen_config.showPaywalls?(i(),c("p",mM,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(i(),c("p",hM,d(e.$t("Members have to be invited to this course.")),1)),e.auth.user_id?_("",!0):(i(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,fM))]),o.space_profile.lockscreen_config.showPaywalls?(i(),v(y,{key:1,space_id:(b=o.space_profile)==null?void 0:b.id},null,8,["space_id"])):_("",!0)]))],64)):o.space_profile.permissions.is_pending?(i(),c("div",pM,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("Your request to join this course is pending")),1)])):e.auth.user_id?_("",!0):(i(),c("div",gM,[a(h,null,{default:r(()=>[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,yM)]))],64))}const bM=I(cM,[["render",vM]]),kM={name:"CollapseIcon"},wM={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function CM(e,t,o,u,s,n){return i(),c("svg",wM,[...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 $M=I(kM,[["render",CM]]),SM={name:"ViewCourse",components:{VideoPlay:Hs,RenderSpaceLinks:us,LockScreenView:bM,AppLayout:Ve,Layout:we,CircleIcon:_s,LockIcon:sM,SocialLinks:Pt,PlayIcon:_o,LessonIcon:uo,PlayPlaceholderIcon:mo,CollapseIcon:$M,WelcomeBanner:ms},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1}},computed:{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((o,u)=>o+(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 o;const t=(o=e.meta)==null?void 0:o.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(t==null?void 0:t.html)},hasMediaImage(e){var t,o;return this.isEnabledMedia(e)&&((o=(t=e.meta)==null?void 0:t.media)==null?void 0:o.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(e.is_locked||!this.track.isEnrolled||!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")},maybeGotoLesson(e,t,o){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(o.is_locked){o.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",o.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),o=Math.floor(e%3600/60),u=e%60,s="";return t>0&&(s+=this.$t("%dh ",t)),o>0&&(s+=this.$t("%dm ",o)),u>0&&(s+=this.$t("%ds",u)),s.trim()||null}},mounted(){this.appVars.course_sections_collapsed=="yes"&&this.toggleAllSections()}},VM=["href"],LM={class:"fcom_course_actions"},MM=["href"],FM={key:0,class:"fcom_sub_header"},TM={key:0,class:"fcom_notice"},PM={class:"fcom_feed_box course_box"},IM={class:"fcom_course_sections"},UM={class:"fcom_course_intro"},EM={class:"fcom_course_labels"},BM={class:"fcom_course_info"},AM=["innerHTML"],DM={class:"fcom_card_sections"},RM={class:"fcom_section_items"},HM=["onClick"],xM={class:"fcom_section_primary_item_title"},OM={class:"title_line_container"},jM={class:"title_line"},NM={key:0,class:"section_lock_badge"},zM={class:"fcom_meta_text"},qM={key:0,class:"fcom_meta_text"},GM={class:"fcom_section_primary_item_actions"},YM=["onClick"],WM={class:"fcom_heading_item clickable"},ZM={class:"lesson_feature_media"},KM=["src","alt"],JM=["src","alt"],QM={class:"lesson_title"},XM=["innerHTML"],eF={class:"lesson_duration"},tF={key:0},sF={key:1},oF=["innerHTML"],iF={key:0,class:"fcom_section_item_actions"},nF={class:"fcom_meta_text"},lF={class:"fcom_main_side_wrap"},aF={class:"fcom_side_box"},rF={key:0,class:"app_side_widget course_widget"},cF={class:"widget_header"},dF={class:"widget_body"},uF={class:"progress_label"},_F={key:0,style:{margin:"20px 0"}},mF={key:1,class:"app_side_widget course_widget"},hF={class:"widget_header"},fF={class:"widget_body"},pF={class:"creator_details"},gF={class:"creator_details_item"},yF={class:"creator_details_info"},vF={class:"info_text"},bF={class:"details_name"},kF={class:"details_meta"},wF={class:"fcom_meta_text"},CF={key:0,class:"fcom_meta_text"},$F=["innerHTML"],SF={key:2};function VF(e,t,o,u,s,n){const m=Xt,f=es,h=x,y=g("render-space-links"),w=g("welcome-banner"),b=g("CollapseIcon"),C=g("Lock"),p=j,k=g("ArrowRight"),$=g("ArrowDown"),S=g("SuccessFilled"),T=g("LockIcon"),F=g("CircleIcon"),B=g("PlayPlaceholderIcon"),L=g("LessonIcon"),D=g("PlayIcon"),A=g("VideoPlay"),U=Me,P=Qt,O=g("UserAvatar"),N=g("UserRouteLink"),Q=g("SocialLinks"),_e=Qe,ne=xe,E=g("LockScreenView"),K=g("layout"),ae=g("app-layout"),W=J("loading");return i(),v(ae,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:r(()=>[a(K,{wrapper_class:["no_bg_layout",{custom_lockscreen:!n.showCourseSections}],title:e.$t("Courses")},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[V(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[V(d(o.course.title)+" ",1),o.course.is_course_admin?(i(),c("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:n.editLessonLink()},d(e.$t("Edit Lessons")),9,VM)):_("",!0)]),_:1})]),_:1})]),actions:r(()=>[l("div",LM,[e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(h,{key:1,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[W,s.enrolling]]):o.track.progress!=100?(i(),v(h,{key:2,class:"fcom_primary_button",onClick:n.continueCourse},{default:r(()=>[V(d(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0):(i(),c(M,{key:0},[n.isCustomLockScreen?_("",!0):(i(),c("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,MM))],64))])]),sub_header:r(()=>{var re,oe;return[o.course&&n.showCourseSections&&((oe=(re=o.course)==null?void 0:re.settings)!=null&&oe.links.length)?(i(),c("div",FM,[a(y,{links:o.course.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[o.course.status==="draft"?(i(),c("div",TM,[l("p",null,d(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),n.showCourseSections?(i(),v(ne,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(U,{class:"fcom_main"},{default:r(()=>{var re;return[o.course.welcome_banner?(i(),v(w,{key:0,config:o.course.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+o.course.id+(o.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",PM,[l("div",IM,[l("div",UM,[l("div",EM,[l("h3",null,d(o.course.title),1),l("p",BM,[V(d(e.$_n("%s Topic","%s Topics",n.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),V(" "+d(e.$_n("%s Lesson","%s Lessons",o.lessonsCount)),1)])])]),(re=o.course.settings)!=null&&re.course_details_rendered?(i(),c("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:o.course.settings.course_details_rendered},null,8,AM)):_("",!0),l("div",{class:H(["course_contents_header",{is_collapsed:n.isCollapsed}])},[l("h4",null,d(e.$t("Course Contents")),1),n.sectionsCount>1?(i(),v(b,{key:0,class:"collapse_icon clickable",onClick:n.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",DM,[l("div",RM,[(i(!0),c(M,null,R(o.sections,oe=>(i(),c("div",{key:oe.id,class:"fcom_section_primary"},[l("div",{onClick:se=>oe.is_closed=!oe.is_closed,class:H(["clickable fcom_section_primary_item",{is_closed:oe.is_closed}])},[l("div",xM,[l("div",OM,[l("div",jM,[l("h4",null,d(oe.title),1),oe.unlock_date?(i(),c("span",NM,[oe.is_locked?(i(),v(p,{key:0},{default:r(()=>[a(C)]),_:1})):_("",!0),l("span",null," ("+d(e.$t("will unlock at %s",e.smartDate(oe.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",zM,d(e.$_n("%s lesson","%s lessons",oe.lessons.length)),1),n.lessonDuration(oe)?(i(),c("span",qM," • "+d(n.lessonDuration(oe)),1)):_("",!0)])]),l("div",GM,[a(p,null,{default:r(()=>[oe.is_closed?(i(),v(k,{key:0,class:"fcom_arrow_icon"})):(i(),v($,{key:1}))]),_:2},1024)])],10,HM),oe.is_closed?_("",!0):(i(!0),c(M,{key:0},R(oe.lessons,se=>(i(),c("div",{key:se.id,class:H(["fcom_section_item",{is_locked:n.isLockLesson(oe,se)}])},[l("div",{onClick:me=>n.maybeGotoLesson(se,o.track,oe),class:"fcom_section_item_title"},[l("p",WM,[o.track.completed_lessons.includes(se.id.toString())?(i(),v(p,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(S)]),_:1})):n.isLockLesson(oe,se)?(i(),v(p,{key:1},{default:r(()=>[a(T)]),_:1})):(i(),v(p,{key:2},{default:r(()=>[a(F)]),_:1})),n.isModernLayout?(i(),c(M,{key:3},[l("span",ZM,[se.featured_image?(i(),c("img",{key:0,src:se.featured_image,alt:se.title},null,8,KM)):n.hasMediaImage(se)?(i(),c("img",{key:1,src:se.meta.media.image,alt:se.title},null,8,JM)):n.hasMediaVideo(se)?(i(),v(B,{key:2})):(i(),v(L,{key:3})),n.showPlayIcon(se)?(i(),v(D,{key:4,class:"play_icon"})):_("",!0)]),l("span",QM,[l("span",{innerHTML:se.title},null,8,XM),l("span",eF,[se.meta.video_length?(i(),c("span",tF,d(n.formatSeconds(se.meta.video_length)),1)):(i(),c("span",sF,d("---")))])])],64)):(i(),c("span",{key:4,innerHTML:se.title},null,8,oF))])],8,YM),!n.isModernLayout&&se.meta.enable_media=="yes"&&se.meta.video_length?(i(),c("div",iF,[l("span",nF,[se.meta.video_length?(i(),v(h,{key:0,onClick:me=>n.maybeGotoLesson(se,o.track,oe),text:""},{default:r(()=>[a(p,{class:"fcom_play_btn_icon"},{default:r(()=>[a(A)]),_:1}),l("span",null,d(n.formatSeconds(se.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),n.showSidebar?(i(),v(_e,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",lF,[l("div",aF,[o.track.isEnrolled?(i(),c("div",rF,[l("div",cF,[l("h3",null,d(e.$t("Course progress")),1)]),l("div",dF,[l("div",uF,[l("p",null,d(e.$t("Completed %1$s of %2$s",o.track.completed_lessons.length,o.lessonsCount)),1),l("span",null,d(parseInt(o.track.progress))+"%",1)]),a(P,{class:"fcom_progress","stroke-width":10,percentage:parseInt(o.track.progress),"show-text":!1},null,8,["percentage"]),o.track.progress==100?(i(),c("div",_F,[l("h5",null,d(e.$t("Congratulations! Course completed! 🎉")),1)])):_("",!0)])])):_("",!0),o.course.creator?(i(),c("div",mF,[l("div",hF,[l("h3",null,d(e.$t("Course Instructor")),1)]),l("div",fF,[l("div",pF,[l("div",gF,[l("div",yF,[a(O,{with_level:!1,xprofile:o.course.creator},null,8,["xprofile"]),l("div",vF,[l("div",bF,[a(N,{show_badge:!0,xprofile:o.course.creator},null,8,["xprofile"])]),l("div",kF,[l("span",wF,d(e.$_n("%d Course","%d Courses",o.course.creator.total_courses)),1),o.course.creator.total_students?(i(),c("span",CF," • "+d(e.$_n("%d Student","%d Students",o.course.creator.total_students)),1)):_("",!0)])])]),o.course.creator.short_description_rendered?(i(),c("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:o.course.creator.short_description_rendered},null,8,$F)):_("",!0)]),a(Q,{xprofile:o.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),n.showCourseSections?_("",!0):(i(),c("div",SF,[a(E,{space_profile:o.course,sections:o.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const LF=I(SM,[["render",VF]]),MF={name:"CommentBox",mixins:[Tt],components:{FeedComments:Js,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,o,u;const e=((t=this.comment.media_images)==null?void 0:t.length)>0||((u=(o=this.comment.meta)==null?void 0:o.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(s=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.unshift(s.comment),this.$emit("commented",s.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(s.comment.id),this.comment={message:"",media_image:""}}),this.showCommentBox=!0}).catch(s=>{this.$handleError(s)}).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)}},FF=["id"],TF={key:0,class:"feed_commenting"},PF={class:"person_avatar"},IF=["src"],UF={key:0,class:"feed_comment_input"},EF={key:1,class:""},BF={style:{padding:"0",margin:"0","text-align":"center"}},AF={key:0,class:"fcom_comment_sorting"};function DF(e,t,o,u,s,n){const m=x,f=g("feed-text-composer"),h=g("router-link"),y=ee,w=te,b=g("feed-comments");return i(),c("div",{class:H(["fcom_comment_box","fcom_comment_box_"+o.feed.type])},[q(e.$slots,"before_comment_box"),(s.commenting||o.is_single)&&o.show_comment_form?(i(),c("div",{key:0,id:"feed_comment_form_"+o.feed.id,class:"feed_comment"},[!o.checkPermission||e.hasCommentPermission(o.feed)?(i(),c(M,{key:0},[s.comment?(i(),c("div",TF,[l("div",PF,[l("img",{alt:"",src:e.auth.avatar},null,8,IF)]),s.showCommentBox?(i(),c("div",UF,[a(f,{context:"comment",mentionQuery:{space_id:n.getSpaceId()},autofocus_changed:s.commenting,autofocus:s.commenting,disabled:s.saving,placeholder:e.$t("Write a comment"),content:s.comment},{default:r(()=>[a(m,{loading:s.saving,disabled:s.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=C=>n.postComment())},{default:r(()=>[V(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(i(),c("div",EF,[l("p",BF,[V(d(e.$t("Please join the Space to post a comment."))+" ",1),o.feed.space?(i(),v(h,{key:0,to:{name:"space_feeds",params:{space:o.feed.space.slug}}},{default:r(()=>[V(d(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,FF)):_("",!0),a(b,{sortBy:s.sortBy,checkPermission:o.checkPermission,onForceShowAll:n.showAllComments,show_all:s.show_all_comments,feed:o.feed},{before_comments_start:r(()=>[o.feed.comments_count>=2?(i(),c("div",AF,[a(w,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=C=>n.changeCommentsSortBy()),modelValue:s.sortBy,"onUpdate:modelValue":t[2]||(t[2]=C=>s.sortBy=C),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(y,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(y,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(y,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(y,{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"]),q(e.$slots,"after_comment_box")],2)}const RF=I(MF,[["render",DF]]),HF={name:"ExitFullScreen"},xF={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"};function OF(e,t,o,u,s,n){return i(),c("svg",xF,[...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 jF=I(HF,[["render",OF]]),NF={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:Ds},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.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)=>(e[t.slug]=[],t.type=="single_choice"&&(e[t.slug]=null),e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&Hi.each(e,(o,u)=>{this.answers[u]=o.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0},showQuestion(e){var o;if(!this.alreadyAttempted)return!0;const t=((o=this.userResult)==null?void 0:o.message)||[];return!!(this.isNew||t[e.slug])},isSingleChoice(e){return e.type=="single_choice"},isMultipleChoice(e){return e.type=="multiple_choice"},showQuestionImage(e){return e.image_enabled&&e.image_url},isQuestionCorrect(e){var t,o,u;return(u=(o=(t=this.userResult)==null?void 0:t.message)==null?void 0:o[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 o=this.answers[e.slug]||[];o.indexOf(t.label)>-1?this.answers[e.slug]=o.filter(s=>s!==t.label):this.answers[e.slug]=[...o,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.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.submitting=!1}))}},mounted(){this.isEnrolled&&this.has_pro&&this.fetchAnswers()}},zF={key:0,class:"fcom_questions_wrap"},qF={key:0,class:"fcom_quiz_result"},GF={class:"result_status"},YF={key:0,class:"result_status_text"},WF={key:0},ZF={key:1},KF={class:"result_score"},JF={class:"score_part"},QF={class:"part_label"},XF={class:"part_value"},eT={class:"score_part"},tT={class:"part_label"},sT={class:"part_value"},oT={key:0,class:"fcom_question"},iT={key:0,class:"fcom_question_image"},nT={class:"fcom_question_header"},lT=["innerHTML"],aT={class:"fcom_question_body"},rT={key:0,class:"correct_text"},cT={key:1,class:"correct_text"},dT={class:"fcom_question_options"},uT={key:1,class:"question_help_text"},_T={key:2,class:"fcom_quiz_footer"},mT={key:0};function hT(e,t,o,u,s,n){var p,k;const m=x,f=Ie,h=g("Check"),y=j,w=g("Close"),b=pe,C=Y;return i(),c(M,null,[s.loading?(i(),v(C,{key:1,rows:5,animated:""})):(i(),c("div",zF,[n.alreadyAttempted?(i(),c("div",qF,[l("div",GF,[["passed","failed"].includes(s.userResult.status)?(i(),c("div",YF,[l("p",null,[n.isPassed?(i(),c("span",WF,"🎉 ")):(i(),c("span",ZF,"😞 ")),l("span",null,d(e.$t("You")),1),l("span",{style:le({color:n.isPassed?"green":"red"})},d(n.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,d(e.$t("the quiz.")),1)]),l("p",null,d(n.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(i(),c(M,{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:n.retakeQuiz},{default:r(()=>[V(d(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",KF,[l("div",JF,[l("span",QF,d(e.$t("Score")),1),l("span",XF,d(s.userResult.score)+"%",1)]),l("div",eT,[l("span",tT,d(e.$t("Correct Answers")),1),l("span",sT,d(((p=s.userResult.meta)==null?void 0:p.correct_answers)+" / "+((k=s.userResult.meta)==null?void 0:k.total_questions)),1)])])])):_("",!0),(i(!0),c(M,null,R(o.questions,$=>(i(),c(M,{key:$.slug},[n.showQuestion($)?(i(),c("div",oT,[n.showQuestionImage($)?(i(),c("div",iT,[a(f,{src:$.image_url},null,8,["src"])])):_("",!0),l("div",nT,[l("div",{innerHTML:$.label_rendered,class:"fcom_question_label"},null,8,lT)]),l("div",aT,[n.showResult?(i(),c("div",{key:0,class:H(["fcom_is_correct",n.isQuestionCorrect($)?"correct":"incorrect"])},[n.isQuestionCorrect($)?(i(),c("p",rT,[a(y,null,{default:r(()=>[a(h)]),_:1}),V(" "+d(e.$t("Correct")),1)])):(i(),c("p",cT,[a(y,null,{default:r(()=>[a(w)]),_:1}),V(" "+d(e.$t("Incorrect")),1)]))],2)):_("",!0),l("div",dT,[(i(!0),c(M,null,R($.options,S=>(i(),c("div",{key:S.label,class:"fcom_question_option"},[a(b,{class:H({single_choice:n.isSingleChoice($)}),"model-value":n.isOptionSelected($,S),onChange:T=>n.handleOptionChange($,S)},{default:r(()=>[V(d(S.label),1)]),_:2},1032,["class","model-value","onChange"])]))),128))]),$.help_text?(i(),c("div",uT,d($.help_text),1)):_("",!0)])])):_("",!0)],64))),128))])),!s.loading&&!n.alreadyAttempted?(i(),c("div",_T,[l("p",null,d(e.$t("Answer all questions to submit")),1),a(m,{class:"fcom_primary_button",onClick:n.submitQuiz,loading:s.submitting,disabled:s.submitting||!n.isAllAnswersSelected},{default:r(()=>[V(d(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(i(),c("span",mT," ("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"])])):_("",!0)],64)}const fT=I(NF,[["render",hT]]),pT={name:"ViewLesson",emits:["reload"],components:{PaperClipIcon:Gs,DocumentLists:tt,CircleIcon:_s,AppLayout:Ve,Layout:we,MediaPreview:De,CommentBox:RF,ChatIcon:Xe,ExitFullScreen:jF,QuizView:fT},props:["course","sections","track","currentLesson","lessonsCount","lesson_slug","currentLessonIndex","lessonsCount"],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.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,o,u,s,n;return((o=(t=(e=this.currentLesson)==null?void 0:e.meta)==null?void 0:t.media)==null?void 0:o.url)||((n=(s=(u=this.currentLesson)==null?void 0:u.meta)==null?void 0:s.media)==null?void 0:n.html)}},methods:{markAsComplete(){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")}).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 o=Array.from(t).map(u=>u.src).filter(Boolean);o.length&&(this._lightboxHandler&&e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=u=>{const s=u.target.closest("img");u.target.closest(".wp-lightbox-container")&&s&&(u.preventDefault(),u.stopPropagation(),this.lightboxImages=o,this.lightboxIndex=Math.max(0,o.indexOf(s.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 o=e.getBoundingClientRect(),u=t.getBoundingClientRect();o.top>=u.top&&o.bottom<=u.bottom&&o.left>=u.left&&o.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.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._lightboxHandler&&this.$refs.lessonContent&&this.$refs.lessonContent.removeEventListener("click",this._lightboxHandler)}},gT={key:0},yT={class:"fcom_back_space"},vT={class:"fcom_lesson_details",style:{padding:"2rem"}},bT={class:"fcom_back_space"},kT={class:"fcom_lesson_name"},wT={class:"fcom_lesson_nav"},CT={key:1},$T=["href"],ST={class:"fcom_lesson_details"},VT={class:"fcom_lesson_header"},LT={class:"fcom_lesson_title"},MT={class:"fcom_lesson_number"},FT=["href"],TT=["innerHTML"],PT={class:"fcom_lesson_nav"},IT=["innerHTML"],UT={class:"fcom_lesson_body feed_texts"},ET={key:0,class:"fcom_lesson_content"},BT=["innerHTML"],AT={key:0,class:"fcom_lesson_quiz"},DT={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},RT={class:"fcom_lesson_documents_header"},HT={key:0,class:"fcom_lesson_documents_list"},xT={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},OT={class:"fcom_lesson_comment_box"},jT={style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},NT={style:{padding:"0",margin:"0 0 20px"}},zT=["href"],qT={class:"fcom_section_sidebar_title"},GT={class:"fcom_section_items"},YT={class:"fcom_section_primary_item"},WT={class:"fcom_section_primary_item_title"},ZT=["id","onClick"],KT={class:"fcom_heading_item clickable"},JT=["innerHTML"],QT={key:0,class:"fcom_section_footer course_progress_footer_wrap"},XT={class:"fcom_course_progress_footer"};function eP(e,t,o,u,s,n){const m=Y,f=g("ArrowLeft"),h=j,y=g("FullScreen"),w=g("ExitFullScreen"),b=x,C=g("ChatIcon"),p=g("PaperClipIcon"),k=g("ArrowRight"),$=g("Operation"),S=g("media-preview"),T=g("QuizView"),F=g("DocumentLists"),B=g("CommentBox"),L=ke,D=Me,A=g("ArrowDown"),U=g("SuccessFilled"),P=g("Lock"),O=g("CircleIcon"),N=Qt,Q=Qe,_e=Cs,ne=xe,E=g("layout"),K=g("app-layout"),ae=J("loading");return i(),v(K,{class:H({fcom_full_screen:s.isFullScreen,fcom_show_right_aside:s.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:r(()=>[o.course&&o.currentLesson?(i(),v(E,{key:0,wrapper_class:"no_bg_layout"},{default:r(()=>[a(ne,{class:"fcom_lesson_container fcom_resp_container"},{default:r(()=>[a(D,{style:le({height:n.containerHeight}),class:"fcom_lesson_wrap"},{default:r(()=>[s.isTransiting?(i(),c("div",gT,[G((i(),c("div",yT,[...t[5]||(t[5]=[V(" ...... ",-1)])])),[[ae,!0]]),l("div",vT,[a(m,{rows:10,animated:!0})])])):(i(),v(L,{key:1,ref:"lesson_scroller"},{default:r(()=>{var W;return[l("div",bT,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=re=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1}),l("span",kT,d(o.course.title),1)]),l("div",wT,[a(b,{title:s.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:n.toggleFullScreen,size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[s.isFullScreen?(i(),v(w,{key:1})):(i(),v(y,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),o.currentLesson.can_view?(i(),c(M,{key:0},[n.commentsEnabled?(i(),v(b,{key:0,onClick:n.scrollToComments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(C)]),_:1})]),_:1},8,["onClick"])):_("",!0),n.hasDocuments?(i(),v(b,{key:1,onClick:n.scrollToDocuments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(p)]),_:1})]),_:1},8,["onClick"])):_("",!0),o.track.isEnrolled?(i(),v(b,{key:2,class:H(n.isCompleted?"":"fcom_primary_button"),style:{"margin-left":"15px"},type:"info",onClick:n.markAsComplete,size:"small"},{default:r(()=>[n.isCompleted?(i(),c("span",CT,d(e.$t("Completed")),1)):(i(),c(M,{key:0},[l("span",null,d(e.$t("Complete Lesson")),1),a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(k)]),_:1})],64))]),_:1},8,["class","onClick"])):e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(b,{key:4,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[ae,s.enrolling]]):_("",!0):(i(),c("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,$T))],64)):_("",!0),a(b,{style:{"margin-left":"15px"},size:"small",text:"",class:"fcom_sm_only",onClick:t[1]||(t[1]=re=>s.sm_side_show=!s.sm_side_show)},{default:r(()=>[a(h,null,{default:r(()=>[a($)]),_:1})]),_:1})])]),l("div",ST,[l("div",VT,[l("div",LT,[l("p",MT,[V(d(e.$t("Lesson %1$s of %2$s",o.currentLessonIndex+1,o.lessonsCount))+" ",1),e.isAdmin()?(i(),c("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:o.course.id,lesson_id:o.currentLesson.id})},d(n.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,FT)):_("",!0)]),l("h1",{innerHTML:o.currentLesson.title},null,8,TT)]),l("div",PT,[a(b,{onClick:t[2]||(t[2]=re=>e.$emit("setPrevLesson")),disabled:o.currentLessonIndex===0,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1})]),_:1},8,["disabled"]),a(b,{onClick:t[3]||(t[3]=re=>e.$emit("setNextLesson")),disabled:o.currentLessonIndex+1===o.lessonsCount,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(k)]),_:1})]),_:1},8,["disabled"])])]),o.currentLesson.can_view?(i(),c(M,{key:1},[n.showMediaPreview?(i(),v(S,{key:0,media_item:o.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",UT,[o.currentLesson.content_loading?(i(),c("div",ET,[a(m,{rows:5,animated:!0})])):(i(),c(M,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:o.currentLesson.content},null,8,BT),(W=o.currentLesson.meta)!=null&&W.quiz_questions?(i(),c("div",AT,[a(T,{lesson:o.currentLesson,isEnrolled:o.track.isEnrolled,questions:o.currentLesson.meta.quiz_questions},null,8,["lesson","isEnrolled","questions"])])):_("",!0)],64))]),n.hasDocuments&&!o.currentLesson.content_loading?(i(),c("div",DT,[l("div",RT,[l("h3",null,d(e.$t("Documents & Files")),1)]),e.has_pro?(i(),c("div",HT,[a(F,{class:"fcom_boxed_documents",document_lists:o.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(i(),c("div",{key:0,class:"fcom_locked_container",innerHTML:o.currentLesson.access_message},null,8,IT))]),n.commentsEnabled&&!o.currentLesson.content_loading?(i(),c("div",xT,[l("div",OT,[a(B,{show_comment_form:o.track.isEnrolled,feed:o.currentLesson,showAll:!0,checkPermission:!0},ve({before_comment_box:r(()=>[l("h3",null,d(e.$t("Lesson Discussions")),1)]),_:2},[o.track.isEnrolled?void 0:{name:"after_comment_box",fn:r(()=>[l("div",jT,[l("p",NT,d(e.$t("Please enroll the course to join the conversation.")),1),e.auth.user_id?!o.track.isEnrolled&&o.course.id?G((i(),v(b,{key:1,disabled:s.enrolling,onClick:n.enroll,class:"fcom_primary_button"},{default:r(()=>[V(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[ae,s.enrolling]]):_("",!0):(i(),c("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,zT))])]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),a(Q,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:r(()=>[a(L,{ref:"lesson_index_sidebar",height:n.containerHeight},{default:r(()=>[l("div",qT,[l("h3",null,d(e.$t("Lessons")),1)]),l("div",GT,[(i(!0),c(M,null,R(o.sections,W=>(i(),c("div",{key:W.id,class:"fcom_section_primary"},[l("div",YT,[l("div",WT,[a(h,{class:"clickable",onClick:re=>W.is_closed=!W.is_closed},{default:r(()=>[W.is_closed?(i(),v(k,{key:0,class:"fcom_arrow_icon"})):(i(),v(A,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,d(W.title),1)])]),W.is_closed?_("",!0):(i(!0),c(M,{key:0},R(W.lessons,re=>(i(),c("div",{class:H([{fcom_current_lesson:re.id==o.currentLesson.id},"fcom_section_item"]),key:re.id},[l("div",{id:"fcom_lesson_title_"+re.id,onClick:oe=>n.gotoLesson(re),class:"fcom_section_item_title"},[l("p",KT,[o.track.completed_lessons.includes(re.id.toString())?(i(),v(h,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(U)]),_:1})):re.can_view?(i(),v(h,{key:2},{default:r(()=>[a(O)]),_:1})):(i(),v(h,{key:1},{default:r(()=>[a(P)]),_:1})),l("span",{innerHTML:re.title},null,8,JT)])],8,ZT)],2))),128))]))),128))]),o.track.progress?(i(),c("div",QT,[l("div",XT,[l("p",null,d(e.$t("Course progress")),1),a(N,{class:"fcom_progress","stroke-width":8,percentage:parseInt(o.track.progress)},null,8,["percentage"])])])):_("",!0)]),_:1},8,["height"])]),_:1}),s.lightboxImages.length?(i(),v(_e,{key:0,"url-list":s.lightboxImages,"initial-index":s.lightboxIndex,"hide-on-click-modal":!0,"show-progress":"",onClose:t[4]||(t[4]=W=>s.lightboxImages=[])},null,8,["url-list","initial-index"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const tP=I(pT,[["render",eP]]),sP={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},oP={class:"fcom_box_list"},iP={class:"fcom_box_list_header"},nP={class:"fcom_box_list_body"},lP={class:"fcom_person_lists"},aP={class:"fcom_leader"},rP={key:0,class:"fcom_serial_suffix"},cP={key:0,class:"fcom_leader_stat"};function dP(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink");return i(),c("div",oP,[l("div",iP,d(o.leaders.title),1),l("div",nP,[l("ul",lP,[(i(!0),c(M,null,R(o.leaders.items,(h,y)=>(i(),c("li",{key:h.user_id},[l("div",aP,[l("div",{class:H(["fcom_serial_"+(y+1),"fcom_serial"])},[l("span",null,d(y+1),1),y<3?(i(),c("div",rP,[...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)?(i(),c("div",cP,[G(l("span",null,"+",512),[[yt,!n.isAll]]),V(" "+d(h.total_points),1)])):_("",!0)]))),128))])])])}const uP=I(sP,[["render",dP]]),_P={name:"LeaderTooltip",components:{InfoFilled:ts},props:{levelChunks:{type:Array,required:!0}}},mP={class:"fcoml_tooltip_content"},hP={class:"fcoml_tooltip_title"},fP={class:"fcoml_tooltip_subtitle"},pP=["innerHTML"],gP={class:"fcoml_tooltip_subtitle"},yP={class:"fcoml_tooltip_desc"},vP={class:"fcoml_tooltip_levels"},bP={class:"levels_list"},kP={class:"level_title"},wP={class:"level_points"};function CP(e,t,o,u,s,n){const m=g("InfoFilled"),f=j,h=x,y=fe;return i(),v(y,{persistent:!1,"popper-class":"fcoml_tooltip_popover",width:550,effect:"dark",trigger:"click"},{reference:r(()=>[a(h,{text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(()=>[l("div",mP,[l("h5",hP,d(e.$t("Leaderboard Points")),1),l("p",fP,d(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,pP),l("p",gP,d(e.$t("Levels")),1),l("p",yP,d(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",vP,[(i(!0),c(M,null,R(o.levelChunks,(w,b)=>(i(),c("div",{key:b},[l("ul",bP,[(i(!0),c(M,null,R(w,C=>(i(),c("li",{key:C.level,class:"level_item"},[l("div",kP,d(C.title),1),l("div",wP,d(e.$_n("%d point","%d points",C.min_points)),1)]))),128))])]))),128))])])]),_:1})}const $P=I(_P,[["render",CP]]),SP={name:"LeaderBoard",components:{InfoFilled:ts,LeaderLists:uP,AppLayout:Ve,Layout:we,LeaderTooltip:$P},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Ee(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((o,u,s)=>{const n=Math.floor(s/t);return o[n]||(o[n]=[]),o[n].push(u),o},[])}},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,class:"fcom_leaderboard_profile"},LP={class:"fcom_leaderboard_profile_inner"},MP={class:"fcom_profile_header"},FP={class:"fcom_profile_info"},TP={class:"info_avatar"},PP={class:"info_user"},IP={class:"fcom_level_name"},UP={class:"fcoml_level_sub"},EP={class:"fcoml_level_sub_icon"},BP={class:"fcoml_level_sub_text"},AP={class:"fcom_leaderboard_profile_avatar"},DP={class:"fcom_leaderboard_levels"},RP=["title"],HP={key:1},xP={class:"fcoml_level_detail"},OP={class:"fcoml_level_title"},jP={class:"fcoml_level_sub"},NP={class:"fcom_leaderboard_items"},zP={key:1,class:"white_loaded"};function qP(e,t,o,u,s,n){const m=g("UserAvatar"),f=g("UserRouteLink"),h=g("LeaderTooltip"),y=g("Lock"),w=j,b=_t,C=mt,p=g("leader-lists"),k=Y,$=g("layout"),S=g("app-layout");return i(),v(S,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a($,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:r(()=>[n.userLevel?(i(),c("div",VP,[l("div",LP,[l("div",MP,[l("div",FP,[l("div",TP,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",PP,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",IP,d(n.userLevel.title),1)])]),l("div",UP,[l("div",EP,[l("span",null,"🏆 "+d(e.auth.total_points),1),t[0]||(t[0]=V(" | ",-1)),l("span",null,d(e.$t("Level %d",n.userLevel.level)),1)]),l("div",BP,[V(d(e.$t("%d points to level up!",n.requiredPoints))+" ",1),a(h,{levelChunks:n.levelChunks},null,8,["levelChunks"])])])]),l("div",AP,[a(C,{gutter:20},{default:r(()=>[(i(!0),c(M,null,R(n.levelChunks,T=>(i(),v(b,{sm:24,md:8},{default:r(()=>[l("ul",DP,[(i(!0),c(M,null,R(T,F=>(i(),c("li",null,[l("div",{title:`${F.min_points} points`,class:H(["fcom_level_icon",{fcom_is_in_level:n.userLevel.max_points>=F.max_points}])},[n.userLevel.max_points<F.max_points?(i(),v(w,{key:0},{default:r(()=>[a(y)]),_:1})):(i(),c("span",HP,d(F.level),1))],10,RP),l("div",xP,[l("div",OP,d(F.title),1),l("div",jP,d(F.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",NP,[a(C,{gutter:20},{default:r(()=>[(i(!0),c(M,null,R(s.leaderboard,T=>(i(),v(b,{key:T.key,md:8,sm:24},{default:r(()=>[a(p,{leaders:T},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),s.loading?(i(),c("div",zP,[a(k,{rows:16,animated:!0})])):_("",!0)]),_:1},8,["title"])]),_:1})}const GP=I(SP,[["render",qP]]),YP=[{name:"dashboard",path:"/dashboard",component:Hy,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:t2,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:d2},{name:"single_feed",path:"post/:feed_slug",component:ys,props:!0}]},{path:"/space/:space/",component:a8,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:m8,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:_8,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:go,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_feed",path:"post/:feed_slug",component:ys,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_members",path:"members",component:e5,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:m6,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:O5,props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:Y6,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:eL,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:QC,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:G7,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:s7,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:L7,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:wo,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:d$,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:A$,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:n9,meta:{active_menu:"all_members"}},{name:"user_courses",path:"courses",component:M9,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:SV,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:ZS,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:pV,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:dL,meta:{}},{name:"bookmarks",path:"/bookmarks",component:pL,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:qL,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:QL,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:LF,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:tP,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:GP,meta:{active_menu:"leaderboards"}}],WP={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 o=e.split("/")[0];if(o=="community"){e=e.replace(/^community\//,"/space/"),this.$router.push(e);return}else if(o=="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(o=="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(o)}};function ZP(e,t,o,u,s,n){return i(),c("h1",null,d(s.message),1)}const KP=I(WP,[["render",ZP]]),JP={name:"VerifiedSign"};function QP(e,t,o,u,s,n){const m=Kt;return i(),v(m,{content:e.$t("Verified"),placement:"top"},{default:r(()=>[...t[0]||(t[0]=[l("span",{class:"fcom_verified"},[l("svg",{viewBox:"0 0 22 22","aria-label":"Verified account",role:"img","data-testid":"icon-verified"},[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)])]),_:1},8,["content"])}const XP=I(JP,[["render",QP]]),eI=[Ko,Es,Jo,Qo,Xo,ei,ti,si,oi,ii,ni,li,ai,ri,ci,di,ui,_i,Bs,mi,hi,fi,pi,As,gi,yi,vi,Rs,$t,bi,ki,wi,Ci,$i,Si,Vi,Li,Mi,Fi,Ti,Pi,Ii,Ui,ts,Te,Ei,Hs];function dt(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const o in e)t.push(dt(e[o]));else if(typeof e=="object"&&e.join!==void 0)for(const o in e)t.push(dt(e[o]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("<br />")}function tI(e){let t;try{t=new URL(e)}catch{t=new URL(e,"https://fluentcommunity.co")}let o=t.pathname;return o=o.replace(/^\//,""),o.split("/")[0]||""}const ce=Lo(Fy),hs=Ro();hs.use(Ho);hs.use(({store:e})=>{e.$api={get:(t,o)=>window.FluentCommunityUtil.Rest.get(t,o),post:(t,o)=>window.FluentCommunityUtil.Rest.post(t,o),put:(t,o)=>window.FluentCommunityUtil.Rest.put(t,o),patch:(t,o)=>window.FluentCommunityUtil.Rest.patch(t,o),delete:t=>window.FluentCommunityUtil.Rest.delete(t)}});ce.use(hs);ce.use(Bo);var bs,ks;ce.use(Zo,{loading:(((bs=window.fluentComAdmin)==null?void 0:bs.assets_url)||"")+"images/image-loader.svg",error:(((ks=window.fluentComAdmin)==null?void 0:ks.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 Gt="40%",Yt="60%",Co="500px";window.innerWidth<600?(Yt="95%",Gt="90%",Co="90%"):window.innerWidth<800&&(Yt="80%",Gt="80%");eI.forEach(e=>{ce.component(e.name,e)});ce.component("VerifiedSign",XP);ce.component("UserAvatar",cs);ce.component("UserRouteLink",Fe);ce.component("WelcomeBanner",ms);ce.component("UserBadge",ko);function vs(){var h,y,w,b,C;ce.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;ce.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:Gt,dialogWidth:Yt,modalWidth:Co,feedMonitorCache:{},mounted:!1,isMobile:window.innerWidth<=768,has_leaderboard:this.appVars.features.leaderboard}},methods:{$get:e.get,$post:e.post,$uploadFile:e.uploadFile,$put:e.put,$del:e.delete,$patch:e.patch,$ajax:e.ajax,changeTitle(p){document.title=p+" - "+this.appVars.site_title},$handleError(p){let k="";typeof p=="string"?k=p:p&&p.message?k=p.message:k=dt(p),k||(k="Something is wrong!"),typeof k!="string"&&(k=dt(k)),this.$notify({type:"error",title:this.$t("Error"),message:k,dangerouslyUseHTMLString:!0})},convertToText:dt,$t(p){p=window.fluentComAdmin.i18n[p]||p;const k=Array.prototype.slice.call(arguments,1);if(k.length===0)return p;const $=/%(\d*)\$?s|%d/g;let S=0;return p=p.replace($,(T,F)=>{if(F){const B=parseInt(F,10)-1;return B<k.length?k[B]:T}else return S<k.length?k[S++]:T}),p},$_n(p,k,$){return parseInt($.toString().replace(/,/g,""),10)>1?this.$t(k,$):this.$t(p,$)},$labelize(p){return p?(p=p.charAt(0).toUpperCase()+p.slice(1),window.fluentComAdmin.i18n[p]?window.fluentComAdmin.i18n[p]:p.replace(/_/g," ").replace(/\b\w/g,k=>k.toUpperCase())):""},$toClipboard(p,k="Copied to clipboard"){navigator.clipboard.writeText(p).then(()=>{this.$notify.success(this.$t(k))}).catch($=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(p){return dayjs.utc(p).local().fromNow()},$storeLocalData(p,k){this.Storage.set(p,k)},$getLocalData(p,k=""){return this.Storage.get(p,k)},ucFirst(p){return p?p.charAt(0).toUpperCase()+p.slice(1):""},ucWords(p){return p?p.replace(/\b[a-z]/g,function(k){return k.toUpperCase()}):""},smartDate(p,k=!1,$=!1){if(!p)return"";let S="D MMM, YYYY";dayjs(p).isSame(new Date,"year")?(S="D MMM",k&&(Math.abs(dayjs(p).diff(new Date,"days"))<=5||$)&&(S="D MMM, HH:mm")):k&&$&&(S="D MMM, YYYY, HH:mm");const T=dayjs(p);return T.isValid()?T.format(S):null},hasPermission(p){return this.appVars.permissions[p]},isAdmin(){return!!this.appVars.permissions.community_admin},hasCourseAdminAccess(){return!!this.appVars.permissions.course_admin},hasCourseCreatorAccess(){return!!this.appVars.permissions.course_creator},hasSpaceAdminAccess(p=null){return this.hasPermissionOrInCurrentSpace("community_admin")||p&&this.isSpaceAdmin(p)},hasSpaceModeratorAccess(p=null){return this.hasPermissionOrInCurrentSpace("community_moderator")||p&&this.isSpaceModerator(p)},canDeleteFeed(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_feed"))},canEditFeed(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_feed"))},canDeleteComment(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_comment"))},canEditComment(p){return this.auth.user_id&&(p.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_comment"))},hasSpaceAccess(p){return p?this.appVars.user_membership_slugs.indexOf(p)!==-1:!0},hasInPermission(p,k){return!k||typeof k!="object"?!1:k[p]},hasCurrentSpacePermission(p){return window.fcom_current_community?this.hasInPermission(p,window.fcom_current_community.permissions):!1},hasPermissionOrInCurrentSpace(p){return this.hasPermission(p)?!0:this.hasCurrentSpacePermission(p)},humanDateDiff(p){if(!p)return"";const k=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss");if(!k.isValid())return"";const $=k.add(this.appVars.date_offset,"s");return dayjs($.format("YYYY-MM-DD HH:mm:ss")).from(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},isToday(p){return dayjs(p).isSame(dayjs(),"day")},isPastDate(p){if(!p)return!0;const k=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss");return k.isValid()?k.add(this.appVars.date_offset,"s").isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss"))):!0},formattedDate(p){return dayjs(p).format(this.appVars.date_formatter)},formattedTime(p){return dayjs(p).format(this.appVars.time_formatter)},formattedDateTime(p){return dayjs(p).format(this.appVars.date_time_formatter)},hasCommentPermission(p){var k;return this.auth.user_id?!p.space_id&&!p.course_id?this.auth.user_id&&(p.user_id==this.auth.user_id||p.privacy=="public"):this.hasSpaceAccess((k=p.space)==null?void 0:k.slug):!1},getExcerpt(p,k=250){if(!p)return"";let $=p.replace(/(<([^>]+)>)/ig,"");return $=$.replace(/(\*\*|__)(.*?)\1/g,"$2"),$=$.replace(/(#+)(.*)/g,"$2"),$=$.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),typeof DOMParser<"u"&&($=new DOMParser().parseFromString($,"text/html").body.textContent||""),$.length>k&&($=$.substring(0,k)+"..."),$},mdToHtml(p){return p?(p=p.replace(" ","",p),p=p.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>"),p=p.replace(/\*(.*?)\*/g,"<em>$1</em>"),p=p.replace(/\~\~(.*?)\~\~/g,"<del>$1</del>"),p=p.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),p=p.replace(/<(https?:\/\/[^\s>]+)>/g,'<a href="$1">$1</a>'),p=p.replace(/^##\s+(.*?)$/gm,"<h2>$1</h2>"),p=p.replace(/^###\s+(.*?)$/gm,"<h3>$1</h3>"),p=p.replace(/^####\s+(.*?)$/gm,"<h4>$1</h4>"),p=p.replace(/^>\s+(.*?)$/gm,"<blockquote>$1</blockquote>"),p=p.replace(/`{3}([\s\S]*?)`{3}/g,"<pre><code>$1</code></pre>"),p=p.replace(/`([^`]+)`/g,"<code>$1</code>"),p=p.replace(/^([\*\-])\s+(.*)$/gm,"<li>$2</li>"),p=p.replace(/(<li>.*?<\/li>(?:\n<li>.*?<\/li>)*)/g,function(k){return"<ul>"+k.replace(/\n/g,"")+"</ul>"}),p=p.replace(/\n/g,"<br>"),p):""},$convertToBoolean(p){return p==="true"||p===!0||p===1||p==="1"||p==="yes"||p==="on"},each:Re,hasFeature(p){return this.appVars.features[p]},isCommunityModerator(){return window.fluentComAdmin.auth.community_roles.some(p=>p==="admin"||p==="moderator")},isSpaceModerator(p){var $,S;return["admin","moderator"].includes((S=($=p==null?void 0:p.membership)==null?void 0:$.pivot)==null?void 0:S.role)},isSpaceAdmin(p){var k,$;return(($=(k=p==null?void 0:p.membership)==null?void 0:k.pivot)==null?void 0:$.role)=="admin"},isModerator(p){if(this.isCommunityModerator())return!0;if(!p)return!1;const k=this.auth.spaces[p];return this.isSpaceModerator(k)},getCurrentAuthUrl(){let p=window.location.href,k=this.appVars.auth_url;return k=k.replace(/(\?|&)redirect_to=[^&]+/,""),k.indexOf("?")===-1?k+="?":k+="&",k+"redirect_to="+encodeURIComponent(p)},$formatNumber(p){return p&&p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(p,k={}){return Re(k,($,S)=>{p=p.replace(":"+S,$)}),this.appVars.portal_url+p},isOnline(p){if(!p)return!1;const $=dayjs.utc(p,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return $<=5&&$>=0},setFollowIds(p){Be().setFollows(p)},$exportToCsv(p,k="fcom-export.csv"){if(!p||!Array.isArray(p)||p.length===0){this.$notify({type:"error",title:this.$t("Error"),message:this.$t("No data available to export.")});return}const $=Object.keys(p[0]),S=[$.join(",")];p.forEach(L=>{const D=$.map(A=>`"${String(L[A]??"").replace(/"/g,'""')}"`);S.push(D.join(","))});const T="\uFEFF"+S.join(` |
| 5 |
`),F=new Blob([T],{type:"text/csv;charset=utf-8;"}),B=document.createElement("a");B.href=URL.createObjectURL(F),B.download=k,document.body.appendChild(B),B.click(),document.body.removeChild(B),URL.revokeObjectURL(B.href)},doNothing(){console.log("OK")}},mounted(){if(window.fcom_mounted)return;this.isMobile&&document.body.classList.add("fcom-is-mobile"),window.fcom_mounted=!0,document.addEventListener("click",k=>{if(k.metaKey||k.ctrlKey)return;const $=k.target.closest("a");if($&&$.target==="_blank")return;let S=k.target.getAttribute("href");if(S||$&&(S=$.getAttribute("href")),!!S){if(window.fluentComAdmin.is_absolute_url){let T=tI(S);if(T){if(window.fluentComAdmin.portal_paths.indexOf(T)===-1){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:S}}));return}}else{let F=window.location.origin,B=new URL(S).origin;if(F==B&&new URL(S).search){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:S}}));return}}}if(S.startsWith(window.fluentComAdmin.urls.portal_base)){if(S.indexOf("fcom_action")!==-1||S.startsWith(window.fluentComAdmin.urls.portal_base+"admin"))return;k.preventDefault(),S=S.replace(window.fluentComAdmin.urls.portal_base,"/"),this.$router.push(S)}else document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:S}}))}});let p=window.fluentComAdmin.dateTime18n;dayjs.updateLocale("en",{weekdays:p.weekdays.split("_"),months:p.months.split("_"),weekdaysShort:p.weekdaysShort.split("_"),monthsShort:p.monthsShort.split("_"),weekdaysMin:p.weekdaysMin.split("_"),formats:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},relativeTime:this.isMobile?p.relativeTimeMobile:p.relativeTime}),document.addEventListener("fcom_renew_rest_nonce",k=>{this.$ajax("GET","fluent_community_renew_nonce",{ajax_nonce:window.fluentComAdmin.ajax_nonce}).then($=>{$.rest_nonce&&(window.fluentComAdmin.rest.nonce=$.rest_nonce,window.fluentComAdmin.ajax_nonce=$.ajax_nonce)}).catch($=>{window.fluentFrameworkApp.$messageBox.alert(this.$t("Your session has expired due to inactivity. Please refresh the page to continue."),this.$t("Session Expired"),{confirmButtonText:this.$t("Refresh"),callback:S=>{location.reload()}})})})}}),ce.config.globalProperties.$notify=Ao,ce.config.globalProperties.$confirm=jt.confirm,ce.config.globalProperties.$promt=jt.prompt,ce.config.globalProperties.$messageBox=jt,ce.config.globalProperties.$gloablStorage={},ce.config.globalProperties.currentTimeZoneName=window.dayjs.tz.guess();const t=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_routes",YP);t.push({path:"/:catchAll(.*)",name:"not-found",component:KP});let o=null;const u=(p,k,$)=>{const S=Ge();if($)return $;if(k&&k.path&&p.path){const T=S.restoreScrollPosition(p.path);if(T>0)return{top:T,behavior:"auto"}}return{top:0}};window.fluentComAdmin.routing_system=="hash"?o=fs({routes:t,history:Mo(),scrollBehavior:u}):o=fs({routes:t,history:Fo(window.fluentComAdmin.portal_slug),scrollBehavior:u});const s=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_app",ce);window.fluentFrameworkApp=s.use(o).mount("#fluent_com_portal");const n=Ge();n.initialize();const m=Be();m.initializeCurrentUser();const f=os();(y=(h=window.fluentComAdmin)==null?void 0:h.auth)!=null&&y.user_id&&((b=(w=window.fluentComAdmin)==null?void 0:w.features)!=null&&b.notifications_polling)&&f.startPolling(6e4),(C=window.fluentComAdmin)!=null&&C.debug_mode&&(window.fcomDevTools={stores:{feed:Le(),space:He(),cache:ie(),ui:n,user:m,notification:f},memory:{getStats:()=>{const p=Le(),k=ie(),$=He(),S={feeds:p.getMemoryStats,cache:k.getCacheStats,spaces:{total:Object.keys($.spacesBySlug).length,mySpaces:$.mySpaces.length}};if("memory"in performance){const T=performance.memory;S.browser={usedMB:(T.usedJSHeapSize/1048576).toFixed(2),totalMB:(T.totalJSHeapSize/1048576).toFixed(2),limitMB:(T.jsHeapSizeLimit/1048576).toFixed(2),percentage:(T.usedJSHeapSize/T.jsHeapSizeLimit*100).toFixed(2)+"%"}}return console.table(S),S},cleanup:()=>{const p=Le(),k=ie();console.log("🧹 Running memory cleanup..."),p.pruneOldFeeds(),k.pruneLRU(),console.log("✅ Cleanup complete"),window.fcomDevTools.memory.getStats()}},help:()=>{console.log(` |
| 6 |
🛠️ FluentCommunity DevTools |
| 7 |
|
| 8 |
Available commands: |
| 9 |
fcomDevTools.memory.getStats() - Show memory statistics |
| 10 |
fcomDevTools.memory.cleanup() - Run memory cleanup |
| 11 |
fcomDevTools.stores.feed - Access Feed Store |
| 12 |
fcomDevTools.stores.space - Access Space Store |
| 13 |
fcomDevTools.stores.cache - Access Cache Store |
| 14 |
fcomDevTools.stores.ui - Access UI Store |
| 15 |
`)}},console.log("🛠️ FluentCommunity DevTools loaded. Type fcomDevTools.help() for available commands.")),document.dispatchEvent(new Event("fluentComPortalAppReady")),window.fluentFrameworkAppRouter=o}window.FluentCommunityUtil?vs():document.addEventListener("fluentCommunityUtilReady",function(){vs()}); |
| 16 |
|