| 1 |
import{D as n,F as c,K as l,ae as p,ab as R,L as x,S as a,I as r,E as y,O as _,Q as d,R as P,af as ee,J as Y,P as M,a7 as z,B as G,ak as ve,ay as Pe,W as re,aj as ae,M as Ct,V as As,a5 as ts,G as No,T as dt,a2 as zo,U as wt,at as qo,al as ws,am as Cs,az as Go,ar as Yo}from"./vue.js?ver=2.7.7";import{c as $s,a as Wo,b as Zo}from"./vue-router.js?ver=2.7.7";import{E as O,a as Ko,b as H,c as Z,d as ye,e as mt,f as te,g as fe,h as Ke,i as ht,j as ft,k as Fe,l as ze,m as ke,n as we,o as Bs,p as Ue,q as Ce,r as ie,s as ne,t as $t,u as ue,v as Ds,w as _e,x as Je,y as Qe,z as Xe,A as Rs,B as St,C as Vt,D as Mt,F as Tt,G as xs,H as Re,I as xe,J as Jo,K as Hs,L as Os,M as Qo,N as js,O as Xo,P as Ns,Q as Le,R as qe,S as et,T as ss,U as ei,V as os,W as is,X as ns,Y as ls,Z as as,_ as ti,$ as si,a0 as Zt}from"./element-plus.js?ver=2.7.7";import"./dayjs.js?ver=2.7.7";import{d as Ge,m as oi,a as zs,c as ii,s as ni}from"./pinia.js?ver=2.7.7";import{g as rs,bc as li,bd as Lt,a5 as Kt,az as Ss,be as qs,a1 as Gs,a0 as Pt,bf as ai,bg as Ee,l as ri,bh as Ys,bi as Ws,n as Zs,bj as ci,bk as di,L as ui,M as _i,J as Ks,bl as mi,bm as hi,m as fi,bn as pi,b as Ft,bo as Js,U as Qs,R as Xs,bp as gi,bq as eo,br as yi,bs as vi,bt as bi,bu as ki,bv as wi,bw as Ci,bx as $i,by as Si,bz as Vi,bA as Mi,bB as Ti,bC as Li,v as Pi,j as Fi,bD as Ii,bE as Ei,bF as Ui,bG as Ai,s as Bi,D as Di,C as Ri,p as xi,bH as Hi,bI as Oi,bJ as ji,bK as Ni,bL as zi,bM as qi,bN as Gi,$ as Yi,bO as Wi,bP as Zi,bQ as Ki,bR as Ji,N as Qi,bS as Xi}from"./vendor.js?ver=2.7.7";import{_ as I,P as en,E as tn}from"./emoji-picker.js?ver=2.7.7";import{u as sn,v as cs,w as on,x as je,y as nn}from"./lodash.js?ver=2.7.7";import{H as ln,O as an,m as rn,s as cn,c as dn,a as un,h as _n,b as mn,x as hn,P as fn,W as pn,U as gn,d as yn,_ as vn,u as Jt,$ as bn,w as kn,r as wn,L as lt,e as Cn}from"./milkdown.js?ver=2.7.7";const ce=Ge("cache",{state:()=>({cache:{},stats:{hits:0,misses:0,size:0,totalSaved:0},maxSize:500,maxMemorySize:50*1024*1024}),getters:{getCacheHitRate:e=>{const t=e.stats.hits+e.stats.misses;return t>0?(e.stats.hits/t*100).toFixed(2):0},getCacheSize:e=>Object.keys(e.cache).length,getMemoryUsage:e=>{try{return(new Blob([JSON.stringify(e.cache)]).size/1024/1024).toFixed(2)+" MB"}catch{return"Unknown"}},getCacheKeys:e=>Object.keys(e.cache),getCacheEntry:e=>t=>e.cache[t]||null},actions:{get(e,t=null){const s=this.cache[e];if(!s)return this.stats.misses++,null;const u=Date.now()-s.timestamp,o=s.ttl||t||5*60*1e3;return u>o?(delete this.cache[e],this.stats.misses++,this.stats.size=Object.keys(this.cache).length,null):(this.stats.hits++,s.hits=(s.hits||0)+1,s.lastAccessed=Date.now(),s.data)},set(e,t,s=5*60*1e3){Object.keys(this.cache).length>=this.maxSize&&this.pruneLRU(50),this.cache[e]={data:t,timestamp:Date.now(),lastAccessed:Date.now(),hits:0,ttl:s},this.stats.size=Object.keys(this.cache).length,this.stats.totalSaved++},invalidate(e){this.cache[e]&&(delete this.cache[e],this.stats.size=Object.keys(this.cache).length)},invalidatePattern(e){let t=0;return Object.keys(this.cache).forEach(s=>{s.includes(e)&&(delete this.cache[s],t++)}),this.stats.size=Object.keys(this.cache).length,t},pruneLRU(e){const t=Object.entries(this.cache).map(([s,u])=>({key:s,lastAccessed:u.lastAccessed||u.timestamp})).sort((s,u)=>s.lastAccessed-u.lastAccessed).slice(0,e);return t.forEach(({key:s})=>{delete this.cache[s]}),this.stats.size=Object.keys(this.cache).length,t.length},pruneExpired(e=15*60*1e3){let t=0;const s=Date.now();return Object.entries(this.cache).forEach(([u,o])=>{s-o.timestamp>e&&(delete this.cache[u],t++)}),this.stats.size=Object.keys(this.cache).length,t},clear(){this.cache={},this.stats.hits=0,this.stats.misses=0,this.stats.size=0},getStats(){return{...this.stats,hitRate:this.getCacheHitRate,memoryUsage:this.getMemoryUsage,cacheSize:this.getCacheSize}},has(e){return e in this.cache},getKeysMatching(e){return Object.keys(this.cache).filter(t=>t.includes(e))},warmCache(e){Object.entries(e).forEach(([t,s])=>{this.set(t,s)})}}}),to=Ge("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},consumeScrollPosition(e){const t=this.restoreScrollPosition(e);return t>0&&(this.lastScrollPath=null,this.lastScrollPosition=0),t},saveLastViewedFeed(e,t,s){this.lastViewedFeed[e]={feedId:t,index:s,timestamp:Date.now()}},setLayoutStyle(e){this.layoutStyle=e;try{localStorage.setItem("fcom_feed_layout",e)}catch(t){console.error("Failed to save layout style:",t)}},setLayoutStyleForContext(e,t){this.layoutStyleByContext[e]=t;try{localStorage.setItem("fcom_layout_by_context",JSON.stringify(this.layoutStyleByContext))}catch(s){console.error("Failed to save layout style:",s)}},setSortBy(e){this.sortBy=e;try{localStorage.setItem("fcom_feed_sort",e)}catch(t){console.error("Failed to save sort preference:",t)}},setSortByForContext(e,t){this.sortByContext[e]=t;try{localStorage.setItem("fcom_sort_by_context",JSON.stringify(this.sortByContext))}catch(s){console.error("Failed to save sort preference:",s)}},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}}}),De=Ge("user",{state:()=>({currentUser:null,profilesByUsername:{},follows:{},followers:[],loading:{},lastFetched:{}}),getters:{getProfile:e=>t=>e.profilesByUsername[t]||null,isFollowing:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&["1","2"].includes(String(s))},isBlocked:e=>t=>{const s=e.follows[String(t)];return s!==void 0&&String(s)==="0"},getFollowLevel:e=>t=>e.follows[String(t)],getCurrentUser:e=>e.currentUser,isLoading:e=>t=>e.loading[t]||!1,followingCount:e=>Object.values(e.follows).filter(t=>["1","2"].includes(String(t))).length,followersCount:e=>e.followers.length},actions:{initializeCurrentUser(){var e;(e=window.fluentComAdmin)!=null&&e.auth&&(this.currentUser=window.fluentComAdmin.auth)},setFollows(e){if(!(!e||typeof e!="object"))for(const[t,s]of Object.entries(e)){const u=String(t);s==null?delete this.follows[u]:this.follows[u]=String(s)}},removeFollow(e){delete this.follows[String(e)]},async fetchProfile(e,t=!1){const s=ce(),u=`user-profile:${e}`;if(!t){const o=s.get(u);if(o)return this.profilesByUsername[e]=o,o.follow!==void 0&&o.user_id&&this.setFollows({[o.user_id]:o.follow}),o}this.loading[e]=!0;try{const o=await this.$api.get(`profile/${e}`),i=o.profile;return i.follow!==void 0&&i.user_id&&this.setFollows({[i.user_id]:i.follow}),o.current_user_follows&&this.setFollows(o.current_user_follows),this.profilesByUsername[e]=i,this.lastFetched[e]=Date.now(),s.set(u,i,5*60*1e3),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch user profile:",o),o}},async updateProfile(e,t=null,s=null){var o,i;const u=ce();try{const m=s||((o=this.currentUser)==null?void 0:o.username),f=await this.$api.put(`profile/${m}`,{data:e}),h=f.profile||f.user||f;return this.currentUser={...this.currentUser,...h},t&&t!==h.username&&(delete this.profilesByUsername[t],u.invalidate(`user-profile:${t}`)),h.username&&(this.profilesByUsername[h.username]=h,u.invalidate(`user-profile:${h.username}`)),(i=window.fluentComAdmin)!=null&&i.auth&&(window.fluentComAdmin.auth={...window.fluentComAdmin.auth,...h}),h}catch(m){throw console.error("Failed to update profile:",m),m}},async toggleFollow(e,t=null){var f,h,g;const s=ce(),u=String(e),o=this.follows[u],i=o!==void 0&&["1","2"].includes(String(o)),m=o;i?(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)):(this.follows[u]="1",t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow="1"));try{const k=i?`profile/${t}/unfollow`:`profile/${t}/follow`,b=await this.$api.post(k);return i?delete this.follows[u]:((f=b.follow)==null?void 0:f.level)!==void 0&&this.setFollows({[u]:b.follow.level}),t&&this.profilesByUsername[t]&&(((h=b.xprofile)==null?void 0:h.followers_count)!==void 0&&(this.profilesByUsername[t].followers_count=b.xprofile.followers_count),s.invalidate(`user-profile:${t}`)),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("user_follow_toggled",{userId:e,isFollowing:!i}),b}catch(k){throw i?(this.follows[u]=m,t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count++,this.profilesByUsername[t].follow=m)):(delete this.follows[u],t&&this.profilesByUsername[t]&&(this.profilesByUsername[t].followers_count--,this.profilesByUsername[t].follow=void 0)),console.error("Failed to toggle follow:",k),k}},invalidateProfile(e){ce().invalidate(`user-profile:${e}`),delete this.lastFetched[e]},clearAll(){this.currentUser=null,this.profilesByUsername={},this.follows={},this.followers=[],this.loading={},this.lastFetched={};const e=ce();e.invalidatePattern("user-profile:"),e.invalidate("user-following")}}}),Te=Ge("feed",{state:()=>({feedsByContext:{},feedsById:{},stickyFeeds:{},loading:{},pagination:{},filters:{},tickerIntervals:{},tickerEnabled:{},lastTickerCheck:{},tickerPending:{},newPostsCount:{},ticker:{count:0,lastFetched:0},executionTimes:{},_pendingRequests:{},_recentContexts:[]}),getters:{getFeedsByContext:e=>t=>{const s=e.feedsByContext[t];return s?s.data||[]:[]},getFeedById:e=>t=>e.feedsById[t]||null,getStickyFeed:e=>t=>e.stickyFeeds[t]||null,getPagination:e=>t=>e.pagination[t]||{page:1,per_page:10,total:0,last_page:1,has_more:!1},isLoading:e=>t=>e.loading[t]||!1,getExecutionTime:e=>t=>e.executionTimes[t]||"",totalFeedsInMemory:e=>{let t=Object.keys(e.feedsById).length;return Object.values(e.feedsByContext).forEach(s=>{var u;t+=((u=s.data)==null?void 0:u.length)||0}),t},disableAutoLoad:e=>t=>{const s=e.loading[t]||!1,u=e.pagination[t];return u?s||u.has_more===!1:!0},getTickerCount:e=>e.ticker.count||0,getTickerLastFetched:e=>e.ticker.lastFetched||0,isTickerActive:e=>t=>e.tickerEnabled[t]&&e.tickerIntervals[t]!==null,getNewPostsCount:e=>t=>e.newPostsCount[t]||0,getMemoryStats:e=>{let t=0,s={};Object.keys(e.feedsByContext).forEach(i=>{var f,h;const m=((h=(f=e.feedsByContext[i])==null?void 0:f.data)==null?void 0:h.length)||0;s[i]=m,t+=m});const u=Object.keys(e.feedsById).length,o=(t*5/1024).toFixed(2);return{totalFeeds:t,feedsByContextCount:s,feedsByIdCount:u,estimatedMemoryMB:o,contexts:Object.keys(e.feedsByContext).length}}},actions:{async fetchFeeds(e,t={},s=!1){var g,k,b;if(console.log("[Feed Store] fetchFeeds called:",{context:e,loadMore:s,paramsPage:t.page,currentLoading:this.loading[e],currentPage:(g=this.pagination[e])==null?void 0:g.page}),this.loading[e]){console.log("[Feed Store] Already loading for context:",e,"- ignoring duplicate request");return}const u=s?(((k=this.pagination[e])==null?void 0:k.page)||0)+1:t.page||1,o={...t,page:u,per_page:t.per_page||10},i=`feeds:${e}:${JSON.stringify(o)}`,m=ce(),f=JSON.stringify({search:o.search||"",order_by_type:o.order_by_type||"",topic_slug:o.topic_slug||""});if(!s&&u===1){const w=m.get(i,3e5);if(w)return this.feedsByContext[e]={...w.feedsByContext,filterKey:f},this.pagination[e]=w.pagination,this.executionTimes[e]=w.executionTime,this.touchContext(e),w.stickyFeed&&!window["viewed_sticky_posts_"+w.stickyFeed.id]?this.stickyFeeds[e]=w.stickyFeed:(this.stickyFeeds[e]=null,w.stickyFeed&&((b=this.feedsByContext[e])!=null&&b.data)&&(this.feedsByContext[e].data.some(S=>S.id===w.stickyFeed.id)||this.feedsByContext[e].data.unshift(w.stickyFeed))),w.feedsByContext.data.forEach(S=>{this.feedsById[S.id]=S}),this.loading[e]=!1,w}return this.loading[e]=!0,this.$api.get(t.feed_base_url||"feeds",o).then(w=>{var S,C,v,$;if(w.sticky){const T="viewed_sticky_posts_"+w.sticky.id;window[T]?(w.feeds.data.some(V=>V.id===w.sticky.id)||w.feeds.data.unshift(w.sticky),this.stickyFeeds[e]=null):this.stickyFeeds[e]=w.sticky}else u===1&&(this.stickyFeeds[e]=null);if(s){const T=((S=this.feedsByContext[e])==null?void 0:S.data)||[];this.feedsByContext[e]={data:[...T,...w.feeds.data],timestamp:Date.now(),filterKey:f}}else this.feedsByContext[e]={data:w.feeds.data,timestamp:Date.now(),filterKey:f};if(this.pagination[e]={page:u,per_page:o.per_page,total:w.feeds.total,last_page:w.feeds.last_page,has_more:w.feeds.has_more},this.touchContext(e),console.log("[Feed Store] Updated pagination:",{context:e,page:u,has_more:w.feeds.has_more,total:w.feeds.total}),w.execution_time&&(this.executionTimes[e]=w.execution_time),w.feeds.data.forEach(T=>{this.feedsById[T.id]={...T,timestamp:Date.now()}}),s){const T=((v=(C=this.feedsByContext[e])==null?void 0:C.data)==null?void 0:v.length)||0;T>500&&(console.log("[Feed Store] Pruning feeds, count:",T),this.pruneOldFeeds(e))}return w.last_fetched_timestamp&&(this.ticker.lastFetched=w.last_fetched_timestamp,($=window.fluentFrameworkApp)!=null&&$.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("newest_feed_fetched",{last_fetched_timestamp:w.last_fetched_timestamp})),w.current_user_follows&&De().setFollows(w.current_user_follows),!s&&u===1&&m.set(i,{feedsByContext:this.feedsByContext[e],pagination:this.pagination[e],stickyFeed:this.stickyFeeds[e],executionTime:this.executionTimes[e]}),console.log("[Feed Store] Fetch SUCCESS, stored feeds for context:",e,{feedCount:this.feedsByContext[e].data.length,pagination:this.pagination[e],hasSticky:!!this.stickyFeeds[e]}),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after success for context:",e),{feeds:this.feedsByContext[e].data,pagination:this.pagination[e],sticky:this.stickyFeeds[e]}}).catch(w=>{throw console.error("[Feed Store] Failed to fetch feeds:",w),this.loading[e]=!1,console.log("[Feed Store] Set loading to FALSE after error for context:",e),w})},async fetchFeedBySlug(e){const t=`feed:slug:${e}`,s=ce(),u=s.get(t,10*60*1e3);if(u)return this.feedsById[u.id]=u,u;try{const i=(await this.$api.get(`feeds/${e}/by-slug`)).feed;return this.feedsById[i.id]={...i,timestamp:Date.now()},s.set(t,i),window.appVars&&(window.appVars.last_feed_id=i.id),i}catch(o){throw console.error("Failed to fetch feed:",o),o}},async createFeed(e,t){var s,u,o,i,m;try{const f=await this.$api.post("feeds",t),h=f.feed;if(this.feedsById[h.id]={...h,timestamp:Date.now()},!f.scheduled_at){const k=w=>{this.feedsByContext[w]||(this.feedsByContext[w]={data:[],timestamp:Date.now()}),this.stickyFeeds[w]&&(this.feedsByContext[w].data.some(C=>C.id===this.stickyFeeds[w].id)||this.feedsByContext[w].data.unshift(this.stickyFeeds[w]),this.stickyFeeds[w]=null);const S=this.feedsByContext[w].data.findIndex(C=>C.id===h.id);S===-1&&this.feedsByContext[w].data.unshift(h),this.pagination[w]?S===-1&&this.pagination[w].total++:this.pagination[w]={page:1,per_page:10,total:1,last_page:1,has_more:!1}};k(e),h.space_id&&e!=="global"&&(k("global"),ce().invalidatePattern("feeds:global"));const b=`user-${h.user_id}`;this.feedsByContext[b]&&e!==b&&k(b),(u=(s=window.fluentFrameworkApp)==null?void 0:s.$eventBus)==null||u.emit("recent_activities_refresh")}return f.last_fetched_timestamp&&(this.ticker.lastFetched=f.last_fetched_timestamp,(o=window.FluentCommunityUtil)!=null&&o.eventBus&&((m=(i=window.fluentFrameworkApp)==null?void 0:i.$eventBus)==null||m.emit("newest_feed_fetched",{last_fetched_timestamp:f.last_fetched_timestamp}))),ce().invalidatePattern(`feeds:${e}`),f}catch(f){throw console.error("Failed to create feed:",f),f}},async updateFeed(e,t){const s=this.feedsById[e]?{...this.feedsById[e]}:null;this.feedsById[e]&&(this.feedsById[e]={...this.feedsById[e],...t,timestamp:Date.now()}),Object.keys(this.feedsByContext).forEach(u=>{const o=this.feedsByContext[u].data.findIndex(i=>i.id===e);o!==-1&&(this.feedsByContext[u].data[o]={...this.feedsByContext[u].data[o],...t})});try{const o=(await this.$api.patch(`feeds/${e}`,t)).feed;return this.feedsById[e]={...this.feedsById[e],...o,timestamp:Date.now()},Object.keys(this.feedsByContext).forEach(m=>{const f=this.feedsByContext[m].data.findIndex(h=>h.id===e);f!==-1&&(this.feedsByContext[m].data[f]={...this.feedsByContext[m].data[f],...o})}),ce().invalidatePattern("feed:"),o}catch(u){throw s&&(this.feedsById[e]=s,Object.keys(this.feedsByContext).forEach(o=>{const i=this.feedsByContext[o].data.findIndex(m=>m.id===e);i!==-1&&(this.feedsByContext[o].data[i]=s)})),console.error("Failed to update feed:",u),u}},async deleteFeed(e,t,s=null){try{return await this.$api.delete(`feeds/${t}`),delete this.feedsById[t],s!==null&&this.feedsByContext[e]?this.feedsByContext[e].data.splice(s,1):Object.keys(this.feedsByContext).forEach(o=>{var i;(i=this.feedsByContext[o])!=null&&i.data&&(this.feedsByContext[o].data=this.feedsByContext[o].data.filter(m=>m.id!==t))}),this.pagination[e]&&this.pagination[e].total--,ce().invalidatePattern("feed:"),!0}catch(u){throw console.error("Failed to delete feed:",u),u}},async fetchTicker(e){var t,s,u;try{const o=e||this.ticker.lastFetched;console.log("[Legacy Ticker] Fetching ticker with timestamp:",o);const i=await this.$api.get("feeds/ticker",{last_fetched_timestamp:o});if(console.log("[Legacy Ticker] Response:",{has_changes:i.has_changes,feeds:((t=i.feeds)==null?void 0:t.length)||0,new_items_count:i.new_items_count}),this.ticker={count:i.new_items_count||0,lastFetched:i.last_fetched_timestamp||Date.now()},console.log("[Legacy Ticker] Checking if we should process feeds:",{has_changes:i.has_changes,feeds_exists:!!i.feeds,feeds_length:((s=i.feeds)==null?void 0:s.length)||0,feeds_data:i.feeds}),i.has_changes&&i.feeds&&i.feeds.length>0){console.log(`[Legacy Ticker] ✅ Processing ${i.feeds.length} feed updates`);const m={};i.feeds.forEach(f=>{console.log("[Legacy Ticker] Processing feed update:",f);const h=f.context||"global";m[h]||(m[h]=[]),m[h].push(f)}),console.log("[Legacy Ticker] Updates grouped by context:",m);for(const f in m){console.log(`[Legacy Ticker] 📥 Processing context: ${f} (${m[f].length} updates)`);try{await this.processTickerUpdates(f,m[f]),console.log(`[Legacy Ticker] ✅ Successfully processed context: ${f}`)}catch(h){console.error(`[Legacy Ticker] ❌ Failed to process context: ${f}`,h)}}}else console.log("[Legacy Ticker] ⏭️ Skipping feed processing - no changes or no feeds in response");return(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("ticker_updated",i),this.ticker}catch(o){throw console.error("[Legacy Ticker] Failed to fetch ticker:",o),o}},resetTicker(){this.ticker.count=0},markStickyAsViewed(e,t){const s=this.stickyFeeds[e];s&&s.id===t&&(window["viewed_sticky_posts_"+t]=!0,this.feedsByContext[e]&&(this.feedsByContext[e].data.some(u=>u.id===s.id)||this.feedsByContext[e].data.unshift(s)),this.stickyFeeds[e]=null)},pruneOldFeeds(e=null){(e?[e]:Object.keys(this.feedsByContext)).forEach(u=>{var i;const o=((i=this.feedsByContext[u])==null?void 0:i.data)||[];if(o.length>500){const m=o.slice(0,o.length-500);this.feedsByContext[u].data=o.slice(o.length-500),console.log(`[Feed Store] Pruned ${m.length} old feeds from ${u}, kept ${this.feedsByContext[u].data.length}`),m.forEach(f=>{Object.values(this.feedsByContext).some(g=>{var k;return(k=g.data)==null?void 0:k.some(b=>b.id===f.id)})||delete this.feedsById[f.id]})}})},resetContext(e){this.feedsByContext[e]={data:[],timestamp:0},this.pagination[e]={page:1,per_page:10,total:0,last_page:1,has_more:!1},this.stickyFeeds[e]=null,this.loading[e]=!1,this.executionTimes[e]="",ce().invalidatePattern(`feeds:${e}`)},touchContext(e){if(!e)return;const t=this._recentContexts.indexOf(e);t>-1&&this._recentContexts.splice(t,1),this._recentContexts.push(e);const s=10;if(this._recentContexts.length<=s)return;let u=this._recentContexts.length-s;const o=[];for(const i of this._recentContexts)u>0&&!this.loading[i]?(delete this.feedsByContext[i],delete this.pagination[i],delete this.stickyFeeds[i],delete this.executionTimes[i],u--):o.push(i);this._recentContexts=o},async softRefreshContext(e,t={}){var s,u,o,i;if((u=(s=this.feedsByContext[e])==null?void 0:s.data)!=null&&u.length&&!this.loading[e]){this.touchContext(e);try{const m=await this.$api.get(t.feed_base_url||"feeds",{...t,page:1,per_page:t.per_page||10}),f=this.feedsByContext[e];if(!((o=f==null?void 0:f.data)!=null&&o.length))return;const h=f.data,g=((i=m.feeds)==null?void 0:i.data)||[];if(!g.length){f.timestamp=Date.now();return}const k=new Map(g.map(v=>[v.id,v])),b=new Set(h.map(v=>v.id)),w=h.map(v=>{const $=k.get(v.id);return $?{...v,...$}:v}),S=g.filter(v=>!b.has(v.id));this.feedsByContext[e]={...f,data:[...S,...w],timestamp:Date.now()};const C=Date.now();if(g.forEach(v=>{this.feedsById[v.id]={...this.feedsById[v.id]||{},...v,timestamp:C}}),m.sticky){const v="viewed_sticky_posts_"+m.sticky.id;window[v]||(this.stickyFeeds[e]=m.sticky)}}catch(m){console.warn("[Feed Store] Soft refresh failed for context",e,m)}}},startTicker(e="global",t=3e4){this.lastTickerCheck[e]||(this.lastTickerCheck[e]=new Date().toISOString()),this.stopTicker(e),this.tickerEnabled[e]=!0,this.newPostsCount[e]=0,this.tickerIntervals[e]=setInterval(()=>{this.checkForUpdates(e)},t),console.log(`[Feed Store] Ticker started for ${e} (interval: ${t}ms)`),this.checkForUpdates(e)},stopTicker(e){this.tickerIntervals[e]&&(clearInterval(this.tickerIntervals[e]),this.tickerIntervals[e]=null,this.tickerEnabled[e]=!1,console.log(`[Feed Store] Ticker stopped for ${e}`))},stopAllTickers(){Object.keys(this.tickerIntervals).forEach(e=>{this.stopTicker(e)})},async checkForUpdates(e="global"){if(!this.tickerPending[e]){this.tickerPending[e]=!0;try{const t=await this.$api.get("feeds/ticker-updates",{context:e,since:this.lastTickerCheck[e]||new Date().toISOString()});this.lastTickerCheck[e]=t.timestamp,t.has_changes&&t.updates.length>0&&(console.log(`[Feed Store] Ticker found ${t.updates.length} changes for ${e}`),await this.processTickerUpdates(e,t.updates))}catch(t){t.xhr_status!==404&&console.error("[Feed Store] Ticker check failed:",t)}finally{this.tickerPending[e]=!1}}},async processTickerUpdates(e,t){var o;console.log(`[processTickerUpdates] Called for context: ${e} with ${t.length} updates`),console.log("[processTickerUpdates] Updates:",t);const s=[],u=[];if(t.forEach(i=>{console.log("[processTickerUpdates] Processing update:",{id:i.id,action:i.action,updated_at:i.updated_at});const m=this.feedsById[i.id];console.log("[processTickerUpdates] Existing feed in store:",m?{id:m.id,updated_at:m.updated_at}:"NOT IN STORE"),i.action==="deleted"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for DELETION`),u.push(i.id)):i.action==="created"?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (CREATED)`),s.push(i.id)):i.action==="updated"&&(!m||new Date(m.updated_at)<new Date(i.updated_at)?(console.log(`[processTickerUpdates] ➡️ Marking feed ${i.id} for FETCH (UPDATED - ${m?"outdated":"not in store"})`),s.push(i.id)):console.log(`[processTickerUpdates] ⏭️ Skipping feed ${i.id} - already have latest version`))}),console.log("[processTickerUpdates] Summary:",{toFetch:s.length,toDelete:u.length,fetchIds:s,deleteIds:u}),u.length>0&&(console.log(`[processTickerUpdates] 🗑️ Deleting ${u.length} feeds from ${e}`),this.deleteFeedsFromStore(e,u)),s.length>0){console.log(`[processTickerUpdates] 📥 Fetching ${s.length} feeds for ${e}`),await this.fetchFeedsByIds(e,s);const i=t.filter(m=>m.action==="created").length;i>0&&(this.newPostsCount[e]=(this.newPostsCount[e]||0)+i)}(o=window.fluentFrameworkApp)!=null&&o.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:e,added:s.filter(i=>!this.feedsById[i]).length,updated:s.filter(i=>this.feedsById[i]).length,removed:u.length})},async fetchFeedsByIds(e,t){if(t.length===0)return;console.log("[Feed Store] fetchFeedsByIds called:",{context:e,count:t.length,ids:t});const s=20;try{if(t.length>s){console.log(`[Feed Store] Batching ${t.length} feeds into chunks of ${s}`);for(let u=0;u<t.length;u+=s){const o=t.slice(u,u+s);await this.fetchFeedBatch(e,o)}}else await this.fetchFeedBatch(e,t);console.log(`[Feed Store] Successfully fetched ${t.length} feeds for ${e}`)}catch(u){console.error("[Feed Store] Failed to fetch feeds by IDs:",{context:e,feedIds:t,error:u})}},async fetchFeedBatch(e,t){try{console.log("[Feed Store] Fetching feeds:",{context:e,feedIds:t});const s=await this.$api.post("feeds/batch",{feed_ids:t,context:e});if(console.log("[Feed Store] API response:",s),!s||!Array.isArray(s.feeds)){console.error("[Feed Store] Invalid response from /feeds/batch:",s);return}console.log(`[Feed Store] Received ${s.feeds.length} feeds for context: ${e}`),s.feeds.forEach(u=>{this.feedsById[u.id]=u,this.feedsByContext[e]||(this.feedsByContext[e]={data:[],timestamp:Date.now()});const o=this.feedsByContext[e].data,i=o.findIndex(m=>m.id===u.id);i===-1?o.unshift(u):o[i]=u})}catch(s){throw console.error("[Feed Store] Failed to fetch batch for context:",e,s),s}},deleteFeedsFromStore(e,t){t.forEach(s=>{var o;delete this.feedsById[s],(o=this.feedsByContext[e])!=null&&o.data&&(this.feedsByContext[e].data=this.feedsByContext[e].data.filter(i=>i.id!==s)),ce().invalidate(`feed:${s}`)}),console.log(`[Feed Store] Deleted ${t.length} feeds from ${e}`)},clearNewPostsCount(e){this.newPostsCount[e]=0},clearAll(){this.stopAllTickers(),this.feedsByContext={},this.feedsById={},this.stickyFeeds={},this.loading={},this.pagination={},this.filters={},this.ticker={count:0,lastFetched:0},this.executionTimes={},this._pendingRequests={},this.tickerIntervals={},this.tickerEnabled={},this.lastTickerCheck={},this.tickerPending={},this.newPostsCount={}}}}),Ne=Ge("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(s=>s.slug===t),getMySpaces:e=>[...e.mySpaces].sort((t,s)=>t.title.localeCompare(s.title)),isLoading:e=>t=>e.loading[t]||!1,joinedSpacesCount:e=>e.mySpaces.length},actions:{async fetchSpace(e,t=!1){const s=ce(),u=`space:${e}`;if(!t){const o=s.get(u);if(o)return this.spacesBySlug[e]=o,this.currentSpace=o,o}this.loading[e]=!0;try{const o=await this.$api.get(`spaces/${e}/by-slug`),i=o.space||o;return this.spacesBySlug[e]=i,this.currentSpace=i,this.lastFetched[e]=Date.now(),o.topics&&(this.topicsBySpace[e]=o.topics),o.pending_count!==void 0&&(i.pending_count=o.pending_count),s.set(u,i,15*60*1e3),typeof window<"u"&&(window.fcom_current_community=i),this.loading[e]=!1,i}catch(o){throw this.loading[e]=!1,console.error("Failed to fetch space:",o),o}},async joinSpace(e,t=null){var i,m,f;const s=ce(),u=t||this.spacesBySlug[e];if(!u)throw new Error("Space not found");const o=((i=u.user_status)==null?void 0:i.status)==="active";o||(u.user_status||(u.user_status={}),u.user_status.status="active",u.members_count=(u.members_count||0)+1,this.mySpaces.find(h=>h.slug===e)||this.mySpaces.push(u));try{const h=await this.$api.post(`spaces/${e}/join`),g=(m=h.membership)==null?void 0:m.status;if(g&&(u.user_status.status=g),g&&g!=="active"&&!o){u.members_count=Math.max(0,(u.members_count||1)-1);const k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,1)}return s.invalidate(`space:${e}`),s.invalidate("my-spaces"),(f=window.fluentFrameworkApp)!=null&&f.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_joined",u),h}catch(h){if(!o){u.user_status.status=null,u.members_count=Math.max(0,(u.members_count||1)-1);const g=this.mySpaces.findIndex(k=>k.slug===e);g!==-1&&this.mySpaces.splice(g,1)}throw console.error("Failed to join space:",h),h}},async leaveSpace(e){var m,f,h,g;const t=ce(),s=this.spacesBySlug[e];if(!s)throw new Error("Space not found");const u=((m=s.user_status)==null?void 0:m.status)==="active",o=(f=s.user_status)==null?void 0:f.status,i=s.members_count;if(u){s.user_status.status=null,s.members_count=Math.max(0,(s.members_count||1)-1);const k=this.mySpaces.findIndex(b=>b.slug===e);k!==-1&&this.mySpaces.splice(k,1)}try{const k=await this.$api.post(`spaces/${e}/leave`),b=k.space||k;return this.spacesBySlug[e]=b,((h=this.currentSpace)==null?void 0:h.slug)===e&&(this.currentSpace=b),t.invalidate(`space:${e}`),t.invalidate("my-spaces"),(g=window.fluentFrameworkApp)!=null&&g.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("space_left",b),b}catch(k){throw u&&(s.user_status.status=o,s.members_count=i,this.mySpaces.push(s)),console.error("Failed to leave space:",k),k}},setCurrentSpace(e){const t=this.spacesBySlug[e];t&&(this.currentSpace=t,typeof window<"u"&&(window.fcom_current_community=t))},clearCurrentSpace(){this.currentSpace=null,typeof window<"u"&&(window.fcom_current_community=null)},invalidateSpace(e){const t=ce();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=ce();e.invalidatePattern("space:"),e.invalidatePattern("space-topics:"),e.invalidate("my-spaces")}}}),ds=Ge("notification",{state:()=>({notifications:[],unreadCount:0,loading:!1,pagination:{page:1,per_page:20,total:0,has_more:!1},pollingInterval:null,pollingEnabled:!1,lastFetched:0}),getters:{getUnreadCount:e=>e.unreadCount,getNotifications:e=>e.notifications,getUnreadNotifications:e=>e.notifications.filter(t=>!t.is_read),isLoading:e=>e.loading,isPollingActive:e=>e.pollingEnabled&&e.pollingInterval!==null},actions:{async fetchNotifications(e=!1){this.loading=!0;const t=e?this.pagination.page+1:1;try{const s=await this.$api.get("notifications",{page:t,per_page:this.pagination.per_page});return e?this.notifications=[...this.notifications,...s.notifications.data]:this.notifications=s.notifications.data,this.pagination={page:t,per_page:this.pagination.per_page,total:s.notifications.total,has_more:s.notifications.has_more},this.unreadCount=s.unread_count||0,this.lastFetched=Date.now(),this.loading=!1,s}catch(s){throw this.loading=!1,console.error("Failed to fetch notifications:",s),s}},async fetchUnreadCount(){try{const e=await this.$api.get("notifications/unread");return this.unreadCount=e.unread_count||0,this.unreadCount}catch(e){return e.xhr_status!==404&&console.error("Failed to fetch unread count:",e),this.unreadCount}},async markAsRead(e){var s;const t=this.notifications.find(u=>u.id===e);t&&!t.is_read&&(t.is_read=!0,this.unreadCount=Math.max(0,this.unreadCount-1));try{const u=await this.$api.post(`notifications/mark-read/${e}`);this.unreadCount=u.unread_count??this.unreadCount,(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("notification_read",e)}catch(u){throw t&&(t.is_read=!1,this.unreadCount++),console.error("Failed to mark notification as read:",u),u}},async markFeedNotificationsAsRead(e){var u;const t=this.notifications.filter(o=>o.object_id===e&&!o.is_read),s=this.unreadCount;t.forEach(o=>{o.is_read=!0}),this.unreadCount=Math.max(0,this.unreadCount-t.length);try{const o=await this.$api.post(`notifications/mark-read/${e}/by-feed-id`);this.unreadCount=o.unread_notification_count??this.unreadCount,(u=window.fluentFrameworkApp)!=null&&u.$eventBus&&window.fluentFrameworkApp.$eventBus.emit("feed_notifications_read",e)}catch(o){throw t.forEach(i=>{i.is_read=!1}),this.unreadCount=s,console.error("Failed to mark feed notifications as read:",o),o}},async markAllAsRead(){var s;const e=this.unreadCount,t=this.notifications.map(u=>({...u,is_read:u.is_read}));this.notifications.forEach(u=>{u.is_read=!0}),this.unreadCount=0;try{await this.$api.post("notifications/mark-all-read"),(s=window.fluentFrameworkApp)!=null&&s.$eventBus&&(window.fluentFrameworkApp.$eventBus.emit("all_notifications_read"),window.fluentFrameworkApp.$eventBus.emit("notification_count_updated",0))}catch(u){throw this.notifications=t,this.unreadCount=e,console.error("Failed to mark all notifications as read:",u),u}},startPolling(e=6e4){this.pollingInterval&&this.stopPolling(),this.pollingEnabled=!0,this.fetchUnreadCount(),this.pollingInterval=setInterval(()=>{this.fetchUnreadCount()},e),console.log(`[Notification Store] Polling started (interval: ${e}ms)`)},stopPolling(){this.pollingInterval&&(clearInterval(this.pollingInterval),this.pollingInterval=null,this.pollingEnabled=!1,console.log("[Notification Store] Polling stopped"))},clearAll(){this.notifications=[],this.unreadCount=0,this.loading=!1,this.pagination={page:1,per_page:20,total:0,has_more:!1},this.lastFetched=0,this.stopPolling()}}}),so=Ge("ticker",{state:()=>({tickerInterval:null,enabled:!1,lastCheck:null,pending:!1,errorCount:0,minInterval:45e3,maxInterval:75e3,maxBackoff:6e4,maxErrors:5,paused:!1,visibilityHandler:null}),getters:{isActive:e=>e.enabled&&e.tickerInterval!==null,isPaused:e=>e.paused},actions:{start(e=45e3,t=75e3,s=5e4){this.tickerInterval&&this.stop(),this.minInterval=e,this.maxInterval=t,this.enabled=!0,this.errorCount=0,this.lastCheck=null,console.log(`[Global Ticker] Started (random interval: ${e}ms - ${t}ms, initial delay: ${s}ms)`),this.setupVisibilityHandler(),console.log(`[Global Ticker] First check scheduled in ${(s/1e3).toFixed(1)} seconds`),setTimeout(async()=>{this.enabled&&(await this.check(),this.scheduleNextCheck())},s)},scheduleNextCheck(){if(this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),!this.enabled)return;let e;this.errorCount>0?e=Math.min(this.maxBackoff,1e3*Math.pow(2,this.errorCount)):e=Math.floor(Math.random()*(this.maxInterval-this.minInterval+1))+this.minInterval,console.log(`[Global Ticker] Next check in ${(e/1e3).toFixed(1)} seconds`),this.tickerInterval=setTimeout(async()=>{this.paused||await this.check(),this.scheduleNextCheck()},e)},stop(){const e=this.enabled||this.tickerInterval!==null;this.tickerInterval&&(clearTimeout(this.tickerInterval),this.tickerInterval=null),this.enabled=!1,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),e&&console.log("[Global Ticker] Stopped")},pause(){this.paused=!0,console.log("[Global Ticker] Paused (tab hidden)")},resume(){this.paused=!1,console.log("[Global Ticker] Resumed (tab visible)"),this.check()},async check(){if(!this.pending){this.pending=!0;try{const e={};this.lastCheck&&(e.since=this.lastCheck),console.log("[Global Ticker] Check params:",e);const t=await this.$api.get("feeds/ticker",e);t&&t.timestamp&&(this.lastCheck=t.timestamp,console.log("[Global Ticker] Updated lastCheck to:",this.lastCheck)),this.errorCount=0,await this.processUpdates(t)}catch(e){this.handleError(e)}finally{this.pending=!1}}},async processUpdates(e){var i;const{feeds:t=[],notifications:s={},spaces:u=[],has_changes:o=!1}=e;if(s&&s.unread_count!==void 0&&this.processNotificationUpdates(s),!!o&&(console.log("[Global Ticker] Processing updates:",{feeds:t.length,notifications:s.unread_count||0,spaces:u.length}),t.length>0&&await this.processFeedUpdates(t),u.length>0&&this.processSpaceUpdates(u),(i=window.fluentFrameworkApp)!=null&&i.$eventBus)){const m={...e,unread_notification_count:s.unread_count||0};window.fluentFrameworkApp.$eventBus.emit("ticker_updated",m)}},async processFeedUpdates(e){console.log("[Ticker Debug] processFeedUpdates called with:",e);const t=Te();e.forEach(s=>{var m;const u=s.context||"global",o=s.id,i=[u];if(s.action!=="deleted"&&(u.startsWith("space-")&&i.push("global"),s.user_id&&i.push(`user-${s.user_id}`)),s.action==="deleted")console.log(`[Global Ticker] Deleting feed ${o} from contexts:`,i),i.forEach(f=>{t.deleteFeedsFromStore(f,[o])});else if(s.feed_data){const f=s.feed_data;console.log(`[Global Ticker] Updating feed ${o} in contexts:`,i),i.forEach(h=>{t.feedsById[f.id]=f,t.feedsByContext[h]||(t.feedsByContext[h]={data:[],timestamp:Date.now()});const g=t.feedsByContext[h].data,k=g.findIndex(b=>b.id===f.id);k===-1?(g.unshift(f),console.log(`[Global Ticker] Added feed ${f.id} to ${h}`),s.action==="created"&&(t.newPostsCount[h]=(t.newPostsCount[h]||0)+1)):(g[k]=f,console.log(`[Global Ticker] Updated feed ${f.id} in ${h}`))}),(m=window.fluentFrameworkApp)!=null&&m.$eventBus&&i.forEach(h=>{window.fluentFrameworkApp.$eventBus.emit("feeds_updated",{context:h,added:s.action==="created"?1:0,updated:s.action==="updated"?1:0,removed:0})})}else console.warn(`[Global Ticker] Feed ${o} has no feed_data, skipping update`)})},processNotificationUpdates(e){const t=ds();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){if(e&&e.xhr_status!==404&&console.error("[Global Ticker] Check failed:",e),this.errorCount++,this.errorCount>=this.maxErrors){console.warn("[Global Ticker] Too many consecutive failures — stopping ticker."),this.stop();return}},setupVisibilityHandler(){typeof document.hidden<"u"&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=()=>{document.hidden?this.pause():this.resume()},document.addEventListener("visibilitychange",this.visibilityHandler))}}}),$n={name:"ChatIcon"},Sn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Vn(e,t,s,u,o,i){return n(),c("svg",Sn,[...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 tt=I($n,[["render",Vn]]),Mn={name:"HeartIcon",props:{filled:{default:!1}}},Tn={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},Ln={key:1,viewBox:"0 0 24 24","aria-hidden":"true"};function Pn(e,t,s,u,o,i){return s.filled?(n(),c("svg",Tn,[...t[0]||(t[0]=[l("g",null,[l("path",{d:"M20.884 13.19c-1.351 2.48-4.001 5.12-8.379 7.67l-.503.3-.504-.3c-4.379-2.55-7.029-5.19-8.382-7.67-1.36-2.5-1.41-4.86-.514-6.67.887-1.79 2.647-2.91 4.601-3.01 1.651-.09 3.368.56 4.798 2.01 1.429-1.45 3.146-2.1 4.796-2.01 1.954.1 3.714 1.22 4.601 3.01.896 1.81.846 4.17-.514 6.67z"})],-1)])])):(n(),c("svg",Ln,[...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 st=I(Mn,[["render",Pn]]),Fn={name:"NotificationsBlock",emits:["close"],components:{ChatIcon:tt,HeartIcon:st},props:["notifications"],methods:{handleNotificationClick(e,t){var o,i;if(this.markRead(e,t),!["comment_added","mention_added","comment/react_added","child_comment_added"].includes(e.action))return;const u=(i=(o=this.getNotificationRoute(e))==null?void 0:o.query)==null?void 0:i.comment_id;u&&this.$eventBus.emit("scroll_to_comment",u)},markRead(e){e.subscriber&&e.subscriber.is_read==1||this.$post("notifications/mark-read/"+e.id).then(t=>{const s=e.feed_id;this.notifications.forEach(u=>{u.subscriber&&(u.id===e.id||s&&u.feed_id===s)&&(u.subscriber.is_read=1)}),this.$eventBus.emit("notification_count_updated",t.unread_count)})},getNotificationRoute(e){const{route:t,action:s,object_id:u,feed_id:o}=e;return{...t,query:{comment_added:{comment_id:u},mention_added:{comment_id:u},"comment/react_added":{comment_id:u},comment_report_added:{comment_id:o}}[s]??t.query??{}}}}},In={class:"notification_avatar"},En={class:"fcom_notification_type"},Un={class:"notification_content"},An=["innerHTML"],Bn=["title"];function Dn(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("ChatIcon"),h=O,g=p("HeartIcon"),k=p("router-link");return n(!0),c(P,null,R(s.notifications,(b,w)=>{var S;return n(),c("div",{class:x(["notification_wrap",{notification_wrap_unread:((S=b==null?void 0:b.subscriber)==null?void 0:S.is_read)=="0"}])},[a(k,{onClick:C=>i.handleNotificationClick(b,w),to:i.getNotificationRoute(b),class:"notification_item"},{default:r(()=>[l("div",In,[a(m,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),l("div",En,[b.action=="comment_added"||b.action=="child_comment_added"?(n(),y(h,{key:0,class:"fcom_nt_comment"},{default:r(()=>[a(f)]),_:1})):b.action=="feed/react_added"||b.action=="comment/react_added"?(n(),y(h,{key:1,class:"fcom_nt_heart"},{default:r(()=>[a(g,{filled:!0})]),_:1})):b.action=="feed/mentioned"||b.action=="mention_added"?(n(),y(h,{key:2,class:"fcom_nt_mention"},{default:r(()=>[a(f)]),_:1})):b.action=="space_feed/created"?(n(),y(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",Un,[l("div",{innerHTML:b.content},null,8,An),l("span",{title:b.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(b.updated_at)),9,Bn)])]),_:2},1032,["onClick","to"])],2)}),256)}const oo=I(Fn,[["render",Dn]]),Rn={name:"NotificationIcon"},xn={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hn(e,t,s,u,o,i){return n(),c("svg",xn,[...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 On=I(Rn,[["render",Hn]]),jn={name:"Notifications",components:{NotificationsBlock:oo,NotificationIcon:On},data(){return{unread_notifications:[],unread_count:parseInt(this.appVars.unread_notification_count),loading:!1,working:!1,visible:!1,notification_type:"all"}},methods:{onTickerUpdated(e){this.appVars.unread_notification_count=e.unread_notification_count,this.unread_count=e.unread_notification_count},onNotificationCountUpdated(e){this.appVars.unread_notification_count=e,this.unread_count=e},switchType(e){this.notification_type=e,this.fetchUnread()},toggleNotifications(){this.loading=!0,this.visible=!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 s;this.unread_notifications=((s=t.notifications)==null?void 0:s.data)||[],this.appVars.unread_notification_count=t.unread_count,this.unread_count=t.unread_count}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})},markAllRead(){this.working=!0,this.$post("notifications/mark-all-read").then(e=>{this.$notify.success(e.message),this.fetchUnread()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})},keyBind(e){e.code==="KeyN"&&e.altKey&&this.$refs.notification_icon.click()}},mounted(){var e;document.addEventListener("keydown",this.keyBind),(e=window.fcom_portal_general)!=null&&e.hide_header_on_scroll&&(this._scrollClose=()=>this.isMobile&&this.handleClose(),document.addEventListener("fcom_layout_scroll",this._scrollClose)),this.$eventBus.on("ticker_updated",this.onTickerUpdated),this.$eventBus.on("notification_count_updated",this.onNotificationCountUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this._scrollClose&&document.removeEventListener("fcom_layout_scroll",this._scrollClose),this.$eventBus.off("ticker_updated",this.onTickerUpdated),this.$eventBus.off("notification_count_updated",this.onNotificationCountUpdated)}},Nn=["aria-label"],zn={class:"notifications_wrap unread_notifications"},qn={class:"norification_pop_header"},Gn={class:"fcom_filter_menu"},Yn={class:"fcom_filter_menu_ul"},Wn={key:2,class:"fcom_no_unread_notifications"};function Zn(e,t,s,u,o,i){const m=p("NotificationIcon"),f=O,h=Ko,g=H,k=Z,b=p("notifications-block"),w=p("router-link"),S=ye,C=ee("loading");return n(),y(S,{popperClass:"notification_pop","popper-options":{strategy:"fixed"},onBeforeEnter:t[7]||(t[7]=v=>i.toggleNotifications()),ref:"notification_pop",trigger:"click",placement:"bottom",width:500},{reference:r(()=>[a(h,{max:20,hidden:!o.unread_count,value:o.unread_count,class:"item"},{default:r(()=>[l("button",{class:"fcom_menu_button","aria-label":e.$t("Notifications"),ref:"notification_icon"},[a(f,null,{default:r(()=>[a(m)]),_:1})],8,Nn)]),_:1},8,["hidden","value"])]),default:r(()=>[l("div",zn,[l("div",qn,[l("h3",null,d(e.$t("Recent Notifications")),1),l("div",null,[Y((n(),y(g,{disabled:o.working,size:"small",onClick:t[0]||(t[0]=v=>i.markAllRead())},{default:r(()=>[M(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])),[[C,o.working]])])]),l("div",Gn,[l("ul",Yn,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z(v=>i.switchType("all"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="all"}),href:"#"},d(e.$t("Recent")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z(v=>i.switchType("unread"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z(v=>i.switchType("mentioned"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z(v=>i.switchType("following"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])])]),o.loading?(n(),y(k,{key:0,style:{"margin-top":"15px"},animated:!0,rows:2})):o.unread_notifications.length?(n(),c("div",{key:1,onClick:t[6]||(t[6]=v=>e.$refs.notification_pop.hide()),class:"notifications fcom_thin_scrollbar"},[a(b,{onClose:t[5]||(t[5]=v=>i.handleClose()),notifications:o.unread_notifications},null,8,["notifications"])])):(n(),c("div",Wn,[l("p",null,d(e.$t("No notifications found")),1)])),a(w,{class:"fcom_view_all_notifications",to:{name:"notifications"},onClick:i.handleClose},{default:r(()=>[a(g,{class:"fcom_secondary_button"},{default:r(()=>[M(d(e.$t("View All")),1)]),_:1})]),_:1},8,["onClick"])])]),_:1},512)}const Kn=I(jn,[["render",Zn]]),Jn={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 Qn(e,t,s,u,o,i){const m=H,f=mt,h=p("CloseBold"),g=O,k=ee("loading");return n(),c(P,null,[a(f,{class:x(s.className),multiple:s.isMultiple,action:i.action_url,headers:i.headers,accept:"image/*",data:s.additionalData,"on-success":i.handleSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1},{default:r(()=>[G(e.$slots,"trigger",{loading:o.loading},()=>[G(e.$slots,"default",{loading:o.loading},()=>[Y((n(),y(m,{disabled:o.loading,text:s.isTextBtn,class:"fcom_plain_button"},{default:r(()=>[M(d(s.button_text||e.$t("Upload Photo")),1)]),_:1},8,["disabled","text"])),[[k,o.loading]])])])]),_:3},8,["class","multiple","action","headers","data","on-success","on-progress","on-error"]),s.can_remove?(n(),y(m,{key:0,class:"remove_img",size:"small",type:"danger",plain:"",onClick:i.handleRemove,text:s.isTextBtn},{default:r(()=>[G(e.$slots,"remove",{},()=>[s.removeIcon?(n(),y(g,{key:0},{default:r(()=>[a(h)]),_:1})):_("",!0),l("span",null,d(e.$t("Remove")),1)])]),_:3},8,["onClick","text"])):_("",!0)],64)}const He=I(Jn,[["render",Qn]]),Xn={name:"ImageIcon"},el={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function tl(e,t,s,u,o,i){return n(),c("svg",el,[...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 us=I(Xn,[["render",tl]]),sl={name:"PollIcon"},ol={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function il(e,t,s,u,o,i){return n(),c("svg",ol,[...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 nl=I(sl,[["render",il]]),ll={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)}}},al={class:"fcom_compose_app_form"},rl={class:"fcom_app_header"},cl={class:"fcom_app_options"},dl={class:"fcom_app_pref"},ul={class:"fcom_app_footer"},_l={style:{"font-weight":"500",color:"var(--el-text-color-regular)","font-size":"14px"}};function ml(e,t,s,u,o,i){const m=H,f=te,h=p("Plus"),g=O,k=fe,b=Ke;return n(),c("div",al,[l("div",rl,[l("h5",null,d(e.$t("Poll Options")),1),l("div",null,[a(m,{onClick:t[0]||(t[0]=w=>e.$emit("cancel")),size:"small",text:""},{default:r(()=>[M(d(e.$t("cancel")),1)]),_:1})])]),l("div",cl,[(n(!0),c(P,null,R(s.form.options,(w,S)=>(n(),c("div",{class:"fcom_app_option",key:"option_"+S},[a(f,{modelValue:w.label,"onUpdate:modelValue":C=>w.label=C,type:"text",placeholder:e.$t("Your option text")},ve({_:2},[!w.slug&&S!==0?{name:"suffix",fn:r(()=>[a(m,{onClick:C=>i.removeOption(S),text:"",size:"small"},{default:r(()=>[...t[3]||(t[3]=[M("x",-1)])]),_:1},8,["onClick"])]),key:"0"}:void 0]),1032,["modelValue","onUpdate:modelValue","placeholder"])]))),128)),l("div",dl,[a(m,{onClick:i.addOption,text:"",size:"small"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("Add More")),1)]),_:1},8,["onClick"])])]),l("div",ul,[l("h5",null,d(e.$t("Poll Settings")),1),s.is_editing?_("",!0):(n(),y(k,{key:0,modelValue:s.form.type,"onUpdate:modelValue":t[1]||(t[1]=w=>s.form.type=w),"true-value":"multi_choice","false-value":"single_choice",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Users can choose multiple options")),1)]),_:1},8,["modelValue"])),t[4]||(t[4]=l("br",null,null,-1)),l("label",_l,d(e.$t("End Date:")),1),l("div",null,[a(b,{style:{"min-width":"50%"},placeholder:e.$t("Leave blank for not end"),clearable:!0,type:"datetime",modelValue:s.form.end_date,"onUpdate:modelValue":t[2]||(t[2]=w=>s.form.end_date=w),"value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["placeholder","modelValue"])])])])}const hl=I(ll,[["render",ml]]),fl={name:"GiphyIcon"},pl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function gl(e,t,s,u,o,i){return n(),c("svg",pl,[...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 yl=I(fl,[["render",gl]]),vl={name:"Giphy",components:{GiphyIcon:yl},data(){return{gifs:[],searchQuery:"",offset:0,limit:20,loading:!1}},methods:{loadGifs(){var t,s;if(this.offset===0&&((s=(t=this.$gloablStorage)==null?void 0:t.gifs)==null?void 0:s.length)>0&&!this.searchQuery){this.gifs=this.$gloablStorage.gifs;return}this.loading=!0;const e={limit:this.limit,offset:this.offset,q:this.searchQuery.trim()};this.$get("giphy",e).then(u=>{this.gifs=this.offset===0?u.gifs:this.gifs.concat(u.gifs),!this.searchQuery&&this.offset===0&&(this.$gloablStorage.gifs=this.gifs),this.offset+=this.limit}).catch(u=>{this.$handleError(u)}).finally(()=>{this.loading=!1})},handleGiphyClick(){this.offset=0,this.searchQuery="",this.loadGifs()},handleSearch:sn(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()}}},bl={class:"fcom_giphy_composer"},kl={class:"search-container"},wl=["onLoad","src","alt","onClick"],Cl={key:0,class:"img_loading"},$l={key:1,class:"no_result"};function Sl(e,t,s,u,o,i){const m=te,f=ht,h=ft,g=p("GiphyIcon"),k=O,b=H,w=ye,S=ee("loading");return n(),c("div",bl,[a(w,{placement:"bottom-end",width:300,persistent:!1,trigger:"click",teleported:!1,"popper-class":"fcom_giphy_popover fcom_menu_below_nav",ref:"popover"},{reference:r(()=>[a(b,{"aria-label":"Pick GIF",text:"",onClick:i.handleGiphyClick},{default:r(()=>[a(k,{class:x(["fcom_apps_icon"])},{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClick"])]),default:r(()=>[Y((n(),c("div",kl,[a(m,{modelValue:o.searchQuery,"onUpdate:modelValue":t[0]||(t[0]=C=>o.searchQuery=C),placeholder:e.$t("Search Gifs"),onInput:i.handleSearch},null,8,["modelValue","placeholder","onInput"]),l("div",{class:"gif_container",onScroll:t[1]||(t[1]=(...C)=>i.handleScroll&&i.handleScroll(...C))},[o.gifs.length>0?(n(),y(h,{key:0,gutter:5},{default:r(()=>[(n(!0),c(P,null,R(o.gifs,C=>(n(),y(f,{span:12,key:C.id,class:"gif_item"},{default:r(()=>[l("img",{alt:"",onLoad:v=>C.loaded=!0,src:C.images.preview_gif.url,onClick:v=>i.selectGiphy(C)},null,40,wl),C.loaded?_("",!0):(n(),c("p",Cl))]),_:2},1024))),128))]),_:1})):(n(),c("p",$l,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))])),[[S,o.loading]])]),_:1},512)])}const Vl=I(vl,[["render",Sl]]),Ml={name:"VideoIcon"},Tl={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Ll(e,t,s,u,o,i){return n(),c("svg",Tl,[...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 Pl=I(Ml,[["render",Ll]]);const Fl={name:"FluentPlayerPreview",emits:["load-failed"],props:{media:{type:Object,required:!0}},data(){return{html:"",loading:!1,playerInstanceKey:"",fallbackGuardCleanups:[],guardGeneration:0}},watch:{"media.url"(){this.loadFluentPlayerContent()}},async mounted(){await this.loadFluentPlayerContent()},beforeUnmount(){this.clearFallbackGuard()},methods:{getFallbackTiming(e,t){var u,o;const s=Number((o=(u=this.appVars.features.fluent_player)==null?void 0:u.fallback)==null?void 0:o[e]);return!Number.isFinite(s)||s<500?t:s},getPlayerInstanceKey(){if(!this.playerInstanceKey){const e=Number.parseInt(this._uid,10);this.playerInstanceKey=Number.isSafeInteger(e)&&e>0?`i${e}`:`i${Math.random().toString(36).slice(2,8)}`}return this.playerInstanceKey},getStableMediaId(){var u,o,i,m,f,h,g,k,b,w,S,C;const e=Number.parseInt((u=this.media)==null?void 0:u.media_id,10);if(Number.isSafeInteger(e)&&e>0)return e;const t=[(o=this.media)==null?void 0:o.media_key,(i=this.media)==null?void 0:i.feed_id,(m=this.media)==null?void 0:m.share_url,(h=(f=this.media)==null?void 0:f.settings)==null?void 0:h.src,(g=this.media)==null?void 0:g.url,(k=this.media)==null?void 0:k.html,(b=this.media)==null?void 0:b.title,(w=this.media)==null?void 0:w.player,(S=this.media)==null?void 0:S.type,(C=this.media)==null?void 0:C.provider].filter(Boolean).join("|");if(!t)return 1;let s=5381;for(let v=0;v<t.length;v++)s=(s<<5)+s+t.charCodeAt(v)>>>0;return s||1},async loadFluentPlayerContent(){this.clearFallbackGuard();const e=++this.guardGeneration;this.loading=!0;try{if(!this.appVars.features.has_fluent_player||this.appVars.features.enable_fluent_player!=="yes"){this.$emit("load-failed");return}const t=this.getStableMediaId(),s=await this.withTimeout(this.$get("fluent-player/video-content/"+t,{...this.media,media_id:t,player_instance_key:this.getPlayerInstanceKey()}),this.getFallbackTiming("content_timeout_ms",1e4));if(e!==this.guardGeneration)return;s.html?(this.html=s.html,this.$nextTick(()=>{if(e!==this.guardGeneration)return;const u=this.$el&&this.$el.querySelector(".fluent-player");if(!u){this.fallBack("player markup missing");return}this.startFallbackGuard(u,s.media)})):this.$emit("load-failed")}catch(t){if(e!==this.guardGeneration)return;console.warn("Failed to load fluent-player assets:",t),this.$emit("load-failed")}finally{e===this.guardGeneration&&(this.loading=!1)}},withTimeout(e,t){return Promise.race([e,new Promise((s,u)=>{const o=setTimeout(()=>u(new Error("fluent-player content request timed out")),t);this.fallbackGuardCleanups.push(()=>clearTimeout(o))})])},startFallbackGuard(e,t){const s=()=>{document.dispatchEvent(new CustomEvent("InitSingleFluentPlayer",{detail:{container:e,playerData:{media:t}}}))};this.waitForPlayerScript(this.getFallbackTiming("script_timeout_ms",12e3),u=>{if(!u){this.fallBack("player script never loaded");return}s(),this.verifyPlayerInit(e)})},waitForPlayerScript(e,t){const s=()=>typeof window.FluentPlayer=="function";if(s()){t(!0);return}const u=document.querySelector('script[src*="fluent-player.js"]');let o=!1;const i=()=>{o=!0};u&&u.addEventListener("error",i);const m=()=>!u||!window.performance||!performance.getEntriesByType?!1:performance.getEntriesByType("resource").some(w=>w.name===u.src&&w.responseEnd>0);let f=0,h=0;const g=this.getFallbackTiming("script_grace_ms",2e3),k=setInterval(()=>{if(f+=250,s()){b(),t(!0);return}u&&(o||m())&&(h+=250),(h>=g||f>=e)&&(b(),t(!1))},250),b=()=>{clearInterval(k),u&&u.removeEventListener("error",i)};this.fallbackGuardCleanups.push(b)},verifyPlayerInit(e){const t=()=>{const o=e.querySelector("media-player");return!!(o&&o.hasAttribute("data-media-player"))};if(t()){this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e);return}let s=0;const u=setInterval(()=>{s+=250,t()?(clearInterval(u),this.enhanceAudioSpeedLabel(e),this.watchCanPlay(e)):s>=this.getFallbackTiming("init_timeout_ms",3e3)&&(clearInterval(u),this.fallBack("player did not initialize"))},250);this.fallbackGuardCleanups.push(()=>clearInterval(u))},enhanceAudioSpeedLabel(e){try{const t=e.querySelector("media-player");if(!(t&&(t.getAttribute("view-type")==="audio"||e.querySelector(".fp-audio-layout"))))return;const u=e.querySelector(".fp-speed-menu media-menu-button");if(!u)return;const o=u.querySelector('media-icon[type="odometer"]');o&&(o.style.display="none");let i=u.querySelector(".fcom_speed_label");i||(i=document.createElement("span"),i.className="fcom_speed_label",u.appendChild(i));const m=()=>{const f=Number(t.playbackRate)||1;i.textContent=(Number.isInteger(f)?f:f.toFixed(2).replace(/0+$/,"").replace(/\.$/,""))+"x"};m(),t.addEventListener("rate-change",m),this.fallbackGuardCleanups.push(()=>t.removeEventListener("rate-change",m))}catch{}},watchCanPlay(e){const t=e.querySelector("media-player");if(!t){this.fallBack("media-player element missing");return}if(t.hasAttribute("data-can-play"))return;let s=0,u=!1;const o=this.getFallbackTiming("stall_timeout_ms",12e3),i=1e3,m=()=>{s=0},f=["load-start","source-change","provider-change","loaded-metadata","loaded-data","progress","waiting","play"];f.forEach(T=>t.addEventListener(T,m));let h=null;const g=()=>{const T=t.querySelector("iframe");T&&T!==h&&(h=T,h.addEventListener("load",m),m())};g();let k=null;const b=()=>{k&&(clearInterval(k),k=null)},w=()=>{k||(k=setInterval($,i))},S="IntersectionObserver"in window?new IntersectionObserver(T=>{const V=T[T.length-1];u=!!(V&&V.isIntersecting),u?(s=0,w()):b()}):null,C=()=>v();t.addEventListener("can-play",C);const v=()=>{b(),t.removeEventListener("can-play",C),f.forEach(T=>t.removeEventListener(T,m)),h&&h.removeEventListener("load",m),S&&S.disconnect()},$=()=>{if(!document.body.contains(t)||t.hasAttribute("data-can-play")){v();return}g(),!(!u||!t.hasAttribute("data-can-load"))&&(s+=i,s>=o&&(v(),this.fallBack("player stalled before becoming playable")))};S?S.observe(t):(u=!0,w()),this.fallbackGuardCleanups.push(v)},fallBack(e){this.clearFallbackGuard(),console.warn("FluentPlayer: switching to standard media render ("+e+")"),this.html="",this.$emit("load-failed")},clearFallbackGuard(){const e=this.fallbackGuardCleanups;this.fallbackGuardCleanups=[],e.forEach(t=>{try{t()}catch{}})}}},Il={class:"fluent-player-preview"},El={key:0,class:"player-container"},Ul=["innerHTML"];function Al(e,t,s,u,o,i){const m=Z;return n(),c("div",Il,[o.html?(n(),c("div",El,[l("div",{innerHTML:o.html},null,8,Ul)])):_("",!0),o.loading?(n(),y(m,{key:1,animated:"",rows:5})):_("",!0)])}const It=I(Fl,[["render",Al],["__scopeId","data-v-e627e334"]]),Bl={name:"TuneIcon"},Dl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none","aria-hidden":"true",focusable:"false"};function Rl(e,t,s,u,o,i){return n(),c("svg",Dl,[...t[0]||(t[0]=[l("path",{d:"M6 4v6M6 14v6M12 4v3M12 11v9M18 4v9M18 17v3",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1),l("path",{d:"M4 12h4M10 9h4M16 15h4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1)])])}const xl=I(Bl,[["render",Rl]]),Hl={name:"AudioList",components:{FluentPlayerPreview:It,TuneIcon:xl,Close:rs},emits:["remove","edit"],props:{feed:{type:Object,default:null},audios:{type:Array,default:()=>[]},editable:{type:Boolean,default:!1}},data(){return{failedItems:{}}},methods:{onLoadFailed(e){this.failedItems={...this.failedItems,[e]:!0}},audioUrl(e){var t;return((t=e.settings)==null?void 0:t.src)||e.url||""},audioType(e){const s=this.audioUrl(e).split("?")[0].split("#")[0].split(".").pop().toLowerCase();return{mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"}[s]||"audio/mpeg"},audioKey(e,t){var o,i;const s=((o=e.settings)==null?void 0:o.posterSrc)||e.image||"",u=((i=e.settings)==null?void 0:i.title)||e.title||"";return(e.media_id||t)+"|"+s+"|"+u},playerMediaFor(e){var s,u;const t={...e,feed_id:((s=this.feed)==null?void 0:s.id)||e.feed_id||"",share_url:((u=this.feed)==null?void 0:u.permalink)||e.share_url||""};return this.editable&&(t.controls={...e.controls||{},settings:!1}),t}}},Ol={class:"fcom_audio_list"},jl={key:1,class:"fcom_audio_native_wrap"},Nl={class:"fcom_audio_native",controls:"",preload:"metadata"},zl=["src","type"],ql=["aria-label","onClick"],Gl=["aria-label","onClick"];function Yl(e,t,s,u,o,i){const m=p("fluent-player-preview"),f=p("tune-icon"),h=p("Close"),g=O;return n(),c("div",Ol,[(n(!0),c(P,null,R(s.audios,(k,b)=>(n(),c("div",{key:i.audioKey(k,b),class:"fcom_audio_player_wrap"},[o.failedItems[k.media_id||b]?(n(),c("div",jl,[l("audio",Nl,[l("source",{src:i.audioUrl(k),type:i.audioType(k)},null,8,zl)])])):(n(),y(m,{key:0,media:i.playerMediaFor(k),onLoadFailed:w=>i.onLoadFailed(k.media_id||b)},null,8,["media","onLoadFailed"])),s.editable?(n(),c(P,{key:2},[l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_edit_btn","aria-label":e.$t("Edit audio"),onClick:w=>e.$emit("edit",b)},[a(f)],8,ql),l("button",{type:"button",class:"fcom_audio_ctl fcom_audio_remove_btn","aria-label":e.$t("Remove audio"),onClick:w=>e.$emit("remove",b)},[a(g,null,{default:r(()=>[a(h)]),_:1})],8,Gl)],64)):_("",!0)]))),128))])}const io=I(Hl,[["render",Yl]]);const Wl={name:"MediaPreview",components:{Postcard:li,FluentPlayerPreview:It,AudioList:io},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},audioMedias(){var s,u,o,i,m;const e=(u=(s=this.feed)==null?void 0:s.meta)==null?void 0:u.audio_medias;if(Array.isArray(e)&&e.length)return e;const t=(i=(o=this.feed)==null?void 0:o.meta)==null?void 0:i.media_preview;return t&&(((m=t.settings)==null?void 0:m.viewType)==="audio"||t.content_type==="audio")?[t]:[]},playerMedia(){var e,t,s,u;return{...this.media,feed_id:((e=this.feed)==null?void 0:e.id)||((t=this.media)==null?void 0:t.feed_id)||"",share_url:((s=this.feed)==null?void 0:s.permalink)||((u=this.media)==null?void 0:u.share_url)||""}},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 s,u;const e=((u=(s=this.media)==null?void 0:s.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|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}].some(o=>o.regex.test(e))},getAspectRatio(e,t){if(e&&t){let s=e/t;return s<1?16/9:s}return 16/9},handleImageError(){this.is_error=!0},getVideoType(e){const t={mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mov:"video/quicktime",qt:"video/quicktime"},s=e.split(".").pop().toLowerCase();return t[s]||"video/mp4"},isAudioUrl(e){return e?/\.(mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i.test(e):!1},getAudioType(e){const t={mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",ogg:"audio/ogg",oga:"audio/ogg",flac:"audio/flac",opus:"audio/opus",weba:"audio/webm"},s=e.split("?")[0].split("#")[0].split(".").pop().toLowerCase();return t[s]||"audio/mpeg"},playVideo(){this.$refs.nativeVideo&&this.$refs.nativeVideo.play()},onVideoPause(){this.$refs.nativeVideo&&this.$refs.nativeVideo.currentTime>0&&(this.isPlaying=!0)}}},Zl={key:0,class:"feed_media feed_media_audio_list"},Kl={key:0},Jl={key:1},Ql=["innerHTML"],Xl={key:2,class:"native_audio_wrapper"},ea=["preload"],ta=["src","type"],sa=["controls","preload","poster"],oa=["src","type"],ia=["href"],na={key:0,class:"feed_media_image"},la={key:1,class:"feed_media_content"},aa={class:"media_domain"},ra={class:"feed_media_title"},ca={key:0,class:"feed_media_description"},da={class:"feed_meta_desc"};function ua(e,t,s,u,o,i){const m=p("audio-list"),f=p("fluent-player-preview"),h=Z,g=Fe;return i.audioMedias.length?(n(),c("div",Zl,[a(m,{feed:s.feed,audios:i.audioMedias},null,8,["feed","audios"])])):(n(),c("div",{key:1,class:x(["feed_media","feed_media_"+i.media.type])},[i.isVideoMedia?(n(),c(P,{key:0},[i.hasFluentPlayer&&i.isSupportedByFluentPlayer()&&!o.fluentPlayerFailed?(n(),c("div",Kl,[a(f,{media:i.playerMedia,onLoadFailed:t[0]||(t[0]=k=>o.fluentPlayerFailed=!0)},null,8,["media"])])):i.media.html?(n(),c("div",Jl,[l("div",{class:"feed_media_ext_video",innerHTML:i.media.html},null,8,Ql)])):i.media.url&&i.isAudioUrl(i.media.url)?(n(),c("div",Xl,[l("audio",{class:"native_audio_player",controls:"",preload:s.is_single?"metadata":"none"},[l("source",{src:i.media.url,type:i.getAudioType(i.media.url)},null,8,ta)],8,ea)])):i.media.url?(n(),c("div",{key:3,class:x(["native_video_wrapper",{video_playing:o.isPlaying}])},[l("video",{ref:"nativeVideo",class:"native_video_player",controls:o.isPlaying,preload:s.is_single?"metadata":"none",poster:i.media.thumbnail,onPlay:t[1]||(t[1]=k=>o.isPlaying=!0),onPause:t[2]||(t[2]=(...k)=>i.onVideoPause&&i.onVideoPause(...k)),onEnded:t[3]||(t[3]=k=>o.isPlaying=!1)},[l("source",{src:i.media.url,type:i.getVideoType(i.media.url)},null,8,oa)],40,sa),o.isPlaying?_("",!0):(n(),c("div",{key:0,class:"native_video_overlay",onClick:t[4]||(t[4]=(...k)=>i.playVideo&&i.playVideo(...k))},[...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)):i.media.type=="image"||i.media.is_uploaded?(n(),c("div",{key:1,class:x(["feed_media_provider_"+i.media.provider,"feed_media_image feed_custom_uploaded"])},[i.media.image&&!o.is_error?(n(),y(g,{key:0,alt:"",style:re({width:"100%",aspectRatio:i.getAspectRatio(i.media.width,i.media.height)}),src:i.media.image,lazy:!0,previewSrcList:[i.media.image],loading:"lazy",onError:i.handleImageError,"zoom-rate":1.2,"max-scale":7,"hide-on-click-modal":!0,"preview-teleported":!0,"min-scale":.2,"initial-index":1,class:x("fcom_media_provider_"+i.media.provider),fit:"scale-down"},{placeholder:r(()=>[a(h,{animated:!0})]),_:1},8,["style","src","previewSrcList","onError","class"])):_("",!0)],2)):(n(),c("a",{key:2,href:i.media.url,target:"_blank",rel:"noopener",class:"feed_media_link"},[i.media.image&&!o.is_error?(n(),c("div",na,[a(g,{onError:t[5]||(t[5]=k=>i.handleImageError()),style:{width:"100%"},src:i.media.image},{error:r(()=>[...t[7]||(t[7]=[l("span",null,null,-1)])]),_:1},8,["src"])])):_("",!0),i.media.title?(n(),c("div",la,[l("div",aa,d(i.getDomainName(i.media.url)),1),l("div",ra,d(e.getExcerpt(i.media.title,88)),1),i.media.description?(n(),c("div",ca,[l("div",da,d(e.getExcerpt(i.media.description,160)),1)])):_("",!0)])):_("",!0)],8,ia))],2))}const Oe=I(Wl,[["render",ua],["__scopeId","data-v-e4a3a6c3"]]);const Vs={video:{extensions:[".mp4",".webm",".mov",".qt"],pattern:/\.(mp4|webm|mov|qt)$/i},audio:{extensions:[".mp3",".wav",".m4a",".aac",".ogg",".oga",".flac"],pattern:/\.(mp3|wav|m4a|aac|ogg|oga|flac)$/i}},Ms=[{name:"youtube",regex:/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/},{name:"vimeo",regex:/^(https?:\/\/)?(www\.)?vimeo\.com\/\d+(\/[a-f0-9]+)?([?#].*)?$/},{name:"file",regex:/\.(mp4|m3u8|mpd|webm|mov|qt|mp3|wav|m4a|aac|ogg|oga|flac|opus|weba)(\?.*)?$/i}],_a={name:"FluentPlayerUploader",components:{UploadFilled:Lt},emits:["video-added","completed","uploading"],props:{className:{type:String,default:"video-uploader"},type:{type:String,default:"url"},media_kind:{type:String,default:"video"}},data(){return{videoUrl:"",processing:!1}},computed:{uploadKind(){return this.media_kind==="audio"?"audio":"video"},acceptTypes(){return Vs[this.uploadKind].extensions.join(",")},uploadButtonLabel(){return this.uploadKind==="audio"?this.$t("Upload Audio"):this.$t("Upload Video")},kindErrorMessage(){return this.uploadKind==="audio"?this.$t("The file must be a valid audio type (MP3, WAV, M4A, AAC, OGG, FLAC)"):this.$t("The file must be a valid video type (MP4, WebM, MOV)")},uploadData(){return{context:"fluent_player",media_kind:this.uploadKind}},action_url(){return this.appVars.rest.url+"/fluent-player/video-upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}}},methods:{beforeUpload(e){return Vs[this.uploadKind].pattern.test(e.name||"")?!0:(this.$handleError(this.kindErrorMessage),!1)},async handleUrlSubmit(){if(!this.videoUrl)return;const e=Ms.some(u=>u.name==="file"&&u.regex.test(this.videoUrl)),t=Ms.some(u=>u.name!=="file"&&u.regex.test(this.videoUrl));let s={type:"oembed",url:this.videoUrl,html:"",content_type:"video"};e?(s.player="fluent_player",s.provider="url",s.media_id=new Date().getTime()):t&&(s.player="fluent_player",s.media_id=new Date().getTime()),this.$emit("video-added",s)},handleVideoUploadSuccess(e){var t,s;try{if(!e||!e.media||!e.media.url)throw new Error("Invalid response: missing media.url");const{media:u}=e,o=((t=u.settings)==null?void 0:t.viewType)==="audio"||this.uploadKind==="audio",i={type:"upload",url:u.url,player:"fluent_player",provider:"upload",content_type:o?"audio":"video",html:"",title:((s=u.settings)==null?void 0:s.title)||"",media_id:u.media_id,settings:u.settings||{}};this.$emit("video-added",i)}catch(u){console.error("[FluentPlayerUploader] handleVideoUploadSuccess error:",u,e)}finally{this.$emit("completed",e),this.processing=!1}},handleError(e){try{let t=(e==null?void 0:e.message)||e;if(typeof t=="string")try{const s=JSON.parse(t);t=(s==null?void 0:s.message)||t}catch{}this.$handleError(t)}catch(t){console.error("[FluentPlayerUploader] handleError failed:",t,e)}finally{this.$emit("completed",e),this.processing=!1}},inProgress(e){this.$emit("uploading"),this.processing=!0}}},ma=["element-loading-text"],ha={key:0,class:"upload-options"},fa={class:"uploader-content"},pa={class:"el-upload__text"},ga={key:1,class:"url-input-section"};function ya(e,t,s,u,o,i){const m=p("upload-filled"),f=O,h=H,g=mt,k=te,b=ee("loading");return Y((n(),c("div",{class:"fluent-player-uploader","element-loading-text":e.$t("Uploading media..."),"element-loading-background":"rgba(255, 255, 255, 0.85)"},[s.type==="upload"?(n(),c("div",ha,[a(g,{drag:"",class:x([s.className,"video-drag-uploader"]),multiple:i.uploadKind==="audio",action:i.action_url,headers:i.headers,accept:i.acceptTypes,data:i.uploadData,"before-upload":i.beforeUpload,"on-success":i.handleVideoUploadSuccess,"on-progress":i.inProgress,"on-error":i.handleError,"show-file-list":!1,disabled:o.processing},{default:r(()=>[l("div",fa,[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",pa,[M(d(e.$t("Drop file here or"))+" ",1),l("em",null,d(e.$t("upload by clicking")),1)]),a(h,{type:"primary",class:"upload-button",loading:o.processing,disabled:o.processing},{default:r(()=>[G(e.$slots,"trigger",{},()=>[G(e.$slots,"default",{},()=>[M(d(o.processing?e.$t("Uploading..."):i.uploadButtonLabel),1)])])]),_:3},8,["loading","disabled"])])]),_:3},8,["class","multiple","action","headers","accept","data","before-upload","on-success","on-progress","on-error","disabled"])])):(n(),c("div",ga,[a(k,{modelValue:o.videoUrl,"onUpdate:modelValue":t[0]||(t[0]=w=>o.videoUrl=w),type:"url",placeholder:e.$t("Enter video URL"),size:"large"},{append:r(()=>[a(h,{onClick:i.handleUrlSubmit,loading:o.processing},{default:r(()=>[M(d(e.$t("Embed")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["modelValue","placeholder"])]))],8,ma)),[[b,o.processing]])}const va=I(_a,[["render",ya]]),ba={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:Oe,FluentPlayerUploader:va},computed:{showPreview(){return this.media.html&&!this.showInput},editorMode:{get(){return this.media.type},set(e){this.media.type=e}},hasFluentPlayer(){var e;return this.hasFluentPlayerInstalled&&((e=this.appVars.features.fluent_player)==null?void 0:e.enable)},hasFluentPlayerInstalled(){return this.appVars.features.has_fluent_player},hasUploadEnabled(){var e;return this.is_feed&&this.hasFluentPlayer&&((e=this.appVars.features.fluent_player)==null?void 0:e.has_video_upload)},uploadRole(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.video_upload_role)||"admin"},getSpace(){return this.space||""},playEmbeddedVideos(){var e;return(e=this.appVars.features.fluent_player)==null?void 0:e.play_embedded_videos},editorTitle(){return this.box_title||this.$t("Featured media")},uploadHint(){return this.$t("The file must be a valid video type (MP4, WebM, MOV)")},hasUpload(){return this.hasUploadEnabled&&(this.uploadRole==="everyone"||this.uploadRole==="admin_moderator"&&(this.isModerator(this.getSpace)||this.isAdmin())||this.uploadRole==="admin"&&this.isAdmin())}},data(){return{appReady:!1,showInput:!1,fetching:!1,uploading:!1,uploadKind:"video"}},methods:{fetchData(){this.media.url&&(this.fetching=!0,this.$get("feeds/oembed",{url:this.media.url}).then(e=>{this.media.html=e.oembed.html,this.media.provider=e.oembed.provider,this.media.title=e.oembed.title,this.media.author_name=e.oembed.author_name,this.media.type=e.oembed.type,this.media.image=e.oembed.image,this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetching=!1}))},handleAddCustomHtml(){this.media.content_type="video",this.$emit("embeded",this.media),this.showInput=!1},handleFluentPlayerVideo(e){Object.assign(this.media,e);const t=this.media.type==="upload"||this.media.provider==="url";if(this.media.player==="fluent_player"&&t){this.media.type="oembed",this.$emit("embeded",this.media);return}this.fetchData()}},mounted(){typeof this.media!="object"&&(this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}),this.appReady=!0,this.media.html||this.fetchData()}},ka={key:0},wa={key:0,class:"fcom_media_editor_actions"},Ca={key:1,class:"fcom_media_editor fcom_media_embeder"},$a={key:0},Sa={key:1},Va={key:2,class:"fcom_course_media"};function Ma(e,t,s,u,o,i){var S;const m=H,f=ze,h=ke,g=te,k=p("fluent-player-uploader"),b=p("media-preview"),w=ee("loading");return o.appReady?Y((n(),c("div",ka,[s.has_iframe||i.hasUpload?(n(),c("div",wa,[i.showPreview?(n(),y(m,{key:0,onClick:t[0]||(t[0]=C=>o.showInput=!0),type:"danger",size:"small",text:""},{default:r(()=>[M(d(e.$t("Edit media")),1)]),_:1})):(n(),y(h,{key:1,onChange:t[1]||(t[1]=C=>{s.media.html="",s.media.url="",o.showInput=!0}),size:"small",modelValue:i.editorMode,"onUpdate:modelValue":t[2]||(t[2]=C=>i.editorMode=C),disabled:o.uploading,"aria-label":e.$t("Media source")},{default:r(()=>[a(f,{label:e.$t("Oembed"),value:"oembed"},null,8,["label"]),s.has_iframe?(n(),y(f,{key:0,label:e.$t("HTML Code"),value:"iframe_html"},null,8,["label"])):_("",!0),i.hasUpload?(n(),y(f,{key:1,label:e.$t("Upload Video"),value:"upload","data-testid":"upload-kind-video"},null,8,["label"])):_("",!0)]),_:1},8,["modelValue","disabled","aria-label"]))])):_("",!0),i.showPreview?(n(),c("div",Va,[a(b,{media_item:s.media},null,8,["media_item"])])):(n(),c("div",Ca,[s.media.type=="iframe_html"&&s.has_iframe?(n(),c(P,{key:0},[l("h3",null,d(e.$t("Add Video from custom HTML Code")),1),a(g,{rows:5,modelValue:s.media.html,"onUpdate:modelValue":t[3]||(t[3]=C=>s.media.html=C),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]=C=>i.handleAddCustomHtml())},{default:r(()=>[M(d(e.$t("Embed")),1)]),_:1})],64)):(n(),c(P,{key:1},[l("h3",null,d(i.editorTitle),1),i.hasFluentPlayerInstalled&&s.media.type==="upload"?(n(),c("p",$a,d(i.uploadHint),1)):(n(),c("p",Sa,d(s.box_description||e.$t("Embed from Vimeo, YouTube, Wistia and more")),1)),i.hasFluentPlayer&&(s.media.type==="upload"||i.playEmbeddedVideos)?(n(),y(k,{key:2,type:((S=s.media)==null?void 0:S.type)==="upload"?"upload":"url",media_kind:o.uploadKind,onVideoAdded:i.handleFluentPlayerVideo,onUploading:t[5]||(t[5]=C=>o.uploading=!0),onCompleted:t[6]||(t[6]=C=>o.uploading=!1)},null,8,["type","media_kind","onVideoAdded"])):(n(),y(g,{key:3,onKeydown:ae(i.fetchData,["enter"]),size:"large",modelValue:s.media.url,"onUpdate:modelValue":t[7]||(t[7]=C=>s.media.url=C),type:"url",placeholder:e.$t("Paste a URL to embed")},{append:r(()=>[a(m,{onClick:i.fetchData,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Embed")),1)]),_:1},8,["onClick"])]),_:1},8,["onKeydown","modelValue","placeholder"]))],64))]))])),[[w,o.fetching]]):_("",!0)}const _s=I(ba,[["render",Ma]]),Ta={name:"VideoEmbeder",emits:["embeded"],props:["is_admin","space"],components:{MediaEmbeder:_s,VideoIcon:Pl},data(){return{videoUrl:"",showVideoPop:!1,media:{type:"oembed",url:"",inner_html:"",content_type:"video"}}},watch:{showVideoPop(e){e||this.resetMedia()}},methods:{show(){this.showVideoPop=!0},resetMedia(){this.media={type:"oembed",url:"",inner_html:"",content_type:"video"}},embeded(e){var s;this.$emit("embeded",e),e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")||(this.showVideoPop=!1,this.resetMedia())}}},La={class:"fcom_video_embeder"};function Pa(e,t,s,u,o,i){const m=p("VideoIcon"),f=O,h=H,g=p("media-embeder"),k=we;return n(),c("div",La,[a(h,{"aria-label":"Add Video",text:"",onClick:i.show},{default:r(()=>[a(f,{class:x(["fcom_apps_icon"])},{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClick"]),o.showVideoPop?(n(),y(k,{key:0,title:e.$t("Attach Media"),modelValue:o.showVideoPop,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVideoPop=b),width:e.dialogWidth,style:{"max-width":"600px"},"append-to-body":!0},{default:r(()=>[a(g,{box_title:e.$t("Add Featured Video for this post"),has_iframe:s.is_admin,is_feed:!0,onEmbeded:i.embeded,space:s.space,media:o.media},null,8,["box_title","has_iframe","onEmbeded","space","media"])]),_:1},8,["title","modelValue","width"])):_("",!0)])}const Fa=I(Ta,[["render",Pa]]),Ia="modulepreload",Ea=function(e){return"/"+e},Ts={},at=function(t,s,u){if(!s||s.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(s.map(i=>{if(i=Ea(i),i in Ts)return;Ts[i]=!0;const m=i.endsWith(".css"),f=m?'[rel="stylesheet"]':"";if(!!u)for(let k=o.length-1;k>=0;k--){const b=o[k];if(b.href===i&&(!m||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${f}`))return;const g=document.createElement("link");if(g.rel=m?"stylesheet":Ia,m||(g.as="script",g.crossOrigin=""),g.href=i,document.head.appendChild(g),m)return new Promise((k,b)=>{g.addEventListener("load",k),g.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${i}`)))})})).then(()=>t()).catch(i=>{const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=i,window.dispatchEvent(m),!m.defaultPrevented)throw i})};var no=(e=>(e.CodeMirror="code-mirror",e.LinkTooltip="link-tooltip",e.Cursor="cursor",e.BlockEdit="block-edit",e.Toolbar="toolbar",e.Placeholder="placeholder",e.ImageBlock="image-block",e))(no||{});const Ua={cursor:!0,"link-tooltip":!0,"block-edit":!0,placeholder:!0,toolbar:!0,"code-mirror":!0,"image-block":!0};async function Aa(e,t,s){switch(e){case"link-tooltip":{const{defineFeature:u}=await at(()=>import("./index.js?ver=2.7.7"),[]);return u(t,s)}case"block-edit":{const{defineFeature:u}=await at(()=>import("./index2.js?ver=2.7.7"),[]);return u(t,s)}case"placeholder":{const{defineFeature:u}=await at(()=>import("./index3.js?ver=2.7.7"),[]);return u(t,s)}case"toolbar":{const{defineFeature:u}=await at(()=>import("./index4.js?ver=2.7.7"),[]);return u(t,s)}case"image-block":{const{defineFeature:u}=await at(()=>import("./index5.js?ver=2.7.7"),[]);return u(t,s)}}}const Ba=ln([],"FeaturesCtx");function Da(e){return t=>{t.inject(Ba,e)}}var ms=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)},ge=(e,t,s)=>(ms(e,t,"read from private field"),s?s.call(e):t.get(e)),We=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},rt=(e,t,s,u)=>(ms(e,t,"write to private field"),u?u.call(e,s):t.set(e,s),s),Ra=(e,t,s)=>(ms(e,t,"access private method"),s),Se,ct,ut,kt,Ze,Qt,lo;class ao{constructor({root:t,features:s={},featureConfigs:u={},defaultValue:o="",onUpdate:i=f=>{},handleCommonActions:m=(f,h)=>{}}){var k;We(this,Qt),We(this,Se,void 0),We(this,ct,void 0),We(this,ut,void 0),We(this,kt,!0),We(this,Ze,null);const f=Object.entries({...Ua,...s}).filter(([,b])=>b).map(([b])=>b);rt(this,ut,(typeof t=="string"?document.querySelector(t):t)??document.body),rt(this,Se,an.make().config(Da(f)).config(b=>{b.set(rn,ge(this,ut)),b.set(cn,o),b.set(dn,{editable:()=>ge(this,kt)})}).config(b=>{const w=async(S,C)=>await m("handleFileUpload",{ctx:b,files:S,schema:C});b.update(un.key,S=>({...S,uploader:w}))}).config(b=>{const w=b.get(_n);w.markdownUpdated((S,C,v)=>{C!==v&&i(C)}),w.updated((S,C,v)=>{m("editor_updated",S)})}).use(mn).use(hn).use(fn).use(pn).use(gn).use(yn).use(vn));const h=(k=u==null?void 0:u["block-edit"])==null?void 0:k.canAddImage;h&&ge(this,Se).use(Jt(()=>new Kt({filterTransaction:b=>b.docChanged?!b.steps.some(S=>{var v,$;let C=!1;return($=(v=S.slice)==null?void 0:v.content)==null||$.forEach(T=>{var V;T.type.name.includes("image")&&(C=!0),(V=T.content)==null||V.forEach(F=>{F.type.name.includes("image")&&(C=!0)})}),C})||h():!0}))),ge(this,Se).use(Jt(()=>new Kt({props:{handleTextInput(b,w,S,C){const v=b.state.schema.marks.link;if(C!==" "||!v)return!1;const $=b.state.doc.resolve(w),T=/(?:^|\s)((?:https?:\/\/|www\.)\S+)$/.exec($.parent.textBetween(0,$.parentOffset,void 0,""));if(!T)return!1;const V=T[1].replace(/[.,)]+$/,""),F=w-T[1].length,L=F+V.length;if(b.state.doc.rangeHasMark(F,L,v))return!1;const A=(V.startsWith("http")?"":"https://")+V,D=b.state.tr.insertText(C,w).addMark(F,L,v.create({href:A})).removeStoredMark(v);return b.dispatch(D),!0}},appendTransaction:(b,w,S)=>{const C=S.schema.marks.link,v=S.selection.$cursor;if(!C||!v||!b.some(D=>D.docChanged))return null;const $=D=>D==null?void 0:D.marks.find(U=>U.type===C);if((S.storedMarks??v.marks()).some(D=>D.type===C)&&!$(v.nodeBefore)&&!$(v.nodeAfter))return S.tr.removeStoredMark(C);const F=v.pos;if(F<1||S.doc.textBetween(F-1,F)!==" "||!S.doc.rangeHasMark(F-1,F,C))return null;const L=$(S.doc.resolve(F-1).nodeBefore),A=$(S.doc.resolve(F).nodeAfter);return A&&(L==null?void 0:L.attrs.href)===A.attrs.href?null:S.tr.removeMark(F-1,F,C).removeStoredMark(C)}}))),ge(this,Se).use(Jt(()=>{let b=!1,w=!1;return new Kt({view:S=>({update(){var L;const C=S.state.schema.marks.link,v=S.state.selection.$cursor,$=A=>A.type===C,T=!!C&&!!(v!=null&&v.marks().some($)),V=document.querySelector("milkdown-link-preview"),F=(V==null?void 0:V.style.display)==="none"&&!w;if(T&&!F){V&&w&&(V.style.display=""),w=!1;const A=S.coordsAtPos((L=v.nodeBefore)!=null&&L.marks.some($)?v.pos-1:v.pos);S.dom.dispatchEvent(new MouseEvent("mousemove",{bubbles:!0,clientX:A.left+1,clientY:(A.top+A.bottom)/2}))}else!T&&b&&(S.dom.dispatchEvent(new MouseEvent("mouseleave",{bubbles:!0})),V&&(V.style.display="none"),w=!0);b=T}})})}));const g=[];f.forEach(b=>{const w=u[b];g.push(Aa(b,ge(this,Se),w))}),rt(this,ct,Promise.all(g))}async create(){await ge(this,ct);const t=await ge(this,Se).create();return Ra(this,Qt,lo).call(this),t}async destroy(){var t;return(t=ge(this,Ze))==null||t.disconnect(),await ge(this,ct),ge(this,Se).destroy()}get editor(){return ge(this,Se)}setReadonly(t){return rt(this,kt,!t),this}getMarkdown(){return ge(this,Se).action(bn())}getEditor(){return ge(this,Se)}destroyEditor(){this.destroy()}}Se=new WeakMap;ct=new WeakMap;ut=new WeakMap;kt=new WeakMap;Ze=new WeakMap;Qt=new WeakSet;lo=function(){const e=ge(this,ut),t=u=>{parseFloat(u.style.left)<0&&(u.style.left="0px")},s=u=>{const o=e.querySelector(u);o&&(ge(this,Ze).observe(o,{attributes:!0,attributeFilter:["style"]}),setTimeout(()=>t(o),0))};rt(this,Ze,new MutationObserver(u=>{const o=u[0];o.type==="childList"?(s("milkdown-link-edit"),s("milkdown-link-preview")):t(o.target)})),ge(this,Ze).observe(e,{childList:!0,subtree:!0})};ao.Feature=no;const xa={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:kn,ProsemirrorAdapterProvider:wn},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:{onUnsavedChangesProceeded(){if(this.pendingNavigation){this.hasUnsavedChanges=!1,this.context==="comment"&&this.is_modal&&(window.fcom_modal_comment_unsaved=!1);const e=this.pendingNavigation;this.pendingNavigation=null,setTimeout(()=>e.click(),0)}},clearContent(){this.editor&&(this.editor.action(e=>{const t=e.get(lt),{state:s}=t,u=s.tr.replaceWith(0,s.doc.content.size,s.schema.nodes.paragraph.create());t.dispatch(u)}),this.currentContent="")},updateContent(e){this.editor.action(t=>{const s=t.get(lt),{state:u}=s,{from:o}=u.selection,i=e,m=u.tr.insertText(i,o),f=o+i.length,h=m.setSelection(Ss.create(m.doc,f));s.dispatch(h),s.focus()})},initEditor(){const e=this,t=new ao({root:this.$refs.crepe_editor_vue,defaultValue:this.modelValue,featureConfigs:{placeholder:{text:this.placeholder||this.$t("Type your message here!"),mode:"doc"},"block-edit":{hasImageBlock:!this.disable_media&&!!this.onInlineUpload,canAddImage:this.canAddImage},"image-block":{onUpload:async s=>{if(!this.onInlineUpload)return null;this.activeUploadBlock&&this.activeUploadBlock.classList.add("uploading");try{return await this.onInlineUpload(s)}finally{this.activeUploadBlock&&(this.activeUploadBlock.classList.remove("uploading"),this.activeUploadBlock=null)}},blockUploadButton:()=>this.$t("Upload image"),blockConfirmButton:()=>this.$t("Confirm"),blockUploadPlaceholderText:this.$t("or paste link")},"link-tooltip":{inputPlaceholder:this.$t("Paste link...")}},onUpdate(s){s=s.replace(/!\[[^\]]*\]\(\s*\)/g,""),e.$emit("update:modelValue",s),e.currentContent=s},async handleCommonActions(s,u){if(s==="editor_updated"){if(e.disable_mention)return!1;e.checkforMention(u)}else if(s==="handleFileUpload")return e.disable_media?[]:await e.handleFileUpload(u)}});t.create().then(()=>{this.editor=t.getEditor(),this.focusOnEditor(),this.$emit("editorCreated")})},focusOnEditor(e=null){!e&&!this.autofocus||!this.editor||this.editor.action(t=>{const s=t.get(lt),{state:u}=s;let o=null;e&&u.doc.descendants((m,f)=>{if(m.isText&&m.text){const h=m.text.lastIndexOf(e);h!==-1&&(o=f+h+e.length+1)}});const i=o!==null?Math.min(o,u.doc.content.size-1):Math.max(1,u.doc.content.size-1);s.dispatch(u.tr.setSelection(Ss.create(u.doc,i))),s.focus()})},checkforMention(e){if(!this.currentContent.includes("@")||this.justReplaced){this.showMentionPop=!1,this.currentMentionSearch="";return}const s=e.get(lt),{state:u}=s,{selection:o}=u;if(!o)return;const m=u.doc.textBetween(0,o.to," ").match(/@([\p{L}\p{M}\p{N}_.-]+)$/u);if(!m){this.showMentionPop=!1,this.currentMentionSearch="";return}let f=m[1];if(!f||f.length<3){if(this.defaultMentions&&this.defaultMentions.length){let h=f.toLowerCase(),g=this.defaultMentions.filter(k=>k.username.toLowerCase().includes(h)||k.display_name.toLowerCase().includes(h));g.length&&(this.currentMentionSearch=f,this.mentionResults=g,this.showMentionPop=!0)}return}if(this.currentMentionSearch&&(this.currentMentionSearch=f,this.searchingMention))return!1;this.searchingMention=!0,this.currentMentionSearch=f,this.$get("members",{mention:this.currentMentionSearch,...this.mentionQuery}).then(h=>{this.mentionResults=h.members.data,this.showMentionPop=!0}).finally(()=>{this.searchingMention=!1})},addMention(e){if(this.disable_mention)return;const t=new RegExp(`@${this.currentMentionSearch}(?!.*@${this.currentMentionSearch})`);this.currentContent=this.currentContent.replace(t,e+" "),this.editor.action(Cn(this.currentContent)),this.focusOnEditor(e),this.showMentionPop=!1,this.currentMentionSearch="",this.justReplaced=!0,setTimeout(()=>{this.justReplaced=!1},2e3)},async handleFileUpload(e){const t=e.files;for(let s=0;s<t.length;s++){const u=t.item(s);if(u&&u.type.includes("image"))if(this.onInlineUpload){if(this.canAddImage&&!this.canAddImage())continue;await this.insertInlineImage(u)}else this.$emit("handleMediaUpload",u)}return[]},async insertInlineImage(e){try{const t=await this.onInlineUpload(e);if(!t)return;this.editor.action(s=>{const u=s.get(lt),{state:o}=u,i=o.schema.nodes["image-block"];if(!i)return;const m=i.create({src:t,caption:"",ratio:1}),{$from:f}=o.selection,h=f.after(1),g=o.tr.insert(h,m);u.dispatch(g),u.focus()})}catch{}},handleBeforeUnload(e){this.hasUnsavedChanges&&(e.preventDefault(),e.returnValue="")},handleLinkClick(e){const t=e.target.closest("a");if(!t||!this.hasUnsavedChanges||e.metaKey||e.ctrlKey)return;const s=t.getAttribute("href"),u=this.appVars.portal_url;if(!s)return;const o=s.startsWith(u)||s.startsWith("/"),i=s===window.location.href;o&&!i&&(e.preventDefault(),e.stopPropagation(),this.pendingNavigation=t,this.$eventBus.emit("showUnsavedChangesModal",this.context))},handleImageBlockClick(e){const t=e.target.closest("milkdown-image-block");t&&(this.activeUploadBlock=t,e.target.closest(".confirm")&&!this.canAddImage()&&(e.preventDefault(),e.stopPropagation()))}},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",this.onUnsavedChangesProceeded)},beforeUnmount(){var e;this.editor&&this.editor.destroy(),this.context==="comment"&&this.is_modal&&this.hasUnsavedChanges&&(window.fcom_modal_comment_unsaved=!1),window.removeEventListener("beforeunload",this.handleBeforeUnload),document.removeEventListener("click",this.handleLinkClick,!0),this.onInlineUpload&&((e=this.$refs.crepe_editor_vue)==null||e.removeEventListener("click",this.handleImageBlockClick,!0)),this.$eventBus.off("unsavedChangesProceeded",this.onUnsavedChangesProceeded)}},Ha={style:{position:"relative"},class:"fcom_md_editor"},Oa={ref:"crepe_editor_vue",class:"crepe-editor feed_md_content fcom_md_seditor_wrapper"},ja={class:"fcom_mention_pop_wrap"},Na={key:0},za={key:0},qa=["onClick"],Ga=["src"],Ya={key:1};function Wa(e,t,s,u,o,i){const m=p("ProsemirrorAdapterProvider"),f=p("MilkdownProvider"),h=ye;return n(),c(P,null,[a(f,null,{default:r(()=>[a(m,null,{default:r(()=>[l("div",Ha,[l("div",Oa,null,512)])]),_:1})]),_:1}),l("div",ja,[a(h,{"popper-class":"fcom_mention_pop",ref:"mentionPopoverRef",placement:"bottom",visible:o.showMentionPop,width:300,persistent:!1},{reference:r(()=>[...t[0]||(t[0]=[l("span",{style:{}},null,-1)])]),default:r(()=>[o.justReplaced?_("",!0):(n(),c("div",Na,[o.mentionResults.length?(n(),c("ul",za,[(n(!0),c(P,null,R(o.mentionResults,g=>(n(),c("li",{key:g.user_id,onClick:k=>i.addMention("@"+g.username)},[g.avatar?(n(),c("img",{key:0,alt:"",src:g.avatar},null,8,Ga)):_("",!0),l("span",null,d(g.display_name)+" (@"+d(g.username)+")",1)],8,qa))),128))])):o.searchingMention?_("",!0):(n(),c("div",Ya,[l("p",null,d(e.$t("No results found. Please search by username")),1)]))]))]),_:1},8,["visible"])])],64)}const Et=I(xa,[["render",Wa]]);const Za={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 s,u,o,i,m;const t=(u=(s=this.$refs.popoverRef)==null?void 0:s.popperRef)==null?void 0:u.contentRef;t!=null&&t.contains(e.target)||(o=this.$refs.triggerRef)!=null&&o.contains(e.target)||(m=(i=e.target).closest)!=null&&m.call(i,".el-popper")||this.hide()},handleAction(e){this.hide(),e.action&&e.action()},focusFirstItem(){this.focusItem(0)},focusItem(e){var u;const t=this.$refs.menuItems;if(!Array.isArray(t)||!t.length)return;const s=t[(e+t.length)%t.length];(u=s==null?void 0:s.focus)==null||u.call(s)},hideAndFocusTrigger(){this.hide(),this.$nextTick(()=>{var s,u;const e=this.$refs.triggerRef,t=((s=e==null?void 0:e.querySelector)==null?void 0:s.call(e,"button, a, [tabindex]"))||e;(u=t==null?void 0:t.focus)==null||u.call(t)})}},beforeUnmount(){document.removeEventListener("click",this.onClickOutside,!0)}},Ka=["onClick","onKeydown"];function Ja(e,t,s,u,o,i){const m=p("MoreFilled"),f=O,h=H,g=ye;return n(),y(g,{trigger:"manual",placement:s.placement,persistent:s.persistent,width:s.width,visible:o.visible,teleported:!1,"popper-class":"fcom_menu_below_nav",onAfterEnter:i.focusFirstItem,ref:"popoverRef"},{reference:r(()=>[l("span",{ref:"triggerRef",class:"fcom_action_popover_trigger",onClick:t[0]||(t[0]=(...k)=>i.toggle&&i.toggle(...k))},[G(e.$slots,"trigger",{},()=>[a(h,{"aria-label":e.$t("View actions"),"aria-haspopup":"menu","aria-expanded":o.visible,class:"fcom_action_popover_default_trigger_button",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label","aria-expanded"])])],512)]),default:r(()=>[G(e.$slots,"default",{hide:i.hide},()=>[l("ul",{class:"actions_items",role:"menu","aria-orientation":"vertical",onKeydown:t[1]||(t[1]=ae(z((...k)=>i.hideAndFocusTrigger&&i.hideAndFocusTrigger(...k),["prevent","stop"]),["esc"]))},[(n(!0),c(P,null,R(s.items,(k,b)=>(n(),c("li",{key:b,ref_for:!0,ref:"menuItems",class:x(["fcom_action_popover_item",k.type?"fcom_action_popover_item_"+k.type:""]),role:"menuitem",tabindex:"0",onClick:w=>i.handleAction(k),onKeydown:[ae(z(w=>i.handleAction(k),["prevent"]),["enter"]),ae(z(w=>i.handleAction(k),["prevent"]),["space"]),ae(z(w=>i.focusItem(b+1),["prevent"]),["down"]),ae(z(w=>i.focusItem(b-1),["prevent"]),["up"])]},d(k.label),43,Ka))),128))],32)])]),_:3},8,["placement","persistent","width","visible","onAfterEnter"])}const pt=I(Za,[["render",Ja]]),Qa={name:"SmilyIcon"},Xa={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function er(e,t,s,u,o,i){return n(),c("svg",Xa,[...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 tr=I(Qa,[["render",er]]),sr={name:"EmojiPicker",components:{Picker:en,ActionPopover:pt,SmilyIcon:tr},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 tn(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})}}},or={class:"ffcom_emoji"},ir={key:0,class:"emoji-mart emoji-mart-static",style:{width:"320px",padding:"10px 20px"}},nr={key:0},lr={style:{"text-align":"center","margin-bottom":"20px"}},ar={key:1,class:"fcom_emoji_holder"};function rr(e,t,s,u,o,i){const m=p("SmilyIcon"),f=O,h=H,g=Z,k=p("Picker"),b=p("action-popover");return n(),y(b,{ref:"fcom_emoji_popover","close-on-click-outside":!0,placement:"bottom",persistent:!1,"trigger-interactive":!0,width:350,onShow:i.loadEmojiAssets},{trigger:r(()=>[a(h,{"aria-label":"Pick Imoji",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})]),default:r(({hide:w})=>[l("div",or,[o.emojiLoading?(n(),c("div",ir,[o.errorMessage?(n(),c("div",nr,d(o.errorMessage),1)):(n(),c(P,{key:1},[l("div",lr,d(e.$t("Loading.....")),1),a(g,{animated:!0,rows:3})],64))])):o.emojiIndex?(n(),c("div",ar,[a(k,{title:e.$t("Pick Emoji"),i18n:{search:e.$t("Search"),notfound:e.$t("No Emoji Found"),categories:{search:e.$t("Search Results"),recent:e.$t("Frequently Used"),smileys:e.$t("Smileys & Emotion"),people:e.$t("People & Body"),nature:e.$t("Animals & Nature"),foods:e.$t("Food & Drink"),activity:e.$t("Activity"),places:e.$t("Travel & Places"),objects:e.$t("Objects"),symbols:e.$t("Symbols"),flags:e.$t("Flags"),custom:e.$t("Custom")}},color:"#66b1ff",showPreview:!1,ref:"picker",data:o.emojiIndex,set:"twitter",onSelect:S=>i.onEmojiSelect(S,w),emojiSize:22,sheetSize:32,emojiTooltip:!1},null,8,["title","i18n","data","onSelect"])])):_("",!0)])]),_:1},8,["onShow"])}const ro=I(sr,[["render",rr]]),cr={name:"AudioEditModal",components:{ImageUploader:He,EditPen:qs,Delete:Gs},emits:["update:visible","saved"],props:{media:{type:Object,required:!0},visible:{type:Boolean,default:!1}},data(){return{localTitle:this.readTitle(),localPoster:this.readPoster(),saving:!1}},watch:{visible(e){e&&(this.localTitle=this.readTitle(),this.localPoster=this.readPoster())}},methods:{readTitle(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.title)||((s=this.media)==null?void 0:s.title)||""},readPoster(){var e,t,s;return((t=(e=this.media)==null?void 0:e.settings)==null?void 0:t.posterSrc)||((s=this.media)==null?void 0:s.image)||""},save(){var e;if(!this.localTitle||!this.localTitle.trim()){this.$handleError(this.$t("Audio file name cannot be empty"));return}if(this.localTitle=this.localTitle.trim(),!((e=this.media)!=null&&e.media_id)){this.$emit("saved",this.buildLocalUpdate()),this.$emit("update:visible",!1);return}this.saving=!0,this.$post("fluent-player/audio-media/"+this.media.media_id,{title:this.localTitle,posterSrc:this.localPoster}).then(t=>{this.$emit("saved",{...this.media,...t.media}),this.$emit("update:visible",!1)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},buildLocalUpdate(){var t;const e={...((t=this.media)==null?void 0:t.settings)||{},title:this.localTitle,posterSrc:this.localPoster,poster_is_custom:!!this.localPoster};return{...this.media,title:this.localTitle,image:this.localPoster,settings:e}}}},dr={class:"fcom_audio_edit"},ur={id:"fcom_audio_name_label",class:"fcom_audio_edit__label"},_r={class:"fcom_audio_edit__label"},mr={class:"fcom_audio_edit__thumb_row"},hr={class:"fcom_image_uploader_wrapper"},fr={class:"fcom_sr_only"};function pr(e,t,s,u,o,i){const m=te,f=Fe,h=p("EditPen"),g=O,k=H,b=p("Delete"),w=p("image-uploader"),S=we;return n(),y(S,{"model-value":s.visible,title:e.$t("Edit Audio"),width:"440px","append-to-body":"","onUpdate:modelValue":t[3]||(t[3]=C=>e.$emit("update:visible",C))},{footer:r(()=>[a(k,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=C=>e.$emit("update:visible",!1))},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(k,{class:"fcom_primary_button",loading:o.saving,disabled:!o.localTitle||!o.localTitle.trim(),onClick:i.save},{default:r(()=>[M(d(e.$t("Save")),1)]),_:1},8,["loading","disabled","onClick"])]),default:r(()=>[l("div",dr,[l("label",ur,d(e.$t("Audio file name")),1),a(m,{modelValue:o.localTitle,"onUpdate:modelValue":t[0]||(t[0]=C=>o.localTitle=C),placeholder:e.$t("Audio file name"),"aria-label":e.$t("Audio file name"),"aria-labelledby":"fcom_audio_name_label"},null,8,["modelValue","placeholder","aria-label"]),l("label",_r,d(e.$t("Thumbnail")),1),l("div",mr,[o.localPoster?(n(),y(f,{key:0,src:o.localPoster,alt:e.$t("Thumbnail"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",hr,[a(w,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.localPoster,confirm_remove:!0,additionalData:{resize:!1,max_width:500,skip_convert:"yes"},onUploaded:t[1]||(t[1]=C=>{o.localPoster=C})},ve({remove:r(()=>[a(g,null,{default:r(()=>[a(b)]),_:1}),l("span",fr,d(e.$t("Remove Thumbnail")),1)]),_:2},[o.localPoster?{name:"trigger",fn:r(({loading:C})=>[a(k,{class:"fcom_plain_button",loading:C,disabled:C,"aria-label":e.$t("Change Thumbnail"),title:e.$t("Change Thumbnail")},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["loading","disabled","aria-label","title"])]),key:"0"}:void 0]),1032,["can_remove"])])])])]),_:1},8,["model-value","title"])}const gr=I(cr,[["render",pr]]),yr={name:"MusicIcon"},vr={width:"22",height:"22",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",focusable:"false"};function br(e,t,s,u,o,i){return n(),c("svg",vr,[...t[0]||(t[0]=[l("path",{d:"M7.5 15V4.583l8.333-1.25V13.75",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M5.417 17.5c1.15 0 2.083-.84 2.083-1.875S6.567 13.75 5.417 13.75 3.333 14.59 3.333 15.625 4.266 17.5 5.417 17.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),l("path",{d:"M13.75 15.625c1.15 0 2.083-.84 2.083-1.875s-.933-1.875-2.083-1.875-2.083.84-2.083 1.875.933 1.875 2.083 1.875Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const kr=I(yr,[["render",br]]),wr={name:"AudioUploadButton",components:{MusicIcon:kr},emits:["audio-added","uploading","completed"],props:{space:{type:String,default:""},remaining:{type:Number,default:null}},data(){return{uploading:!1}},computed:{maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},capacity(){return this.remaining===null?this.maxAudios:Math.max(0,this.remaining)},canUpload(){const e=this.appVars.features.fluent_player;if(!this.appVars.features.has_fluent_player||!e||!e.enable||!e.has_audio_upload)return!1;const t=e.video_upload_role||"admin";return t==="everyone"?!0:t==="admin_moderator"?this.isModerator(this.space)||this.isAdmin():this.isAdmin()}},methods:{pickFiles(){this.$refs.fileInput&&this.$refs.fileInput.click()},async onFilesSelected(e){var s,u;let t=Array.from(e.target.files||[]);if(e.target.value="",!!t.length){if(this.capacity<=0){this.$handleError(this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}t.length>this.capacity&&((u=(s=this.$notify)==null?void 0:s.warning)==null||u.call(s,this.$t("You can add a maximum of %s audios per post.",this.maxAudios)),t=t.slice(0,this.capacity)),this.uploading=!0,this.$emit("uploading");for(const o of t)try{await this.uploadOne(o)}catch(i){this.$handleError(i&&i.message?i.message:i)}this.uploading=!1,this.$emit("completed")}},uploadOne(e){const t=new FormData;return t.append("file",e),t.append("context","fluent_player"),t.append("media_kind","audio"),fetch(this.appVars.rest.url+"/fluent-player/video-upload",{method:"POST",headers:{"X-WP-Nonce":this.appVars.rest.nonce},body:t}).then(s=>s.json().then(u=>({ok:s.ok,body:u}))).then(({ok:s,body:u})=>{if(!s||!u||!u.media||!u.media.url)throw new Error(u&&u.message||this.$t("Failed to upload audio"));const o=u.media;this.$emit("audio-added",{type:"upload",url:o.url,player:"fluent_player",provider:"upload",content_type:"audio",html:"",title:o.settings&&o.settings.title||e.name,media_id:o.media_id,settings:o.settings||{}})})}}};function Cr(e,t,s,u,o,i){const m=p("MusicIcon"),f=O,h=H;return i.canUpload?(n(),y(h,{key:0,"aria-label":e.$t("Upload Audio"),title:e.$t("Upload Audio"),text:"",loading:o.uploading,onClick:i.pickFiles},{default:r(()=>[a(f,{class:"fcom_status_img_icon"},{default:r(()=>[a(m)]),_:1}),l("input",{ref:"fileInput",type:"file",accept:".mp3,.wav,.m4a,.aac,.ogg,.oga,.flac",multiple:"",hidden:"",onChange:t[0]||(t[0]=(...g)=>i.onFilesSelected&&i.onFilesSelected(...g))},null,544)]),_:1},8,["aria-label","title","loading","onClick"])):_("",!0)}const $r=I(wr,[["render",Cr]]),Sr={name:"DocumentsUploader",components:{UploadFilled:Lt,Document:Pt},emits:["filesChanged","fileAdded"],props:{is_multiple:{type:Boolean,default:!1},additional_data:{type:Object,default:()=>({})},showLists:{type:Boolean,default:!0},prevFiles:{type:Array,default:()=>[]}},computed:{action_url(){return this.appVars.rest.url+"/documents/upload"},headers(){return{"X-WP-Nonce":this.appVars.rest.nonce}},uploadingFiles(){return this.fileList.filter(e=>e.status==="uploading")}},data(){return{fileList:[]}},methods:{handleSuccess(e){var t;console.log(e),(t=e==null?void 0:e.file)!=null&&t.media_key&&this.$emit("fileAdded",e==null?void 0:e.file)},handleChange(){let e=[];this.fileList.forEach(t=>{var s,u;(u=(s=t==null?void 0:t.response)==null?void 0:s.file)!=null&&u.media_key&&e.push({id:t.response.file.id,media_key:t.response.file.media_key,title:t.response.file.title,type:t.response.file.type})}),this.$emit("filesChanged",e)},handleError(e){this.$handleError(JSON.parse(e.message))}}},Vr={class:"fcom_documents_uploader"},Mr={class:"el-upload__text"},Tr={key:0},Lr={class:"fcom_document_lists"},Pr={class:"fcom_each_document"},Fr={class:"fcom_document_info"},Ir={class:"fcom_document_icon"},Er={class:"fcom_document_title"},Ur={class:"fcom_document_actions"};function Ar(e,t,s,u,o,i){const m=p("UploadFilled"),f=O,h=mt,g=p("Document"),k=H;return n(),c("div",Vr,[a(h,{action:i.action_url,headers:i.headers,"file-list":o.fileList,"onUpdate:fileList":t[0]||(t[0]=b=>o.fileList=b),accept:"*/*",drag:"",class:"fcom_document_upload",multiple:s.is_multiple,data:s.additional_data,"show-file-list":s.showLists,"on-change":i.handleChange,"on-success":i.handleSuccess,"on-error":i.handleError,"on-remove":i.handleChange},{default:r(()=>[a(f,{class:"el-icon--upload"},{default:r(()=>[a(m)]),_:1}),l("div",Mr,d(e.$t("Drop file here or click to upload")),1)]),_:1},8,["action","headers","file-list","multiple","data","show-file-list","on-change","on-success","on-error","on-remove"]),!s.showLists&&i.uploadingFiles.length?(n(),c("div",Tr,[l("div",Lr,[(n(!0),c(P,null,R(i.uploadingFiles,b=>(n(),c("div",Pr,[l("div",Fr,[l("div",Ir,[a(f,null,{default:r(()=>[a(g)]),_:1})]),l("span",Er,d(b.name),1)]),l("div",Ur,[a(k,{text:"",size:"small",loading:!0},{default:r(()=>[M(d(e.$t("Uploading...")),1)]),_:1})])]))),256))])])):_("",!0)])}const Br=I(Sr,[["render",Ar]]),Dr={name:"PdfIcon"},Rr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function xr(e,t,s,u,o,i){return n(),c("svg",Rr,[...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 Hr=I(Dr,[["render",xr]]),Or={name:"ZipIcon"},jr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Nr(e,t,s,u,o,i){return n(),c("svg",jr,[...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 zr=I(Or,[["render",Nr]]),qr={name:"AudioIcon"},Gr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Yr(e,t,s,u,o,i){return n(),c("svg",Gr,[...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 Wr=I(qr,[["render",Yr]]),Zr={name:"DocIcon"},Kr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function Jr(e,t,s,u,o,i){return n(),c("svg",Kr,[...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 Qr=I(Zr,[["render",Jr]]),Xr={name:"VideoFileIcon"},ec={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"20",height:"20",color:"currentColor",fill:"none"};function tc(e,t,s,u,o,i){return n(),c("svg",ec,[...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 sc=I(Xr,[["render",tc]]);const oc={name:"DocumentLists",components:{Document:Pt,Download:ai,PdfIcon:Hr,ImageIcon:us,ZipIcon:zr,AudioIcon:Wr,DocIcon:Qr,VideoFileIcon:sc},props:["document_lists","additional_data","is_editable","allow_rename"],emits:["fileRemoved","documentsUpdated"],data(){return{editingIndex:null,editingTitle:"",isSaving:!1}},computed:{canEditTitle(){return this.is_editable||this.allow_rename}},methods:{removeDocument(e,t){if(!this.is_editable){this.$emit("fileRemoved",e);return}this.$confirm(this.$t("Are you sure you want to delete this document?"),this.$t("Warning"),{confirmButtonText:this.$t("OK"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.deleteDocument(e,t)})},deleteDocument(e,t){this.isSaving=!0,this.$post("documents/delete",{id:t.id}).then(s=>{this.$notify.success(s.message),this.document_lists.splice(e,1),this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})},getIcon(e){return e=="application/pdf"?"pdf-icon":e.includes("image")?"image-icon":e=="application/zip"?"zip-icon":e.includes("audio")?"audio-icon":e.includes("video")?"video-file-icon":e.includes("openxmlformats")?"doc-icon":"document"},startEdit(e,t){this.editingIndex=e,this.editingTitle=this.getBaseName(t.title)},cancelEdit(){this.editingIndex=null,this.editingTitle=""},getFileExtension(e){if(!e)return"";const t=e.lastIndexOf(".");return t<=0||t===e.length-1?"":e.slice(t)},getBaseName(e){const t=this.getFileExtension(e);return t?e.slice(0,-t.length):e||""},saveDoc(e){const t=this.editingTitle.trim()+this.getFileExtension(e.title);this.isSaving=!0,this.$post("documents/update",{id:e.id,title:t,...this.additional_data}).then(s=>{e.title=t,this.$notify.success(s.message),this.isSaving=!1,this.editingIndex=null,this.$emit("documentsUpdated",this.document_lists)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.isSaving=!1})}}},ic={class:"fcom_document_lists"},nc={class:"fcom_each_document"},lc={class:"fcom_document_info"},ac={class:"fcom_document_icon"},rc={class:"fcom_document_ext"},cc={class:"fcom_rename_actions"},dc=["href"],uc={class:"fcom_document_actions"},_c=["href"];function mc(e,t,s,u,o,i){const m=O,f=te,h=H,g=p("EditPen"),k=p("Download"),b=p("DeleteFilled"),w=ee("loading");return n(),c("div",ic,[(n(!0),c(P,null,R(s.document_lists,(S,C)=>(n(),c("div",nc,[l("div",lc,[l("div",ac,[a(m,null,{default:r(()=>[(n(),y(Ct(i.getIcon(S.type))))]),_:2},1024)]),i.canEditTitle&&o.editingIndex==C?(n(),c(P,{key:0},[a(f,{readonly:o.isSaving,size:"small","aria-label":e.$t("Document name"),style:{flex:"1",width:"100%"},modelValue:o.editingTitle,"onUpdate:modelValue":t[0]||(t[0]=v=>o.editingTitle=v)},ve({_:2},[i.getFileExtension(S.title)?{name:"suffix",fn:r(()=>[l("span",rc,d(i.getFileExtension(S.title)),1)]),key:"0"}:void 0]),1032,["readonly","aria-label","modelValue"]),l("div",cc,[a(h,{disabled:o.isSaving||!o.editingTitle.trim(),loading:o.isSaving,onClick:v=>i.saveDoc(S),type:"primary",size:"small"},{default:r(()=>[M(d(e.$t("Update")),1)]),_:1},8,["disabled","loading","onClick"]),a(h,{disabled:o.isSaving,onClick:i.cancelEdit,size:"small"},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"])])],64)):(n(),c("a",{key:1,href:S.url,target:"_blank",rel:"noopener",class:"fcom_document_title"},d(S.title),9,dc))]),Y((n(),c("div",uc,[i.canEditTitle&&o.editingIndex!=C?(n(),y(h,{key:0,onClick:v=>i.startEdit(C,S),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClick"])):_("",!0),!s.is_editable&&S.url?(n(),c("a",{key:1,href:S.url+"&force_download=1",target:"_blank",class:"el-button el-button--text"},[a(m,null,{default:r(()=>[a(k)]),_:1})],8,_c)):_("",!0),s.is_editable?(n(),y(h,{key:2,onClick:v=>i.removeDocument(C,S),plain:"",text:"",size:"small"},{default:r(()=>[a(m,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])):_("",!0)])),[[w,o.isSaving]])]))),256))])}const ot=I(oc,[["render",mc]]);const hc={name:"DocumentUploaderPop",components:{DocumentLists:ot,DocumentsUploader:Br,Document:Pt},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="")}}},fc={class:"fcom_inline_docs_form"},pc={class:"fcom_doc_upload_modal"};function gc(e,t,s,u,o,i){var g;const m=H,f=p("documents-uploader"),h=p("document-lists");return n(),c("div",fc,[l("div",pc,[a(m,{onClick:t[0]||(t[0]=k=>i.reset()),class:"fcom_file_cancel_btn",text:"",size:"small"},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(f,{style:{"margin-bottom":"20px"},showLists:!1,additional_data:{space_id:s.space_id},is_multiple:!0,onFileAdded:i.fileAdded},null,8,["additional_data","onFileAdded"]),a(h,{class:"fcom_boxed_documents",additional_data:{space_id:s.space_id,feed_id:s.feed.id},is_editable:!0,document_lists:(g=s.feed)==null?void 0:g.document_ids,onFileRemoved:i.removeDocument},null,8,["additional_data","document_lists","onFileRemoved"])])])}const yc=I(hc,[["render",gc]]),vc={name:"PaperClipIcon"},bc={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function kc(e,t,s,u,o,i){return n(),c("svg",bc,[...t[0]||(t[0]=[l("path",{d:"M18.1188 9.2622L11.431 16.6897C9.50497 18.8288 6.13081 18.9109 3.86828 16.8737C1.60575 14.8365 1.33471 11.4723 3.26079 9.33317L9.14601 2.79697C10.4836 1.31147 12.8106 1.25484 14.3818 2.66956C15.953 4.08428 16.1399 6.40445 14.8023 7.88995L9.45214 13.832C8.70311 14.6638 7.42326 14.695 6.54338 13.9027C5.66351 13.1105 5.5607 11.8344 6.30973 11.0025L10.8574 5.95182",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const co=I(vc,[["render",kc]]),wc=window.fluentComAdmin.auth,Cc={name:"FeedTextComposer",components:{AudioEditModal:gr,AudioList:io,AudioUploadButton:$r,PaperClipIcon:co,DocumentLists:ot,DocumentUploaderPop:yc,Document:Pt,MediaPreview:Oe,Giphy:Vl,ImageUploader:He,SurveyEditForm:hl,MarkdownEditor:Et,EmojiPicker:ro,VideoEmbeder:Fa,ImageIcon:us,PollIcon:nl},emits:["editorCreated"],props:{placeholder:{type:String,default(){return"What's happening, "+wc.first_name}},config:{type:Object,default(){return{multipleMedia:!1,surveyApp:!1,videoApp:!1,disableUpload:!1,documentsApp:!1,space_id:null,spaceSlug:null,isAdmin:!1}}},disabled:{type:Boolean,default(){return!1}},autofocus:{type:Boolean,default(){return!0}},content:{type:Object,default(){return{message:"",media_images:[]}}},mentionQuery:{type:Object,default(){return{}}},autofocus_changed:{type:[Boolean,Number],default(){return!1}},defaultMentions:{type:Array,default(){return[]}},context:{type:String,default(){return""}},is_editing:{type:Boolean,default(){return!1}},is_modal:{type:Boolean,default(){return!1}}},computed:{hasActiveApp(){return this.content.content_type=="document"},hasInlineImageUpload(){return this.appVars.features.has_inline_image_upload==="yes"},maxAudios(){var e;return((e=this.appVars.features.fluent_player)==null?void 0:e.max_audios_per_post)||10},audioRemaining(){var e,t;return Math.max(0,this.maxAudios-(((t=(e=this.content)==null?void 0:e.audio_medias)==null?void 0:t.length)||0))}},data(){return{mentionResults:[],mentionSearch:"",uploading:!1,isEmojiPickerVisible:!1,showAudioEdit:!1,composerEditIndex:null,maxMediaPerPost:this.appVars.features.max_media_per_post}},methods:{cencelSurvey(){this.content.survey=null},insertEmoji(e){this.$refs.markdownEditor&&this.$refs.markdownEditor.updateContent(e)},clearContent(){var e;this.content.message="",(e=this.$refs.markdownEditor)==null||e.clearContent()},checkHasImageForCommentsEdit(e){return e.media&&e.media.media_url},removeImageFromComments(){this.content.media=null},checkForImage(e){for(let t=0;t<e.clipboardData.items.length;++t){let s=e.clipboardData.items[t];if(s.kind=="file"&&s.type.startsWith("image/")){const u=s.getAsFile(),o=e.clipboardData.getData("text")||"clipboard-image.png";this.uploadImage(new File([u],o,{type:u.type}))}}},uploadImage(e,t=!0){if(this.config.disableUpload)return this.$notify.error(this.$t("You are not allowed to upload media here.")),!1;if(!this.canAddImage())return!1;t&&(this.uploading=!0);const s=new FormData;return s.append("file",e),s.append("max_width",1400),s.append("context",this.context),s.append("resize",!0),this.$uploadFile("feeds/media-upload",s).then(u=>(t&&this.handleMediaUpload(u.media.url),u.media.url)).catch(u=>{this.$handleError(u)}).finally(()=>{this.uploading=!1})},handleMediaUpload(e,t="uploader"){var s,u;if(this.content.media_images||(this.content.media_images=[]),(u=(s=this.content)==null?void 0:s.meta)!=null&&u.media_preview&&(this.content.meta.media_preview=null),this.config.multipleMedia||(this.content.media_images=[]),!this.canAddImage())return!1;this.content.media=null,this.content.meta=null,this.content.audio_medias=[],this.content.media_images.push({url:e,provider:t,type:"image",height:0,width:0})},initSurveyForm(){this.content.survey||(this.content.survey={type:"single_choice",options:[{slug:"",label:this.$t("First choice")},{slug:"",label:""}]})},selectedGiphy(e){var s,u;this.content.meta||(this.content.meta=[]),(s=this.content)!=null&&s.media_images&&(this.content.media_images=[]),(u=this.content)!=null&&u.media&&(this.content.media=null),this.content.audio_medias=[];const t={image:e.images.downsized_medium.url,height:e.images.downsized_medium.height,width:e.images.downsized_medium.width,type:"image",provider:"giphy"};this.content.meta={media_preview:t}},handleVideoAttachment(e){var s,u,o;if(e&&(e.content_type==="audio"||((s=e.settings)==null?void 0:s.viewType)==="audio")){if(this.content.media_images=[],this.content.media=null,this.content.meta&&!Array.isArray(this.content.meta)&&this.content.meta.media_preview&&(this.content.meta.media_preview=null),Array.isArray(this.content.audio_medias)||(this.content.audio_medias=[]),this.content.audio_medias.length>=this.maxAudios){(o=(u=this.$notify)==null?void 0:u.warning)==null||o.call(u,this.$t("You can add a maximum of %s audios per post.",this.maxAudios));return}this.content.audio_medias.push({...e,player:"fluent_player"}),this.syncAudioMediasToMeta();return}this.content.media_images=[],this.content.meta=[],this.content.audio_medias=[],this.content.media=e},syncAudioMediasToMeta(){const e=Array.isArray(this.content.audio_medias)?this.content.audio_medias:[];(!this.content.meta||Array.isArray(this.content.meta))&&(this.content.meta={...this.content.meta||{}}),e.length?this.content.meta.audio_medias=e:delete this.content.meta.audio_medias},removeComposerAudio(e){Array.isArray(this.content.audio_medias)&&(this.content.audio_medias.splice(e,1),this.syncAudioMediasToMeta())},openComposerAudioEdit(e){this.composerEditIndex=e,this.showAudioEdit=!0},onComposerAudioSaved(e){if(this.composerEditIndex===null)return;const t=this.content.audio_medias[this.composerEditIndex]||{};this.content.audio_medias.splice(this.composerEditIndex,1,{...t,...e}),this.syncAudioMediasToMeta()},getInlineImageCount(){var t,s;const e=(s=(t=this.$refs.markdownEditor)==null?void 0:t.$refs)==null?void 0:s.crepe_editor_vue;return e?e.querySelectorAll('img[src^="http"]').length:0},canAddImage(){var s;return(((s=this.content.media_images)==null?void 0:s.length)||0)+this.getInlineImageCount()>=this.maxMediaPerPost?(this.$notify.error(this.$t("You can upload a maximum of %s images per post.",this.maxMediaPerPost)),!1):!0}},mounted(){var t,s,u;const e=(s=(t=this.content)==null?void 0:t.meta)==null?void 0:s.audio_medias;Array.isArray(e)&&e.length&&!((u=this.content.audio_medias)!=null&&u.length)&&(this.content.audio_medias=[...e]),this.autofocus&&this.$nextTick(()=>{this.$refs.create_status&&this.$refs.create_status.focus()})}},$c={class:"fcom_text_composer"},Sc={class:"fcom_editor status_text_input"},Vc={key:1,class:"fcom_audio_compose_list"},Mc={key:2,style:{position:"relative","text-align":"center"}},Tc={key:3,class:"fcom_media_items"},Lc={key:0,class:"fcom_media_images"},Pc=["src","alt"],Fc={key:1,class:"fcrom_media_images"},Ic={class:"fcrom_media_image"},Ec=["src","alt"],Uc={key:4,class:"fcrom_media_images"},Ac=["src","alt"],Bc={key:5,class:"fcrom_media_images"},Dc={class:"fcrom_media_image"},Rc=["src","alt"],xc={class:"fcom_composer_footer"},Hc={class:"fcom_composer_apps"},Oc={key:0},jc={class:"fcom_composer_actions"};function Nc(e,t,s,u,o,i){var E,q,j,N,W,le,B,J,me,Q,he;const m=p("MarkdownEditor"),f=p("DocumentUploaderPop"),h=p("SurveyEditForm"),g=p("audio-list"),k=p("audio-edit-modal"),b=H,w=p("media-preview"),S=p("CloseBold"),C=O,v=p("ImageIcon"),$=p("image-uploader"),T=p("video-embeder"),V=p("audio-upload-button"),F=p("PaperClipIcon"),L=p("PollIcon"),A=p("EmojiPicker"),D=p("Giphy"),U=ee("loading");return n(),c(P,null,[l("div",$c,[l("div",Sc,[G(e.$slots,"before_input"),a(m,{ref:"markdownEditor",modelValue:s.content.message,"onUpdate:modelValue":t[0]||(t[0]=X=>s.content.message=X),context:s.context,is_modal:s.is_modal,autofocus:s.autofocus,placeholder:s.placeholder,mentionQuery:s.mentionQuery,defaultMentions:s.defaultMentions,autofocus_changed:s.autofocus_changed,onInlineUpload:i.hasInlineImageUpload?X=>i.uploadImage(X,!1):null,canAddImage:i.canAddImage,onHandleMediaUpload:i.uploadImage,onEditorCreated:t[1]||(t[1]=()=>{e.$emit("editorCreated")})},null,8,["modelValue","context","is_modal","autofocus","placeholder","mentionQuery","defaultMentions","autofocus_changed","onInlineUpload","canAddImage","onHandleMediaUpload"]),G(e.$slots,"after_input")]),s.content.content_type=="document"?(n(),c(P,{key:0},[s.config.documentsApp&&s.config.space_id?(n(),y(f,{key:0,is_inline:!0,feed:s.content,space_id:s.config.space_id},null,8,["feed","space_id"])):_("",!0)],64)):(n(),c(P,{key:1},[s.content.survey?(n(),y(h,{key:0,onCancel:i.cencelSurvey,form:s.content.survey,is_editing:s.is_editing},null,8,["onCancel","form","is_editing"])):_("",!0),(q=(E=s.content)==null?void 0:E.audio_medias)!=null&&q.length?(n(),c("div",Vc,[a(g,{audios:s.content.audio_medias,editable:!0,onRemove:i.removeComposerAudio,onEdit:i.openComposerAudioEdit},null,8,["audios","onRemove","onEdit"]),o.composerEditIndex!==null?(n(),y(k,{key:0,media:s.content.audio_medias[o.composerEditIndex],visible:o.showAudioEdit,"onUpdate:visible":t[2]||(t[2]=X=>o.showAudioEdit=X),onSaved:i.onComposerAudioSaved},null,8,["media","visible","onSaved"])):_("",!0)])):(N=(j=s.content)==null?void 0:j.media)!=null&&N.type?(n(),c("div",Mc,[a(b,{onClick:t[3]||(t[3]=X=>{s.content.media=null}),text:"",type:"danger"},{default:r(()=>[M(d(e.$t("Remove Media")),1)]),_:1}),a(w,{media_item:s.content.media},null,8,["media_item"])])):(W=s.content)!=null&&W.meta?(n(),c("div",Tc,[(B=(le=s.content.meta)==null?void 0:le.media_items)!=null&&B.length?(n(!0),c(P,{key:0},R(s.content.meta.media_items,(X,se)=>(n(),c("div",{key:se},[X.type=="image"?(n(),c("div",Lc,[l("img",{class:"fcom_media_image",src:X.url,alt:e.$t("Media image")},null,8,Pc),a(b,{class:"fcom_media_images_cross_button",link:"",onClick:oe=>s.content.meta.media_items.splice(se,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(S)]),_:1})]),_:1},8,["onClick"])])):_("",!0)]))),128)):((me=(J=s.content.meta)==null?void 0:J.media_preview)==null?void 0:me.type)=="image"||(he=(Q=s.content.meta)==null?void 0:Q.media_preview)!=null&&he.image?(n(),c("div",Fc,[l("div",Ic,[l("img",{src:s.content.meta.media_preview.image,alt:e.$t("Media Preview image")},null,8,Ec),a(b,{link:"",onClick:t[4]||(t[4]=X=>s.content.meta.media_preview=null)},{default:r(()=>[a(C,null,{default:r(()=>[a(S)]),_:1})]),_:1})])])):_("",!0)])):s.content.media_images&&s.content.media_images.length?(n(),c("div",Uc,[(n(!0),c(P,null,R(s.content.media_images,(X,se)=>(n(),c("div",{class:"fcrom_media_image",key:se},[l("img",{src:X.url,alt:e.$t("Media image")},null,8,Ac),a(b,{link:"",onClick:oe=>s.content.media_images.splice(se,1)},{default:r(()=>[a(C,null,{default:r(()=>[a(S)]),_:1})]),_:1},8,["onClick"])]))),128))])):i.checkHasImageForCommentsEdit(s.content)?(n(),c("div",Bc,[l("div",Dc,[l("img",{src:s.content.media.media_url,alt:e.$t("Media image")},null,8,Rc),a(b,{link:"",onClick:t[5]||(t[5]=X=>i.removeImageFromComments())},{default:r(()=>[a(C,null,{default:r(()=>[a(S)]),_:1})]),_:1})])])):_("",!0)],64))]),G(e.$slots,"before_composer_footer"),Y((n(),c("div",xc,[l("div",Hc,[i.hasActiveApp?_("",!0):(n(),c(P,{key:0},[o.maxMediaPerPost?(n(),y($,{key:0,additionalData:{resize:!0,context:s.context,max_width:1400},isMultiple:s.config.multipleMedia,onUploading:t[6]||(t[6]=()=>{o.uploading=!0}),onCompleted:t[7]||(t[7]=()=>{o.uploading=!1}),onUploaded:i.handleMediaUpload},{default:r(()=>[a(b,{"aria-label":"Upload Media",loading:o.uploading,text:""},{default:r(()=>[a(C,{class:"fcom_status_img_icon"},{default:r(()=>[a(v)]),_:1}),o.uploading?(n(),c("span",Oc,d(e.$t("Uploading...")),1)):_("",!0)]),_:1},8,["loading"])]),_:1},8,["additionalData","isMultiple","onUploaded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),y(T,{key:1,space:s.config.spaceSlug,is_admin:s.config.is_admin,onEmbeded:i.handleVideoAttachment},null,8,["space","is_admin","onEmbeded"])):_("",!0),s.config.videoApp&&e.hasFeature("video_embeder")?(n(),y(V,{key:2,space:s.config.spaceSlug,remaining:i.audioRemaining,onAudioAdded:i.handleVideoAttachment,onUploading:t[8]||(t[8]=()=>{o.uploading=!0}),onCompleted:t[9]||(t[9]=()=>{o.uploading=!1})},null,8,["space","remaining","onAudioAdded"])):_("",!0),s.config.documentsApp&&s.config.space_id?(n(),y(b,{key:3,"aria-label":e.$t("Add Documents"),title:e.$t("Upload Documents"),text:"",onClick:t[10]||(t[10]=X=>s.content.content_type="document")},{default:r(()=>[a(C,{class:x(["fcom_apps_icon"])},{default:r(()=>[a(F)]),_:1})]),_:1},8,["aria-label","title"])):_("",!0),s.config.surveyApp&&e.hasFeature("has_survey_poll")?(n(),y(b,{key:4,"aria-label":"Create Poll",onClick:i.initSurveyForm,text:""},{default:r(()=>[a(C,{class:"fcom_apps_icon"},{default:r(()=>[a(L)]),_:1})]),_:1},8,["onClick"])):_("",!0),e.hasFeature("emoji_app")?(n(),y(A,{key:5,onEmojiSelected:i.insertEmoji},null,8,["onEmojiSelected"])):_("",!0),e.hasFeature("giphy_app")?(n(),y(D,{key:6,onSelectedGiphy:i.selectedGiphy},null,8,["onSelectedGiphy"])):_("",!0)],64))]),l("div",jc,[G(e.$slots,"default")])])),[[U,o.uploading]]),G(e.$slots,"after_composer_footer")],64)}const gt=I(Cc,[["render",Nc]]),zc={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}}},qc={class:"fcom_image_carousel"},Gc={key:0},Yc=["preload","poster"],Wc=["src","type"],Zc={key:1,class:"fcom_image_wrap"},Kc={key:0,class:"fcom_image_overlay"};function Jc(e,t,s,u,o,i){const m=Fe;return n(),c("div",qc,[l("div",{class:x([i.carouselClass+" "+s.feed.type,"fcom_image_carousel__container"])},[(n(!0),c(P,null,R(i.visibleMedia,(f,h)=>(n(),c("div",{class:x(["fcom_carousel__image","fcom_media_type_"+f.type])},[f.type==="video"?(n(),c("div",Gc,[l("video",{style:{width:"100%","aspect-ratio":"16/9"},controls:"",preload:s.is_single?"":"none",poster:f.thumbnail},[l("source",{src:f.url,type:i.getVideoType(f.url)},null,8,Wc)],8,Yc)])):(n(),c("div",Zc,[a(m,{lazy:"",alt:"",src:f.url,"zoom-rate":1.2,"max-scale":7,"min-scale":.5,"hide-on-click-modal":!0,"preview-teleported":!0,"initial-index":f.index,"preview-src-list":i.srcList,"show-progress":"",fit:"cover"},null,8,["src","initial-index","preview-src-list"]),i.isOverflowSlot(h)?(n(),c("div",Kc,"+"+d(i.overflowCount),1)):_("",!0)]))],2))),256))],2)])}const Ut=I(zc,[["render",Jc]]),Qc={name:"ErrorIcon"},Xc={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 ed(e,t,s,u,o,i){return n(),c("svg",Xc,[...t[0]||(t[0]=[l("circle",{cx:"12",cy:"12",r:"10"},null,-1),l("line",{x1:"12",x2:"12",y1:"16",y2:"12"},null,-1),l("line",{x1:"12",x2:"12.01",y1:"8",y2:"8"},null,-1)])])}const uo=I(Qc,[["render",ed]]),td={name:"ReportReview",components:{ErrorIcon:uo},props:{feed:{type:Object,required:!0},type:{type:String,default:"post"}},emits:["updated"],methods:{openReportDetails(){this.$eventBus.emit("showReportReviewModal",{content:this.feed,type:this.type})},handleReportUpdate(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&this.$emit("updated",e.content)}},mounted(){this.$eventBus.on("updateModerationReport",this.handleReportUpdate)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.handleReportUpdate)}},sd={class:"fcom_feed_report_wrap"},od={class:"fcom_feed_report_content"},id={key:0},nd={key:1},ld={key:2},ad={class:"fcom_feed_report_action"};function rd(e,t,s,u,o,i){const m=p("ErrorIcon"),f=H;return n(),c("div",sd,[l("div",od,[a(m),s.feed.meta.auto_flagged=="yes"?(n(),c("span",id,d(e.$t("This %s has been flagged automatically by the site rule.",s.type)),1)):s.feed.meta.reports_count>1?(n(),c("span",nd,d(e.$t("This %1$s has been flagged with %2$s reports",s.type,s.feed.meta.reports_count)),1)):(n(),c("span",ld,d(e.$t("This %1$s has been flagged with %2$s report",s.type,s.feed.meta.reports_count)),1))]),l("div",ad,[a(f,{onClick:t[0]||(t[0]=h=>i.openReportDetails())},{default:r(()=>[M(d(e.$t("Review")),1)]),_:1})])])}const _o=I(td,[["render",rd]]),cd={name:"StickyIcon"},dd={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 ud(e,t,s,u,o,i){return n(),c("svg",dd,[...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 At=I(cd,[["render",ud]]),_d={name:"FeedMdContent",props:["content","class_name"],data(){return{hoverTimeout:null,lightboxImages:[],lightboxIndex:0}},watch:{content(){this.$nextTick(()=>{this.cleanupListeners(),this.setupListeners()})}},methods:{setupListeners(){const e=this.$refs.content;if(!e)return;const t=/\/u\/([^\/]+)\/?$/;e.querySelectorAll("a").forEach(s=>{const u=s.getAttribute("href"),o=(u==null?void 0:u.startsWith(this.appVars.portal_url))&&u.match(t);if(!o)return;const i=o[1];s._mentionEnter=()=>{clearTimeout(this.hoverTimeout),this.hoverTimeout=setTimeout(()=>{this.$eventBus.emit("show_mention_popover",{username:i,triggerElement:s})},500)},s._mentionLeave=()=>{clearTimeout(this.hoverTimeout),this.$eventBus.emit("hide_mention_popover")},s.addEventListener("mouseenter",s._mentionEnter),s.addEventListener("mouseleave",s._mentionLeave)}),this._clickHandler=s=>{var m;const u=s.target.closest('img[src^="http"]');if(u){s.preventDefault();const f=Array.from(e.querySelectorAll('img[src^="http"]')).map(h=>h.src);this.lightboxImages=f,this.lightboxIndex=Math.max(0,f.indexOf(u.src));return}const o=s.target.closest(".fcom_copy_code_btn");if(!o)return;s.stopPropagation();const i=(m=o.parentElement)==null?void 0:m.querySelector("pre");i&&this.$toClipboard((i.querySelector("code")||i).innerText,"Code copied")},e.addEventListener("click",this._clickHandler),e.querySelectorAll("pre").forEach(s=>{var o;if((o=s.parentElement)!=null&&o.classList.contains("fcom_code_wrap"))return;const u=document.createElement("div");u.className="fcom_code_wrap",u.innerHTML='<button class="fcom_copy_code_btn" title="'+this.$t("Copy code")+'"></button>',s.replaceWith(u),u.prepend(s)})},cleanupListeners(){const e=this.$refs.content;e&&(e.querySelectorAll("a").forEach(t=>{t._mentionEnter&&(t.removeEventListener("mouseenter",t._mentionEnter),t.removeEventListener("mouseleave",t._mentionLeave))}),this.$eventBus.emit("hide_mention_popover"),clearTimeout(this.hoverTimeout),this._clickHandler&&(e.removeEventListener("click",this._clickHandler),this._clickHandler=null),e.querySelectorAll(".fcom_copy_code_btn").forEach(t=>t.remove()))}},mounted(){this.$nextTick(()=>this.setupListeners())},beforeUnmount(){this.cleanupListeners()}},md=["innerHTML"];function hd(e,t,s,u,o,i){const m=Bs;return n(),c(P,null,[l("div",{ref:"content",class:x(["feed_md_content",s.class_name]),innerHTML:s.content},null,10,md),o.lightboxImages.length?(n(),y(m,{key:0,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,onClose:t[0]||(t[0]=f=>o.lightboxImages=[]),"show-progress":o.lightboxImages.length>1},null,8,["url-list","initial-index","show-progress"])):_("",!0)],64)}const Bt=I(_d,[["render",hd]]),fd=80,pd=20,gd=5e3,Dt={methods:{scrollCommentIntoView(e,t=null){var f;const s=this.$el instanceof Element?this.$el:(f=this.$el)==null?void 0:f.parentElement,u=(s==null?void 0:s.closest(".feed"))||document,o=h=>h&&u.querySelector("#comment_"+h),i=o(e)||o(t);if(!i)return;const m=i.querySelector(".comment_text")||i;m.classList.add("fcom_highlight_glow"),setTimeout(()=>m.classList.remove("fcom_highlight_glow"),gd),setTimeout(()=>{const h=i.getBoundingClientRect();h.top>=fd&&h.bottom<=window.innerHeight-pd||i.scrollIntoView({behavior:"smooth",block:"center"})},50)}}},yd={name:"SingleComment",mixins:[Dt],components:{ImageCarousel:Ut,FeedTextComposer:gt,MediaPreview:Oe,ReportReview:_o,StickyIcon:At,FeedMdContent:Bt,ActionPopover:pt},props:{comment:{type:Object,required:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},space_id:{type:String,default:null}},emits:["deleted","updated","reload","copyLink"],watch:{isEdit(e){e||(this.expanded=!1,this.canExpand=!1,this.$nextTick(()=>{this.checkOverflow(),this.canExpand&&(this.expanded=!0)}))}},mounted(){this.$nextTick(()=>this.checkOverflow())},data(){return{working:!1,isEdit:!1,editingComment:null,focusTrigger:0,expanded:!1,canExpand:!1}},computed:{contentClass(){return"comment_text_body"+(this.expanded?"":" clamped")},isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess()&&this.isReportEnabled&&this.show_report&&(this.comment.status=="pending"||((e=this.comment.meta)==null?void 0:e.reports_count))},showReportOption(){return!(this.comment.user_id==this.auth.user_id)&&this.auth.user_id&&this.isReportEnabled},showStickyOption(){return!this.comment.parent_id&&this.hasSpaceModeratorAccess()},getReportComment(){return{...this.comment,space_id:this.space_id}},commentActions(){const e=[{label:this.$t("Copy Link"),action:()=>this.copyCommentLink(this.comment)}];return this.showStickyOption&&e.push({label:this.comment.is_sticky?this.$t("Unpin from Top"):this.$t("Pin to Top"),action:()=>this.toggleSticky()}),this.showReportOption&&e.push({label:this.$t("Report Comment"),action:()=>this.reportComment(this.comment)}),this.canEditComment(this.comment)&&e.push({label:this.$t("Edit"),action:()=>this.editComment()}),this.canDeleteComment(this.comment)&&e.push({label:this.$t("Delete"),type:"danger",action:()=>this.deleteComment()}),e}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.updateComment()},deleteComment(){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.comment.post_id+"/comments/"+this.comment.id).then(e=>{this.$emit("deleted"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})})},editComment(){this.working=!0,this.$get(`comments/${this.comment.id}`,{context:"edit"}).then(e=>{this.editingComment=e.comment,this.isEdit=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1,this.$refs.comment_actions.hide()})},updateComment(){var t,s,u,o;const e=((t=this.editingComment.media_images)==null?void 0:t.length)>0||((u=(s=this.editingComment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);if(!((o=this.editingComment.message)!=null&&o.replace(/ |\u00A0/gi,"").trim())&&!e){this.$notify.error(this.$t("Comment cannot be empty")),this.focusTrigger++;return}this.working=!0,this.isEdit=!0,this.$post(`feeds/${this.comment.post_id}/comments/${this.comment.id}`,{comment:this.editingComment.message,media_images:this.editingComment.media_images,meta:this.editingComment.meta}).then(i=>{this.$notify.success((i==null?void 0:i.message)||this.$t("Comment updated successfully")),Object.assign(this.comment,i.comment),this.comment.media_images=[],this.isEdit=!1,this.$nextTick(()=>{this.scrollCommentIntoView(this.comment.id)})}).catch(i=>{this.$handleError(i),this.focusTrigger++}).finally(()=>{this.isEdit=!1,this.working=!1})},toggleSticky(){this.hasSpaceModeratorAccess()&&(this.working=!0,this.comment.is_sticky=!this.comment.is_sticky,this.$patch("feeds/"+this.comment.post_id+"/comments/"+this.comment.id,{is_sticky:this.comment.is_sticky?1:0}).then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},renderedComment(e){const s=/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]+)/.exec(e);if(s&&s[1]){let i=s[1];if(i){let m=`<div class="feed_media_ext_video"><iframe src="https://www.youtube.com/embed/${i}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;e+=m}}let u=window.location.origin,o=new RegExp(u,"g");return e=e.replace(/<a(.*?)href="(.*?)"(.*?)>/g,(i,m,f,h)=>f.match(o)?`<a${m}href="${f}"${h}>`:`<a${m}href="${f}" target="_blank"${h}>`),e},copyCommentLink(e){this.$emit("copyLink",e),this.$refs.comment_actions.hide()},reportComment(e){this.$refs.comment_actions.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:e,type:"comment"})},checkOverflow(){var t,s;if(this.expanded)return;const e=(s=(t=this.$refs.commentBody)==null?void 0:t.$refs)==null?void 0:s.content;e&&(this.canExpand=e.scrollHeight>e.clientHeight+1)},toggleExpand(){this.expanded=!this.expanded},reportUpdated(e){var t;e.status=="unpublished"?this.$emit("deleted"):(this.comment.status=e.status,this.comment.meta&&(this.comment.meta.reports_count=((t=e.meta)==null?void 0:t.reports_count)||0),this.$emit("updated"))}}},vd={key:1,class:"person_avatar"},bd={class:"comment_wrap"},kd={key:0,class:"comment_text"},wd={key:0,class:"comment_text_head"},Cd={class:"comment_text_head_name"},$d=["title"],Sd={key:0,class:"comment_text_head_status"},Vd={class:"comment_actions"},Md={key:2,class:"comment_text_media"},Td={key:3,class:"comment_text_media"};function Ld(e,t,s,u,o,i){const m=p("ReportReview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=Ue,k=p("StickyIcon"),b=O,w=H,S=p("MoreFilled"),C=p("ActionPopover"),v=p("FeedMdContent"),$=p("MediaPreview"),T=p("ImageCarousel"),V=p("feed-text-composer"),F=ee("loading");return n(),c(P,null,[i.showReport?(n(),y(m,{key:0,feed:i.getReportComment,type:"comment",onUpdated:i.reportUpdated},null,8,["feed","onUpdated"])):_("",!0),s.show_header&&s.comment.xprofile?(n(),c("div",vd,[a(f,{with_level:!1,xprofile:s.comment.xprofile,is_rounded:!0},null,8,["xprofile"])])):_("",!0),Y((n(),c("div",bd,[o.isEdit?(n(),c("div",{key:1,onKeydown:t[4]||(t[4]=ae((...L)=>i.maybeSave&&i.maybeSave(...L),["enter"])),class:"comment_text"},[a(V,{context:"comment",config:{multipleMedia:!0},placeholder:e.$t("Write a comment"),content:o.editingComment,autofocus:!0,autofocus_changed:o.focusTrigger},{default:r(()=>[l("div",null,[a(w,{onClick:t[2]||(t[2]=L=>o.isEdit=!1),class:"fcom_secondary_button"},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(w,{class:"fcom_primary_button",onClick:t[3]||(t[3]=L=>i.updateComment(o.editingComment))},{default:r(()=>[M(d(e.$t("Update")),1)]),_:1})])]),_:1},8,["placeholder","content","autofocus_changed"])],32)):(n(),c("div",kd,[s.show_header?(n(),c("div",wd,[l("div",Cd,[a(h,{show_badge:!0,xprofile:s.comment.xprofile,show_follow:!0},null,8,["xprofile"]),l("div",{title:s.comment.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(s.comment.created_at)),9,$d),s.comment.status=="pending"?(n(),c("div",Sd,[a(g,{type:"warning"},{default:r(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",Vd,[s.comment.is_sticky?(n(),y(w,{key:0,onClick:t[0]||(t[0]=L=>i.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(k)]),_:1},8,["title"])]),_:1},8,["aria-label"])):_("",!0),a(C,{ref:"comment_actions",items:i.commentActions,placement:"bottom",width:200},{trigger:r(()=>[a(w,{"aria-label":e.$t("View comment actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(S)]),_:1})]),_:1},8,["aria-label"])]),_:1},8,["items"])])])):_("",!0),a(v,{ref:"commentBody",class_name:i.contentClass,content:i.renderedComment(s.comment.message_rendered)},null,8,["class_name","content"]),o.canExpand?(n(),c("button",{key:1,type:"button",class:"fcom_see_more_btn",onClick:t[1]||(t[1]=(...L)=>i.toggleExpand&&i.toggleExpand(...L))},d(o.expanded?e.$t("See less"):e.$t("See more")),1)):_("",!0),s.comment.meta.media_preview?(n(),c("div",Md,[a($,{media_item:s.comment.meta.media_preview},null,8,["media_item"])])):s.comment.meta.media_items?(n(),c("div",Td,[s.comment.meta.media_items?(n(),y(T,{key:0,feed:s.comment},null,8,["feed"])):_("",!0)])):_("",!0)])),G(e.$slots,"after_comment_text")])),[[F,o.working]])],64)}const mo=I(yd,[["render",Ld]]);function K(e){return window.fluentComAdmin.i18n[e]||e}const ho={public:{label:K("Public"),description:K("__PUBLIC_SPACE_DESC"),space_description:K("__PIBLIC_SPACE_DESC_2")},private:{label:K("Private"),description:K("__PRIVATE_SPACE_DESC"),space_description:K("__PRIVATE_SPACE_DESC_2")},secret:{label:K("Secret"),description:K("Only invited members can view and post."),space_description:K("__SECRET_SPACE_DESC_2")}},Pd={public:{label:K("Public"),description:K("Anyone can view and enroll the course for free")},private:{label:K("Private"),description:K("__PRIVATE_COURSE_DESC")},secret:{label:K("Secret"),description:K("Only invited students can view and enroll the course content.")}},Fd={self_paced:{label:K("Self Paced"),description:K("__SELF_PAED_COURSE_DESC")},structured:{label:K("Structured"),description:K("__STRUCTURED_COURSE_DESC")},scheduled:{label:K("Scheduled"),description:K("Course starts on a specific date. Sections are dripped relative to that date.")}};K("Leaderboard Settings"),K("Settings for Leaderboard & Gamification features"),K("Get Leaderboard & Gamification Module"),K("Unlock potential by creating new feeds and earning points for likes. Advance in rank based on your total points using this module"),K("Emoji Module"),K("Settings for Emoji & Reaction features"),K("Get Emoji & Reaction Module"),K("Use emojis to add a personal touch and make your new article, post, or comment more expressive"),K("Giphy Module"),K("Customize Your Giphy Module Settings"),K("Get Giphy Module"),K("Want to use awesome GIFs? Upgrade to Pro plan now and enjoy surfing on FluentCommunity"),K("User Badge Module"),K("Add a badge next to user profile name to highlight valued users"),K("Get User Badge Module"),K("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."),K("Media Module"),K("Add a badge next to user profile name to highlight valued users"),K("Get Media Module"),K("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 Be=e=>{e=parseInt(e);const t=Object.values(window.fluentComAdmin.leaderboard_levels);if(!e)return t[0];for(let s=0;s<t.length;s++)if(e>=t[s].min_points&&e<=t[s].max_points)return t[s];return t[t-1]},Id={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),cs(t))return e;const s=this.appVars.socialLinkProviders;return s&&this.each(s,(o,i)=>{t[i]&&e.push({title:o.title,icon:o.icon_svg,url:o.domain+t[i]})}),e}}},Ed={key:0,class:"fcom_social_links"},Ud=["href","title"];function Ad(e,t,s,u,o,i){const m=O,f=p("router-link");return i.hasSocialLinks?(n(),c("div",Ed,[(n(!0),c(P,null,R(i.socialLinks,h=>(n(),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,Ud))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(f,{key:0,to:{name:"update_profile",params:{username:s.xprofile.username}}},{default:r(()=>[M(d("+ "+e.$t("Add social links")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)}const Rt=I(Id,[["render",Ad]]),Bd={name:"FollowAction",props:{profile:{type:Object,required:!0},followButtonText:{type:String,default:""}},emits:["refetch"],setup(){return{userStore:De()}},data(){return{loading:!1,hovering:!1}},watch:{profile:{immediate:!0,handler(e){e!=null&&e.user_id&&(e==null?void 0:e.follow)!==void 0&&this.userStore.setFollows({[e.user_id]:e.follow})}}},computed:{isFollowing(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isFollowing(this.profile.user_id):!1},showFollowAction(){var s;const e=(s=this.profile)==null?void 0:s.user_id,t=this.auth.user_id;return this.hasFeature("followers_module")&&e&&t&&e!=t},isBlocked(){var e;return(e=this.profile)!=null&&e.user_id?this.userStore.isBlocked(this.profile.user_id):!1},followBtnText(){var e;return this.followButtonText?this.followButtonText:(e=this.profile)!=null&&e.is_follower?this.$t("Follow Back"):this.$t("Follow")}},methods:{confirmUnfollow(){this.unfollowUser()},async followUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully followed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},async unfollowUser(){this.loading=!0;try{const e=await this.userStore.toggleFollow(this.profile.user_id,this.profile.username);this.$notify.success((e==null?void 0:e.message)||this.$t("Successfully unfollowed user")),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.loading=!1}},unblockUser(){this.loading=!0,this.$post("profile/"+this.profile.username+"/unblock").then(e=>{this.userStore.removeFollow(this.profile.user_id),this.$notify.success(e.message)}).finally(()=>{this.loading=!1})}}},Dd={key:0},Rd={key:1},xd={key:0},Hd={key:1};function Od(e,t,s,u,o,i){const m=H;return i.showFollowAction?(n(),c(P,{key:0},[i.isBlocked?(n(),y(m,{key:0,class:"fcom_secondary_button danger_button",loading:o.loading,disabled:o.loading,style:{"min-width":"90px","max-height":"30px"},onClick:i.unblockUser,onMouseenter:t[0]||(t[0]=f=>o.hovering=!0),onMouseleave:t[1]||(t[1]=f=>o.hovering=!1)},{default:r(()=>[o.hovering?(n(),c("span",Rd,d(e.$t("Unblock")),1)):(n(),c("span",Dd,d(e.$t("Blocked")),1))]),_:1},8,["loading","disabled","onClick"])):i.isFollowing?(n(),y(m,{key:1,onClick:i.confirmUnfollow,class:x(["fcom_secondary_button",{danger_button:o.hovering}]),style:{"min-width":"95px","max-height":"30px"},loading:o.loading,disabled:o.loading,onMouseenter:t[2]||(t[2]=f=>o.hovering=!0),onMouseleave:t[3]||(t[3]=f=>o.hovering=!1)},{default:r(()=>[o.hovering?(n(),c("span",Hd,d(e.$t("Unfollow")),1)):(n(),c("span",xd,d(e.$t("Following")),1))]),_:1},8,["onClick","class","loading","disabled"])):(n(),y(m,{key:2,onClick:i.followUser,class:"fcom_color_button",style:{"max-height":"30px"},loading:o.loading,disabled:o.loading},{default:r(()=>[l("span",null,d(i.followBtnText),1)]),_:1},8,["onClick","loading","disabled"]))],64)):_("",!0)}const it=I(Bd,[["render",Od]]),jd={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:Rt,FollowAction:it},data(){return{}},computed:{userLevel(){var e;return this.has_leaderboard&&((e=this.xprofile)!=null&&e.total_points)?Be(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)}},Nd=["href"],zd={class:"fcom_user_display_name"},qd={key:1,class:"user_route"},Gd=["href"],Yd={class:"fcom_user_display_name"},Wd={class:"fcom_profile_pop_avatar"},Zd={key:0,class:"fcom_prfile_tagline"},Kd={class:"fcom_level_name"},Jd={style:{display:"block"},class:"fcoml_level_sub meta_line"},Qd={class:"fcom_profile_pop_info"},Xd={class:"pop_info_header"},eu={class:"header_name"},tu=["href"],su={class:"fcom_user_display_name"},ou={class:"fcom_user_name"},iu={key:0,class:"header_actions"},nu={key:0,class:"fcom_profile_pop_bio"},lu=["title"],au=["title"],ru={class:"pop_info_btns"},cu=["href"],du=["href"];function uu(e,t,s,u,o,i){const m=p("verified-sign"),f=p("UserBadge"),h=p("UserAvatar"),g=ht,k=p("follow-action"),b=p("SocialLinks"),w=ft,S=ye;return s.show_pop?(n(),c("span",qd,[a(S,{ref:"popoverRef",visible:s.virtualRef?!0:null,"virtual-ref":s.virtualRef,"virtual-triggering":!!s.virtualRef,width:500,"show-after":s.virtualRef?0:500,trigger:s.virtualRef?null:"hover",onShow:i.initShow,onHide:i.onHide,persistent:!1,"popper-class":"fcom_profile_popper",placement:"top","popper-style":"padding: 0;"},{reference:r(()=>[G(e.$slots,"default",{},()=>[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",Yd,d(s.xprofile.display_name),1)],8,Gd)])]),default:r(()=>[l("div",{class:"fcom_profile_pop",onMouseenter:t[0]||(t[0]=C=>s.virtualRef&&e.$emit("popover-mouseenter")),onMouseleave:t[1]||(t[1]=C=>s.virtualRef&&e.$emit("popover-mouseleave"))},[s.xprofile&&s.xprofile.username?(n(),y(w,{key:0,gutter:20},{default:r(()=>[a(g,{sm:24,md:8},{default:r(()=>[l("div",Wd,[a(h,{xprofile:s.xprofile},null,8,["xprofile"]),i.userLevel?(n(),c("div",Zd,[l("div",Kd,d(i.userLevel.title),1),l("div",Jd,d(i.userLevel.tagline),1)])):_("",!0)])]),_:1}),a(g,{sm:24,md:16},{default:r(()=>{var C,v;return[l("div",Qd,[l("div",Xd,[l("div",eu,[l("a",{href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[l("p",su,d(s.xprofile.display_name),1),s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,tu),l("span",ou," @"+d(s.xprofile.username),1)]),s.show_follow?(n(),c("div",iu,[a(k,{profile:s.xprofile},null,8,["profile"])])):_("",!0)]),(C=s.xprofile.meta)!=null&&C.short_description_rendered||s.xprofile.short_description_rendered?(n(),c("div",nu,d(e.getExcerpt(((v=s.xprofile.meta)==null?void 0:v.short_description_rendered)||s.xprofile.short_description_rendered,160)),1)):_("",!0),s.xprofile.created_at?(n(),c("div",{key:1,title:s.xprofile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.xprofile.created_at))),9,lu)):_("",!0),s.xprofile.last_activity?(n(),c("div",{key:2,title:s.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.xprofile.last_activity))),9,au)):_("",!0),l("div",ru,[l("a",{class:"el-button el-button--primary is-text is-has-bg",href:e.$getRouteLink("u/:username",{username:s.xprofile.username})},d(e.$t("View Profile")),9,cu),e.appVars.has_chat&&e.hasPermission("can_initiate_message")?(n(),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:s.xprofile.user_id})},d(e.$t("Message")),9,du)):_("",!0)]),a(b,{style:{"justify-content":"left"},xprofile:s.xprofile,isOwn:!1},null,8,["xprofile"])])]}),_:1})]),_:1})):_("",!0)],32)]),_:3},8,["visible","virtual-ref","virtual-triggering","show-after","trigger","onShow","onHide"]),s.show_verified&&s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)])):(n(),c("a",{key:0,href:e.$getRouteLink("u/:username",{username:s.xprofile.username}),class:"user_route"},[G(e.$slots,"default",{},()=>[l("p",zd,d(s.xprofile.display_name),1)]),s.show_verified&&s.xprofile.is_verified?(n(),y(m,{key:0})):_("",!0),s.show_badge?(n(),y(f,{key:1,profile:s.xprofile},null,8,["profile"])):_("",!0)],8,Nd))}const Ie=I(jd,[["render",uu]]),_u={name:"CommentReacts",components:{UserRouteLink:Ie},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}))}}},mu={style:{"margin-left":"5px"}},hu={key:0},fu={key:1},pu={class:"fcom_user_lists"},gu={key:2};function yu(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=Ce,k=ye;return n(),y(k,{persistent:!1,placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav",onShow:i.getReactions},{reference:r(()=>[l("span",mu,d(s.comment.reactions_count),1)]),default:r(()=>[o.loading?(n(),c("div",hu,[a(m,{animated:!0,rows:1})])):o.reactions?(n(),c("div",fu,[a(g,{"max-height":"300px"},{default:r(()=>[l("ul",pu,[(n(!0),c(P,null,R(o.reactions,b=>(n(),c("li",null,[b.xprofile?(n(),c(P,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),c("div",gu,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const vu=I(_u,[["render",yu]]),bu={name:"NestedReplyBox",mixins:[Dt],components:{SingleComment:mo,FeedTextComposer:gt,CommentReactions:vu,HeartIcon:st},props:["comment","feed","checkPermission","show_reacts_only","defaultMentions","is_modal"],emits:["commented","copyLink"],data(){return{open:!1,composerOpen:!1,replyingToId:null,autofocusInput:!1,focusTick:0,composerKey:0,commentReply:{message:"",media_images:[]},submitting:!1}},computed:{canComment(){return this.hasCommentPermission(this.feed)||!this.checkPermission}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.addComment()},addComment(){var t,s,u;const e=((t=this.commentReply.media_images)==null?void 0:t.length)>0||((u=(s=this.commentReply.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.commentReply.message&&!e||!this.comment.id||(this.submitting=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.commentReply.message,parent_id:this.comment.id,media_images:this.commentReply.media_images,meta:this.commentReply.meta}).then(o=>{var i;this.comment.comments||(this.comment.comments=[]),this.commentReply={message:"",media_images:[]},(i=this.$refs.composer)==null||i.clearContent(),this.comment.comments.push(o.comment),Array.isArray(this.feed.comments)&&this.feed.comments.push(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id,this.comment.id)})}).catch(o=>{this.$handleError(o)}).finally(()=>{this.submitting=!1}))},toggleCommentBox(e,t=!0){var m;if(!this.hasCommentPermission(this.feed)){this.$notify({message:this.$t("Please join the Space to post a comment."),type:"warning"});return}const s=e==null?void 0:e.id,u=(m=e==null?void 0:e.xprofile)==null?void 0:m.username,o=t&&u&&e.user_id!=this.auth.user_id?u:"";if(!t){this.open=this.composerOpen=!this.open,this.replyingToId=null,this.autofocusInput=!1;return}if(this.composerOpen&&this.replyingToId===s){this.composerOpen=!1;return}const i=this.composerOpen;this.replyingToId=s,this.open=this.composerOpen=this.autofocusInput=!0,this.isComposerEmpty()?(this.commentReply.message=o?`@${o} `:"",i&&this.composerKey++):this.focusTick++},isComposerEmpty(){return!(this.commentReply.message||"").replace(/ |\u00A0/gi,"").trim()},handleCommentDelete(e){const t=this.comment.comments[e];this.comment.comments.splice(e,1),t!=null&&t.id&&Array.isArray(this.feed.comments)&&(this.feed.comments=this.feed.comments.filter(s=>s.id!==t.id)),this.feed.comments_count--},toggleLike(e){let t=!e.liked;this.$post("feeds/"+this.feed.id+"/comments/"+e.id+"/reactions",{state:t?1:0}).then(s=>{e.liked=s.liked,e.reactions_count=s.reactions_count}).catch(s=>{this.$handleError(s)})},emitCopyLink(e){this.$emit("copyLink",e)}}},ku={key:0,class:"reply_box"},wu=["aria-expanded"],Cu={class:"fcom_comments_react fcom_reaction_list"},$u={class:"child_comments"},Su=["id"],Vu={key:0,class:"reply_box"},Mu=["onClick","aria-expanded"],Tu={class:"fcom_comments_react fcom_reaction_list"},Lu={key:0,class:"child_reply_wrap"},Pu={class:"feed_commenting"},Fu={class:"person_avatar"},Iu=["alt","src"];function Eu(e,t,s,u,o,i){var w;const m=p("HeartIcon"),f=O,h=p("CommentReactions"),g=p("single-comment"),k=H,b=p("feed-text-composer");return n(),c(P,null,[i.canComment?(n(),c("div",ku,[((w=s.feed.meta)==null?void 0:w.comments_disabled)!=="yes"?(n(),c("button",{key:0,type:"button",onClick:t[0]||(t[0]=S=>i.toggleCommentBox(s.comment)),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===s.comment.id},d(e.$t("Reply")),9,wu)):_("",!0),l("span",{class:x([{fcom_is_liked:s.comment.liked},"reply_btn"])},[l("div",Cu,[a(f,{class:x({user_reacted:s.comment.liked}),onClick:t[1]||(t[1]=S=>i.toggleLike(s.comment))},{default:r(()=>[a(m,{filled:s.comment.liked},null,8,["filled"])]),_:1},8,["class"]),parseInt(s.comment.reactions_count)?(n(),y(h,{key:0,comment:s.comment},null,8,["comment"])):_("",!0)])],2),G(e.$slots,"after_reply_box_text",{toggleOpen:()=>i.toggleCommentBox(s.comment,!1),open:o.open})])):_("",!0),!s.show_reacts_only||o.open?(n(),c(P,{key:1},[l("div",$u,[(n(!0),c(P,null,R(s.comment.comments,(S,C)=>(n(),c("div",{id:"comment_"+S.id,class:"each_comment"},[a(g,{onCopyLink:i.emitCopyLink,onDeleted:v=>i.handleCommentDelete(C),comment:S,show_report:!0},{after_comment_text:r(()=>{var v;return[i.canComment?(n(),c("div",Vu,[((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),c("button",{key:0,type:"button",onClick:$=>i.toggleCommentBox(S),class:"reply_btn","aria-expanded":o.composerOpen&&o.replyingToId===S.id},d(e.$t("Reply")),9,Mu)):_("",!0),l("span",{class:x([{fcom_is_liked:S.liked},"reply_btn"])},[l("div",Tu,[a(f,{class:x({user_reacted:S.liked}),onClick:$=>i.toggleLike(S)},{default:r(()=>[a(m,{filled:S.liked},null,8,["filled"])]),_:2},1032,["class","onClick"]),parseInt(S.reactions_count)?(n(),y(h,{key:0,comment:S},null,8,["comment"])):_("",!0)])],2)])):_("",!0)]}),_:2},1032,["onCopyLink","onDeleted","comment"])],8,Su))),256))]),o.composerOpen?(n(),c("div",Lu,[l("div",Pu,[l("div",Fu,[l("img",{alt:e.$t("Your Photo"),src:e.auth.avatar},null,8,Iu)]),l("div",{onKeydown:t[3]||(t[3]=ae((...S)=>i.maybeSave&&i.maybeSave(...S),["enter"])),class:"feed_comment_input comment_text"},[(n(),y(b,{ref:"composer",key:o.composerKey,config:{multipleMedia:!0},context:"comment",is_modal:s.is_modal,defaultMentions:s.defaultMentions?s.defaultMentions:[],disabled:o.submitting,autofocus:o.autofocusInput,autofocus_changed:o.focusTick,mentionQuery:{space_id:s.feed.space_id},content:o.commentReply,placeholder:e.$t("Leave a reply")},{default:r(()=>[a(k,{loading:o.submitting,disabled:o.submitting,onClick:t[2]||(t[2]=S=>i.addComment()),class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Reply")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","defaultMentions","disabled","autofocus","autofocus_changed","mentionQuery","content","placeholder"]))],32)])])):_("",!0)],64)):_("",!0)],64)}const Uu=I(bu,[["render",Eu]]),Au={name:"FeedComments",components:{SingleComment:mo,NestedReplyBox:Uu},props:["feed","show_all","checkPermission","defaultMentions","sortBy","is_single","is_modal"],emits:["forceShowAll"],created(){this._lastSortBy=null,this._sortedTopLevelIds=null},data(){return{loading:!1}},computed:{_displayData(){const e=this.feed.comments;if(!e||!e.length)return{list:[],lastComment:null};const t={},s=[],u={};let o=null;for(let h=0;h<e.length;h++){const g=e[h];!o&&g.is_sticky&&(o=g),g.parent_id?(t[g.parent_id]||(t[g.parent_id]=[]),t[g.parent_id].push(g)):(s.push(g.id),u[g.id]=g)}for(const h of s)u[h].comments=t[h]||void 0;if(o&&u[o.id]){o=u[o.id];const h=s.indexOf(o.id);h!==-1&&s.splice(h,1),delete u[o.id]}const i=o||(s.length?u[s[s.length-1]]:null);if(!s.length&&!o)return{list:[],lastComment:null};const m=this.sortBy;if(this._lastSortBy!==m){let h=[...s];m==="oldest"||!m?h.sort((g,k)=>g-k):m==="latest"?h.sort((g,k)=>k-g):m==="popular"?h.sort((g,k)=>{var b,w;return(((b=u[k])==null?void 0:b.reactions_count)||0)-(((w=u[g])==null?void 0:w.reactions_count)||0)}):m==="most_replied"&&h.sort((g,k)=>{var b,w;return(((b=t[k])==null?void 0:b.length)||0)-(((w=t[g])==null?void 0:w.length)||0)}),this._sortedTopLevelIds=h,this._lastSortBy=m}let f;if(this._sortedTopLevelIds){const h=new Set(s),g=new Set(this._sortedTopLevelIds);f=this._sortedTopLevelIds.filter(k=>h.has(k)&&u[k]).map(k=>u[k]);for(let k=s.length-1;k>=0;k--)g.has(s[k])||f.unshift(u[s[k]])}else f=s.map(h=>u[h]);return o&&f.unshift(o),{list:f,lastComment:i}},displayComments(){return this._displayData.list},lastComment(){return this._displayData.lastComment}},methods:{fetchComments(){this.loading=!0,this.$get("feeds/"+this.feed.id+"/comments").then(e=>{this.feed.comments=e.comments}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},collectCommentIds(e){var u;const t=new Set([e.id]),s=e.comments?[...e.comments]:[];for(;s.length;){const o=s.pop();t.add(o.id),(u=o.comments)!=null&&u.length&&s.push(...o.comments)}return t},handleCommentDelete(e){const t=this.collectCommentIds(e);this.feed.comments=this.feed.comments.filter(s=>!t.has(s.id)),this.feed.comments_count-=t.size},handleStickyCommentDelete(){this.feed.sticky_comment=null,this.feed.comments_count--},copyCommentLink(e){let t={name:"single_feed",params:{feed_slug:this.feed.slug},query:{comment_id:e.id}};this.feed.course_id&&(t={name:"view_lesson",params:{lesson_slug:this.feed.slug},query:{comment_id:e.id}});let s=this.$router.resolve(t),u=this.appVars.urls.portal_base;u=u.replace(/\/$/,"");let o=u+s.fullPath;navigator.clipboard.writeText(o).then(()=>{this.$notify.success(this.$t("Link copied to clipboard"))}).catch(i=>{this.$notify.error(this.$t("Failed to copy the link"))})},maybeShowAllComments(){if(this.is_single||!this.hasFeature("show_post_modal")){this.$emit("forceShowAll");return}this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments"})}},mounted(){!this.feed.comments&&this.feed.comments_count&&this.fetchComments()}},Bu={key:0,class:"feed_comments"},Du=["id"],Ru={key:1,class:"feed_comments"},xu=["id"],Hu=["onClick","aria-expanded"];function Ou(e,t,s,u,o,i){const m=Z,f=p("nested-reply-box"),h=p("single-comment");return s.show_all?(n(),c("div",Bu,[o.loading?(n(),y(m,{key:0,row:5,class:"feed_comments_skeleton"})):(n(),c(P,{key:1},[G(e.$slots,"before_comments_start"),(n(!0),c(P,null,R(i.displayComments,(g,k)=>(n(),c("div",{class:"each_comment",key:g.id,id:"comment_"+g.id},[a(h,{comment:g,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onReload:i.fetchComments,onDeleted:b=>i.handleCommentDelete(g)},ve({_:2},[g.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{feed:s.feed,comment:g,checkPermission:s.checkPermission,defaultMentions:s.defaultMentions?s.defaultMentions:[],is_modal:s.is_modal,onCopyLink:i.copyCommentLink},null,8,["feed","comment","checkPermission","defaultMentions","is_modal","onCopyLink"])]),key:"0"}]),1032,["comment","space_id","onCopyLink","onReload","onDeleted"])],8,Du))),128))],64))])):i.lastComment?(n(),c("div",Ru,[l("div",{class:"each_comment",id:"comment_"+i.lastComment.id},[a(h,{comment:i.lastComment,space_id:s.feed.space_id,show_report:!0,onCopyLink:i.copyCommentLink,onDeleted:t[0]||(t[0]=g=>i.handleCommentDelete(i.lastComment))},ve({_:2},[i.lastComment.parent_id?void 0:{name:"after_comment_text",fn:r(()=>[a(f,{defaultMentions:s.defaultMentions?s.defaultMentions:[],onCopyLink:i.copyCommentLink,show_reacts_only:!0,checkPermission:s.checkPermission,feed:s.feed,comment:i.lastComment,is_modal:s.is_modal},{after_reply_box_text:r(({toggleOpen:g,open:k})=>[i.lastComment.comments&&i.lastComment.comments.length?(n(),c("button",{key:0,type:"button",onClick:b=>g(),class:"reply_btn last_comment_reply_txt","aria-expanded":k},d(e.$_n("%d reply","%d replies",i.lastComment.comments.length)),9,Hu)):_("",!0)]),_:1},8,["defaultMentions","onCopyLink","checkPermission","feed","comment","is_modal"])]),key:"0"}]),1032,["comment","space_id","onCopyLink"])],8,xu),s.feed.comments_count>1?(n(),c("div",{key:0,onClick:t[1]||(t[1]=g=>i.maybeShowAllComments()),class:"each_comment show_all_comments"},d(e.$t("View more comments")),1)):_("",!0)])):_("",!0)}const fo=I(Au,[["render",Ou]]);const ju={name:"ReactedUsers",components:{UserRouteLink:Ie},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,s=>{s.user_id!=t&&s.xprofile&&e.push({user_id:s.user_id,avatar:s.xprofile.avatar})}),e.slice(0,3)}},methods:{getReactions(){this.reactions&&this.reactions.length===this.feed.reactions_count||(this.loading=!0,this.$get("feeds/"+this.feed.id+"/reactions").then(e=>{this.reactions=e.reactions,e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.$nextTick(()=>{var t,s,u,o;(o=(u=(s=(t=this.$refs.reactedPopover)==null?void 0:t.popperRef)==null?void 0:s.popperInstanceRef)==null?void 0:u.update)==null||o.call(u)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1}))}}},Nu=["title"],zu={key:0,class:"reactions_avatars"},qu=["alt","src"],Gu={key:0},Yu={key:1},Wu={class:"fcom_user_lists"},Zu={key:2};function Ku(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=Ce,k=ye;return n(),y(k,{ref:"reactedPopover",persistent:!1,"popper-class":"fcom_feed_reacted_user_list",placement:"bottom",title:e.$t("Likes"),width:210,trigger:"click",onShow:i.getReactions},{reference:r(()=>[l("div",{title:e.$t("Click to view"),class:"fcom_reactions"},[i.reactedProfiles&&i.reactedProfiles.length?(n(),c("div",zu,[(n(!0),c(P,null,R(i.reactedProfiles,b=>(n(),c("span",{key:b.id,class:"fcom_reaction_avatar fcom_avatar_is_rounded fcom_user_avatar"},[b!=null&&b.avatar?(n(),c("img",{key:0,alt:e.$t("Reacted Users"),src:b.avatar},null,8,qu)):_("",!0)]))),128))])):_("",!0),l("span",null,d(e.$_n("%s like","%s likes",s.feed.reactions_count)),1)],8,Nu)]),default:r(()=>[o.loading?(n(),c("div",Gu,[a(m,{animated:!0,rows:3})])):o.reactions?(n(),c("div",Yu,[a(g,{"max-height":"300px"},{default:r(()=>[l("ul",Wu,[(n(!0),c(P,null,R(o.reactions,b=>(n(),c("li",null,[b.xprofile?(n(),c(P,{key:0},[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"]),a(h,{show_badge:!0,xprofile:b.xprofile,show_follow:!0},null,8,["xprofile"])],64)):_("",!0)]))),256))])]),_:1})])):(n(),c("div",Zu,[l("p",null,d(e.$t("Failed to load the list")),1)]))]),_:1},8,["title","onShow"])}const Ju=I(ju,[["render",Ku]]),Qu={name:"FeedFooter",mixins:[Dt],components:{ReactedUsers:Ju,FeedComments:fo,FeedTextComposer:gt,ChatIcon:tt,HeartIcon:st},props:["feed","is_single","space_slug","is_modal"],emits:["commented","joinSpace"],data(){return{commenting:!1,comment:{message:"",media_images:[]},saving:!1,show_all_comments:this.is_single,reactions:[],isAutoFocus:!1,showCommentBox:!0,defaultMentions:[],sortBy:"oldest"}},methods:{maybeSave(e){(e.metaKey||e.ctrlKey)&&e.keyCode===13&&this.postComment()},postComment(){this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(e=>{var t;this.feed.comments||(this.feed.comments=[]),this.feed.comments.push(e.comment),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.comment={message:"",media_images:[]},this.commenting=!1,(t=this.$refs.composer)==null||t.clearContent(),this.$notify.success(e.message),this.$nextTick(()=>{this.$emit("commented",e.comment),this.scrollCommentIntoView(e.comment.id)})}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})},showCommentForm(){if(!this.is_single&&this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=!0,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!0});return}this.show_all_comments=!0,this.commenting?(this.commenting=!1,setTimeout(()=>{this.commenting=!0,this.isAutoFocus=!0},100)):(this.commenting=!0,this.isAutoFocus=!0),this.prepareDefaultMentions()},showAll(){this.show_all_comments=!this.show_all_comments,this.commenting=!this.commenting,this.isAutoFocus=!1,this.prepareDefaultMentions()},maybeShowFeedModal(){if(this.is_single){this.showAll();return}if(!this.hasFeature("show_post_modal")){this.showAll();return}this.feed.auto_focus_comment=!1,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:"comments",auto_focus_comment:!1})},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0);let t=!this.feed.has_user_react;this.$post("feeds/"+this.feed.id+"/react",e).then(s=>{this.feed.has_user_react=t,this.feed.reactions_count=s.new_count}).catch(s=>{this.$handleError(s)})},prepareDefaultMentions(){if(!this.auth.user_id||this.defaultMentions.length)return;let e=this.auth.user_id,t=[];this.feed.user_id!=e&&t.push(this.feed.xprofile);let s=this.feed.comments.slice(-30);this.each(s,u=>{u.user_id!=e&&t.push(u.xprofile)}),this.defaultMentions=on(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)}},Xu={ref:"feed_footer",class:"feed_footer"},e_={class:"fcom_feed_footer_actions"},t_={class:"fcom_sr_only"},s_={class:"fcom_feed_footer_meta"},o_={key:0},i_={key:0,class:"fcom_reactions_count feed_reaction_meta"},n_={class:"feed_comment_count"},l_={key:2,class:"feed_reaction_meta"},a_={key:0,ref:"fcom_comment_sorting",class:"fcom_comment_sorting"},r_=["id"],c_={key:0,style:{padding:"0",margin:"0","text-align":"center"}},d_={key:1,class:"feed_commenting"},u_={class:"person_avatar"},__=["src"],m_={key:2,class:""},h_={style:{padding:"0",margin:"0","text-align":"center"}},f_={key:0,style:{margin:"10px 0"}},p_=["href"];function g_(e,t,s,u,o,i){var v,$,T,V;const m=p("HeartIcon"),f=O,h=p("ChatIcon"),g=p("ReactedUsers"),k=ie,b=ne,w=p("feed-comments"),S=H,C=p("feed-text-composer");return n(),c(P,null,[l("div",Xu,[l("div",e_,[l("ul",null,[l("li",{class:x(["fcom_reaction fcom_reaction_list",{react_active:s.feed.has_user_react}]),onClick:t[0]||(t[0]=F=>i.toggleReact())},[a(f,{class:x({user_reacted:s.feed.has_user_react})},{default:r(()=>[a(m,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"])],2),((v=s.feed.meta)==null?void 0:v.comments_disabled)!=="yes"?(n(),c("li",{key:0,class:"fcom_comment_btn_wrap",onClick:t[1]||(t[1]=F=>i.showCommentForm())},[a(f,null,{default:r(()=>[a(h)]),_:1}),l("span",null,[l("span",t_,d(e.$t("Comment")),1)])])):_("",!0)])]),l("div",s_,[s.feed.reactions_count||s.feed.comments_count||(($=s.feed.meta)==null?void 0:$.comments_disabled)==="yes"?(n(),c("ul",o_,[s.feed.reactions_count?(n(),c("li",i_,[a(g,{feed:s.feed},null,8,["feed"])])):_("",!0),s.feed.comments_count>0?(n(),c("li",{key:1,onClick:t[2]||(t[2]=(...F)=>i.maybeShowFeedModal&&i.maybeShowFeedModal(...F)),class:"feed_reaction_meta"},[l("div",n_,d(e.$_n("%d comment","%d comments",s.feed.comments_count)),1)])):((T=s.feed.meta)==null?void 0:T.comments_disabled)==="yes"?(n(),c("li",l_,d(e.$t("comments disabled")),1)):_("",!0)])):_("",!0)])],512),a(w,{sortBy:o.sortBy,defaultMentions:o.defaultMentions,onForceShowAll:i.showAll,show_all:o.show_all_comments,feed:s.feed,is_single:s.is_single,is_modal:s.is_modal},{before_comments_start:r(()=>[s.feed.comments_count>=2?(n(),c("div",a_,[a(b,{"aria-label":e.$t("Sort comments by"),onChange:t[3]||(t[3]=F=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[4]||(t[4]=F=>o.sortBy=F),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(k,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(k,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(k,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(k,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])],512)):_("",!0)]),_:1},8,["sortBy","defaultMentions","onForceShowAll","show_all","feed","is_single","is_modal"]),o.commenting||s.is_single?(n(),c("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment feed_commentbox_main"},[((V=s.feed.meta)==null?void 0:V.comments_disabled)==="yes"?(n(),c(P,{key:0},[s.feed.comments_count?(n(),c("p",c_,d(e.$t("Comments are disabled for this post.")),1)):_("",!0)],64)):e.hasCommentPermission(s.feed)?(n(),c("div",d_,[l("div",u_,[l("img",{alt:"",src:e.auth.photo},null,8,__)]),o.showCommentBox?(n(),c("div",{key:0,onKeydown:t[6]||(t[6]=ae((...F)=>i.maybeSave&&i.maybeSave(...F),["enter"])),class:"feed_comment_input"},[a(C,{ref:"composer",context:"comment",is_modal:s.is_modal,config:{multipleMedia:!0},mentionQuery:{space_id:s.feed.space_id},autofocus_changed:o.commenting,defaultMentions:o.defaultMentions,autofocus:o.isAutoFocus,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:r(()=>[a(S,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",onClick:t[5]||(t[5]=F=>i.postComment())},{default:r(()=>[M(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["is_modal","mentionQuery","autofocus_changed","defaultMentions","autofocus","disabled","placeholder","content"])],32)):_("",!0)])):(n(),c("div",m_,[l("p",h_,[M(d(e.$t("Please join the Space to post a comment."))+" ",1),e.appVars.auth.user_id?(n(),c("div",f_,[a(S,{class:"fcom_primary_button",onClick:t[7]||(t[7]=()=>{e.$emit("joinSpace")})},{default:r(()=>[M(d(e.$t("Join Space")),1)]),_:1})])):(n(),c("a",{key:1,href:e.getCurrentAuthUrl()},d(e.appVars.allow_signup?e.$t("Login / Signup"):e.$t("Login")),9,p_))])]))],8,r_)):_("",!0)],64)}const y_=I(Qu,[["render",g_]]),v_={name:"SpaceIcon",props:["space_profile"]},b_=["alt","src"],k_={key:1,class:"fcom_emoji"},w_={key:2,class:"fcom_shape"},C_={key:3,class:"fcom_no_avatar"};function $_(e,t,s,u,o,i){var f,h,g,k;const m=O;return s.space_profile.logo?(n(),c("img",{key:0,alt:e.$t("Space Logo"),src:s.space_profile.logo},null,8,b_)):(f=s.space_profile.settings)!=null&&f.emoji?(n(),c("span",k_,d((h=s.space_profile.settings)==null?void 0:h.emoji),1)):(g=s.space_profile.settings)!=null&&g.shape_svg?(n(),c("span",w_,[a(m,{innerHTML:(k=s.space_profile.settings)==null?void 0:k.shape_svg},null,8,["innerHTML"])])):(n(),c("span",C_))}const Ye=I(v_,[["render",$_]]);const S_={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)}}},V_=["value","maxlength","placeholder"];function M_(e,t,s,u,o,i){return n(),c("textarea",{value:s.modelValue,onInput:t[0]||(t[0]=(...m)=>i.onInput&&i.onInput(...m)),onKeydown:t[1]||(t[1]=ae(z(m=>e.$emit("enter"),["prevent"]),["enter"])),ref:"textarea",maxlength:s.maxlength,class:"fcom_status_title_input",rows:"1",placeholder:s.placeholder},null,40,V_)}const T_=I(S_,[["render",M_]]),L_={name:"EyeIcon"},P_={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function F_(e,t,s,u,o,i){return n(),c("svg",P_,[...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 I_=I(L_,[["render",F_]]),E_={name:"CalendarIcon"},U_={width:"14",height:"16",viewBox:"0 0 14 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function A_(e,t,s,u,o,i){return n(),c("svg",U_,[...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 po=I(E_,[["render",A_]]);const B_={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:Ye,FeedTextComposer:gt,SingleLineTextarea:T_,EyeIcon:I_,CalendarIcon:po},data(){return{feed:this.editing_feed,isAutoFocus:!1,state:this.defaultState,posting:!1,doingOembed:!1,oembed:null,postableSpaces:[],autofocus_changed:!1,globalDisabled:this.appVars.features.disable_global_posts,hasPostTitle:this.hasFeature("has_post_title"),scheduleModalVisible:!1,scheduleForm:{date:null,time:null},editorReady:!1}},watch:{"scheduleForm.date":{handler(e){this.scheduleForm.time=null}}},computed:{...oi(Ne,["spacesBySlug"]),allSpaces(){return this.space&&this.spacesBySlug[this.space]?{...this.appVars.auth.spaces,[this.space]:this.spacesBySlug[this.space]}:this.appVars.auth.spaces},isEditing(){var e;return(e=this.editing_feed)==null?void 0:e.id},isScheduleDisabled(){return!this.scheduleForm.date||!this.scheduleForm.time},showScheduleInfo(){return this.feed.scheduled_at&&!this.isEditing},showScheduleIcon(){return(this.isAdmin()||this.isCurrentSpaceAdmin)&&!this.isEditing&&this.has_pro},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getPlaceholder(){const e=this.appVars.topicsConfig.max_topics_per_post;return this.isTopicRequired?this.$_n("Select a topic","Choose up to %s topics",e):this.$_n("Select a topic","Choose up to %s topics (optional)",e)},getButtonLabel(){return this.feed.scheduled_at&&!this.isEditing?this.$t("Schedule"):this.btn_text},getScheduleLabel(){return this.$t("Scheduled for %1$s at %2$s",this.formattedDate(this.feed.scheduled_at),this.formattedTime(this.feed.scheduled_at))},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u},getPostTitle(){return this.isEditing?this.author.name||"":this.$t("Create Post")},canPost(){var e,t;return this.space?(t=(e=this.allSpaces[this.space])==null?void 0:e.permissions)==null?void 0:t.can_create_post:this.appVars.auth.user_id},isTopicRequired(){var e,t;return this.currentSpaceSlug?((t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.settings)==null?void 0:t.topic_required)=="yes":!1},isStateActive(){return this.state=="active"},isCurrentSpaceAdmin(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.community_moderator:!1},isCommunityAdmin(){return this.isAdmin()},currentPlaceHolder(){return this.isStateActive?this.default_placeholder?this.default_placeholder:this.$t("Write something here..."):this.initial_placeholder?this.initial_placeholder:this.$t("What's happening, %s",this.auth.first_name)},currentTopics(){var s;let e=this.currentSpaceSlug;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},canUploadDoc(){var e,t;return this.currentSpaceSlug?(t=(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.permissions)==null?void 0:t.can_upload_documents:!1},currentSpaceSlug(){if(this.space)return this.space;let e=this.feed.space;return e&&typeof e=="object"?e==null?void 0:e.slug:e},currentSpaceId(){var e;return this.currentSpaceSlug?(e=this.allSpaces[this.currentSpaceSlug])==null?void 0:e.id:null},feedContext(){const e=this.space||this.currentSpaceSlug;return e&&e!=="__self__post__"?`space-${e}`:"global"}},methods:{...zs(Te,["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}const e=this.convertTo24Hour(this.scheduleForm.time);this.feed.scheduled_at=`${this.scheduleForm.date} ${e}:00`},post(){if(!this.isStateActive)return;if(this.feed.id){this.$emit("updatePost",this.feed);return}const e=this.feed;if(this.space&&(e.space=this.space),!e.space){this.$refs.fcom_posting_space.classList.add("fcon_shake"),setTimeout(()=>{this.$refs.fcom_posting_space.classList.remove("fcon_shake")},500),this.$notify({title:this.$t("Error"),message:this.$t("Please select a space to post in."),type:"error"});return}if(e.space!="__self__post__"&&e.send_announcement_email=="yes"){let t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space after 5 minutes of this post");e.scheduled_at&&(t=this.$t("Are you sure you want to send email to everyone? An automated email will be sent to all the members of the space. The email will be sent at the scheduled time.")),this.$confirm(t,this.$t("Sending email to all members?"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("No"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.postStatus(e)}).catch(()=>{this.feed.send_announcement_email="no",this.state="active",this.$notify({title:this.$t("Cancelled"),message:this.$t("You have cancelled the action."),type:"info"})})}else this.postStatus(e)},feedSpaceChanged(){this.$refs.fcom_posting_space_select.blur(),this.feed.topic_ids=""},async postStatus(e){var t;this.posting=!0;try{const u=await Te().createFeed(this.feedContext,e);if(u.scheduled_at||(this.$notify.success(u.message),this.$emit("added",u.feed),this.$nextTick(()=>{const o=document.getElementById("feed_id_"+u.feed.id);o&&(o.classList.add("fcom_highlight_glow"),setTimeout(()=>{o.classList.remove("fcom_highlight_glow")},4500))})),this.feed=this.initFeed(),this.state="idle",u.scheduled_at){const o=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",o))}this.editorReady=!1}catch(s){this.$handleError(s),(t=s==null?void 0:s.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,s=[],u=[];this.each(t,f=>{let h=e.filter(g=>{let k=g.parent_id==f.id&&g.permissions&&g.permissions.can_create_post;return k&&u.push(g.slug),k});h.length&&s.push({label:f.title,spaces:h})});let o=e.filter(f=>!f.parent_id&&f.permissions&&f.permissions.can_create_post);o&&o.length&&s.push({label:this.$t("Others"),spaces:o}),this.globalDisabled||s.unshift({label:"",spaces:[{title:this.$t("On my profile"),slug:"__self__post__"}]}),this.postableSpaces=s;const i=this.appVars.default_post_space;!this.feed.space&&i&&["all_feeds","user_profile_feeds"].includes((m=this.$route)==null?void 0:m.name)&&this.postableSpaces.some(f=>f.spaces.some(h=>h.slug===i))&&(this.feed.space=i)}},mounted(){(this.editing_feed.id||this.defaultState=="active")&&(this.editorReady=!0)}},D_={class:"person_avatar"},R_=["alt","src"],x_={class:"create_header_content"},H_={key:0,class:"fcom_create_status_box_header"},O_={class:"user_infos"},j_={class:"feed_user_name"},N_={class:"feed_meta_info"},z_={key:1,class:"feed_timestamp"},q_={class:"create_header_action"},G_={key:0,ref:"fcom_topics_input",class:"fcom_topics_input"},Y_={style:{margin:"0",display:"block",width:"100%",padding:"5px 0","font-weight":"500"}},W_={key:0,class:"fcom_meta_text"},Z_={class:"fcom_post_actions"},K_={key:0,class:"fcom_post_space_name"},J_={class:"target_label"},Q_={ref:"fcom_posting_space",style:{"margin-right":"10px"}},X_={key:0,class:"fcom_space_title"},em={key:1},tm={class:"fcom_empty_spaces_dropdown"},sm={key:0,class:"fcom_composer_admin_actions"},om={key:0},im={class:"dialog_header"},nm={class:"dialog_left schedule_header_left"},lm={class:"dialog_body"},am={class:"fcom_input_help"},rm={class:"dialog_footer"};function cm(e,t,s,u,o,i){const m=p("EditPen"),f=O,h=p("CalendarIcon"),g=H,k=p("EyeIcon"),b=p("Close"),w=p("SingleLineTextarea"),S=ie,C=ne,v=p("SpaceIcon"),$=$t,T=fe,V=p("feed-text-composer"),F=Ke,L=ue,A=Ds,D=_e,U=we;return i.canPost?(n(),c("div",{key:0,class:x([{state_active:i.isStateActive},"create_status_holder"])},[l("div",{class:x(["create_header",{state_active:i.isStateActive}])},[l("div",D_,[l("img",{alt:s.author.name||e.$t("Your Photo"),src:s.author.avatar||e.auth.avatar},null,8,R_)]),l("div",x_,[i.isStateActive?_("",!0):(n(),c("div",{key:0,onClick:t[0]||(t[0]=(...E)=>i.makeActive&&i.makeActive(...E)),class:"form_placeholder"},d(i.currentPlaceHolder),1)),l("div",{class:x([{fcom_editor_with_title:o.hasPostTitle,"is-active":i.isStateActive},"fcom_create_status_box"])},[i.isStateActive?(n(),c("div",H_,[l("div",O_,[l("div",j_,d(i.getPostTitle),1),l("div",N_,[!s.editing_feed.id&&i.showScheduleInfo?(n(),c("div",{key:0,onClick:t[1]||(t[1]=(...E)=>i.openScheduleModal&&i.openScheduleModal(...E)),class:"feed_scheduled_info"},[l("span",null,d(i.getScheduleLabel),1),a(f,null,{default:r(()=>[a(m)]),_:1})])):(n(),c("span",z_,d(s.editing_feed.id?e.humanDateDiff(s.editing_feed.created_at):e.dayjs().format(e.siteDateTimeFormat)),1))])]),l("div",q_,[i.showScheduleIcon?(n(),y(g,{key:0,onClick:i.openScheduleModal,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0),a(g,{onClick:i.previewPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["onClick"]),i.isEditing?_("",!0):(n(),y(g,{key:1,class:"close_btn",onClick:i.cancelPost,text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"]))])])):_("",!0),o.editorReady?(n(),y(V,{key:1,context:"feed",placeholder:i.currentPlaceHolder,config:{surveyApp:!0,space_id:i.currentSpaceId,is_admin:i.isCurrentSpaceAdmin||i.isCommunityAdmin,spaceSlug:i.currentSpaceSlug,disableUpload:s.disableUpload,multipleMedia:!0,documentsApp:i.canUploadDoc,videoApp:!0},autofocus:o.isAutoFocus||!o.hasPostTitle,onEditorCreated:t[9]||(t[9]=()=>{o.isAutoFocus=!0}),mentionQuery:i.currentSpaceSlug&&i.currentSpaceSlug!=="__self__post__"?{space:i.currentSpaceSlug}:{},disabled:o.posting,autofocus_changed:o.autofocus_changed,is_editing:!!i.isEditing,content:o.feed},{before_input:r(()=>[o.hasPostTitle?(n(),y(w,{key:0,maxlength:120,autofocus:!0,isActive:i.isStateActive,modelValue:o.feed.title,"onUpdate:modelValue":t[2]||(t[2]=E=>o.feed.title=E),onEnter:t[3]||(t[3]=E=>i.changeAutoFocus()),placeholder:o.hasPostTitle=="required"?e.$t("Short title of this post"):e.$t("Title (optional)")},null,8,["isActive","modelValue","placeholder"])):_("",!0)]),before_composer_footer:r(()=>[G(e.$slots,"before_footer")]),after_input:r(()=>[e.has_pro&&i.currentTopics.length?(n(),c("div",G_,[a(C,{"popper-class":"fcom_topics_select","multiple-limit":e.appVars.topicsConfig.max_topics_per_post,modelValue:o.feed.topic_ids,"onUpdate:modelValue":t[4]||(t[4]=E=>o.feed.topic_ids=E),multiple:e.appVars.topicsConfig.max_topics_per_post>1,placeholder:i.getPlaceholder},{default:r(()=>[(n(!0),c(P,null,R(i.currentTopics,E=>(n(),y(S,{key:E.slug,label:E.title,value:E.id},{default:r(()=>[l("span",Y_,d(E.title),1),E.description?(n(),c("span",W_,d(E.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")&&i.isCurrentSpaceAdmin&&o.feed.send_announcement_email?(n(),c("div",sm,[a(T,{disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.feed.send_announcement_email,"onUpdate:modelValue":t[8]||(t[8]=E=>o.feed.send_announcement_email=E),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Send announcement email to space members"))+" ",1),e.has_pro?_("",!0):(n(),c("span",om,"("+d(e.$t("Require Pro"))+")",1))]),_:1},8,["disabled","modelValue"])])):_("",!0)]),default:r(()=>[l("div",Z_,[s.space&&i.isStateActive?(n(),c("div",K_,[l("span",null,"#"+d(s.space),1)])):_("",!0),!s.space&&!s.disableSpace?(n(),c(P,{key:1},[l("span",J_,d(e.$t("Posting in:")),1),l("span",Q_,[a(C,{modelValue:o.feed.space,"onUpdate:modelValue":t[5]||(t[5]=E=>o.feed.space=E),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]=E=>i.feedSpaceChanged())},{empty:r(()=>[l("p",tm,d(Object.keys(i.allSpaces).length?e.$t("No spaces to post in"):e.$t("Join a space to post")),1)]),default:r(()=>[(n(!0),c(P,null,R(o.postableSpaces,E=>(n(),y($,{key:E.label,label:E.label},{default:r(()=>[(n(!0),c(P,null,R(E.spaces,q=>(n(),y(S,{key:q.slug,label:q.title,value:q.slug},{default:r(()=>[q.id?(n(),c("span",X_,[a(v,{space_profile:q},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(q.title,30)),1)])):(n(),c("span",em,d(e.getExcerpt(q.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])],512)],64)):_("",!0),G(e.$slots,"before_submit_btn"),a(g,{onClick:t[7]||(t[7]=E=>i.post()),disabled:o.posting||i.isEditing&&s.saving,loading:i.isEditing?s.saving:o.posting,class:x(["fcom_primary_button",{fcom_update_button:i.isEditing}])},{default:r(()=>[M(d(i.getButtonLabel),1)]),_:1},8,["disabled","loading","class"])])]),_:3},8,["placeholder","config","autofocus","mentionQuery","disabled","autofocus_changed","is_editing","content"])):_("",!0),G(e.$slots,"after_composer")],2)])],2),a(U,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[12]||(t[12]=E=>o.scheduleModalVisible=E),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1},{header:r(()=>[l("div",im,[l("div",nm,[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",rm,[a(g,{class:"fcom_secondary_button",onClick:i.cancelSchedule},{default:r(()=>[M(d(e.$t("Remove Schedule")),1)]),_:1},8,["onClick"]),a(g,{class:"fcom_primary_button",disabled:i.isScheduleDisabled,onClick:i.schedulePost},{default:r(()=>[M(d(e.$t("Select Schedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",lm,[a(D,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(L,{label:e.$t("Date")},{default:r(()=>[a(F,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[10]||(t[10]=E=>o.scheduleForm.date=E),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(L,{label:e.$t("Time")},{default:r(()=>[a(A,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[11]||(t[11]=E=>o.scheduleForm.time=E),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1}),a(L,null,{default:r(()=>[l("p",am,d(e.$t("The date and time is based on your site's Timezone")),1)]),_:1})])]),_:1},8,["modelValue","width"])],2)):_("",!0)}const xt=I(B_,[["render",cm]]),dm={name:"EditFeed",components:{SpaceIcon:Ye,CreateStatusForm:xt},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 s;let t={id:e.id,title:e.title,message:e.message,space:(s=e==null?void 0:e.space)==null?void 0:s.slug,meta:e.meta,content_type:e.content_type,document_ids:e.document_ids,media:e.media,media_images:e.media_images,survey:e.survey,topic_ids:e.topic_ids,send_announcement_email:e.send_announcement_email};this.changeSpace&&this.newSpaceId&&(this.newSpaceId==="profile"?t.move_to_profile=1:t.new_space_id=this.newSpaceId),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()}},um={class:"fcom_feed_edit"},_m={class:"fcom_feed_edit_dialog_header"},mm={key:0,class:"fcom_feed_edit_dialog_body"},hm={key:0},fm={key:0,style:{"margin-top":"5px"}},pm={class:"fcom_space_title"};function gm(e,t,s,u,o,i){const m=p("Close"),f=O,h=fe,g=ie,k=p("SpaceIcon"),b=ne,w=p("create-status-form"),S=Z,C=we,v=ee("loading");return n(),c("div",um,[a(C,{class:"fcom_feed_edit_dialog",modelValue:o.localDialogVisible,"onUpdate:modelValue":t[3]||(t[3]=$=>o.localDialogVisible=$),width:e.dialogWidth,"append-to-body":!0,overflow:"","before-close":()=>{},"show-close":!1},{default:r(()=>{var $,T;return[Y((n(),c("div",null,[l("div",_m,[l("span",null,d(e.$t("Edit Feed")),1),a(f,{onClick:i.handleClose},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),o.feed.id?(n(),c("div",mm,[!(s.hide_create_form&&e.auth.user_id)||e.canEditFeed(o.feed)?(n(),y(w,{key:0,"default-state":"active",btn_text:e.$t("Update"),editing_feed:o.feed,author:s.author,onUpdatePost:i.handleUpdatePost,saving:o.saving,disableSpace:!0,space:(T=($=o.feed)==null?void 0:$.space)==null?void 0:T.slug},{after_composer:r(()=>[i.canMovePost?(n(),c("div",hm,[a(h,{modelValue:o.changeSpace,"onUpdate:modelValue":t[0]||(t[0]=V=>o.changeSpace=V),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Move to a different space")),1)]),_:1},8,["modelValue"]),o.changeSpace?(n(),c("div",fm,[a(b,{modelValue:o.newSpaceId,"onUpdate:modelValue":t[1]||(t[1]=V=>o.newSpaceId=V),placeholder:e.$t("Select destination"),style:{width:"100%"}},{default:r(()=>[a(g,{value:"profile",label:i.profileOptionLabel,disabled:!o.feed.space_id},{default:r(()=>[l("span",null,d(i.profileOptionLabel),1)]),_:1},8,["label","disabled"]),(n(!0),c(P,null,R(e.appVars.auth.spaces,V=>(n(),y(g,{disabled:o.feed.space_id==V.id,key:V.id,label:V.title,value:V.id},{default:r(()=>[l("span",pm,[a(k,{space_profile:V},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(V.title,30)),1)])]),_:2},1032,["disabled","label","value"]))),128))]),_:1},8,["modelValue","placeholder"])])):_("",!0)])):_("",!0)]),before_submit_btn:r(()=>[o.feed.status=="unlisted"?(n(),y(h,{key:0,modelValue:o.makePublish,"onUpdate:modelValue":t[2]||(t[2]=V=>o.makePublish=V),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])):_("",!0)]),_:1},8,["btn_text","editing_feed","author","onUpdatePost","saving","space"])):_("",!0)])):(n(),y(S,{key:1,rows:5,animated:!0}))])),[[v,o.loading]])]}),_:1},8,["modelValue","width"])])}const hs=I(dm,[["render",gm]]),ym={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=Be(this.xprofile.total_points);return e?e.level:0},withCompletion(){var s;if(!this.with_completion||!((s=this.xprofile)!=null&&s.total_points))return!1;const e=Be(this.xprofile.total_points),t=Be(e.max_points+1);return e.level!==t.level},getOutlineStyle(){if(!this.withCompletion)return{};const e=Be(this.xprofile.total_points),t=Be(e.max_points+1),s=this.xprofile.total_points-e.min_points,u=t.min_points-e.min_points,i=s/u*100/100*360;return{backgroundImage:`conic-gradient(rgb(56, 117, 223) ${i}deg, #D9D9D9 ${i}deg)`}}},methods:{setAltImg(e){e.target.src=this.appVars.assets_url+"images/placeholder.png"}}},vm=["src"],bm={key:1,class:"fcom_no_image"},km={key:0,role:"region","aria-label":"User Level",class:"fcom_user_level_mark"};function wm(e,t,s,u,o,i){return n(),c("div",{class:x([{fcom_avatar_is_rounded:s.is_rounded,is_member_online:s.is_online},"fcom_user_avatar"])},[l("span",{style:re(i.getOutlineStyle),class:x({fcom_compilation_avatar:i.withCompletion})},[s.xprofile?(n(),c("img",{key:0,onError:t[0]||(t[0]=(...m)=>i.setAltImg&&i.setAltImg(...m)),src:s.xprofile.avatar,alt:""},null,40,vm)):(n(),c("span",bm))],6),i.level||s.is_online?(n(),c("div",km,[l("span",null,d(i.level),1)])):_("",!0)],2)}const fs=I(ym,[["render",wm]]),Cm={name:"SurveyVoters",props:["feed","option","options","totalCount"],components:{UserRouteLink:Ie,UserAvatar:fs},data(){return{voters:[],loading:!1,showVotersDialog:!0,cache:{},requestId:0}},watch:{option(){this.loadVoters()}},computed:{getVotePercentage(){return this.option.vote_counts?Math.floor(this.option.vote_counts/this.totalCount*100)+"%":"0%"}},methods:{switchOption(e){this.$emit("updateOption",e)},closeDialog(){this.showVotersDialog=!1,this.$emit("close")},loadVoters(){var u;const e=(u=this.option)==null?void 0:u.slug;if(!e)return;const t=++this.requestId,s=this.cache[e];s&&(this.voters=s),this.loading=!s,this.$get(`feeds/${this.feed.id}/apps/survey-voters/${e}`).then(({voters:o})=>{this.cache[e]=o,t===this.requestId&&(this.voters=o)}).catch(o=>{s||this.$handleError(o)}).finally(()=>{t===this.requestId&&(this.loading=!1)})}},mounted(){this.loadVoters()}},$m={class:"dialog_header"},Sm={class:"fcom_filter_menu"},Vm={class:"fcom_filter_menu_ul"},Mm=["onClick"],Tm={key:1},Lm={class:"feed_meta_info survey_voters_meta"},Pm={class:"meta_line"},Fm={class:"meta_line"},Im={class:"voters_list"},Em={class:"voter_avatar"},Um={class:"voter_info"},Am=["title"],Bm={key:2,class:"not_found"};function Dm(e,t,s,u,o,i){const m=Z,f=p("UserAvatar"),h=p("UserRouteLink"),g=Ce,k=we;return n(),y(k,{modelValue:o.showVotersDialog,"onUpdate:modelValue":t[0]||(t[0]=b=>o.showVotersDialog=b),"modal-class":"fcom_common_dialog menu_dialog","close-on-click-modal":!0,"append-to-body":!0,width:e.dialogWidth,style:{"max-width":"800px"},direction:"rtl",onClose:i.closeDialog},{header:r(({close:b})=>[l("div",$m,[l("div",Sm,[l("ul",Vm,[(n(!0),c(P,null,R(s.options,w=>(n(),c("li",{key:w.slug},[l("a",{onClick:z(S=>i.switchOption(w.slug),["prevent"]),class:x({"router-link-exact-active":s.option.slug==w.slug}),href:"#"},d(w.label),11,Mm)]))),128))])])])]),default:r(()=>[o.loading?(n(),y(m,{key:0,animated:"",rows:4})):o.voters.length?(n(),c("div",Tm,[l("div",Lm,[l("span",Pm,d(i.getVotePercentage),1),l("span",Fm,d(e.$_n("%s Vote","%s Votes",s.option.vote_counts)),1)]),a(g,{"max-height":"800px"},{default:r(()=>[l("div",Im,[(n(!0),c(P,null,R(o.voters,b=>(n(),c("div",{key:b.id,class:"voter_item"},[b.xprofile?(n(),c(P,{key:0},[l("div",Em,[a(f,{with_level:!1,xprofile:b.xprofile},null,8,["xprofile"])]),l("div",Um,[a(h,{show_badge:!0,xprofile:b.xprofile},null,8,["xprofile"]),b.xprofile.created_at?(n(),c("div",{key:0,title:b.xprofile.created_at,class:"voter_time"},d(e.$t("Joined %s",e.humanDateDiff(b.xprofile.created_at))),9,Am)):_("",!0)])],64)):_("",!0)]))),128))])]),_:1})])):(n(),c("div",Bm,[l("p",null,d(e.$t("No voters yet")),1)]))]),_:1},8,["modelValue","width","onClose"])}const Rm=I(Cm,[["render",Dm]]),xm={name:"SurveyRenderer",props:{feed:{type:Object,required:!0},is_preview:{type:Boolean,default:!1},hasTopMedia:{type:Boolean,default:!1},isChildFeed:{type:Boolean,default:!1}},components:{SurveyVoters:Rm},data(){var e,t;return{inputType:(t=(e=this.feed.meta)==null?void 0:e.survey_config)==null?void 0:t.type,formattedOptions:[],working:!1,totalCount:0,showVotersDialog:!1,selectedOption:null,endingDate:null}},watch:{"feed.meta.survey_config":{handler(e,t){JSON.stringify(e)!==JSON.stringify(t)&&(this.inputType=t.type,this.setupData())},deep:!0}},computed:{isEnded(){return this.endingDate&&this.isPastDate(this.endingDate)},endedDateLabel(){return this.$t("ended %s",this.humanDateDiff(this.endingDate))},endingDateLabel(){return this.$t("ending %s",this.humanDateDiff(this.endingDate))},shouldHideBorder(){var e,t;return!this.hasTopMedia&&(((e=this.feed.meta)==null?void 0:e.media_items)||((t=this.feed.meta)==null?void 0:t.media_preview))||this.isChildFeed}},methods:{getVoteStyle(e){const t=e?e/this.totalCount*100:0,s={width:t+"%"};return t>0&&t<100&&(s["border-top-right-radius"]=0,s["border-bottom-right-radius"]=0),s},showVoters(e){this.selectedOption=e,this.showVotersDialog=!0},updateOption(e){this.selectedOption=this.formattedOptions.find(t=>t.slug===e)},toggleVote(e){if(this.isEnded){this.$notify.error(this.$t("This poll has ended."));return}if(this.showVotersDialog)return;let t=this.formattedOptions[e].voted;this.inputType=="single_choice"&&this.each(this.formattedOptions,s=>{s.voted=!1}),this.formattedOptions[e].voted=!t,this.syncVotes()},syncVotes(){if(this.is_preview)return;let e=[];this.each(this.formattedOptions,t=>{t.voted&&e.push(t.slug)}),this.working=!0,this.$post(`feeds/${this.feed.id}/apps/survey-vote`,{vote_indexes:e}).then(t=>{this.feed.meta.survey_config=t.survey_config,this.setupData()}).catch(t=>{this.$handleError(t)}).finally(()=>{this.working=!1})},setupData(){let e=[],t=0;this.feed.meta.survey_config&&(this.each(this.feed.meta.survey_config.options,s=>{e.push(s),s.vote_counts&&(t+=parseInt(s.vote_counts))}),this.formattedOptions=e,this.totalCount=t,this.endingDate=this.feed.meta.survey_config.end_date)}},mounted(){this.setupData()}},Hm={class:"fcom_app_options"},Om=["onClick"],jm={class:"fcom_app_text"},Nm={class:"fcom_app_input_wrap"},zm={key:0,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 6"},qm={key:1,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 8 8"},Gm=["onClick"],Ym={key:0},Wm={class:"feed_meta_info"},Zm={key:0,class:"meta_line"},Km=["title"],Jm=["title"];function Qm(e,t,s,u,o,i){const m=p("ArrowRight"),f=O,h=p("SurveyVoters");return n(),c(P,null,[l("div",{class:x(["fcom_app_render",{"no-border":i.shouldHideBorder}])},[l("div",Hm,[(n(!0),c(P,null,R(o.formattedOptions,(g,k)=>(n(),c("div",{key:g.slug,onClick:b=>i.toggleVote(k),class:x([g.voted?"fcom_is_voted":"","fcom_app_option"])},[l("div",jm,[l("span",Nm,[l("span",{class:x("fcom_input_"+o.inputType)},[o.inputType=="single_choice"?(n(),c("svg",zm,[...t[1]||(t[1]=[l("circle",{cx:"3",cy:"3",r:"2.5",fill:"currentColor"},null,-1)])])):(n(),c("svg",qm,[...t[2]||(t[2]=[l("path",{fill:"currentColor",d:"M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"},null,-1)])]))],2)]),l("span",null,d(g.label),1)]),l("div",{class:"fcom_app_counts",onClick:b=>i.showVoters(g)},[M(d(g.vote_counts?Math.floor(g.vote_counts/o.totalCount*100)+"%":"")+" ",1),g.vote_counts?(n(),c("span",Ym,"("+d(g.vote_counts)+")",1)):_("",!0),g.vote_counts?(n(),y(f,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(m)]),_:1})):_("",!0)],8,Gm),o.totalCount?(n(),c("span",{key:0,style:re(i.getVoteStyle(g.vote_counts)),class:"fc_app_shadow"},null,4)):_("",!0)],10,Om))),128))]),l("div",Wm,[o.totalCount?(n(),c("span",Zm,d(e.$_n("%d vote","%d votes",o.totalCount)),1)):_("",!0),o.endingDate?(n(),c(P,{key:1},[i.isEnded?(n(),c("span",{key:0,title:e.$t("Ended at: %s",o.endingDate),class:"meta_line"},d(i.endedDateLabel),9,Km)):(n(),c("span",{key:1,title:e.$t("Will end at: %s",o.endingDate),class:"meta_line"},d(i.endingDateLabel),9,Jm))],64)):_("",!0)])],2),o.showVotersDialog?(n(),y(h,{key:0,feed:s.feed,option:o.selectedOption,options:o.formattedOptions,totalCount:o.totalCount,onUpdateOption:i.updateOption,onClose:t[0]||(t[0]=g=>o.showVotersDialog=!1)},null,8,["feed","option","options","totalCount","onUpdateOption"])):_("",!0)],64)}const go=I(xm,[["render",Qm]]),Xm={name:"BookmarkIcon",props:["is_active"]},eh={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"},th={key:1,width:"16",height:"20",viewBox:"0 0 16 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function sh(e,t,s,u,o,i){return s.is_active?(n(),c("svg",eh,[...t[0]||(t[0]=[l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(n(),c("svg",th,[...t[1]||(t[1]=[l("path",{d:"M1.33331 14.9839V8.08944C1.33331 5.06164 1.33331 3.54774 2.30962 2.60712C3.28593 1.6665 4.85728 1.6665 7.99998 1.6665C11.1427 1.6665 12.714 1.6665 13.6903 2.60712C14.6666 3.54774 14.6666 5.06164 14.6666 8.08944V14.9839C14.6666 16.9054 14.6666 17.8662 14.0226 18.2101C12.7754 18.876 10.436 16.6542 9.32498 15.9852C8.68064 15.5972 8.35847 15.4032 7.99998 15.4032C7.64148 15.4032 7.31932 15.5972 6.67498 15.9852C5.56398 16.6542 3.22454 18.876 1.97735 18.2101C1.33331 17.8662 1.33331 16.9054 1.33331 14.9839Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))}const yo=I(Xm,[["render",sh]]);const oh={name:"RenderChildPost",components:{ImageCarousel:Ut,SurveyRenderer:go,DocumentLists:ot,UserRouteLink:Ie,MediaPreview:Oe,FeedMdContent:Bt},props:["feed_id"],data(){return{feed:null,loading:!1,notFound:null,in_space:this.$route.params.space,hasOverflowContent:!1}},computed:{hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern"||!this.feed)return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},feedClasses(){if(!this.feed)return[];let e=["feed_single"];return e.push("feed_type_"+this.feed.type),this.hasTopMedia&&e.push("feed_modern_layout"),e}},methods:{getFeed(){this.loading=!0,this.$get("feeds/"+this.feed_id+"/by-id").then(e=>{this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),this.$nextTick(()=>{this.setOverFlow()})}).catch(e=>{typeof e=="object"&&e.xhr_status==404?this.notFound=!0:this.$handleError(e)}).finally(()=>{this.loading=!1})},handleFeedClick(e){e.preventDefault()&&e.stopPropagation();let t={name:"single_feed",params:{feed_slug:this.feed.slug}};this.feed.space&&(t={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),this.$router.push(t)},setOverFlow(){let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},mounted(){this.getFeed()}},ih=["id"],nh={key:0,class:"fcom_top_media"},lh={class:"fcom_feed_header_wrap"},ah={class:"feed_header"},rh={key:0,class:"feed_user"},ch={class:"feed_user_name"},dh={class:"feed_meta_info"},uh={key:0,class:"meta_line"},_h=["title","href"],mh={key:1,class:"feed_timestamp"},hh={key:0,class:"feed_title"},fh={class:"feed_title_heading"},ph={key:1,class:"expand-button"};function gh(e,t,s,u,o,i){var C,v,$,T,V,F,L,A,D,U,E;const m=p("media-preview"),f=p("UserAvatar"),h=p("UserRouteLink"),g=p("FeedMdContent"),k=H,b=p("DocumentLists"),w=p("SurveyRenderer"),S=p("ImageCarousel");return o.feed?(n(),c("div",{key:0,onClick:t[0]||(t[0]=(...q)=>i.handleFeedClick&&i.handleFeedClick(...q)),class:"fcom_child_feed"},[l("div",{id:"feed_id_"+o.feed.id,class:x([i.feedClasses,"feed"])},[i.hasTopMedia?(n(),c("div",nh,[o.feed.meta&&o.feed.meta.media_preview?(n(),y(m,{key:0,feed:o.feed},null,8,["feed"])):_("",!0)])):_("",!0),l("div",lh,[l("div",ah,[o.feed.xprofile?(n(),c("div",rh,[a(f,{with_level:!1,xprofile:o.feed.xprofile},null,8,["xprofile"]),l("div",null,[l("div",ch,[a(h,{show_badge:!0,xprofile:o.feed.xprofile,show_follow:!0},null,8,["xprofile"])]),l("div",dh,[o.feed.content_type=="survey"&&((T=($=(v=(C=o.feed)==null?void 0:C.meta)==null?void 0:v.survey_config)==null?void 0:$.options)!=null&&T.length)?(n(),c("span",uh,d(e.$t("created a poll")),1)):_("",!0),l("a",{title:o.feed.created_at,href:o.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(o.feed.created_at)),9,_h),!o.in_space&&o.feed.space?(n(),c("span",mh,d(e.$t("Posted in %s",e.getExcerpt(o.feed.space.title,30))),1)):_("",!0)])])])):_("",!0)])]),l("div",{ref:"feed_body",class:x([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[o.feed.title?(n(),c("div",hh,[l("h2",fh,d(o.feed.title),1)])):_("",!0),a(g,{class_name:"feed_texts",content:o.feed.message_rendered},null,8,["content"]),o.hasOverflowContent?(n(),c("div",ph,[a(k,{class:"btn_expand"},{default:r(()=>[M(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),o.feed.content_type=="document"?(n(),y(b,{key:1,document_lists:((F=(V=o.feed)==null?void 0:V.meta)==null?void 0:F.document_lists)||[]},null,8,["document_lists"])):(n(),c(P,{key:2},[o.feed.content_type=="survey"&&((U=(D=(A=(L=o.feed)==null?void 0:L.meta)==null?void 0:A.survey_config)==null?void 0:D.options)!=null&&U.length)?(n(),y(w,{key:0,feed:o.feed,isChildFeed:!0},null,8,["feed"])):_("",!0),o.feed.meta?(n(),c(P,{key:1},[o.feed.meta.media_items?(n(),y(S,{key:0,feed:o.feed},null,8,["feed"])):!i.hasTopMedia&&(o.feed.meta.media_preview||(E=o.feed.meta.audio_medias)!=null&&E.length)?(n(),y(m,{key:1,feed:o.feed},null,8,["feed"])):_("",!0)],64)):_("",!0)],64))],10,ih)])):_("",!0)}const yh=I(oh,[["render",gh]]),vh={name:"CustomAppMeta",components:{RenderChildPost:yh},props:{feed:{type:Object,required:!0}}},bh={ref:"fcom_custom_app"},kh={key:0},wh=["innerHTML"];function Ch(e,t,s,u,o,i){const m=p("RenderChildPost");return n(),c("div",bh,[s.feed.meta.custom_app_preview.app_name=="child_post"&&s.feed.meta.custom_app_preview.feed_id?(n(),c("div",kh,[a(m,{feed_id:s.feed.meta.custom_app_preview.feed_id},null,8,["feed_id"])])):s.feed.meta.custom_app_preview.custom_html?(n(),c("div",{key:1,innerHTML:s.feed.meta.custom_app_preview.custom_html},null,8,wh)):_("",!0)],512)}const $h=I(vh,[["render",Ch]]),Sh={name:"FeedAction",components:{EditFeed:hs},props:{feed:{type:Object,required:!0},hide_create_form:{type:Boolean,default:!1}},emits:["updated","deleted"],data(){return{isEdit:!1,working:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReportOption(){var t,s;return!(((t=this.feed)==null?void 0:t.user_id)==((s=this.auth)==null?void 0:s.user_id))&&this.auth.user_id&&this.isReportEnabled}},methods:{editItem(){this.$refs.popover.hide(),this.isEdit=!0},handleUpdate(e){this.$emit("updated",e);const t=document.getElementById("feed_id_"+e.id);t&&(t.classList.add("fcom_highlight_glow"),setTimeout(()=>{t.classList.remove("fcom_highlight_glow")},4500))},reportPost(){this.$refs.popover.hide(),this.$eventBus.emit("showReportContentModal",{reportConfig:this.feed,type:"post"})},copyFeedLink(){navigator.clipboard.writeText(this.feed.permalink).then(()=>{this.$notify.success(this.$t("Link copied to clipboard")),this.$refs.popover.hide()}).catch(e=>{this.$notify.error(this.$t("Failed to copy"))})},toggleSticky(){!this.feed.space_id||this.working||(this.working=!0,this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleSidebarPin(){!this.feed.space_id||this.working||(this.$refs.popover.hide(),this.working=!0,this.feed.priority=!this.feed.priority,this.$patch("feeds/"+this.feed.id,{priority:this.feed.priority?1:0}).then(e=>{this.$notify.success(e.feed.priority?this.$t("Pinned to sidebar"):this.$t("Unpinned from sidebar")),this.feed.priority=e.feed.priority,this.$eventBus.emit("updateSpaceSidebar",this.feed.space_id)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1}))},toggleCommentStatus(){var t;if(this.working)return;let e=((t=this.feed.meta)==null?void 0:t.comments_disabled)=="yes";this.$refs.popover.hide(),this.working=!0,this.$patch("feeds/"+this.feed.id,{comments_disabled:e?0:1}).then(s=>{var o;let u=((o=s.feed.meta)==null?void 0:o.comments_disabled)=="yes";this.$notify.success(u?this.$t("Comments have been disabled."):this.$t("Comments have been enabled.")),this.feed.meta.comments_disabled=s.feed.meta.comments_disabled}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})},removePreview(){this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to remove the preview image? This action cannot be undone."),this.$t("Remove Preview"),{confirmButtonText:this.$t("Remove"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+this.feed.id+"/media-preview").then(e=>{this.feed.meta.media_preview=null}).catch(e=>{this.$handleError(e)}).finally(()=>{this.working=!1})}).catch(()=>{})},deleteItem(){this.working||(this.$refs.popover.hide(),this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working||(this.working=!0,this.$emit("deleted"),this.working=!1)}).catch(()=>{}))}}},Vh={class:"actions_items"},Mh={key:0},Th={key:1},Lh={key:0},Ph={key:1},Fh={key:0},Ih={key:1};function Eh(e,t,s,u,o,i){var b,w;const m=p("MoreFilled"),f=O,h=H,g=ye,k=p("EditFeed");return n(),c(P,null,[a(g,{persistent:!1,ref:"popover",placement:"bottom",width:200,trigger:"click",teleported:!1,"popper-class":"fcom_menu_below_nav"},{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 S,C;return[l("ul",Vh,[G(e.$slots,"before_feed_actions_pop"),l("li",{onClick:t[0]||(t[0]=v=>i.copyFeedLink())},d(e.$t("Copy Link")),1),i.showReportOption?(n(),c("li",{key:0,onClick:t[1]||(t[1]=v=>i.reportPost())},d(e.$t("Report Post")),1)):_("",!0),e.canEditFeed(s.feed)?(n(),c(P,{key:1},[l("li",{onClick:t[2]||(t[2]=v=>i.editItem())},d(e.$t("Edit")),1),s.feed.space&&e.hasSpaceAdminAccess(s.feed.space)?(n(),c(P,{key:0},[l("li",{onClick:t[3]||(t[3]=v=>i.toggleSticky())},[s.feed.is_sticky?(n(),c("span",Mh,d(e.$t("Unpin from Top")),1)):(n(),c("span",Th,d(e.$t("Pin to top")),1))]),l("li",{onClick:t[4]||(t[4]=v=>i.toggleSidebarPin())},[s.feed.priority?(n(),c("span",Ph,d(e.$t("Unpin from sidebar")),1)):(n(),c("span",Lh,d(e.$t("Pin to sidebar")),1))])],64)):_("",!0),(S=s.feed.meta)!=null&&S.media_preview?(n(),c("li",{key:1,onClick:t[5]||(t[5]=v=>i.removePreview())},d(e.$t("Remove Preview")),1)):_("",!0),e.hasSpaceAdminAccess(s.feed.space)?(n(),c("li",{key:2,onClick:t[6]||(t[6]=v=>i.toggleCommentStatus())},[((C=s.feed.meta)==null?void 0:C.comments_disabled)=="yes"?(n(),c("span",Fh,d(e.$t("Enable comments")),1)):(n(),c("span",Ih,d(e.$t("Disable comments")),1))])):_("",!0)],64)):_("",!0),e.canDeleteFeed(s.feed)?(n(),c("li",{key:2,onClick:t[7]||(t[7]=v=>i.deleteItem())},d(e.$t("Delete")),1)):_("",!0),G(e.$slots,"after_feed_actions_pop")])]}),_:3},512),o.isEdit?(n(),y(k,{key:0,feedSlug:s.feed.slug,dialogVisible:o.isEdit,hide_create_form:s.hide_create_form,author:{name:(b=s.feed.xprofile)==null?void 0:b.display_name,avatar:(w=s.feed.xprofile)==null?void 0:w.avatar},onUpdated:i.handleUpdate,onClose:t[8]||(t[8]=S=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","hide_create_form","author","onUpdated"])):_("",!0)],64)}const vo=I(Sh,[["render",Eh]]);const Uh={name:"Feed",components:{DocumentLists:ot,CustomAppMeta:$h,BookmarkIcon:yo,StickyIcon:At,UserRouteLink:Ie,EditFeed:hs,FeedFooter:y_,MediaPreview:Oe,ImageCarousel:Ut,SurveyRenderer:go,ReportReview:_o,FeedAction:vo,FeedMdContent:Bt},emits:["updated","deleted","removed","reload","commented"],props:{feed:{type:Object,required:!0},is_single:{type:Boolean,default:!1},is_route:{type:Boolean,default:!1},show_footer:{type:Boolean,default:!0},show_header:{type:Boolean,default:!0},show_report:{type:Boolean,default:!1},hide_create_form:{type:Boolean,default:!1},is_preview:{type:Boolean,default:!1},show_actions:{type:Boolean,default:!0},is_modal:{type:Boolean,default:!1},isSingleSpacePage:{type:Boolean,default:!1}},data(){return{in_space:this.$route.params.space,working:!1,hasOverflowContent:!1,isExpanded:!1,joiningSpace:!1}},computed:{isReportEnabled(){return this.has_pro&&this.appVars.moderationConfig.is_enabled},showReport(){var e;return this.hasSpaceModeratorAccess(this.feed.space)&&this.isReportEnabled&&this.show_report&&(this.feed.status=="pending"||((e=this.feed.meta)==null?void 0:e.reports_count))},space_slug(){let e=!1;return this.feed.space?e=this.feed.space.slug:this.$route.params.space&&(e=this.$route.params.space),e},feedClasses(){let e=[];return e.push("feed_type_"+this.feed.type),this.feed.type=="article"&&e.push(this.feed.featured_image?"feed_has_image":"feed_no_image"),this.is_preview&&e.push("feed_preview"),this.is_single?e.push("feed_single"):e.push("feed_list_item"),this.hasTopMedia&&e.push("feed_modern_layout"),e},feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.space_slug&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.space_slug}}),e},hasTopMedia(){var t,s,u,o,i,m;if(this.appVars.features.post_layout!="modern")return!1;let e=["oembed","iframe_html"].includes((s=(t=this.feed.meta)==null?void 0:t.media_preview)==null?void 0:s.type);return e||(e=(o=(u=this.feed.meta)==null?void 0:u.media_preview)==null?void 0:o.is_uploaded),e||(e=((m=(i=this.feed.meta)==null?void 0:i.media_items)==null?void 0:m.length)==1),e},parsedMessage(){return this.parseMessage(this.feed.message_rendered)}},methods:{getTopicRoute(e){return this.space_slug?{name:"space_feeds",params:{space:this.space_slug},query:{topic:e}}:{name:"all_feeds",query:{topic:e}}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},gotoTopicUrl(e){let t=this.getTopicRoute(e);this.$router.push(t)},gotoFeed(e){e&&(e.metaKey||e.ctrlKey)||(e&&(e.preventDefault(),e.stopPropagation()),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},getFeedContent(){return this.feed.title},expandInline(){this.hasOverflowContent=!1,this.isExpanded=!0},showFullContent(e){if(!this.hasFeature("show_post_modal")){this.expandInline();return}e&&e.stopPropagation(),this.$eventBus.emit("showFeedModal",{feed:this.feed})},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;let s=e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(o,i,m,f)=>o.startsWith("<a")&&!o.includes('target="_blank"')?o.includes(window.location.origin)?o:o.replace("<a",'<a target="_blank" rel="noopener noreferrer nofollow"'):i&&!this.isInsideHtmlTag(f,m)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${i}">#${i}</a>`:o);return s.indexOf('<span class="fcom_dynamic_prop" data-type="timestamp"')===-1?s:(o=>o.replace(/<span class="fcom_dynamic_prop" data-type="timestamp" data-timestamp="(\d+)">([^<]+)<\/span>/g,(i,m,f)=>{try{const h=this.dayjs(m*1e3);if(!h.isValid())return i;const k=h.local().format(this.siteDateTimeFormat)+" ("+this.currentTimeZoneName+")";return`<span class="fcom_timestamp" title="${f}">${k}</span>`}catch{return i}}))(s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},handleUpdate(e){this.$emit("updated",e),Object.assign(this.feed,e)},handleDelete(){this.$emit("deleted")},handleRemoveBookmark(){this.$emit("deleted")},toggleBookmark(){const e={react_type:"bookmark"};this.feed.bookmarked&&(e.remove=!0),this.feed.bookmarked=!this.feed.bookmarked,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.$notify.success(this.feed.bookmarked?this.$t("Bookmarked"):this.$t("Removed from bookmark")),!this.feed.bookmarked&&this.$route.name==="bookmarks"&&this.$emit("removeFromBookmark")}).catch(t=>{this.$handleError(t),this.feed.bookmarked=!this.feed.bookmarked})},toggleSticky(){this.feed.space_id&&(this.feed.is_sticky=!this.feed.is_sticky,this.$patch("feeds/"+this.feed.id,{is_sticky:this.feed.is_sticky?1:0}).then(e=>{this.feed.is_sticky=e.feed.is_sticky,this.$emit("reload")}).catch(e=>{this.$handleError(e)}))},joinSpace(){this.joiningSpace=!0,this.$post("spaces/"+this.feed.space.slug+"/join").then(e=>{this.appVars.user_membership_slugs.push(this.feed.space.slug),this.$notify.success(e.message),document.location.href=this.feed.permalink}).catch(e=>{this.$handleError(e)}).finally(()=>{this.joiningSpace=!1})},onModReport(e){var t,s;((t=e.content)==null?void 0:t.id)==((s=this.feed)==null?void 0:s.id)&&(e.action==="unpublished"&&e.type!=="comment"?this.$emit("removed"):(this.feed.meta={...this.feed.meta,...e.content.meta},e.content.status&&(this.feed.status=e.content.status)))}},created(){this.$eventBus.on("updateModerationReport",this.onModReport)},beforeUnmount(){this.$eventBus.off("updateModerationReport",this.onModReport)},mounted(){if(document.dispatchEvent(new CustomEvent("fcomFeedMounted",{detail:{isSingle:this.is_single,feed:this.feed,feedBody:this.$refs.feed_body}})),this.is_single||this.feed.is_sticky||this.feed.priority){this.isExpanded=!0;return}let e=this.$refs.feed_body;if(!e)return;e.scrollHeight>400&&(this.hasOverflowContent=!0)}},Ah=["id"],Bh={key:1,class:"fcom_top_media"},Dh={key:2,class:"fcom_feed_header_wrap"},Rh={class:"feed_actions fcom_concat_buttons"},xh={key:0,class:"fcom_feed_topics"},Hh={class:"feed_header"},Oh={key:0,class:"feed_user"},jh={class:"feed_user_info"},Nh={class:"feed_user_name"},zh={key:0,class:"feed_status"},qh={key:1,class:"feed_status"},Gh={class:"feed_meta_info"},Yh={key:0,class:"meta_line"},Wh=["title","href"],Zh=["title","href"],Kh={key:3},Jh={key:0,class:"feed_title"},Qh={key:0,class:"feed_title_heading"},Xh=["href"],ef={key:1,class:"feed_title_heading"};function tf(e,t,s,u,o,i){var E,q,j,N,W,le,B,J,me,Q,he,X,se,oe,bt;const m=p("report-review"),f=p("media-preview"),h=H,g=p("StickyIcon"),k=O,b=p("BookmarkIcon"),w=p("FeedAction"),S=p("router-link"),C=p("UserAvatar"),v=p("UserRouteLink"),$=Ue,T=p("FeedMdContent"),V=p("SurveyRenderer"),F=p("ImageCarousel"),L=p("DocumentLists"),A=p("CustomAppMeta"),D=p("feed-footer"),U=ee("loading");return Y((n(),c("div",{id:"feed_id_"+((E=s.feed)==null?void 0:E.id),class:x([i.feedClasses,"feed"])},[i.showReport?(n(),y(m,{key:0,feed:s.feed},null,8,["feed"])):_("",!0),i.hasTopMedia?(n(),c("div",Bh,[s.feed.meta&&s.feed.meta.media_preview?(n(),y(f,{key:0,feed:s.feed,is_preview:s.is_preview},null,8,["feed","is_preview"])):_("",!0)])):_("",!0),s.show_header?(n(),c("div",Dh,[l("div",Rh,[e.auth.user_id&&!e.hasSpaceAccess((q=s.feed.space)==null?void 0:q.slug)&&!s.is_single&&!s.isSingleSpacePage?(n(),y(h,{key:0,loading:o.joiningSpace,class:"fcom_secondary_button join_button",onClick:t[0]||(t[0]=pe=>i.joinSpace())},{default:r(()=>[M(d(e.$t("Join")),1)]),_:1},8,["loading"])):_("",!0),s.show_actions?(n(),c(P,{key:1},[s.feed.is_sticky&&o.in_space?(n(),y(h,{key:0,onClick:t[1]||(t[1]=pe=>i.toggleSticky()),"aria-label":e.$t("Toggle Sticky"),class:"no_pad_btn",text:"",size:"small"},{default:r(()=>[a(k,{class:"fcom_sticky"},{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])):_("",!0),e.auth.user_id?(n(),y(h,{key:1,"aria-label":e.$t("Toggle Bookmark"),size:"small",text:"",onClick:t[2]||(t[2]=pe=>i.toggleBookmark()),class:x([{bookmark_active:s.feed.bookmarked},"feed_bookmark no_pad_btn"]),title:s.feed.bookmarked?e.$t("Remove From Bookmark"):e.$t("Bookmark this post")},{default:r(()=>[a(k,{style:{"font-size":"14px"}},{default:r(()=>[a(b,{is_active:s.feed.bookmarked},null,8,["is_active"])]),_:1})]),_:1},8,["aria-label","class","title"])):_("",!0),a(w,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},{before_feed_actions_pop:r(()=>[s.is_route?(n(),c("li",{key:0,onClick:t[3]||(t[3]=pe=>e.$emit("reload"))},d(e.$t("Refresh")),1)):_("",!0)]),_:1},8,["feed","hide_create_form","onUpdated","onDeleted"])],64)):_("",!0),G(e.$slots,"after_feed_actions")]),((j=e.appVars.topicsConfig)==null?void 0:j.show_on_post_card)=="yes"&&s.feed.terms&&s.feed.terms.length?(n(),c("div",xh,[(n(!0),c(P,null,R(s.feed.terms,pe=>(n(),y(S,{onClick:z(PU=>i.gotoTopicUrl(pe.slug),["prevent"]),key:pe.slug,to:i.getTopicRoute(pe.slug),class:"feed_timestamp"},{default:r(()=>[M("#"+d(pe.title),1)]),_:2},1032,["onClick","to"]))),128))])):_("",!0),l("div",Hh,[s.feed.xprofile?(n(),c("div",Oh,[a(C,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"]),l("div",jh,[l("div",Nh,[a(v,{show_badge:!0,xprofile:s.feed.xprofile,show_follow:!0},null,8,["xprofile"]),s.feed.status=="pending"?(n(),c("span",zh,[a($,{type:"warning"},{default:r(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0),s.feed.status=="scheduled"?(n(),c("span",qh,[a($,{type:"warning"},{default:r(()=>[M(d(e.$t("Scheduled")),1)]),_:1})])):_("",!0)]),l("div",Gh,[s.feed.content_type=="survey"&&((B=(le=(W=(N=s.feed)==null?void 0:N.meta)==null?void 0:W.survey_config)==null?void 0:le.options)!=null&&B.length)?(n(),c("span",Yh,d(e.$t("created a poll")),1)):_("",!0),s.feed.status=="scheduled"?(n(),c("a",{key:1,title:s.feed.scheduled_at,onClick:t[4]||(t[4]=(...pe)=>i.gotoFeed&&i.gotoFeed(...pe)),href:s.feed.permalink,class:"feed_timestamp"},d(i.getScheduledTime(s.feed.scheduled_at)),9,Wh)):(n(),c("a",{key:2,title:s.feed.created_at,onClick:t[5]||(t[5]=(...pe)=>i.gotoFeed&&i.gotoFeed(...pe)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,Zh)),!o.in_space&&s.feed.space?(n(),c("span",Kh,[a(S,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[M(d(e.$t("Posted in %s",e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])])):_("",!0),G(e.$slots,"after_feed_header")])])):_("",!0),l("div",{ref:"feed_body",class:x([{feed_is_overflow_content:o.hasOverflowContent},"feed_body"])},[s.feed.title?(n(),c("div",Jh,[s.is_single?(n(),c("h2",ef,d(s.feed.title),1)):(n(),c("h2",Qh,[l("a",{onClick:t[6]||(t[6]=z((...pe)=>i.showFullContent&&i.showFullContent(...pe),["prevent"])),href:s.feed.permalink},d(s.feed.title),9,Xh)]))])):_("",!0),a(T,{class_name:"feed_texts",content:i.parsedMessage},null,8,["content"]),o.hasOverflowContent&&!o.isExpanded?(n(),c("div",{key:1,onClick:t[7]||(t[7]=pe=>i.expandInline()),class:"expand-button"},[a(h,{class:"btn_expand"},{default:r(()=>[M(d(e.$t("Show More")),1)]),_:1})])):_("",!0)],2),s.feed.content_type=="survey"&&((he=(Q=(me=(J=s.feed)==null?void 0:J.meta)==null?void 0:me.survey_config)==null?void 0:Q.options)!=null&&he.length)?(n(),c(P,{key:3},[a(V,{feed:s.feed,is_preview:s.is_preview,hasTopMedia:i.hasTopMedia},null,8,["feed","is_preview","hasTopMedia"]),s.feed.meta.media_items?(n(),y(F,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(X=s.feed.meta.audio_medias)!=null&&X.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0)],64)):s.feed.content_type=="document"?(n(),y(L,{key:4,document_lists:((oe=(se=s.feed)==null?void 0:se.meta)==null?void 0:oe.document_lists)||[]},null,8,["document_lists"])):s.feed.meta?(n(),c(P,{key:5},[s.feed.meta.media_items?(n(),y(F,{key:0,is_single:s.is_single,feed:s.feed},null,8,["is_single","feed"])):!i.hasTopMedia&&(s.feed.meta.media_preview||(bt=s.feed.meta.audio_medias)!=null&&bt.length)?(n(),y(f,{key:1,feed:s.feed},null,8,["feed"])):_("",!0),s.feed.meta.custom_app_preview?(n(),y(A,{key:2,feed:s.feed},null,8,["feed"])):_("",!0)],64)):_("",!0),s.show_footer?(n(),y(D,{key:6,feed:s.feed,is_modal:s.is_modal,is_single:s.is_single,space_slug:i.space_slug,onJoinSpace:t[8]||(t[8]=()=>{i.joinSpace()}),onCommented:t[9]||(t[9]=pe=>{e.$emit("commented",pe)})},null,8,["feed","is_modal","is_single","space_slug"])):_("",!0),G(e.$slots,"after_feed_footer")],10,Ah)),[[U,o.working]])}const nt=I(Uh,[["render",tf]]),sf={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()}},of={name:"FeedCard",mixins:[sf],components:{UserRouteLink:Ie,ChatIcon:tt,HeartIcon:st,StickyIcon:At,MediaPreview:Oe,ImageCarousel:Ut,UserAvatar:fs,FeedAction:vo},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,s,u,o,i;const e=this.feed.meta;return e?(t=e.media_preview)!=null&&t.image?e.media_preview.image:(u=(s=e.media_items)==null?void 0:s[0])!=null&&u.url?e.media_items[0].url:((o=e.media_preview)==null?void 0:o.type)==="iframe_html"&&((i=e.media_preview)!=null&&i.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 s=t[1],u=[[/youtube\.com\/embed\/([^?/]+)/,o=>"https://img.youtube.com/vi/"+o+"/hqdefault.jpg"],[/player\.vimeo\.com\/video\/([^?/]+)/,o=>"https://vumbnail.com/"+o+".jpg"],[/fast\.wistia\.net\/embed\/iframe\/([^?/]+)/,o=>"https://fast.wistia.net/embed/medias/"+o+"/swatch"],[/dailymotion\.com\/(?:embed\/video|player\.html\?video=)\/?([^?/&]+)/,o=>"https://www.dailymotion.com/thumbnail/video/"+o]];for(const[o,i]of u){const m=s.match(o);if(m)return i(m[1])}return null},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})}}},nf=["id"],lf={class:"fcom_feed_card_header"},af=["src","alt"],rf={class:"feed_card_user"},cf={class:"feed_card_body"},df={class:"fcom_feed_title_row"},uf=["textContent"],_f={key:0,class:"feed_status"},mf={class:"card_description feed_meta_info"},hf=["title","href"],ff={key:0},pf={class:"fcom_feed_card_footer"},gf={class:"num_label"},yf={class:"num_label"},vf={class:"fcom_feed_card_action"};function bf(e,t,s,u,o,i){var v;const m=p("UserAvatar"),f=Ue,h=p("UserRouteLink"),g=p("router-link"),k=p("HeartIcon"),b=O,w=H,S=p("ChatIcon"),C=p("FeedAction");return n(),c("div",{id:"feed_id_"+((v=s.feed)==null?void 0:v.id),class:"fcom_feed_card"},[l("div",lf,[l("div",{onClick:t[0]||(t[0]=(...$)=>i.goToFeedView&&i.goToFeedView(...$)),class:"feed_card_cover"},[l("img",{src:i.cardImage,class:"card_image",alt:s.feed.title||e.$t("Placeholder image")},null,8,af)]),l("div",rf,[a(m,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])]),l("div",cf,[l("div",df,[l("div",{onClick:t[1]||(t[1]=(...$)=>i.goToFeedView&&i.goToFeedView(...$)),class:"card_title feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,60))},null,8,uf),s.feed.status=="pending"?(n(),c("span",_f,[a(f,{type:"warning"},{default:r(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",mf,[a(h,{xprofile:s.feed.xprofile,show_verified:!1,show_follow:!0},null,8,["xprofile"]),l("a",{title:s.feed.created_at,onClick:t[2]||(t[2]=(...$)=>i.goToFeedView&&i.goToFeedView(...$)),href:s.feed.permalink,class:"feed_timestamp"},d(e.humanDateDiff(s.feed.created_at)),9,hf),!o.in_space&&s.feed.space?(n(),c("span",ff,[a(g,{to:i.getSpaceRoute(s.feed.space.slug),class:"feed_timestamp"},{default:r(()=>[M(d(e.$t(e.getExcerpt(s.feed.space.title,30))),1)]),_:1},8,["to"])])):_("",!0)])])]),l("div",pf,[a(w,{text:""},{default:r(()=>[a(b,{class:x({user_reacted:s.feed.has_user_react}),onClick:t[3]||(t[3]=$=>i.toggleReact())},{default:r(()=>[a(k,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",gf,d(s.feed.reactions_count),1)]),_:1}),a(w,{onClick:t[4]||(t[4]=$=>i.goToFeedView($,!0)),text:""},{default:r(()=>[a(b,null,{default:r(()=>[a(S)]),_:1}),l("span",yf,d(s.feed.comments_count),1)]),_:1})]),l("div",vf,[a(C,{feed:s.feed,hide_create_form:s.hide_create_form,onUpdated:i.handleUpdate,onDeleted:i.handleDelete},null,8,["feed","hide_create_form","onUpdated","onDeleted"])])],8,nf)}const kf=I(of,[["render",bf]]),wf={name:"FeedListItem",components:{UserRouteLink:Ie,ChatIcon:tt,HeartIcon:st,StickyIcon:At},props:["feed"],computed:{feedRoute(){let e={name:"single_feed",params:{feed_slug:this.feed.slug}};return this.feed.space&&(e={name:"space_feed",params:{feed_slug:this.feed.slug,space:this.feed.space.slug}}),e}},data(){return{in_space:this.$route.params.space}},methods:{getFeedHref(){return this.hasFeature("show_post_modal")?null:this.$router.resolve(this.feedRoute).href},parseMessage(e){if(!e)return"";const t=this.$route.params.space?`${this.appVars.urls.portal_base}space/${this.$route.params.space}/home`:this.appVars.urls.global_search;return e.replace(/<a\s(?:(?!target="_blank")[^>])*>|<[^>]+>|#([\p{L}\p{M}\p{N}_-]+)/gu,(s,u,o,i)=>s.startsWith("<a")&&!s.includes('target="_blank"')?s.includes(window.location.origin)?s:s.replace("<a",'<a target="_blank" rel="noopener"'):u&&!this.isInsideHtmlTag(i,o)?`<a onclick="window.FluentCommunityUtil.handleSearchClick(event)" href="${t}?search=%23${u}">#${u}</a>`:s)},isInsideHtmlTag(e,t){let s=!1;for(let u=0;u<t;u++)e[u]==="<"&&(s=!0),e[u]===">"&&(s=!1);return s},goToFeedView(e,t=!1){if(this.hasFeature("show_post_modal")){this.feed.auto_focus_comment=t,this.$eventBus.emit("showFeedModal",{feed:this.feed,view:t?"comments":"",auto_focus_comment:t});return}e.ctrlKey||e.metaKey||(e.preventDefault(),window.__showing_feed=this.feed,this.$router.push(this.feedRoute))},toggleReact(){const e={react_type:"like"};this.feed.has_user_react&&(e.remove=!0),this.feed.has_user_react=!this.feed.has_user_react,this.$post("feeds/"+this.feed.id+"/react",e).then(t=>{this.feed.reactions_count=t.new_count}).catch(t=>{this.$handleError(t),this.feed.has_user_react=!this.feed.has_user_react})}}},Cf=["id"],$f={class:"fcom_feed_data"},Sf={key:0,class:"fcom_sticky"},Vf={class:"feed_user"},Mf=["href"],Tf=["href"],Lf={class:"fcom_feed_title_row"},Pf=["textContent"],Ff={key:0,class:"feed_status"},If={class:"fcom_feed_meta"},Ef={key:0},Uf={class:"feed_actions"},Af={class:"num_label"},Bf={class:"num_label"};function Df(e,t,s,u,o,i){var S,C,v;const m=p("StickyIcon"),f=O,h=p("UserAvatar"),g=Ue,k=p("HeartIcon"),b=H,w=p("ChatIcon");return n(),c("div",{id:"feed_id_"+((S=s.feed)==null?void 0:S.id),class:"fcom_feed_list"},[l("div",$f,[s.feed.is_sticky?(n(),c("div",Sf,[a(f,{class:"fcom_sticky"},{default:r(()=>[a(m)]),_:1})])):_("",!0),l("div",Vf,[l("a",{href:i.getFeedHref(),onClick:t[0]||(t[0]=(...$)=>i.goToFeedView&&i.goToFeedView(...$))},[a(h,{with_level:!1,xprofile:s.feed.xprofile},null,8,["xprofile"])],8,Mf)]),l("a",{href:i.getFeedHref(),onClick:t[1]||(t[1]=(...$)=>i.goToFeedView&&i.goToFeedView(...$)),class:"feed_body"},[l("div",Lf,[l("div",{class:"feed_texts feed_md_content",textContent:d(e.getExcerpt(s.feed.title||s.feed.message_rendered,250))},null,8,Pf),s.feed.status=="pending"?(n(),c("span",Ff,[a(g,{type:"warning"},{default:r(()=>[M(d(e.$t("In Review")),1)]),_:1})])):_("",!0)]),l("div",If,[M(d(((v=(C=s.feed)==null?void 0:C.xprofile)==null?void 0:v.display_name)||"No Name")+" • "+d(e.humanDateDiff(s.feed.created_at))+" ",1),!o.in_space&&s.feed.space?(n(),c("span",Ef,"• #"+d(s.feed.space.slug),1)):_("",!0)])],8,Tf)]),l("div",Uf,[a(b,{text:""},{default:r(()=>[a(f,{class:x({user_reacted:s.feed.has_user_react}),onClick:t[2]||(t[2]=$=>i.toggleReact())},{default:r(()=>[a(k,{filled:s.feed.has_user_react},null,8,["filled"])]),_:1},8,["class"]),l("span",Af,d(s.feed.reactions_count),1)]),_:1}),a(b,{onClick:t[3]||(t[3]=$=>i.goToFeedView($,!0)),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(w)]),_:1}),l("span",Bf,d(s.feed.comments_count),1)]),_:1})])],8,Cf)}const bo=I(wf,[["render",Df]]),Rf={name:"SwitchTimelineIcon"},xf={width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hf(e,t,s,u,o,i){return n(),c("svg",xf,[...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 Of=I(Rf,[["render",Hf]]),jf={name:"SwitchListIcon"},Nf={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",role:"img",color:"#666666"};function zf(e,t,s,u,o,i){return n(),c("svg",Nf,[...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 qf=I(jf,[["render",zf]]),Gf={name:"SwitchCardIcon"},Yf={xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"};function Wf(e,t,s,u,o,i){return n(),c("svg",Yf,[...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 Zf=I(Gf,[["render",Wf]]),Kf={name:"DoubleChevronUpIcon",props:{fill:{type:String,default:"currentColor"}}},Jf=["fill"];function Qf(e,t,s,u,o,i){return n(),c("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[l("path",{d:"M5 13L10 8L15 13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1),l("path",{d:"M5 8L10 3L15 8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",fill:"none"},null,-1)])],8,Jf)}const Xf=I(Kf,[["render",Qf]]),ep={name:"ScrollToTop",components:{DoubleChevronUpIcon:Xf},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)}},tp=["aria-label"],sp={class:"fcom_scroll_to_top_icon"};function op(e,t,s,u,o,i){const m=p("DoubleChevronUpIcon");return n(),y(As,{"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(()=>[o.visible?(n(),c("button",{key:0,type:"button",class:"fcom_scroll_to_top","aria-label":e.$t("Scroll to top"),onClick:t[0]||(t[0]=(...f)=>i.scrollToTop&&i.scrollToTop(...f))},[l("span",sp,[a(m)])],8,tp)):_("",!0)]),_:1})}const ip=I(ep,[["render",op]]),np={name:"AllFeeds",emits:["refetch","update:loading"],inheritAttrs:!1,setup(){const e=Te(),t=to();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:xt,Feed:nt,FeedCard:kf,FeedListItem:bo,SwitchTimelineIcon:Of,SwitchListIcon:qf,SwitchCardIcon:Zf,ScrollToTop:ip},watch:{space(e){this.canReuseCachedFeeds()?this.scheduleStalenessRefresh():this.fetchFeedsFromStore(),this.restoreLayoutPreference()},search(){this.fetchFeedsFromStore()},loading(e){this.$emit("update:loading",e)},topic_slug(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},"$route.query.search"(e){this.search=e||""}},computed:{feedContext(){let e;return this.space?e=`space-${this.space}`:this.user_id?e=`user-${this.user_id}`:e="global",this.context_suffix?`${e}:${this.context_suffix}`:e},feeds(){return this.feedStore.getFeedsByContext(this.feedContext)},sticky(){return this.feedStore.getStickyFeed(this.feedContext)},pagination(){return this.feedStore.getPagination(this.feedContext)},loading(){return this.feedStore.isLoading(this.feedContext)},execution_time(){return this.feedStore.getExecutionTime(this.feedContext)},disableAutoLoad(){return this.feedStore.disableAutoLoad(this.feedContext)},currentLayoutStyle(){return this.can_change_layout?this.custom_layout_style:this.layout_style},computedPostOrderOptions(){return this.user_id?this.appVars.user_post_order_by_options:this.appVars.post_order_by_options}},data(){return{appReady:!0,sort_by:"",search:this.$route.query.search||"",custom_layout_style:this.layout_style,disable_sticky:!1,boundHandler:null}},methods:{...zs(Te,["fetchFeeds","createFeed","updateFeed","deleteFeed","resetContext"]),currentFilterKey(){return JSON.stringify({search:this.search||"",order_by_type:this.sort_by||"",topic_slug:this.topic_slug||""})},canReuseCachedFeeds(){var t,s;const e=(t=this.feedStore.feedsByContext)==null?void 0:t[this.feedContext];return(s=e==null?void 0:e.data)!=null&&s.length?e.filterKey===this.currentFilterKey():!1},scheduleStalenessRefresh(){var s;this.feedStore.touchContext(this.feedContext);const t=(s=this.feedStore.feedsByContext)==null?void 0:s[this.feedContext];t!=null&&t.timestamp&&(Date.now()-t.timestamp<6e4||this.feedStore.softRefreshContext(this.feedContext,{feed_base_url:this.feed_base_url,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,search_in:this.searchIn}))},async fetchFeedsFromStore(e=!1){try{await this.feedStore.fetchFeeds(this.feedContext,{feed_base_url:this.feed_base_url,page:e?this.pagination.page:1,per_page:this.pagination.per_page||10,space:this.space,user_id:this.user_id,order_by_type:this.sort_by,search:this.search,disable_sticky:this.disable_sticky,topic_slug:this.topic_slug,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(s){this.$handleError(s)}},handleRemoveFromList(e){const t=this.feeds[e];t&&this.feedStore.deleteFeedsFromStore(this.feedContext,[t.id])},async handleUpdate(e,t){try{await this.feedStore.updateFeed(e.id,e)}catch(s){this.$handleError(s)}},handleLoadMore(){var o;if(this.disableAutoLoad)return!1;if(this.pagination.last_page==this.pagination.page)return;let e=document.querySelector(".all_feeds_holder .feed_outer:last-child");if(!e)return;let t=e.getBoundingClientRect(),s=(o=window.fcomLayoutRef)==null?void 0:o.wrapRef;!s||t.bottom-s.getBoundingClientRect().bottom-t.height>100||this.loading||this.fetchFeedsFromStore(!0)},resetFetch(){!this.hide_filters&&!this.default_search&&!this.user_id&&this.$storeLocalData("feed_sort_by",this.sort_by),this.disable_sticky="yes",this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},spaceChanged(){this.feedStore.resetContext(this.feedContext),this.fetchFeedsFromStore()},routeNewArticle(){this.space?this.$router.push({name:"space_write_article",params:{space:this.space}}):this.$router.push({name:"write_article"})},switchView(e){this.custom_layout_style!=e&&(this.custom_layout_style=e,this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")&&this.$storeLocalData("feed_layout_style_"+this.feed_name,e),this.$notify.success(this.$t("Layout changed")))},restoreLayoutPreference(){if(this.can_change_layout&&this.feed_name&&this.hasFeature("can_switch_layout")){let e=this.$getLocalData("feed_layout_style_"+this.feed_name);this.custom_layout_style=e||this.layout_style}else this.custom_layout_style=this.layout_style}},created(){if(this.default_search&&(this.search=this.default_search),this.default_order_by&&!this.can_change_order?this.sort_by=this.default_order_by:!this.hide_filters&&!this.default_search&&(this.user_id?this.sort_by="":this.sort_by=this.$getLocalData("feed_sort_by")||""),this.$route.query.sort_by&&(this.sort_by=this.$route.query.sort_by),this.sort_by||(this.sort_by=this.default_order_by||"latest"),this.canReuseCachedFeeds()){this.scheduleStalenessRefresh();return}this.fetchFeedsFromStore()},mounted(){this.restoreLayoutPreference(),this.boundHandler=this.handleLoadMore.bind(this),document.addEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.on("doGlobalSearch",e=>{this.loading||this.search!=e&&(this.search=e,this.pagination.page=1,this.$router.push({query:{search:e}}))})},beforeUnmount(){this.$eventBus.emit("leaving_all_feeds"),document.removeEventListener("fcom_layout_scroll",this.boundHandler),this.$eventBus.off("doGlobalSearch"),this.feeds&&this.feeds.length>50&&this.feedStore.pruneOldFeeds()}},lp={key:1,class:"feed_filters"},ap={id:"feed_short_by",class:"fcom_feed_filter_label"},rp={key:1,class:"fcom_layout_switch"},cp={class:"fcom_icon_menu"},dp={class:"fcom_icon_menu"},up={class:"fcom_icon_menu"},_p={key:2,style:{margin:"0 0 10px"},class:"fcom_search_result_num"},mp={key:0},hp={key:3,class:"fcom_sticky_feed"},fp={class:"all_feeds_holder"},pp={key:0,style:{"margin-top":"20px","text-align":"center"}},gp={key:5},yp={class:"feed_outer"},vp={class:"feed"},bp={style:{"text-align":"center"},class:"feed_body not_found"},kp={key:0},wp={key:1},Cp={key:2};function $p(e,t,s,u,o,i){const m=p("create-status-form"),f=ie,h=ne,g=p("SwitchCardIcon"),k=p("SwitchListIcon"),b=p("SwitchTimelineIcon"),w=O,S=H,C=Je,v=Qe,$=Xe,T=p("feed"),V=p("FeedListItem"),F=p("FeedCard"),L=Z,A=p("ScrollToTop");return n(),c(P,null,[G(e.$slots,"before_create_form"),!s.hide_create_form&&e.auth.user_id?(n(),y(m,{key:0,space:s.space,btn_text:e.$t("Post")},null,8,["space","btn_text"])):_("",!0),G(e.$slots,"before_feeds"),s.hide_filters?_("",!0):(n(),c("div",lp,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),s.can_change_order?(n(),c(P,{key:0},[l("span",ap,d(e.$t("Sort by:")),1),a(h,{modelValue:o.sort_by,"onUpdate:modelValue":t[0]||(t[0]=D=>o.sort_by=D),"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]=D=>i.handleSortByChange())},{default:r(()=>[(n(!0),c(P,null,R(i.computedPostOrderOptions,(D,U)=>(n(),y(f,{key:U,value:U,label:D},null,8,["value","label"]))),128))]),_:1},8,["modelValue","aria-label","placeholder"])],64)):_("",!0),s.can_change_layout&&s.feed_name&&e.hasFeature("can_switch_layout")?(n(),c("div",rp,[a($,{"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(v,{class:"fcom_layout_dropdown_menu"},{default:r(()=>[a(C,{onClick:t[2]||(t[2]=D=>i.switchView("card")),class:x({selected_layout:o.custom_layout_style==="card"})},{default:r(()=>[l("div",cp,[a(g),l("span",null,d(e.$t("Card")),1)])]),_:1},8,["class"]),a(C,{onClick:t[3]||(t[3]=D=>i.switchView("list")),class:x({selected_layout:o.custom_layout_style==="list"})},{default:r(()=>[l("div",dp,[a(k),l("span",null,d(e.$t("List")),1)])]),_:1},8,["class"]),a(C,{onClick:t[4]||(t[4]=D=>i.switchView("timeline")),class:x({selected_layout:o.custom_layout_style==="timeline"})},{default:r(()=>[l("div",up,[a(b),l("span",null,d(e.$t("Timeline")),1)])]),_:1},8,["class"])]),_:1})]),default:r(()=>[a(S,{type:"info",text:"",title:e.$t("Switch Layout View")},{default:r(()=>[a(w,{class:x(["fcom_layout_icon",o.custom_layout_style])},{default:r(()=>[o.custom_layout_style=="card"?(n(),y(g,{key:0})):o.custom_layout_style=="list"?(n(),y(k,{key:1})):(n(),y(b,{key:2}))]),_:1},8,["class"])]),_:1},8,["title"])]),_:1})])):_("",!0)])),i.pagination.total&&o.search?(n(),c("div",_p,[M(d(e.$_n("%s result found","%s results found",i.pagination.total))+" ",1),i.execution_time?(n(),c("span",mp,d(e.$t("in %ss",i.execution_time.toFixed(2))),1)):_("",!0)])):_("",!0),i.sticky?(n(),c("div",hp,[a(T,{onReload:t[5]||(t[5]=D=>{i.sticky=null,e.fetchFeeds()}),onFeedUpdated:t[6]||(t[6]=D=>{i.sticky=D}),onDeleted:t[7]||(t[7]=()=>{i.sticky=null}),feed:i.sticky,show_report:!0,isSingleSpacePage:!!s.space},null,8,["feed","isSingleSpacePage"])])):_("",!0),i.feeds.length?(n(),c("div",{key:4,ref:"all_feeds_wrap",class:x(["fcom_feed_style_"+i.currentLayoutStyle,"all_feeds"])},[l("div",fp,[(n(!0),c(P,null,R(i.feeds,(D,U)=>(n(),c("div",{key:D.id,class:"feed_outer"},[i.currentLayoutStyle=="list"?(n(),y(V,{key:0,feed:D},null,8,["feed"])):i.currentLayoutStyle=="card"?(n(),y(F,{key:1,feed:D,hide_create_form:s.hide_create_form,onUpdated:E=>i.handleUpdate(E,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","hide_create_form","onUpdated","onDeleted","onRemoved"])):(n(),y(T,{key:2,feed:D,isSingleSpacePage:!!s.space,show_report:!0,layout_style:i.currentLayoutStyle,hide_create_form:s.hide_create_form,onUpdated:E=>i.handleUpdate(E,U),onDeleted:()=>i.handleDelete(U),onRemoved:()=>i.handleRemoveFromList(U)},null,8,["feed","isSingleSpacePage","layout_style","hide_create_form","onUpdated","onDeleted","onRemoved"]))]))),128))]),i.pagination.has_more!==!1?(n(),c("div",pp,[a(S,{class:"fcom_secondary_button",disabled:i.loading,loading:i.loading,onClick:t[8]||(t[8]=D=>i.fetchFeedsFromStore(!0))},{default:r(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)],2)):!i.loading&&!i.sticky?(n(),c("div",gp,[l("div",yp,[l("div",vp,[l("div",bp,[o.search?(n(),c("p",kp,d(e.$t("No results found based on your search criteria")),1)):s.topic_slug?(n(),c("p",wp,d(e.$t("No posts found for the selected topic")),1)):(n(),c("p",Cp,d(e.$t("No posts found!")),1))])])])])):_("",!0),i.loading&&!i.feeds.length?(n(),c(P,{key:6},[a(L,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5}),i.pagination.page==1?(n(),c(P,{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(A,{threshold:500})],64)}const yt=I(np,[["render",$p]]),Sp={name:"SearchBar",components:{SpaceIcon:Ye,AllFeeds:yt,SearchIcon:Ee,Loading:ri},data(){return{search:"",SearchIcon:ts(Ee),showingSearch:!1,perform_search:!1,searching:!1,searchGroups:[],search_space:"__all__",searchIn:["post_content"]}},computed:{placeholder(){return this.search_space!="__all__"?this.$t("Search in %s","#"+this.search_space):this.$t("Search here...")}},methods:{onRouteUpdated(){this.showingSearch=!1},initSearch(){this.openSearch()},openSearch(){this.search||(this.perform_search=!1,this.search_space=this.$route.params.space||"__all__",this.searchIn=["post_content"]),this.showingSearch=!0,this.handleOpen()},toSearch(){if(!this.search){this.perform_search=!1;return}if(this.perform_search&&this.$refs.feedsRef){this.$refs.feedsRef.search=this.search;return}this.perform_search=!0},onClear(){this.search="",this.perform_search=!1},handleScroll(e){if(this.$refs.feedsScroller.wrapRef.scrollHeight-this.$refs.feedsScroller.wrapRef.clientHeight-e.scrollTop<100){let s=this.$refs.feedsRef;!s.loading&&s.pagination.page<s.pagination.last_page&&(s.pagination.page++,s.fetchFeeds(!0))}},keyBind(e){e.key==="k"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.showingSearch?this.showingSearch=!1:this.openSearch())},handleOpen(){this.formatSearchGroups()},focusInput(){this.$refs.seatch_input&&this.$refs.seatch_input.focus()},formatSearchGroups(){if(this.searchGroups.length)return;let e=this.appVars.auth.spaces;e=Object.values(e);let t=this.appVars.space_groups,s=[];this.each(t,u=>{let o=e.filter(i=>i.parent_id==u.id&&i.permissions&&i.permissions.can_view_posts);o.length&&s.push({label:u.title,spaces:o})}),this.searchGroups=s}},mounted(){document.addEventListener("keydown",this.keyBind),this.$eventBus.on("route_updated",this.onRouteUpdated)},beforeUnmount(){document.removeEventListener("keydown",this.keyBind),this.$eventBus.off("route_updated",this.onRouteUpdated)}},Vp=["aria-label"],Mp={class:"fcom_search_header"},Tp={key:0,class:"fcom_space_title"},Lp={key:1},Pp={style:{display:"flex","align-items":"center","flex-wrap":"wrap",gap:"10px",margin:"10px 20px 0","justify-content":"center"}},Fp={key:0,class:"fcom_search_results"},Ip={key:1,class:"fcom_search_welcome"};function Ep(e,t,s,u,o,i){const m=p("SearchIcon"),f=O,h=p("Loading"),g=ie,k=p("SpaceIcon"),b=$t,w=ne,S=te,C=fe,v=Rs,$=p("all-feeds"),T=Ce,V=we;return n(),c(P,null,[l("button",{class:"fcom_menu_button","aria-label":e.$t("Search"),onClick:t[0]||(t[0]=F=>i.initSearch())},[a(f,{id:"fcom_search_icon",class:"fcom_search_icon"},{default:r(()=>[a(m)]),_:1})],8,Vp),o.showingSearch?(n(),y(V,{key:0,top:"60px","append-to-body":!0,"lock-scroll":!0,"modal-class":"fcom_search_bar_visible",onOpened:i.focusInput,modelValue:o.showingSearch,"onUpdate:modelValue":t[5]||(t[5]=F=>o.showingSearch=F),"show-close":!1,style:{"max-width":"700px"},width:e.drawerWidth},{header:r(()=>[l("div",Mp,[a(S,{ref:"seatch_input",size:"large",type:"search",autocomplete:"off",inputmode:"search",modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=F=>o.search=F),placeholder:i.placeholder,onKeyup:ae(i.toSearch,["enter"]),onClear:i.onClear,clearable:""},ve({prefix:r(()=>[a(f,{onClick:i.toSearch},{default:r(()=>[a(m)]),_:1},8,["onClick"])]),append:r(()=>[a(w,{class:"fcom_minimal_select fcom_global_search_append",modelValue:o.search_space,"onUpdate:modelValue":t[1]||(t[1]=F=>o.search_space=F),placeholder:e.$t("All Posts"),style:{width:"100px"}},{default:r(()=>[a(g,{label:e.$t("All Posts"),value:"__all__"},null,8,["label"]),(n(!0),c(P,null,R(o.searchGroups,F=>(n(),y(b,{key:F.label,label:F.label},{default:r(()=>[(n(!0),c(P,null,R(F.spaces,L=>(n(),y(g,{key:L.slug,label:L.title,value:L.slug},{default:r(()=>[L.id?(n(),c("span",Tp,[a(k,{space_profile:L},null,8,["space_profile"]),l("span",null,d(e.getExcerpt(L.title,30)),1)])):(n(),c("span",Lp,d(e.getExcerpt(L.title,30)),1))]),_:2},1032,["label","value"]))),128))]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:2},[o.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",Pp,[l("span",null,d(e.$t("Search in:")),1),a(v,{modelValue:o.searchIn,"onUpdate:modelValue":t[3]||(t[3]=F=>o.searchIn=F),class:"fcom_search_in"},{default:r(()=>[a(C,{value:"post_content",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Post Title & Content")),1)]),_:1}),a(C,{value:"post_comments",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Comments")),1)]),_:1})]),_:1},8,["modelValue"])])])]),default:r(()=>[o.perform_search?(n(),c("div",Fp,[a(T,{ref:"feedsScroller",onScroll:i.handleScroll,style:{"padding-right":"20px"},height:"70vh"},{default:r(()=>[a($,{searchIn:o.searchIn,layout_style:"list",feed_name:"search_results",context_suffix:"search",space:o.search_space!="__all__"?o.search_space:"",ref:"feedsRef",default_search:o.search,hide_filters:!1,hide_create_form:!0,"onUpdate:loading":t[4]||(t[4]=F=>o.searching=F)},null,8,["searchIn","space","default_search"])]),_:1},8,["onScroll"])])):(n(),c("div",Ip,[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,[M(d(e.$t("Tip: Quick-launch search with"))+" ",1),t[6]||(t[6]=l("b",null,"⌘ + K",-1)),M(" (Mac) "+d(e.$t("or"))+" ",1),t[7]||(t[7]=l("b",null,"Ctrl + K",-1)),t[8]||(t[8]=M(" (Windows/Linux)",-1))])]))]),_:1},8,["onOpened","modelValue","width"])):_("",!0)],64)}const Up=I(Sp,[["render",Ep]]),Ap={name:"Drawer",emits:["update:modelValue"],props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},size:{type:String,default:"40%"},direction:{type:String,default:"right",validator:e=>["left","right","top","bottom"].includes(e)},closeOnClickModal:{type:Boolean,default:!1},appendToBody:{type:Boolean,default:!1},destroyOnClose:{type:Boolean,default:!1},modal:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},withHeader:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},zIndex:{type:Number,default:null},id:{type:String,default:""},modalClass:{type:String,default:"fcom_common_dialog"},drawerClass:{type:String,default:"fcom_high_drawer"},headerClass:{type:String,default:""},bodyClass:{type:String,default:""},footerClass:{type:String,default:""},hasCloseConfirmation:{type:Boolean,default:!1},closeConfirmationMessage:{type:String,default:""},confirmLeaveAction:{type:Function,default:null},cancelLeaveAction:{type:Function,default:null},beforeClose:{type:Function,default:null}},computed:{elDirection(){return{left:"ltr",right:"rtl",top:"ttb",bottom:"btt"}[this.direction]||"rtl"}},methods:{handleBeforeClose(e){const t=()=>{this.beforeClose?this.beforeClose(e):e()};if(this.hasCloseConfirmation){const s=this.closeConfirmationMessage||this.$t("Are you sure you want to close this?");this.$confirm(s,this.$t("Confirm"),{confirmButtonText:this.$t("Yes"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.confirmLeaveAction&&this.confirmLeaveAction(),t()}).catch(()=>{this.cancelLeaveAction&&this.cancelLeaveAction()})}else t()}}},Bp=["id"];function Dp(e,t,s,u,o,i){const m=St;return n(),y(m,No({"model-value":s.modelValue,"onUpdate:modelValue":t[0]||(t[0]=f=>e.$emit("update:modelValue",f)),direction:i.elDirection,size:s.size,modal:s.modal,"modal-class":s.modalClass,class:s.drawerClass,"close-on-click-modal":s.closeOnClickModal,"append-to-body":s.appendToBody,"destroy-on-close":s.destroyOnClose,"show-close":s.showClose,"with-header":s.withHeader,"lock-scroll":s.lockScroll,"open-delay":s.openDelay,"close-delay":s.closeDelay},s.zIndex!==null?{"z-index":s.zIndex}:{},{id:s.id,"before-close":i.handleBeforeClose}),ve({default:r(()=>[l("div",{class:x(s.bodyClass)},[G(e.$slots,"default")],2)]),_:2},[s.withHeader?{name:"header",fn:r(({close:f,titleId:h,titleClass:g})=>[G(e.$slots,"header",{close:f,titleId:h,titleClass:g},()=>[s.title?(n(),c("h4",{key:0,id:h,class:x([g,s.headerClass]),style:{margin:"0"}},d(s.title),11,Bp)):_("",!0)])]),key:"0"}:void 0,e.$slots.footer?{name:"footer",fn:r(()=>[l("div",{class:x(s.footerClass)},[G(e.$slots,"footer")],2)]),key:"1"}:void 0]),1040,["model-value","direction","size","modal","modal-class","class","close-on-click-modal","append-to-body","destroy-on-close","show-close","with-header","lock-scroll","open-delay","close-delay","id","before-close"])}const ko=I(Ap,[["render",Dp]]);const Rp={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])}}},xp={class:"fcom_svg_generator"},Hp={class:"fcom_form_item"},Op={class:"fcom_form_item"},jp=["innerHTML"];function Np(e,t,s,u,o,i){const m=Vt,f=ze,h=ke;return n(),c("div",xp,[l("div",Hp,[l("label",null,d(e.$t("Select Shape Color:")),1),a(m,{predefine:e.appVars.suggestedColors,modelValue:o.currentColor,"onUpdate:modelValue":t[0]||(t[0]=g=>o.currentColor=g),onActiveChange:i.colorChanged,size:"large","show-alpha":""},null,8,["predefine","modelValue","onActiveChange"])]),l("div",Op,[l("label",null,d(e.$t("Select Shape:")),1),a(h,{onChange:t[1]||(t[1]=g=>i.selectShape(o.selectedShape)),modelValue:o.selectedShape,"onUpdate:modelValue":t[2]||(t[2]=g=>o.selectedShape=g)},{default:r(()=>[(n(!0),c(P,null,R(i.svgShapes,(g,k)=>(n(),y(f,{key:k,value:k},{default:r(()=>[l("div",{innerHTML:g},null,8,jp)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])])])}const zp=I(Rp,[["render",Np]]),qp={name:"LogoEmojiSelector",components:{EmojiPicker:ro,ImageUploader:He,SvgShapeGenerator:zp,ActionPopover:pt},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"}}},Gp=["innerHTML"];function Yp(e,t,s,u,o,i){const m=H,f=p("EmojiPicker"),h=te,g=Mt,k=p("SvgShapeGenerator"),b=Fe,w=p("ImageUploader"),S=Tt,C=p("action-popover");return n(),y(C,{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:i.currentMark||""},null,8,Gp)]),_:1})]),default:r(({hide:v})=>[l("div",null,[a(S,{modelValue:o.selectedTab,"onUpdate:modelValue":t[5]||(t[5]=$=>o.selectedTab=$),type:"border-card"},{default:r(()=>[a(g,{name:"emoji",label:e.$t("Emoji")},{default:r(()=>[a(h,{onChange:t[1]||(t[1]=$=>i.setData("emoji")),modelValue:o.emoji,"onUpdate:modelValue":t[2]||(t[2]=$=>o.emoji=$),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]=$=>{o.emoji=$,i.setData("emoji")})})]),key:"0"}:void 0]),1032,["modelValue","placeholder"])]),_:1},8,["label"]),a(g,{name:"shape",label:e.$t("Shape")},{default:r(()=>[a(k,{onUpdate:i.handleShapeChanged},null,8,["onUpdate"])]),_:1},8,["label"]),s.custom_svg?(n(),y(g,{key:0,name:"shape_svg",label:e.$t("Custom SVG")},{default:r(()=>[a(h,{rows:4,type:"textarea",onChange:t[3]||(t[3]=$=>i.setData("shape_svg")),modelValue:o.shape_svg,"onUpdate:modelValue":t[4]||(t[4]=$=>o.shape_svg=$),placeholder:e.$t("Paste your SVG here"),style:{width:"100%"}},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(g,{name:"logo",label:e.$t("Custom Image")},{default:r(()=>[o.logo?(n(),y(b,{key:0,alt:e.$t("Logo"),src:o.logo,style:{"max-width":"100px"}},null,8,["alt","src"])):_("",!0),a(w,{can_remove:!!o.logo,additionalData:{resize:!0,max_width:400},onUploaded:i.handleLogoPhotoUpload},null,8,["can_remove","onUploaded"])]),_:1},8,["label"])]),_:1},8,["modelValue"]),a(m,{onClick:$=>v(),type:"success",plain:"",class:"fcom_mt_20"},{default:r(()=>[M(d(e.$t("Close")),1)]),_:1},8,["onClick"])])]),_:1},8,["width"])}const Ht=I(qp,[["render",Yp]]),Wp={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})}}},Zp={key:0,class:"fcom_slug_input_info"},Kp=["innerHTML"],Jp={key:1,class:"fcom_help_text"};function Qp(e,t,s,u,o,i){const m=H,f=te;return n(),c(P,null,[a(f,{class:"fcom_slug_input",disabled:s.disabled,readonly:o.showEdit,modelValue:o.model,"onUpdate:modelValue":t[1]||(t[1]=h=>o.model=h),ref:"input",placeholder:s.placeholder,onInput:i.updateSlug},ve({_:2},[s.prefix?{name:"prepend",fn:r(()=>[l("span",null,d(s.prefix),1)]),key:"0"}:void 0,o.showEdit?{name:"append",fn:r(()=>[a(m,{onClick:t[0]||(t[0]=h=>i.confirmEditInit()),text:"",type:"info"},{default:r(()=>[M(d(e.$t("change")),1)]),_:1})]),key:"1"}:void 0]),1032,["disabled","readonly","modelValue","placeholder","onInput"]),!o.showEdit&&s.edit_notice?(n(),c("div",Zp,[l("p",{innerHTML:s.edit_notice},null,8,Kp)])):_("",!0),s.description?(n(),c("div",Jp,[l("p",null,d(s.description),1)])):_("",!0)],64)}const Ot=I(Wp,[["render",Qp]]),Xp={name:"ErrorAlerts",props:{errors:{type:Array,default:()=>[]},dismissable:{type:Boolean,default:!1}},data(){return{dismissed:!1}},watch:{errors(){this.dismissed=!1}}},e1={class:"fcom_errors_alert_list"};function t1(e,t,s,u,o,i){const m=xs;return s.errors.length&&!o.dismissed?(n(),y(m,{key:0,type:"warning",closable:s.dismissable,"show-icon":"",onClose:t[0]||(t[0]=f=>o.dismissed=!0)},{title:r(()=>[l("ul",e1,[(n(!0),c(P,null,R(s.errors,(f,h)=>(n(),c("li",{key:h},d(f),1))),128))])]),_:1},8,["closable"])):_("",!0)}const jt=I(Xp,[["render",t1]]),be=e=>{var t,s;return((s=(t=window.fluentComAdmin)==null?void 0:t.i18n)==null?void 0:s[e])||e},s1=e=>{const t=[];return!e||!e.trim()?(t.push(be("Path cannot be empty.")),{valid:!1,type:"path",errors:t}):(e=e.trim(),e.startsWith("/")||t.push(be("Path must start with /")),/\s/.test(e)&&t.push(be("Path cannot contain spaces.")),/[<>{}|\\^`"']/.test(e)&&t.push(be("Path contains invalid characters: < > { } | \\ ^ ` \" '")),e.includes("..")&&t.push(be('Path cannot contain ".." (directory traversal).')),/#.*#/.test(e)&&t.push(be("Path cannot contain multiple hash fragments.")),{valid:t.length===0,type:"path",errors:t})},wo=e=>{const t=[];if(!e||!e.trim())return t.push(be("URL cannot be empty.")),{valid:!1,type:"url",errors:t};if(e=e.trim(),!/^https?:\/\//i.test(e))return t.push(be("URL must start with http:// or https://")),{valid:!1,type:"url",errors:t};/\s/.test(e)&&t.push(be("URL cannot contain spaces."));const s=e.replace(/^https?:\/\//i,"");(!s||s==="/")&&t.push(be("URL must have a domain name (e.g. example.com)."));const u=s.split("/")[0].split("?")[0].split("#")[0],o=u.split(":")[0];if(!(o==="localhost"||o.startsWith("localhost."))&&!/^[a-zA-Z0-9][a-zA-Z0-9\-]*(\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,}$/.test(o)&&t.push(be("Domain must include a valid TLD (e.g. .com, .org).")),/[^a-zA-Z0-9.\-:]/.test(u)&&t.push(be("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(be("Port must be a number (e.g. :8080)."))}return(/javascript:/i.test(e)||/data:/i.test(e)||/vbscript:/i.test(e))&&t.push(be("URL contains a blocked protocol (javascript:, data:, vbscript:).")),{valid:t.length===0,type:"url",errors:t}},Nt=e=>!e||!e.trim()?{valid:!1,type:null,errors:[be("URL or path cannot be empty.")]}:(e=e.trim(),e.startsWith("/")?s1(e):wo(e)),o1={name:"TopicSelector",props:["modelValue","creatable","space_id"],emits:["update:modelValue"],components:{SlugInput:Ot,ActionPopover:pt,ErrorAlerts:jt},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=Nt("/"+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(s=>{this.$notify.success(s.message),this.fetchTopics(),this.selected.push(s.topic.id),e()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.creatingTopic=!1})}},watch:{selected(){this.$emit("update:modelValue",this.selected)}},mounted(){this.fetchTopics()}},i1={class:"fcom_topic_selector"},n1={key:0,class:"fcom_meta_text"};function l1(e,t,s,u,o,i){const m=ie,f=ne,h=p("Plus"),g=O,k=H,b=te,w=ue,S=p("slug-input"),C=p("error-alerts"),v=_e,$=p("action-popover"),T=ee("loading");return n(),c("div",i1,[Y((n(),y(f,{modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=V=>o.selected=V),"popper-class":"fcom_topics_from_settings",style:{width:"100%"},filterable:!0,multiple:!0,clearable:"","multiple-limit":i.maxTopicsPerSpace,placeholder:i.getTopicsPlaceholder()},{default:r(()=>[(n(!0),c(P,null,R(o.topics,V=>(n(),y(m,{key:V.slug,label:V.title,value:V.id},{default:r(()=>[l("span",null,d(V.title),1),V.description?(n(),c("span",n1,d(V.description),1)):_("",!0)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","multiple-limit","placeholder"])),[[T,o.loading]]),e.isAdmin()&&s.creatable?(n(),y($,{key:0,placement:"left",width:400,onShow:i.initCreatetopic},{trigger:r(()=>[a(k,{disabled:i.isTopicLimitReached,class:"fcom_secondary_button"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1},8,["disabled"])]),default:r(({hide:V})=>[a(v,{modelValue:o.newTopic,"onUpdate:modelValue":t[4]||(t[4]=F=>o.newTopic=F),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[a(w,{label:e.$t("Title"),required:""},{default:r(()=>[a(b,{modelValue:o.newTopic.title,"onUpdate:modelValue":t[1]||(t[1]=F=>o.newTopic.title=F),placeholder:e.$t("Title of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(w,{label:e.$t("Slug (optional)")},{default:r(()=>[a(S,{modelValue:o.newTopic.slug,"onUpdate:modelValue":t[2]||(t[2]=F=>o.newTopic.slug=F),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(w,{label:e.$t("Description (optional)")},{default:r(()=>[a(b,{modelValue:o.newTopic.description,"onUpdate:modelValue":t[3]||(t[3]=F=>o.newTopic.description=F),type:"textarea",rows:3,placeholder:e.$t("Description of the topic")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{errors:o.newTopicErrors,style:{"margin-bottom":"16px"}},null,8,["errors"]),a(w,null,{default:r(()=>[a(k,{class:"fcom_primary_button",onClick:F=>i.createTopic(V),loading:o.creatingTopic},{default:r(()=>[M(d(e.$t("Create")),1)]),_:1},8,["onClick","loading"])]),_:2},1024)]),_:2},1032,["modelValue"])]),_:1},8,["onShow"])):_("",!0)])}const Co=I(o1,[["render",l1]]),a1={name:"ListViewIcon"},r1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c1(e,t,s,u,o,i){return n(),c("svg",r1,[...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 d1=I(a1,[["render",c1]]),u1={name:"TimelineViewIcon"},_1={width:"160",height:"158",viewBox:"0 0 160 158",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m1(e,t,s,u,o,i){return n(),c("svg",_1,[...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 h1=I(u1,[["render",m1]]),f1={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 p1(e,t,s,u,o,i){const m=ie,f=ne,h=ee("loading");return Y((n(),y(f,{placeholder:e.$t("Select Menu Group"),clearable:"",modelValue:o.selected,"onUpdate:modelValue":t[0]||(t[0]=g=>o.selected=g)},{default:r(()=>[(n(!0),c(P,null,R(o.groups,g=>(n(),y(m,{key:g.id,value:g.id.toString(),label:g.title},null,8,["value","label"]))),128))]),_:1},8,["placeholder","modelValue"])),[[h,o.loading]])}const ps=I(f1,[["render",p1]]),g1={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)}}},y1={class:"fcom_form_builder"},v1=["innerHTML"],b1={key:8},k1={key:9,class:"fcom_help_text"},w1=["innerHTML"];function C1(e,t,s,u,o,i){const m=te,f=Re,h=ke,g=ie,k=ne,b=fe,w=Rs,S=Ke,C=Vt,v=ue,$=H,T=_e;return n(),c("div",y1,[a(T,{"label-position":"top",model:s.formData,onSubmit:z(e.doNothing,["prevent"])},{default:r(()=>[(n(!0),c(P,null,R(s.formFields,(V,F)=>(n(),y(v,{key:e.index,label:V.label},ve({default:r(()=>[V.type=="text"?(n(),y(m,{key:0,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L,placeholder:V.placeholder,type:V.data_type||"text"},null,8,["modelValue","onUpdate:modelValue","placeholder","type"])):V.type=="radio"?(n(),y(h,{key:1,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L},{default:r(()=>[(n(!0),c(P,null,R(V.options,(L,A)=>(n(),y(f,{key:A,value:L.value,label:L.label},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="select"?(n(),y(k,{key:2,class:"fcom_select",multiple:V.is_multiple,clearable:"",filterable:"",modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L,placeholder:V.placeholder},{default:r(()=>[(n(!0),c(P,null,R(V.options,(L,A)=>(n(),y(g,{key:A,label:L.label,value:L.value},null,8,["label","value"]))),128))]),_:2},1032,["multiple","modelValue","onUpdate:modelValue","placeholder"])):V.type=="checkbox"?(n(),y(w,{key:3,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L},{default:r(()=>[(n(!0),c(P,null,R(V.options,(L,A)=>(n(),y(b,{key:A,value:L.value,label:L.label,class:"fcom_checkbox"},null,8,["value","label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V.type=="inline_checkbox"?(n(),y(b,{key:4,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L,"true-value":V.true_value||"yes","false-value":V.false_value||"no",class:"fcom_checkbox"},{default:r(()=>[M(d(V.checkbox_label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","true-value","false-value"])):V.type=="date"?(n(),y(S,{key:5,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L,type:V.data_type||"date","value-format":V.value_format||"YYYY-MM-DD",format:V.value_format||"YYYY-MM-DD",placeholder:V.placeholder},null,8,["modelValue","onUpdate:modelValue","type","value-format","format","placeholder"])):V.type=="color_picker"?(n(),y(C,{key:6,modelValue:s.formData[F],"onUpdate:modelValue":L=>s.formData[F]=L},null,8,["modelValue","onUpdate:modelValue"])):V.type=="raw_html"?(n(),c("div",{key:7,innerHTML:V.content},null,8,v1)):(n(),c("div",b1,[l("pre",null,d(V),1)])),V.help_text?(n(),c("div",k1,[l("p",{innerHTML:V.help_text},null,8,w1)])):_("",!0)]),_:2},[V.label?{name:"label",fn:r(()=>[M(d(V.label),1)]),key:"0"}:void 0]),1032,["label"]))),128)),s.disableSubmit?_("",!0):(n(),y(v,{key:0},{default:r(()=>[a($,{class:"fcom_primary_button",onClick:z(i.handleSubmit,["prevent"])},{default:r(()=>[M(d(s.submitButtonText),1)]),_:1},8,["onClick"])]),_:1}))]),_:1},8,["model","onSubmit"])])}const $o=I(g1,[["render",C1]]),$1={name:"CardViewIcon"},S1={xmlns:"http://www.w3.org/2000/svg",width:"160",height:"158",viewBox:"0 0 160 158",fill:"none"};function V1(e,t,s,u,o,i){return n(),c("svg",S1,[...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 M1=I($1,[["render",V1]]),T1={name:"CreateSpaceForm",emits:["completed"],components:{SpaceGroupSelector:ps,SlugInput:Ot,ImageUploader:He,LogoEmojiSelector:Ht,TopicSelector:Co,ListViewIcon:d1,TimelineViewIcon:h1,FormBuilder:$o,ErrorAlerts:jt,CardViewIcon:M1},props:{community:{required:!1,default:null},parent_id:{required:!1,default:null},savingCount:{required:!1,default:0},disable_redirect:{required:!1,default:!1}},data(){return{saving:!1,privacies:ho,formErrors:[],form:{title:"",slug:"",privacy:"private",parent_id:"",description:"",settings:{custom_lock_screen:"no",restricted_post_only:"no",emoji:"🚀",shape_svg:"",can_request_join:"yes",layout_style:"timeline",disable_layout_style:"no",show_sidebar:"yes",members_page_status:"members_only",document_library:"no",document_access:"members_only",media_gallery:"no",media_access:"members_only",document_upload:"admin_only"},topic_ids:[]},dataLoaded:!1,showingSections:["basic"],postOrderOptions:this.appVars.post_order_by_options,commentOrderOptions:this.appVars.comment_order_by_options,metaSettings:null,fetchingMetaBoxes:!1}},watch:{savingCount(){this.submit()}},computed:{isDefaultLockscreen(){return this.form.settings.custom_lock_screen=="no"&&this.form.privacy=="private"}},methods:{goToCustomization(){this.validateForm()&&(this.showingSections=["customization"])},getValidationErrors(){var t,s;const e=[];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=Nt("/"+this.form.slug);u.valid||u.errors.forEach(o=>e.push(this.$t(o)))}return((t=this.form.settings)==null?void 0:t.topic_required)==="yes"&&!((s=this.form.topic_ids)!=null&&s.length)&&e.push(this.$t("Please select at least one topic when members are required to select a topic.")),e},validateForm(){return this.formErrors=this.getValidationErrors(),this.formErrors.length===0},submit(){if(this.form.id){const u=this.getValidationErrors();if(u.length){this.$notify.error(u[0]);return}}else if(!this.validateForm())return;this.saving=!0;let e="spaces",t={space:this.form},s=this.$post;if(this.form.id&&(e+="/"+this.form.id+"/by-id",t={space_id:this.form.id,data:{slug:this.form.slug,title:this.form.title,privacy:this.form.privacy,description:this.form.description,group_chat_support:this.form.group_chat_support,settings:this.form.settings,logo:this.form.logo,parent_id:this.form.parent_id??"",cover_photo:this.form.cover_photo,topic_ids:this.form.topic_ids}},s=this.$put,this.metaSettings)){let u={};this.each(this.metaSettings,(o,i)=>{u[i]=o.settings}),t.meta_settings=u}s(e,t).then(u=>{if(this.$eventBus.emit("reloadMenu"),!this.form.id&&!this.disable_redirect){let o=this.$router.resolve({name:"space_feeds",params:{space:u.space.slug}}).href;window.location.href=o;return}this.$notify.success(u.message),this.$emit("completed",u.space),u.redirect_url&&!this.disable_redirect&&(window.location.href=u.redirect_url)}).catch(u=>{this.form.id||(this.showingSections=["basic"]),this.$handleError(u)}).finally(()=>{this.saving=!1})},handleCoverPhotoUpload(e){this.form.cover_photo=e},handleLogoPhotoUpload(e){this.form.logo=e},fetchMetaBoxes(){this.community.id&&(this.fetchingMetaBoxes=!0,this.$get("spaces/"+this.community.slug+"/meta-settings",{space_id:this.community.id}).then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))}},mounted(){if(this.community&&this.community.id){this.community.chat_thread_id&&(this.community.group_chat_support="yes"),this.form=this.community;let e=[];this.community.topics&&this.each(this.community.topics,t=>{e.push(t.id)}),this.form.topic_ids=e,this.fetchMetaBoxes(this.community.id)}else this.parent_id?this.form.parent_id=this.parent_id:this.$route.query.parent_id&&(this.form.parent_id=this.$route.query.parent_id);this.form.id&&(this.showingSections=["basic","customization"]),this.dataLoaded=!0}},L1={key:0},P1={class:"fcom_form_section"},F1={class:"fcom_help_text"},I1={class:"fcom_form_section"},E1={style:{"font-weight":"bold"}},U1=["innerHTML"],A1={key:0},B1={class:"fcom_help_text"},D1={key:0},R1={key:1,class:"fcom_form_section"},x1={class:"fcom_lined_checkboxes"},H1={key:0,class:"fcom_pro_feature"},O1={key:0,class:"fcom_feature_nested"},j1={key:0,class:"fcom_pro_feature"},N1={key:1,class:"fcom_feature_nested"},z1={class:"fcom_form_section"},q1={class:"fcom_svg_radio_item"},G1={class:"svg_radio_label"},Y1={class:"fcom_svg_radio_item"},W1={class:"svg_radio_label"},Z1={class:"fcom_svg_radio_item"},K1={class:"svg_radio_label"},J1={class:"fcom_help_text"},Q1={key:0},X1={key:1},eg={class:"fcom_form_section"},tg={class:"fcom_help_text"},sg=["href"],og={class:"fcom_image_uploader_wrapper"},ig={class:"fcom_help_text"},ng={class:"fcom_image_uploader_wrapper"},lg={class:"fcom_help_text"},ag={class:"fcom_space_form_bottom"},rg={class:"fcom_space_form_bottom"},cg={key:0},dg={class:"fcom_form_section fcom_mt_20"};function ug(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=te,h=ue,g=p("SlugInput"),k=p("space-group-selector"),b=ie,w=ne,S=Re,C=ke,v=fe,$=p("TimelineViewIcon"),T=p("ListViewIcon"),V=p("CardViewIcon"),F=p("topic-selector"),L=Fe,A=p("EditPen"),D=O,U=H,E=p("Delete"),q=p("ImageUploader"),j=p("error-alerts"),N=_e,W=p("form-builder"),le=ee("loading");return n(),c("div",null,[a(N,{onSubmit:t[31]||(t[31]=z(B=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[32]||(t[32]=B=>o.form=B),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[o.showingSections.indexOf("basic")!==-1?(n(),c(P,{key:0},[o.form.id?_("",!0):(n(),c("h4",L1,d(e.$t("Basic Info")),1)),l("div",P1,[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:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=B=>o.form.title=B)},{prepend:r(()=>{var B,J;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=me=>{o.form.settings.emoji=me.emoji,o.form.logo=me.logo,o.form.settings.shape_svg=me.shape_svg}),config:{logo:o.form.logo,emoji:((B=o.form.settings)==null?void 0:B.emoji)||"",shape_svg:((J=o.form.settings)==null?void 0:J.shape_svg)||""}},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(g,{popMessage:e.$t("The URLs of this space posts will be changed to the new slug. If you have lots of contents in this space, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>o.form.slug=B),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:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=B=>o.form.description=B)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[o.dataLoaded?(n(),y(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=B=>o.form.parent_id=B),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",F1,[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",I1,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(w,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=B=>o.form.privacy=B),placeholder:e.$t("Select Privacy")},{default:r(()=>[(n(!0),c(P,null,R(o.privacies,(B,J)=>(n(),y(b,{key:J,label:B.label,value:J},{default:r(()=>[l("span",E1,d(e.$labelize(B.label)),1),l("p",{innerHTML:B.description},null,8,U1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),c(P,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(C,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[6]||(t[6]=B=>o.form.settings.custom_lock_screen=B),class:""},{default:r(()=>[a(S,{value:"yes"},{default:r(()=>[M(d(e.$t("Custom Lock Screen")),1)]),_:1}),a(S,{value:"no"},{default:r(()=>[M(d(e.$t("Default Lock Screen")),1)]),_:1}),a(S,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[M(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),c("span",A1,d(e.$t("Require Pro")),1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),y(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[7]||(t[7]=B=>o.form.settings.onboard_redirect_url=B),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 non-members. This may be your sales page for this space")),1)])]),_:1},8,["label"])):_("",!0)],64)):_("",!0),i.isDefaultLockscreen?(n(),y(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.can_request_join,"onUpdate:modelValue":t[8]||(t[8]=B=>o.form.settings.can_request_join=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Allow users to request to join this Space")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),i.isDefaultLockscreen?(n(),y(h,{key:2},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[9]||(t[9]=B=>o.form.settings.show_paywalls=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Show Paywalls in Default Lock Screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),a(h,{label:e.$t("Who can view space members")},{default:r(()=>[a(w,{modelValue:o.form.settings.members_page_status,"onUpdate:modelValue":t[10]||(t[10]=B=>o.form.settings.members_page_status=B)},{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),o.showingSections.indexOf("customization")!==-1?(n(),c(P,{key:1},[o.form.id?_("",!0):(n(),c("h4",D1,d(e.$t("Customization")),1)),o.form.settings?(n(),c("div",R1,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",x1,[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.restricted_post_only,"onUpdate:modelValue":t[11]||(t[11]=B=>o.form.settings.restricted_post_only=B)},{default:r(()=>[M(d(e.$t("Only admin or moderators can create post")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.show_sidebar,"onUpdate:modelValue":t[12]||(t[12]=B=>o.form.settings.show_sidebar=B)},{default:r(()=>[M(d(e.$t("Show Right Sidebar on Space")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[13]||(t[13]=B=>o.form.settings.hide_members_count=B)},{default:r(()=>[M(d(e.$t("Hide Members count from spaces page (when members page access unavailable)")),1)]),_:1},8,["modelValue"]),a(v,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.document_library,"onUpdate:modelValue":t[14]||(t[14]=B=>o.form.settings.document_library=B)},{default:r(()=>[M(d(e.$t("Enable File/Document Library for this space"))+" ",1),e.has_pro?_("",!0):(n(),c("span",H1," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),o.form.settings.document_library=="yes"?(n(),c("div",O1,[a(h,{label:e.$t("Document Library Access (View & Download)")},{default:r(()=>[a(C,{modelValue:o.form.settings.document_access,"onUpdate:modelValue":t[15]||(t[15]=B=>o.form.settings.document_access=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(S,{value:"members_only"},{default:r(()=>[M(d(e.$t("Members of this space")),1)]),_:1}),a(S,{value:"logged_in"},{default:r(()=>[M(d(e.$t("Any Logged in users")),1)]),_:1}),a(S,{value:"everybody"},{default:r(()=>[M(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(C,{modelValue:o.form.settings.document_upload,"onUpdate:modelValue":t[16]||(t[16]=B=>o.form.settings.document_upload=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(S,{value:"members_only"},{default:r(()=>[M(d(e.$t("Any Members")),1)]),_:1}),a(S,{value:"admin_only"},{default:r(()=>[M(d(e.$t("Admin/Moderators Only")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0),a(v,{class:"fcom_checkbox",disabled:!e.has_pro,"true-value":"yes","false-value":"no",modelValue:o.form.settings.media_gallery,"onUpdate:modelValue":t[17]||(t[17]=B=>o.form.settings.media_gallery=B)},{default:r(()=>[M(d(e.$t("Enable Media Gallery for this space"))+" ",1),e.has_pro?_("",!0):(n(),c("span",j1," ("+d(e.$t("Pro Feature"))+") ",1))]),_:1},8,["disabled","modelValue"]),e.has_pro&&o.form.settings.media_gallery=="yes"?(n(),c("div",N1,[a(h,{label:e.$t("Media Gallery Access (View)")},{default:r(()=>[a(C,{modelValue:o.form.settings.media_access,"onUpdate:modelValue":t[18]||(t[18]=B=>o.form.settings.media_access=B),class:"fcom_radio_group_inline"},{default:r(()=>[a(S,{value:"members_only"},{default:r(()=>[M(d(e.$t("Members of this space")),1)]),_:1}),a(S,{value:"logged_in"},{default:r(()=>[M(d(e.$t("Any Logged in users")),1)]),_:1}),a(S,{value:"everybody"},{default:r(()=>[M(d(e.$t("Public")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])])):_("",!0)])]),_:1}),a(h,{label:e.$t("Default Post Sort By")},{default:r(()=>[a(w,{modelValue:o.form.settings.default_post_sort_by,"onUpdate:modelValue":t[19]||(t[19]=B=>o.form.settings.default_post_sort_by=B),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Posts Sort")},{default:r(()=>[(n(!0),c(P,null,R(o.postOrderOptions,(B,J)=>(n(),y(b,{key:J,value:J,label:B},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_post_sort_by,"onUpdate:modelValue":t[20]||(t[20]=B=>o.form.settings.disable_post_sort_by=B)},{default:r(()=>[M(d(e.$t("Disable Post Sort By Options")),1)]),_:1},8,["modelValue"]),a(h,{label:e.$t("Default Comment Sort By")},{default:r(()=>[a(w,{modelValue:o.form.settings.default_comment_sort_by,"onUpdate:modelValue":t[21]||(t[21]=B=>o.form.settings.default_comment_sort_by=B),clearable:"",class:"fcom_select",placeholder:e.$t("Latest Comments Sort")},{default:r(()=>[(n(!0),c(P,null,R(o.commentOrderOptions,(B,J)=>(n(),y(b,{key:J,value:J,label:B},null,8,["value","label"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])])):_("",!0),l("div",z1,[l("h4",null,d(e.$t("Layout")),1),a(h,{label:e.$t("Default Layout Styles"),class:"fcom_mb_10"},{default:r(()=>[a(C,{modelValue:o.form.settings.layout_style,"onUpdate:modelValue":t[22]||(t[22]=B=>o.form.settings.layout_style=B),class:"fcom_svg_radio_group"},{default:r(()=>[l("div",q1,[a(S,{value:"timeline"},{default:r(()=>[a($,{style:{width:"100px",height:"auto"}}),l("p",G1,d(e.$t("Timeline")),1)]),_:1})]),l("div",Y1,[a(S,{value:"list"},{default:r(()=>[a(T,{style:{width:"100px",height:"auto"}}),l("p",W1,d(e.$t("List")),1)]),_:1})]),l("div",Z1,[a(S,{value:"card"},{default:r(()=>[a(V,{style:{width:"100px",height:"auto"}}),l("p",K1,d(e.$t("Card")),1)]),_:1})])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(h,{style:{"margin-top":"0"}},{default:r(()=>[a(v,{class:"fcom_checkbox","true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_layout_style,"onUpdate:modelValue":t[23]||(t[23]=B=>o.form.settings.disable_layout_style=B)},{default:r(()=>[M(d(e.$t("Disable Layout Style Change Option")),1)]),_:1},8,["modelValue"]),l("div",J1,[o.form.settings.disable_layout_style==="yes"?(n(),c("p",Q1,d(e.$t("The selected layout will be applied for all members. They cannot switch to a different view.")),1)):(n(),c("p",X1,d(e.$t("User can change the layout style to their own preference.")),1))])]),_:1})]),l("div",eg,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(F,{creatable:!0,space_id:o.form.id,modelValue:o.form.topic_ids,"onUpdate:modelValue":t[24]||(t[24]=B=>o.form.topic_ids=B)},null,8,["space_id","modelValue"]),l("div",tg,[l("p",null,[M(d(e.$t("Categorize your posts and allow members to filter spaces with the topic navigation bar. You can define up to 20 topics per space."))+" ",1),e.isAdmin()?(n(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics.")),9,sg)):_("",!0)])]),a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.topic_required,"onUpdate:modelValue":t[25]||(t[25]=B=>o.form.settings.topic_required=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Make members select a topic")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),e.appVars.has_chat?(n(),y(h,{key:1,label:e.$t("Group Chat?")},{default:r(()=>[a(v,{"true-value":"yes","false-value":"no",modelValue:o.form.group_chat_support,"onUpdate:modelValue":t[26]||(t[26]=B=>o.form.group_chat_support=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Enable group chat for this space members")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[o.form.settings.og_image?(n(),y(L,{key:0,alt:e.$t("Thumbnail / Open Graph Image"),src:o.form.settings.og_image,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",og,[a(q,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.settings.og_image,confirm_remove:!0,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:t[27]||(t[27]=B=>{o.form.settings.og_image=B})},ve({remove:r(()=>[a(D,null,{default:r(()=>[a(E)]),_:1})]),_:2},[o.form.settings.og_image?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(D,null,{default:r(()=>[a(A)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove"])]),l("div",ig,[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(()=>[o.form.cover_photo?(n(),y(L,{key:0,src:o.form.cover_photo,alt:e.$t("Featured Image Preview"),style:{"max-width":"100px",height:"auto"}},null,8,["src","alt"])):_("",!0),l("div",ng,[a(q,{isTextBtn:!1,removeIcon:!0,can_remove:!!o.form.cover_photo,confirm_remove:!0,additionalData:{resize:!0,max_width:1600},onUploaded:i.handleCoverPhotoUpload},ve({remove:r(()=>[a(D,null,{default:r(()=>[a(E)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(D,null,{default:r(()=>[a(A)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",lg,[l("p",null,d(e.$t("If you add this image, it will be shown on the space homepage")),1)])]),_:1},8,["label"]),a(j,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),y(h,{key:2,style:{"margin-top":"45px"}},{default:r(()=>[l("div",ag,[o.showingSections.indexOf("basic")===-1?(n(),y(U,{key:0,class:"plain_button",text:"",onClick:t[28]||(t[28]=()=>{o.showingSections=["basic"]})},{default:r(()=>[l("span",null,d(e.$t("Go Back")),1)]),_:1})):_("",!0),Y((n(),y(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[29]||(t[29]=B=>i.submit())},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled"])),[[le,o.saving]])])]),_:1}))])],64)):(n(),c(P,{key:2},[a(j,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,null,{default:r(()=>[l("div",rg,[t[33]||(t[33]=l("span",null,null,-1)),a(U,{onClick:t[30]||(t[30]=B=>i.goToCustomization()),class:"fcom_primary_button"},{default:r(()=>[l("span",null,d(e.$t("Next")),1)]),_:1})])]),_:1})],64))]),_:1},8,["modelValue"]),Y((n(),c("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),c("div",cg,[(n(!0),c(P,null,R(o.metaSettings,B=>(n(),c("div",dg,[l("h4",null,d(B.section_title),1),a(W,{formData:B.settings,formFields:B.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[le,o.fetchingMetaBoxes]])])}const zt=I(T1,[["render",ug]]),_g={name:"CreateCorseForm",components:{FormBuilder:$o,SpaceGroupSelector:ps,TopicSelector:Co,SlugInput:Ot,ImageUploader:He,LogoEmojiSelector:Ht,ErrorAlerts:jt,CrepeEditor:Et},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:Pd,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:Fd,dataLoaded:!1,metaSettings:null,fetchingMetaBoxes:!1,appReady:!1,courseInstructors:[],fetchingInstructors:!1}},watch:{savingCount(){this.submit(!1)}},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 s=Nt("/"+this.form.slug);s.valid||s.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 o=this.getValidationErrors();if(o.length){this.$notify.error(o[0]);return}}else if(!this.validateForm())return;this.saving=!0;let t="admin/courses",s=this.form,u=this.$post;if(this.form.id&&(t+="/"+this.form.id,s={title:this.form.title,privacy:this.form.privacy,course_type:this.form.course_type,description:this.form.description,status:this.form.status,slug:this.form.slug,logo:this.form.logo,cover_photo:this.form.cover_photo,space_id:this.form.id,parent_id:this.form.parent_id,settings:this.form.settings,category_ids:this.form.category_ids},u=this.$put,this.form.created_by&&this.isAdmin()&&(s.created_by=this.form.created_by),this.metaSettings)){let o={};this.each(this.metaSettings,(i,m)=>{o[m]=i.settings}),s.meta_settings=o}u(t,s).then(o=>{if(!this.form.id&&!this.disable_redirect){let i=this.$getRouteLink("admin/manage-courses/edit/"+o.course.id+"/lessons");window.location.href=i,this.form={};return}this.$eventBus.emit("reloadMenu"),this.$notify.success(o.message||this.$t("Course has been created successfully")),this.$emit("completed",o.course),e&&this.$emit("close")}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1})},searchUsers(e=""){e&&e.length<3||this.fetchCourseInstructors(e)},handlePhotoUpload(e){this.form.cover_photo=e},fetchMetaBoxes(){this.course.id&&(this.fetchingMetaBoxes=!0,this.$get("admin/courses/"+this.course.id+"/meta-settings").then(e=>{this.metaSettings=e.meta_settings}).catch(e=>{this.$handleError(e)}).finally(()=>{this.fetchingMetaBoxes=!1}))},fetchCourseInstructors(e=""){this.fetchingInstructors=!0,this.$get("admin/courses/"+this.course.id+"/instructors/search",{search:e}).then(t=>{this.courseInstructors=t.instructors}).catch(t=>{this.$handleError(t)}).finally(()=>{this.fetchingInstructors=!1})}},mounted(){var t,s,u,o,i;this.course.id?(this.form=this.course,this.form.created_by=parseInt(this.form.created_by),this.fetchMetaBoxes(),this.fetchCourseInstructors()):this.parent_id&&(this.form.parent_id=this.parent_id);const e=(s=(t=this.course)==null?void 0:t.settings)==null?void 0:s.course_type;e&&!((u=this.form)!=null&&u.course_type)&&(this.form.course_type=e),(!((i=(o=this.form)==null?void 0:o.settings)!=null&&i.course_layout)||!this.has_pro)&&(this.form.settings.course_layout="classic"),this.dataLoaded=!0,this.$nextTick(()=>{this.appReady=!0})}},mg={key:0},hg={class:"fcom_form_section"},fg={class:"fcom_help_text"},pg={class:"fcom_help_text"},gg={class:"fcom_form_section"},yg={style:{"font-weight":"bold"}},vg={key:0},bg={class:"fcom_help_text"},kg={style:{"font-weight":"bold"}},wg={class:"fcom_form_section"},Cg={class:"fcom_lined_checkboxes"},$g={class:"fcom_checkbox_with_tooltip"},Sg={key:0},Vg={key:0},Mg={class:"fcom_help_text"},Tg={key:0,class:"fcom_form_section"},Lg={class:"fcom_select_photo",style:{float:"left"}},Pg=["src","alt"],Fg={style:{float:"right",color:"#8492a6","font-size":"13px"}},Ig={class:"fcom_lined_checkboxes"},Eg={class:"fcom_form_section"},Ug={class:"fcom_help_text"},Ag=["href"],Bg={class:"fcom_image_uploader_wrapper"},Dg={class:"fcom_help_text"},Rg={class:"fcom_space_form_bottom"},xg={key:0},Hg={class:"fcom_form_section fcom_mt_20"},Og={key:1},jg=["href"];function Ng(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=te,h=ue,g=p("SlugInput"),k=p("crepe-editor"),b=p("space-group-selector"),w=Re,S=ke,C=ie,v=ne,$=fe,T=p("InfoFilled"),V=O,F=xe,L=p("topic-selector"),A=Fe,D=p("EditPen"),U=H,E=p("Delete"),q=p("ImageUploader"),j=p("error-alerts"),N=_e,W=p("form-builder"),le=ee("loading");return e.hasFeature("has_course")?(n(),c("div",mg,[a(N,{onSubmit:t[23]||(t[23]=z(B=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[24]||(t[24]=B=>o.form=B),"label-position":"top","require-asterisk-position":"right"},{default:r(()=>[l("div",hg,[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:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=B=>o.form.title=B)},{prepend:r(()=>{var B,J;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,config:{logo:o.form.logo,emoji:(B=o.form.settings)==null?void 0:B.emoji,shape_svg:((J=o.form.settings)==null?void 0:J.shape_svg)||""},onUpdate:t[0]||(t[0]=me=>{o.form.settings.emoji=me.emoji,o.form.logo=me.logo,o.form.settings.shape_svg=me.shape_svg})},null,8,["config"])):_("",!0)]}),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"]),o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Slug (optional)")},{default:r(()=>[a(g,{popMessage:e.$t("The URLs of this course lessons will be changed to the new slug. If you have lots of lessons and sections in this course, you should not change it. Are you sure you want to change it?"),is_inital_inactive:!!o.form.id,modelValue:o.form.slug,"onUpdate:modelValue":t[2]||(t[2]=B=>o.form.slug=B),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:o.form.description,"onUpdate:modelValue":t[3]||(t[3]=B=>o.form.description=B)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),a(h,{class:"form_label_with_tooltip",label:e.$t("Course Details")},{default:r(()=>[o.appReady?(n(),y(k,{key:0,modelValue:o.form.settings.course_details,"onUpdate:modelValue":t[4]||(t[4]=B=>o.form.settings.course_details=B),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",fg,[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(()=>[o.dataLoaded?(n(),y(b,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[5]||(t[5]=B=>o.form.parent_id=B),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",pg,[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(S,{modelValue:o.form.status,"onUpdate:modelValue":t[6]||(t[6]=B=>o.form.status=B),class:"fcom_radio_group"},{default:r(()=>[a(w,{value:"published"},{default:r(()=>[M(d(e.$t("Published")),1)]),_:1}),a(w,{value:"draft"},{default:r(()=>[M(d(e.$t("Draft")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])]),l("div",gg,[l("h4",null,d(e.$t("Access Control")),1),a(h,{label:e.$t("Privacy")},{default:r(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.privacy,"onUpdate:modelValue":t[7]||(t[7]=B=>o.form.privacy=B),placeholder:e.$t("Select Privacy")},{default:r(()=>[(n(!0),c(P,null,R(o.privacies,(B,J)=>(n(),y(C,{key:J,label:B.label,value:J},{default:r(()=>[l("span",yg,d(B.label),1),l("p",null,d(B.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),o.form.privacy=="private"?(n(),c(P,{key:0},[a(h,{label:e.$t("Lock Screen Type")},{default:r(()=>[a(S,{modelValue:o.form.settings.custom_lock_screen,"onUpdate:modelValue":t[8]||(t[8]=B=>o.form.settings.custom_lock_screen=B),class:"fcom_radio_group"},{default:r(()=>[a(w,{value:"yes"},{default:r(()=>[M(d(e.$t("Custom")),1)]),_:1}),a(w,{value:"no"},{default:r(()=>[M(d(e.$t("Default")),1)]),_:1}),a(w,{disabled:!e.has_pro,value:"redirect"},{default:r(()=>[M(d(e.$t("Redirect to an URL"))+" ",1),e.has_pro?_("",!0):(n(),c("span",vg,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.form.settings.custom_lock_screen=="redirect"&&e.has_pro?(n(),y(h,{key:0,label:e.$t("Provide the Redirect URL")},{default:r(()=>[a(f,{modelValue:o.form.settings.onboard_redirect_url,"onUpdate:modelValue":t[9]||(t[9]=B=>o.form.settings.onboard_redirect_url=B),type:"text",placeholder:e.$t("Redirect URL for unenrolled users")},null,8,["modelValue","placeholder"]),l("div",bg,[l("p",null,d(e.$t("This link will be used to redirect the unenrolled or public users. This may be your sales page for this course")),1)])]),_:1},8,["label"])):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),y(h,{key:1,style:{"margin-bottom":"0"}},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_paywalls,"onUpdate:modelValue":t[10]||(t[10]=B=>o.form.settings.show_paywalls=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Show Paywalls in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0),o.form.settings.custom_lock_screen=="no"?(n(),y(h,{key:2},{default:r(()=>[a($,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_welcome_banner,"onUpdate:modelValue":t[11]||(t[11]=B=>o.form.settings.show_welcome_banner=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Show Welcome Banner in the default lock screen")),1)]),_:1},8,["modelValue"])]),_:1})):_("",!0)],64)):_("",!0),a(h,{label:e.$t("Enrollment Type")},{default:r(()=>[a(v,{"popper-class":"rich_select",modelValue:o.form.course_type,"onUpdate:modelValue":t[12]||(t[12]=B=>o.form.course_type=B),placeholder:e.$t("Select Type")},{default:r(()=>[(n(!0),c(P,null,R(o.courseTypes,(B,J)=>(n(),y(C,{key:J,label:B.label,value:J},{default:r(()=>[l("span",kg,d(B.label),1),l("p",null,d(B.description),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])]),l("div",wg,[l("h4",null,d(e.$t("Features Customizations")),1),a(h,null,{default:r(()=>[l("div",Cg,[o.form.privacy=="public"&&o.form.course_type=="self_paced"?(n(),y($,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.public_lesson_view,"onUpdate:modelValue":t[13]||(t[13]=B=>o.form.settings.public_lesson_view=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Public users can view the lessons without enrolling in the course")),1)]),_:1},8,["modelValue"])):_("",!0),a($,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.disable_comments,"onUpdate:modelValue":t[14]||(t[14]=B=>o.form.settings.disable_comments=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Disable comments for all the lessons for this course")),1)]),_:1},8,["modelValue"]),a($,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_members_count,"onUpdate:modelValue":t[15]||(t[15]=B=>o.form.settings.hide_members_count=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Hide students count from courses page")),1)]),_:1},8,["modelValue"]),l("div",$g,[a($,{disabled:!e.has_pro,"true-value":"yes","false-value":"no","model-value":e.has_pro?o.form.settings.sequential_lesson_order:"no","onUpdate:modelValue":t[16]||(t[16]=B=>{o.form.settings.sequential_lesson_order=B}),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Lesson order enforcement"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Sg,"("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["disabled","model-value"]),a(F,{class:"box-item fcom_checkbox_tooltip",effect:"dark",placement:"right-end"},{content:r(()=>[M(d(e.$t("Your members will have to complete each lesson")),1),t[25]||(t[25]=l("br",null,null,-1)),M(" "+d(e.$t("in order before moving onto the next one.")),1)]),default:r(()=>[a(V,null,{default:r(()=>[a(T)]),_:1})]),_:1})])])]),_:1}),a(h,{label:e.$t("Course Layout")},{default:r(()=>[a(S,{modelValue:o.form.settings.course_layout,"onUpdate:modelValue":t[17]||(t[17]=B=>o.form.settings.course_layout=B),class:"fcom_radio_group"},{default:r(()=>[a(w,{value:"classic"},{default:r(()=>[M(d(e.$t("Classic")),1)]),_:1}),a(w,{disabled:!e.has_pro,value:"modern"},{default:r(()=>[M(d(e.$t("Modern"))+" ",1),e.has_pro?_("",!0):(n(),c("span",Vg,"("+d(e.$t("Available on Pro"))+")",1))]),_:1},8,["disabled"])]),_:1},8,["modelValue"]),l("div",Mg,[l("p",null,d(e.$t("Classic is the default layout. For a more visual and engaging experience, the Modern layout displays the featured image or embedded video thumbnail.")),1)])]),_:1},8,["label"])]),o.form.id?(n(),c("div",Tg,[l("h4",null,d(e.$t("Course Instructor")),1),a(h,{label:e.$t("Instructor")},{default:r(()=>[a(v,{disabled:!e.isAdmin(),class:"rich_select","fit-input-width":"",filterable:"",remote:"",loading:o.fetchingInstructors,"remote-method":i.searchUsers,placeholder:e.$t("Select User"),modelValue:o.form.created_by,"onUpdate:modelValue":t[18]||(t[18]=B=>o.form.created_by=B)},{default:r(()=>[(n(!0),c(P,null,R(o.courseInstructors,B=>(n(),y(C,{class:"fcom_with_photo_option",key:B.ID,label:B.display_name+" ("+(B.user_email||B.ID)+")",value:B.ID},{default:r(()=>[l("span",Lg,[l("img",{src:B.photo,alt:B.display_name},null,8,Pg),l("span",null,d(B.display_name),1)]),l("span",Fg,d(B.user_email||B.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",Ig,[a($,{"true-value":"yes","false-value":"no",modelValue:o.form.settings.hide_instructor_view,"onUpdate:modelValue":t[19]||(t[19]=B=>o.form.settings.hide_instructor_view=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Hide course instructor view from course overview page")),1)]),_:1},8,["modelValue"]),o.form.settings.hide_instructor_view!="yes"?(n(),y($,{key:0,"true-value":"yes","false-value":"no",modelValue:o.form.settings.show_instructor_students_count,"onUpdate:modelValue":t[20]||(t[20]=B=>o.form.settings.show_instructor_students_count=B),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Show students count in course instructor view")),1)]),_:1},8,["modelValue"])):_("",!0)])]),_:1})])):_("",!0),l("div",Eg,[l("h4",null,d(e.$t("Others")),1),e.has_pro&&o.dataLoaded?(n(),y(h,{key:0,label:e.$t("Topic navigation")},{default:r(()=>[a(L,{modelValue:o.form.category_ids,"onUpdate:modelValue":t[21]||(t[21]=B=>o.form.category_ids=B),creatable:!0},null,8,["modelValue"]),l("div",Ug,[l("p",null,d(e.$t("Categorize your course and allow members to filter courses with the topic navigation bar in the courses directory. You can define up to 20 topics per course.")),1),l("p",null,[e.isAdmin()?(n(),c("a",{key:0,target:"_blank",rel:"noopener",href:e.$getRouteLink("admin/settings/topics-settings")},d(e.$t("Manage all topics")),9,Ag)):_("",!0)])])]),_:1},8,["label"])):_("",!0),a(h,{label:e.$t("Thumbnail / Open Graph Image (Recommended Size: 1200 x 630)")},{default:r(()=>[o.form.cover_photo?(n(),y(A,{key:0,alt:e.$t("Cover Photo"),src:o.form.cover_photo,style:{"max-width":"100px",height:"auto"}},null,8,["alt","src"])):_("",!0),l("div",Bg,[a(q,{isTextBtn:!1,can_remove:!!o.form.cover_photo,additionalData:{resize:!1,disable_convert:"yes",max_width:1200,max_height:630},onUploaded:i.handlePhotoUpload},ve({remove:r(()=>[a(V,null,{default:r(()=>[a(E)]),_:1})]),_:2},[o.form.cover_photo?{name:"trigger",fn:r(()=>[a(U,{class:"fcom_plain_button"},{default:r(()=>[a(V,null,{default:r(()=>[a(D)]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["can_remove","onUploaded"])]),l("div",Dg,[l("p",null,d(e.$t("Will be used on course card preview and social sharing preview.")),1)])]),_:1},8,["label"]),a(j,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),o.form.id?_("",!0):(n(),y(h,{key:1,style:{"margin-top":"45px"}},{default:r(()=>[l("div",Rg,[t[26]||(t[26]=l("span",null,null,-1)),a(U,{class:"fcom_primary_button",disabled:o.saving,onClick:t[22]||(t[22]=B=>i.submit()),loading:o.saving},{default:r(()=>[l("span",null,d(e.$t("Create")),1)]),_:1},8,["disabled","loading"])])]),_:1}))])]),_:1},8,["modelValue"]),Y((n(),c("div",null,[o.metaSettings&&Object.keys(o.metaSettings).length>0?(n(),c("div",xg,[(n(!0),c(P,null,R(o.metaSettings,B=>(n(),c("div",Hg,[l("h4",null,d(B.section_title),1),a(W,{formData:B.settings,formFields:B.fields,disableSubmit:!0},null,8,["formData","formFields"])]))),256))])):_("",!0)])),[[le,o.fetchingMetaBoxes]])])):(n(),c("div",Og,[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,jg)]))}const zg=I(_g,[["render",Ng]]),qg={name:"SpaceCourseSelector",components:{SpaceIcon:Ye},emits:["update:modelValue","selectedType","selectedSlug"],props:{modelValue:{type:[String,Number,Array],default:""},placeholder_text:{type:String,default:""},is_multiple:{type:Boolean,default:!1},memberships:{type:Array,default:[]}},data(){return{all_spaces:[],selected_spaces:"",loading:!1,formattedSpaceGroups:[],app_ready:!1}},watch:{selected_spaces(e){this.is_multiple?this.$emit("update:modelValue",Array.isArray(e)?e:[]):this.$emit("update:modelValue",e||"")}},methods:{isMemberOfSpace(e){return this.memberships&&this.memberships.includes(e.toString())},fetch(){this.loading=!0,this.$get("admin/all_space_courses").then(e=>{this.all_spaces=e.all_spaces,this.formatSpaceGroups()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},emitChanges(){this.$emit("update:modelValue",this.selected_spaces||"");const e=Array.isArray(this.selected_spaces)&&this.selected_spaces.length?this.selected_spaces[0]:this.selected_spaces,t=this.all_spaces.find(s=>s.id==e);this.$emit("selectedSlug",(t==null?void 0:t.slug)||""),this.$emit("selectedType",(t==null?void 0:t.type)=="course"?"course":"space")},formatSpaceGroups(){if(this.all_spaces.length==0)return;let e=this.all_spaces,t=this.appVars.space_groups,s=[],u=[];this.each(t,i=>{let m=e.filter(f=>{let h=f.parent_id==i.id;return h&&u.push(f.slug),h});m.length&&s.push({label:i.title,spaces:m})});let o=e.filter(i=>i.parent_id===null);o&&o.length&&s.push({label:this.$t("Uncategorized"),spaces:o}),this.formattedSpaceGroups=s}},mounted(){this.is_multiple?this.selected_spaces=Array.isArray(this.modelValue)?this.modelValue:[]:this.selected_spaces=this.modelValue||"",this.fetch(),this.app_ready=!0}},Gg={key:0,class:"fcom_space_title"},Yg={key:0},Wg={key:1};function Zg(e,t,s,u,o,i){const m=p("SpaceIcon"),f=ie,h=$t,g=ne,k=ee("loading");return o.app_ready?(n(),y(g,{key:0,onChange:i.emitChanges,modelValue:o.selected_spaces,"onUpdate:modelValue":t[0]||(t[0]=b=>o.selected_spaces=b),filterable:"",multiple:s.is_multiple,placeholder:s.placeholder_text,style:{width:"100%"}},{default:r(()=>[(n(!0),c(P,null,R(o.formattedSpaceGroups,b=>Y((n(),y(h,{key:b.label,label:b.label},{default:r(()=>[(n(!0),c(P,null,R(b.spaces,w=>(n(),y(f,{key:w.slug,label:w.title,disabled:i.isMemberOfSpace(w.id),value:w.id.toString()},{default:r(()=>[w.id?(n(),c("span",Gg,[a(m,{space_profile:w},null,8,["space_profile"]),l("span",null,[M(d(e.getExcerpt(w.title,50))+" ",1),w.type=="course"?(n(),c("span",Yg," ("+d(e.$t("course"))+")",1)):_("",!0)])])):(n(),c("span",Wg,d(e.getExcerpt(w.title,50)),1))]),_:2},1032,["label","disabled","value"]))),128))]),_:2},1032,["label"])),[[k,o.loading]])),128))]),_:1},8,["onChange","modelValue","multiple","placeholder"])):_("",!0)}const qt=I(qg,[["render",Zg]]),Kg={name:"SidebarLinkForm",components:{SpaceGroupSelector:ps,LogoEmojiSelector:Ht,SpaceCourseSelector:qt,ErrorAlerts:jt},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=wo(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}},Jg={class:"fcom_form_section"},Qg={class:"fcom_help_text"},Xg={class:"fcom_help_text"},ey={class:"fcom_help_text"},ty={key:0},sy={key:1};function oy(e,t,s,u,o,i){const m=p("logo-emoji-selector"),f=te,h=ue,g=fe,k=p("space-group-selector"),b=Re,w=ke,S=p("SpaceCourseSelector"),C=p("error-alerts"),v=H,$=_e,T=ee("loading");return n(),y($,{onSubmit:t[8]||(t[8]=z(V=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[9]||(t[9]=V=>o.form=V),"label-position":"top","require-asterisk-position":"right",class:"fcom_space_form"},{default:r(()=>[l("div",Jg,[a(h,{label:e.$t("Link Title"),required:""},{default:r(()=>[a(f,{type:"text",placeholder:e.$t("Your Link Title"),modelValue:o.form.title,"onUpdate:modelValue":t[1]||(t[1]=V=>o.form.title=V)},{prepend:r(()=>{var V,F;return[o.dataLoaded?(n(),y(m,{key:0,custom_svg:!0,onUpdate:t[0]||(t[0]=L=>{o.form.settings.emoji=L.emoji,o.form.logo=L.logo,o.form.settings.shape_svg=L.shape_svg}),config:{logo:o.form.logo,emoji:((V=o.form.settings)==null?void 0:V.emoji)||"",shape_svg:((F=o.form.settings)==null?void 0:F.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:o.form.settings.permalink,"onUpdate:modelValue":t[2]||(t[2]=V=>o.form.settings.permalink=V)},null,8,["placeholder","modelValue"]),l("div",Qg,[a(g,{modelValue:o.form.settings.new_tab,"onUpdate:modelValue":t[3]||(t[3]=V=>o.form.settings.new_tab=V),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Open this link in new tab")),1)]),_:1},8,["modelValue"])])]),_:1},8,["label"]),a(h,{label:e.$t("Menu Group")},{default:r(()=>[o.dataLoaded?(n(),y(k,{key:0,modelValue:o.form.parent_id,"onUpdate:modelValue":t[4]||(t[4]=V=>o.form.parent_id=V),space_id:o.form.id},null,8,["modelValue","space_id"])):_("",!0),l("div",Xg,[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(w,{modelValue:o.form.privacy,"onUpdate:modelValue":t[5]||(t[5]=V=>o.form.privacy=V)},{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",ey,[l("p",null,d(e.$t("Select who can see this link.")),1)])]),_:1},8,["label"]),o.form.privacy=="members_only"?(n(),y(h,{key:0,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a(S,{modelValue:o.form.settings.membership_ids,"onUpdate:modelValue":t[6]||(t[6]=V=>o.form.settings.membership_ids=V),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),a(C,{errors:o.formErrors,style:{"margin-bottom":"16px"},dismissable:""},null,8,["errors"]),a(h,{style:{"margin-top":"45px"}},{default:r(()=>[Y((n(),y(v,{class:"fcom_primary_button",disabled:o.saving,onClick:t[7]||(t[7]=V=>i.saveSettings())},{default:r(()=>[o.form.id?(n(),c("span",ty,d(e.$t("Update")),1)):(n(),c("span",sy,d(e.$t("Create Link")),1))]),_:1},8,["disabled"])),[[T,o.saving]])]),_:1})])]),_:1},8,["modelValue"])}const iy=I(Kg,[["render",oy]]),ny={name:"SpaceIcon"},ly={version:"1.1",viewBox:"0 0 128 128","xml:space":"preserve"};function ay(e,t,s,u,o,i){return n(),c("svg",ly,[...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 ry=I(ny,[["render",ay]]),cy={name:"CourseIcon"},dy={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function uy(e,t,s,u,o,i){return n(),c("svg",dy,[...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 _y=I(cy,[["render",uy]]),my={name:"SpaceCreateModal",components:{Drawer:ko,CreateSpaceForm:zt,CreateCourseForm:zg,SidebarLinkForm:iy,ArrowLeftBold:Ys,SpaceIcon:ry,CourseIcon:_y,Link:Ws},data(){return{step:"choose_type",parent_id:null,showCreateSpaceModal:!1,select_type:"space_form",disable_redirect:!1,enteredForm:!1}},computed:{currentTitle(){return this.step==="choose_type"?this.$t("Choose a Space Type"):this.step==="space_form"?this.$t("Create a Discussion Space"):this.step==="course_form"?this.$t("Create a Course"):this.step==="link_form"?this.$t("Create a Link"):""},leaveMessage(){return this.enteredForm?this.$t("Some settings have been changed. Are you sure to leave this page?"):this.$t("Closing will discard your changes. Are you sure?")}},watch:{showCreateSpaceModal(e){e||(this._resetState(),this._clearUrlQuery())}},methods:{handleNextStep(){this.enteredForm=!0,this.step=this.select_type},_resetState(){this.step="choose_type",this.select_type="space_form",this.enteredForm=!1},_clearUrlQuery(){const{create_space:e,parent_id:t,...s}=this.$route.query;e===void 0&&t===void 0||this.$router.replace({query:s})},handleCompleted(e){this.enteredForm=!1,this.parent_id=null,this.showCreateSpaceModal=!1,this.$eventBus.emit("spaceCreated",e)}},beforeUnmount(){this.$eventBus.off("createSpaceModal")},created(){this.$eventBus.on("createSpaceModal",e=>{const t=this.$route.query.parent_id||null;this._resetState(),this.showCreateSpaceModal=!0,this.parent_id=e&&e.parent_id||t||null,e&&(this.disable_redirect=!!e.disable_redirect,e.spaceConfig?(this.step="space_form",this.select_type="space_form",this.enteredForm=!0):e.course_config&&(this.select_type="course_form",this.step="course_form",this.enteredForm=!0))})},mounted(){this.$router.isReady().then(()=>{const{create_space:e,parent_id:t}=this.$route.query;e==="yes"&&t&&this.$eventBus.emit("createSpaceModal",{parent_id:t})})}},hy={class:"dialog_header"},fy={class:"dialog_left"},py={class:"dialog_body"},gy={key:0,class:"space-type-selector"},yy={class:"space-cards"},vy={class:"space-card-label"},by={class:"space-card-label"},ky={key:0,class:"space-card-note"},wy={class:"space-card-label"},Cy={key:0,class:"space-card-note"},$y={class:"dialog_footer"};function Sy(e,t,s,u,o,i){const m=p("ArrowLeftBold"),f=O,h=H,g=p("SpaceIcon"),k=p("CourseIcon"),b=p("Link"),w=p("create-space-form"),S=p("create-course-form"),C=p("sidebar-link-form"),v=p("Drawer");return n(),y(v,{modelValue:o.showCreateSpaceModal,"onUpdate:modelValue":t[5]||(t[5]=$=>o.showCreateSpaceModal=$),size:e.drawerWidth,"close-on-click-modal":!0,"has-close-confirmation":o.enteredForm,"close-confirmation-message":i.leaveMessage,drawerClass:"fcom_space_create_drawer"},ve({header:r(()=>[l("div",hy,[l("div",fy,[o.step!="choose_type"?(n(),y(h,{key:0,onClick:t[0]||(t[0]=$=>o.step="choose_type"),text:"",size:"small"},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})):_("",!0),l("h4",null,d(i.currentTitle),1)])])]),default:r(()=>[l("div",py,[o.step=="choose_type"?(n(),c("div",gy,[l("div",yy,[l("div",{onClick:t[1]||(t[1]=$=>o.select_type="space_form"),class:x([{"is-active":o.select_type==="space_form"},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(g)]),_:1}),l("span",vy,d(e.$t("Discussion Space")),1)],2),l("div",{onClick:t[2]||(t[2]=$=>!!e.hasFeature("has_course")&&(o.select_type="course_form")),class:x([{"is-active":o.select_type==="course_form","is-disabled":!e.hasFeature("has_course")},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(k)]),_:1}),l("span",by,d(e.$t("Course")),1),e.hasFeature("has_course")?_("",!0):(n(),c("span",ky,d(e.$t("Course Module is disabled")),1))],2),l("div",{onClick:t[3]||(t[3]=$=>!!e.appVars.pro&&(o.select_type="link_form")),class:x([{"is-active":o.select_type==="link_form","is-disabled":!e.appVars.pro},"space-card"])},[a(f,{class:"space-card-icon"},{default:r(()=>[a(b)]),_:1}),l("span",wy,d(e.$t("Link")),1),e.appVars.pro?_("",!0):(n(),c("span",Cy,d(e.$t("Pro Required")),1))],2)])])):o.step=="space_form"?(n(),y(w,{key:1,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="course_form"?(n(),y(S,{key:2,disable_redirect:o.disable_redirect,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["disable_redirect","parent_id","onCompleted"])):o.step=="link_form"?(n(),y(C,{key:3,parent_id:o.parent_id,onCompleted:i.handleCompleted},null,8,["parent_id","onCompleted"])):_("",!0)])]),_:2},[o.step=="choose_type"?{name:"footer",fn:r(()=>[l("div",$y,[a(h,{disabled:!o.select_type,class:"fcom_primary_button",onClick:t[4]||(t[4]=$=>i.handleNextStep())},{default:r(()=>[M(d(e.$t("Next")),1)]),_:1},8,["disabled"])])]),key:"0"}:void 0]),1032,["modelValue","size","has-close-confirmation","close-confirmation-message"])}const Vy=I(my,[["render",Sy]]),My={name:"ExpandIcon"},Ty={xmlns:"http://www.w3.org/2000/svg",id:"icon-20-expand",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"};function Ly(e,t,s,u,o,i){return n(),c("svg",Ty,[...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 gs=I(My,[["render",Ly]]),Py={name:"ReportContentModal",data(){return{reportConfig:null,showModal:!1,saving:!1,contentType:"",reportReason:"",reportExplanation:""}},computed:{currentTitle(){return this.contentType=="comment"?this.$t("Report Comment"):this.$t("Report Post")}},methods:{closeModal(){this.showModal=!1},showReportContentModal(e){this.showModal=!0,this.reportReason="",this.reportExplanation="",this.contentType=e.type,this.reportConfig=e.reportConfig},validateAndSubmit(){if(!this.reportReason){this.$handleError(this.$t("Please select a reason for reporting this content"));return}this.submitReport()},getParentId(){return this.contentType=="comment"?this.reportConfig.id:null},getPostId(){return this.contentType=="post"?this.reportConfig.id:this.reportConfig.post_id},submitReport(){this.saving=!0,this.$post("moderation/report",{content_type:this.contentType,user_id:this.auth.user_id,post_id:this.getPostId(),parent_id:this.getParentId(),reason:this.reportReason,explanation:this.reportExplanation}).then(e=>{this.$notify.success(e.message),this.$eventBus.emit("updateModerationReport",{content:e.content,action:"reported"}),this.closeModal()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.saving=!1})}},created(){this.$eventBus.on("showReportContentModal",this.showReportContentModal)},beforeUnmount(){this.$eventBus.off("showReportContentModal",this.showReportContentModal)}},Fy={class:"dialog_header"},Iy={class:"dialog_left"},Ey={class:"dialog_body"},Uy={class:"fcom_report_content_form"},Ay={class:"dialog_footer"};function By(e,t,s,u,o,i){const m=ie,f=ne,h=ue,g=te,k=_e,b=H,w=we;return o.showModal?(n(),y(w,{key:0,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,width:e.drawerWidth,modelValue:o.showModal,"onUpdate:modelValue":t[4]||(t[4]=S=>o.showModal=S),direction:"rtl",onClose:i.closeModal},{header:r(()=>[l("div",Fy,[l("div",Iy,[l("h4",null,d(i.currentTitle),1)])])]),footer:r(()=>[l("div",Ay,[a(b,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=S=>i.closeModal())},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1}),a(b,{class:"fcom_primary_button",onClick:t[3]||(t[3]=S=>i.validateAndSubmit()),loading:o.saving},{default:r(()=>[M(d(e.$t("Report")),1)]),_:1},8,["loading"])])]),default:r(()=>[l("div",Ey,[l("div",Uy,[a(k,{ref:"reportForm","label-position":"top"},{default:r(()=>[a(h,{label:e.$t("Reason")},{default:r(()=>[a(f,{modelValue:o.reportReason,"onUpdate:modelValue":t[0]||(t[0]=S=>o.reportReason=S),placeholder:e.$t("Please select a reason for reporting this content")},{default:r(()=>[(n(!0),c(P,null,R(e.appVars.report_reasons,(S,C)=>(n(),y(m,{key:C,label:S,value:C},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(h,{label:e.$t("Explanation")},{default:r(()=>[a(g,{modelValue:o.reportExplanation,"onUpdate:modelValue":t[1]||(t[1]=S=>o.reportExplanation=S),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 Dy=I(Py,[["render",By]]),Ry={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")}}},xy={class:"fcom_pagination_wrap"};function Hy(e,t,s,u,o,i){const m=Jo;return n(),c("div",xy,[a(m,{background:!1,size:"small","pager-count":5,layout:i.pager_layout,onCurrentChange:i.changePage,onSizeChange:i.changeSize,"hide-on-single-page":s.hide_on_single,"current-page":s.pagination.page,"page-sizes":i.page_sizes,"page-size":s.pagination.per_page,total:s.pagination.total},null,8,["layout","onCurrentChange","onSizeChange","hide-on-single-page","current-page","page-sizes","page-size","total"])])}const Ve=I(Ry,[["render",Hy]]),Oy={name:"ReportReviewModal",components:{Pagination:Ve},data(){return{isOpen:!1,loading:!1,content:{},postReports:[],report:null,type:null,ignoring:!1,unpublishing:!1,pagination:{page:1,per_page:10,total:0}}},computed:{getReason(){return e=>this.appVars.report_reasons[e]},isContentLive(){var e;return((e=this.content)==null?void 0:e.status)=="published"},getPublishBtnText(){return this.isContentLive?this.$t("Dismiss Reports"):this.$t("Approve")+" "+this.$t(this.ucFirst(this.type))},getUnpublishBtnText(){return this.isContentLive?this.$t("Unpublish")+" "+this.$t(this.ucFirst(this.type)):this.$t("Remove")+" "+this.$t(this.ucFirst(this.type))}},methods:{closeModal(){this.isOpen=!1,this.content={},this.type=null,this.postReports=[],this.report=null,this.pagination={page:1,per_page:10,total:0}},showReportReviewModal(e){this.isOpen=!0,this.content=e.content,this.type=e.type,this.getPostReports()},getPostReports(){var t;this.loading=!0;let e={page:this.pagination.page,per_page:this.pagination.per_page,content_type:this.type,space_id:(t=this.content)==null?void 0:t.space_id};this.type=="comment"?e.parent_id=this.content.id:e.post_id=this.content.id,this.$get("moderation/reports",e).then(s=>{this.postReports=s.reports.data,this.report=s.reports.data[0]||null,this.pagination.total=s.reports.total}).catch(s=>{this.$handleError(s)}).finally(()=>{this.loading=!1})},ignoreReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.ignoring=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"ignored"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"ignored",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.ignoring=!1})},unpublishReport(){var e,t;if(!((e=this.report)!=null&&e.id)){this.$notify.error(this.$t("No moderation report found for this content."));return}this.unpublishing=!0,this.$put("moderation/reports/"+this.report.id,{space_id:(t=this.content)==null?void 0:t.space_id,status:"unpublished"}).then(s=>{this.$notify.success(s.message),this.isOpen=!1,this.$eventBus.emit("updateModerationReport",{content:s.content,action:"unpublished",type:this.type}),this.closeModal()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.unpublishing=!1})}},created(){this.$eventBus.on("showReportReviewModal",this.showReportReviewModal)},beforeUnmount(){this.$eventBus.off("showReportReviewModal",this.showReportReviewModal)}},jy={class:"dialog_body"},Ny={class:"report_details"},zy={class:"report_details_header"},qy={class:"report_details_header_left"},Gy={class:"report_details_header_right"},Yy={key:0},Wy={key:1},Zy={key:1},Ky={class:"report_reason"},Jy=["title"],Qy={key:0,class:"report_details_body"},Xy=["textContent"],ev={key:2,role:"region","aria-label":"Pagination",class:"pagination_wrap"},tv={class:"dialog_footer report_footer"};function sv(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=Z,g=p("Pagination"),k=H,b=we;return n(),y(b,{modelValue:o.isOpen,"onUpdate:modelValue":t[3]||(t[3]=w=>o.isOpen=w),"modal-class":"fcom_common_dialog",id:"fluent_comminity_body",width:e.dialogWidth,"append-to-body":!0,"close-on-click-modal":!1,direction:"rtl",onClose:i.closeModal},{footer:r(()=>[l("div",tv,[a(k,{class:"fcom_secondary_button",onClick:t[1]||(t[1]=w=>i.unpublishReport()),loading:o.unpublishing,disabled:!o.loading&&!o.report},{default:r(()=>[M(d(i.getUnpublishBtnText),1)]),_:1},8,["loading","disabled"]),a(k,{class:"fcom_primary_button",onClick:t[2]||(t[2]=w=>i.ignoreReport()),loading:o.ignoring,disabled:!o.loading&&!o.report},{default:r(()=>[M(d(i.getPublishBtnText),1)]),_:1},8,["loading","disabled"])])]),default:r(()=>{var w,S;return[l("div",jy,[l("h4",null,d(e.$t("Reports")+" ("+((S=(w=o.content)==null?void 0:w.meta)==null?void 0:S.reports_count)+")"),1),l("div",Ny,[o.loading?(n(),y(h,{key:1,rows:5,animated:!0})):(n(!0),c(P,{key:0},R(o.postReports,C=>(n(),c("div",{key:C.id,class:"report_details_item"},[l("div",zy,[l("div",qy,[C.reporter?(n(),y(m,{key:0,with_level:!1,xprofile:C.reporter},null,8,["xprofile"])):_("",!0)]),l("div",Gy,[!C.reporter&&!i.getReason(C.reason)?(n(),c("div",Yy,d(e.$t("Flagged automatically by the site rule")),1)):(n(),c("div",Wy,[C.reporter?(n(),y(f,{key:0,show_verified:!1,xprofile:C.reporter},null,8,["xprofile"])):(n(),c("span",Zy,d(e.$t("By System ")),1)),i.getReason(C.reason)?(n(),c(P,{key:2},[l("span",null,d(e.$t("reported for ")),1),l("span",Ky,d(i.getReason(C.reason)),1)],64)):_("",!0)])),l("div",{title:C.created_at,class:"meta_line"},d(e.humanDateDiff(C.created_at)),9,Jy)])]),C.explanation?(n(),c("div",Qy,[l("div",{textContent:d(C.explanation)},null,8,Xy)])):_("",!0)]))),128)),o.pagination.total?(n(),c("div",ev,[a(g,{hide_on_single:!0,onFetch:t[0]||(t[0]=C=>i.getPostReports()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])])]}),_:1},8,["modelValue","width","onClose"])}const ov=I(Oy,[["render",sv]]),iv={name:"PreviewPostModal",components:{Feed:nt},data(){return{loading:!1,isOpen:!1,previewData:null,allSpaces:this.appVars.auth.spaces}},methods:{closeModal(){this.isOpen=!1,this.previewData=null},showPreviewPostModal(e){if(e!=null&&e.message){if(!(e!=null&&e.space)&&!(e!=null&&e.is_editing)){this.$handleError({message:this.$t("Please select a space to preview.")});return}}else{this.$handleError({message:this.$t("Please write a message to preview.")});return}this.isOpen=!0,this.preparePreviewData(e),this.generatePreview()},preparePreviewData(e){var t;this.previewData={...e,xprofile:(t=e.author)!=null&&t.name?{display_name:e.author.name,avatar:e.author.avatar}:this.appVars.auth,space:this.allSpaces[e==null?void 0:e.space],created_at:dayjs.utc().subtract(this.appVars.date_offset,"s").format("YYYY-MM-DD HH:mm:ss"),content_type:this.determineContentType(e),meta:this.prepareMetadata(e),terms:this.processTopicIds(e)}},determineContentType(e){return e!=null&&e.survey?"survey":e!=null&&e.document_ids?"document":"post"},prepareMetadata(e){return{...e==null?void 0:e.meta,survey_config:e==null?void 0:e.survey,document_lists:e==null?void 0:e.document_ids}},processTopicIds(e){let t=e==null?void 0:e.topic_ids;return t?(t=Array.isArray(t)?t:[t],t.map(s=>this.currentTopics(e==null?void 0:e.space).find(u=>u.id==s))):[]},currentTopics(e){var s;if(!e)return[];let t=((s=this.allSpaces[e])==null?void 0:s.topics)||[];return t=Object.values(t),this.isModerator(e)?t:t.filter(u=>u.admin_only!="yes")},generatePreview(){this.loading=!0,this.$post("feeds/markdown-preview",{text:this.previewData.message,feed:this.previewData,with:["meta"]}).then(e=>{this.previewData.message_rendered=e.html,this.previewData.meta={...this.previewData.meta,...e.meta}}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},created(){this.$eventBus.on("showPreviewPostModal",this.showPreviewPostModal)},beforeUnmount(){this.$eventBus.off("showPreviewPostModal",this.showPreviewPostModal)}};function nv(e,t,s,u,o,i){const m=Z,f=H,h=p("Feed"),g=Ce,k=we;return o.previewData?(n(),y(k,{key:0,modelValue:o.isOpen,"onUpdate:modelValue":t[0]||(t[0]=b=>o.isOpen=b),class:"fcom_feed_modal",width:e.dialogWidth,"align-center":!0,"append-to-body":!0,"close-on-click-modal":!1,onClose:i.closeModal},{default:r(()=>[a(g,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[o.loading?(n(),y(m,{key:0,rows:4,animated:!0})):(n(),y(h,{key:1,feed:o.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:i.closeModal,text:""},null,8,["onClick"])]),_:1},8,["feed"]))]),_:1},512)]),_:1},8,["modelValue","width","onClose"])):_("",!0)}const lv=I(iv,[["render",nv]]),av={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)}},rv={class:"dialog_header"},cv={class:"dialog_left"},dv={class:"dialog_body"},uv={class:"dialog_footer"};function _v(e,t,s,u,o,i){const m=H,f=we;return n(),y(f,{"modal-class":"fcom_common_dialog fcom_editor_unfinished_dialog",modelValue:o.isVisible,"onUpdate:modelValue":t[0]||(t[0]=h=>o.isVisible=h),width:e.modalWidth,"close-on-click-modal":!1,"close-on-press-escape":!1,"append-to-body":!0,"show-close":!1},{header:r(()=>[l("div",rv,[l("div",cv,[l("h4",null,d(e.$t("Leave Page?")),1)])])]),footer:r(()=>[l("div",uv,[a(m,{class:"fcom_secondary_button",onClick:i.handleCancel},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["onClick"]),a(m,{class:"fcom_primary_button",onClick:i.handleProceed},{default:r(()=>[M(d(e.$t("Leave")),1)]),_:1},8,["onClick"])])]),default:r(()=>[l("div",dv,[l("span",null,d(o.message),1)])]),_:1},8,["modelValue","width"])}const mv=I(av,[["render",_v]]),hv={name:"MentionPopover",components:{UserRouteLink:Ie},setup(){return{userStore:De()}},data(){return{xprofile:null,virtualRef:null,hideTimeout:null,cache:{},cacheTTL:5*60*1e3,requestId:0}},methods:{getCached(e){const t=this.cache[e];return t?Date.now()-t.timestamp>this.cacheTTL?(delete this.cache[e],null):t.data:null},setCache(e,t){this.cache[e]={data:t,timestamp:Date.now()}},async showPopover({username:e,triggerElement:t}){this.cancelHide();const s=++this.requestId;let u=this.getCached(e);if(!u){try{u=await this.userStore.fetchProfile(e)}catch{return}this.setCache(e,u)}s===this.requestId&&(this.xprofile=u,this.virtualRef=t)},cancelHide(){clearTimeout(this.hideTimeout)},startHideTimeout(){this.cancelHide(),this.hideTimeout=setTimeout(()=>{this.virtualRef=null},200)}},mounted(){this.$eventBus.on("show_mention_popover",this.showPopover),this.$eventBus.on("hide_mention_popover",this.startHideTimeout)},beforeUnmount(){this.$eventBus.off("show_mention_popover",this.showPopover),this.$eventBus.off("hide_mention_popover",this.startHideTimeout),clearTimeout(this.hideTimeout)}};function fv(e,t,s,u,o,i){const m=p("UserRouteLink");return o.virtualRef&&o.xprofile?(n(),y(m,{key:0,xprofile:o.xprofile,virtualRef:o.virtualRef,show_badge:!0,show_follow:!0,onPopoverMouseenter:i.cancelHide,onPopoverMouseleave:i.startHideTimeout},null,8,["xprofile","virtualRef","onPopoverMouseenter","onPopoverMouseleave"])):_("",!0)}const pv=I(hv,[["render",fv]]);let gv=window.fluentComAdmin.el_i18n;for(const[e,t]of Object.entries(gv))Hs.el[e]=t;const yv={name:"PortalApplication",components:{NotificationsPop:Kn,SearchBar:Up,Feed:nt,SpaceCreateModal:Vy,ReportContentModal:Dy,ElConfigProvider:Os,ExpandIcon:gs,ReportReviewModal:ov,PreviewPostModal:lv,UnfinishedChangesModal:mv,MentionPopover:pv},setup(){const e=so(),t=Te();return{tickerStore:e,feedStore:t}},data(){return{loading:!1,mobileMenuItems:this.appVars.mobileMenuItems,hasSearchHolder:!1,hasNotificationHolder:!1,isSmallScreen:!1,popFeed:null,shopPopFeed:!1,prevUrl:null,previousFocus:null,enLang:Hs,loadedStyles:{},tickerDismissed:!1}},computed:{newFeedsCount(){return this.feedStore.getNewPostsCount("global")||0}},watch:{$route(e,t){var i,m;if(this.popFeed&&(this.prevUrl=e.href,this.closeFeedModal()),(i=e.meta)!=null&&i.lazy_styles&&this.loadLazyStyles(e.meta.lazy_styles),(m=e.meta)!=null&&m.in_space&&e.params.space){let f=e.params.space;const h=document.querySelectorAll(`.fcom_space_${f} .fcom_unread_count`);for(let g=0,k=h.length;g<k;g++)h[g].remove()}if(e.name==t.name&&e.path===t.path&&e.query.topic!=t.query.topic){this.$eventBus.emit("topic_changed",e.query.topic);return}e.query.create_space&&e.query.parent_id&&this.$eventBus.emit("open_create_space_modal",e.query.create_space),this.$eventBus.emit("route_updated",{to:e,from:t});const s=e.name;document.body.setAttribute("data-route",s),document.dispatchEvent(new CustomEvent("route_updated",{detail:{to:e,from:t}})),document.querySelectorAll(".feed_layout").forEach(f=>{f.classList.remove("space_opened")}),this.isSmallScreen&&document.querySelector(".feed_layout")&&document.querySelector(".feed_layout").classList.remove("space_opened");const u=e.meta.active_menu;document.querySelectorAll(".fcom_general_menu a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_general_menu a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")}),document.querySelectorAll(".fcom_sidebar_contents a").forEach(f=>{f.classList.remove("router-link-exact-active")}),u&&document.querySelectorAll(".fcom_sidebar_contents a.fcom_"+u).forEach(f=>{f.classList.add("router-link-exact-active")});const o=(f,h)=>{var g;if(h)try{(g=document.querySelector(f+h))==null||g.classList.add("router-link-exact-active")}catch(k){console.error(k)}};e.meta.in_course&&o(".fcom_space_",e.params.course_slug),e.meta.in_space&&o(".space_contents a.fcom_space_",e.params.space)}},methods:{dismissTicker(){this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),console.log("[App] Ticker dismissed")},routeToAllFeeds(){this.changeTitle(this.$t("Feeds")),this.tickerDismissed=!0,this.feedStore.clearNewPostsCount("global"),this.$router.push({name:"dashboard",query:{stamp:new Date().getTime(),sort_by:"latest"}})},reloadSidebarMenu(){this.$get("options/sidebar-menu-html").then(e=>{e.sidebar_html&&document.getElementById("fcom_sidebar_wrap")&&(document.getElementById("fcom_sidebar_wrap").innerHTML=e.sidebar_html,document.dispatchEvent(new CustomEvent("sidebar_menu_reloaded"))),e.auth_spaces&&(this.auth=e.auth_spaces)})},showFeedModal(e){e.feed&&(this.previousFocus=document.activeElement,this.popFeed=e.feed,this.shopPopFeed=!0,this.prevUrl=window.location.href,window.history.pushState({},"",e.feed.permalink),document.body.classList.add("fcom_post_modal_opened"),e.view=="comments"&&this.$nextTick(()=>{setTimeout(()=>{var m;const t=(m=this.$refs.feed_dialog_scroller)==null?void 0:m.wrapRef;if(!t)return;const s=e.highlight_comment_id,u=s?"instant":"smooth",o=s&&t.querySelector("#comment_"+s);if(o){t.querySelectorAll(".fcom_highlight_comment").forEach(f=>{f.classList.remove("fcom_highlight_comment")}),o.classList.add("fcom_highlight_comment"),t.scrollTo({top:o.offsetTop-100,behavior:u}),o.setAttribute("tabindex","-1"),o.focus({preventScroll:!0}),this.keepCommentInView(t,o);return}const i=t.querySelector(".feed_footer");i&&t.scrollTo({top:i.offsetTop-100,behavior:u})},100)}))},keepCommentInView(e,t){if(typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>{if(!e.contains(t)){s.disconnect();return}e.scrollTo({top:t.offsetTop-100,behavior:"instant"})});s.observe(e.firstElementChild||e),setTimeout(()=>s.disconnect(),2e3)},closeFeedModal(){if(window.fcom_modal_comment_unsaved){window.fcom_pending_modal_close=!0,this.$refs.unfinishedChangesModal.showModal("comment");return}this.proceedCloseFeedModal()},proceedCloseFeedModal(){this.shopPopFeed=!1,this.popFeed=null,this.prevUrl&&window.history.pushState({},"",this.prevUrl),document.body.classList.remove("fcom_post_modal_opened"),this.previousFocus&&typeof this.previousFocus.focus=="function"&&this.$nextTick(()=>{this.previousFocus.focus({preventScroll:!0}),this.previousFocus=null})},gotToFeed(){let e={name:"single_feed",params:{feed_slug:this.popFeed.slug}};this.popFeed.space&&(e={name:"space_feed",params:{feed_slug:this.popFeed.slug,space:this.popFeed.space.slug}}),this.popFeed.auto_focus_comment=!1,window.__showing_feed=this.popFeed,this.$router.push(e),this.$nextTick(()=>{this.closeFeedModal()})},async handleModalFeedDelete(){if(this.popFeed)try{const e=this.popFeed.space?`space-${this.popFeed.space.slug}`:"global";await this.feedStore.deleteFeed(e,this.popFeed.id),this.proceedCloseFeedModal(),this.$notify.success(this.$t("Post deleted successfully"))}catch(e){this.$handleError(e)}},loadLazyStyles(e){this.each(e,t=>{if(!this.appVars.lazy_styles[t]||this.loadedStyles[t])return;this.loadedStyles[t]=!0;let s=document.createElement("link");s.rel="stylesheet",s.href=this.appVars.lazy_styles[t],s.type="text/css",s.id=t,s.media="all",document.head.appendChild(s)})}},created(){const e=document.querySelector(".fcom_notification_holder");this.auth.user_id&&e&&(e.replaceChildren(),this.hasNotificationHolder=!0),this.hasSearchHolder=!!document.getElementsByClassName("fcom_search_holder").length,this.$eventBus.on("fresh_feeds_loaded",t=>{let s=t.space;s||(s="__all"),this.feedMonitorCache[s]=t.feeds[0].id}),document.addEventListener("doCustomGlobalSearch",t=>{this.$eventBus.emit("doGlobalSearch",t.detail.search)}),this.$eventBus.on("reloadMenu",()=>{this.reloadSidebarMenu()}),this.$eventBus.on("toTop",t=>{window.fcomLayoutRef&&(t||(t=0),window.fcomLayoutRef.scrollTo({top:t,behavior:"instant"}))}),this.isSmallScreen=window.innerWidth<=1024},mounted(){this.$eventBus.on("showFeedModal",this.showFeedModal),this.auth.user_id&&(console.log("[App] Starting new Pinia ticker with random intervals (45-75s)..."),this.tickerStore.start()),this.$watch("$route",e=>{e.name==="dashboard"&&(this.tickerDismissed=!1)})},beforeUnmount(){this.tickerStore.isActive&&(console.log("[App] Stopping Pinia ticker..."),this.tickerStore.stop())}},vv={key:0,class:"fcom_new_ticker"},bv={key:1,class:"fcom_mobile_menu"},kv={class:"focm_menu_items"},wv=["innerHTML"],Cv=["innerHTML"],$v=["href","aria-label"],Sv=["innerHTML"],Vv=["innerHTML"];function Mv(e,t,s,u,o,i){const m=p("router-view"),f=O,h=p("router-link"),g=Qo,k=p("ExpandIcon"),b=H,w=p("feed"),S=Ce,C=we,v=p("search-bar"),$=p("notifications-pop"),T=p("space-create-modal"),V=p("unfinished-changes-modal"),F=p("preview-post-modal"),L=p("report-content-modal"),A=p("report-review-modal"),D=p("mention-popover"),U=Os;return n(),y(U,{locale:o.enLang},{default:r(()=>[a(m,{class:x(e.appVars.route_classes)},null,8,["class"]),(n(),y(dt,{to:"body"},[u.tickerStore.isActive&&i.newFeedsCount>0&&!o.tickerDismissed?(n(),c("div",vv,[l("div",{onClick:t[0]||(t[0]=E=>i.routeToAllFeeds()),class:"fcom_ticker_menu"},d(e.$_n("A new post is available","%s new posts available",i.newFeedsCount)),1),l("div",{onClick:t[1]||(t[1]=E=>i.dismissTicker()),class:"fcom_ticker_dismiss"}," x ")])):_("",!0),o.mobileMenuItems&&o.mobileMenuItems.length?(n(),c("div",bv,[l("div",kv,[(n(!0),c(P,null,R(o.mobileMenuItems,E=>(n(),c("div",null,[E.route?(n(),y(h,{key:0,"aria-label":E.title?e.$t("Go to %s",E.title):e.$t("Menu item"),class:"focm_menu_item",to:E.route},{default:r(()=>[a(f,null,{default:r(()=>[E.icon?(n(),y(Ct(E.icon),{key:0})):E.icon_svg?(n(),c("span",{key:1,innerHTML:E.icon_svg},null,8,wv)):_("",!0)]),_:2},1024),E.html?(n(),c("span",{key:0,innerHTML:E.html},null,8,Cv)):_("",!0)]),_:2},1032,["aria-label","to"])):(n(),c("a",{key:1,href:E.permalink,"aria-label":E.title?e.$t("Go to %s",E.title):e.$t("Menu item"),class:"focm_menu_item"},[E.icon_svg?(n(),y(f,{key:0},{default:r(()=>[l("span",{innerHTML:E.icon_svg},null,8,Sv)]),_:2},1024)):_("",!0),l("span",{innerHTML:E.html},null,8,Vv)],8,$v))]))),256))])])):_("",!0),a(C,{ref:"fcom_feed_modal","destroy-on-close":"",modelValue:o.shopPopFeed,"onUpdate:modelValue":t[2]||(t[2]=E=>o.shopPopFeed=E),"close-on-click-modal":!0,"close-on-press-escape":!0,"before-close":()=>{i.closeFeedModal()},class:"fcom_feed_modal",width:"100%"},{default:r(()=>[a(S,{ref:"feed_dialog_scroller","max-height":"calc(100dvh - 40px)"},{default:r(()=>[o.popFeed?(n(),y(w,{key:0,onDeleted:i.handleModalFeedDelete,is_single:!0,feed:o.popFeed,is_modal:!0,show_report:!0},{after_feed_actions:r(()=>[a(g,{direction:"vertical"}),a(b,{onClick:i.gotToFeed,class:"no_pad_btn",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["onClick"]),a(b,{style:{padding:"0 5px"},class:"no_pad_bt fcom_close_pop",onClick:i.closeFeedModal,text:""},null,8,["onClick"])]),_:1},8,["onDeleted","feed"])):_("",!0)]),_:1},512)]),_:1},8,["modelValue","before-close"])])),o.hasSearchHolder?(n(),y(dt,{key:0,to:".fcom_search_holder"},[a(v)])):_("",!0),o.hasNotificationHolder?(n(),y(dt,{key:1,to:".fcom_notification_holder"},[a($)])):_("",!0),e.isAdmin?(n(),y(T,{key:2})):_("",!0),a(V,{ref:"unfinishedChangesModal",onProceed:i.proceedCloseFeedModal},null,8,["onProceed"]),a(F),a(L),a(A),a(D)]),_:1},8,["locale"])}const Tv=I(yv,[["render",Mv]]),Lv={name:"ContentLayout",props:["title","content_class","wrapper_class"]},Pv={key:0,class:"fhr_content_layout_header"},Fv={role:"region","aria-label":"Actions",class:"fhr_page_actions"};function Iv(e,t,s,u,o,i){return n(),c("div",{class:x([s.wrapper_class,"fhr_content_layout"])},[G(e.$slots,"header",{},()=>[s.title?(n(),c("div",Pv,[G(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(s.title),1)]),l("div",Fv,[G(e.$slots,"actions")])])):_("",!0)]),G(e.$slots,"sub_header"),l("div",{class:x([s.content_class,"fhr_content_layout_body"])},[G(e.$slots,"default")],2)],2)}const $e=I(Lv,[["render",Iv]]),Ev={name:"Dashboard",components:{Layout:$e},data(){return{greetings:"",notices:[]}},mounted(){this.$route.query.sort_by=="latest"&&this.$storeLocalData("feed_sort_by",""),this.$router.push({name:"all_feeds"})}},Uv={key:0,class:"dashboard_actions"},Av=["innerHTML"],Bv={key:1};function Dv(e,t,s,u,o,i){const m=p("layout");return n(),y(m,{title:o.greetings},{default:r(()=>[o.notices.length?(n(),c("div",Uv,[l("h4",null,d(e.$t("Action required")),1),l("ul",null,[(n(!0),c(P,null,R(o.notices,f=>(n(),c("li",{innerHTML:f},null,8,Av))),256))])])):(n(),c("div",Bv,[l("p",null,d(e.$t("All is well! This dashboard will be updated with something awesome!")),1)]))]),_:1},8,["title"])}const Rv=I(Ev,[["render",Dv]]),xv={name:"AppLayout",props:["wrapper_class"]},Hv={class:"feeds_main"};function Ov(e,t,s,u,o,i){const m=p("router-view");return n(),c("div",{class:x([s.wrapper_class,"feeds"])},[l("div",Hv,[G(e.$slots,"before_route_view"),G(e.$slots,"default",{},()=>[a(m)]),G(e.$slots,"after_route_view")])],2)}const Me=I(xv,[["render",Ov]]),jv={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)}},Nv={key:0,class:"app_side_widget widget_push_notification"},zv={class:"widget_header"},qv={style:{display:"flex","column-gap":"8px","align-items":"center",color:"var(--el-color-danger, #f56c6c)"}},Gv={class:"widget_body notifications_wrap"},Yv={class:"onboard_actions fcom_mt_10"},Wv={key:0},Zv={key:1},Kv={key:0},Jv={key:1,class:"app_side_widget widget_push_notification"};function Qv(e,t,s,u,o,i){const m=O,f=H;return i.hasPush?(n(),c("div",Nv,[l("div",zv,[l("h3",qv,[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",Gv,[l("p",null,d(e.$t("Get notified about replies to your posts and important community updates via web push notifications.")),1),l("div",Yv,[a(f,{loading:o.requestInProgress,type:"primary",onClick:t[0]||(t[0]=h=>i.processSubscribe())},{default:r(()=>[o.requestInProgress?(n(),c("span",Zv,d(e.$t("Processing...")),1)):(n(),c("span",Wv,d(e.$t("Turn On Push Notifications")),1))]),_:1},8,["loading"])]),o.requestInProgress?(n(),c("p",Kv,d(e.$t("Please click Allow to enable notifications.")),1)):_("",!0)])])):o.confirmed?(n(),c("div",Jv,[l("p",null,d(e.$t("You will get push notifications on replies and important updates.")),1)])):_("",!0)}const So=I(jv,[["render",Qv]]),Xv={name:"RecentActivities",components:{NotificationOnboard:So},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 s=this.appVars.urls.portal_base;return s=s.replace(/\/$/,""),s+t.fullPath}},mounted(){this.getActivities(),this.$eventBus.on("recent_activities_refresh",this.getActivities)},beforeUnmount(){this.$eventBus.off("recent_activities_refresh",this.getActivities)}},e0=["innerHTML"],t0={key:1,class:"app_side_widget fcom_widget_highlight"},s0={class:"widget_header"},o0={role:"region","aria-label":"Pending Members"},i0={class:"widget_body"},n0={key:2,role:"region","aria-label":"Featured Posts",class:"app_side_widget widget_recent_activities"},l0={class:"widget_header"},a0={class:"widget_body notifications_wrap"},r0={class:"notification_wrap"},c0=["href"],d0={class:"notification_item"},u0={class:"notification_avatar"},_0={class:"notification_content"},m0=["innerHTML"],h0={style:{"margin-top":"5px"},class:"feed_timestamp"},f0={role:"region","aria-label":"Space Activities",class:"app_side_widget widget_recent_activities"},p0={class:"widget_header"},g0={class:"widget_body notifications_wrap"},y0={class:"notification_wrap"},v0=["href"],b0={class:"notification_avatar"},k0={class:"notification_content"},w0=["innerHTML"],C0=["title"],$0={key:2,class:"notification_wrap"},S0={class:"notification_item"},V0={class:"notification_content"},M0={class:"no_notifications"},T0=["innerHTML"];function L0(e,t,s,u,o,i){const m=p("NotificationOnboard"),f=H,h=p("UserAvatar"),g=Z;return n(),c(P,null,[o.before_contents?(n(),c("div",{key:0,innerHTML:o.before_contents},null,8,e0)):_("",!0),a(m),o.pending_count&&s.with_pending_count?(n(),c("div",t0,[l("div",s0,[l("h3",o0,d(e.$t("Pending Members")),1)]),l("div",i0,[l("p",null,d(e.$t("%s people requested to join the community.",o.pending_count)),1)]),a(f,{role:"link","aria-label":"View pending members",onClick:t[0]||(t[0]=k=>e.$router.push({name:"space_members",query:{view_pending:"yes"}})),type:"danger"},{default:r(()=>[M(d(e.$t("View pending members")),1)]),_:1})])):_("",!0),s.with_pins&&o.pinned_posts.length?(n(),c("div",n0,[l("div",l0,[l("h3",null,d(s.pinned_widget_title||e.$t("Featured Posts")),1)]),l("div",a0,[(n(!0),c(P,null,R(o.pinned_posts,k=>{var b;return n(),c("div",r0,[l("a",{class:"no_style_link",href:k.permalink},[l("div",d0,[l("div",u0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",_0,[l("div",{innerHTML:k.message},null,8,m0),l("span",h0,d((b=k.xprofile)==null?void 0:b.display_name),1)])])],8,c0)])}),256))])])):_("",!0),l("div",f0,[l("div",p0,[l("h3",null,d(s.widget_title||e.$t("Recent Activities")),1)]),l("div",g0,[o.loading?(n(),y(g,{key:0,style:{"min-width":"320px"},animated:!0,rows:5})):o.activities.length?(n(!0),c(P,{key:1},R(o.activities,k=>(n(),c("div",y0,[l("a",{href:i.getActivityLink(k),class:"notification_item"},[l("div",b0,[a(h,{with_level:!1,xprofile:k.xprofile},null,8,["xprofile"])]),l("div",k0,[l("div",{innerHTML:k.message},null,8,w0),l("span",{title:k.updated_at,class:"notification_time_stamp"},d(e.humanDateDiff(k.updated_at)),9,C0)])],8,v0)]))),256)):(n(),c("div",$0,[l("div",S0,[l("div",V0,[l("div",M0,d(e.$t("No recent activities found")),1)])])]))])]),o.after_contents?(n(),c("div",{key:3,innerHTML:o.after_contents},null,8,T0)):_("",!0)],64)}const Gt=I(Xv,[["render",L0]]),P0={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 F0(e,t,s,u,o,i){const m=Fe,f=H,h=mt,g=p("CloseBold"),k=O;return n(),c(P,null,[a(h,{action:i.action_url,headers:i.headers,accept:"image/*",class:"fcom_bg_upload",multiple:s.is_multiple,data:s.additional_data,"show-file-list":!1,"on-success":i.handleSuccess,"on-error":i.handleError},{default:r(()=>[G(e.$slots,"trigger",{},()=>[G(e.$slots,"default",{},()=>[o.imageUrl?(n(),y(m,{key:0,alt:e.$t("Image Preview"),src:o.imageUrl},null,8,["alt","src"])):(n(),y(f,{key:1,class:"fcom_btn_upload",text:""},{default:r(()=>[M(d(s.button_text||e.$t("Upload Image")),1)]),_:1}))])])]),_:3},8,["action","headers","multiple","data","on-success","on-error"]),o.imageUrl&&s.can_remove?(n(),y(f,{key:0,class:"fcom_bg_remove",text:"",size:"small",onClick:i.removeImage},{default:r(()=>[a(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClick"])):_("",!0)],64)}const Vo=I(P0,[["render",F0]]),I0={name:"WelcomeBannerConfig",props:["savingCount"],emits:["saved"],components:{MediaEmbeder:_s,BgImageUpload:Vo,CrepeEditor:Et},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()}},E0={class:"fcom_customizer_container"},U0={class:"fcom_wc_banner_header"},A0={class:"fcom_wc_banner_options"},B0={class:"fcom_filter_menu"},D0={class:"fcom_filter_menu_ul"},R0={key:0,class:"fcom_wc_banner_content"},x0={class:"fcom_wc_banner_content_header"},H0={class:"fcom_wc_banner_media_type"},O0={key:0,class:"fcom_banner_image_holder"},j0={key:1,class:"fcom_banner_image_preview"},N0={key:0,class:"fcom_wc_banner_cta_buttons"},z0={class:"fcom_wc_help_text"},q0={class:"fcom_wc_banner_content_footer"};function G0(e,t,s,u,o,i){const m=js,f=Re,h=ke,g=p("BgImageUpload"),k=Fe,b=p("CloseBold"),w=O,S=H,C=p("media-embeder"),v=te,$=ue,T=p("crepe-editor"),V=ie,F=ne,L=Xo,A=fe,D=_e,U=Z;return n(),c("div",E0,[l("div",U0,[l("h4",null,d(e.$t("Welcome Banner")),1)]),l("div",A0,[l("div",B0,[l("ul",D0,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(E=>i.switchOption("login"),["prevent"])),class:x({"router-link-exact-active":o.currentTab=="login"}),href:"#"},d(e.$t("Logged in")),3)]),l("li",null,[l("a",{onClick:t[1]||(t[1]=z(E=>i.switchOption("logout"),["prevent"])),class:x({"router-link-exact-active":o.currentTab=="logout"}),href:"#"},d(e.$t("Logged out")),3)])])])]),o.loading?(n(),y(U,{key:1,rows:5})):(n(),c("div",R0,[l("div",x0,[l("h4",null,d(o.currentTab==="login"?e.$t("Enable for logged in members"):e.$t("Enable for logged out members")),1),a(m,{modelValue:o.bannerData[o.currentTab].enabled,"onUpdate:modelValue":t[2]||(t[2]=E=>o.bannerData[o.currentTab].enabled=E),"active-value":"yes","inactive-value":"no",class:"fcom_switch"},null,8,["modelValue"])]),l("div",{class:x(["fcom_wc_banner_content_body",{fcom_wc_disabled:!i.isEnabled}])},[l("div",H0,[l("p",null,d(e.$t("Media type")),1),a(h,{modelValue:o.bannerData[o.currentTab].mediaType,"onUpdate:modelValue":t[3]||(t[3]=E=>o.bannerData[o.currentTab].mediaType=E),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"])]),o.bannerData[o.currentTab].mediaType==="image"?(n(),c(P,{key:0},[o.bannerData[o.currentTab].bannerImage?(n(),c("div",j0,[a(k,{alt:e.$t("Image Preview"),src:o.bannerData[o.currentTab].bannerImage},null,8,["alt","src"]),a(S,{class:"fcom_secondary_button",text:"",onClick:t[5]||(t[5]=E=>o.bannerData[o.currentTab].bannerImage="")},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1})]),_:1})])):(n(),c("div",O0,[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(g,{modelValue:o.bannerData[o.currentTab].bannerImage,"onUpdate:modelValue":t[4]||(t[4]=E=>o.bannerData[o.currentTab].bannerImage=E)},null,8,["modelValue"])]))],64)):_("",!0),o.bannerData[o.currentTab].mediaType==="video"?(n(),y(C,{key:1,media:o.bannerData[o.currentTab].bannerVideo},null,8,["media"])):_("",!0),a(D,{onSubmit:t[9]||(t[9]=z(E=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Title")},{default:r(()=>[a(v,{modelValue:o.bannerData[o.currentTab].title,"onUpdate:modelValue":t[6]||(t[6]=E=>o.bannerData[o.currentTab].title=E)},null,8,["modelValue"])]),_:1},8,["label"]),a($,{label:e.$t("Description")},{default:r(()=>[o.appReady?(n(),y(T,{key:0,modelValue:o.bannerData[o.currentTab].description,"onUpdate:modelValue":t[7]||(t[7]=E=>o.bannerData[o.currentTab].description=E)},null,8,["modelValue"])):_("",!0)]),_:1},8,["label"]),a($,{label:e.$t("Call to Action")},{default:r(()=>{var E;return[((E=o.bannerData[o.currentTab].ctaButtons)==null?void 0:E.length)>0?(n(),c("div",N0,[(n(!0),c(P,null,R(o.bannerData[o.currentTab].ctaButtons,(q,j)=>(n(),c("div",{key:j,class:"fcom_wc_banner_cta_button"},[a($,{label:j?"":e.$t("Button Label")},{default:r(()=>[a(v,{modelValue:q.label,"onUpdate:modelValue":N=>q.label=N},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a($,{label:j?"":e.$t("Button Link")},{default:r(()=>[a(v,{modelValue:q.link,"onUpdate:modelValue":N=>q.link=N},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a($,{label:j?"":e.$t("Button Type"),class:"fcom_wc_banner_select"},{default:r(()=>[a(F,{modelValue:q.type,"onUpdate:modelValue":N=>q.type=N,class:"fcom_select",placeholder:e.$t("Select type")},{default:r(()=>[a(V,{label:e.$t("Primary"),value:"primary"},null,8,["label"]),a(V,{label:e.$t("Secondary"),value:"secondary"},null,8,["label"]),a(V,{label:e.$t("Text"),value:"text"},null,8,["label"]),a(V,{label:e.$t("Link"),value:"link"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"]),a($,{label:j?"":e.$t("Open in new tab"),class:"fcom_wc_banner_select"},{default:r(()=>[a(F,{modelValue:q.newTab,"onUpdate:modelValue":N=>q.newTab=N,class:"fcom_select"},{default:r(()=>[a(V,{label:e.$t("Yes"),value:"yes"},null,8,["label"]),a(V,{label:e.$t("No"),value:"no"},null,8,["label"])]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),a(S,{text:"",class:"wc_button_remove",onClick:N=>i.removeButton(j)},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1})]),_:1},8,["onClick"])]))),128)),a(L,{underline:!1,onClick:i.addButton},{default:r(()=>[M(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"])])):(n(),y(L,{key:1,underline:!1,onClick:i.addButton},{default:r(()=>[M(d("+ "+e.$t("Add button")),1)]),_:1},8,["onClick"]))]}),_:1},8,["label"]),o.currentTab=="login"?(n(),y($,{key:0},{default:r(()=>[a(A,{modelValue:o.bannerData[o.currentTab].allowClose,"onUpdate:modelValue":t[8]||(t[8]=E=>o.bannerData[o.currentTab].allowClose=E),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Allow members to close the welcome banner")),1)]),_:1},8,["modelValue"]),l("span",z0,d(e.$t("If allowed, members will be able to hide the banner")),1)]),_:1})):_("",!0)]),_:1})],2),l("div",q0,[a(S,{class:"fcom_primary_button",disabled:o.saving,loading:o.saving,onClick:i.saveSettings},{default:r(()=>[M(d(e.$t("Update Info")),1)]),_:1},8,["disabled","loading","onClick"])])]))])}const Y0=I(I0,[["render",G0]]);const W0={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 s=this.items[this.draggingIndex],u=this.items[t];if(s===u)return;const o=e.currentTarget.getBoundingClientRect(),i=o.top+o.height/2,m=e.clientY;(this.draggingIndex<t&&m>i||this.draggingIndex>t&&m<i)&&(this.reorderItems(this.draggingIndex,t),this.draggingIndex=t)},dropEnd(e,t){const s=e.dataTransfer.getData("source-group");if(!(!this.group&&s)){if(this.group&&s&&s!==this.group){e.stopPropagation();const u=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:u,sourceGroup:s,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 s=e.dataTransfer.getData("text/plain");this.$emit("crossDrop",{itemKey:s,sourceGroup:t,targetGroup:this.group,targetIndex:this.items.length})},reorderItems(e,t){const s=this.items.splice(e,1)[0];this.items.splice(t,0,s)}}},Z0=["onDragstart","onDragover","onDrop","draggable"];function K0(e,t,s,u,o,i){return n(),c("div",{class:"drag-container",onDragover:t[1]||(t[1]=z((...m)=>i.onContainerDragOver&&i.onContainerDragOver(...m),["prevent"])),onDrop:t[2]||(t[2]=z((...m)=>i.onContainerDrop&&i.onContainerDrop(...m),["prevent"]))},[a(zo,{name:"flip-list",tag:"div",class:"drag-group",style:re(s.gap?{display:"flex",flexDirection:"column",gap:s.gap}:{})},{default:r(()=>[(n(!0),c(P,null,R(s.items,(m,f)=>(n(),c("div",{key:m[s.rowKey],onDragstart:h=>i.dragStart(h,f),onDragend:t[0]||(t[0]=(...h)=>i.dragEnd&&i.dragEnd(...h)),onDragover:z(h=>i.dragOver(h,f),["prevent"]),onDrop:z(h=>i.dropEnd(h,f),["prevent"]),draggable:s.draggable,class:x(["drag-item",s.itemClass,{dragging:o.draggingIndex===f}]),style:re(s.itemStyle)},[G(e.$slots,"item",{data:m,index:f},void 0,!0)],46,Z0))),128))]),_:3},8,["style"])],32)}const J0=I(W0,[["render",K0],["__scopeId","data-v-97dc50e4"]]),Q0={name:"MenuGroupSettings",components:{SpaceCourseSelector:qt,FluentDnD:J0,LogoEmojiSelector:Ht,Drawer:ko},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=Nt(this.editingItem.permalink);e.valid||this.urlErrors.push(...e.errors)}return this.urlErrors.length===0},initEditLink(e,t="create"){e.privacy||(e.privacy="public",e.membership_ids=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()}}},X0={key:0,class:"fcom_section_primary"},eb={class:"fcom_section_primary_item"},tb={class:"fcom_section_primary_item_title"},sb={class:"fcom_heading_item"},ob={class:"fcom_section_item_actions"},ib={class:"fcom_section_items menu-items-container"},nb={key:0,style:{padding:"1rem"}},lb={class:"fcom_section_item_title"},ab={class:"fcom_heading_item"},rb={key:0,class:"community_avatar"},cb=["src"],db={key:1,class:"fcom_emoji"},ub={key:2,class:"fcom_shape"},_b=["innerHTML"],mb={class:"fcom_section_item_actions"},hb={key:0},fb={key:1},pb={key:0},gb={class:"fcom_help_text"},yb={class:"fcom_help_text"};function vb(e,t,s,u,o,i){const m=H,f=O,h=Ue,g=p("FluentDnD"),k=p("logo-emoji-selector"),b=te,w=ue,S=fe,C=Re,v=ke,$=p("SpaceCourseSelector"),T=xs,V=_e,F=p("drawer");return n(),c(P,null,[s.menuItems?(n(),c("div",X0,[l("div",eb,[l("div",tb,[l("div",sb,[G(e.$slots,"title",{},()=>[l("h4",null,d(s.title),1)])])]),l("div",ob,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=L=>i.initEditLink({enabled:"yes",privacy:"public",membership_ids:[],new_tab:"yes"}))},{default:r(()=>[M(d(e.$t("Add New Link")),1)]),_:1})])]),l("div",ib,[s.menuItems.length?_("",!0):(n(),c("div",nb,[l("p",null,d(e.$t("No link has been added for this section")),1)])),a(g,{items:s.menuItems,"row-key":"slug",onDrop:i.drop,"item-class":"fcom_section_item"+(s.saving?"":" fcom_cursor_move"),"item-style":"padding: 15px 15px 15px 35px"},{item:r(({data:L,index:A})=>[l("div",lb,[l("p",ab,[s.use_icon_selector?(n(),c(P,{key:0},[t[12]||(t[12]=l("div",{class:"fcom_drag_handle"}," ⋮⋮ ",-1)),L.icon_image?(n(),c("div",rb,[a(f,null,{default:r(()=>[l("img",{alt:"",style:{"max-width":"16px","max-height":"16px"},src:L.icon_image},null,8,cb)]),_:2},1024)])):L.emoji?(n(),c("span",db,d(L.emoji),1)):L.shape_svg?(n(),c("span",ub,[a(f,{innerHTML:L.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):L.icon_svg?(n(),y(f,{key:1},{default:r(()=>[l("span",{innerHTML:L.icon_svg},null,8,_b)]),_:2},1024)):_("",!0),l("span",null,d(L.title),1),L.is_unavailable=="yes"?(n(),y(h,{key:2,type:"danger"},{default:r(()=>[M(d(e.$t("unavailable")),1)]),_:1})):L.enabled=="yes"?(n(),y(h,{key:3,type:"success"},{default:r(()=>[M(d(e.$t("enabled")),1)]),_:1})):(n(),y(h,{key:4,type:"info"},{default:r(()=>[M(d(e.$t("disabled")),1)]),_:1}))])]),l("div",mb,[l("div",null,[a(m,{onClick:D=>i.initEditLink(L,"edit"),size:"small"},{default:r(()=>[M(d(e.$t("Edit")),1)]),_:1},8,["onClick"]),L.is_system!="yes"?(n(),y(m,{key:0,onClick:D=>i.removeLink(A),type:"danger",plain:"",size:"small"},{default:r(()=>[M(d(e.$t("Delete")),1)]),_:1},8,["onClick"])):_("",!0)])])]),_:1},8,["items","onDrop","item-class"])])])):_("",!0),a(F,{modelValue:o.openEditLinkDrawer,"onUpdate:modelValue":t[11]||(t[11]=L=>o.openEditLinkDrawer=L),size:e.drawerWidth,"before-close":i.beforeCloseDrawer,id:"fluent_comminity_body","close-on-click-modal":!0,"has-close-confirmation":i.isDirty&&!s.saving,"close-confirmation-message":e.$t("Closing will discard your changes. Are you sure?")},{header:r(()=>[o.mode==="edit"?(n(),c("h4",hb,d(e.$t("Edit Link")),1)):(n(),c("h4",fb,d(e.$t("Add Custom Link")),1))]),default:r(()=>[o.editingItem?(n(),c("div",pb,[a(V,{onSubmit:t[10]||(t[10]=z(L=>e.doNothing(),["prevent"])),"label-position":"top",disabled:s.saving},{default:r(()=>[a(w,{label:e.$t("Name of the Link")},{default:r(()=>[a(b,{disabled:s.saving,placeholder:e.$t("Public Name of the item"),modelValue:o.editingItem.title,"onUpdate:modelValue":t[2]||(t[2]=L=>o.editingItem.title=L)},ve({_:2},[s.use_icon_selector?{name:"prepend",fn:r(()=>[a(k,{custom_svg:s.custom_svg,fallback_mark:"<span style='font-size: 20px;'>☺</span>",onUpdate:t[1]||(t[1]=L=>{s.saving||(o.editingItem.emoji=L.emoji,o.editingItem.icon_image=L.logo,o.editingItem.shape_svg=L.shape_svg)}),config:{logo:o.editingItem.icon_image,emoji:o.editingItem.emoji||"",shape_svg:o.editingItem.shape_svg||""}},null,8,["custom_svg","config"])]),key:"0"}:void 0]),1032,["disabled","placeholder","modelValue"])]),_:1},8,["label"]),a(w,{label:e.$t("URL")},{default:r(()=>[a(b,{disabled:s.saving||o.editingItem.is_system=="yes",type:"text",placeholder:e.$t("URL or path (e.g. https://example.com or /members)"),modelValue:o.editingItem.permalink,"onUpdate:modelValue":t[3]||(t[3]=L=>o.editingItem.permalink=L)},null,8,["disabled","placeholder","modelValue"]),l("div",gb,[l("p",null,d(e.$t("For internal links, start with / (e.g. /members).")),1)])]),_:1},8,["label"]),s.has_svg?(n(),y(w,{key:0,label:e.$t("SVG Code for Icon (Simplified SVG Code) / Emoji")},{default:r(()=>[a(b,{disabled:s.saving,placeholder:e.$t("SVG Code. No url please / You can use emoji"),type:"textarea",rows:3,modelValue:o.editingItem.icon_svg,"onUpdate:modelValue":t[4]||(t[4]=L=>o.editingItem.icon_svg=L)},null,8,["disabled","placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),s.has_enable_disable?(n(),y(w,{key:1,style:{"margin-bottom":"5px"}},{default:r(()=>[a(S,{disabled:s.saving,"true-value":"yes","false-value":"no",modelValue:o.editingItem.enabled,"onUpdate:modelValue":t[5]||(t[5]=L=>o.editingItem.enabled=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Enable this link")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),o.editingItem.is_system!="yes"?(n(),y(w,{key:2},{default:r(()=>[a(S,{disabled:s.saving,"true-value":"yes","false-value":"no",modelValue:o.editingItem.new_tab,"onUpdate:modelValue":t[6]||(t[6]=L=>o.editingItem.new_tab=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Open this link in a new tab.")),1)]),_:1},8,["disabled","modelValue"])]),_:1})):_("",!0),a(w,{label:e.$t("Visibility")},{default:r(()=>[a(v,{disabled:s.saving,modelValue:o.editingItem.privacy,"onUpdate:modelValue":t[7]||(t[7]=L=>o.editingItem.privacy=L)},{default:r(()=>[a(C,{label:e.$t("Everyone"),value:"public"},null,8,["label"]),a(C,{label:e.$t("Logged-in only"),value:"logged_in"},null,8,["label"]),a(C,{label:e.$t("Public only"),value:"logged_out_only"},null,8,["label"]),a(C,{label:e.$t("By Space/Course Memberships"),value:"members_only"},null,8,["label"])]),_:1},8,["disabled","modelValue"]),l("div",yb,d(e.$t("Select who can see this link.")),1)]),_:1},8,["label"]),o.editingItem.privacy=="members_only"?(n(),y(w,{key:3,label:e.$t("Select Space/Course Memberships")},{default:r(()=>[a($,{disabled:s.saving,modelValue:o.editingItem.membership_ids,"onUpdate:modelValue":t[8]||(t[8]=L=>o.editingItem.membership_ids=L),placeholder_text:e.$t("Select Memberships"),is_multiple:!0},null,8,["disabled","modelValue","placeholder_text"])]),_:1},8,["label"])):_("",!0),o.urlErrors.length?(n(),y(T,{key:o.validationAttempt,type:"warning",closable:!0,"show-icon":"",style:{margin:"8px 0"}},{title:r(()=>[l("div",null,[l("ul",null,[(n(!0),c(P,null,R(o.urlErrors,(L,A)=>(n(),c("li",{style:{"margin-bottom":"0"},key:A},d(L),1))),128))])])]),_:1})):_("",!0),a(w,null,{default:r(()=>[a(m,{disabled:s.saving,class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>i.createOrUpdateLink())},{default:r(()=>[M(d(s.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 Mo=I(Q0,[["render",vb]]),bb={name:"ManageFeedLinks",components:{MenuGroupSettings:Mo},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()}},kb={class:"fcom_customizer_container"},wb={key:0,class:"fcom_card_sections"};function Cb(e,t,s,u,o,i){const m=p("menu-group-settings"),f=Z;return n(),c("div",kb,[o.loading?_("",!0):(n(),c("div",wb,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,title:e.$t("Manage Links"),menuItems:o.menuItems,onSave:t[0]||(t[0]=h=>i.saveMenuItems())},null,8,["title","menuItems"])])),o.loading?(n(),y(f,{key:1,rows:5,animated:""})):_("",!0)])}const $b=I(bb,[["render",Cb]]),Sb={name:"FeedCustomizer",props:["customize_tab"],components:{WelcomeBannerConfig:Y0,ManageFeedLinks:$b},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)}}},Vb={class:"fcom_full_editor"},Mb={class:"fcom_full_editor_header"},Tb={class:"fcom_editor_menu object_menu"},Lb={class:"fcom_space_menu_ul"},Pb={class:"full_editor_actions"};function Fb(e,t,s,u,o,i){const m=p("ArrowLeft"),f=O,h=H,g=Ns,k=p("welcome-banner-config"),b=Ce,w=Le,S=p("manage-feed-links"),C=qe;return n(),c("div",Vb,[a(C,null,{default:r(()=>[a(g,{class:"fcom_full_editor_header_wrap"},{default:r(()=>[l("div",Mb,[l("div",{onClick:t[0]||(t[0]=(...v)=>i.handleBack&&i.handleBack(...v)),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),M(" "+d(e.$t("Feed")),1)]),l("div",Tb,[l("ul",Lb,[e.has_pro?(n(),c("li",{key:0,onClick:t[1]||(t[1]=v=>o.currentTab="welcome")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="welcome"}),href:"#"},d(e.$t("Welcome Banner")),3)])):_("",!0),l("li",{onClick:t[2]||(t[2]=v=>o.currentTab="manage_links")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="manage_links"}),href:"#"},d(e.$t("Feed Links")),3)])])]),l("div",Pb,[a(h,{class:"fcom_primary_button",disabled:o.saving,loading:o.saving,onClick:i.saveChanges},{default:r(()=>[M(d(e.$t("Save Changes")),1)]),_:1},8,["disabled","loading","onClick"])])])]),_:1}),a(C,{class:"fcom_full_editor_container"},{default:r(()=>[o.currentTab=="welcome"?(n(),y(w,{key:0,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(k,{savingCount:o.savingCount,onSaved:i.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):o.currentTab=="manage_links"?(n(),y(w,{key:1,class:"fcom_full_editor_main"},{default:r(()=>[a(b,null,{default:r(()=>[a(S,{savingCount:o.savingCount,onSaved:i.savedData},null,8,["savingCount","onSaved"])]),_:1})]),_:1})):_("",!0)]),_:1})]),_:1})])}const Ib=I(Sb,[["render",Fb]]),Eb={name:"FeedMenu",components:{FeedCustomizer:Ib},data(){return{customizeTab:"welcome",customizeSpace:!1}},methods:{openCustomizer(e){var t;(t=this.$refs.feed_actions)==null||t.hide(),this.customizeTab=e,this.customizeSpace=!0},updatedFeedSettings(e){this.customizeSpace=!1,e&&location.reload()}}},Ub={class:"actions_items"},Ab={key:0};function Bb(e,t,s,u,o,i){const m=p("MoreFilled"),f=O,h=H,g=ye,k=p("feed-customizer");return n(),c(P,null,[l("div",null,[a(g,{placement:"bottom",ref:"feed_actions",trigger:"click",persistent:!1,"popper-options":{strategy:"fixed"}},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Ub,[e.has_pro?(n(),c("li",{key:0,onClick:t[0]||(t[0]=b=>i.openCustomizer("welcome"))},d(e.$t("Welcome Banner")),1)):_("",!0),l("li",{onClick:t[1]||(t[1]=b=>i.openCustomizer("manage_links"))},d(e.$t("Manage Links")),1)])]),_:1},512)]),o.customizeSpace?(n(),c("div",Ab,[(n(),y(dt,{to:"body"},[a(k,{customize_tab:o.customizeTab,onClose:t[2]||(t[2]=b=>o.customizeSpace=!1),onUpdated:i.updatedFeedSettings},null,8,["customize_tab","onUpdated"])]))])):_("",!0)],64)}const Db=I(Eb,[["render",Bb]]),Rb={name:"RenderSpaceLinks",props:{links:{type:Array,required:!0}},computed:{enabledLinks(){return this.links.filter(e=>e.enabled!=="no")}}},xb={class:"object_menu"},Hb={class:"fcom_space_menu_ul"},Ob=["target","href"],jb=["src"],Nb={key:1,class:"fcom_emoji"},zb={key:2,style:{"font-size":"120%"},class:"fcom_shape"};function qb(e,t,s,u,o,i){const m=O;return n(),c("div",xb,[l("ul",Hb,[(n(!0),c(P,null,R(i.enabledLinks,f=>(n(),c("li",{key:f.slug},[l("a",{target:f.new_tab=="yes"?"_blank":"",rel:"noopener nofollow",href:f.permalink},[f.icon_image?(n(),c("img",{key:0,alt:"",src:f.icon_image},null,8,jb)):f.emoji?(n(),c("span",Nb,d(f.emoji),1)):f.shape_svg?(n(),c("span",zb,[a(m,{innerHTML:f.shape_svg},null,8,["innerHTML"])])):_("",!0),l("span",null,d(f.title),1)],8,Ob)]))),128))])])}const ys=I(Rb,[["render",qb]]),Gb={name:"FeedsRoute",components:{SpaceIcon:Ye,Layout:$e,AppLayout:Me,RecentActivities:Gt,FeedMenu:Db,RenderSpaceLinks:ys},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)}},Yb={key:0,"aria-label":"Feed Links",class:"fcom_sub_header"},Wb={key:0,class:"fcom_profile_complete_btn_wrap"},Zb={key:1},Kb={key:0,class:"fcom_feed_box"},Jb={key:0,class:"fcom_main_side_wrap"},Qb={class:"fcom_side_box"};function Xb(e,t,s,u,o,i){const m=p("render-space-links"),f=H,h=p("feed-menu"),g=p("router-view"),k=Le,b=p("recent-activities"),w=et,S=qe,C=p("layout"),v=p("app-layout");return n(),y(v,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(C,{wrapper_class:"no_bg_layout",title:e.$t("Feed")},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=$=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title clickable"},d(e.$t("Feed")),1)]),sub_header:r(()=>{var $;return[(($=e.appVars.feed_links)==null?void 0:$.length)>0?(n(),c("nav",Yb,[a(m,{links:e.appVars.feed_links},null,8,["links"])])):_("",!0)]}),actions:r(()=>[e.auth.compilation_score<100?(n(),c("div",Wb,[a(f,{onClick:i.goToProfile,type:"danger"},{default:r(()=>[M(d(e.$t("Complete your profile"))+" ("+d(e.auth.compilation_score)+"%)",1)]),_:1},8,["onClick"])])):_("",!0),e.isAdmin()?(n(),c("div",Zb,[a(h)])):_("",!0)]),default:r(()=>[a(S,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(k,{class:"fcom_main"},{default:r(()=>[o.transiting?_("",!0):(n(),c("div",Kb,[a(g)]))]),_:1}),a(w,{class:"fcom_resp_side",width:"306px"},{default:r(()=>[e.isMobile?_("",!0):(n(),c("div",Jb,[l("div",Qb,[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 e2=I(Gb,[["render",Xb]]);const t2={name:"NewPostsBanner",components:{ArrowUp:Zs},props:{context:{type:String,default:"global"},minScrollToShow:{type:Number,default:500}},setup(){return{feedStore:Te()}},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}}},s2={class:"fcom_new_posts_text"};function o2(e,t,s,u,o,i){const m=p("ArrowUp"),f=O;return n(),y(As,{name:"slide-down"},{default:r(()=>[o.show?(n(),c("div",{key:0,class:"fcom_new_posts_banner",onClick:t[0]||(t[0]=(...h)=>i.scrollToTop&&i.scrollToTop(...h))},[a(f,{class:"fcom_new_posts_icon"},{default:r(()=>[a(m)]),_:1}),l("span",s2,d(o.count===1?e.$t("1 new post available"):e.$t("{count} new posts available",{count:o.count})),1)])):_("",!0)]),_:1})}const i2=I(t2,[["render",o2],["__scopeId","data-v-e4ec71f4"]]),n2={name:"AllFeeds",components:{Feeds:yt,NewPostsBanner:i2},setup(){return{tickerStore:so()}},mounted(){var e,t;if(this.changeTitle(this.$t("All Feeds")),(e=this.appVars.features)!=null&&e.enable_feed_ticker){const s=((t=this.appVars.features)==null?void 0:t.ticker_interval)||3e4;this.tickerStore.start(s)}},beforeUnmount(){var e;(e=this.appVars.features)!=null&&e.enable_feed_ticker&&this.tickerStore.stop()}},l2={key:0,class:"notices fcom_notice_wrap"},a2=["innerHTML"];function r2(e,t,s,u,o,i){var g;const m=p("WelcomeBanner"),f=p("NewPostsBanner"),h=p("feeds");return n(),c(P,null,[e.appVars.portal_notices&&e.appVars.portal_notices.length?(n(),c("div",l2,[(n(!0),c(P,null,R(e.appVars.portal_notices,k=>(n(),c("div",{innerHTML:k},null,8,a2))),256))])):_("",!0),e.appVars.welcome_banner?(n(),y(m,{key:1})):_("",!0),(g=e.appVars.features)!=null&&g.enable_feed_ticker?(n(),y(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 c2=I(n2,[["render",r2]]),d2={name:"ViewFeed",components:{Feed:nt},props:["feed_slug"],setup(){return{feedStore:Te()}},data(){return{loading:!0,feed:null,notFound:!1}},watch:{feed_slug(){this.feed=null,this.$nextTick(()=>{this.getFeed()})},"$route.query.comment_id"(e){e&&this.highlightComment(e)}},methods:{getFeed(){this.feed=null,this.loading=!0,this.$get("feeds/"+this.feed_slug+"/by-slug").then(e=>{if(this.isWrongSpaceContext(e.feed)){this.notFound=!0;return}this.feed=e.feed,this.appVars.last_feed_id<e.feed.id&&(this.appVars.last_feed_id=e.feed.id),e.current_user_follows&&this.setFollowIds(e.current_user_follows),this.changeFeedTitle(),this.$nextTick(()=>{this.checkCommentScroll()})}).catch(e=>{this.$handleError(e),typeof e=="object"&&e.xhr_status==404&&(this.notFound=!0)}).finally(()=>{this.loading=!1})},isWrongSpaceContext(e){var s;const t=this.$route.params.space;return t&&((s=e==null?void 0:e.space)==null?void 0:s.slug)!==t},changeFeedTitle(){this.changeTitle(this.feed.title||"Feed")},async handleDelete(){var e;if(this.feed)try{const t=this.feed.space?`space-${this.feed.space.slug}`:"global";await this.feedStore.deleteFeed(t,this.feed.id),(e=window.history.state)!=null&&e.back?this.$router.back():this.$router.push({name:"all_feeds"})}catch(t){this.$handleError(t)}},checkCommentScroll(){const e=this.$route.query.comment_id;e?this.highlightComment(e):this.$eventBus.emit("toTop",0)},highlightComment(e){e&&(document.querySelectorAll(".fcom_highlight_comment").forEach(t=>{t.classList.remove("fcom_highlight_comment")}),setTimeout(()=>{const t=document.getElementById("comment_"+e);if(!t){this.$eventBus.emit("toTop",0);return}t.classList.add("fcom_highlight_comment");const s=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;s.top>=0&&s.bottom<=u||(t.style.scrollMarginTop="100px",t.scrollIntoView({behavior:"instant"}))},100))}},mounted(){if(this.$eventBus.on("scroll_to_comment",this.highlightComment),window.__showing_feed&&window.__showing_feed.slug==this.feed_slug){if(this.isWrongSpaceContext(window.__showing_feed)){window.__showing_feed=null,this.notFound=!0,this.loading=!1;return}this.feed=window.__showing_feed,window.__showing_feed=null,this.$nextTick(()=>{this.changeFeedTitle(),this.checkCommentScroll()})}else this.getFeed()},beforeUnmount(){this.$eventBus.off("scroll_to_comment",this.highlightComment)}},u2={key:0,class:"fcom_feed_report_wrap"},_2={class:"fcom_feed_report_content"},m2={key:1,class:"feed_outer"},h2={key:3,class:"error-container"},f2={style:{padding:"20px",background:"var(--fcom-primary-bg)","border-radius":"8px"},class:"error-content"},p2={class:"error-title"},g2={class:"error-message"},y2={class:"error-explanation"},v2={style:{"list-style":"disc",margin:"20px"},class:"error-reasons"},b2={class:"error-actions"},k2=["href"];function w2(e,t,s,u,o,i){const m=p("Feed"),f=Z;return n(),c("div",null,[o.feed&&o.feed.status=="unpublished"?(n(),c("div",u2,[l("div",_2,[l("span",null,d(e.$t("This content has been unpublished by community moderation. Only the author and moderators can view it.")),1)])])):_("",!0),o.feed?(n(),c("div",m2,[a(m,{is_single:!0,is_route:!0,show_report:!0,feed:o.feed,onReload:i.getFeed,onRemoved:i.getFeed,onDeleted:i.handleDelete},null,8,["feed","onReload","onRemoved","onDeleted"])])):o.loading?(n(),y(f,{key:2,rows:5,animated:!0,class:"white_loaded"})):o.notFound?(n(),c("div",h2,[l("div",f2,[l("h1",p2,d(e.$t("Post Not Found")),1),l("p",g2,d(e.$t("Sorry, the requested post could not be found.")),1),l("p",y2,d(e.$t("This may be due to one of the following reasons:")),1),l("ul",v2,[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",b2,[l("a",{href:e.$getRouteLink(""),class:"el-button fcom_primary_button"},d(e.$t("Back to home")),9,k2)])])])):_("",!0)])}const Ls=I(d2,[["render",w2]]),C2={name:"SpaceHeader",emits:["refetch","doSearch"],components:{ImageUploader:He},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})}},$2={key:0,class:"object_header space_header"},S2={key:0,style:{"text-align":"right"},class:"object_media_uploader"};function V2(e,t,s,u,o,i){const m=H,f=p("image-uploader"),h=ee("loading");return i.profile.cover_photo?Y((n(),c("div",$2,[l("div",{style:re({backgroundImage:"url("+i.profile.cover_photo+")"}),class:"object_cover"},[i.isMod?(n(),c("div",S2,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:r(()=>[a(m,{size:"small",plain:"",type:"primary"},{default:r(()=>[M(d(e.$t("Change Cover")),1)]),_:1})]),_:1},8,["onUploaded"]),a(m,{class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(i.removeCoverPhoto,["prevent"])},{default:r(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])])):_("",!0)],4)])),[[h,o.updating]]):_("",!0)}const M2=I(C2,[["render",V2]]),T2={name:"SpaceMenuItems",props:["space","profile"]},L2={"aria-label":"Space menu"},P2={class:"fcom_space_menu_ul"},F2=["innerHTML"],I2=["href","target","innerHTML"],E2={key:1};function U2(e,t,s,u,o,i){var f,h;const m=p("router-link");return n(),c("nav",L2,[l("ul",P2,[(h=(f=s.profile)==null?void 0:f.header_links)!=null&&h.length?(n(!0),c(P,{key:0},R(s.profile.header_links,g=>(n(),c("li",null,[g.route?(n(),y(m,{key:0,to:g.route},{default:r(()=>[l("span",{innerHTML:g.title},null,8,F2)]),_:2},1032,["to"])):(n(),c("a",{key:1,class:x(g.css_class??""),href:g.url,target:g.is_external?"_blank":"_self",innerHTML:g.title},null,10,I2))]))),256)):_("",!0),e.isMobile?(n(),c("li",E2,[a(m,{to:{name:"space_about"}},{default:r(()=>[M(d(e.$t("About")),1)]),_:1})])):_("",!0)])])}const A2=I(T2,[["render",U2]]),B2={name:"ImagePlaceholder"},D2={width:"240",height:"240",viewBox:"0 0 240 240",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function R2(e,t,s,u,o,i){return n(),c("svg",D2,[...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 Yt=I(B2,[["render",R2]]),x2={name:"LockscreenPaywallMeta",components:{ImagePlaceholder:Yt},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()}},H2={key:0,class:"fcom_paywalls"},O2={class:"fcom_paywall"},j2={class:"fcom_select_photo",style:{float:"left"}},N2=["src"],z2={key:0,class:"fcom_description"},q2={class:"fcom_paywall_actions"},G2={class:"fcom_color_input_wrap"},Y2={class:"fcom_color_input_wrap"},W2={class:"fcom_color_input_wrap"},Z2={class:"fcom_color_input_wrap"};function K2(e,t,s,u,o,i){const m=p("image-placeholder"),f=ie,h=$t,g=ne,k=p("Delete"),b=O,w=H,S=Z,C=Mt,v=te,$=ue,T=fe,V=_e,F=Vt,L=Tt;return n(),y(L,{modelValue:o.editTab,"onUpdate:modelValue":t[12]||(t[12]=A=>o.editTab=A)},{default:r(()=>[a(C,{label:e.$t("Paywalls"),name:"paywall"},{default:r(()=>[o.loading?(n(),y(S,{key:1,rows:2,animated:""})):(n(),c("div",H2,[(n(!0),c(P,null,R(s.field.paywalls,(A,D)=>(n(),c("div",O2,[a(g,{"fit-input-width":"",modelValue:s.field.paywalls[D],"onUpdate:modelValue":U=>s.field.paywalls[D]=U,placeholder:e.$t("Select Paywall")},{default:r(()=>[(n(!0),c(P,null,R(o.availablePaywalls,U=>(n(),y(h,{key:U.ID,label:U.post_title},{default:r(()=>[(n(!0),c(P,null,R(U.variants,E=>(n(),y(f,{key:E.id,value:E.id.toString(),label:E.variation_title,disabled:i.isPaywallAdded(E.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",j2,[E.photo?(n(),c("img",{key:0,src:E.photo},null,8,N2)):(n(),y(m,{key:1})),l("span",null,d(E.variation_title),1)])]),_:2},1032,["value","label","disabled"]))),128))]),_:2},1032,["label"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"]),a(b,{onClick:U=>i.removePaywall(A)},{default:r(()=>[a(k)]),_:1},8,["onClick"])]))),256)),!s.field.paywalls||Object.keys(s.field.paywalls).length<1?(n(),c("div",z2,[l("p",null,d(e.$t("Please add paywall pricing options")),1)])):_("",!0),l("div",q2,[a(w,{style:{width:"100%"},class:"fcom_plain_button",onClick:i.initAddPaywall},{default:r(()=>[l("span",null,d("+ "+e.$t("Add Paywall")),1)]),_:1},8,["onClick"])])]))]),_:1},8,["label"]),a(C,{label:e.$t("Content"),name:"content"},{default:r(()=>[a(V,{onSubmit:t[2]||(t[2]=z(A=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Button Label")},{default:r(()=>[a(v,{modelValue:s.field.button_text,"onUpdate:modelValue":t[0]||(t[0]=A=>s.field.button_text=A),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a($,null,{default:r(()=>[a(T,{modelValue:s.field.show_description,"onUpdate:modelValue":t[1]||(t[1]=A=>s.field.show_description=A),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Show Paywall Description")),1)]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["label"]),a(C,{label:e.$t("Design"),name:"design"},{default:r(()=>[a(V,{onSubmit:t[11]||(t[11]=z(A=>e.doNothing(),["prevent"])),"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a($,{label:e.$t("Background Color")},{default:r(()=>[l("div",G2,[a(F,{predefine:e.appVars.suggestedColors,modelValue:s.field.background_color,"onUpdate:modelValue":t[3]||(t[3]=A=>s.field.background_color=A)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.background_color,"onUpdate:modelValue":t[4]||(t[4]=A=>s.field.background_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Text Color")},{default:r(()=>[l("div",Y2,[a(F,{predefine:e.appVars.suggestedColors,modelValue:s.field.text_color,"onUpdate:modelValue":t[5]||(t[5]=A=>s.field.text_color=A)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.text_color,"onUpdate:modelValue":t[6]||(t[6]=A=>s.field.text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Label")},{default:r(()=>[l("div",W2,[a(F,{predefine:e.appVars.suggestedColors,modelValue:s.field.button_text_color,"onUpdate:modelValue":t[7]||(t[7]=A=>s.field.button_text_color=A)},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.button_text_color,"onUpdate:modelValue":t[8]||(t[8]=A=>s.field.button_text_color=A)},null,8,["modelValue"])])]),_:1},8,["label"]),a($,{label:e.$t("Button Background")},{default:r(()=>[l("div",Z2,[a(F,{predefine:e.appVars.suggestedColors,modelValue:s.field.button_color,"onUpdate:modelValue":t[9]||(t[9]=A=>s.field.button_color=A),"show-alpha":""},null,8,["predefine","modelValue"]),a(v,{modelValue:s.field.button_color,"onUpdate:modelValue":t[10]||(t[10]=A=>s.field.button_color=A)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1})]),_:1},8,["label"])]),_:1},8,["modelValue"])}const J2=I(x2,[["render",K2]]),Q2={name:"LockscreenMeta",components:{BgImageUpload:Vo,LockscreenPaywallMeta:J2},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],s=this.lockscreen[e-1];this.lockscreen.splice(e-1,2,t,s)},moveDown(e){if(e==this.lockscreen.length-1)return;const t=this.lockscreen[e],s=this.lockscreen[e+1];this.lockscreen.splice(e,2,s,t)}}},X2={key:0,class:"fcom_lockscreen_meta"},ek={class:"fcom_meta_section lockscreen_meta"},tk={class:"fcom_description"},sk={class:"fcom_meta_section lockscreen_meta"},ok={class:"fcom_meta_label"},ik={class:"fcom_meta_content"},nk={class:"fcom_meta_block"},lk={class:"fcom_block_label"},ak={class:"fcom_meta_sorting"},rk={class:"fcom_block_action"},ck={key:1,class:"fcom_lockscreen_meta"},dk={class:"fcom_edit_title"},uk={class:"fcom_edit_content"},_k={class:"fcom_color_input_wrap"},mk={class:"fcom_color_input_wrap"},hk={class:"fcom_color_input_wrap"},fk={class:"fcom_color_input_wrap"},pk={class:"fcom_color_input_wrap"},gk={key:1,class:"fcom_description"},yk={key:2,class:"fcom_description"},vk={key:3,class:"fcom_description"};function bk(e,t,s,u,o,i){const m=O,f=p("Top"),h=p("Bottom"),g=p("EditPen"),k=p("Hide"),b=p("View"),w=p("Back"),S=te,C=ue,v=fe,$=_e,T=Mt,V=p("BgImageUpload"),F=Vt,L=Tt,A=p("lockscreen-paywall-meta");return o.editing?(n(),c("div",ck,[l("div",dk,[a(m,{onClick:i.backToFields},{default:r(()=>[a(w)]),_:1},8,["onClick"]),l("p",null,d(e.$labelize(o.editingField.label)),1)]),l("div",uk,[o.editingField.type=="image"?(n(),y(L,{key:0,modelValue:o.editTab,"onUpdate:modelValue":t[18]||(t[18]=D=>o.editTab=D)},{default:r(()=>[a(T,{label:e.$t("Content"),name:"content"},{default:r(()=>[a($,{onSubmit:t[5]||(t[5]=z(D=>e.doNothing(),["prevent"])),model:o.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(C,{label:e.$t("Heading")},{default:r(()=>[a(S,{modelValue:o.editingField.heading,"onUpdate:modelValue":t[0]||(t[0]=D=>o.editingField.heading=D),placeholder:e.$t("Heading")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Description")},{default:r(()=>[a(S,{modelValue:o.editingField.description,"onUpdate:modelValue":t[1]||(t[1]=D=>o.editingField.description=D),type:"textarea",placeholder:e.$t("Description")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Button Label")},{default:r(()=>[a(S,{modelValue:o.editingField.button_text,"onUpdate:modelValue":t[2]||(t[2]=D=>o.editingField.button_text=D),placeholder:e.$t("Button Label")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(C,{label:e.$t("Button Link")},{default:r(()=>[a(S,{modelValue:o.editingField.button_link,"onUpdate:modelValue":t[3]||(t[3]=D=>o.editingField.button_link=D)},null,8,["modelValue"])]),_:1},8,["label"]),o.editingField.type=="image"?(n(),y(C,{key:0},{default:r(()=>[a(v,{modelValue:o.editingField.new_tab,"onUpdate:modelValue":t[4]||(t[4]=D=>o.editingField.new_tab=D),"true-value":"yes","false-value":"no",class:"fcom_checkbox"},{default:r(()=>[M(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($,{onSubmit:t[17]||(t[17]=z(D=>e.doNothing(),["prevent"])),model:o.editingField,"label-position":"top",class:"fcom_form_container"},{default:r(()=>[a(C,{label:e.$t("Background Image"),class:"fcom_bg_image"},{default:r(()=>[a(V,{modelValue:o.editingField.background_image,"onUpdate:modelValue":t[6]||(t[6]=D=>o.editingField.background_image=D),can_remove:!0},null,8,["modelValue"])]),_:1},8,["label"]),a(C,{label:e.$t("Overlay Color")},{default:r(()=>[l("div",_k,[a(F,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.overlay_color,"onUpdate:modelValue":t[7]||(t[7]=D=>o.editingField.overlay_color=D)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.editingField.overlay_color,"onUpdate:modelValue":t[8]||(t[8]=D=>o.editingField.overlay_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Heading Color")},{default:r(()=>[l("div",mk,[a(F,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.heading_color,"onUpdate:modelValue":t[9]||(t[9]=D=>o.editingField.heading_color=D)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.editingField.heading_color,"onUpdate:modelValue":t[10]||(t[10]=D=>o.editingField.heading_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Text Color")},{default:r(()=>[l("div",hk,[a(F,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.text_color,"onUpdate:modelValue":t[11]||(t[11]=D=>o.editingField.text_color=D)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.editingField.text_color,"onUpdate:modelValue":t[12]||(t[12]=D=>o.editingField.text_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Button Label")},{default:r(()=>[l("div",fk,[a(F,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.button_text_color,"onUpdate:modelValue":t[13]||(t[13]=D=>o.editingField.button_text_color=D)},null,8,["predefine","modelValue"]),a(S,{modelValue:o.editingField.button_text_color,"onUpdate:modelValue":t[14]||(t[14]=D=>o.editingField.button_text_color=D)},null,8,["modelValue"])])]),_:1},8,["label"]),a(C,{label:e.$t("Button Background")},{default:r(()=>[l("div",pk,[a(F,{predefine:e.appVars.suggestedColors,modelValue:o.editingField.button_color,"onUpdate:modelValue":t[15]||(t[15]=D=>o.editingField.button_color=D),"show-alpha":""},null,8,["predefine","modelValue"]),a(S,{modelValue:o.editingField.button_color,"onUpdate:modelValue":t[16]||(t[16]=D=>o.editingField.button_color=D)},null,8,["modelValue"])])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["label"])]),_:1},8,["modelValue"])):o.editingField.type=="block"?(n(),c("div",gk,d(e.$t("Edit the field from block editor ")),1)):o.editingField.type=="lesson"?(n(),c("div",yk,d(e.$t("Edit lessons from lesson editor ")),1)):o.editingField.type=="welcome_banner"?(n(),c("div",vk,d(e.$t("__COURSE_BANNER_SOURCE_DESC")),1)):o.editingField.type=="paywall"?(n(),y(A,{key:4,field:o.editingField,space_id:s.space_id},null,8,["field","space_id"])):_("",!0)])])):(n(),c("div",X2,[l("div",ek,[l("div",tk,[l("p",null,d(e.$t("This page is only visible to non-members viewing a private space.")),1)])]),l("div",sk,[l("div",ok,d(e.$t("Page Blocks")),1),l("div",ik,[l("ul",nk,[(n(!0),c(P,null,R(i.lockscreenFields,(D,U)=>(n(),c("li",{class:x(["fcom_block_list",{block_hidden:D.hidden}])},[l("div",lk,[a(m,{class:"fcom_el_icon"},{default:r(()=>[(n(),y(Ct(i.getFieldIcon(D))))]),_:2},1024),l("p",null,d(e.$labelize(D.label)),1)]),l("div",ak,[a(m,{onClick:E=>i.moveUp(U)},{default:r(()=>[a(f)]),_:1},8,["onClick"]),a(m,{onClick:E=>i.moveDown(U)},{default:r(()=>[a(h)]),_:1},8,["onClick"])]),l("div",rk,[a(m,{onClick:E=>i.updateField(D)},{default:r(()=>[a(g)]),_:1},8,["onClick"]),D.hidden?(n(),y(m,{key:0,onClick:E=>i.toggleHidden(D)},{default:r(()=>[a(k)]),_:1},8,["onClick"])):(n(),y(m,{key:1,onClick:E=>i.toggleHidden(D)},{default:r(()=>[a(b)]),_:1},8,["onClick"]))])],2))),256))])])])]))}const kk=I(Q2,[["render",bk]]),wk={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,s)=>{const u=document.createElement("script");u.src=e,u.onload=t,u.onerror=s,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(s){this.has_error=!0,console.error(`Failed to load js ${t}:`,s)}this.attach()},loadCSSFile(e){return new Promise((t,s)=>{const u=document.createElement("link");u.rel="stylesheet",u.href=e,u.onload=t,u.onerror=s,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(s){console.error("Failed to load some CSS files:",s)}}},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)}},Ck={class:"fcom_block_editor"};function $k(e,t,s,u,o,i){const m=Z;return n(),c("div",Ck,[Y(l("div",null,[l("textarea",{ref:"block_editor",id:"fcom_block_editor",name:"block_editor"}," "+d(o.html)+` |
| 4 |
`,513)],512),[[wt,o.all_loaded]]),o.all_loaded?_("",!0):(n(),y(m,{key:0,class:"white_loaded",rows:7,animated:!0}))])}const Sk=I(wk,[["render",$k]]);const Vk={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 s=new URLSearchParams(this.editorParams);t+="&"+s.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:s}=e.data;t==="EDITOR_UPDATED"?this.dataSent&&(this.editorData.content=s,this.$emit("update:modelValue",s)):t==="TITLE_UPDATED"?(this.editorData.title=s,this.$emit("titleUpdated",s)):t==="FEATURED_MEDIA_UPDATED"?this.$emit("featuredMediaUpdated",s):t==="META_UPDATED"?this.$emit("metaUpdated",s):t==="MANAGE_DOCUMENTS"?this.$emit("manageDocuments"):t==="EDITOR_READY"&&(console.log("EDITOR_READY"),this.sendDataToEditor())}}},Mk={key:0,style:{display:"flex","justify-content":"center","align-items":"center","column-gap":"10px"}},Tk=["element-loading-text"],Lk={ref:"iframeContainer",class:"iframe-container"};function Pk(e,t,s,u,o,i){const m=H,f=Z,h=ee("loading");return n(),c(P,null,[i.notLoading?(n(),c("div",Mk,[l("p",null,d(e.$t("Problem with loading the editor?")),1),a(m,{onClick:t[0]||(t[0]=g=>i.editorFailed())},{default:r(()=>[M(d(e.$t("Use Alternative Editor")),1)]),_:1})])):_("",!0),Y((n(),c("div",{"element-loading-text":e.$t("Loading editor. Please wait...."),class:"editor-container"},[o.dataSent?_("",!0):(n(),y(f,{key:0,style:{margin:"50px"},animated:!0,rows:2})),l("div",Lk,null,512)],8,Tk)),[[h,!o.dataSent]])],64)}const Fk=I(Vk,[["render",Pk],["__scopeId","data-v-ba29dde7"]]),Ik={name:"CircleIcon",props:{fill:{type:String,default:"currentColor"}}},Ek=["fill"];function Uk(e,t,s,u,o,i){return n(),c("svg",{fill:s.fill,width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[...t[0]||(t[0]=[l("path",{d:"M10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5Z",fill:"none",stroke:"currentColor"},null,-1)])],8,Ek)}const vs=I(Ik,[["render",Uk]]),Ak={name:"LessonIcon"},Bk={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Dk(e,t,s,u,o,i){return n(),c("svg",Bk,[...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 To=I(Ak,[["render",Dk]]),Rk={name:"PlayIcon"},xk={width:"20",height:"19",viewBox:"0 0 20 19",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hk(e,t,s,u,o,i){return n(),c("svg",xk,[...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 Lo=I(Rk,[["render",Hk]]),Ok={name:"PlayPlaceholderIcon"},jk={width:"60",height:"48",viewBox:"0 0 60 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Nk(e,t,s,u,o,i){return n(),c("svg",jk,[...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 Po=I(Ok,[["render",Nk]]),zk={name:"_LockscreenLessonEditor",components:{CircleIcon:vs,LessonIcon:To,PlayIcon:Lo,PlayPlaceholderIcon:Po},props:{sections:{type:Array,required:!0},is_editor:{type:Boolean,default:!1},settings:{type:Object,required:!1}},computed:{lessonsCount(){return this.sections.reduce((e,t)=>e+t.lessons.length,0)},sectionsCount(){return this.sections.reduce((e,t)=>e+(t.lessons.length?1:0),0)},lessonDuration(){return e=>{const t=e.lessons.reduce((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}}},methods:{isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(t==null?void 0:t.html)},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isModernLayout(){var e;return this.has_pro&&((e=this.settings)==null?void 0:e.course_layout)==="modern"},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},maybeGotoLesson(e,t){if(!this.is_editor){if(this.isFreePreview(e)){this.gotoLesson(e);return}t.is_locked&&t.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",t.unlock_date),type:"info"})}},gotoLesson(e){this.$router.push({name:"view_lesson",params:{lesson_slug:e.slug}}),setTimeout(()=>{window.location.reload()},100)},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}}},qk={class:"fcom_course_sections"},Gk={class:"fcom_course_intro"},Yk={class:"fcom_course_labels"},Wk={class:"fcom_course_info"},Zk={class:"fcom_card_sections"},Kk={class:"fcom_section_items"},Jk=["onClick"],Qk={class:"fcom_section_primary_item_title"},Xk={class:"title_line_container"},ew={class:"title_line"},tw={class:"fcom_meta_text"},sw={key:0,class:"fcom_meta_text"},ow={class:"fcom_section_primary_item_actions"},iw=["onClick"],nw={class:"fcom_heading_item clickable"},lw={class:"lesson_feature_media"},aw=["src","alt"],rw=["src","alt"],cw={class:"lesson_title"},dw=["innerHTML"],uw={class:"lesson_duration"},_w={key:0},mw={key:1},hw=["innerHTML"];function fw(e,t,s,u,o,i){const m=p("ArrowRight"),f=p("ArrowDown"),h=O,g=p("CircleIcon"),k=p("Lock"),b=p("PlayPlaceholderIcon"),w=p("LessonIcon"),S=p("PlayIcon");return n(),c("div",qk,[l("div",Gk,[l("div",Yk,[l("h3",null,d(e.$t("Course Content")),1),l("p",Wk,[M(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),M(" "+d(e.$_n("%s Lesson","%s Lessons",i.lessonsCount)),1)])])]),l("div",Zk,[l("div",Kk,[(n(!0),c(P,null,R(s.sections,C=>(n(),c("div",{key:C.id,class:"fcom_section_primary"},[C.lessons.length?(n(),c("div",{key:0,onClick:v=>C.is_closed=!C.is_closed,class:x(["clickable fcom_section_primary_item",{is_closed:C.is_closed}])},[l("div",Qk,[l("div",Xk,[l("div",ew,[l("h4",null,d(C.title),1)]),l("span",tw,d(e.$t("%d lessons",C.lessons.length)),1),i.lessonDuration(C)?(n(),c("span",sw," • "+d(i.lessonDuration(C)),1)):_("",!0)])]),l("div",ow,[a(h,{class:"clickable"},{default:r(()=>[C.is_closed?(n(),y(m,{key:0,class:"fcom_arrow_icon"})):(n(),y(f,{key:1}))]),_:2},1024)])],10,Jk)):_("",!0),C.is_closed?_("",!0):(n(!0),c(P,{key:1},R(C.lessons,v=>(n(),c("div",{key:v.id,class:x(["fcom_section_item",{is_locked:!i.isFreePreview(v)}])},[l("div",{onClick:$=>i.maybeGotoLesson(v,C),class:"fcom_section_item_title"},[l("p",nw,[a(h,null,{default:r(()=>[i.isFreePreview(v)?(n(),y(g,{key:0})):(n(),y(k,{key:1}))]),_:2},1024),i.isModernLayout?(n(),c(P,{key:0},[l("span",lw,[v.featured_image?(n(),c("img",{key:0,src:v.featured_image,alt:v.title},null,8,aw)):i.hasMediaImage(v)?(n(),c("img",{key:1,src:v.meta.media.image,alt:v.title},null,8,rw)):i.hasMediaVideo(v)?(n(),y(b,{key:2})):(n(),y(w,{key:3})),i.showPlayIcon(v)?(n(),y(S,{key:4,class:"play_icon"})):_("",!0)]),l("span",cw,[l("span",{innerHTML:v.title},null,8,dw),l("span",uw,[v.meta.video_length?(n(),c("span",_w,d(i.formatSeconds(v.meta.video_length)),1)):(n(),c("span",mw,d("---")))])])],64)):(n(),c("span",{key:1,innerHTML:v.title},null,8,hw))])],8,iw)],2))),128))]))),128))])])])}const Fo=I(zk,[["render",fw]]),pw={name:"LockscreenPaywallView",components:{ImagePlaceholder:Yt},props:{space_id:{type:[String,Number],required:!0},field:{type:Object,required:!0},editable:{type:Boolean,default:!1}},data(){return{loading:!1,availablePaywalls:[]}},computed:{buttonStyles(){return{backgroundColor:this.field.button_color,borderColor:this.field.button_color,color:this.field.button_text_color}},cardStyles(){return{backgroundColor:this.field.background_color||"transparent",color:this.field.text_color||"var(--fcom-primary-text, #2B2E33)"}},filteredPaywalls(){return!Array.isArray(this.field.paywalls)||!Array.isArray(this.availablePaywalls)?[]:this.field.paywalls.map(e=>{for(const t of this.availablePaywalls)if(Array.isArray(t.variants)){const s=t.variants.find(u=>String(u.id)===String(e));if(s)return{...s,description:t.post_excerpt}}return null}).filter(Boolean)}},methods:{isSubscriptionPaywall(e){var t;return((t=e.other_info)==null?void 0:t.payment_type)=="subscription"},getRepeatInterval(e){var u;const t=(u=e.other_info)==null?void 0:u.repeat_interval;return t&&{daily:this.$t("day"),weekly:this.$t("week"),monthly:this.$t("month"),quarterly:this.$t("quarter"),half_yearly:this.$t("half year"),yearly:this.$t("year")}[t]||""},fetchAvailablePaywalls(){if(!this.space_id){this.availablePaywalls=[];return}const e={space_id:this.space_id};this.editable||(e.paywall_ids=this.field.paywalls),this.loading=!0,this.$get("cart/spaces/"+this.space_id+"/paywalls",e).then(t=>{this.availablePaywalls=t.paywalls||[]}).catch(t=>{this.$handleError(t)}).finally(()=>{this.loading=!1})}},mounted(){this.hasFeature("has_fluentcart")&&this.fetchAvailablePaywalls()}},gw={class:"fcom_paywall_cards"},yw={class:"paywall_header"},vw={class:"paywall_body"},bw=["innerHTML"],kw={key:0,class:"subscription"},ww={class:"paywall_footer"},Cw={key:0,class:"fcom_mb_10"},$w=["href"];function Sw(e,t,s,u,o,i){const m=Z,f=ss,h=p("ImagePlaceholder");return n(),c("div",gw,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),c(P,{key:1},R(i.filteredPaywalls,g=>(n(),c("div",{key:g.id,class:"fcom_paywall",style:re(i.cardStyles)},[l("div",yw,[g.photo?(n(),y(f,{key:0,src:g.photo},null,8,["src"])):(n(),y(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(g.variation_title),1)]),l("div",vw,[l("span",{innerHTML:g.total_price},null,8,bw),i.isSubscriptionPaywall(g)?(n(),c("span",kw," / "+d(i.getRepeatInterval(g)),1)):_("",!0)]),l("div",ww,[s.field.show_description=="yes"&&(g!=null&&g.description)?(n(),c("span",Cw,d(g.description),1)):_("",!0),s.editable?Y((n(),c("input",{key:1,class:"el-button fcom_primary_button link_button",style:re(i.buttonStyles),type:"text","onUpdate:modelValue":t[0]||(t[0]=k=>s.field.button_text=k)},null,4)),[[qo,s.field.button_text]]):(n(),c("a",{key:2,class:"el-button fcom_primary_button link_button",style:re(i.buttonStyles),href:g.checkout_url},d(s.field.button_text),13,$w))])],4))),128))])}const Io=I(pw,[["render",Sw]]),Vw={name:"LockScreenEditor",props:["title","lockscreen","sections","saving","loading","space_id","settings"],emits:["save","close"],components:{LockscreenLessonEditor:Fo,MediaEmbeder:_s,BlockEditor:Sk,LockscreenMeta:kk,LockscreenPaywallView:Io,FullEditorFrame:Fk},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}}},Mw={class:"fcom_editor_topbar"},Tw={class:"fcom_editor_content"},Lw={class:"fcom_item"},Pw={class:"fcom_content"},Fw=["onBlur"],Iw=["onBlur"],Ew=["onBlur"],Uw={key:1,class:"fcom_content_wrap"},Aw={id:"fcomBlockContent"},Bw={key:2,class:"fcom_content_wrap"},Dw={key:1,class:"fcom_description"},Rw={key:3,class:"fcom_content_wrap"},xw={key:4,class:"fcom_paywall_wrap"};function Hw(e,t,s,u,o,i){const m=p("lockscreen-meta"),f=et,h=p("Lock"),g=O,k=p("block-editor"),b=p("FullEditorFrame"),w=p("welcome-banner"),S=p("lockscreen-lesson-editor"),C=Z,v=p("lockscreen-paywall-view"),$=Ce,T=Le;return n(),c(P,null,[a(f,{class:"fcom_full_editor_side lockscreen_editor",width:"250px"},{default:r(()=>[G(e.$slots,"before_meta"),a(m,{lockscreen:s.lockscreen,space_id:s.space_id,onEditField:i.updateEditField},null,8,["lockscreen","space_id","onEditField"])]),_:3}),a(T,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a($,null,{default:r(()=>[l("div",Mw,[a(g,null,{default:r(()=>[a(h)]),_:1}),l("h3",null,d(s.title),1)]),l("div",Tw,[(n(!0),c(P,null,R(i.lockscreenFields,V=>{var F;return n(),c("div",Lw,[V.type=="image"?(n(),c("div",{key:0,class:"fcom_image_wrap",style:re(i.imageStyles(V))},[l("div",Pw,[l("h2",{style:re(i.headingStyles(V)),contenteditable:"true",onBlur:L=>i.updateHeading(L,V)},d(V.heading),45,Fw),V.description?(n(),c("p",{key:0,style:re(i.descriptionStyles(V)),contenteditable:"true",onBlur:L=>i.updateDescription(L,V)},d(V.description),45,Iw)):_("",!0),V.button_text?(n(),c("button",{key:1,class:"fcom_btn",style:re(i.buttonStyles(V)),contenteditable:"true",onBlur:L=>i.updateButtonLabel(L,V)},d(V.button_text),45,Ew)):_("",!0)])],4)):_("",!0),V.type=="block"?(n(),c("div",Uw,[l("div",Aw,[o.useClassic?(n(),y(k,{key:0,modelValue:V.content,"onUpdate:modelValue":L=>V.content=L},null,8,["modelValue","onUpdate:modelValue"])):(n(),y(b,{key:1,ref_for:!0,ref:"fullEditorFrame",onUseAlternateEditor:i.switchToClassic,editorParams:{context:"lockscreen",space_id:s.space_id},frameHeight:"calc(100vh - 160px)",documentTitle:"",modelValue:V.content,"onUpdate:modelValue":L=>V.content=L},null,8,["onUseAlternateEditor","editorParams","modelValue","onUpdate:modelValue"]))])])):_("",!0),V.type=="welcome_banner"?(n(),c("div",Bw,[V.banner?(n(),y(w,{key:0,config:V.banner,"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config"])):(n(),c("div",Dw,d(e.$t("__COURSE_BANNER_EMPTY_DESC")),1))])):_("",!0),V.type=="lesson"?(n(),c("div",Rw,[s.loading?(n(),y(C,{key:1,rows:5,animated:!0})):(n(),y(S,{key:0,sections:s.sections,is_editor:!0,settings:s.settings},null,8,["sections","settings"]))])):_("",!0),V.type=="paywall"&&((F=V.paywalls)==null?void 0:F.length)>0?(n(),c("div",xw,[a(v,{space_id:s.space_id,field:V,editable:!0},null,8,["space_id","field"])])):_("",!0)])}),256))])]),_:1})]),_:1})],64)}const Ow=I(Vw,[["render",Hw]]),jw={name:"SpaceLockscreen",props:["spaceProfile","savingCount"],emits:["close"],components:{LockScreenEditor:Ow},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()}},Nw={key:0,class:"fcom_lockscreen_meta"},zw={class:"fcom_description"},qw={class:"white_loaded"};function Gw(e,t,s,u,o,i){const m=p("lock-screen-editor"),f=Z,h=Le;return o.lockscreen?(n(),y(m,{key:0,title:s.spaceProfile.title,space_id:s.spaceProfile.id,settings:s.spaceProfile.settings,lockscreen:o.lockscreen,saving:o.saving,loading:o.loading,onSave:i.saveChanges,onClose:t[0]||(t[0]=g=>e.$emit("close"))},{before_meta:r(()=>[s.spaceProfile.settings.custom_lock_screen!="yes"?(n(),c("div",Nw,[l("div",zw,[l("p",null,d(e.$t("__LOCK_SCRREN_DESC")),1)])])):_("",!0)]),_:1},8,["title","space_id","settings","lockscreen","saving","loading","onSave"])):o.loading?(n(),y(h,{key:1,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[l("div",qw,[a(f,{animated:!0,rows:10})])]),_:1})):_("",!0)}const Yw=I(jw,[["render",Gw]]),Ww={name:"ManageSpaceLinks",components:{MenuGroupSettings:Mo},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(s=>{this.$notify.success(s.message),this.spaceProfile.settings.links=s.links,e&&this.$emit("close")}).catch(s=>{this.$handleError(s)}).finally(()=>{this.saving=!1})}}},Zw={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},Kw={class:"fcom_card_sections"};function Jw(e,t,s,u,o,i){const m=p("menu-group-settings"),f=Ce,h=Le;return n(),y(h,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(f,null,{default:r(()=>[l("div",Zw,[l("div",Kw,[a(m,{custom_svg:!0,use_icon_selector:!0,has_svg:!1,onSave:t[0]||(t[0]=g=>i.saveMenuItems()),title:e.$t("Manage Links"),menuItems:s.spaceProfile.settings.links},null,8,["title","menuItems"])])])]),_:1})]),_:1})}const Qw=I(Ww,[["render",Jw]]),Xw={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,s;return(s=(t=this.spaceProfile.settings)==null?void 0:t.cart_product_ids)==null?void 0:s.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(s=>{var u;this.products.push(s.product),this.productID=(u=s.product)==null?void 0:u.id,this.productID&&this.addPaywall()}).catch(s=>{this.$handleError(s)}).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()}},e3={class:"fcom_topic_selector"},t3={class:"fcom_select_photo",style:{float:"left"}},s3=["src","alt"],o3=["innerHTML"];function i3(e,t,s,u,o,i){const m=ie,f=ne,h=p("Plus"),g=O,k=H,b=te,w=ue,S=_e,C=ye,v=St,$=ee("loading");return n(),y(v,{"modal-class":"fcom_common_dialog",class:"fcom_high_drawer",size:e.drawerWidth,modelValue:i.addPaywallModal,"onUpdate:modelValue":t[6]||(t[6]=T=>i.addPaywallModal=T),"close-on-click-modal":!1,visible:i.addPaywallModal,direction:"rtl"},{header:r(()=>[l("h4",null,d(e.$t("Add Paywall")),1)]),default:r(()=>[a(S,{onSubmit:t[5]||(t[5]=z(T=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(w,null,{default:r(()=>[l("div",e3,[Y((n(),y(f,{style:{width:"100%"},"fit-input-width":"",modelValue:o.productID,"onUpdate:modelValue":t[0]||(t[0]=T=>o.productID=T),filterable:"",clearable:"",remote:"",loading:o.fetchingProducts,"remote-method":i.searchProducts,placeholder:e.$t("Search Product")},{default:r(()=>[(n(!0),c(P,null,R(o.products,T=>(n(),y(m,{key:T.id,label:T.title,value:T.id,disabled:i.isProductAdded(T.id),class:"fcom_with_photo_option"},{default:r(()=>[l("span",t3,[l("img",{src:T.image,alt:T.title},null,8,s3),l("span",null,d(T.title),1)]),l("span",{style:{float:"right",color:"#8492a6","font-size":"13px"},innerHTML:T.price},null,8,o3)]),_:2},1032,["label","value","disabled"]))),128))]),_:1},8,["modelValue","loading","remote-method","placeholder"])),[[$,o.fetchingProducts]]),a(C,{ref:"creating_product_ref",onShow:i.initCreateProduct,placement:"bottom",width:400,trigger:"click"},{reference:r(()=>[a(k,{class:"fcom_secondary_button"},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1}),l("span",null,d(e.$t("New")),1)]),_:1})]),default:r(()=>[a(S,{modelValue:o.newPaywall,"onUpdate:modelValue":t[4]||(t[4]=T=>o.newPaywall=T),"label-position":"top"},{default:r(()=>[a(w,{label:e.$t("Title")},{default:r(()=>[a(b,{modelValue:o.newPaywall.title,"onUpdate:modelValue":t[1]||(t[1]=T=>o.newPaywall.title=T),placeholder:e.$t("Title of the product")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(w,{label:e.$t("Price")},{default:r(()=>[a(b,{modelValue:o.newPaywall.price,"onUpdate:modelValue":t[2]||(t[2]=T=>o.newPaywall.price=T),type:"number",placeholder:e.$t("Price of the product"),min:0},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(w,null,{default:r(()=>[a(k,{class:"fcom_primary_button",onClick:t[3]||(t[3]=T=>i.createProduct()),loading:o.creatingProduct,disabled:o.creatingProduct},{default:r(()=>[M(d(e.$t("Create")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["onShow"])])]),_:1}),a(w,null,{default:r(()=>[a(k,{class:"fcom_primary_button",loading:o.saving,onClick:i.addPaywall},{default:r(()=>[M(d(e.$t("Add")),1)]),_:1},8,["loading","onClick"])]),_:1})]),_:1})]),_:1},8,["size","modelValue","visible"])}const n3=I(Xw,[["render",i3]]),l3={name:"ManagePaywalls",components:{ImagePlaceholder:Yt,AddPaywallModal:n3},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 s;const t=((s=this.spaceProfile.settings)==null?void 0:s.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()}},a3={style:{"max-width":"800px",padding:"20px",margin:"0 auto"}},r3={class:"fcom_card_sections"},c3={class:"fcom_card_section_heading"},d3={class:"fcom_section_primary_item_title"},u3={class:"fcom_heading_item"},_3={key:0,class:"fcom_section_item_actions"},m3={class:"fcom_section_primary"},h3={class:"fcom_section_primary_item"},f3={class:"fcom_section_primary_item_title"},p3={class:"fcom_heading_item"},g3={class:"fcom_shape"},y3={class:"fcom_section_item_actions"},v3=["href"],b3=["href"],k3={class:"fcom_section_items"},w3={class:"fcom_section_item_title"},C3={class:"fcom_heading_item"},$3={class:"fcom_shape"},S3={class:"fcom_section_item_actions"},V3=["innerHTML"],M3={key:2,style:{padding:"1rem"}},T3={key:1,class:"fcom_section_item"},L3={class:"fcom_section_primary"},P3={class:"fcom_section_primary_item"},F3=["disabled"],I3={class:"dialog_header"},E3={class:"dialog_left"},U3={class:"dialog_body"},A3={style:{"text-align":"center"}},B3={class:"fcom_heading_item",style:{"justify-content":"center"}},D3={class:"fcom_shape"},R3={style:{margin:"1rem 0px 0.8rem"}},x3={class:"dialog_footer"};function H3(e,t,s,u,o,i){const m=H,f=Z,h=ss,g=p("MoreFilled"),k=O,b=Je,w=Qe,S=Xe,C=p("ImagePlaceholder"),v=Ce,$=Le,T=p("AddPaywallModal"),V=fe,F=we,L=ee("loading");return n(),c(P,null,[a($,{class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(v,null,{default:r(()=>[l("div",a3,[l("div",r3,[l("div",c3,[l("div",d3,[l("div",u3,[G(e.$slots,"title",{},()=>[l("h4",null,d(e.$t("Manage Paywalls")),1)])])]),o.hasFluentCart?(n(),c("div",_3,[a(m,{class:"fcom_primary_button",onClick:t[0]||(t[0]=A=>i.initAddPaywall())},{default:r(()=>[M(d(e.$t("Add Paywall")),1)]),_:1})])):_("",!0)]),o.hasFluentCart?(n(),c(P,{key:0},[o.loading||o.removing?(n(),y(f,{key:0,class:"white_loaded",rows:5,animated:!0})):o.paywalls.length?(n(!0),c(P,{key:1},R(o.paywalls,A=>(n(),c("div",{class:"fcom_section_item",key:A.ID},[l("div",m3,[l("div",h3,[l("div",f3,[l("h4",p3,[l("span",g3,[a(h,{src:A==null?void 0:A.thumbnail},null,8,["src"])]),l("span",null,d((A==null?void 0:A.post_title)||""),1)])]),l("div",y3,[a(S,{trigger:"click","popper-class":"fcom_pop_action"},{dropdown:r(()=>[a(w,null,{default:r(()=>[a(b,null,{default:r(()=>[l("a",{href:A==null?void 0:A.view_url,target:"_blank",rel:"noopener"},d(e.$t("View Product")),9,v3)]),_:2},1024),a(b,null,{default:r(()=>[l("a",{href:A==null?void 0:A.admin_url,target:"_blank",rel:"noopener"},d(e.$t("Edit Product")),9,b3)]),_:2},1024),a(b,{type:"danger",onClick:D=>i.initRemovePaywall(A)},{default:r(()=>[M(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(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]),l("div",k3,[(n(!0),c(P,null,R(A.variants,D=>(n(),c("div",{class:"fcom_section_item",key:D.id},[l("div",w3,[l("div",C3,[l("span",$3,[D.photo?(n(),y(h,{key:0,src:D.photo},null,8,["src"])):(n(),y(h,{key:1},{default:r(()=>[a(C)]),_:1}))]),l("span",null,d(D.variation_title),1)])]),l("div",S3,[l("span",{class:"fcom_price",innerHTML:D.total_price},null,8,V3),a(S,{trigger:"click"},{dropdown:r(()=>[a(w,null,{default:r(()=>[a(b,{onClick:U=>i.copyCheckoutUrl(D.checkout_url)},{default:r(()=>[M(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(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)])]))),128))])])]))),128)):(n(),c("div",M3,[l("p",null,d(e.$t("No paywall has been added yet")),1)]))],64)):(n(),c("div",T3,[l("div",L3,[l("div",P3,[l("span",null,[M(d(e.$t("To monetize your ")+i.spaceType+", ")+" ",1),Y((n(),c("a",{disabled:o.installing,onClick:t[1]||(t[1]=(...A)=>i.installPlugin&&i.installPlugin(...A)),class:"fcom_link"},[M(d(e.$t("click here")),1)],8,F3)),[[L,o.installing]]),M(" "+d(e.$t("to install and activate FluentCart.")),1)])])])]))])])]),_:3})]),_:3}),o.addPaywallModal?(n(),y(T,{key:0,modelValue:o.addPaywallModal,"onUpdate:modelValue":t[2]||(t[2]=A=>o.addPaywallModal=A),spaceProfile:s.spaceProfile,onAdded:i.paywallAdded},null,8,["modelValue","spaceProfile","onAdded"])):_("",!0),a(F,{"modal-class":"fcom_common_dialog","close-on-click-modal":!1,"append-to-body":!0,width:e.drawerWidth,modelValue:o.removePaywallModal,"onUpdate:modelValue":t[5]||(t[5]=A=>o.removePaywallModal=A),direction:"rtl",onClose:t[6]||(t[6]=A=>o.removePaywallModal=!1)},{header:r(()=>[l("div",I3,[l("div",E3,[l("h4",null,d(e.$t("Delete Paywall")),1)])])]),footer:r(()=>[l("div",x3,[a(m,{class:"fcom_primary_button",disabled:o.removing,onClick:i.deletePaywall},{default:r(()=>[M(d(e.$t("Delete")),1)]),_:1},8,["disabled","onClick"]),a(m,{class:"fcom_secondary_button",onClick:t[4]||(t[4]=A=>o.removePaywallModal=!1)},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1})])]),default:r(()=>{var A,D;return[l("div",U3,[l("div",A3,[l("h4",B3,[l("span",D3,[a(h,{src:(A=o.removePaywall)==null?void 0:A.thumbnail},null,8,["src"])]),l("span",null,d((D=o.removePaywall)==null?void 0:D.post_title),1)]),l("p",R3,d(e.$t("Are you sure you want to delete this paywall? This action cannot be undone.")),1),a(V,{class:"fcom_checkbox",modelValue:o.revokeAccess,"onUpdate:modelValue":t[3]||(t[3]=U=>o.revokeAccess=U),"true-value":"yes","false-value":"no"},{default:r(()=>[M(d(e.$t("Also remove the this space from the product integration?")),1)]),_:1},8,["modelValue"])])])]}),_:1},8,["width","modelValue"])],64)}const O3=I(l3,[["render",H3]]),j3={name:"SpaceCustomizer",props:["space_profile"],emits:["close","completed"],components:{SpaceLockscreen:Yw,CreateSpaceForm:zt,ManageSpaceLinks:Qw,ManagePaywalls:O3},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})}},N3={key:0,class:"fcom_full_editor"},z3={class:"fcom_full_editor_header fcom_space_settings_nav"},q3={class:"fcom_editor_menu object_menu"},G3={class:"fcom_space_menu_ul"},Y3={class:"full_editor_actions"},W3={style:{"max-width":"800px",margin:"0 auto"},class:"fcom_full_editor_content"};function Z3(e,t,s,u,o,i){const m=p("ArrowLeft"),f=O,h=H,g=Ns,k=p("create-space-form"),b=Ce,w=Le,S=p("space-lockscreen"),C=p("manage-space-links"),v=p("manage-paywalls"),$=qe;return s.space_profile?(n(),c("div",N3,[a($,null,{default:r(()=>[a(g,{class:"fcom_full_editor_header_wrap"},{default:r(()=>{var T;return[l("div",z3,[l("div",{onClick:t[0]||(t[0]=V=>e.$emit("completed")),class:"fcom_back_header"},[a(f,null,{default:r(()=>[a(m)]),_:1}),M(" "+d(s.space_profile.title),1)]),l("div",q3,[l("ul",G3,[l("li",{onClick:t[1]||(t[1]=V=>o.currentTab="general")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="general"}),href:"#"},d(e.$t("General Settings")),3)]),l("li",{onClick:t[2]||(t[2]=V=>o.currentTab="paywalls")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="paywalls"}),href:"#"},d(e.$t("Paywalls")),3)]),s.space_profile.privacy=="private"&&((T=s.space_profile.settings)==null?void 0:T.custom_lock_screen)=="yes"?(n(),c("li",{key:0,onClick:t[3]||(t[3]=V=>o.currentTab="lock_screen")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="lock_screen"}),href:"#"},d(e.$t("Lock Screen")),3)])):_("",!0),l("li",{onClick:t[4]||(t[4]=V=>o.currentTab="manage_links")},[l("a",{class:x({"router-link-exact-active":o.currentTab==="manage_links"}),href:"#"},d(e.$t("Space Links")),3)])])]),l("div",Y3,[a(h,{class:"fcom_primary_button",disabled:o.saving,loading:o.saving,onClick:i.saveChanges},{default:r(()=>[M(d(!o.hasPro&&o.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]=V=>e.$emit("completed")),text:""},{default:r(()=>[...t[9]||(t[9]=[M(" X ",-1)])]),_:1})])])]}),_:1}),a($,{class:"fcom_full_editor_container editor_customizer_container"},{default:r(()=>[o.currentTab=="general"?(n(),y(w,{key:0,class:"fcom_full_editor_main lockscreen_editor"},{default:r(()=>[a(b,null,{default:r(()=>[l("div",W3,[a(k,{savingCount:o.savingCount,community:s.space_profile},null,8,["savingCount","community"])])]),_:1})]),_:1})):o.currentTab=="lock_screen"?(n(),y(S,{key:1,savingCount:o.savingCount,onClose:t[6]||(t[6]=T=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):o.currentTab=="manage_links"?(n(),y(C,{key:2,savingCount:o.savingCount,onClose:t[7]||(t[7]=T=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):o.currentTab=="paywalls"?(n(),y(v,{key:3,savingCount:o.savingCount,onClose:t[8]||(t[8]=T=>e.$emit("close")),spaceProfile:s.space_profile},null,8,["savingCount","spaceProfile"])):_("",!0)]),_:1})]),_:1})])):_("",!0)}const K3=I(j3,[["render",Z3]]),J3={name:"SpaceMenu",emits:["refetch","doSearch"],components:{ImageUploader:He,SpaceMenuItems:A2,SpaceCustomizer:K3},setup(){return{spaceStore:Ne()}},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:ts(Ee),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)}},Q3={class:"space_header"},X3={class:"object_menu"},e8={key:0,class:"menu_actions"},t8=["href"],s8={class:"actions_items"},o8={key:0};function i8(e,t,s,u,o,i){const m=p("space-menu-items"),f=H,h=p("MoreFilled"),g=O,k=ye,b=p("space-customizer"),w=ee("loading");return n(),c(P,null,[Y((n(),c("div",Q3,[l("div",X3,[a(m,{space:s.space,profile:i.profile,class:"fcom_desktop_only"},null,8,["space","profile"]),i.profile.id?(n(),c("div",e8,[e.auth.user_id?i.profile.membership?_("",!0):(n(),y(f,{key:1,disabled:o.joining,loading:o.joining,onClick:t[0]||(t[0]=S=>i.join()),class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Join")),1)]),_:1},8,["disabled","loading"])):(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button fcom_join_space_auth"},d(e.$t("Join")),9,t8)),i.showActions?(n(),y(k,{key:2,persistent:!1,ref:"space_actions",placement:"bottom",width:200,"popper-options":{strategy:"fixed"},trigger:"click"},{reference:r(()=>[a(f,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[a(m,{space:s.space,profile:i.profile,class:"fcom_linked_menus fcom_sm_only"},null,8,["space","profile"]),l("ul",s8,[e.hasSpaceAdminAccess(i.profile)?(n(),c(P,{key:0},[l("li",{onClick:t[1]||(t[1]=()=>{i.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),i.profile.membership?(n(),c("li",{key:1,onClick:t[2]||(t[2]=()=>{e.$refs.space_actions.hide(),i.leave()})},d(e.$t("Leave Space")),1)):_("",!0),e.isAdmin()?(n(),c("li",{key:2,onClick:t[3]||(t[3]=(...S)=>i.initDeleteSpace&&i.initDeleteSpace(...S))},d(e.$t("Delete")),1)):_("",!0)])]),_:1},512)):_("",!0)])):_("",!0)])])),[[w,o.updating]]),o.customizeSpace&&s.space_profile?(n(),c("div",o8,[(n(),y(dt,{to:"body"},[a(b,{space_profile:s.space_profile,onClose:t[4]||(t[4]=S=>o.customizeSpace=null),onCompleted:t[5]||(t[5]=S=>{o.customizeSpace=!1,e.$emit("refetch")})},null,8,["space_profile"])]))])):_("",!0)],64)}const Eo=I(J3,[["render",i8]]),n8={name:"AboutSpace",components:{RecentActivities:Gt},props:["space_profile","has_permission"],data(){return{privacies:ho}}},l8={class:"fcom_main_side_wrap"},a8={role:"region","aria-label":"About Space",class:"app_side_widget widget_recent_activities"},r8={class:"widget_header"},c8={key:0,class:"widget_body"},d8=["innerHTML"],u8={class:"space_meta"},_8={class:"space_meta_item"},m8={class:"meta_label"},h8={class:"meta_desc"};function f8(e,t,s,u,o,i){var k,b,w;const m=p("Guide"),f=O,h=Z,g=p("recent-activities");return n(),c("div",l8,[l("div",a8,[l("div",r8,[l("h3",null,d(e.$t("About")),1)]),s.space_profile?(n(),c("div",c8,[l("div",{class:"space_description",innerHTML:s.space_profile.description_rendered},null,8,d8),l("div",u8,[l("div",_8,[l("div",m8,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("span",null,d((k=o.privacies[s.space_profile.privacy])==null?void 0:k.label),1)]),l("div",h8,d((b=o.privacies[s.space_profile.privacy])==null?void 0:b.space_description),1)])])])):(n(),y(h,{key:1,animated:!0}))]),s.space_profile&&s.has_permission?(n(),y(g,{key:0,with_pins:!0,with_pending_count:!0,widget_title:e.$t("Recent Space Activities"),context:{type:"space",space_slug:(w=s.space_profile)==null?void 0:w.slug,space_id:s.space_profile.id}},null,8,["widget_title","context"])):_("",!0)])}const Uo=I(n8,[["render",f8]]),p8={name:"CustomLockscreenView",props:["profile","sections"],components:{LockscreenLessonEditor:Fo,LockscreenPaywallView:Io},computed:{lockscreenFields(){var e,t;return(t=(e=this.profile)==null?void 0:e.lockscreen_config.lockScreen)==null?void 0:t.filter(s=>!s.hidden)},buttonLink(){return e=>e.button_link||"javascript:void(0)"},imageStyles(){return e=>({backgroundImage:`url(${e.background_image})`,backgroundColor:e.overlay_color})},headingStyles(){return e=>({color:e.heading_color})},descriptionStyles(){return e=>({color:e.text_color})},buttonStyles(){return e=>({backgroundColor:e.button_color,color:e.button_text_color})}}},g8={class:"fcom_custom_lockscreen"},y8={class:"fcom_lockscreen_content"},v8={class:"fcom_item"},b8={class:"fcom_content"},k8=["href","target"],w8={key:1,class:"fcom_content_wrap"},C8=["innerHTML"],$8={key:2,class:"fcom_content_wrap"},S8={key:3,class:"fcom_content_wrap"},V8={key:4,class:"fcom_paywall_wrap"};function M8(e,t,s,u,o,i){const m=p("welcome-banner"),f=p("lockscreen-lesson-editor"),h=p("lockscreen-paywall-view");return n(),c("div",g8,[l("div",y8,[(n(!0),c(P,null,R(i.lockscreenFields,g=>{var k;return n(),c("div",v8,[g.type=="image"?(n(),c("div",{key:0,class:"fcom_image_wrap",style:re(i.imageStyles(g))},[l("div",b8,[l("h2",{style:re(i.headingStyles(g))},d(g.heading),5),l("p",{style:re(i.descriptionStyles(g))},d(g.description),5),g.button_text?(n(),c("a",{key:0,class:"fcom_btn",href:i.buttonLink(g),style:re(i.buttonStyles(g)),target:g.new_tab=="yes"?"_blank":"_self"},d(g.button_text),13,k8)):_("",!0)])],4)):_("",!0),g.type=="block"&&g.content?(n(),c("div",w8,[l("div",{class:"fcom_custom_editor_html",innerHTML:g.content},null,8,C8)])):_("",!0),g.type=="welcome_banner"&&g.banner?(n(),c("div",$8,[a(m,{config:g.banner,"close-key":"fcom_course_welcome_banner_closed_"+s.profile.id+"_not_enrolled","wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])])):_("",!0),g.type=="lesson"?(n(),c("div",S8,[a(f,{sections:s.sections,settings:s.profile.settings},null,8,["sections","settings"])])):_("",!0),g.type=="paywall"&&((k=g.paywalls)==null?void 0:k.length)>0?(n(),c("div",V8,[a(h,{space_id:s.profile.id,field:g},null,8,["space_id","field"])])):_("",!0)])}),256))])])}const Ao=I(p8,[["render",M8]]),T8={name:"DefaultLockscreenPaywall",components:{ImagePlaceholder:Yt},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()}},L8={class:"space_default_lock_box fcom_paywall_cards"},P8={class:"paywall_header"},F8={class:"paywall_body"},I8=["innerHTML"],E8={key:0,class:"subscription"},U8={class:"paywall_footer"},A8={key:0,class:"fcom_mb_10"},B8=["href"];function D8(e,t,s,u,o,i){const m=Z,f=ss,h=p("ImagePlaceholder");return n(),c("div",L8,[o.loading?(n(),y(m,{key:0,rows:3,animated:!0})):(n(!0),c(P,{key:1},R(o.availablePaywalls,g=>(n(),c(P,{key:g.ID},[(n(!0),c(P,null,R(g.variants,k=>(n(),c("div",{key:k.id,class:"fcom_paywall"},[l("div",P8,[k.photo?(n(),y(f,{key:0,src:k.photo},null,8,["src"])):(n(),y(f,{key:1},{default:r(()=>[a(h)]),_:1})),l("span",null,d(k.variation_title),1)]),l("div",F8,[l("span",{innerHTML:k.total_price},null,8,I8),i.isSubscriptionPaywall(k)?(n(),c("span",E8," / "+d(i.getRepeatInterval(k)),1)):_("",!0)]),l("div",U8,[k!=null&&k.description?(n(),c("span",A8,d(g.post_excerpt),1)):_("",!0),l("a",{class:"el-button fcom_primary_button link_button",href:k.checkout_url},d(e.$t("Join Now")),9,B8)])]))),128))],64))),128))])}const Bo=I(T8,[["render",D8]]),R8={name:"LockscreenView",components:{CustomLockscreenView:Ao,DefaultLockscreenPaywall:Bo},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)}},x8={key:0,style:{margin:"30px","text-align":"center"}},H8={key:0,class:"space_lock_box space_default_lock_box"},O8={class:"space_lock_box space_default_lock_box"},j8={class:"lock_desc"},N8=["href"],z8={key:0,class:"lock_desc"},q8={key:1,class:"lock_desc"},G8=["href"],Y8={key:2},W8={key:2,class:"space_lock_box"},Z8={class:"lock_desc"},K8=["href"];function J8(e,t,s,u,o,i){var b,w;const m=p("Lock"),f=O,h=H,g=p("default-lockscreen-paywall"),k=p("custom-lockscreen-view");return(b=this.space_profile.lockscreen_config)!=null&&b.redirect_url?(n(),c("h3",x8,d(e.$t("Please wait....")),1)):s.space_profile.lockscreen_config?(n(),c(P,{key:1},[s.space_profile.permissions&&s.space_profile.permissions.is_pending?(n(),c("div",H8,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Membership Request Under Review")),1)])):s.space_profile.lockscreen_config.showCustom?(n(),c("div",Y8,[a(k,{profile:s.space_profile},null,8,["profile"])])):(n(),c(P,{key:1},[l("div",O8,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("This is a private space")),1),s.space_profile.lockscreen_config.canSendRequest?(n(),c(P,{key:0},[l("p",j8,d(e.$t("Please send a join request and an admin will review your join request.")),1),e.auth.user_id?(n(),y(h,{key:0,disabled:s.joining,loading:s.joining,class:"fcom_primary_button",onClick:t[0]||(t[0]=S=>e.$emit("join"))},{default:r(()=>[M(d(e.$t("Request Access")),1)]),_:1},8,["disabled","loading"])):(n(),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,N8))],64)):(n(),c(P,{key:1},[s.space_profile.lockscreen_config.showPaywalls?(n(),c("p",z8,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),c("p",q8,d(e.$t("Members have to be invited to this space.")),1)),e.auth.user_id?_("",!0):(n(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,G8))],64))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(g,{key:0,space_id:(w=s.space_profile)==null?void 0:w.id},null,8,["space_id"])):_("",!0)],64))],64)):e.auth.user_id?_("",!0):(n(),c("div",W8,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h4",null,d(e.$t("Please login/signup to join this community")),1),l("p",Z8,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,K8)]))}const Q8=I(R8,[["render",J8]]),X8={name:"NotFoundResult",props:{title:{type:String,default:""},message:{type:String,default:""},icon:{type:String,default:"error"},actions:{type:Array,default:()=>[]}},computed:{displayActions(){return this.actions.length?this.actions:[{text:this.$t("Go to Home"),class:"fcom_primary_button",action:()=>this.$router.push({name:"all_feeds"})}]}}},e4={class:"fcom_404_container"},t4={class:"fcom_404_content"};function s4(e,t,s,u,o,i){const m=H,f=ei;return n(),c("div",e4,[l("div",t4,[a(f,{icon:s.icon,title:s.title},{"sub-title":r(()=>[l("p",null,d(s.message),1)]),extra:r(()=>[G(e.$slots,"actions",{},()=>[(n(!0),c(P,null,R(i.displayActions,(h,g)=>(n(),y(m,{key:g,class:x(["el-button",h.class]),onClick:k=>h.action&&h.action()},{default:r(()=>[M(d(h.text),1)]),_:2},1032,["class","onClick"]))),128))])]),_:3},8,["icon","title"])])])}const Do=I(X8,[["render",s4]]),o4={name:"SpaceView",components:{NotFoundResult:Do,RenderSpaceLinks:ys,AboutSpace:Uo,Layout:$e,AppLayout:Me,SpaceHeader:M2,RecentActivities:Gt,CreateSpaceForm:zt,SpaceMenu:Eo,LockscreenView:Q8,SpaceIcon:Ye},setup(){return{spaceStore:Ne()}},props:["space"],data(){return{search:"",joining:!1,pending_count:0,notFound:!1}},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)},notFoundActions(){var e;return(e=this.auth)!=null&&e.username?[]:[{text:this.$t("Log in"),class:"fcom_primary_button",action:()=>{window.location.href=this.getCurrentAuthUrl()}},{text:this.$t("Go to Home"),class:"fcom_secondary_button",action:()=>this.$router.push({name:"all_feeds"})}]},showSideBar(){var e,t;return!this.notFound&&!this.isCustomLockScreen&&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.notFound&&!this.isCustomLockScreen},showProfileLogo(){return!this.isCustomLockScreen},feedCssClasses(){var s,u;const e=[];e.push(this.showSideBar?"fcom_has_space_sidebar":"fcom_hide_space_sidebar");let t=((u=(s=this.space_profile)==null?void 0:s.settings)==null?void 0:u.layout_style)||"timeline";return e.push("fcom_layout_"+t),e.push("fcom_route_"+this.$route.name),e},wrapperLayoutClasses(){var e;return["fcom_single_layout","fcom_max_layout","fcom_space_"+((e=this.space_profile)==null?void 0:e.slug),"fcom_space_route_"+this.$route.name]}},watch:{space(){this.search="",this.getSpaceProfile()}},methods:{async getSpaceProfile(){this.notFound=!1;try{const e=await this.spaceStore.fetchSpace(this.space);this.auth.spaces[e.slug]=e,e.pending_count!==void 0&&(this.pending_count=e.pending_count),this.changeTitle(e.title)}catch(e){e.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Space Not Found"))):this.$handleError(e)}},async processJoin(){this.joining=!0;try{const e=await this.spaceStore.joinSpace(this.space);this.$notify.success(e.message),await this.getSpaceProfile()}catch(e){this.$handleError(e)}finally{this.joining=!1}},resetRoute(){this.$nextTick(()=>{})}},async mounted(){const e=this.spaceStore.getSpaceBySlug(this.space);e?(this.spaceStore.setCurrentSpace(this.space),this.changeTitle(e.title)):await this.getSpaceProfile()},beforeUnmount(){this.spaceStore.clearCurrentSpace()}},i4={key:0,"aria-label":"Space Links",class:"fcom_sub_header"},n4={class:"space_route"},l4={key:0},a4={key:2,class:"space_holder"},r4={key:3};function c4(e,t,s,u,o,i){const m=p("Lock"),f=O,h=p("space-icon"),g=p("router-link"),k=p("space-menu"),b=p("render-space-links"),w=p("space-header"),S=Z,C=p("not-found-result"),v=p("lockscreen-view"),$=p("router-view"),T=Le,V=p("AboutSpace"),F=et,L=qe,A=p("layout"),D=p("app-layout");return n(),y(D,{wrapper_class:i.wrapperLayoutClasses},{default:r(()=>[a(A,{wrapper_class:["no_bg_layout",{custom_lockscreen:i.isCustomLockScreen},"fcom_route_"+e.$route.name],title:"...."},{title:r(()=>[l("h1",{onClick:t[0]||(t[0]=U=>{e.$eventBus.emit("toTop"),i.resetRoute()}),class:"fcom_page_title"},[i.space_profile?(n(),y(g,{key:0,class:"fcom_space_title",to:{name:"space_feeds",params:{space:s.space}}},{default:r(()=>[i.isCustomLockScreen?(n(),y(f,{key:0},{default:r(()=>[a(m)]),_:1})):i.showProfileLogo?(n(),y(h,{key:1,space_profile:i.space_profile},null,8,["space_profile"])):_("",!0),l("span",null,d(i.space_profile.title),1)]),_:1},8,["to"])):_("",!0)])]),actions:r(()=>[i.showSpaceMenu?(n(),y(k,{key:0,space:s.space,space_profile:i.space_profile,onDoSearch:t[1]||(t[1]=U=>{o.search=U}),onRefetch:t[2]||(t[2]=U=>i.getSpaceProfile())},null,8,["space","space_profile"])):_("",!0)]),sub_header:r(()=>{var U,E;return[i.space_profile&&!i.isCustomLockScreen&&((E=(U=i.space_profile)==null?void 0:U.settings)!=null&&E.links.length)?(n(),c("nav",i4,[a(b,{links:i.space_profile.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[i.showSpaceHeader?(n(),y(w,{key:0,onRefetch:t[3]||(t[3]=U=>i.getSpaceProfile()),space:s.space,space_profile:i.space_profile},null,8,["space","space_profile"])):_("",!0),a(L,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(T,{class:"fcom_main"},{default:r(()=>[l("div",{class:x([i.feedCssClasses,"fcom_feed_box"])},[l("div",n4,[i.loading?(n(),c("div",l4,[a(S,{class:"white_loaded",rows:10,animated:!0})])):o.notFound?(n(),y(C,{key:1,title:e.$t("Space Not Found"),message:e.$t("The space you are looking for does not exist or has been removed."),actions:i.notFoundActions},null,8,["title","message","actions"])):i.space_profile?(n(),c("div",a4,[i.isCustomLockScreen?(n(),y(v,{key:0,space_profile:i.space_profile,joining:o.joining,onJoin:t[4]||(t[4]=U=>i.processJoin())},null,8,["space_profile","joining"])):_("",!0),i.has_permission?(n(),y($,{key:s.space,search:o.search,onRefetch:t[5]||(t[5]=U=>i.getSpaceProfile()),space_profile:i.space_profile,space_slug:s.space},null,8,["search","space_profile","space_slug"])):_("",!0)])):(n(),c("div",r4,[l("h4",null,d(e.$t("Sorry! this community could not be loaded")),1)]))])],2)]),_:1}),i.showSideBar?(n(),y(F,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[a(V,{has_permission:i.has_permission,space_profile:i.space_profile},null,8,["has_permission","space_profile"])]),_:1})):_("",!0)]),_:1})]),_:1},8,["wrapper_class"])]),_:1},8,["wrapper_class"])}const d4=I(o4,[["render",c4]]),u4={name:"CreateFeed",props:["space_slug","space_profile","space","search"],emits:["refetch"],components:{CreateStatusForm:xt,Feeds:yt},setup(){return{spaceStore:Ne()}},data(){return{topic_slug:null}},methods:{setTopic(e){this.topic_slug=e;let t=JSON.parse(JSON.stringify(this.$route.query));e?t.topic=e:delete t.topic,this.$router.push({query:t})},watchTopicUrlChanged(e){this.topic_slug==e||!e||(this.topic_slug=e,this.$nextTick(()=>{window.fcomLayoutRef&&window.fcomLayoutRef.scrollTo({top:0,behavior:"smooth"})}))}},computed:{layout_style(){var e,t;return((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.layout_style)||"timeline"},spaceTopics(){var t,s;const e=this.spaceStore.getSpaceTopics(this.space_slug);return e&&e.length>0?e:cs((t=this.space_profile)==null?void 0:t.topics)?null:((s=this.space_profile)==null?void 0:s.topics)||null}},created(){this.$route.query.topic&&(this.topic_slug=this.$route.query.topic),this.$eventBus.on("topic_changed",this.watchTopicUrlChanged)},beforeUnmount(){this.$eventBus.off("topic_changed",this.watchTopicUrlChanged)}},_4={key:0,class:"fcom_space_topics"},m4={ref:"fcom_topics_filters",class:"fcom_topics_filters"};function h4(e,t,s,u,o,i){var g,k,b;const m=H,f=Ce,h=p("feeds");return n(),c(P,null,[i.spaceTopics?(n(),c("div",_4,[a(f,null,{default:r(()=>[l("div",m4,[a(m,{onClick:t[0]||(t[0]=w=>i.setTopic("")),class:x({fcom_active_topic:!o.topic_slug})},{default:r(()=>[M(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),c(P,null,R(i.spaceTopics,w=>(n(),y(m,{key:w.slug,onClick:S=>i.setTopic(w.slug),class:x({fcom_active_topic:w.slug==o.topic_slug})},{default:r(()=>[M(d(w.title),1)]),_:2},1032,["onClick","class"]))),128))],512)]),_:1})])):_("",!0),a(h,{feed_name:"space_feed_"+s.space_slug,space:s.space_slug,topic_slug:o.topic_slug,default_search:s.search,layout_style:i.layout_style,can_change_order:((g=s.space_profile.settings)==null?void 0:g.disable_post_sort_by)!=="yes",default_order_by:((k=s.space_profile.settings)==null?void 0:k.default_post_sort_by)||"",can_change_layout:((b=s.space_profile.settings)==null?void 0:b.disable_layout_style)!=="yes",hide_create_form:!s.space_profile.permissions.can_create_post},null,8,["feed_name","space","topic_slug","default_search","layout_style","can_change_order","default_order_by","can_change_layout","hide_create_form"])],64)}const f4=I(u4,[["render",h4]]),p4={name:"SpaceHomeRedirect",created(){this.$router.replace({name:"space_feeds",params:{space:this.$route.params.space}})}},g4={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)}},y4={class:"fcom_invitation_form",ref:"inviteForm"};function v4(e,t,s,u,o,i){const m=te,f=ue,h=ht,g=ft,k=H,b=_e,w=ee("loading");return n(),c("div",y4,[a(b,{onSubmit:t[2]||(t[2]=z(S=>e.doNothing(),["prevent"])),modelValue:o.inviatation,"onUpdate:modelValue":t[3]||(t[3]=S=>o.inviatation=S),"label-position":"top"},{default:r(()=>[a(g,{gutter:30},{default:r(()=>[a(h,{sm:24,md:12},{default:r(()=>[a(f,{label:e.$t("Invitee email")},{default:r(()=>[a(m,{modelValue:o.inviatation.email,"onUpdate:modelValue":t[0]||(t[0]=S=>o.inviatation.email=S),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:o.inviatation.invitee_name,"onUpdate:modelValue":t[1]||(t[1]=S=>o.inviatation.invitee_name=S),placeholder:e.$t("Enter invitee Name"),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{default:r(()=>[Y((n(),y(k,{disabled:o.saving,class:"fcom_primary_button",onClick:i.sendInvitation},{default:r(()=>[M(d(e.$t("Send Invitation")),1)]),_:1},8,["disabled","onClick"])),[[w,o.saving]])]),_:1})]),_:1},8,["modelValue"])],512)}const b4=I(g4,[["render",v4]]),k4={name:"AddMemberForm",components:{InviationForm:b4},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()}},w4={class:"fcom_select_photo",style:{float:"left"}},C4=["src","alt"],$4={style:{float:"right",color:"#8492a6","font-size":"13px"}},S4={key:1},V4={class:"fcom_spaced_flex"},M4={key:0},T4={key:1},L4={key:1},P4={key:0},F4={key:1};function I4(e,t,s,u,o,i){const m=ie,f=H,h=ne,g=ue,k=_e,b=p("InviationForm"),w=ee("loading");return o.showingForm=="addByUser"?(n(),y(k,{key:0,onSubmit:t[4]||(t[4]=z(S=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.form,"onUpdate:modelValue":t[5]||(t[5]=S=>o.form=S)},{default:r(()=>[o.form.editing_user?(n(),c("p",S4,d(e.$t("Editing manager role for"))+" "+d(o.form.editing_user.display_name),1)):(n(),y(g,{key:0,label:e.$t("Search for an existing user or Invite by Email")},{default:r(()=>[Y((n(),y(h,{ref:"invite_member",class:"rich_select","fit-input-width":"",filterable:"",remote:"","remote-method":i.fetchUsers,placeholder:e.$t("Select User"),modelValue:o.form.user_id,"onUpdate:modelValue":t[1]||(t[1]=S=>o.form.user_id=S)},{empty:r(()=>[l("p",null,d(e.$t("No existing users found based on your search.")),1),a(f,{disabled:o.adding,loading:o.adding,type:"success",onClick:t[0]||(t[0]=S=>i.invitePerson())},{default:r(()=>[M(d(e.$t("Send Email Invitation")),1)]),_:1},8,["disabled","loading"])]),default:r(()=>[(n(!0),c(P,null,R(o.users,S=>(n(),y(m,{class:"fcom_with_photo_option",key:S.ID,label:S.display_name+" ("+(S.user_email||S.ID)+")",value:S.ID},{default:r(()=>[l("span",w4,[l("img",{src:S.photo,alt:S.display_name},null,8,C4),l("span",null,d(S.display_name),1)]),l("span",$4,d(S.user_email||S.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["remote-method","placeholder","modelValue"])),[[w,o.loading]])]),_:1},8,["label"])),a(g,{label:e.$t("Membership Role")},{default:r(()=>[a(h,{placeholder:e.$t("Select Role"),modelValue:o.form.role,"onUpdate:modelValue":t[2]||(t[2]=S=>o.form.role=S)},{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"]),G(e.$slots,"after_form",{},()=>[l("div",V4,[a(f,{class:"fcom_primary_button",loading:o.adding,disabled:o.adding,onClick:t[3]||(t[3]=S=>i.addMember())},{default:r(()=>[o.form.editing_user?(n(),c("span",M4,d(e.$t("Update Role")),1)):(n(),c("span",T4,d(e.$t("Add as %s",o.form.role)),1))]),_:1},8,["loading","disabled"])])])]),_:3},8,["modelValue"])):(n(),c("div",L4,[e.has_pro?(n(),c("div",P4,[a(b,{space_id:s.space_profile.id,default_value:o.invite_search,onCompleted:t[6]||(t[6]=S=>e.$emit("completed"))},null,8,["space_id","default_value"])])):(n(),c("div",F4,[l("p",null,d(e.$t("Member Invitation feature is only available on the Pro version")),1)]))]))}const E4=I(k4,[["render",I4]]),U4={name:"AddMembersForm",components:{SpaceCourseSelector:qt},props:{context:{type:String,required:!0},target:{type:Object,required:!0}},emits:["completed","membersAdded"],data(){return{sourceMode:"wp_users",wpUsers:[],wpLoading:!1,currentSearch:"",inviting:!1,selectedUserIds:[],role:"member",saving:!1,selectedSourceId:"",selectedSourceType:"",selectedSourceSlug:"",csvRows:[],csvFileName:"",createMissingUsers:!1,sendWelcomeEmailCsv:!1,sendWelcomeEmailCrm:!1,wpUsersLoaded:!1,crmTags:[],crmTagsLoading:!1,crmTagsLoaded:!1,selectedTagId:null,createMissingCrmUsers:!1,batchRunning:!1,batchProgress:0,batchProcessed:0,batchTotal:0,importDone:null}},computed:{isEmail(){return/^\S+@\S+\.\S+$/.test(this.currentSearch)}},watch:{sourceMode(e){e==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers(),e==="crm_tag"&&this.appVars.pro&&!this.crmTagsLoaded&&this.fetchCrmTags()},createMissingUsers(e){e||(this.sendWelcomeEmailCsv=!1)},createMissingCrmUsers(e){e||(this.sendWelcomeEmailCrm=!1)}},methods:{invitingLabel(e){return e?this.$t("Send Invitation to %s",e):this.$t("Send Invitation")},searchWpUsers(e=""){this.currentSearch=(e||"").trim(),!(e&&e.length<2)&&this.fetchWpUsers(e)},fetchWpUsers(e=""){this.wpLoading=!0;const t=this.context==="course",s=t?`admin/courses/${this.target.id}/users/search`:"spaces/users/search",u=t?{search:e}:{context:"add_member",search:e,space_id:this.target.id};this.$get(s,u).then(o=>{this.wpUsers=o.users.data,this.wpUsersLoaded=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.wpLoading=!1})},addWpUsers(){if(!this.selectedUserIds.length)return;const e=this.context==="course";if(this.selectedUserIds.length===1){this.saving=!0;const u=e?"admin/courses/"+this.target.id+"/students":"spaces/"+this.target.slug+"/members",o=e?{user_id:this.selectedUserIds[0]}:{user_id:this.selectedUserIds[0],role:this.role};this.$post(u,o).then(i=>{this.$notify.success(i.message),this.$emit("completed")}).catch(i=>{this.$handleError(i)}).finally(()=>{this.saving=!1});return}const t=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",s=e?{}:{role:this.role};this.runChunkedImport(this.selectedUserIds,u=>({url:t,data:{user_ids:u,...s}}))},inviteToSpace(){if(this.context!=="space")return;const e=this.currentSearch;this.inviting=!0,this.$post("invitations",{email:e,space_id:this.target.id}).then(t=>{this.$notify.success(t.message||this.$t("Invitation sent.")),this.currentSearch="",this.fetchWpUsers("")}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},importFromSource(){if(!this.selectedSourceId){this.$notify.error(this.$t("Please select a source space or course."));return}const e=this.context==="course",t=this.selectedSourceType==="course";if(t&&!parseInt(this.selectedSourceId,10)){this.$notify.error(this.$t("Invalid source course."));return}if(!t&&!this.selectedSourceSlug){this.$notify.error(this.$t("Invalid source space."));return}const s=e?"admin/courses/"+this.target.id+"/students/bulk-add":"spaces/"+this.target.slug+"/members/bulk-add",u=t?{from_course_id:parseInt(this.selectedSourceId,10)}:{from_space_slug:this.selectedSourceSlug};this.runOffsetImport(s,u)},downloadSampleCsv(){this.$exportToCsv([{Name:"John Doe",Email:"john@example.com",Username:"johndoe"},{Name:"Jane Smith",Email:"jane@example.com",Username:"janesmith"},{Name:"Bob Lee",Email:"bob@example.com",Username:"boblee"}],"fcom-bulk-import-sample-"+this.context+".csv")},onCsvFileChange(e){if(e&&e.status&&e.status!=="ready")return;const t=e.raw||e;if(!t)return;this.csvFileName=t.name||"import.csv";const s=new FileReader;s.onload=u=>{this.csvRows=this.parseCsvText(u.target.result.trim()),this.csvRows.length||this.$notify.error(this.$t("No valid rows found. Ensure columns are Name, Email, Username."))},s.readAsText(t)},resetCsvImport(){this.csvRows=[],this.csvFileName=""},splitCsvLine(e){return e.split(/,(?=(?:[^"]*"[^"]*")*[^"]*$)/).map(t=>t.trim().replace(/^"|"$/g,"").replace(/""/g,'"'))},parseCsvText(e){const t=e.split(/\r?\n/).map(b=>b.trim()).filter(Boolean);if(!t.length)return[];const s=this.splitCsvLine(t[0]).map(b=>b.toLowerCase()),u=["name","email","username"],o=s.some(b=>u.includes(b));let i=0,m=1,f=2,h=0;o&&(h=1,i=s.indexOf("name"),m=s.indexOf("email"),f=s.indexOf("username"));const g=new Set,k=[];for(let b=h;b<t.length;b++){const w=this.splitCsvLine(t[b]),S=i>=0&&w[i]||"",C=m>=0?(w[m]||"").toLowerCase():"",v=f>=0&&w[f]||"";!C.includes("@")||g.has(C)||(g.add(C),k.push({name:S,email:C,username:v}))}return k},importCsv(){if(!this.csvRows.length)return;let e=`spaces/${this.target.slug}/members/bulk-import`;this.context==="course"&&(e=`admin/courses/${this.target.id}/students/bulk-import`);const t=100,s=this.csvRows.length,u={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=s,this.batchProcessed=0,this.batchProgress=0;const o=i=>{if(i>=s){this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded");return}const m=this.csvRows.slice(i,i+t);this.$post(e,{rows:m,create_missing:this.createMissingUsers,notify_new_users:this.sendWelcomeEmailCsv}).then(f=>{u.added+=f.added||0,u.skipped+=f.skipped||0,u.failed+=f.failed||0;const h=f.processed&&f.processed>0?f.processed:m.length,g=i+h;this.batchProcessed=Math.min(s,g),this.batchProgress=Math.round(this.batchProcessed/s*100),o(g)}).catch(f=>{this.$handleError(f),this.batchRunning=!1,this.importDone={...u,total:s},this.$emit("membersAdded")})};o(0)},fetchCrmTags(){this.crmTagsLoading=!0,this.$get("settings/crm-tagging-config").then(e=>{this.crmTags=e.crm_tags||[],this.crmTagsLoaded=!0}).catch(e=>{this.$handleError(e)}).finally(()=>{this.crmTagsLoading=!1})},addFromCrmTag(){if(!this.selectedTagId)return;const e=this.context==="course",t=e?`admin/courses/${this.target.id}/students/resolve-crm-tag`:`spaces/${this.target.slug}/members/resolve-crm-tag`,s=e?`admin/courses/${this.target.id}/students/bulk-add`:`spaces/${this.target.slug}/members/bulk-add`,u=[];let o=0;this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const i=()=>{this.batchRunning=!1;const f=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:f},this.$emit("membersAdded")},m=f=>{this.$post(t,{tag_id:this.selectedTagId,create_missing:this.createMissingCrmUsers,notify_new_users:this.sendWelcomeEmailCrm,offset:f,per_page:200}).then(h=>{if(h.user_ids&&h.user_ids.length&&u.push(...h.user_ids),o+=h.failed||0,h.has_more){m(h.next_offset);return}if(!u.length){i();return}this.runChunkedImport(u,g=>({url:s,data:{user_ids:g}}),o)}).catch(h=>{this.$handleError(h),this.batchRunning=!1;const g=u.length+o;this.importDone={added:0,skipped:0,failed:o,total:g},this.$emit("membersAdded")})};m(0)},runChunkedImport(e,t,s=0){const o=e.length,i={added:0,skipped:0,failed:s},m=o+s;this.batchRunning=!0,this.batchTotal=o,this.batchProcessed=0,this.batchProgress=0;const f=h=>{if(h>=o){this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded");return}const g=e.slice(h,h+500),{url:k,data:b}=t(g);this.$post(k,b).then(w=>{i.added+=w.added||0,i.skipped+=w.skipped||0,i.failed+=w.failed||0;const S=w.processed&&w.processed>0?w.processed:g.length,C=h+S;this.batchProcessed=Math.min(o,C),this.batchProgress=Math.round(this.batchProcessed/o*100),f(C)}).catch(w=>{this.$handleError(w),this.batchRunning=!1,this.importDone={...i,total:m},this.$emit("membersAdded")})};f(0)},runOffsetImport(e,t){const s={added:0,skipped:0,failed:0};this.batchRunning=!0,this.batchTotal=0,this.batchProcessed=0,this.batchProgress=0;const u=o=>{this.$post(e,{...t,offset:o,per_page:500}).then(i=>{s.added+=i.added||0,s.skipped+=i.skipped||0,s.failed+=i.failed||0,i.total&&!this.batchTotal&&(this.batchTotal=i.total),this.batchProcessed=i.next_offset||o+(i.processed||0),this.batchProgress=this.batchTotal?Math.min(99,Math.round(this.batchProcessed/this.batchTotal*100)):50,i.has_more?u(i.next_offset||this.batchProcessed):(this.batchProgress=100,this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded"))}).catch(i=>{this.$handleError(i),this.batchRunning=!1,this.importDone={...s,total:this.batchTotal||s.added+s.skipped+s.failed},this.$emit("membersAdded")})};u(0)}},mounted(){this.sourceMode==="wp_users"&&!this.wpUsersLoaded&&this.fetchWpUsers()}},A4={class:"fcom_add_members_form"},B4={key:0,class:"fcom_source_selector_wrap fcom_mb_20"},D4={key:1,class:"fcom_import_done"},R4={class:"fcom_done_title"},x4={class:"fcom_done_subtitle"},H4={class:"fcom_import_summary"},O4={class:"fcom_import_summary_title"},j4={class:"fcom_import_summary_row"},N4={class:"fcom_import_summary_row"},z4={key:0,class:"fcom_import_summary_row"},q4={key:1,class:"fcom_import_summary_row"},G4={key:2,class:"fcom_import_progress_wrap"},Y4={class:"fcom_help_text fcom_mb_15"},W4={key:0,class:"fcom_muted_text fcom_mt_10"},Z4={class:"fcom_select_photo",style:{float:"left"}},K4=["src","alt"],J4={style:{float:"right",color:"#8492a6","font-size":"13px"}},Q4={style:{padding:"4px","text-align":"center"}},X4={style:{margin:"0 0 8px"}},e5={key:0},t5={key:1},s5={key:2},o5={key:1,style:{margin:"4px 0 0","font-size":"12px"}},i5={key:0,class:"fcom_help_text fcom_mb_10"},n5=["href"],l5={class:"fcom_help_text fcom_mb_15"},a5={key:0},r5={key:2},c5={class:"fcom_spaced_flex fcom_mb_10"},d5={class:"fcom_csv_drop_inner"},u5={class:"el-upload__text fcom_mt_10"},_5={key:0},m5={class:"el-upload__tip"},h5={class:"fcom_spaced_flex fcom_mb_10"},f5={class:"fcom_muted_text",style:{"margin-left":"8px"}},p5={key:0,class:"fcom_muted_text fcom_mb_10"},g5=["aria-label"],y5={class:"fcom_help_text fcom_mb_15"},v5=["aria-label"],b5={class:"fcom_help_text fcom_mb_15"},k5={key:0};function w5(e,t,s,u,o,i){const m=ze,f=ke,h=os,g=ie,k=H,b=ne,w=ue,S=_e,C=p("SpaceCourseSelector"),v=mt,$=is,T=ns,V=fe,F=ee("loading");return n(),c("div",A4,[!o.batchRunning&&!o.importDone?(n(),c("div",B4,[a(f,{modelValue:o.sourceMode,"onUpdate:modelValue":t[0]||(t[0]=L=>o.sourceMode=L),size:"small"},{default:r(()=>[a(m,{value:"wp_users"},{default:r(()=>[M(d(e.$t("WP Users")),1)]),_:1}),a(m,{value:"from_source"},{default:r(()=>[M(d(e.$t("From Space/Course")),1)]),_:1}),a(m,{value:"csv"},{default:r(()=>[M(d(e.$t("CSV Import")),1)]),_:1}),e.appVars.has_fluentcrm?(n(),y(m,{key:0,value:"crm_tag"},{default:r(()=>[M(d(e.$t("CRM Tag")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])])):_("",!0),o.importDone?(n(),c("div",D4,[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",R4,d(e.$t("All Done!")),1),l("p",x4,d(e.$t("Import has been completed. You may close this now.")),1),l("div",H4,[l("strong",O4,d(e.$t("Import Summary")),1),l("p",j4,d(e.$t("Total Records:"))+" "+d(o.importDone.total),1),l("p",N4,d(s.context==="course"?e.$t("Enrolled:"):e.$t("Added:"))+" "+d(o.importDone.added),1),o.importDone.skipped?(n(),c("p",z4,d(e.$t("Skipped:"))+" "+d(o.importDone.skipped),1)):_("",!0),o.importDone.failed?(n(),c("p",q4,d(e.$t("Failed:"))+" "+d(o.importDone.failed),1)):_("",!0)])])):o.batchRunning?(n(),c("div",G4,[l("div",Y4,[l("p",null,d(e.$t("Importing… Please do not close this window.")),1)]),a(h,{percentage:o.batchProgress,"stroke-width":12},null,8,["percentage"]),o.batchTotal?(n(),c("p",W4,d(o.batchProcessed)+" / "+d(o.batchTotal)+" "+d(e.$t("processed")),1)):_("",!0)])):(n(),c(P,{key:3},[o.sourceMode==="wp_users"?(n(),y(S,{key:0,onSubmit:t[5]||(t[5]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(w,{label:e.$t("Users")},{default:r(()=>[a(b,{class:"rich_select","fit-input-width":"",multiple:"",filterable:"",remote:"","default-first-option":"","reserve-keyword":!1,loading:o.wpLoading,"remote-method":i.searchWpUsers,placeholder:e.$t("Search and select users"),modelValue:o.selectedUserIds,"onUpdate:modelValue":t[2]||(t[2]=L=>o.selectedUserIds=L)},{empty:r(()=>[l("div",Q4,[l("p",X4,[i.isEmail?(n(),c("span",e5,[M(d(e.$t("User not registered:"))+" ",1),l("strong",null,d(o.currentSearch),1)])):o.currentSearch?(n(),c("span",t5,d(e.$t("No matching user found.")),1)):(n(),c("span",s5,d(e.$t("No data")),1))]),s.context==="space"?(n(),c(P,{key:0},[i.isEmail?(n(),y(k,{key:0,size:"small",class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,"aria-label":i.invitingLabel(o.currentSearch),onClick:t[1]||(t[1]=L=>i.inviteToSpace())},{default:r(()=>[M(d(e.$t("Send Email Invitation")),1)]),_:1},8,["loading","disabled","aria-label"])):o.currentSearch?(n(),c("p",o5,d(e.$t("Type a valid email to invite.")),1)):_("",!0)],64)):_("",!0)])]),default:r(()=>[(n(!0),c(P,null,R(o.wpUsers,L=>(n(),y(g,{class:"fcom_with_photo_option",key:L.ID,label:`${L.display_name} (${L.user_email||L.ID})`,value:L.ID},{default:r(()=>[l("span",Z4,[l("img",{src:L.photo,alt:L.display_name},null,8,K4),l("span",null,d(L.display_name),1)]),l("span",J4,d(L.user_email||L.ID),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["loading","remote-method","placeholder","modelValue"])]),_:1},8,["label"]),s.context==="space"?(n(),y(w,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(b,{modelValue:o.role,"onUpdate:modelValue":t[3]||(t[3]=L=>o.role=L),placeholder:e.$t("Select Role")},{default:r(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),a(w,null,{default:r(()=>[o.selectedUserIds.length>1&&!e.appVars.pro?(n(),c("div",i5,[l("p",null,[M(d(e.$t("Bulk adding requires FluentCommunity Pro."))+" ",1),e.appVars.upgrade_url?(n(),c("a",{key:0,href:e.$upgradeUrl("feature_lock_bulk_add_members"),target:"_blank"},d(e.$t("Upgrade")),9,n5)):_("",!0)])])):_("",!0),Y((n(),y(k,{class:"fcom_primary_button",onClick:t[4]||(t[4]=L=>i.addWpUsers())},{default:r(()=>[M(d(s.context==="course"?e.$t("Add Students"):e.$t("Add as %s",o.role)),1)]),_:1})),[[F,o.saving]])]),_:1})]),_:1})):o.sourceMode==="from_source"?(n(),y(S,{key:1,"label-position":"top"},{default:r(()=>[a(w,{label:e.$t("Select Source Space or Course")},{default:r(()=>[a(C,{modelValue:o.selectedSourceId,"onUpdate:modelValue":t[6]||(t[6]=L=>o.selectedSourceId=L),placeholder_text:e.$t("Select a space or course..."),memberships:[s.target.id.toString()],onSelectedType:t[7]||(t[7]=L=>o.selectedSourceType=L),onSelectedSlug:t[8]||(t[8]=L=>o.selectedSourceSlug=L)},null,8,["modelValue","placeholder_text","memberships"])]),_:1},8,["label"]),l("div",l5,[l("p",null,d(s.context==="course"?e.$t("All users will be enrolled as Student."):e.$t("All users will be added as Member.")),1)]),a(k,{class:"fcom_primary_button",onClick:t[9]||(t[9]=L=>i.importFromSource())},{default:r(()=>[M(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members"))+" ",1),e.appVars.pro?_("",!0):(n(),c("span",a5," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):o.sourceMode==="csv"?(n(),c("div",r5,[o.csvRows.length?(n(),c(P,{key:1},[l("div",h5,[l("div",null,[l("strong",null,d(o.csvFileName),1),l("span",f5,d(o.csvRows.length)+" "+d(e.$t("contacts")),1)]),a(k,{link:"",size:"small",onClick:t[11]||(t[11]=L=>i.resetCsvImport())},{default:r(()=>[M(d(e.$t("Change")),1)]),_:1})]),a(T,{data:o.csvRows.slice(0,5),size:"small",class:"fcom_mb_10"},{default:r(()=>[a($,{prop:"name",label:e.$t("Name"),"min-width":"120"},null,8,["label"]),a($,{prop:"email",label:e.$t("Email"),"min-width":"160"},null,8,["label"]),a($,{prop:"username",label:e.$t("Username"),"min-width":"110"},null,8,["label"])]),_:1},8,["data"]),o.csvRows.length>5?(n(),c("p",p5," + "+d(o.csvRows.length-5)+" "+d(e.$t("more rows")),1)):_("",!0),a(S,{"label-position":"top"},{default:r(()=>[a(w,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for new email addresses")},[l("div",null,[a(V,{modelValue:o.createMissingUsers,"onUpdate:modelValue":t[12]||(t[12]=L=>o.createMissingUsers=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Create WordPress accounts for new email addresses")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCsv,"onUpdate:modelValue":t[13]||(t[13]=L=>o.sendWelcomeEmailCsv=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[wt,o.createMissingUsers]])])],8,g5)]),_:1}),l("div",y5,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(w,null,{default:r(()=>[a(k,{class:"fcom_primary_button",onClick:t[14]||(t[14]=L=>i.importCsv())},{default:r(()=>[M(d(s.context==="course"?e.$t("Import Students"):e.$t("Import Members")),1)]),_:1})]),_:1})]),_:1})],64)):(n(),c(P,{key:0},[l("div",c5,[t[20]||(t[20]=l("span",null,null,-1)),e.appVars.pro?(n(),y(k,{key:0,link:"",size:"small",onClick:t[10]||(t[10]=L=>i.downloadSampleCsv())},{default:r(()=>[M("↓ "+d(e.$t("Sample CSV")),1)]),_:1})):_("",!0)]),a(v,{drag:"",accept:".csv,.txt","auto-upload":!1,"show-file-list":!1,"on-change":i.onCsvFileChange,disabled:!e.appVars.pro},{tip:r(()=>[l("div",m5,d(e.$t("Columns: Name, Email, Username")),1)]),default:r(()=>[l("div",d5,[t[22]||(t[22]=l("div",{class:"fcom_csv_drop_arrow"},"↑",-1)),l("div",u5,[M(d(e.$t("Drop CSV here or"))+" ",1),l("em",null,d(e.$t("click to browse")),1),t[21]||(t[21]=M()),e.appVars.pro?_("",!0):(n(),c("span",_5," ("+d(e.$t("Pro"))+")",1))])])]),_:1},8,["on-change","disabled"])],64))])):o.sourceMode==="crm_tag"?(n(),y(S,{key:3,"label-position":"top"},{default:r(()=>[a(w,{label:e.$t("FluentCRM Tag")},{default:r(()=>[a(b,{modelValue:o.selectedTagId,"onUpdate:modelValue":t[15]||(t[15]=L=>o.selectedTagId=L),loading:o.crmTagsLoading,placeholder:e.$t("Select a tag"),style:{width:"100%"}},{default:r(()=>[(n(!0),c(P,null,R(o.crmTags,L=>(n(),y(g,{key:L.id,label:L.title,value:L.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading","placeholder"])]),_:1},8,["label"]),a(w,null,{default:r(()=>[l("div",{role:"group","aria-label":e.$t("Create WordPress accounts for contacts without an existing account")},[l("div",null,[a(V,{modelValue:o.createMissingCrmUsers,"onUpdate:modelValue":t[16]||(t[16]=L=>o.createMissingCrmUsers=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Create WordPress accounts for contacts without an existing account")),1)]),_:1},8,["modelValue"])]),l("div",null,[Y(a(V,{modelValue:o.sendWelcomeEmailCrm,"onUpdate:modelValue":t[17]||(t[17]=L=>o.sendWelcomeEmailCrm=L),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Send default WordPress welcome email for new users")),1)]),_:1},8,["modelValue"]),[[wt,o.createMissingCrmUsers]])])],8,v5)]),_:1}),l("div",b5,[l("p",null,d(s.context==="course"?e.$t("All contacts with this tag will be enrolled as Student."):e.$t("All contacts with this tag will be added as Member.")),1)]),a(k,{class:"fcom_primary_button",onClick:t[18]||(t[18]=L=>i.addFromCrmTag())},{default:r(()=>[M(d(s.context==="course"?e.$t("Add Students"):e.$t("Add Members")),1),e.appVars.pro?_("",!0):(n(),c("span",k5," ("+d(e.$t("Pro"))+")",1))]),_:1})]),_:1})):_("",!0)],64))])}const C5=I(U4,[["render",w5]]),$5={name:"SpaceMembers",props:["space","space_profile"],components:{Search:Ee,Pagination:Ve,FollowAction:it,AddMemberForm:E4,AddMembersForm:C5},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(s=>{this.$notify.success(s.message),this.members.splice(t,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})},approveMember(e,t=null){this.working=!0,this.$post("spaces/"+this.space+"/members",{user_id:e.user_id}).then(s=>{if(this.$notify.success(s.message),t===null){this.fetch();return}this.members.splice(t,1),this.members.length||this.fetch()}).catch(s=>{this.$handleError(s)}).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()}},S5={ref:"space_members"},V5={key:0,class:"card_header"},M5={class:"member_status"},T5={class:"add_member"},L5={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},P5={class:"permission_failed"},F5=["href"],I5={key:2},E5={class:"search_member fcom_mb_20"},U5={class:"card_list"},A5={class:"card_content"},B5={class:"card_avatar"},D5={class:"card_info"},R5={class:"card_name"},x5={class:"info_header"},H5={class:"meta_line"},O5={key:0,class:"card_headline"},j5={class:"feed_meta_info"},N5=["title"],z5=["title"],q5=["title"],G5={key:1,class:"card_description"},Y5={class:"card_footer"},W5={class:"card_action"},Z5={class:"actions_items"},K5=["onClick"],J5=["onClick"],Q5={class:"pagination_wrap"},X5={key:0,class:"loading"},eC={key:1,class:"no_members"},tC={key:0},sC={key:1};function oC(e,t,s,u,o,i){const m=ze,f=ke,h=H,g=p("Search"),k=O,b=te,w=p("UserAvatar"),S=p("UserRouteLink"),C=Ue,v=p("FollowAction"),$=p("MoreFilled"),T=ye,V=p("Pagination"),F=Z,L=p("add-members-form"),A=St,D=p("add-member-form"),U=ee("loading");return n(),c(P,null,[l("div",S5,null,512),e.hasSpaceAdminAccess(s.space_profile)?(n(),c("div",V5,[l("div",M5,[o.pending_count?(n(),y(f,{key:0,onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=E=>o.status=E),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[M(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[M(d(e.$t("Pending"))+" ("+d(o.pending_count)+")",1)]),_:1})]),_:1},8,["onChange","modelValue"])):_("",!0)]),l("div",T5,[a(h,{class:"fcom_primary_button",onClick:t[1]||(t[1]=E=>o.addingNewMember=!0)},{default:r(()=>[M(d(e.$t("Add Member")),1)]),_:1}),a(h,{class:"fcom_secondary_button",onClick:t[2]||(t[2]=E=>e.$router.push({name:"space_invitations"}))},{default:r(()=>[M(d(e.$t("Invitations")),1)]),_:1})])])):_("",!0),o.permission_failed?(n(),c("div",L5,[l("div",P5,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view all members")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,F5)])])):(n(),c("div",I5,[l("div",E5,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=E=>o.search=E),placeholder:e.$t("Search...")},{prefix:r(()=>[a(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",{class:x(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[Y((n(),c("div",U5,[(n(!0),c(P,null,R(o.members,(E,q)=>{var j,N,W,le,B;return Y((n(),c("div",{key:E.id,class:"each_card"},[l("div",A5,[l("div",B5,[a(w,{xprofile:E.xprofile,is_online:e.isOnline(E.xprofile.last_activity)},null,8,["xprofile","is_online"])]),l("div",D5,[l("div",R5,[l("div",x5,[a(S,{xprofile:E.xprofile,show_badge:!0,show_follow:!0},null,8,["xprofile"]),l("div",H5,"@"+d((j=E.xprofile)==null?void 0:j.username),1)]),(W=(N=E.xprofile)==null?void 0:N.meta)!=null&&W.headline?(n(),c("div",O5,d(E.xprofile.meta.headline),1)):_("",!0),l("div",j5,[o.status!="pending"&&E.created_at?(n(),c("div",{key:0,title:E.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(E.created_at))),9,N5)):E.created_at?(n(),c("div",{key:1,title:E.created_at,class:"meta_line"},d(e.$t("Requested %s",e.humanDateDiff(E.created_at))),9,z5)):_("",!0),E.xprofile.last_activity?(n(),c("div",{key:2,title:E.xprofile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(E.xprofile.last_activity))),9,q5)):_("",!0)]),(le=E.xprofile)!=null&&le.short_description?(n(),c("div",G5,d(e.getExcerpt(((B=E.xprofile.meta)==null?void 0:B.short_description_rendered)||E.xprofile.short_description,120)),1)):_("",!0),E.role!="member"?(n(),y(C,{key:2,type:"success"},{default:r(()=>[M(d(e.$labelize(E.role)),1)]),_:2},1024)):_("",!0)]),o.status=="pending"?(n(),c(P,{key:0},[t[9]||(t[9]=l("div",{class:"card_break"},null,-1)),l("div",Y5,[a(h,{class:"fcom_primary_button",onClick:J=>i.approveMember(E,q)},{default:r(()=>[M(d(e.$t("Approve")),1)]),_:1},8,["onClick"]),a(h,{class:"fcom_secondary_button",onClick:J=>i.removeMember(E,q)},{default:r(()=>[M(d(e.$t("Decline")),1)]),_:1},8,["onClick"])])],64)):_("",!0)])]),l("div",W5,[a(v,{profile:E.xprofile},null,8,["profile"]),o.status!="pending"&&s.space_profile&&e.hasInPermission("can_remove_member",s.space_profile.permissions)?(n(),y(T,{key:0,placement:"bottom",width:200,trigger:"click",persistent:!1,ref_for:!0,ref:"userPopoverRef_"+E.user_id},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),size:"small",text:""},{default:r(()=>[a(k,{class:"fcom_more_icon"},{default:r(()=>[a($)]),_:1})]),_:1},8,["aria-label"])]),default:r(()=>[l("ul",Z5,[l("li",{onClick:J=>i.removeMemberPrompt(E,q)},d(e.$t("Remove Member")),9,K5),l("li",{onClick:J=>i.initAddMember(E,J)},d(e.$t("Change Membership")),9,J5)])]),_:2},1536)):_("",!0)])])),[[U,o.working]])}),128))])),[[U,o.loading]]),l("div",Q5,[a(V,{hide_on_single:!0,onFetch:t[4]||(t[4]=E=>i.fetch()),pagination:o.pagination},null,8,["pagination"])]),o.loading&&!o.pagination.total?(n(),c("div",X5,[a(F,{class:"white_loaded",rows:3,animated:!0}),a(F,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),c("div",eC,d(e.$t("No %s members found in this community.",o.status)),1)):_("",!0)],2)])),o.addingNewMember?(n(),y(A,{key:3,modelValue:o.addingNewMember,"onUpdate:modelValue":t[6]||(t[6]=E=>o.addingNewMember=E),"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(()=>[o.addingNewMember?(n(),y(L,{key:0,context:"space",target:s.space_profile,onCompleted:i.handleBulkMemberAdded,onMembersAdded:t[5]||(t[5]=E=>i.fetch())},null,8,["target","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0),o.addingMember?(n(),y(A,{key:4,modelValue:o.addingMember,"onUpdate:modelValue":t[8]||(t[8]=E=>o.addingMember=E),"close-on-click-modal":!1,"append-to-body":!0,size:e.drawerWidth,direction:"rtl"},{header:r(()=>[o.editing_member.editing_user?(n(),c("h4",tC,d(e.$t("Update Role")),1)):(n(),c("h4",sC,d(e.$t("Add Member")),1))]),default:r(()=>[o.addingMember?(n(),y(D,{key:0,space_profile:s.space_profile,modelValue:o.editing_member,"onUpdate:modelValue":t[7]||(t[7]=E=>o.editing_member=E),onCompleted:i.handleMemberUpdated},null,8,["space_profile","modelValue","onCompleted"])):_("",!0)]),_:1},8,["modelValue","size"])):_("",!0)],64)}const iC=I($5,[["render",oC]]);const nC={name:"DocumentUploadForm",components:{CreateStatusForm:xt},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")}}},lC={class:"fcom_document_upload_form"};function aC(e,t,s,u,o,i){const m=fe,f=p("CreateStatusForm");return n(),c("div",lC,[a(f,{ref:"createStatusForm",default_placeholder:e.$t("About these files"),initial_placeholder:e.$t("Upload new"),btn_text:e.$t("Upload Files"),editing_feed:o.post,"default-state":"active",disableUpload:!0,space:s.space_profile.slug,onAdded:i.resetForm},{before_submit_btn:r(()=>[a(m,{onChange:t[0]||(t[0]=h=>{e.$refs.createStatusForm.feed.status=h}),"true-value":"published","false-value":"unlisted",modelValue:o.post_status,"onUpdate:modelValue":t[1]||(t[1]=h=>o.post_status=h),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Publish as a post")),1)]),_:1},8,["modelValue"])]),_:1},8,["default_placeholder","initial_placeholder","btn_text","editing_feed","space","onAdded"])])}const rC=I(nC,[["render",aC]]),cC={name:"DocumentFeedCard",components:{ChatIcon:tt,HeartIcon:st,DocumentLists:ot,UserRouteLink:Ie},props:["feed"],computed:{can_manage(){return this.canEditFeed(this.feed)}}},dC={class:"fcom_document_feed_card feed"},uC={class:"feed_header"},_C={key:0,class:"feed_user"},mC={class:"feed_user_name"},hC={class:"feed_title"},fC={class:"feed_title_heading"},pC=["href"],gC={class:"feed_meta_info"},yC=["href"],vC=["title"],bC=["href"],kC={style:{"margin-left":"5px","margin-right":"7px"}},wC=["href"],CC={style:{"margin-left":"5px"}},$C={class:"feed_body"};function SC(e,t,s,u,o,i){var k,b,w,S,C;const m=p("ChatIcon"),f=O,h=p("HeartIcon"),g=p("DocumentLists");return n(),c("div",dC,[l("div",uC,[s.feed.xprofile?(n(),c("div",_C,[l("div",mC,[l("div",hC,[l("h2",fC,[l("a",{href:s.feed.permalink},d(s.feed.title||e.$t("Uploaded %s files",((b=(k=s.feed.meta)==null?void 0:k.document_lists)==null?void 0:b.length)||"--")),9,pC)])])]),l("div",gC,[l("a",{onClick:t[0]||(t[0]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[l("span",{title:s.feed.created_at,style:{padding:"0 7px 0 0"}},d(e.humanDateDiff(s.feed.created_at))+" "+d(e.$t("by %s",(w=s.feed.xprofile)==null?void 0:w.display_name)),9,vC)],8,yC),s.feed.comments_count?(n(),c("a",{key:0,onClick:t[1]||(t[1]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(m)]),_:1}),l("span",kC,d(s.feed.comments_count),1)],8,bC)):_("",!0),s.feed.reactions_count?(n(),c("a",{key:1,onClick:t[2]||(t[2]=(...v)=>e.gotoFeed&&e.gotoFeed(...v)),href:s.feed.permalink,class:"feed_timestamp"},[a(f,{style:{"margin-left":"7px"}},{default:r(()=>[a(h,{filled:!0})]),_:1}),l("span",CC,d(s.feed.reactions_count),1)],8,wC)):_("",!0)])])):_("",!0)]),l("div",$C,[a(g,{document_lists:(C=(S=s.feed)==null?void 0:S.meta)==null?void 0:C.document_lists,allow_rename:i.can_manage,additional_data:{space_id:s.feed.space_id}},null,8,["document_lists","allow_rename","additional_data"])])])}const VC=I(cC,[["render",SC]]);const MC={name:"SpaceDocuments",props:["space","space_profile"],components:{FeedListItem:bo,Feed:nt,DocumentUploadForm:rC,UploadFilled:Lt,Search:Ee,Pagination:Ve,DocumentFeedCard:VC},emits:["refetch"],inheritAttrs:!1,data(){return{documents:[],loading:!1,pagination:{page:1,per_page:20,total:0},working:!1,search:"",SearchIcon:ts(Ee),permission_failed:!1,show_uploader:!1}},computed:{visibleDocuments(){return this.documents.filter(e=>{var t,s;return(s=(t=e==null?void 0:e.meta)==null?void 0:t.document_lists)==null?void 0:s.length})}},methods:{fetch(e=!1){this.loading=!0,this.$get("documents",{page:this.pagination.page,per_page:this.pagination.per_page,space_id:this.space_profile.id,search:this.search}).then(t=>{e?this.documents=this.documents.concat(t.documents.data):this.documents=t.documents.data,this.pagination.total=t.documents.total,this.pagination.last_page=t.documents.last_page}).catch(t=>{t.permission_failed?this.permission_failed=!0:this.$handleError(t)}).finally(()=>{this.loading=!1})},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.fetch()},handleLoadMore(e){var i;if(this.pagination.last_page==this.pagination.page)return;let t=document.querySelector(".all_documents_wrap .feed_outer:last-child");if(!t)return;let s=t.getBoundingClientRect(),u=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;!u||s.bottom-u.getBoundingClientRect().bottom-s.height>100||this.loading||(this.loading=!0,this.pagination.page++,this.fetch(!0))}},mounted(){this.has_pro?(this.fetch(),document.addEventListener("fcom_layout_scroll",this.handleLoadMore)):this.permission_failed=!0,this.changeTitle(this.$t("Documents and Files in %s",this.space_profile.title))}},TC={ref:"space_docs"},LC={class:"card_header"},PC={class:"member_status"},FC={key:0,class:"add_member"},IC={key:0},EC={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},UC={class:"permission_failed"},AC=["href"],BC={key:2},DC={class:"search_member"},RC={class:""},xC={class:"card_list"},HC={class:"all_documents_wrap"},OC={key:0,style:{"margin-top":"20px","text-align":"center"}},jC={key:1,class:"loading"},NC={key:2,class:"no_members"};function zC(e,t,s,u,o,i){var C,v;const m=p("UploadFilled"),f=O,h=H,g=p("document-upload-form"),k=p("Search"),b=te,w=p("document-feed-card"),S=Z;return n(),c(P,null,[l("div",TC,null,512),l("div",LC,[l("div",PC,[l("h3",null,d(e.$t("Documents and Files")),1)]),(v=(C=s.space_profile)==null?void 0:C.permissions)!=null&&v.can_upload_documents?(n(),c("div",FC,[o.show_uploader?(n(),y(h,{key:1,plain:"",onClick:t[1]||(t[1]=$=>o.show_uploader=!1),size:"small"},{default:r(()=>[l("span",null,d(e.$t("Cancel")),1)]),_:1})):(n(),y(h,{key:0,onClick:t[0]||(t[0]=$=>o.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)]),o.show_uploader?(n(),c("div",IC,[a(g,{onRefetch:t[2]||(t[2]=()=>{i.toSearch(),o.show_uploader=!1}),space_profile:s.space_profile,reload:i.toSearch},null,8,["space_profile","reload"])])):_("",!0),o.permission_failed?(n(),c("div",EC,[l("div",UC,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,AC)])])):(n(),c("div",BC,[l("div",DC,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[3]||(t[3]=$=>o.search=$),placeholder:e.$t("Search...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",RC,[l("div",xC,[l("div",HC,[(n(!0),c(P,null,R(i.visibleDocuments,$=>(n(),c("div",{key:$.id,class:"feed_outer"},[a(w,{feed:$},null,8,["feed"])]))),128))])]),!o.loading&&o.pagination.last_page!=o.pagination.page?(n(),c("div",OC,[a(h,{class:"fcom_secondary_button",disabled:o.loading,onClick:t[4]||(t[4]=$=>{o.pagination.page++,i.fetch(!0)})},{default:r(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled"])])):_("",!0),o.loading?(n(),c("div",jC,[a(S,{class:"fcom_mt_20 white_loaded",animated:!0,rows:5})])):!o.loading&&!i.visibleDocuments.length?(n(),c("div",NC,d(e.$t("No documents found in this space based on your search criteria.")),1)):_("",!0)])]))],64)}const qC=I(MC,[["render",zC]]),GC={name:"LightboxMeta",components:{TopRight:ci},props:{author:{type:Object,default:null},authorHref:{type:String,default:""},postDate:{type:String,default:""},permalink:{type:String,default:null}}},YC={class:"fcom_space_media_meta_group"},WC={key:0,class:"fcom_space_media_author_chip"},ZC=["src","alt"],KC={class:"fcom_space_media_author_chip_text"},JC=["href"],QC={key:1,class:"fcom_space_media_author_chip_name"},XC={key:2,class:"fcom_space_media_author_chip_date"},e6=["href"];function t6(e,t,s,u,o,i){const m=xe,f=p("TopRight"),h=O;return n(),c("div",YC,[s.author?(n(),c("div",WC,[s.author.avatar?(n(),c("img",{key:0,src:s.author.avatar,alt:s.author.name||"",class:"fcom_space_media_author_chip_avatar"},null,8,ZC)):_("",!0),l("div",KC,[s.authorHref?(n(),y(m,{key:0,content:e.$t("View Profile"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:s.authorHref,class:"fcom_space_media_author_chip_name fcom_space_media_author_chip_link"},d(s.author.name||e.$t("Member")),9,JC)]),_:1},8,["content"])):(n(),c("span",QC,d(s.author.name||e.$t("Member")),1)),s.postDate?(n(),c("span",XC,d(s.postDate),1)):_("",!0)])])):_("",!0),s.permalink?(n(),c("a",{key:1,href:s.permalink,class:"fcom_space_media_viewpost_btn"},[l("span",null,d(e.$t("View post")),1),a(h,{class:"fcom_space_media_viewpost_icon"},{default:r(()=>[a(f)]),_:1})],8,e6)):_("",!0)])}const s6=I(GC,[["render",t6]]),Ae=1,Ps=5,o6=.2,i6=50,Fs=6,n6={data(){return{imageScale:Ae,imageOffsetX:0,imageOffsetY:0,isPanning:!1,panStartX:0,panStartY:0,panOriginX:0,panOriginY:0,touchMoved:!1}},computed:{canZoomOut(){return this.imageScale>Ae},canZoomIn(){return this.imageScale<Ps},canResetZoom(){return this.imageScale!==Ae||this.imageOffsetX!==0||this.imageOffsetY!==0},imageTransformStyle(){return{transform:`translate(${this.imageOffsetX}px, ${this.imageOffsetY}px) scale(${this.imageScale})`,transition:this.isPanning?"none":"transform 0.15s ease-out"}}},created(){this.boundPanMove=this.onImagePanMove.bind(this),this.boundPanEnd=this.onImagePanEnd.bind(this),this.boundWheelHandler=this.handleWheel.bind(this),this.touchValid=!1},methods:{resetImageZoom(){this.imageScale=Ae,this.imageOffsetX=0,this.imageOffsetY=0,this.stopPan()},stepZoom(e){const t=Math.min(Ps,Math.max(Ae,this.imageScale+e*o6));t!==this.imageScale&&(this.imageScale=Number(t.toFixed(2)),this.imageScale<=Ae&&(this.imageOffsetX=0,this.imageOffsetY=0))},toggleImageZoom(){this.imageScale>Ae?this.resetImageZoom():this.imageScale=2},handleWheel(e){this.currentKind==="image"&&(e.preventDefault(),this.stepZoom(e.deltaY<0?1:-1),this.showChrome())},syncWheelListener(){this.detachWheel(),this.modelValue&&this.currentKind==="image"&&document.addEventListener("wheel",this.boundWheelHandler,{passive:!1})},detachWheel(){document.removeEventListener("wheel",this.boundWheelHandler,{passive:!1})},anchorPan(e,t){this.panStartX=e,this.panStartY=t,this.panOriginX=this.imageOffsetX,this.panOriginY=this.imageOffsetY},movePan(e,t){this.imageOffsetX=this.panOriginX+(e-this.panStartX),this.imageOffsetY=this.panOriginY+(t-this.panStartY)},onImagePanStart(e){this.canZoomOut&&(this.isPanning=!0,this.anchorPan(e.clientX,e.clientY),document.addEventListener("mousemove",this.boundPanMove),document.addEventListener("mouseup",this.boundPanEnd))},onImagePanMove(e){this.isPanning&&this.movePan(e.clientX,e.clientY)},onImagePanEnd(){this.stopPan()},stopPan(){this.isPanning=!1,document.removeEventListener("mousemove",this.boundPanMove),document.removeEventListener("mouseup",this.boundPanEnd)},onImageTouchStart(e){if(e.touches.length!==1){this.touchValid=!1,this.isPanning=!1;return}const t=e.touches[0];this.touchValid=!0,this.anchorPan(t.clientX,t.clientY),this.touchMoved=!1,this.isPanning=this.imageScale>Ae,this.showChrome()},onImageTouchMove(e){if(!this.touchValid||e.touches.length!==1)return;const t=e.touches[0];(Math.abs(t.clientX-this.panStartX)>Fs||Math.abs(t.clientY-this.panStartY)>Fs)&&(this.touchMoved=!0),this.isPanning&&this.movePan(t.clientX,t.clientY)},onImageTouchEnd(e){if(!this.touchValid){this.isPanning=!1;return}if(this.isPanning){this.isPanning=!1;return}if(!this.touchMoved)return;const t=e.changedTouches[0],s=(t?t.clientX:this.panStartX)-this.panStartX,u=(t?t.clientY:this.panStartY)-this.panStartY;Math.abs(s)>i6&&Math.abs(s)>Math.abs(u)&&(s<0?this.next():this.prev())}}},l6={name:"MediaLightbox",mixins:[n6],components:{FluentPlayerPreview:It,LightboxMeta:s6,Close:rs,ArrowLeftBold:Ys,ArrowRightBold:di},props:{modelValue:{type:Boolean,default:!1},items:{type:Array,default:()=>[]},initialIndex:{type:Number,default:0}},emits:["update:modelValue"],data(){return{currentIndex:0,fluentPlayerFailed:!1,chromeVisible:!0}},computed:{dialogOpen:{get(){return this.modelValue},set(e){this.$emit("update:modelValue",e)}},currentItem(){return this.items[this.currentIndex]||null},currentKind(){var e;return((e=this.currentItem)==null?void 0:e.kind)||null},currentMediaUrl(){var e;return((e=this.currentItem)==null?void 0:e.url)||null},hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))},playerMedia(){var s,u,o;const e=this.currentItem;if(!e||e.kind!=="video"&&e.kind!=="audio")return null;const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};return t.src||(t.src=e.url),{media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((s=e.feed)==null?void 0:s.id)||"",share_url:((u=e.feed)==null?void 0:u.permalink)||"",title:t.title||((o=e.feed)==null?void 0:o.title)||""}},author(){var e,t;return((t=(e=this.currentItem)==null?void 0:e.feed)==null?void 0:t.author)||null},authorProfileHref(){var t;const e=(t=this.author)==null?void 0:t.username;return!e||!this.$getRouteLink?"":this.$getRouteLink("u/:username",{username:e})},postDate(){var t,s,u,o,i,m;const e=((u=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.created_at)==null?void 0:u.date)||((i=(o=this.currentItem)==null?void 0:o.feed)==null?void 0:i.created_at)||((m=this.currentItem)==null?void 0:m.created_at);return e?this.humanDateDiff(e):""},safePermalink(){var t,s;const e=(s=(t=this.currentItem)==null?void 0:t.feed)==null?void 0:s.permalink;if(!e)return null;try{const u=new URL(e,window.location.origin);return u.protocol==="http:"||u.protocol==="https:"?e:null}catch{return null}},metaProps(){return{author:this.author,authorHref:this.authorProfileHref,postDate:this.postDate,permalink:this.safePermalink}},zoomButtons(){return[{label:this.$t("Zoom out"),icon:ui,disabled:!this.canZoomOut,action:()=>this.stepZoom(-1)},{label:this.$t("Zoom in"),icon:_i,disabled:!this.canZoomIn,action:()=>this.stepZoom(1)},{label:this.$t("Reset zoom"),icon:Ks,disabled:!this.canResetZoom,action:this.resetImageZoom}]},hasNav(){return this.items.length>1},hasPrev(){return this.hasNav&&this.currentIndex>0},hasNext(){return this.hasNav&&this.currentIndex<this.items.length-1},imageAlt(){var t,s;const e=this.currentItem;return e?(t=e.feed)!=null&&t.title?e.feed.title:(s=this.author)!=null&&s.name?this.$t("Photo by %s",this.author.name):this.$t("Photo %d of %d",this.currentIndex+1,this.items.length):this.$t("Media")},lightboxWidth(){return{image:"96vw",audio:"min(90vw, 720px)"}[this.currentKind]||"min(90vw, 1100px)"},dialogAriaLabel(){const e={image:"Photo viewer",video:"Video viewer",audio:"Audio viewer"};return this.$t(e[this.currentKind]||"Media viewer")},srAnnounce(){return!this.currentItem||this.items.length<=1?"":this.$t("Item %d of %d",this.currentIndex+1,this.items.length)}},watch:{modelValue(e){e&&(this.currentIndex=this.initialIndex,this.fluentPlayerFailed=!1,this.resetImageZoom())},currentKind(){this.syncWheelListener()}},created(){this.boundKeydownHandler=this.handleKeydown.bind(this),this.boundMouseMoveHandler=this.onPointerReveal.bind(this),this.boundFocusInHandler=this.showChrome.bind(this),this.chromeIdleTimer=null,this._lastReveal=0},methods:{onOpened(){this.detachDocListeners(),document.addEventListener("keydown",this.boundKeydownHandler),document.addEventListener("mousemove",this.boundMouseMoveHandler),document.addEventListener("focusin",this.boundFocusInHandler),this.syncWheelListener(),this.showChrome()},onClosed(){this.detachDocListeners(),this.stopPan(),this.resetImageZoom(),this.fluentPlayerFailed=!1,this.clearChromeTimer(),this.chromeVisible=!0},detachDocListeners(){document.removeEventListener("keydown",this.boundKeydownHandler),this.detachWheel(),document.removeEventListener("mousemove",this.boundMouseMoveHandler),document.removeEventListener("focusin",this.boundFocusInHandler)},showChrome(){this.chromeVisible=!0,this.scheduleChromeHide()},scheduleChromeHide(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=setTimeout(()=>{const e=document.activeElement,t=e&&typeof e.closest=="function"&&e.closest(".fcom_space_media_video_close, .fcom_space_media_video_nav, .fcom_space_media_lightbox_icon, .fcom_space_media_viewpost_btn, .fcom_space_media_author_chip_link");!this.isPanning&&!t&&(this.chromeVisible=!1)},2e3)},clearChromeTimer(){clearTimeout(this.chromeIdleTimer),this.chromeIdleTimer=null},onPointerReveal(){const e=Date.now();e-this._lastReveal<200||(this._lastReveal=e,this.showChrome())},handleKeydown(e){if(!this.modelValue||e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;const t=e.target;t&&typeof t.closest=="function"&&t.closest('audio, video, media-player, input, textarea, [contenteditable="true"]')||(e.key==="ArrowLeft"?this.prev():this.next())},goTo(e){const t=this.currentIndex+e;t<0||t>this.items.length-1||(this.stopActiveVideo(),this.fluentPlayerFailed=!1,this.resetImageZoom(),this.currentIndex=t,this.showChrome())},prev(){this.goTo(-1)},next(){this.goTo(1)},requestClose(){this.dialogOpen=!1},stopActiveVideo(){const e=this.$refs.mediaBody;e&&e.querySelectorAll("video, audio, media-player").forEach(t=>{try{t.muted=!0,typeof t.pause=="function"&&t.pause()}catch{}})},handleBeforeClose(e){this.stopActiveVideo(),e()}},beforeUnmount(){this.detachDocListeners(),this.stopPan(),this.clearChromeTimer()}},a6=["aria-label"],r6=["aria-label"],c6=["aria-label"],d6={class:"fcom_media_sr_only","aria-live":"polite"},u6=["src","alt"],_6=["src","aria-label"],m6=["src","aria-label"],h6={key:0,class:"fcom_space_media_meta_bar"},f6={key:1,class:"fcom_space_media_image_controls"},p6={class:"fcom_space_media_zoom_bar"},g6=["aria-label","disabled","onClick"];function y6(e,t,s,u,o,i){const m=p("Close"),f=O,h=p("ArrowLeftBold"),g=p("ArrowRightBold"),k=p("fluent-player-preview"),b=p("lightbox-meta"),w=we;return n(),y(w,{modelValue:i.dialogOpen,"onUpdate:modelValue":t[12]||(t[12]=S=>i.dialogOpen=S),width:i.lightboxWidth,"show-close":!1,"align-center":"","destroy-on-close":"","before-close":i.handleBeforeClose,"aria-label":i.dialogAriaLabel,class:x(["fcom_space_media_lightbox","fcom_space_media_video_dialog",{fcom_space_media_lightbox_image:i.currentKind==="image",fcom_chrome_hidden:!o.chromeVisible,fcom_space_media_panning:e.isPanning}]),onOpened:i.onOpened,onClosed:i.onClosed},{default:r(()=>{var S,C,v,$,T,V,F,L;return[l("button",{type:"button",class:"fcom_space_media_lightbox_icon fcom_space_media_video_close","aria-label":e.$t("Close"),onClick:t[0]||(t[0]=(...A)=>i.requestClose&&i.requestClose(...A))},[a(f,null,{default:r(()=>[a(m)]),_:1})],8,a6),i.hasPrev?(n(),c("button",{key:0,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_prev","aria-label":e.$t("Previous"),onClick:t[1]||(t[1]=(...A)=>i.prev&&i.prev(...A))},[a(f,null,{default:r(()=>[a(h)]),_:1})],8,r6)):_("",!0),i.hasNext?(n(),c("button",{key:1,type:"button",class:"fcom_space_media_video_nav fcom_space_media_video_nav_next","aria-label":e.$t("Next"),onClick:t[2]||(t[2]=(...A)=>i.next&&i.next(...A))},[a(f,null,{default:r(()=>[a(g)]),_:1})],8,c6)):_("",!0),l("div",{class:"fcom_space_media_video_stage",onClick:t[11]||(t[11]=z((...A)=>i.requestClose&&i.requestClose(...A),["self"]))},[l("p",d6,d(i.srAnnounce),1),l("div",{ref:"mediaBody",class:x(["fcom_space_media_video_body",{fcom_space_media_zoomed:e.imageScale>1,fcom_space_media_body_image:i.currentKind==="image",fcom_space_media_body_audio:i.currentKind==="audio"}]),onClick:t[10]||(t[10]=z((...A)=>i.requestClose&&i.requestClose(...A),["self"]))},[i.currentKind==="image"?(n(),c("img",{key:0,src:i.currentItem.url,alt:i.imageAlt,draggable:"false",style:re(e.imageTransformStyle),class:x({fcom_space_media_dragging:e.isPanning}),onMousedown:t[3]||(t[3]=z((...A)=>e.onImagePanStart&&e.onImagePanStart(...A),["prevent"])),onTouchstart:t[4]||(t[4]=(...A)=>e.onImageTouchStart&&e.onImageTouchStart(...A)),onTouchmove:t[5]||(t[5]=z((...A)=>e.onImageTouchMove&&e.onImageTouchMove(...A),["prevent"])),onTouchend:t[6]||(t[6]=(...A)=>e.onImageTouchEnd&&e.onImageTouchEnd(...A)),onTouchcancel:t[7]||(t[7]=(...A)=>e.onImageTouchEnd&&e.onImageTouchEnd(...A)),onDblclick:t[8]||(t[8]=(...A)=>e.toggleImageZoom&&e.toggleImageZoom(...A))},null,46,u6)):i.currentKind==="video"||i.currentKind==="audio"?(n(),c(P,{key:1},[i.playerMedia&&i.hasFluentPlayer&&!o.fluentPlayerFailed?(n(),y(k,{key:i.playerMedia.media_id,media:i.playerMedia,onLoadFailed:t[9]||(t[9]=A=>o.fluentPlayerFailed=!0)},null,8,["media"])):i.currentKind==="video"&&i.currentMediaUrl?(n(),c("video",{key:1,src:i.currentMediaUrl,"aria-label":((C=(S=i.currentItem)==null?void 0:S.settings)==null?void 0:C.title)||(($=(v=i.currentItem)==null?void 0:v.feed)==null?void 0:$.title)||e.$t("Video"),controls:"",autoplay:"",playsinline:""},null,8,_6)):i.currentKind==="audio"&&i.currentMediaUrl?(n(),c("audio",{key:2,src:i.currentMediaUrl,"aria-label":((V=(T=i.currentItem)==null?void 0:T.settings)==null?void 0:V.title)||((L=(F=i.currentItem)==null?void 0:F.feed)==null?void 0:L.title)||e.$t("Audio"),controls:""},null,8,m6)):_("",!0)],64)):_("",!0)],2),i.currentKind==="video"||i.currentKind==="audio"?(n(),c("div",h6,[a(b,ws(Cs(i.metaProps)),null,16)])):_("",!0),i.currentItem&&i.currentKind==="image"?(n(),c("div",f6,[a(b,ws(Cs(i.metaProps)),null,16),l("div",p6,[(n(!0),c(P,null,R(i.zoomButtons,A=>(n(),c("button",{key:A.label,type:"button",class:"fcom_space_media_lightbox_icon","aria-label":A.label,disabled:A.disabled,onClick:A.action},[a(f,null,{default:r(()=>[(n(),y(Ct(A.icon)))]),_:2},1024)],8,g6))),128))])])):_("",!0)])]}),_:1},8,["modelValue","width","before-close","aria-label","class","onOpened","onClosed"])}const v6=I(l6,[["render",y6]]),Ro={data(){return{feedLoadingId:null}},methods:{feedRoute(e){var u,o,i;const t=(u=e.feed)==null?void 0:u.slug,s=((i=(o=e.feed)==null?void 0:o.space)==null?void 0:i.slug)||this.spaceSlug;return s?{name:"space_feed",params:{feed_slug:t,space:s}}:{name:"single_feed",params:{feed_slug:t}}},feedHref(e){var t;if((t=e.feed)!=null&&t.slug)return this.$router.resolve(this.feedRoute(e)).href},openFeed(e,t){var u;const s=(u=e.feed)==null?void 0:u.slug;if(s&&!(t&&(t.metaKey||t.ctrlKey))){if(!this.hasFeature("show_post_modal")){t&&t.preventDefault(),this.$router.push(this.feedRoute(e));return}t&&t.preventDefault(),this.feedLoadingId!==e.feed.id&&(this.feedLoadingId=e.feed.id,this.$get("feeds/"+s+"/by-slug").then(o=>{o!=null&&o.feed&&this.$eventBus.emit("showFeedModal",{feed:o.feed})}).catch(o=>{this.$handleError&&this.$handleError(o)}).finally(()=>{this.feedLoadingId=null}))}}}},b6={name:"MediaAudioList",components:{FluentPlayerPreview:It,ExpandIcon:gs},mixins:[Ro],props:{items:{type:Array,default:()=>[]},spaceSlug:{type:String,default:""}},data(){return{visibleIds:{},failedIds:{},reloadKey:0}},computed:{hasFluentPlayer(){var e,t,s,u,o;return!!((t=(e=this.appVars)==null?void 0:e.features)!=null&&t.has_fluent_player&&((o=(u=(s=this.appVars)==null?void 0:s.features)==null?void 0:u.fluent_player)!=null&&o.enable))}},methods:{observeRow(e){!e||this.visibleIds[e.dataset.id]||(this._io?this._io.observe(e):this.visibleIds[e.dataset.id]=!0)},onRowVisible(e){e.forEach(t=>{t.isIntersecting&&(this.visibleIds[t.target.dataset.id]=!0,this._io.unobserve(t.target))})},playerMediaFor(e){var u,o,i;if(this._playerMediaCache[e.id])return this._playerMediaCache[e.id];const t=e.settings&&typeof e.settings=="object"?{...e.settings}:{};t.src||(t.src=e.url);const s={media_id:e.id,type:"fluent_player",provider:"upload",url:e.url,settings:t,feed_id:((u=e.feed)==null?void 0:u.id)||"",share_url:((o=e.feed)==null?void 0:o.permalink)||"",title:t.title||((i=e.feed)==null?void 0:i.title)||""};return this._playerMediaCache[e.id]=s,s}},created(){this._playerMediaCache={},typeof IntersectionObserver<"u"&&(this._io=new IntersectionObserver(this.onRowVisible,{rootMargin:"200px"}))},beforeUnmount(){this._io&&(this._io.disconnect(),this._io=null)},activated(){this._activatedOnce&&this.reloadKey++,this._activatedOnce=!0},deactivated(){var e,t;(t=(e=this.$el)==null?void 0:e.querySelectorAll)==null||t.call(e,"audio, video, media-player").forEach(s=>{try{typeof s.pause=="function"&&s.pause()}catch{}})}},k6={class:"fcom_space_media_audio_list all_media_holder"},w6=["data-id"],C6=["href","aria-label","onClick"],$6={key:1,class:"fcom_audio_row_placeholder","aria-hidden":"true"},S6=["src","aria-label"];function V6(e,t,s,u,o,i){const m=p("ExpandIcon"),f=xe,h=p("fluent-player-preview");return n(),c("div",k6,[(n(!0),c(P,null,R(s.items,g=>{var k,b,w;return n(),c("div",{key:g.id,ref_for:!0,ref:i.observeRow,"data-id":g.id,class:"fcom_space_media_audio_row"},[(k=g.feed)!=null&&k.slug?(n(),y(f,{key:0,content:e.$t("Open post"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:e.feedHref(g),class:"fcom_audio_row_open","aria-label":e.$t("Open post"),onClick:z(S=>e.openFeed(g,S),["stop"])},[a(m)],8,C6)]),_:2},1032,["content"])):_("",!0),i.hasFluentPlayer&&!o.failedIds[g.id]?(n(),c(P,{key:1},[o.visibleIds[g.id]?(n(),y(h,{key:g.id+"-"+o.reloadKey,media:i.playerMediaFor(g),onLoadFailed:S=>o.failedIds[g.id]=!0},null,8,["media","onLoadFailed"])):(n(),c("div",$6))],64)):g.url?(n(),c("audio",{key:2,src:g.url,"aria-label":((b=g.settings)==null?void 0:b.title)||((w=g.feed)==null?void 0:w.title)||e.$t("Audio"),controls:"",preload:"none",class:"fcom_audio_row_native"},null,8,S6)):_("",!0)],8,w6)}),128))])}const M6=I(b6,[["render",V6]]),T6={name:"SpaceMedia",components:{MediaLightbox:v6,MediaAudioList:M6,ExpandIcon:gs},mixins:[Ro],props:["space","space_profile","space_slug"],emits:["refetch"],inheritAttrs:!1,data(){return{hasAudio:!1,items:[],cursor:0,hasMore:!1,loading:!1,fetchToken:0,permission_failed:!1,viewerIndex:0,mediaDialog:!1,boundScrollHandler:null,cache:{}}},computed:{activeType:{get(){const e=this.$route.query.type;return["photos","videos","audios"].includes(e)?e:"photos"},set(e){const t={...this.$route.query};e==="photos"?delete t.type:t.type=e,this.$router.push({query:t}).catch(()=>{})}},spaceSlug(){var e;return((e=this.space_profile)==null?void 0:e.slug)||this.space_slug||this.space},isVideoLightboxOpen(){var e;return this.mediaDialog&&((e=this.items[this.viewerIndex])==null?void 0:e.kind)==="video"}},watch:{activeType(){this.loadActiveType()}},methods:{async fetch(e=!1){if(e&&this.loading)return;const t=++this.fetchToken,s=this.activeType;this.loading=!0;try{const u={type:s,per_page:24};e&&this.cursor&&(u.cursor=this.cursor);const o=await this.$get("media-gallery/"+this.spaceSlug,u);if(t!==this.fetchToken||s!==this.activeType)return;const i=o.items||[];this.items=e?this.items.concat(i):i,this.hasMore=!!o.has_more,typeof o.has_audio<"u"&&(this.hasAudio=o.has_audio),this.cursor=o.cursor||0,this.cache[s]={items:this.items,cursor:this.cursor,hasMore:this.hasMore}}catch(u){if(t!==this.fetchToken)return;if(u!=null&&u.permission_failed){this.permission_failed=!0;return}this.$handleError&&this.$handleError(u)}finally{t===this.fetchToken&&(this.loading=!1)}},loadActiveType(){const e=this.cache[this.activeType];if(e){this.items=e.items,this.cursor=e.cursor,this.hasMore=e.hasMore;return}this.items=[],this.cursor=0,this.hasMore=!1,this.fetch(!1)},openItem(e){this.items[e]&&(this.viewerIndex=e,this.mediaDialog=!0)},handleScrollAutoLoad(){var i;if(!this.hasMore||this.loading)return;const e=document.querySelector(".all_media_holder"),t=e&&e.lastElementChild;if(!t)return;const s=(i=window.fcomLayoutRef)==null?void 0:i.wrapRef;if(!s)return;const u=t.getBoundingClientRect(),o=s.getBoundingClientRect();u.bottom-o.bottom<100&&this.fetch(!0)}},created(){this.fetch(!1)},mounted(){this.boundScrollHandler=this.handleScrollAutoLoad.bind(this),document.addEventListener("fcom_layout_scroll",this.boundScrollHandler)},beforeUnmount(){this.boundScrollHandler&&document.removeEventListener("fcom_layout_scroll",this.boundScrollHandler)}},L6={class:"card_header"},P6={class:"member_status"},F6={key:0,class:"fcom_space_media_tabs"},I6={key:0,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},E6={class:"permission_failed"},U6=["href"],A6={key:1,class:"fcom_space_media_card"},B6={key:1,class:"fcom_space_media_empty no_members"},D6={key:0},R6={key:1},x6={key:2},H6={key:0,class:"fcom_space_media_grid all_media_holder"},O6=["aria-label","onClick","onKeydown"],j6=["src","alt"],N6=["src","poster"],z6={key:2,class:"fcom_space_media_play_badge","aria-hidden":"true"},q6=["href","aria-label","onClick"],G6={key:3,class:"fcom_space_media_load_more",style:{"margin-top":"20px","text-align":"center"}};function Y6(e,t,s,u,o,i){const m=ze,f=ke,h=Z,g=p("media-audio-list"),k=p("ExpandIcon"),b=xe,w=H,S=p("media-lightbox");return n(),c("div",{class:x(["fcom_space_media",{fcom_space_media_video_open:i.isVideoLightboxOpen}])},[l("div",L6,[l("div",P6,[l("h3",null,d(e.$t("Media Gallery")),1)]),o.permission_failed?_("",!0):(n(),c("div",F6,[a(f,{modelValue:i.activeType,"onUpdate:modelValue":t[0]||(t[0]=C=>i.activeType=C),size:"default"},{default:r(()=>[a(m,{label:"photos",value:"photos"},{default:r(()=>[M(d(e.$t("Photos")),1)]),_:1}),a(m,{label:"videos",value:"videos"},{default:r(()=>[M(d(e.$t("Videos")),1)]),_:1}),o.hasAudio?(n(),y(m,{key:0,label:"audios",value:"audios","data-testid":"tab-audios"},{default:r(()=>[M(d(e.$t("Audios")),1)]),_:1})):_("",!0)]),_:1},8,["modelValue"])]))]),o.permission_failed?(n(),c("div",I6,[l("div",E6,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view this page")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,U6)])])):(n(),c("div",A6,[o.loading&&!o.items.length?(n(),y(h,{key:0,class:"fcom_mt_20 white_loaded",animated:!0,rows:5})):o.items.length?(n(),c(P,{key:2},[(n(),y(Go,null,[i.activeType==="audios"?(n(),y(g,{key:0,items:o.items,"space-slug":i.spaceSlug},null,8,["items","space-slug"])):_("",!0)],1024)),i.activeType!=="audios"?(n(),c("div",H6,[(n(!0),c(P,null,R(o.items,(C,v)=>{var $,T,V,F,L;return n(),c("div",{key:C.id,class:x(["fcom_space_media_cell",["fcom_kind_"+C.kind]]),role:"button",tabindex:"0","aria-label":(($=C.settings)==null?void 0:$.title)||((T=C.feed)==null?void 0:T.title)||e.$t("Open media"),onClick:A=>i.openItem(v),onKeydown:[ae(A=>i.openItem(v),["enter"]),ae(z(A=>i.openItem(v),["prevent"]),["space"])]},[C.kind==="image"?(n(),c("img",{key:0,src:C.url,alt:((V=C.feed)==null?void 0:V.title)||"",loading:"lazy"},null,8,j6)):(n(),c("video",{key:1,src:C.url,poster:((F=C.settings)==null?void 0:F.posterSrc)||void 0,preload:"metadata",muted:"",playsinline:""},null,8,N6)),t[4]||(t[4]=l("span",{class:"fcom_space_media_overlay","aria-hidden":"true"},null,-1)),C.kind==="video"?(n(),c("span",z6)):_("",!0),(L=C.feed)!=null&&L.slug?(n(),y(b,{key:3,content:e.$t("Open post"),placement:"top","show-after":200},{default:r(()=>[l("a",{href:e.feedHref(C),class:"fcom_space_media_feed_btn","aria-label":e.$t("Open post"),onClick:z(A=>e.openFeed(C,A),["stop"]),onKeydown:t[1]||(t[1]=z(()=>{},["stop"]))},[a(k)],40,q6)]),_:2},1032,["content"])):_("",!0)],42,O6)}),128))])):_("",!0)],64)):(n(),c("div",B6,[i.activeType==="videos"?(n(),c("p",D6,d(e.$t("No videos yet. Videos shared in posts will appear here.")),1)):i.activeType==="audios"?(n(),c("p",R6,d(e.$t("No audios yet. Audio shared in posts will appear here.")),1)):(n(),c("p",x6,d(e.$t("No photos yet. Photos shared in posts will appear here.")),1))])),o.hasMore?(n(),c("div",G6,[a(w,{class:"fcom_secondary_button",disabled:o.loading,loading:o.loading,onClick:t[2]||(t[2]=C=>i.fetch(!0))},{default:r(()=>[M(d(e.$t("Load more")),1)]),_:1},8,["disabled","loading"])])):_("",!0)])),a(S,{modelValue:o.mediaDialog,"onUpdate:modelValue":t[3]||(t[3]=C=>o.mediaDialog=C),items:o.items,"initial-index":o.viewerIndex},null,8,["modelValue","items","initial-index"])],2)}const W6=I(T6,[["render",Y6]]);const Z6={name:"PendingInvitations",components:{Pagination:Ve},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()}},K6={class:"fcom_invitations"},J6={style:{margin:"20px 0"},class:"fcom_spaced_flex"},Q6={key:0},X6={key:0,class:"fcom_person_name"},e$={key:1,class:"fcom_person_name"},t$={key:3,style:{margin:"0",padding:"0"}},s$={class:"fcom_person_name"};function o$(e,t,s,u,o,i){const m=ie,f=ne,h=p("CopyDocument"),g=O,k=H,b=is,w=p("UserRouteLink"),S=p("DeleteFilled"),C=ns,v=p("Pagination"),$=ee("loading");return n(),c("div",K6,[l("div",J6,[l("h4",null,d(e.$t("Invitations")),1),e.has_pro?(n(),c("div",Q6,[a(f,{style:{"min-width":"150px"},onChange:t[0]||(t[0]=T=>{o.pagination.page=1,i.getInvitations()}),modelValue:o.status,"onUpdate:modelValue":t[1]||(t[1]=T=>o.status=T)},{default:r(()=>[(n(),c(P,null,R(["all","pending","accepted","active","expired"],T=>a(m,{key:T,label:e.$labelize(T),value:T},null,8,["label","value"])),64))]),_:1},8,["modelValue"])])):_("",!0)]),Y((n(),y(C,{data:o.invitations,border:"","empty-text":i.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?(n(),c("span",X6,d(T.row.meta.invitee_name)+" <"+d(T.row.message)+"> ",1)):(n(),c("span",e$,d(T.row.meta.title)+" ("+d(e.$t("Invitation Link"))+") ",1)),T.row.access_url?(n(),y(k,{key:2,type:"info",size:"small",text:"",onClick:V=>e.$toClipboard(T.row.access_url,e.$t("Invitation link has been copied to clipboard"))},{default:r(()=>[a(g,{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):(n(),c("p",t$,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"]),o.is_mod?(n(),y(b,{key:0,prop:"user_id",label:e.$t("Invited By"),width:"180"},{default:r(T=>[l("span",s$,[a(w,{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"?Y((n(),y(k,{key:0,size:"small",onClick:V=>i.handleResend(T.row)},{default:r(()=>[M(d(e.$t("Resend")),1)]),_:1},8,["onClick"])),[[$,o.loading]]):_("",!0),a(k,{"aria-label":e.$t("Delete invitation"),onClick:V=>i.handleDelete(T.row),plain:"",type:"danger",size:"small"},{default:r(()=>[a(g,{title:e.$t("Delete invitation")},{default:r(()=>[a(S)]),_:1},8,["title"])]),_:1},8,["aria-label","onClick"])]),_:1},8,["label"])]),_:1},8,["data","empty-text"])),[[$,o.loading]]),a(v,{hide_on_single:!1,pagination:o.pagination,onFetch:i.getInvitations},null,8,["pagination","onFetch"])])}const i$=I(Z6,[["render",o$]]);const n$={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}))}}},l$={class:"fcom_invitation_link_wrap"},a$={class:"fcom_invite_head"},r$={class:"fcom_invite_body"},c$={key:1},d$={key:1,style:{padding:"20px"}},u$={style:{"font-size":"20px",margin:"20px 0","text-align":"center"}};function _$(e,t,s,u,o,i){const m=te,f=ue,h=Ke,g=H,k=_e,b=p("CopyDocument"),w=O;return n(),c("div",l$,[l("div",a$,[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",r$,[o.createdItem?(n(),c("div",d$,[l("h4",u$,d(e.$t("Please share this url to your audience to join this space")),1),a(m,{modelValue:o.createdItem.access_url,"onUpdate:modelValue":t[6]||(t[6]=S=>o.createdItem.access_url=S),readonly:""},{suffix:r(()=>[a(g,{class:"fcomc_button_primary",onClick:t[5]||(t[5]=S=>e.$toClipboard(o.createdItem.access_url,e.$t("Invitation link has been copied to your clipboard")))},{default:r(()=>[a(w,null,{default:r(()=>[a(b)]),_:1}),l("span",null,d(e.$t("Copy")),1)]),_:1})]),_:1},8,["modelValue"])])):(n(),y(k,{key:0,onSubmit:t[3]||(t[3]=z(S=>e.doNothing(),["prevent"])),modelValue:o.form,"onUpdate:modelValue":t[4]||(t[4]=S=>o.form=S),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Invitation Link Title")},{default:r(()=>[a(m,{modelValue:o.form.title,"onUpdate:modelValue":t[0]||(t[0]=S=>o.form.title=S),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:o.form.limit,"onUpdate:modelValue":t[1]||(t[1]=S=>o.form.limit=S),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:o.form.expire_date,"onUpdate:modelValue":t[2]||(t[2]=S=>o.form.expire_date=S),type:"date",placeholder:e.$t("Leave empty for no expiration"),"value-format":"YYYY-MM-DD",format:e.siteDateFormat},null,8,["modelValue","placeholder","format"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[e.has_pro?(n(),y(g,{key:0,onClick:i.createLink,loading:o.creating,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Create Invitation Link")),1)]),_:1},8,["onClick","loading"])):(n(),c("div",c$,[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 m$=I(n$,[["render",_$]]),h$={name:"InviteUser",props:["space_profile"],data(){return{inviteEmail:"",inviteName:"",role:"member",inviting:!1}},methods:{invite(){const e=(this.inviteEmail||"").trim();if(!/^\S+@\S+\.\S+$/.test(e)){this.$notify.error(this.$t("Please enter a valid email address."));return}this.inviting=!0,this.$get("spaces/users/search",{context:"add_member",search:e,space_id:this.space_profile.id}).then(t=>{const s=(t.users.data||[]).find(u=>(u.user_email||"").toLowerCase()===e.toLowerCase());return s?this.$post("spaces/"+this.space_profile.slug+"/members",{user_id:s.ID,role:this.role}).then(u=>{this.$notify.success(u.message),this.resetForm()}):this.$post("invitations",{email:e,invitee_name:(this.inviteName||"").trim(),space_id:this.space_profile.id}).then(u=>{this.$notify.success(u.message||this.$t("Invitation sent.")),this.resetForm(),this.$emit("invited")})}).catch(t=>{this.$handleError(t)}).finally(()=>this.inviting=!1)},resetForm(){this.inviteEmail="",this.inviteName="",this.role="member"}}},f$={class:"fcom_invitation_link_wrap"},p$={class:"fcom_invite_head"},g$={class:"fcom_invite_body"};function y$(e,t,s,u,o,i){const m=te,f=ue,h=ie,g=ne,k=H,b=_e;return n(),c("div",f$,[l("div",p$,[l("h4",null,d(e.$t("Invite a user by email")),1),l("p",null,d(e.$t("If the user already exists, they will be added to the space directly. Otherwise, an email invitation will be sent.")),1)]),l("div",g$,[a(b,{onSubmit:t[6]||(t[6]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{modelValue:o.inviteEmail,"onUpdate:modelValue":t[0]||(t[0]=w=>o.inviteEmail=w),type:"email",placeholder:e.$t("Enter email address"),onKeyup:t[1]||(t[1]=ae(w=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Invitee Name (optional)")},{default:r(()=>[a(m,{modelValue:o.inviteName,"onUpdate:modelValue":t[2]||(t[2]=w=>o.inviteName=w),placeholder:e.$t("Enter invitee Name"),onKeyup:t[3]||(t[3]=ae(w=>i.invite(),["enter"]))},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,{label:e.$t("Membership Role")},{default:r(()=>[a(g,{modelValue:o.role,"onUpdate:modelValue":t[4]||(t[4]=w=>o.role=w),placeholder:e.$t("Select Role")},{default:r(()=>[a(h,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(h,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(h,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[a(k,{class:"fcom_primary_button",loading:o.inviting,disabled:o.inviting,onClick:t[5]||(t[5]=w=>i.invite())},{default:r(()=>[M(d(e.$t("Send Invitation")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})])])}const v$=I(h$,[["render",y$]]),b$={name:"SpaceInviations",components:{CreateInvitationLink:m$,PendingInvitations:i$,InviteUser:v$},props:["space_profile"],data(){return{currentTab:"invitations"}}},k$={key:0,class:"card_header"},w$={class:"permission_failed"},C$=["href"],$$={key:1};function S$(e,t,s,u,o,i){const m=p("pending-invitations"),f=Mt,h=p("CreateInvitationLink"),g=p("InviteUser"),k=Tt;return e.hasSpaceAdminAccess(s.space_profile)?(n(),c("div",$$,[a(k,{modelValue:o.currentTab,"onUpdate:modelValue":t[1]||(t[1]=b=>o.currentTab=b),type:"border-card"},{default:r(()=>[a(f,{name:"invitations",label:e.$t("Invitations")},{default:r(()=>[o.currentTab=="invitations"?(n(),y(m,{key:0,space_id:s.space_profile.id},null,8,["space_id"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invitation_links",label:e.$t("New Invitation Link")},{default:r(()=>[o.currentTab=="invitation_links"?(n(),y(h,{key:0,space_profile:s.space_profile},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"]),a(f,{name:"invite_user",label:e.$t("Invite User")},{default:r(()=>[o.currentTab=="invite_user"?(n(),y(g,{key:0,space_profile:s.space_profile,onInvited:t[0]||(t[0]=b=>o.currentTab="invitations")},null,8,["space_profile"])):_("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue"])])):(n(),c("div",k$,[l("div",w$,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view invitations")),1),l("a",{href:e.$getRouteLink("space/:space_slug/home",{space_slug:s.space_profile.slug}),class:"el-button fcom_primary_button"},d(e.$t("Go to Space Home")),9,C$)])]))}const V$=I(b$,[["render",S$]]),M$={name:"GlobIcon"},T$={width:"14",height:"14",viewBox:"0 0 14 14",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function L$(e,t,s,u,o,i){return n(),c("svg",T$,[...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 xo=I(M$,[["render",L$]]),P$={name:"GroupIcon"},F$={width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I$(e,t,s,u,o,i){return n(),c("svg",F$,[...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 Wt=I(P$,[["render",I$]]),E$={name:"AllCommunities",components:{User:mi,GlobIcon:xo,Layout:$e,AppLayout:Me,CreateSpaceForm:zt,GroupIcon:Wt,Pagination:Ve,Search:Ee},setup(){return{spaceStore:Ne()}},data(){return{communities:[],loading:!0,joining:null,pagination:{page:1,per_page:24,total:0},search:"",type:"all",sort_by:"alphabetical"}},methods:{getCommunities(){this.loading=!0,this.$get("spaces/discover",{type:this.type,search:this.search,sort_by:this.sort_by,page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.communities=e.spaces.data,this.pagination.total=e.spaces.total}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},goToSpaceFeeds(e){this.$router.push({name:"space_feeds",params:{space:e}})},getSpaceFeedsRoute(e){return{name:"space_feeds",params:{space:e}}},getExcerpt(e,t=50){if(!e)return"";let s=e.replace(/(<([^>]+)>)/ig,"");return typeof DOMParser<"u"&&(s=new DOMParser().parseFromString(s,"text/html").body.textContent||""),s.length>t&&(s=s.substring(0,t)+"..."),s},async join(e){if(e.privacy!="public"||!this.auth.user_id){this.$router.push({name:"space_feeds",params:{space:e.slug}});return}this.joining=e.slug;try{await this.spaceStore.joinSpace(e.slug,e),this.$notify.success(this.$t("Successfully joined the space")),this.$eventBus.emit("reloadMenu"),delete this.spaceStore.spacesBySlug[e.slug],this.$router.push({name:"space_feeds",params:{space:e.slug}})}catch(t){this.$handleError(t)}finally{this.joining=null}},fireCreateSpace(e=null){this.$eventBus.emit("createSpaceModal",e)},goToSpaceGroups(){window.location.href=this.$getRouteLink("admin/settings/space_groups")},SwitchToSpaceView(e){this.type=e,this.getCommunities()},handleSearch(){this.search&&this.search.length<3||this.toSearch()},toSearch(){this.pagination.page=1,this.getCommunities()},changeSortBy(){this.$storeLocalData("space_sort_by",this.sort_by),this.toSearch()},openCreateSpace(e){e==="yes"&&this.fireCreateSpace()}},created(){this.$eventBus.on("open_create_space_modal",this.openCreateSpace)},mounted(){this.sort_by=this.$getLocalData("space_sort_by","alphabetical"),this.getCommunities(),this.$route.query.create_space=="yes"&&this.fireCreateSpace(),this.changeTitle(this.$t("Spaces"))},beforeUnmount(){this.$eventBus.off("open_create_space_modal",this.openCreateSpace)}},U$={class:"object_menu"},A$={class:"fcom_space_menu_ul"},B$={key:0},D$={key:1},R$={class:"actions_items"},x$={class:"search_member"},H$={class:"feed_filters"},O$={id:"feed_short_by",class:"fcom_feed_filter_label"},j$={class:"fcom_communities"},N$={key:0,class:"fcom_no_items_wrap"},z$={key:1,class:"fcom_box_card_list"},q$={class:"fcom_box_card_avatar"},G$=["src"],Y$=["src"],W$=["alt","src"],Z$={class:"fcom_box_card_info"},K$={class:"fcom_box_card_name"},J$={key:0},Q$={class:"fcom_box_card_details"},X$={class:"details_item"},e7={key:0,class:"details_item"},t7=["textContent"],s7={class:"fcom_box_card_action"},o7=["disabled","onClick"],i7=["onClick"];function n7(e,t,s,u,o,i){const m=H,f=p("MoreFilled"),h=O,g=ye,k=p("Search"),b=te,w=ie,S=ne,C=p("router-link"),v=Ue,$=p("GlobIcon"),T=p("Lock"),V=p("GroupIcon"),F=p("pagination"),L=p("layout"),A=p("app-layout"),D=ee("loading");return n(),y(A,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(L,{content_class:"no_bg_layout",title:e.$t("Spaces")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:r(()=>[l("div",U$,[l("ul",A$,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(U=>i.SwitchToSpaceView("all"),["prevent"])),class:x(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Spaces")),3)]),e.auth.user_id?(n(),c("li",B$,[l("a",{onClick:t[1]||(t[1]=z(U=>i.SwitchToSpaceView("joined"),["prevent"])),class:x(o.type=="joined"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Spaces")),3)])):_("",!0),e.isAdmin()?(n(),c("li",D$,[a(m,{onClick:t[2]||(t[2]=U=>i.fireCreateSpace()),class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("New Space")),1)]),_:1})])):_("",!0)]),e.isAdmin()?(n(),y(g,{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",R$,[l("li",{onClick:t[3]||(t[3]=(...U)=>i.goToSpaceGroups&&i.goToSpaceGroups(...U))},d(e.$t("View Space Groups")),1)])]),_:1},512)):_("",!0)])]),default:r(()=>[l("div",x$,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=U=>o.search=U),placeholder:e.$t("Search Space...")},{prefix:r(()=>[a(h,null,{default:r(()=>[a(k)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",H$,[t[7]||(t[7]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",O$,d(e.$t("Sort by:")),1),a(S,{"aria-label":e.$t("Sort Spaces by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=U=>o.sort_by=U),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=U=>i.changeSortBy())},{default:r(()=>[a(w,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"]),a(w,{value:"latest",label:e.$t("Latest Spaces")},null,8,["label"]),a(w,{value:"oldest",label:e.$t("Oldest Spaces")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),Y((n(),c("div",j$,[!o.loading&&o.communities.length==0?(n(),c("div",N$,[o.search?(n(),c(P,{key:0},[l("h3",null,d(e.$t("No spaces found based on your search criteria")),1),l("p",null,d(e.$t("No spaces match your search criteria. Try adjusting your search terms or browse our space catalog.")),1)],64)):(n(),c(P,{key:1},[l("h3",null,d(e.$t("No spaces found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some spaces for you!")),1)],64))])):(n(),c("div",z$,[(n(!0),c(P,null,R(o.communities,U=>(n(),c("div",{role:"region","aria-label":"Space Lists",key:U.id,class:"fcom_each_box_card"},[l("div",q$,[a(C,{"aria-label":"Go to Space",to:i.getSpaceFeedsRoute(U.slug)},{default:r(()=>{var E;return[(E=U.settings)!=null&&E.og_image?(n(),c("img",{key:0,src:U.settings.og_image,alt:""},null,8,G$)):U.cover_photo?(n(),c("img",{key:1,src:U.cover_photo,alt:""},null,8,Y$)):(n(),c("img",{key:2,alt:e.$t("Placeholder image"),src:e.appVars.assets_url+"images/space-placeholder.jpg"},null,8,W$))]}),_:2},1032,["to"])]),l("div",Z$,[l("div",K$,[a(C,{to:i.getSpaceFeedsRoute(U.slug)},{default:r(()=>[M(d(i.getExcerpt(U.title,24))+" ",1),U.space_pivot?(n(),y(v,{key:0,type:"success"},{default:r(()=>[M(d(e.$labelize(U.space_pivot.role))+" ",1),U.space_pivot.status!="active"?(n(),c("span",J$," ("+d(e.$labelize(U.space_pivot.status))+") ",1)):_("",!0)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",Q$,[l("div",X$,[U.privacy==="public"?(n(),y(h,{key:0},{default:r(()=>[a($)]),_:1})):(n(),y(h,{key:1},{default:r(()=>[a(T)]),_:1})),l("span",null,d(e.$labelize(U.privacy)),1)]),U.members_count?(n(),c("div",e7,[a(h,null,{default:r(()=>[a(V)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(U.members_count))),1)])):_("",!0)]),U.description?(n(),c("div",{key:0,class:"fcom_box_card_description",textContent:d(i.getExcerpt(U.description_rendered,85))},null,8,t7)):_("",!0),l("div",s7,[U.space_pivot?(n(),c("button",{key:1,class:"fcom_card_button",onClick:E=>i.goToSpaceFeeds(U.slug)},d(e.$t("View Space")),9,i7)):Y((n(),c("button",{key:0,class:"fcom_card_button",disabled:o.joining===U.slug,onClick:E=>i.join(U)},[M(d(e.$t("Join")),1)],8,o7)),[[D,o.joining===U.slug]])])])]))),128))])),a(F,{hide_on_single:!0,onFetch:i.getCommunities,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[D,o.loading]])]),_:1},8,["title"])]),_:1})}const l7=I(E$,[["render",n7]]),a7={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 s=[];for(let u=0;u<t.length;u++){let o=this.appVars.user_badges[t[u]];o&&s.push(o)}return s}return[this.badge]}}},r7=["src"],c7={key:1,class:"fcom_emoji"},d7={key:2,class:"fcom_shape"},u7={key:1};function _7(e,t,s,u,o,i){const m=O,f=xe;return i.renderingBadges?(n(!0),c(P,{key:0},R(i.renderingBadges,h=>(n(),c("div",{class:x([{user_icon_only:h.show_label!="yes"},"user_badge"])},[a(f,{content:h.title,placement:"top"},{default:r(()=>[l("div",{style:re({backgroundColor:h.background_color,color:h.color,borderColor:h.color}),class:"user_badge_inner"},[h.config?(n(),c(P,{key:0},[h.config.logo?(n(),c("img",{key:0,alt:"",src:h.config.logo},null,8,r7)):h.config.emoji?(n(),c("span",c7,d(h.config.emoji),1)):h.config.shape_svg?(n(),c("span",d7,[a(m,{innerHTML:h.config.shape_svg},null,8,["innerHTML"])])):_("",!0)],64)):_("",!0),h.show_label=="yes"?(n(),c("span",u7,d(h.title),1)):_("",!0)],4)]),_:2},1032,["content"])],2))),256)):_("",!0)}const Ho=I(a7,[["render",_7]]),m7={name:"AddNotificationIcon"},h7={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 f7(e,t,s,u,o,i){return n(),c("svg",h7,[...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 p7=I(m7,[["render",f7]]),g7={name:"NotificationAddedIcon"},y7={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 v7(e,t,s,u,o,i){return n(),c("svg",y7,[...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 b7=I(g7,[["render",v7]]),k7={name:"AddUserForm",components:{SpaceIcon:Ye,SpaceCourseSelector:qt},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 w7(e,t,s,u,o,i){const m=te,f=ue,h=p("SpaceCourseSelector"),g=ie,k=ne,b=H,w=_e,S=ee("loading");return n(),y(w,{onSubmit:t[4]||(t[4]=z(C=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(f,{label:e.$t("User")},{default:r(()=>[a(m,{modelValue:s.user_profile.display_name+" ("+s.user_profile.email+")",disabled:""},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Select Space/Course")},{default:r(()=>[Y(a(h,{modelValue:o.selectedId,"onUpdate:modelValue":t[0]||(t[0]=C=>o.selectedId=C),memberships:o.userMemberships,placeholder_text:e.$t("Select Space/Course"),onSelectedType:i.updateSelectedType,onSelectedSlug:i.updateSelectedSlug},null,8,["modelValue","memberships","placeholder_text","onSelectedType","onSelectedSlug"]),[[S,o.loading]])]),_:1},8,["label"]),o.selectedType==="space"?(n(),y(f,{key:0,label:e.$t("Membership Role")},{default:r(()=>[a(k,{placeholder:e.$t("Select Role"),modelValue:o.role,"onUpdate:modelValue":t[1]||(t[1]=C=>o.role=C)},{default:r(()=>[a(g,{label:e.$t("Member"),value:"member"},null,8,["label"]),a(g,{label:e.$t("Moderator"),value:"moderator"},null,8,["label"]),a(g,{label:e.$t("Admin"),value:"admin"},null,8,["label"])]),_:1},8,["placeholder","modelValue"])]),_:1},8,["label"])):_("",!0),G(e.$slots,"after_form",{},()=>[a(f,null,{default:r(()=>[o.selectedType==="course"?Y((n(),y(b,{key:0,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[2]||(t[2]=C=>i.addToCourse())},{default:r(()=>[M(d(e.$t("Add to Course")),1)]),_:1},8,["disabled"])),[[S,o.saving]]):Y((n(),y(b,{key:1,class:"fcom_primary_button",disabled:o.saving||!o.selectedId,onClick:t[3]||(t[3]=C=>i.addToSpace())},{default:r(()=>[M(d(e.$t("Add to Space")),1)]),_:1},8,["disabled"])),[[S,o.saving]])]),_:1})])]),_:3})}const C7=I(k7,[["render",w7]]),$7={name:"ProfileHeader",emits:["refetch"],setup(){return{userStore:De()}},components:{UserBadge:Ho,ImageUploader:He,BookmarkIcon:yo,FollowAction:it,AddNotificationIcon:p7,NotificationAddedIcon:b7,AddUserForm:C7},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=Be(this.user_profile.total_points);return e?e.level:0},getCoverPhotoButtonText(){return this.user_profile.cover_photo?this.$t("Change Cover"):this.$t("Upload Cover")},isOtherProfile(){var s;const e=this.auth.user_id,t=(s=this.profile)==null?void 0:s.user_id;return t&&e&&t!=e},showActions(){var e,t;return((t=(e=this.profile)==null?void 0:e.profile_nav_actions)==null?void 0:t.length)||this.showFollowAction},showFollowAction(){return this.hasFeature("followers_module")&&this.isOtherProfile},showOtherActions(){return this.isOtherProfile&&this.hasPermission("super_admin")},showBlock(){var t,s;if(!((t=this.profile)!=null&&t.user_id)||this.userStore.isBlocked(this.profile.user_id))return!1;const e=(s=this.profile)==null?void 0:s.follow;return this.showFollowAction&&(!e||String(e)!=="0")},isFollowing(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;if(this.userStore.isFollowing(this.profile.user_id))return!0;const e=(s=this.profile)==null?void 0:s.follow;return e!==void 0&&["1","2"].includes(String(e))},isNotificationOn(){var t,s;if(!((t=this.profile)!=null&&t.user_id))return!1;const e=this.userStore.getFollowLevel(this.profile.user_id);return e!==void 0?String(e)==="2":String((s=this.profile)==null?void 0:s.follow)==="2"},getTitle(){return this.isNotificationOn?this.$t("Turn off Email Notification of This User"):this.$t("Turn on Email Notification of This User")}},methods:{handleCoverPhotoUpload(e){this.profile.cover_photo=e,this.updateProfile({cover_photo:e})},handlePhotoUpload(e){this.profile.avatar=e,this.updateProfile({avatar:e})},removeAvatar(){var t;(t=this.$refs.avatarPopover)==null||t.hide();const e=this.isOwnProfile?this.$t("Are you sure you want to remove your profile photo?"):this.$t("Are you sure you want to remove %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()}}},S7={ref:"fcom_user_profile",class:"object_header user_header"},V7={key:0,class:"object_media_uploader"},M7={class:"object_info"},T7={class:"object_avatar"},L7=["alt","src"],P7=["aria-label"],F7={class:"fcom_avatar_actions"},I7={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"},E7={class:"object_name"},U7={class:"object_meta"},A7={key:0,class:"object_meta follower"},B7={class:"object_menu"},D7={key:0,class:"fcom_profile_nav"},R7=["href","target"],x7={key:1,class:"fcom_profile_menu_actions"},H7=["target","href"];function O7(e,t,s,u,o,i){var E,q,j,N,W,le,B,J,me;const m=H,f=p("image-uploader"),h=p("UploadFilled"),g=O,k=ye,b=p("verified-sign"),w=p("UserBadge"),S=p("router-link"),C=p("FollowAction"),v=p("NotificationAddedIcon"),$=p("AddNotificationIcon"),T=p("MoreFilled"),V=Je,F=Qe,L=Xe,A=p("add-user-form"),D=St,U=ee("loading");return Y((n(),c("div",S7,[l("div",{style:re({backgroundImage:`url('${i.user_profile.cover_photo||""}')`}),class:x(["object_cover",{no_cover:!i.user_profile.cover_photo}])},[i.isOwnProfile||e.hasPermission("super_admin")?(n(),c("div",V7,[a(f,{additionalData:{resize:!0,max_width:1500},onUploaded:i.handleCoverPhotoUpload},{default:r(()=>[a(m,{title:e.$t("Recommended Size: 1200 x 375px"),size:"small",plain:"",type:"primary"},{default:r(()=>[M(d(i.getCoverPhotoButtonText),1)]),_:1},8,["title"])]),_:1},8,["onUploaded"]),i.user_profile.cover_photo?(n(),y(m,{key:0,class:"fcom_mt_10",size:"small",plain:"",type:"danger",onClick:z(i.removeCoverPhoto,["prevent"])},{default:r(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)],6),l("div",M7,[l("div",T7,[l("img",{alt:e.$t("Placeholder Photo"),src:i.user_profile.avatar||e.appVars.assets_url+"/images/placeholder.png"},null,8,L7),i.isOwnProfile||e.hasPermission("super_admin")?(n(),y(k,{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(g,{class:"object_avatar_upload"},{default:r(()=>[a(h)]),_:1})],8,P7)]),default:r(()=>[l("div",F7,[a(f,{additionalData:{resize:!0,max_width:200},onUploaded:i.handlePhotoUpload},{trigger:r(()=>[a(m,{size:"small",text:"",class:"fcom_avatar_action_btn"},{default:r(()=>[M(d(e.$t("Upload")),1)]),_:1})]),_:1},8,["onUploaded"]),i.user_profile.has_custom_avatar?(n(),y(m,{key:0,size:"small",text:"",type:"danger",class:"fcom_avatar_action_btn",onClick:i.removeAvatar},{default:r(()=>[M(d(e.$t("Remove")),1)]),_:1},8,["onClick"])):_("",!0)])]),_:1},512)):_("",!0),i.level?(n(),c("div",I7,[l("span",null,d(i.level),1)])):_("",!0)]),l("div",E7,[l("h3",null,[M(d((E=i.user_profile)==null?void 0:E.display_name)+" ",1),(q=i.user_profile)!=null&&q.is_verified?(n(),y(b,{key:0})):_("",!0),a(w,{profile:i.user_profile},null,8,["profile"])]),l("p",U7,"@"+d((j=i.user_profile)==null?void 0:j.username),1),e.hasFeature("followers_module")?(n(),c("div",A7,[((N=i.user_profile)==null?void 0:N.followings_count)!=null?(n(),y(S,{key:0,to:{name:"user_followings",params:{username:i.user_profile.username}}},{default:r(()=>[l("span",null,d(i.user_profile.followings_count),1),M(" "+d(e.$t("Following")),1)]),_:1},8,["to"])):_("",!0),((W=i.user_profile)==null?void 0:W.followers_count)!=null?(n(),y(S,{key:1,to:{name:"user_followers",params:{username:i.user_profile.username}}},{default:r(()=>[l("span",null,d(i.user_profile.followers_count),1),M(" "+d(e.$t("Followers")),1)]),_:1},8,["to"])):_("",!0)])):_("",!0)])]),l("div",B7,[(B=(le=s.profile)==null?void 0:le.profile_navs)!=null&&B.length?(n(),c("ul",D7,[(n(!0),c(P,null,R(s.profile.profile_navs,Q=>(n(),c("li",{class:x(Q.wrapper_class??"")},[Q.route?(n(),y(S,{key:0,class:x(Q.css_class??""),to:Q.route},{default:r(()=>[Q.svg_icon?(n(),y(g,{key:0,innerHTML:Q.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(Q.title),1)]),_:2},1032,["class","to"])):(n(),c("a",{key:1,href:Q.url,class:x(Q.css_class??""),target:Q.is_external?"_blank":"_self"},[Q.svg_icon?(n(),y(g,{key:0,innerHTML:Q.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(Q.title),1)],10,R7))],2))),256))])):_("",!0),i.showActions?(n(),c("div",x7,[(me=(J=s.profile)==null?void 0:J.profile_nav_actions)!=null&&me.length?(n(!0),c(P,{key:0},R(s.profile.profile_nav_actions,Q=>(n(),c("a",{class:x(Q.css_class),target:Q.is_external?"_blank":"_self",href:Q.url},[Q.svg_icon?(n(),y(g,{key:0,innerHTML:Q.svg_icon},null,8,["innerHTML"])):_("",!0),l("span",null,d(Q.title),1)],10,H7))),256)):_("",!0),i.showFollowAction||i.showOtherActions?(n(),c(P,{key:1},[i.showFollowAction?(n(),c(P,{key:0},[s.profile?(n(),y(C,{key:0,profile:s.profile,onRefetch:t[0]||(t[0]=Q=>e.$emit("refetch"))},null,8,["profile"])):_("",!0),i.isFollowing?(n(),y(m,{key:1,class:"fcom_secondary_button icon_button",title:i.getTitle,loading:o.updating,disabled:o.updating,onClick:i.toggleEmailNotification},{default:r(()=>[i.isNotificationOn?(n(),y(g,{key:0},{default:r(()=>[a(v)]),_:1})):(n(),y(g,{key:1},{default:r(()=>[a($)]),_:1}))]),_:1},8,["title","loading","disabled","onClick"])):_("",!0)],64)):_("",!0),i.showBlock||i.showOtherActions?(n(),y(L,{key:1,"popper-class":"fcom_pop_buttons",trigger:"click"},{dropdown:r(()=>[a(F,null,{default:r(()=>[i.showBlock?(n(),y(V,{key:0,onClick:t[1]||(t[1]=Q=>i.confirmAndBlock())},{default:r(()=>[a(m,{"aria-label":e.$t("Block User"),class:"fcom_dot_menu edit_action",size:"small",text:"",type:"danger"},{default:r(()=>[M(d(e.$t("Block User")),1)]),_:1},8,["aria-label"])]),_:1})):_("",!0),i.showOtherActions?(n(),y(V,{key:1,onClick:t[2]||(t[2]=Q=>i.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(()=>[M(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(g,null,{default:r(()=>[a(T)]),_:1})]),_:1})]),_:1})):_("",!0)],64)):_("",!0)])):_("",!0)]),a(D,{modelValue:o.isAddUserOpen,"onUpdate:modelValue":t[3]||(t[3]=Q=>o.isAddUserOpen=Q),"close-on-click-modal":!0,"before-close":i.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(A,{ref:"addUserForm",onCompleted:i.userAdded,user_profile:i.user_profile},null,8,["onCompleted","user_profile"])]),_:1},8,["modelValue","before-close","size"])])),[[U,o.updating]])}const j7=I($7,[["render",O7]]),N7={name:"ProfileAbout",components:{SocialLinks:Rt},props:["profile","isOwn"]},z7={class:"app_side_widget"},q7={class:"widget_header"},G7={key:0,class:"widget_actions"},Y7={key:0,class:"widget_body"},W7=["innerHTML"],Z7={key:1,style:{"text-align":"center"}},K7=["title"],J7=["title"];function Q7(e,t,s,u,o,i){const m=p("EditPen"),f=O,h=H,g=p("SocialLinks"),k=Z;return n(),c("div",z7,[l("div",q7,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),c("div",G7,[a(h,{"aria-label":"Edit Your Profile",onClick:t[0]||(t[0]=b=>e.$router.push({name:"update_profile",params:{username:s.profile.username}})),text:""},{default:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1})])):_("",!0)]),s.profile?(n(),c("div",Y7,[s.profile.short_description_rendered?(n(),c("div",{key:0,class:"space_description feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,W7)):s.isOwn?(n(),c("div",Z7,[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:s.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:s.profile.created_at,class:"meta_line"},d(e.$t("Joined: %s",e.humanDateDiff(s.profile.created_at))),9,K7),s.profile.last_activity?(n(),c("div",{key:2,title:s.profile.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),9,J7)):_("",!0),a(g,{xprofile:s.profile,isOwn:s.isOwn},null,8,["xprofile","isOwn"])])):(n(),y(k,{key:1,animated:!0}))])}const Oo=I(N7,[["render",Q7]]),X7={name:"FeedProfile",props:["username"],components:{NotFoundResult:Do,SpaceMenu:Eo,Layout:$e,AppLayout:Me,UserHeader:j7,ProfileAbout:Oo,RecentActivities:Gt},setup(){return{userStore:De()}},data(){return{defaultRoute:this.appVars.default_profile_tab,notFound:!1}},computed:{profile(){return this.userStore.getProfile(this.username)},loading(){return this.userStore.isLoading(this.username)},isOwn(){return this.profile&&this.profile.user_id==this.auth.user_id},showWidget(){var s;const{disable_sidebar:e}=this.$route.meta||{},t=((s=this.profile)==null?void 0:s.is_restricted)??!1;return!e&&!this.notFound&&!t}},watch:{username(){this.notFound=!1,this.getProfile()}},methods:{async getProfile(e=!1){this.notFound=!1;try{const t=await this.userStore.fetchProfile(this.username,e);this.changeTitle(t==null?void 0:t.display_name),(t==null?void 0:t.user_id)==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score)}catch(t){if(this.username==="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}t.xhr_status===404?(this.notFound=!0,this.changeTitle(this.$t("Profile Not Found"))):this.$handleError(t)}},approveUser(){this.loading=!0,this.$patch("members/"+this.profile.user_id,{status:"active"}).then(e=>{this.$notify.success(e.message),this.profile.status="active",this.getProfile(!0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){if(this.username=="__me__"&&this.auth.username){let s=this.$route.params;s.username=this.auth.username,this.$router.push({name:this.$route.name,params:s,query:{signed:Date.now()}});return}this.getProfile();const t={about:"user_profile",posts:"user_profile_feeds",spaces:"user_spaces",comments:"user_comments",courses:"user_courses"}[this.defaultRoute||""];t&&this.$route.name==="user_profile"&&t!==this.$route.name&&this.$router.replace({name:t,params:{username:this.username}})}},e9={key:0},t9={key:1},s9={class:"edit_profile"},o9={class:"fcom_profile_box"},i9={key:1,class:"profile_holder"},n9={key:2},l9={class:"fcom_main_side_wrap"},a9={class:"widget_recent_activities"};function r9(e,t,s,u,o,i){const m=p("router-link"),f=ls,h=as,g=H,k=O,b=p("EditPen"),w=p("user-header"),S=p("not-found-result"),C=p("router-view"),v=Z,$=Le,T=p("ProfileAbout"),V=p("RecentActivities"),F=et,L=qe,A=p("layout"),D=p("app-layout");return n(),y(D,{wrapper_class:"fcom_single_layout fcom_member_profile fcom_max_layout"},{default:r(()=>[a(A,{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(()=>[M(d(e.$t("Members")),1)]),_:1})]),_:1}),i.profile?(n(),y(f,{key:0},{default:r(()=>[i.isOwn?(n(),c("span",e9,d(e.$t("My Profile")),1)):(n(),c("span",t9,d(i.profile.display_name),1))]),_:1})):_("",!0)]),_:1})]),actions:r(()=>[i.profile&&e.hasPermission("super_admin")&&i.profile.status!="active"?(n(),c(P,{key:0},[i.profile.status?(n(),c(P,{key:0},[l("span",null,d(e.$labelize(i.profile.status)),1),a(g,{type:"success",onClick:t[0]||(t[0]=U=>e.$confirm(e.$t("Are you sure you want to approve this user?"),e.$t("Warning"),{type:"warning"}).then(()=>{i.approveUser()}))},{default:r(()=>[M(d(e.$t("Approve Account")),1)]),_:1})],64)):(n(),y(g,{key:1,disabled:!0},{default:r(()=>[M(d(e.$t("Self Deactivated Account")),1)]),_:1}))],64)):_("",!0),i.profile&&(i.isOwn||e.hasPermission("super_admin"))?(n(),c(P,{key:1},[a(m,{to:{name:"user_notification_settings",params:{username:i.profile.username}},class:"el-button el-button--text fcom_secondary_button"},{default:r(()=>[a(k,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"?(n(),y(g,{key:0,onClick:t[1]||(t[1]=U=>e.$router.push({name:"update_profile",params:{username:i.profile.username}})),class:"fcom_primary_button edit_profile_button"},{default:r(()=>[a(k,null,{default:r(()=>[a(b)]),_:1}),l("span",s9,d(e.$t("Edit Profile")),1)]),_:1})):_("",!0)],64)):_("",!0)]),default:r(()=>[o.notFound?_("",!0):(n(),y(w,{key:0,username:s.username,isOwn:i.isOwn,profile:i.profile,onRefetch:i.getProfile},null,8,["username","isOwn","profile","onRefetch"])),a(L,{class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a($,{class:"fcom_main"},{default:r(()=>[l("div",o9,[o.notFound?(n(),y(S,{key:0,title:e.$t("Profile Not Found"),message:e.$t("The user profile you are looking for does not exist or has been removed.")},{actions:r(()=>[e.auth.user_id?(n(),y(g,{key:0,onClick:t[2]||(t[2]=U=>e.$router.push({name:"all_members"})),class:"el-button fcom_primary_button"},{default:r(()=>[M(d(e.$t("Browse Members")),1)]),_:1})):_("",!0),a(g,{onClick:t[3]||(t[3]=U=>e.$router.push({name:"all_feeds"})),class:"el-button fcom_secondary_button"},{default:r(()=>[M(d(e.$t("Go to Home")),1)]),_:1})]),_:1},8,["title","message"])):i.profile?(n(),c("div",i9,[a(C,{isOwn:i.isOwn,username:s.username,profile:i.profile,onRefetch:i.getProfile},null,8,["isOwn","username","profile","onRefetch"])])):i.loading?(n(),c("div",n9,[a(v,{rows:10,animated:!0})])):_("",!0)])]),_:1}),i.showWidget?(n(),y(F,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",l9,[l("div",a9,[e.$route.name!=="user_profile"?(n(),y(T,{key:0,isOwn:i.isOwn,profile:i.profile},null,8,["isOwn","profile"])):i.profile?(n(),y(V,{key:1,widget_title:e.$t("Recent Activities"),context:{user_id:i.profile.user_id}},null,8,["widget_title","context"])):_("",!0)])])]),_:1})):_("",!0)]),_:1})]),_:1})]),_:1})}const c9=I(X7,[["render",r9]]),d9={name:"LockedProfile"},u9={class:"space_lock_box"},_9={class:"lock_header"},m9={class:"lock_desc"},h9=["href"];function f9(e,t,s,u,o,i){const m=p("Lock"),f=O;return n(),c("div",u9,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("h3",_9,d(e.$t("This profile is private")),1),l("p",m9,d(e.$t("You do not have permission to view this profile's content.")),1),!e.auth.user_id&&e.appVars.allow_signup?(n(),c("a",{key:0,href:e.getCurrentAuthUrl(),class:"el-button fcom_primary_button"},d(e.$t("Login / Signup")),9,h9)):_("",!0)])}const vt=I(d9,[["render",f9]]),p9={name:"ProfileFeeds",components:{AllFeeds:yt,ErrorIcon:uo,LockedProfile:vt},props:["profile","isOwn","username"],emits:["refetch"],methods:{openScheduledPosts(){this.$router.push({name:"user_scheduled_posts"})}}},g9={key:0,class:"fcom_feed_report_wrap"},y9={class:"fcom_feed_report_content"},v9={class:"fcom_feed_report_action"};function b9(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("ErrorIcon"),h=H,g=p("all-feeds");return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c(P,{key:1},[s.profile.scheduled_posts_count?(n(),c("div",g9,[l("div",y9,[a(f),l("span",null,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)]),l("div",v9,[a(h,{onClick:t[0]||(t[0]=k=>i.openScheduledPosts())},{default:r(()=>[M(d(e.$t("View Posts")),1)]),_:1})])])):_("",!0),a(g,{feed_name:"profile_feed",require_space_selection:e.appVars.features.disable_global_posts,user_id:s.profile.user_id,hide_create_form:s.profile.user_id!=e.auth.user_id},null,8,["require_space_selection","user_id","hide_create_form"])],64))}const k9=I(p9,[["render",b9]]),w9={name:"ScheduledPosts",components:{Feed:nt,Pagination:Ve,EditFeed:hs,AlarmClock:hi},props:["profile","isOwn","username"],emits:["refetch"],data(){return{loading:!1,saving:!1,scheduleModalVisible:!1,popoverVisible:null,scheduleForm:this.initScheduleForm(),feeds:[],isEdit:!1,editingFeed:null,pagination:{page:1,per_page:10,total:0,last_page:0}}},computed:{isPostCount(){return this.profile.scheduled_posts_count},isPopoverVisible(){return e=>this.popoverVisible===e.id},isDateDisabled(){return e=>e<new Date().setHours(0,0,0,0)},getStartTime(){if(!this.scheduleForm.date||!this.isToday(this.scheduleForm.date))return"00:00";const t=this.dayjs().add(30,"minute");if(!this.isToday(t.toDate()))return"23:50";const s=t.format("HH");let u=parseInt(t.format("mm"),10);return u=Math.ceil(u/10)*10,u===60?this.dayjs(t).add(1,"hour").format("HH")+":00":s+":"+(u<10?"0":"")+u}},methods:{initScheduleForm(){return{id:null,date:"",time:""}},getScheduledTime(e){return this.$t("%1$s at %2$s",this.formattedDate(e),this.formattedTime(e))},getSpaceRoute(e){return{name:"space_feeds",params:{space:e}}},cancelReschedule(){this.scheduleModalVisible=!1},initReschedule(e){this.scheduleModalVisible=!0,this.scheduleForm.id=e.id,this.scheduleForm.date=this.dayjs(e.scheduled_at).format("YYYY-MM-DD"),this.scheduleForm.time=this.dayjs(e.scheduled_at).format(this.siteTimeFormat)},togglePopover(e){this.popoverVisible===e.id?this.popoverVisible=null:this.popoverVisible=e.id},hidePopover(e){this.popoverVisible===e.id&&(this.popoverVisible=null)},updateFeed(e){const t=this.feeds.findIndex(s=>s.id===e.id);t!==-1&&(this.feeds[t]=e),this.editingFeed=null},removeFeed(e){this.feeds=this.feeds.filter(t=>t.id!==e)},editItem(e){this.popoverVisible=!1,this.editingFeed=e,this.isEdit=!0},deleteItem(e){this.popoverVisible=!1,this.$confirm(this.$t("Are you sure you want to delete this feed?"),this.$t("Warning"),{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.saving=!0,this.$del("feeds/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(this.$t("Feed deleted successfully"))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})})},copyFeedLink(e){this.popoverVisible=!1,this.$toClipboard(e.permalink)},publishNow(e){this.saving=!0,this.$post("scheduled-posts/publish/"+e.id).then(t=>{this.removeFeed(e.id),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},reschedulePost(){this.saving=!0;const e=`${this.scheduleForm.date} ${this.convertTo24Hour(this.scheduleForm.time)}:00`;this.$put("scheduled-posts/"+this.scheduleForm.id,{scheduled_at:e}).then(t=>{this.scheduleModalVisible=!1,this.scheduleForm=this.initScheduleForm(),this.updateFeed(t.feed),this.$notify.success(t.message)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})},fetchFeeds(){this.loading=!0,this.$get("scheduled-posts",{page:this.pagination.page,per_page:this.pagination.per_page,user_id:this.profile.user_id}).then(e=>{this.feeds=e.feeds.data,this.pagination.total=e.feeds.total,this.pagination.last_page=e.feeds.last_page}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.changeTitle(this.$t("Scheduled Posts")),(this.isAdmin()||this.auth.user_id==this.profile.user_id)&&this.fetchFeeds()}},C9={class:"scheduled_posts_header"},$9={class:"fcom_scheduled_posts_title"},S9={key:0},V9={key:1},M9={key:1,class:"fcom_feed_style_timeline fcom_scheduled_posts"},T9={class:"all_feeds_holder"},L9={class:"actions_items"},P9=["onClick"],F9=["onClick"],I9=["onClick"],E9={class:"feed_user"},U9={class:"feed_user_name"},A9={class:"feed_meta_info"},B9=["title","href"],D9={key:0},R9={class:"post_actions"},x9={key:2,class:"feed_outer"},H9={class:"feed"},O9={style:{"text-align":"center"},class:"feed_body not_found"},j9={class:"dialog_header"},N9={class:"dialog_left schedule_header_left"},z9={class:"dialog_body"},q9={class:"dialog_footer"};function G9(e,t,s,u,o,i){const m=p("AlarmClock"),f=O,h=Z,g=p("MoreFilled"),k=H,b=ye,w=p("UserAvatar"),S=p("UserRouteLink"),C=p("router-link"),v=p("feed"),$=p("edit-feed"),T=Ke,V=ue,F=Ds,L=_e,A=we,D=p("pagination");return n(),c(P,null,[l("div",C9,[a(f,null,{default:r(()=>[a(m)]),_:1}),l("div",$9,[l("h3",null,d(e.$t("Scheduled Posts")),1),i.isPostCount?(n(),c("p",S9,d(e.$t("You currently have %s scheduled posts to be published",s.profile.scheduled_posts_count)),1)):(n(),c("p",V9,d(e.$t("You have no scheduled posts to be published")),1))])]),o.loading?(n(),y(h,{key:0,rows:5,animated:!0})):o.feeds.length?(n(),c("div",M9,[l("div",T9,[(n(!0),c(P,null,R(o.feeds,U=>(n(),c("div",{key:U.id,class:"feed_outer"},[a(v,{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:i.isPopoverVisible(U),teleported:!1,"popper-class":"fcom_menu_below_nav",onHide:E=>i.hidePopover(U)},{reference:r(()=>[a(k,{"aria-label":e.$t("View Post actions"),class:"fcom_dot_menu",size:"small",text:"",onClick:E=>i.togglePopover(U)},{default:r(()=>[a(f,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label","onClick"])]),default:r(()=>[l("ul",L9,[l("li",{onClick:E=>i.copyFeedLink(U)},d(e.$t("Copy Link")),9,P9),e.canEditFeed(U)?(n(),c("li",{key:0,onClick:E=>i.editItem(U)},d(e.$t("Edit")),9,F9)):_("",!0),e.canDeleteFeed(U)?(n(),c("li",{key:1,onClick:E=>i.deleteItem(U)},d(e.$t("Delete")),9,I9)):_("",!0)])]),_:2},1032,["visible","onHide"])]),after_feed_header:r(()=>[l("div",E9,[a(w,{with_level:!1,xprofile:s.profile},null,8,["xprofile"]),l("div",null,[l("div",U9,[a(S,{show_badge:!0,xprofile:s.profile},null,8,["xprofile"])]),l("div",A9,[l("a",{title:U.created_at,onClick:t[0]||(t[0]=(...E)=>e.gotoFeed&&e.gotoFeed(...E)),href:U.permalink,class:"feed_timestamp"},d(i.getScheduledTime(U.scheduled_at)),9,B9),U.space?(n(),c("span",D9,[a(C,{to:i.getSpaceRoute(U.space.slug),class:"feed_timestamp"},{default:r(()=>[M(d(e.$t("Posted in %s",e.getExcerpt(U.space.title,30))),1)]),_:2},1032,["to"])])):_("",!0)])])])]),after_feed_footer:r(()=>[l("div",R9,[a(k,{class:"fcom_secondary_button",onClick:E=>i.initReschedule(U),disabled:o.saving},{default:r(()=>[M(d(e.$t("Reschedule Post")),1)]),_:1},8,["onClick","disabled"]),a(k,{class:"fcom_secondary_button",onClick:E=>i.publishNow(U),disabled:o.saving},{default:r(()=>[M(d(e.$t("Publish Now")),1)]),_:1},8,["onClick","disabled"])])]),_:2},1032,["feed"])]))),128)),o.isEdit&&o.editingFeed?(n(),y($,{key:0,feedSlug:o.editingFeed.slug,dialogVisible:o.isEdit,onUpdated:i.updateFeed,hide_create_form:!1,onClose:t[1]||(t[1]=U=>o.isEdit=!1)},null,8,["feedSlug","dialogVisible","onUpdated"])):_("",!0)])])):(n(),c("div",x9,[l("div",H9,[l("div",O9,[l("p",null,d(e.$t("No scheduled posts found!")),1)])])])),a(A,{modelValue:o.scheduleModalVisible,"onUpdate:modelValue":t[4]||(t[4]=U=>o.scheduleModalVisible=U),width:e.modalWidth,"modal-class":"fcom_common_dialog","append-to-body":!0,"close-on-click-modal":!1,onClose:i.cancelReschedule},{header:r(()=>[l("div",j9,[l("div",N9,[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",q9,[a(k,{class:"fcom_secondary_button",disabled:o.saving,onClick:i.cancelReschedule},{default:r(()=>[M(d(e.$t("Cancel")),1)]),_:1},8,["disabled","onClick"]),a(k,{class:"fcom_primary_button",disabled:o.saving,onClick:i.reschedulePost},{default:r(()=>[M(d(e.$t("Reschedule")),1)]),_:1},8,["disabled","onClick"])])]),default:r(()=>[l("div",z9,[a(L,{"label-position":"top",class:"fcom_schedule_form"},{default:r(()=>[a(V,{label:e.$t("Date")},{default:r(()=>[a(T,{modelValue:o.scheduleForm.date,"onUpdate:modelValue":t[2]||(t[2]=U=>o.scheduleForm.date=U),type:"date","value-format":"YYYY-MM-DD",format:e.siteDateFormat,placeholder:e.$t("Select Date"),"disabled-date":i.isDateDisabled},null,8,["modelValue","format","placeholder","disabled-date"])]),_:1},8,["label"]),a(V,{label:e.$t("Time")},{default:r(()=>[a(F,{modelValue:o.scheduleForm.time,"onUpdate:modelValue":t[3]||(t[3]=U=>o.scheduleForm.time=U),disabled:!o.scheduleForm.date,style:{width:"210px"},step:"00:10",format:e.siteTimeFormat,start:i.getStartTime,end:"23:59",placeholder:e.$t("Select Time")},null,8,["modelValue","disabled","format","start","placeholder"])]),_:1},8,["label"])]),_:1})])]),_:1},8,["modelValue","width","onClose"]),a(D,{pagination:o.pagination,onFetch:i.fetchFeeds},null,8,["pagination","onFetch"])],64)}const Y9=I(w9,[["render",G9]]),W9={name:"UserSpaces",props:["profile"],components:{Calendar:fi,Baseball:pi,GroupIcon:Wt,GlobIcon:xo,LockedProfile:vt},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()}},Z9={key:1,class:"user_spaces"},K9={class:"fcom_box_card_list"},J9=["onClick"],Q9=["src"],X9=["src"],eS={key:2,class:"fcom_no_image"},tS={class:"fcom_box_card_info"},sS={class:"fcom_box_card_name"},oS={class:"fcom_box_card_details"},iS={class:"details_item"},nS={key:0,class:"details_item"},lS={class:"fcom_box_card_action"},aS=["onClick"],rS={key:0,class:"loading"},cS={key:1},dS={class:"no_members"},uS={key:2,class:"no_members"};function _S(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("router-link"),h=p("MoreFilled"),g=O,k=H,b=Je,w=Qe,S=Xe,C=p("GlobIcon"),v=p("Lock"),$=p("GroupIcon"),T=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",Z9,[l("div",K9,[(n(!0),c(P,null,R(o.communities,V=>{var F;return n(),c("div",{key:V.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:L=>i.goToSpaceFeeds(V.slug)},[(F=V.settings)!=null&&F.og_image?(n(),c("img",{key:0,src:V.settings.og_image,alt:""},null,8,Q9)):V.cover_photo?(n(),c("img",{key:1,src:V.cover_photo,alt:""},null,8,X9)):(n(),c("div",eS))],8,J9),l("div",tS,[l("div",sS,[a(f,{class:"user_route",to:{name:"space_feeds",params:{space:V.slug}}},{default:r(()=>[M(d(i.getExcerpt(V.title,30)),1)]),_:2},1032,["to"]),e.isAdmin()?(n(),y(S,{key:0,trigger:"click"},{dropdown:r(()=>[a(w,null,{default:r(()=>[a(b,{onClick:L=>i.removeMembership(V.slug)},{default:r(()=>[M(d(e.$t("Remove from space")),1)]),_:1},8,["onClick"])]),_:2},1024)]),default:r(()=>[a(k,{"aria-label":e.$t("View actions"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",oS,[l("div",iS,[V.privacy==="public"?(n(),y(g,{key:0},{default:r(()=>[a(C)]),_:1})):(n(),y(g,{key:1},{default:r(()=>[a(v)]),_:1})),l("span",null,d(V.privacy==="public"?e.$t("Public"):e.$t("Private")),1)]),V.members_count?(n(),c("div",nS,[a(g,null,{default:r(()=>[a($)]),_:1}),l("span",null,d(e.$_n("%s Member","%s Members",e.$formatNumber(V.members_count))),1)])):_("",!0)]),l("div",lS,[l("button",{class:"fcom_card_button",onClick:L=>i.goToSpaceFeeds(V.slug)},d(i.getBtnLevel(V.type)),9,aS)])])])}),128))]),o.loading?(n(),c("div",rS,[a(T,{class:"white_loaded",rows:3,animated:!0}),a(T,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?!o.loading&&!o.communities.length?(n(),c("div",uS,d(e.$t("No Spaces found.")),1)):_("",!0):(n(),c("div",cS,[l("div",dS,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const mS=I(W9,[["render",_S]]),hS={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})}}},fS={style:{"margin-top":"30px"},class:"fcom_account_deactivation about_wrap"},pS={class:"about_header"},gS={class:"about_body fcom_mt_10"},yS={class:"fcom_mt_20"};function vS(e,t,s,u,o,i){const m=H;return n(),c("div",fS,[l("div",pS,[l("h3",null,d(e.$t("Account Deactivation")),1)]),l("div",gS,[o.selection=="init"?(n(),c(P,{key:0},[l("p",null,d(e.$t("If you no longer wish to keep your community account, click button below to deactivate your account.")),1),a(m,{onClick:t[0]||(t[0]=f=>o.selection="deactivate"),class:"fcom_secondary_button fcom_mt_20"},{default:r(()=>[M(d(e.$t("Continue to Deactivate Account")),1)]),_:1})],64)):o.selection=="deactivate"?(n(),c(P,{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",yS,[a(m,{onClick:t[1]||(t[1]=f=>o.selection="init"),class:"fcom_secondary_button"},{default:r(()=>[M(d(e.$t("Go Back")),1)]),_:1}),a(m,{onClick:t[2]||(t[2]=f=>i.deactivateAccount()),type:"danger"},{default:r(()=>[M(d(e.$t("Confirm Account Deactivation")),1)]),_:1})])],64)):_("",!0)])])}const bS=I(hS,[["render",vS]]),kS={name:"UserProfileUpdate",props:["isOwn","profile","username"],emits:["refetch"],components:{SlugInput:Ot,MarkdownEditor:Et,AccountDeactivation:bS,InfoFilled:Ft},setup(){const e=De(),t=ce();return{userStore:e,cacheStore:t}},data(){return{updating:!1,loading:!1,notification_settings:{email_on_comment:!1},profileData:{},fcom_is_dirty:!1,fcom_dirty_ready:!1,passwordData:{current_password:"",new_password:"",confirm_password:""},changingPassword:!1}},watch:{profile:{handler(e){e&&(this.fcom_dirty_ready=!1,this.profileData={username:e.username,display_name:e.display_name,first_name:e.first_name,last_name:e.last_name,email:e.email,website:e.website,headline:e.headline||"",short_description:e.short_description,user_id:e.user_id,is_verified:e.is_verified,is_flagged:e.is_flagged||"no",social_links:e.social_links||{},badge_slugs:e.badge_slugs,status:e.status,custom_fields:this.getCustomFieldValues(e)},this.$nextTick(()=>{this.fcom_is_dirty=!1,this.fcom_dirty_ready=!0}))},immediate:!0},profileData:{handler(){this.fcom_dirty_ready&&(this.fcom_is_dirty=!0)},deep:!0}},computed:{customFieldGroups(){return this.profile.custom_field_groups||[]},canFlagMember(){return this.has_pro&&this.appVars.moderationConfig&&this.appVars.moderationConfig.is_enabled==="yes"}},methods:{async updateProfile(){this.updating=!0;try{const e=await this.$post(`profile/${this.username}`,{data:this.profileData});if(e.redirect_url){window.location.href=e.redirect_url;return}const t=e.profile;this.username!==t.username&&(delete this.userStore.profilesByUsername[this.username],this.cacheStore.invalidate(`user-profile:${this.username}`)),this.userStore.profilesByUsername[t.username]=t,this.cacheStore.invalidate(`user-profile:${t.username}`),this.fcom_is_dirty=!1,this.$notify.success(this.$t("Profile updated successfully")),t.user_id==this.auth.user_id&&(this.auth.compilation_score=t.compilation_score),this.username!==t.username&&this.$router.push({name:"update_profile",params:{username:t.username}}),this.$emit("refetch")}catch(e){this.$handleError(e)}finally{this.updating=!1}},async changePassword(){var e;if(!this.passwordData.current_password||!this.passwordData.new_password){this.$notify.error(this.$t("Please fill in all password fields"));return}if(this.passwordData.new_password!==this.passwordData.confirm_password){this.$notify.error(this.$t("New password and confirmation do not match"));return}if(this.passwordData.current_password===this.passwordData.new_password){this.$notify.error(this.$t("New password must be different from your current password"));return}this.changingPassword=!0;try{const t=await this.$post(`profile/${this.username}/change-password`,{data:this.passwordData});t.rest_nonce&&((e=window.fluentComAdmin)!=null&&e.rest)&&(window.fluentComAdmin.rest.nonce=t.rest_nonce),t.ajax_nonce&&window.fluentComAdmin&&(window.fluentComAdmin.ajax_nonce=t.ajax_nonce),this.$notify.success(t.message||this.$t("Password changed successfully")),this.passwordData={current_password:"",new_password:"",confirm_password:""}}catch(t){this.$handleError(t)}finally{this.changingPassword=!1}},isEmpty:cs,getCustomFieldValues(e){const t={},s=e.custom_field_groups||[];for(const u of s)for(const o of u.fields||[])o.slug&&(t[o.slug]=o.value!==void 0?o.value:"");return t}},async mounted(){await this.userStore.fetchProfile(this.username,!0)}},wS={key:0,class:"fcom_sub_group fcom_additional_info"},CS={class:"fcom_sub_group_header"},$S={key:0},SS={class:"fcom_sub_group_content"},VS={key:0,class:"fcom_sub_group"},MS={class:"fcom_sub_group_header"},TS={class:"fcom_sub_group_content"},LS={key:1,class:"fcom_mb_20"},PS={key:0,class:"fcom_sub_group"},FS={class:"fcom_sub_group_header"},IS={key:0,class:"fcom_help_text"},ES={id:"fcom_flag_member_help"},US={key:2},AS={style:{color:"var(--el-color-danger, red)"},class:"help_msg"},BS={key:3,class:"help_msg"},DS={class:"fcom_sub_group"},RS={class:"fcom_fixed_bottom_overlay"},xS={key:0,class:"fcom_update_profile fcom_change_password"},HS={class:"fcom_sub_group"},OS={class:"fcom_sub_group_header"},jS={class:"fcom_change_password_content"};function NS(e,t,s,u,o,i){const m=te,f=ue,h=ht,g=ft,k=p("InfoFilled"),b=O,w=xe,S=p("markdown-editor"),C=Ke,v=ie,$=ne,T=Re,V=ke,F=fe,L=p("UserBadge"),A=p("slug-input"),D=H,U=_e,E=p("account-deactivation"),q=ee("loading");return n(),c(P,null,[l("div",{class:x([{fcom_is_dirty:o.fcom_is_dirty},"fcom_update_profile"])},[a(U,{onSubmit:t[11]||(t[11]=z(j=>e.doNothing(),["prevent"])),"label-position":"top",modelValue:o.profileData,"onUpdate:modelValue":t[12]||(t[12]=j=>o.profileData=j)},{default:r(()=>[a(g,{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:o.profileData.first_name,"onUpdate:modelValue":t[0]||(t[0]=j=>o.profileData.first_name=j)},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:o.profileData.last_name,"onUpdate:modelValue":t[1]||(t[1]=j=>o.profileData.last_name=j)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(g,{gutter:30},{default:r(()=>[a(h,{xs:24,md:12},{default:r(()=>[a(f,{label:e.$t("Email")},{default:r(()=>[a(m,{disabled:!s.profile.can_change_email,modelValue:o.profileData.email,"onUpdate:modelValue":t[2]||(t[2]=j=>o.profileData.email=j)},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:o.profileData.website,"onUpdate:modelValue":t[3]||(t[3]=j=>o.profileData.website=j)},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1}),a(f,null,{label:r(()=>[M(d(e.$t("Headline"))+" ",1),a(w,{effect:"dark",placement:"top",content:e.$t("A short tagline shown on the members list.")},{default:r(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("A short tagline shown on the members list.")},{default:r(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:r(()=>[a(m,{modelValue:o.profileData.headline,"onUpdate:modelValue":t[4]||(t[4]=j=>o.profileData.headline=j),maxlength:"60","show-word-limit":""},null,8,["modelValue"])]),_:1}),a(f,{class:"fcom_editor_input_wrap",label:e.$t("Short Bio")},{default:r(()=>[a(S,{disable_mention:!0,disable_media:!0,modelValue:o.profileData.short_description,"onUpdate:modelValue":t[5]||(t[5]=j=>o.profileData.short_description=j)},null,8,["modelValue"])]),_:1},8,["label"]),(n(!0),c(P,null,R(i.customFieldGroups,j=>(n(),c(P,{key:j.slug},[j.fields&&j.fields.length?(n(),c("div",wS,[l("div",CS,[l("h5",null,d(j.label),1),j.edit_description?(n(),c("p",$S,d(j.edit_description),1)):_("",!0)]),l("div",SS,[(n(!0),c(P,null,R(j.fields,N=>(n(),y(f,{key:N.slug,label:N.label,required:N.is_required},{default:r(()=>[N.type==="text"?(n(),y(m,{key:0,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="textarea"?(n(),y(m,{key:1,type:"textarea",rows:3,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="number"?(n(),y(m,{key:2,type:"number",modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="date"?(n(),y(C,{key:3,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,type:"date","value-format":"YYYY-MM-DD",placeholder:N.placeholder,style:{width:"100%"}},null,8,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="select"?(n(),y($,{key:4,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder,"value-on-clear":"",clearable:""},{default:r(()=>[(n(!0),c(P,null,R(N.options,W=>(n(),y(v,{key:W,label:W,value:W},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="multiselect"?(n(),y($,{key:5,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder,multiple:!0,clearable:""},{default:r(()=>[(n(!0),c(P,null,R(N.options,(W,le)=>(n(),y(v,{key:le,label:W,value:le},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder"])):N.type==="radio"?(n(),y(V,{key:6,modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W},{default:r(()=>[(n(!0),c(P,null,R(N.options,W=>(n(),y(T,{key:W,value:W},{default:r(()=>[M(d(W),1)]),_:2},1032,["value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):N.type==="url"?(n(),y(m,{key:7,type:"url",modelValue:o.profileData.custom_fields[N.slug],"onUpdate:modelValue":W=>o.profileData.custom_fields[N.slug]=W,placeholder:N.placeholder||"https://"},null,8,["modelValue","onUpdate:modelValue","placeholder"])):_("",!0)]),_:2},1032,["label","required"]))),128))])])):_("",!0)],64))),128)),i.isEmpty(e.appVars.socialLinkProviders)?_("",!0):(n(),c("div",VS,[l("div",MS,[l("h5",null,d(e.$t("Social Links")),1),l("p",null,d(e.$t("Add your social media profile link.")),1)]),l("div",TS,[(n(!0),c(P,null,R(e.appVars.socialLinkProviders,(j,N)=>(n(),y(f,{key:N,label:j.title},{default:r(()=>[a(m,{placeholder:j.placeholder,modelValue:o.profileData.social_links[N],"onUpdate:modelValue":W=>o.profileData.social_links[N]=W},{prepend:r(()=>[a(b,{innerHTML:j.icon_svg},null,8,["innerHTML"]),l("span",null,d(j.domain),1)]),_:2},1032,["placeholder","modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]))),128))])])),s.profile.can_change_username?(n(),c("div",LS,[e.hasPermission("super_admin")?(n(),c("div",PS,[l("div",FS,[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(F,{"true-value":1,"false-value":0,modelValue:o.profileData.is_verified,"onUpdate:modelValue":t[6]||(t[6]=j=>o.profileData.is_verified=j),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Mark this account as verified")),1)]),_:1},8,["modelValue"])]),_:1},8,["label"]),i.canFlagMember?(n(),y(f,{key:0,class:"checkbox_label"},{label:r(()=>[M(d(e.$t("Moderate Posts and Comments"))+" ",1),a(w,{effect:"dark",placement:"top",content:e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:r(()=>[a(b,{class:"fcom_label_tooltip",role:"button",tabindex:"0","aria-label":e.$t("Require all future posts or comments posted by this member to be approved by an admin")},{default:r(()=>[a(k)]),_:1},8,["aria-label"])]),_:1},8,["content"])]),default:r(()=>[a(F,{disabled:s.profile.is_moderator==="yes","aria-describedby":s.profile.is_moderator==="yes"?"fcom_flag_member_help":null,"true-value":"yes","false-value":"no",modelValue:o.profileData.is_flagged,"onUpdate:modelValue":t[7]||(t[7]=j=>o.profileData.is_flagged=j),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Require approval for new posts and comments")),1)]),_:1},8,["disabled","aria-describedby","modelValue"]),s.profile.is_moderator==="yes"?(n(),c("div",IS,[l("p",ES,d(e.$t("Admin or moderator accounts cannot be moderated")),1)])):_("",!0)]),_:1})):_("",!0),e.appVars.user_badges?(n(),y(f,{key:1,label:e.$t("Profile Badges")},{default:r(()=>[a($,{clearable:"",multiple:!0,modelValue:o.profileData.badge_slugs,"onUpdate:modelValue":t[8]||(t[8]=j=>o.profileData.badge_slugs=j),placeholder:e.$t("User Profile Badge")},{default:r(()=>[(n(!0),c(P,null,R(e.appVars.user_badges,j=>(n(),y(v,{key:j.slug,label:j.title,value:j.slug},{default:r(()=>[a(L,{badge:j,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(V,{modelValue:o.profileData.status,"onUpdate:modelValue":t[9]||(t[9]=j=>o.profileData.status=j),class:"fcom_radio_group"},{default:r(()=>[a(T,{value:"active"},{default:r(()=>[M(d(e.$t("Active")),1)]),_:1}),a(T,{value:"pending"},{default:r(()=>[M(d(e.$t("Pending")),1)]),_:1}),a(T,{value:"blocked"},{default:r(()=>[M(d(e.$t("Blocked")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),o.profileData.status?o.profileData.status!="active"?(n(),c("div",BS,[l("p",null,d(e.$t("The user cannot access the portal.")),1)])):_("",!0):(n(),c("div",US,[l("p",AS,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",DS,[a(f,{label:e.$t("Community Account Username")},{default:r(()=>[a(A,{is_inital_inactive:!0,modelValue:o.profileData.username,"onUpdate:modelValue":t[10]||(t[10]=j=>o.profileData.username=j),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",RS,[Y((n(),y(D,{class:"fcom_primary_button",onClick:i.updateProfile,disabled:o.updating},{default:r(()=>[M(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled"])),[[q,o.updating]])])]),_:1})]),_:1},8,["modelValue"])],2),s.profile.username==e.appVars.auth.username&&s.profile.can_change_password?(n(),c("div",xS,[a(U,{onSubmit:t[16]||(t[16]=z(()=>{},["prevent"])),"label-position":"top"},{default:r(()=>[l("div",HS,[l("div",OS,[l("h5",null,d(e.$t("Change Password")),1),l("p",null,d(e.$t("Update the password you use to log in.")),1)]),l("div",jS,[a(f,{label:e.$t("Current Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"current-password",modelValue:o.passwordData.current_password,"onUpdate:modelValue":t[13]||(t[13]=j=>o.passwordData.current_password=j)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("New Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.new_password,"onUpdate:modelValue":t[14]||(t[14]=j=>o.passwordData.new_password=j)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,{label:e.$t("Confirm New Password"),required:""},{default:r(()=>[a(m,{type:"password","show-password":"",autocomplete:"new-password",modelValue:o.passwordData.confirm_password,"onUpdate:modelValue":t[15]||(t[15]=j=>o.passwordData.confirm_password=j)},null,8,["modelValue"])]),_:1},8,["label"]),a(f,null,{default:r(()=>[Y((n(),y(D,{class:"fcom_primary_button",onClick:i.changePassword,disabled:o.changingPassword},{default:r(()=>[M(d(e.$t("Change Password")),1)]),_:1},8,["onClick","disabled"])),[[q,o.changingPassword]])]),_:1})])])]),_:1})])):_("",!0),e.hasFeature("can_deactivate_account")&&s.profile.username==e.appVars.auth.username?(n(),y(E,{key:1,profile:s.profile},null,8,["profile"])):_("",!0)],64)}const zS=I(kS,[["render",NS]]),qS={name:"UserAbout",props:["profile","isOwn"],components:{Timer:Js,CalendarIcon:po,LockedProfile:vt},computed:{hasSocialLinks(){return this.socialLinks.length>0},visibleGroups(){return(this.profile.custom_field_groups||[]).filter(t=>t.fields&&t.fields.some(s=>this.hasFieldValue(s.value)))},socialLinks(){var u,o;let e=(u=this.profile)==null?void 0:u.social_links;e||(e=(o=this.profile.meta)==null?void 0:o.social_links);const t=[];if(this.profile.website&&t.push({title:this.$t("Website"),icon:'<svg viewBox="0 0 40 20" fill="currentColor"><path d="M3.8 10C3.8 6.58 6.58 3.8 10 3.8H18V0H10C4.48 0 0 4.48 0 10C0 15.52 4.48 20 10 20H18V16.2H10C6.58 16.2 3.8 13.42 3.8 10ZM12 12H28V8H12V12ZM30 0H22V3.8H30C33.42 3.8 36.2 6.58 36.2 10C36.2 13.42 33.42 16.2 30 16.2H22V20H30C35.52 20 40 15.52 40 10C40 4.48 35.52 0 30 0Z"></path></svg>',text:this.profile.website,url:this.profile.website}),!e)return t;const s=this.appVars.socialLinkProviders;return Object.entries(s).forEach(([i,m])=>{e[i]&&t.push({title:m.title,icon:m.icon_svg,text:e[i],url:m.domain+e[i]})}),t}},methods:{goToUpdateProfile(){this.$router.push({name:"update_profile",params:{username:this.profile.username}})},hasFieldValue(e){return Array.isArray(e)?e.length>0:e!=null&&e!==""},formatFieldValue(e){return e.type==="multiselect"&&Array.isArray(e.value)&&e.options?e.value.map(t=>e.options[t]||t).join(", "):e.value}}},GS={key:1,class:"about_wrap"},YS={class:"about_header"},WS={key:0,class:"about_body"},ZS=["innerHTML"],KS={key:1},JS={class:"about_items"},QS=["title"],XS=["title"],eV={class:"items_title"},tV={key:0,class:"about_item"},sV={class:"about_item_label"},oV=["href"],iV={key:2,class:"about_items"},nV={key:0,class:"items_title"},lV=["href","title"];function aV(e,t,s,u,o,i){const m=p("LockedProfile"),f=p("EditPen"),h=O,g=H,k=p("CalendarIcon"),b=p("Timer"),w=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",GS,[l("div",YS,[l("h3",null,d(e.$t("About")),1),s.isOwn?(n(),y(g,{key:0,"aria-label":"Edit your profile description",onClick:i.goToUpdateProfile,text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(f)]),_:1})]),_:1},8,["onClick"])):_("",!0)]),s.profile?(n(),c("div",WS,[s.profile.short_description_rendered?(n(),c("div",{key:0,class:"about_description feed_texts feed_md_content",innerHTML:s.profile.short_description_rendered},null,8,ZS)):s.isOwn?(n(),c("div",KS,[a(g,{class:"fcom_plain_button",onClick:t[0]||(t[0]=S=>e.$router.push({name:"update_profile",params:{username:s.profile.username}}))},{default:r(()=>[l("span",null,d("+ "+e.$t("Add your profile description")),1)]),_:1})])):_("",!0),l("div",JS,[s.profile.created_at?(n(),c("div",{key:0,title:s.profile.created_at,class:"about_item"},[a(h,null,{default:r(()=>[a(k)]),_:1}),l("span",null,d(e.$t("Joined %s",e.humanDateDiff(s.profile.created_at))),1)],8,QS)):_("",!0),s.profile.last_activity?(n(),c("div",{key:1,title:s.profile.last_activity,class:"about_item"},[a(h,null,{default:r(()=>[a(b)]),_:1}),M(" "+d(e.$t("Last seen: %s",e.humanDateDiff(s.profile.last_activity))),1)],8,XS)):_("",!0)]),(n(!0),c(P,null,R(i.visibleGroups,S=>(n(),c("div",{key:S.slug,class:"about_items"},[l("div",eV,d(S.label),1),(n(!0),c(P,null,R(S.fields,C=>(n(),c(P,{key:C.slug},[i.hasFieldValue(C.value)?(n(),c("div",tV,[l("span",sV,d(C.label)+":",1),C.type==="url"&&C.value?(n(),c("a",{key:0,href:C.value,target:"_blank",rel:"noopener noreferrer"},d(C.value),9,oV)):(n(),c("span",{key:1,class:x({about_item_multiline:C.type==="textarea"})},d(i.formatFieldValue(C)),3))])):_("",!0)],64))),128))]))),128)),i.hasSocialLinks||s.isOwn?(n(),c("div",iV,[i.hasSocialLinks?(n(),c("div",nV,d(e.$t("Social Links")),1)):_("",!0),(n(!0),c(P,null,R(i.socialLinks,S=>(n(),c("a",{target:"_blank",rel:"noopener noreferrer",href:S.url,key:S.title,title:S.title,class:"about_item"},[a(h,{innerHTML:S.icon},null,8,["innerHTML"]),M(" "+d(S.text),1)],8,lV))),128)),s.isOwn&&!i.hasSocialLinks?(n(),y(g,{key:1,class:"fcom_plain_button",onClick:i.goToUpdateProfile},{default:r(()=>[l("span",null,d("+ "+e.$t("Add social links")),1)]),_:1},8,["onClick"])):_("",!0)])):_("",!0)])):(n(),y(w,{key:1,animated:!0}))]))}const rV=I(qS,[["render",aV]]),cV={name:"UserComments",props:["profile","username","isOwn"],emits:["refetch"],components:{Pagination:Ve,Check:Qs,ImageIcon:us,FeedMdContent:Bt,LockedProfile:vt},data(){return{comments:[],loading:!0,pagination:{page:1,per_page:10,total:0},working:!1,replyingComemnt:null,isReplying:!1,expandedMap:{},canExpandMap:{}}},methods:{fetchComments(){this.loading=!0,this.$get("profile/"+this.username+"/comments",{page:this.pagination.page,per_page:this.pagination.per_page}).then(e=>{this.comments=e.comments.data,this.pagination.total=e.comments.total,this.expandedMap={},this.canExpandMap={},window.scrollTo(0,0)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1,this.$nextTick(()=>{this.checkOverflow()})})},deleteComment(e,t){this.$confirm(this.$t("Are you sure you want to delete this comment and associated data?"),"Warning",{confirmButtonText:this.$t("Delete"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.working=!0,this.$del("feeds/"+e.post_id+"/comments/"+e.id).then(s=>{this.comments.splice(t,1),this.$notify.success(s.message)}).catch(s=>{this.$handleError(s)}).finally(()=>{this.working=!1})})},initCommentReply(e){this.replyingComemnt=e,this.$nextTick(()=>{this.isReplying=!0})},limitCharacters(e,t){return e.slice(0,t)+(e.length>t?"...":"")},getPostRoute(e){var s;let t=(s=e.post)==null?void 0:s.type;return!t||!e.post?{name:"all_feeds"}:t=="text"||t=="article"?{name:"single_feed",params:{feed_slug:e.post.slug},query:{comment_id:e.id}}:t=="course_lesson"&&e.post.space?{name:"view_lesson",params:{course_slug:e.post.space.slug,lesson_slug:e.post.slug},query:{comment_id:e.id}}:{name:"all_feeds",query:{comment_id:e.id,post_id:e.post.id}}},getPostHref(e){return this.$router.resolve(this.getPostRoute(e)).href},canOpenInModal(e){var t,s;return!this.hasFeature("show_post_modal")||((t=e.post)==null?void 0:t.type)!="text"?!1:!!((s=e.post)!=null&&s.permalink)},openPost(e,t){if(!(t.ctrlKey||t.metaKey||t.shiftKey||t.button===1)){if(t.preventDefault(),!this.canOpenInModal(e)){this.$router.push(this.getPostRoute(e));return}this.$eventBus.emit("showFeedModal",{feed:e.post,view:"comments",highlight_comment_id:e.id})}},getPostExcerpt(e){if(!e)return"";let t=e.type;t=="text"&&(t="");let s="";return e.title?s=e.title:s=this.getExcerpt(e.message,50),s+(t?" ("+t+")":"")},contentClass(e){return"comment_text_body"+(this.expandedMap[e]?"":" clamped")},toggleExpand(e){this.expandedMap={...this.expandedMap,[e]:!this.expandedMap[e]}},checkOverflow(){const e=this.$refs.commentBody||[],t=this.comments.filter(u=>u.message_rendered),s={};e.forEach((u,o)=>{var f;const i=(f=u==null?void 0:u.$refs)==null?void 0:f.content,m=t[o];i&&m&&(s[m.id]=i.scrollHeight>i.clientHeight+1)}),this.canExpandMap=s}},mounted(){this.profile.is_restricted||this.fetchComments()}},dV={key:1,class:"white_loaded"},uV={class:"course_comments feed_comments user_comments"},_V={class:"comment_text_head"},mV=["title"],hV={class:"comment_action"},fV={class:"comment_text_head_post"},pV=["href","aria-haspopup","onClick"],gV={class:"comment_text"},yV=["onClick"],vV={key:1,class:"comment_text_body feed_md_content media_only_content"},bV={key:0};function kV(e,t,s,u,o,i){const m=p("LockedProfile"),f=Z,h=p("Delete"),g=O,k=H,b=p("FeedMdContent"),w=p("ImageIcon"),S=p("pagination");return s.profile.is_restricted?(n(),y(m,{key:0})):o.loading?(n(),c("div",dV,[a(f,{row:5})])):(n(),c(P,{key:2},[l("div",uV,[(n(!0),c(P,null,R(o.comments,(C,v)=>(n(),c("div",{key:C.id,class:"fcom_course_comment each_comment"},[t[0]||(t[0]=l("span",{class:"comment_icon"},null,-1)),l("div",_V,[l("div",{title:C.created_at,class:"comment_text_head_time"},d(e.humanDateDiff(C.created_at)),9,mV),l("div",hV,[s.isOwn?(n(),y(k,{key:0,class:"fcom_plain_button",onClick:$=>i.deleteComment(C,v)},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClick"])):_("",!0)])]),l("div",fV,[l("a",{class:"post_link",href:i.getPostHref(C),"aria-haspopup":i.canOpenInModal(C)?"dialog":null,onClick:$=>i.openPost(C,$)},d(i.getPostExcerpt(C.post)),9,pV)]),l("div",gV,[C.message_rendered?(n(),c(P,{key:0},[a(b,{ref_for:!0,ref:"commentBody",class_name:i.contentClass(C.id),content:C.message_rendered},null,8,["class_name","content"]),o.canExpandMap[C.id]?(n(),c("button",{key:0,type:"button",class:"fcom_see_more_btn",onClick:$=>i.toggleExpand(C.id)},d(o.expandedMap[C.id]?e.$t("See less"):e.$t("See more")),9,yV)):_("",!0)],64)):(n(),c("div",vV,[a(w,{class:"fcom_status_img_icon"})]))])]))),128)),o.pagination.total?_("",!0):(n(),c("div",bV,[l("h5",null,d(e.$t("%s did not add any comment to any posts yet",s.profile.display_name)),1)]))]),a(S,{pagination:o.pagination,onFetch:i.fetchComments},null,8,["pagination","onFetch"])],64))}const wV=I(cV,[["render",kV]]),CV={name:"UserCourses",props:["profile","isOwn"],components:{MoreFilled:Xs,GroupIcon:Wt,LockedProfile:vt},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()}},$V={key:1,class:"user_courses"},SV={key:0,class:"fcom_box_card_list"},VV=["onClick"],MV=["src","alt","onError"],TV={key:1,class:"fcom_no_image"},LV={class:"fcom_box_card_info"},PV={class:"fcom_box_card_name"},FV={class:"fcom_box_card_details"},IV={class:"inline_details"},EV={key:0,class:"inline_details"},UV={key:0,class:"fcom_box_card_description"},AV=["innerHTML"],BV={class:"fcom_box_card_action"},DV=["onClick"],RV=["onClick"],xV={key:1,class:"loading"},HV={key:2},OV={class:"no_members"},jV={key:3,class:"fcom_no_items_wrap"},NV={key:0},zV={key:1};function qV(e,t,s,u,o,i){const m=p("LockedProfile"),f=Ue,h=p("router-link"),g=p("MoreFilled"),k=O,b=H,w=Je,S=Qe,C=Xe,v=p("GroupIcon"),$=Z;return s.profile.is_restricted?(n(),y(m,{key:0})):(n(),c("div",$V,[o.courses.length?(n(),c("div",SV,[(n(!0),c(P,null,R(o.courses,T=>(n(),c("div",{key:T.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:V=>i.goToCourse(T.slug)},[T.cover_photo&&!T.coverError?(n(),c("img",{key:0,src:T.cover_photo,alt:T.title,onError:V=>T.coverError=!0},null,40,MV)):(n(),c("div",TV))],8,VV),l("div",LV,[l("div",PV,[a(h,{class:"course_route",to:{name:"view_course",params:{course_slug:T.slug}}},{default:r(()=>[M(d(T.title)+" ",1),T.status=="draft"?(n(),y(f,{key:0,type:"info"},{default:r(()=>[M(d(T.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"]),e.isAdmin()?(n(),y(C,{key:0,trigger:"click"},{dropdown:r(()=>[a(S,null,{default:r(()=>[a(w,{onClick:V=>i.removeMembership(T.slug)},{default:r(()=>[M(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(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["aria-label"])]),_:2},1024)):_("",!0)]),l("div",FV,[l("div",IV,[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?(n(),c("div",EV,[a(k,null,{default:r(()=>[a(v)]),_:1}),M(" "+d(e.$_n("%s student","%s students",e.$formatNumber(T.studentsCount))),1)])):_("",!0)]),T.description?(n(),c("div",UV,d(e.getExcerpt(T.description)),1)):_("",!0),T.custom_html?(n(),c("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:T.custom_html},null,8,AV)):_("",!0),l("div",BV,[T.isEnrolled?(n(),c("button",{key:0,class:"fcom_card_button",onClick:V=>i.goToCourse(T.slug)},d(e.$t("%s Completed",T.progress+"%")),9,DV)):(n(),c("button",{key:1,class:"fcom_card_button",onClick:V=>i.goToCourse(T.slug)},d(e.$t("View Course")),9,RV))])])]))),128))])):_("",!0),o.loading?(n(),c("div",xV,[a($,{class:"white_loaded",rows:3,animated:!0}),a($,{class:"fcom_mt_20 white_loaded",rows:3,animated:!0})])):s.profile.canViewUserSpaces?o.courses.length?_("",!0):(n(),c("div",jV,[l("h3",null,d(e.$t("No courses yet")),1),s.isOwn?(n(),c("p",NV,d(e.$t("Courses you enroll in will appear here.")),1)):(n(),c("p",zV,d(e.$t("This member has not enrolled in any courses yet.")),1))])):(n(),c("div",HV,[l("div",OV,d(e.$t("Sorry, you do not have permission to view this page")),1)]))]))}const GV=I(CV,[["render",qV]]),YV={name:"GroupUsersIcon"},WV={viewBox:"0 0 128 128",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};function ZV(e,t,s,u,o,i){return n(),c("svg",WV,[...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-16s16,7.2,16,16S72.8,82,64,82z"></path><path d="M64,100.8c-14.9,0-29.2,6.2-39.4,17.1l-2.7,2.9l5.8,5.5l2.7-2.9c8.8-9.4,20.7-14.6,33.6-14.6s24.8,5.2,33.6,14.6l2.7,2.9l5.8-5.5l-2.7-2.9C93.2,107.1,78.9,100.8,64,100.8z"></path><path d="M97,47.9v8c9.4,0,18.1,3.8,24.6,10.7l5.8-5.5C119.6,52.7,108.5,47.9,97,47.9z"></path><path d="M116.1,20c0-10.5-8.6-19.1-19.1-19.1S77.9,9.5,77.9,20S86.5,39.1,97,39.1S116.1,30.5,116.1,20z M85.9,20c0-6.1,5-11.1,11.1-11.1s11.1,5,11.1,11.1s-5,11.1-11.1,11.1S85.9,26.1,85.9,20z"></path><path d="M31,47.9c-11.5,0-22.6,4.8-30.4,13.2l5.8,5.5c6.4-6.9,15.2-10.7,24.6-10.7V47.9z"></path><path d="M50.1,20C50.1,9.5,41.5,0.9,31,0.9S11.9,9.5,11.9,20S20.5,39.1,31,39.1S50.1,30.5,50.1,20z M31,31.1c-6.1,0-11.1-5-11.1-11.1S24.9,8.9,31,8.9s11.1,5,11.1,11.1S37.1,31.1,31,31.1z"></path></g>',1)])])}const KV=I(YV,[["render",ZV]]),JV={name:"NotificationPref",components:{NotificationOnboard:So,Notification:gi,GroupUsersIcon:KV},props:["username"],data(){return{pref:{},spaceGroups:[],is_custom:!1,loading:!1,error:"",saving:!1,digestEmailDay:"",initialState:null,default_messaging_email_frequency:""}},computed:{notificationRows(){const e=[];return this.spaceGroups.forEach(t=>{e.push({__group:!0,id:t.id,title:t.title}),t.spaces.forEach(s=>{e.push(s)})}),e},fcom_is_dirty(){return this.initialState?JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)!=this.initialState:!1}},methods:{getPrefs(){this.loading=!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(s=>{e[s.id]=s.pref})}),this.$post(`profile/${this.username}/notification-preferences`,{user_globals:this.pref,space_prefs:e}).then(t=>{this.$notify.success(t.message),this.initialState=JSON.stringify(this.pref)+JSON.stringify(this.spaceGroups)}).catch(t=>{this.$handleError(t)}).finally(()=>{this.saving=!1})}},mounted(){(this.auth.user_id||this.hasPermission("super_admin"))&&this.getPrefs()}},QV={class:"fcom_notification_config"},XV={key:0},eM=["innerHTML"],tM={key:1,class:"white_loaded"},sM={class:"fcom_notification_card"},oM={class:"fcom_notification_card__header"},iM={class:"fcom_notification_card__title"},nM={class:"fcom_notification_card__body"},lM={class:"fcom_input_wrap"},aM={key:0},rM={key:1,class:"fcom_not_enabled"},cM={class:"fcom_input_wrap"},dM={key:0},uM={key:1,class:"fcom_not_enabled"},_M={class:"fcom_input_wrap"},mM={key:0},hM={key:1,class:"fcom_not_enabled"},fM={class:"fcom_input_wrap"},pM={key:0},gM={key:1,class:"fcom_not_enabled"},yM={key:0,class:"fcom_input_wrap"},vM={style:{"font-weight":"500","font-size":"16px",margin:"10px 0 5px 0"}},bM={key:0,class:"fcom_not_enabled"},kM={key:1,class:"fcom_not_enabled"},wM={key:2,class:"fcom_not_enabled"},CM={class:"fcom_notification_card"},$M={class:"fcom_notification_card__header"},SM={class:"fcom_notification_card__title"},VM={class:"fcom_np_table_wrap"},MM={key:0,class:"fcom_np_group_title"},TM={key:1,class:"fcom_np_space"},LM=["innerHTML"],PM=["innerHTML"],FM={key:2,class:"fcom_np_icon fcom_no_avatar"},IM={class:"fcom_np_name"},EM={class:"fcom_sr_only"},UM={class:"fcom_sr_only"},AM={class:"fcom_sr_only"},BM={class:"fcom_notification_card fcom_fixed_bottom_overlay"},DM={key:3},RM={key:0},xM=["href"];function HM(e,t,s,u,o,i){const m=Z,f=p("NotificationOnboard"),h=p("Notification"),g=O,k=fe,b=Re,w=ke,S=p("GroupUsersIcon"),C=is,v=ie,$=ne,T=ns,V=H;return n(),c("div",QV,[o.error?(n(),c("div",XV,[l("p",{innerHTML:o.error},null,8,eM)])):o.loading?(n(),c("div",tM,[a(m,{rows:10,animated:!0})])):e.auth.user_id||e.hasPermission("super_admin")&&o.pref?(n(),c("div",{key:2,class:x([{fcom_is_dirty:i.fcom_is_dirty},"fcom_notification_config_body"])},[a(f),l("div",sM,[l("div",oM,[a(g,{style:{"font-size":"30px"}},{default:r(()=>[a(h)]),_:1}),l("div",iM,[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",nM,[l("div",lM,[a(k,{"true-value":"yes","false-value":"no",modelValue:o.pref.com_my_post_mail,"onUpdate:modelValue":t[0]||(t[0]=F=>o.pref.com_my_post_mail=F),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Email me when someone comments on my post")),1)]),_:1},8,["modelValue"]),o.pref.com_my_post_mail=="yes"?(n(),c("p",aM,d(e.$t("You will receive an email when someone leaves a comment on your post.")),1)):(n(),c("p",rM,d(e.$t("No email will be sent for comments on your post.")),1))]),l("div",cM,[a(k,{"true-value":"yes","false-value":"no",modelValue:o.pref.reply_my_com_mail,"onUpdate:modelValue":t[1]||(t[1]=F=>o.pref.reply_my_com_mail=F),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Email me when someone replies to my comments")),1)]),_:1},8,["modelValue"]),o.pref.reply_my_com_mail=="yes"?(n(),c("p",dM,d(e.$t("You will receive an email when someone replies to your comments.")),1)):(n(),c("p",uM,d(e.$t("No email will be sent when someone replies to your comments.")),1))]),l("div",_M,[a(k,{"true-value":"yes","false-value":"no",modelValue:o.pref.mention_mail,"onUpdate:modelValue":t[2]||(t[2]=F=>o.pref.mention_mail=F),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Email me when someone mentions me in a post or comment")),1)]),_:1},8,["modelValue"]),o.pref.mention_mail=="yes"?(n(),c("p",mM,d(e.$t("You will receive an email when someone mentions you in a comment or post.")),1)):(n(),c("p",hM,d(e.$t("No emails will be sent when someone mentions you.")),1))]),l("div",fM,[a(k,{"true-value":"yes","false-value":"no",modelValue:o.pref.digest_mail,"onUpdate:modelValue":t[3]||(t[3]=F=>o.pref.digest_mail=F),class:"fcom_checkbox"},{default:r(()=>[M(d(e.$t("Weekly digest on %s",o.digestEmailDay)),1)]),_:1},8,["modelValue"]),o.pref.digest_mail=="yes"?(n(),c("p",pM,d(e.$t("You will get a digest email with curated activities in the community")),1)):(n(),c("p",gM,d(e.$t("No digest email will be sent.")),1))]),e.appVars.has_chat&&o.default_messaging_email_frequency!="no"?(n(),c("div",yM,[l("p",vM,d(e.$t("Email sending frequency for one-to-one messages")),1),a(w,{modelValue:o.pref.message_email_frequency,"onUpdate:modelValue":t[4]||(t[4]=F=>o.pref.message_email_frequency=F),class:"fcom_radio_group"},{default:r(()=>[o.default_messaging_email_frequency!=="disabled"?(n(),y(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"]),o.pref.message_email_frequency=="disabled"?(n(),c("p",bM,d(e.$t("You will not get any email on new messages from any members")),1)):o.pref.message_email_frequency=="default"?(n(),c("p",kM,[o.default_messaging_email_frequency=="disabled"?(n(),c(P,{key:0},[M(d(e.$t("Email notification is disabled for one-to-one messages as per global community settings.")),1)],64)):(n(),c(P,{key:1},[M(d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.default_messaging_email_frequency))),1)],64))])):(n(),c("p",wM,d(e.$t("You will get email notifications on new messages from your last notification. Frequency: %s",e.$labelize(o.pref.message_email_frequency))),1))])):_("",!0)])]),l("div",CM,[l("div",$M,[a(g,{style:{"font-size":"30px"}},{default:r(()=>[a(S)]),_:1}),l("div",SM,[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",VM,[a(T,{data:i.notificationRows,"row-class-name":({row:F})=>F.__group?"fcom_np_group_row":"",class:"fcom_np_table fcom_table"},{empty:r(()=>[M(d(e.$t("No spaces found")),1)]),default:r(()=>[a(C,{label:e.$t("Space"),"min-width":"220",fixed:""},{default:r(({row:F})=>[F.__group?(n(),c("div",MM,d(F.title),1)):(n(),c("div",TM,[F.icon?(n(),y(g,{key:0,class:"fcom_np_icon"},{default:r(()=>[l("span",{innerHTML:F.icon},null,8,LM)]),_:2},1024)):F.shape_svg?(n(),c("span",{key:1,class:"fcom_np_icon",innerHTML:F.shape_svg},null,8,PM)):(n(),c("span",FM)),l("span",IM,d(F.title),1)]))]),_:1},8,["label"]),e.isMobile?(n(),y(C,{key:1,label:e.$t("Notifications"),"min-width":"200"},{default:r(({row:F})=>[F.__group?_("",!0):(n(),y($,{key:0,placeholder:e.$t("Email Disabled"),modelValue:F.pref,"onUpdate:modelValue":L=>F.pref=L},{default:r(()=>[a(v,{label:e.$t("Email Disabled"),value:""},null,8,["label"]),a(v,{label:e.$t("Notify only for Admin Posts"),value:"admin_only_posts"},null,8,["label"]),a(v,{label:e.$t("Notify for all posts"),value:"all_member_posts"},null,8,["label"])]),_:1},8,["placeholder","modelValue","onUpdate:modelValue"]))]),_:1},8,["label"])):(n(),c(P,{key:0},[a(C,{label:e.$t("Email Disabled"),align:"center",width:"180"},{default:r(({row:F})=>[F.__group?_("",!0):(n(),y(b,{key:0,modelValue:F.pref,"onUpdate:modelValue":L=>F.pref=L,value:"",name:"space-pref-"+F.id,class:"fcom_np_radio"},{default:r(()=>[l("span",EM,d(e.$t("Email Disabled")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(C,{label:e.$t("Notify only for Admin Posts"),align:"center",width:"220"},{default:r(({row:F})=>[F.__group?_("",!0):(n(),y(b,{key:0,modelValue:F.pref,"onUpdate:modelValue":L=>F.pref=L,value:"admin_only_posts",name:"space-pref-"+F.id,class:"fcom_np_radio"},{default:r(()=>[l("span",UM,d(e.$t("Notify only for Admin Posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"]),a(C,{label:e.$t("Notify for all posts"),align:"center",width:"180"},{default:r(({row:F})=>[F.__group?_("",!0):(n(),y(b,{key:0,modelValue:F.pref,"onUpdate:modelValue":L=>F.pref=L,value:"all_member_posts",name:"space-pref-"+F.id,class:"fcom_np_radio"},{default:r(()=>[l("span",AM,d(e.$t("Notify for all posts")),1)]),_:1},8,["modelValue","onUpdate:modelValue","name"]))]),_:1},8,["label"])],64))]),_:1},8,["data","row-class-name"])])]),l("div",BM,[a(V,{onClick:i.saveSettings,disabled:o.saving,loading:o.saving,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Save Changes")),1)]),_:1},8,["onClick","disabled","loading"])])],2)):(n(),c("div",DM,[l("h3",null,d(e.$t("Sorry you do not have permission to access this.")),1),e.auth.user_id?_("",!0):(n(),c("div",RM,[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,xM)]))]))])}const OM=I(JV,[["render",HM]]),jM={name:"UserNotificationSettings",props:["username"],components:{NotificationPrefForm:OM}},NM={class:"fcom_routed_notification_settings"};function zM(e,t,s,u,o,i){const m=p("notification-pref-form");return n(),c("div",NM,[a(m,{username:s.username},null,8,["username"])])}const qM=I(jM,[["render",zM]]),GM={name:"UserFollowers",components:{Pagination:Ve,FollowAction:it},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"))}},YM={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},WM={class:"search_member"},ZM={class:"feed_filters"},KM={id:"feed_short_by",class:"fcom_feed_filter_label"},JM={key:0,class:"loading"},QM={key:1,class:"no_follow"},XM={key:2,class:"card_list"},eT={role:"region","aria-label":"User Info",class:"card_content"},tT={class:"card_avatar"},sT={class:"card_info"},oT={class:"info_header"},iT={class:"meta_line"},nT={key:0,class:"card_headline"},lT={class:"feed_meta_info"},aT=["title"],rT=["title"],cT={key:1,class:"card_description"},dT={class:"card_action"},uT={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function _T(e,t,s,u,o,i){const m=p("Search"),f=O,h=te,g=ie,k=ne,b=Z,w=p("UserAvatar"),S=p("UserRouteLink"),C=p("FollowAction"),v=p("Pagination");return n(),c("div",YM,[l("div",WM,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=$=>o.search=$),placeholder:e.$t("Search Followers...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",ZM,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",KM,d(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followers by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=$=>o.sort_by=$),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=$=>i.toSearch())},{default:r(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),c("div",JM,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),c("div",QM,[o.search?(n(),c(P,{key:0},[M(d(e.$t("No results found")),1)],64)):(n(),c(P,{key:1},[M(d(e.$t("No one is following this account yet. Posting and interacting with others helps boost followers!")),1)],64))])):(n(),c("div",XM,[(n(!0),c(P,null,R(o.follows,$=>{var T,V,F,L,A,D,U,E,q,j;return n(),c("div",{key:$.followed_id,class:"each_card"},[l("div",eT,[l("div",tT,[a(w,{is_online:e.isOnline((T=$.follower)==null?void 0:T.last_activity),xprofile:$.follower},null,8,["is_online","xprofile"])]),l("div",sT,[l("div",oT,[a(S,{show_pop:!0,show_badge:!0,xprofile:$.follower,show_follow:!0},null,8,["xprofile"]),l("div",iT,"@"+d((V=$.follower)==null?void 0:V.username),1)]),(L=(F=$.follower)==null?void 0:F.meta)!=null&&L.headline?(n(),c("div",nT,d($.follower.meta.headline),1)):_("",!0),l("div",lT,[(A=$.follower)!=null&&A.created_at?(n(),c("div",{key:0,title:(D=$.follower)==null?void 0:D.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff($.follower.created_at))),9,aT)):_("",!0),(U=$.follower)!=null&&U.last_activity?(n(),c("div",{key:1,title:(E=$.follower)==null?void 0:E.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff($.follower.last_activity))),9,rT)):_("",!0)]),(q=$.follower)!=null&&q.short_description?(n(),c("div",cT,d(e.getExcerpt(((j=$.follower.meta)==null?void 0:j.short_description_rendered)||$.follower.short_description,120)),1)):_("",!0)])]),l("div",dT,[a(C,{profile:$.follower,onRefetch:t[3]||(t[3]=N=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),c("div",uT,[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=$=>i.fetchFollowers()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])}const mT=I(GM,[["render",_T]]),hT={name:"UserFollowings",props:["isOwn","profile"],emits:["refetch"],components:{Pagination:Ve,FollowAction:it},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"))}},fT={class:"fcom_dir_layout_classic space_members fcom_dir_layout"},pT={class:"search_member"},gT={class:"feed_filters"},yT={id:"feed_short_by",class:"fcom_feed_filter_label"},vT={key:0,class:"loading"},bT={key:1,class:"no_follow"},kT={key:2,class:"card_list"},wT={role:"region","aria-label":"User Info",class:"card_content"},CT={class:"card_avatar"},$T={class:"card_info"},ST={class:"info_header"},VT={class:"meta_line"},MT={key:0,class:"card_headline"},TT={class:"feed_meta_info"},LT=["title"],PT=["title"],FT={key:1,class:"card_description"},IT={class:"card_action"},ET={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function UT(e,t,s,u,o,i){const m=p("Search"),f=O,h=te,g=ie,k=ne,b=Z,w=p("UserAvatar"),S=p("UserRouteLink"),C=p("FollowAction"),v=p("Pagination");return n(),c("div",fT,[l("div",pT,[a(h,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=$=>o.search=$),placeholder:e.$t("Search Followings...")},{prefix:r(()=>[a(f,null,{default:r(()=>[a(m)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",gT,[t[5]||(t[5]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",yT,d(e.$t("Sort by:")),1),a(k,{"aria-label":e.$t("Sort followings by"),modelValue:o.sort_by,"onUpdate:modelValue":t[1]||(t[1]=$=>o.sort_by=$),class:"fcom_minimal_select","popper-class":"plain_select",onChange:t[2]||(t[2]=$=>i.toSearch())},{default:r(()=>[a(g,{value:"id",label:e.$t("Most Recent")},null,8,["label"]),a(g,{value:"alphabetical",label:e.$t("Alphabetical")},null,8,["label"])]),_:1},8,["aria-label","modelValue"])]),o.loading&&!o.follows.length?(n(),c("div",vT,[a(b,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.follows.length?(n(),c("div",bT,[o.search?(n(),c(P,{key:0},[M(d(e.$t("No results found")),1)],64)):s.isOwn?(n(),c(P,{key:1},[M(d(e.$t("You aren't following anyone yet. Start following other members to connect and keep up with their activity!")),1)],64)):(n(),c(P,{key:2},[M(d(e.$t("This user isn't following anyone yet. Once they follow accounts, they'll show up here.")),1)],64))])):(n(),c("div",kT,[(n(!0),c(P,null,R(o.follows,$=>{var T,V,F,L,A,D,U,E,q,j;return n(),c("div",{key:$.followed_id,class:"each_card"},[l("div",wT,[l("div",CT,[a(w,{is_online:e.isOnline((T=$.followed)==null?void 0:T.last_activity),xprofile:$.followed},null,8,["is_online","xprofile"])]),l("div",$T,[l("div",ST,[a(S,{show_pop:!0,show_badge:!0,xprofile:$.followed,show_follow:!0},null,8,["xprofile"]),l("div",VT,"@"+d((V=$.followed)==null?void 0:V.username),1)]),(L=(F=$.followed)==null?void 0:F.meta)!=null&&L.headline?(n(),c("div",MT,d($.followed.meta.headline),1)):_("",!0),l("div",TT,[(A=$.followed)!=null&&A.created_at?(n(),c("div",{key:0,title:(D=$.followed)==null?void 0:D.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff($.followed.created_at))),9,LT)):_("",!0),(U=$.followed)!=null&&U.last_activity?(n(),c("div",{key:1,title:(E=$.followed)==null?void 0:E.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff($.followed.last_activity))),9,PT)):_("",!0)]),(q=$.followed)!=null&&q.short_description?(n(),c("div",FT,d(e.getExcerpt(((j=$.followed.meta)==null?void 0:j.short_description_rendered)||$.followed.short_description,120)),1)):_("",!0)])]),l("div",IT,[a(C,{profile:$.followed,onRefetch:t[3]||(t[3]=N=>e.$emit("refetch"))},null,8,["profile"])])])}),128))])),i.showPagination?(n(),c("div",ET,[a(v,{hide_on_single:!0,onFetch:t[4]||(t[4]=$=>i.fetchFollowings()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)])}const AT=I(hT,[["render",UT]]),BT={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}})}}},DT={class:"follow_header"},RT={class:"fcom_filter_menu"},xT={class:"fcom_filter_menu_ul"},HT={key:0},OT={key:1},jT={class:"follow_body"};function NT(e,t,s,u,o,i){var f,h;const m=p("router-view");return n(),c(P,null,[l("div",DT,[l("div",RT,[l("ul",xT,[((f=s.profile)==null?void 0:f.followings_count)!=null?(n(),c("li",HT,[l("a",{href:"#",onClick:t[0]||(t[0]=z(g=>i.switchRoute("user_followings"),["prevent"])),class:x({"router-link-exact-active":i.isActive("user_followings")})},d(e.$t("Following")),3)])):_("",!0),((h=s.profile)==null?void 0:h.followers_count)!=null?(n(),c("li",OT,[l("a",{href:"#",onClick:t[1]||(t[1]=z(g=>i.switchRoute("user_followers"),["prevent"])),class:x({"router-link-exact-active":i.isActive("user_followers")})},d(e.$t("Followers")),3)])):_("",!0)])])]),l("div",jT,[a(m,{isOwn:s.isOwn,profile:s.profile,onRefetch:t[2]||(t[2]=g=>e.$emit("refetch"))},null,8,["isOwn","profile"])])],64)}const zT=I(BT,[["render",NT]]),qT={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 GT(e,t,s,u,o,i){const m=p("MoreFilled"),f=O,h=H,g=ze,k=ke,b=ue,w=_e,S=ye,C=ee("loading");return n(),y(S,{persistent:!1,placement:"bottom",width:270,visible:o.isOpened,onHide:t[2]||(t[2]=v=>o.isOpened=!1)},{reference:r(()=>[a(h,{"aria-label":e.$t("View actions"),onClick:i.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(w,{onSubmit:t[1]||(t[1]=z(v=>e.doNothing(),["prevent"])),"label-position":"top"},{default:r(()=>[a(b,{label:e.$t("Status")},{default:r(()=>[a(k,{modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=v=>o.status=v)},{default:r(()=>[a(g,{label:e.$t("Active"),value:"active"},null,8,["label"]),a(g,{label:e.$t("Pending"),value:"pending"},null,8,["label"]),a(g,{label:e.$t("Blocked"),value:"blocked"},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),a(b,null,{default:r(()=>[Y((n(),y(h,{disabled:o.working,onClick:i.changeMemberStatus,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Update Status")),1)]),_:1},8,["disabled","onClick"])),[[C,o.working]])]),_:1})]),_:1})]),_:1},8,["visible"])}const YT=I(qT,[["render",GT]]),WT={name:"AllMembers",components:{SocialLinks:Rt,Layout:$e,AppLayout:Me,Pagination:Ve,MemberAction:YT,FollowAction:it},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(s=>{this.$notify.success(s.message),e.status=t}).catch(s=>{this.$handleError(s)}).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,s=this.$route.query.inactives?"blocked":null,u=t||s;u&&e.includes(u)&&(this.status=u),this.fetch(),this.changeTitle(this.$t("All Members"))}},ZT={key:0,class:"card_header"},KT={role:"region","aria-label":"Member Navigation",class:"member_status"};const JT={key:1,style:{"text-align":"center",padding:"20px 20px 40px"},class:"space_members"},QT={class:"permission_failed"},XT=["href"],eL={class:"search_member"},tL={class:"feed_filters"},sL={id:"feed_short_by",class:"fcom_feed_filter_label"},oL={key:0,class:"loading"},iL={key:1,class:"no_members"},nL={key:2,class:"card_list"},lL={role:"region","aria-label":"User Info",class:"card_content"},aL={class:"card_avatar"},rL={class:"card_info"},cL={class:"info_header"},dL={class:"meta_line"},uL={key:0,class:"card_headline"},_L={class:"feed_meta_info"},mL=["title"],hL=["title"],fL={key:1,class:"card_description"},pL={key:2,class:"card_footer"},gL={class:"card_action"},yL={key:3,role:"region","aria-label":"Pagination",class:"pagination_wrap"};function vL(e,t,s,u,o,i){const m=ze,f=ke,h=H,g=p("Search"),k=O,b=te,w=ie,S=ne,C=Z,v=p("UserAvatar"),$=p("UserRouteLink"),T=p("SocialLinks"),V=p("FollowAction"),F=p("MemberAction"),L=p("Pagination"),A=p("layout"),D=p("app-layout");return n(),y(D,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(A,{use_scroll:!0,class:"no_bg_layout",title:e.$t("All Members")+" "+(typeof o.pagination.total=="number"?" ("+e.$formatNumber(o.pagination.total)+")":"")},{default:r(()=>[e.isAdmin()?(n(),c("div",ZT,[l("div",KT,[a(f,{onChange:i.toSearch,modelValue:o.status,"onUpdate:modelValue":t[0]||(t[0]=U=>o.status=U),class:"status_group"},{default:r(()=>[a(m,{value:"active"},{default:r(()=>[M(d(e.$t("Active")),1)]),_:1}),a(m,{value:"pending"},{default:r(()=>[M(d(e.$t("Pending")),1)]),_:1}),a(m,{value:"blocked"},{default:r(()=>[M(d(e.$t("Blocked")),1)]),_:1}),e.hasFeature("can_deactivate_account")?(n(),y(m,{key:0,value:"deactivated"},{default:r(()=>[M(d(e.$t("Deactivated (self)")),1)]),_:1})):_("",!0)]),_:1},8,["onChange","modelValue"])]),_("",!0)])):_("",!0),o.permission_failed?(n(),c("div",JT,[l("div",QT,[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,XT)])])):(n(),c(P,{key:2},[l("div",eL,[a(b,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[2]||(t[2]=U=>o.search=U),placeholder:e.$t("Search Members...")},{prefix:r(()=>[a(k,null,{default:r(()=>[a(g)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",tL,[t[6]||(t[6]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",sL,d(e.$t("Sort by:")),1),a(S,{"aria-label":e.$t("Sort members by"),modelValue:o.sort_by,"onUpdate:modelValue":t[3]||(t[3]=U=>o.sort_by=U),class:"fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Latest Posts"),onChange:t[4]||(t[4]=U=>i.fetch())},{default:r(()=>[a(w,{value:"last_activity",label:e.$t("Last Activity")},null,8,["label"]),a(w,{value:"display_name",label:e.$t("Display Name")},null,8,["label"]),a(w,{value:"created_at",label:e.$t("Joining Date")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])]),l("div",{class:x(["fcom_dir_layout_"+o.memberLayout,"space_members fcom_dir_layout"])},[o.loading?(n(),c("div",oL,[a(C,{class:"white_loaded",rows:3,animated:!0})])):!o.loading&&!o.members.length?(n(),c("div",iL,d(e.$t("No members found")),1)):(n(),c("div",nL,[(n(!0),c(P,null,R(o.members,(U,E)=>{var q,j;return n(),c("div",{key:U.user_id,class:"each_card"},[l("div",lL,[l("div",aL,[a(v,{is_online:e.isOnline(U.last_activity),xprofile:U},null,8,["is_online","xprofile"])]),l("div",rL,[l("div",cL,[a($,{show_pop:!0,show_badge:!0,xprofile:U,show_follow:!0},null,8,["xprofile"]),l("div",dL,"@"+d(U.username),1)]),(q=U.meta)!=null&&q.headline?(n(),c("div",uL,d(U.meta.headline),1)):_("",!0),l("div",_L,[U.created_at?(n(),c("div",{key:0,title:U.created_at,class:"meta_line"},d(e.$t("Joined %s",e.humanDateDiff(U.created_at))),9,mL)):_("",!0),U.last_activity?(n(),c("div",{key:1,title:U.last_activity,class:"meta_line"},d(e.$t("Last seen: %s",e.humanDateDiff(U.last_activity))),9,hL)):_("",!0)]),U.short_description?(n(),c("div",fL,d(e.getExcerpt(((j=U.meta)==null?void 0:j.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"?(n(),c("div",pL,[l("div",{style:re({color:U.status==="pending"?"var(--el-color-warning)":"var(--el-color-danger)",display:"flex",gap:"10px"}),class:"meta_line"},[U.status==="pending"?(n(),c(P,{key:0},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:N=>i.changeMemberStatus(U,"active"),type:"primary",size:"small",disabled:o.working,loading:o.working},{default:r(()=>[M(d(e.$t("Approve")),1)]),_:1},8,["onClick","disabled","loading"])],64)):U.status==="blocked"?(n(),c(P,{key:1},[l("span",null,d(e.$t("Status:"))+" "+d(e.$labelize(U.status)),1),a(h,{onClick:N=>i.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:o.working,loading:o.working},{default:r(()=>[M(d(e.$t("Unblock")),1)]),_:1},8,["onClick","disabled","loading"])],64)):(n(),c(P,{key:2},[l("span",null,d(e.$t("Status:"))+" "+d(e.$t("Self Deactivated")),1),a(h,{onClick:N=>i.changeMemberStatus(U,"active"),type:"danger",size:"small",disabled:o.working,loading:o.working},{default:r(()=>[M(d(e.$t("Reactivate")),1)]),_:1},8,["onClick","disabled","loading"])],64))],4)])):_("",!0)])]),l("div",gL,[a(V,{profile:U},null,8,["profile"]),e.isAdmin()?(n(),y(F,{key:0,member:U,openedMemberId:o.openedMemberId,onTogglePopover:N=>i.handleTogglePopover(U.user_id)},null,8,["member","openedMemberId","onTogglePopover"])):_("",!0)])])}),128))])),o.pagination.total?(n(),c("div",yL,[a(L,{hide_on_single:!0,onFetch:t[5]||(t[5]=U=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])):_("",!0)],2)],64))]),_:1},8,["title"])]),_:1})}const bL=I(WT,[["render",vL]]),kL={name:"Notifications",components:{AppLayout:Me,Layout:$e,NotificationsBlock:oo,Pagination:Ve},setup(){return{notificationStore:ds()}},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)}},wL={class:"fcom_filter_menu"},CL={class:"fcom_filter_menu_ul fcom_notification_types"},$L={style:{"border-top-left-radius":"0","border-top-right-radius":"0"},class:"space_members"},SL={key:0,class:"notifications notifications_wrap"},VL={class:"pagination_wrap"},ML={key:1,style:{"margin-top":"15px"}},TL={key:2};function LL(e,t,s,u,o,i){const m=H,f=js,h=p("notifications-block"),g=p("Pagination"),k=Z,b=p("layout"),w=p("app-layout"),S=ee("loading");return n(),y(w,{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:o.working,onClick:t[0]||(t[0]=C=>i.markAllRead())},{default:r(()=>[M(d(e.$t("Mark all as read")),1)]),_:1},8,["disabled"])]),default:r(()=>[l("div",wL,[l("ul",CL,[l("li",null,[l("a",{onClick:t[1]||(t[1]=z(C=>i.switchType("all"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="all"&&o.status!="unread"}),href:"#"},d(e.$t("All")),3)]),l("li",null,[l("a",{onClick:t[2]||(t[2]=z(C=>i.switchType("unread"),["prevent"])),class:x({"router-link-exact-active":o.status=="unread"}),href:"#"},d(e.$t("Unread")),3)]),l("li",null,[l("a",{onClick:t[3]||(t[3]=z(C=>i.switchType("mentioned"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="mentioned"}),href:"#"},d(e.$t("Mentions")),3)]),l("li",null,[l("a",{onClick:t[4]||(t[4]=z(C=>i.switchType("following"),["prevent"])),class:x({"router-link-exact-active":o.notification_type=="following"}),href:"#"},d(e.$t("Following")),3)])]),a(f,{onChange:t[5]||(t[5]=C=>i.fetch()),style:{"--el-switch-on-color":"#2271b1"},"active-value":"unread","inactive-value":"all","active-text":e.$t("Unread only"),modelValue:o.status,"onUpdate:modelValue":t[6]||(t[6]=C=>o.status=C),class:"fcom_switch"},null,8,["active-text","modelValue"])]),l("div",$L,[o.notifications.length?Y((n(),c("div",SL,[a(h,{notifications:o.notifications},null,8,["notifications"]),l("div",VL,[a(g,{hide_on_single:!0,onFetch:t[7]||(t[7]=C=>i.fetch()),pagination:o.pagination},null,8,["pagination"])])])),[[S,o.loading]]):o.loading?(n(),c("div",TL,[a(k,{animated:!0,rows:5})])):(n(),c("div",ML,[l("p",null,d(e.$t("No notifications found")),1)]))])]),_:1},8,["title"])]),_:1})}const PL=I(kL,[["render",LL]]),FL={name:"Bookmarks",components:{Feeds:yt,AppLayout:Me,Layout:$e},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"))}},IL={style:{"margin-bottom":"16px"}},EL={class:"search_member"},UL={key:1};function AL(e,t,s,u,o,i){const m=p("Search"),f=O,h=te,g=p("feeds"),k=p("layout"),b=p("app-layout");return n(),y(b,{wrapper_class:"fcom_single_layout fcom_compact_layout"},{default:r(()=>[a(k,{wrapper_class:"no_bg_layout",title:e.$t("Your Bookmarks")},{default:r(()=>[l("h4",IL,d(e.$t("Your saved posts")),1),l("div",EL,[a(h,{clearable:"",onClear:i.handleSearch,onKeydown:ae(i.handleSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[0]||(t[0]=w=>o.search=w),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?(n(),y(g,{key:0,feed_base_url:i.feed_base_url,hide_create_form:!0,space:"",feed_name:"all_feeds",context_suffix:"bookmarks",layout_style:e.appVars.features.default_feed_layout,default_order_by:e.appVars.features.default_feed_sort_by||"",can_change_order:e.appVars.features.disable_feed_sort_by!=="yes",can_change_layout:e.appVars.features.can_switch_layout},null,8,["feed_base_url","layout_style","default_order_by","can_change_order","can_change_layout"])):(n(),c("div",UL,[l("p",null,d(e.$t("Please login to view your bookmarks")),1)]))]),_:1},8,["title"])]),_:1})}const BL=I(FL,[["render",AL]]);const DL={name:"AllCourses",components:{AppLayout:Me,Layout:$e,GroupIcon:Wt,Pagination:Ve,Search:Ee},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)}},RL={class:"object_menu"},xL={class:"fcom_space_menu_ul"},HL={key:0},OL={key:1},jL={key:0,class:"fcom_space_topics"},NL={class:"fcom_topics_filters"},zL={class:"search_member"},qL={class:"feed_filters"},GL={id:"feed_short_by",class:"fcom_feed_filter_label"},YL={class:"fcom_courses"},WL={key:0,class:"fcom_no_items_wrap"},ZL={key:2},KL=["href"],JL={class:"fcom_box_card_list"},QL=["onClick"],XL=["src","onError"],eP={key:1,class:"fcom_no_image"},tP={class:"fcom_box_card_info"},sP={class:"fcom_box_card_name"},oP={class:"fcom_box_card_details"},iP={class:"inline_details"},nP={key:0,class:"inline_details"},lP={key:0,class:"fcom_box_card_description"},aP=["innerHTML"],rP={class:"fcom_box_card_action"},cP=["onClick"],dP=["onClick"];function uP(e,t,s,u,o,i){const m=H,f=Ce,h=p("Search"),g=O,k=te,b=ie,w=ne,S=Ue,C=p("router-link"),v=p("GroupIcon"),$=p("pagination"),T=p("layout"),V=p("app-layout"),F=ee("loading");return n(),y(V,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(T,{wrapper_class:"no_bg_layout",title:e.$t("Courses")+" "+(o.pagination.total?" ("+e.$formatNumber(o.pagination.total)+")":"")},{actions:r(()=>[l("div",RL,[l("ul",xL,[l("li",null,[l("a",{onClick:t[0]||(t[0]=z(L=>i.SwitchToCourseView("all"),["prevent"])),class:x(o.type=="all"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("All Courses")),3)]),e.auth.user_id?(n(),c("li",HL,[l("a",{onClick:t[1]||(t[1]=z(L=>i.SwitchToCourseView("enrolled"),["prevent"])),class:x(o.type=="enrolled"?"router-link-active router-link-exact-active":""),href:"#"},d(e.$t("My Courses")),3)])):_("",!0),e.hasCourseCreatorAccess()?(n(),c("li",OL,[a(m,{onClick:t[2]||(t[2]=L=>i.emitCreateCourse()),class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("New Course")),1)]),_:1})])):_("",!0)])])]),default:r(()=>[o.courseCategories&&o.courseCategories.length?(n(),c("div",jL,[a(f,null,{default:r(()=>[l("div",NL,[a(m,{onClick:t[3]||(t[3]=L=>i.setTopic("")),class:x({fcom_active_topic:!o.topic_slug})},{default:r(()=>[M(d(e.$t("All")),1)]),_:1},8,["class"]),(n(!0),c(P,null,R(o.courseCategories,L=>(n(),y(m,{key:L.slug,onClick:A=>i.setTopic(L.slug),class:x({fcom_active_topic:L.slug==o.topic_slug})},{default:r(()=>[M(d(L.title),1)]),_:2},1032,["onClick","class"]))),128))])]),_:1})])):_("",!0),l("div",zL,[a(k,{clearable:"",onClear:i.toSearch,onKeydown:ae(i.toSearch,["enter"]),onInput:i.handleSearch,modelValue:o.search,"onUpdate:modelValue":t[4]||(t[4]=L=>o.search=L),placeholder:e.$t("Search Courses...")},{prefix:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["onClear","onKeydown","onInput","modelValue","placeholder"])]),l("div",qL,[t[9]||(t[9]=l("div",{class:"fcom_feed_divider"},null,-1)),l("span",GL,d(e.$t("Sort by:")),1),a(w,{"aria-label":e.$t("Sort Courses by"),modelValue:o.sort_by,"onUpdate:modelValue":t[5]||(t[5]=L=>o.sort_by=L),class:"fcom_minimal_select space_sort_select","popper-class":"plain_select",onChange:t[6]||(t[6]=L=>i.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"])]),Y((n(),c("div",YL,[!o.loading&&!o.courses.length?(n(),c("div",WL,[o.topic_slug?(n(),c(P,{key:0},[l("h3",null,d(e.$t("No courses found in this topic")),1),l("p",null,d(e.$t("No courses found based on your search criteria")),1)],64)):o.type=="all"?(n(),c(P,{key:1},[o.search?(n(),c(P,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.isAdmin()?(n(),c(P,{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=>i.emitCreateCourse()),class:"fcom_primary_button fcom_mt_10"},{default:r(()=>[M(d(e.$t("Create a Course")),1)]),_:1})],64)):(n(),c("div",ZL,[l("h3",null,d(e.$t("No published courses found")),1),l("p",null,d(e.$t("Please check back later. We are in a process to publish some courses for you!")),1)]))],64)):(n(),c(P,{key:2},[o.search?(n(),c(P,{key:0},[l("h3",null,d(e.$t("No courses found based on your search criteria")),1),l("p",null,d(e.$t("No courses match your search criteria. Try adjusting your search terms or browse our course catalog.")),1)],64)):e.auth.user_id?(n(),c(P,{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=>i.SwitchToCourseView("all"),["prevent"])),class:"el-button fcom_primary_button fcom_mt_10",href:"#"},d(e.$t("View all courses")),1)],64)):(n(),c(P,{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,KL)],64))],64))])):_("",!0),l("div",JL,[(n(!0),c(P,null,R(o.courses,L=>(n(),c("div",{key:L.id,class:"fcom_each_box_card"},[l("div",{class:"fcom_box_card_avatar",onClick:A=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},[L.cover_photo&&!L.coverError?(n(),c("img",{key:0,src:L.cover_photo,alt:"",onError:A=>L.coverError=!0},null,40,XL)):(n(),c("div",eP))],8,QL),l("div",tP,[l("div",sP,[a(C,{class:"course_route",to:{name:"view_course",params:{course_slug:L.slug}}},{default:r(()=>[M(d(L.title)+" ",1),L.status=="draft"?(n(),y(S,{key:0,type:"info"},{default:r(()=>[M(d(L.status),1)]),_:2},1024)):_("",!0)]),_:2},1032,["to"])]),l("div",oP,[l("div",iP,[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?(n(),c("div",nP,[a(g,null,{default:r(()=>[a(v)]),_:1}),M(" "+d(e.$_n("%s student","%s students",e.$formatNumber(L.studentsCount))),1)])):_("",!0)]),L.description?(n(),c("div",lP,d(i.getExcerpt(L.description)),1)):_("",!0),L.custom_html?(n(),c("div",{key:1,class:"fcom_box_card_custom_html",innerHTML:L.custom_html},null,8,aP)):_("",!0),l("div",rP,[L.isEnrolled?(n(),c("button",{key:0,class:x(["fcom_card_button",L.progress>=100?"fcom_card_button_success":"fcom_card_button_progress"]),onClick:A=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},d(e.$t("%s Completed",L.progress+"%")),11,cP)):(n(),c("button",{key:1,class:"fcom_card_button",onClick:A=>e.$router.push({name:"view_course",params:{course_slug:L.slug}})},d(e.$t("View Course")),9,dP))])])]))),128))]),a($,{hide_on_single:!0,onFetch:i.fetchCourses,pagination:o.pagination},null,8,["onFetch","pagination"])])),[[F,o.loading]])]),_:1},8,["title"])]),_:1})}const _P=I(DL,[["render",uP],["__scopeId","data-v-6ac627c3"]]),mP={name:"ViewCoursesRoute",components:{Layout:$e,AppLayout:Me},props:["course_slug"],data(){return{course:{},sections:[],track:{},loading:!1,currentLessonIndex:null,currentLesson:null}},watch:{course_slug(){this.fetchCourse()}},computed:{allLessons(){let e=[];return je(this.sections,t=>{je(t.lessons,s=>{e.push(s)})}),e},lessonsCount(){return this.allLessons.length}},methods:{fetchCourse(){this.loading=!0,this.$get("courses/"+this.course_slug+"/by-slug",{intended_lesson_slug:this.$route.params.lesson_slug||null}).then(e=>{this.sections=e.sections,this.track=e.track,this.$route.params.lesson_slug&&this.goToLesson(this.$route.params.lesson_slug,!0),this.course=e.course,this.changeTitle(this.course.title)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},handleNextLesson(){let e=null;if(this.currentLessonIndex===null){if(je(this.allLessons,(t,s)=>{if(!this.track.completed_lessons.includes(t.id.toString()))return e=t,!1}),!e)if(this.allLessons.length)e=this.allLessons[0];else return this.$notify.error(this.$t("Sorry, no lesson found")),!1}else je(this.allLessons,(t,s)=>{if(s>this.currentLessonIndex)return e=t,!1});e&&this.goToLesson(e.slug)},setPrevLesson(){let e=this.currentLessonIndex-1;if(e<0||!this.allLessons[e])return this.$notify.error(this.$t("Sorry, no lesson found")),!1;let t=this.allLessons[e];t&&this.goToLesson(t.slug)},goToLesson(e,t=!1){let s=null,u=null;je(this.allLessons,(o,i)=>{if(o.slug==e)return s=o,u=i,!1}),s&&(this.loading=!0,this.currentLesson=null,this.currentLessonIndex=null,this.$nextTick(()=>{this.currentLessonIndex=u,this.currentLesson=s,this.currentLesson.lazy_load&&(this.currentLesson.content_loading=!0,this.fetchLesson(s.slug,o=>{o.slug==this.currentLesson.slug&&(this.currentLesson.can_view=o.can_view,this.currentLesson.is_locked=o.is_locked,this.currentLesson.lock_type=o.lock_type,this.currentLesson.access_message=o.access_message,this.currentLesson.meta=o.meta,this.currentLesson.content=o.content,this.currentLesson.content_loading=!1)})),this.changeTitle(this.currentLesson.title),this.$router.push({name:"view_lesson",params:{lesson_slug:s.slug},query:t?this.$route.query:{}}),this.loading=!1}))},fetchLesson(e,t=null){this.$get("courses/"+this.course.slug+"/lessons/"+e+"/by-slug").then(s=>{t&&t(s.lesson)}).catch(s=>{this.$handleError(s),t&&t({slug:e,content:"<p>"+this.$t("Sorry, the lesson content could not be loaded.")+"</p>"})})}},created(){this.fetchCourse()}},hP={key:0},fP={style:{padding:"20px"},class:"fcom_course_sections fcom_white_loaded"},pP={key:1},gP={key:2,style:{padding:"1rem 2rem"}};function yP(e,t,s,u,o,i){const m=ls,f=as,h=Z,g=p("layout"),k=p("app-layout"),b=p("router-view");return o.loading?(n(),c("div",hP,[a(k,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(g,{title:"...."},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[M(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[...t[1]||(t[1]=[M("....",-1)])]),_:1})]),_:1})]),default:r(()=>[l("div",fP,[a(h,{rows:10,animated:!0})])]),_:1})]),_:1})])):o.course.id?(n(),c("div",pP,[a(b,{track:o.track,course:o.course,sections:o.sections,lessonsCount:i.lessonsCount,currentLesson:o.currentLesson,currentLessonIndex:o.currentLessonIndex,onSetNextLesson:i.handleNextLesson,onSetPrevLesson:i.setPrevLesson,onGoToLesson:i.goToLesson,onReload:i.fetchCourse,onUpdateTrack:t[0]||(t[0]=w=>{o.track=w})},null,8,["track","course","sections","lessonsCount","currentLesson","currentLessonIndex","onSetNextLesson","onSetPrevLesson","onGoToLesson","onReload"])])):(n(),c("div",gP,[l("h3",null,d(e.$t("Sorry, the course could not be loaded.")),1)]))}const vP=I(mP,[["render",yP]]),bP={name:"LockIcon",props:{fill:{type:String,default:"currentColor"}}},kP={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function wP(e,t,s,u,o,i){return n(),c("svg",kP,[...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 CP=I(bP,[["render",wP]]),$P={name:"WelcomeBanner",components:{MediaPreview:Oe},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}}},SP={key:0,class:"fcom_welcome_title"},VP=["innerHTML"],MP={key:2,class:"fcom_welcome_cta_buttons"},TP=["href","target"];function LP(e,t,s,u,o,i){const m=p("media-preview"),f=Fe,h=p("MoreFilled"),g=O,k=H,b=Je,w=Qe,S=Xe;return i.effectiveConfig&&i.showBanner?(n(),c("div",{key:0,class:x(["fcom_welcome_box",s.wrapperClass])},[i.showMedia?(n(),y(m,{key:0,media_item:i.effectiveConfig.bannerVideo},null,8,["media_item"])):i.effectiveConfig.bannerImage?(n(),y(f,{key:1,class:"feed_media",alt:e.$t("Image Preview"),src:i.effectiveConfig.bannerImage},null,8,["alt","src"])):_("",!0),l("div",{class:x(s.contentClass)},[i.effectiveConfig.title?(n(),c("h2",SP,d(i.effectiveConfig.title),1)):_("",!0),i.effectiveConfig.description_rendered?(n(),c("div",{key:1,class:"fcom_welcome_sub",innerHTML:i.effectiveConfig.description_rendered},null,8,VP)):_("",!0),i.showCtaButtons?(n(),c("div",MP,[(n(!0),c(P,null,R(i.effectiveConfig.ctaButtons,C=>(n(),c(P,null,[C.link&&C.label?(n(),c("a",{key:0,href:C.link,target:C.newTab=="yes"?"_blank":"",class:x({"el-button fcom_primary_button":C.type=="primary","el-button fcom_secondary_button":C.type=="secondary","el-button is-text":C.type=="text","el-link fcom_link_button":C.type=="link"})},d(C.label),11,TP)):_("",!0)],64))),256))])):_("",!0)],2),i.isRemovable?(n(),y(S,{key:2,trigger:"click",class:"fcom_welcome_close"},{dropdown:r(()=>[a(w,null,{default:r(()=>[a(b,{onClick:i.closeBanner},{default:r(()=>[M(d(e.$t("Hide Banner")),1)]),_:1},8,["onClick"])]),_:1})]),default:r(()=>[a(k,{"aria-label":e.$t("Hide Banner"),class:"fcom_dot_menu",size:"small",text:""},{default:r(()=>[a(g,null,{default:r(()=>[a(h)]),_:1})]),_:1},8,["aria-label"])]),_:1})):_("",!0)],2)):_("",!0)}const bs=I($P,[["render",LP]]),PP={name:"LockscreenView",components:{CustomLockscreenView:Ao,DefaultLockscreenPaywall:Bo,WelcomeBanner:bs},props:["space_profile","sections"],emits:["join"],data(){return{isRedirecting:!1}},created(){var e,t,s,u;((t=(e=this.space_profile)==null?void 0:e.settings)==null?void 0:t.custom_lock_screen)=="redirect"&&((u=(s=this.space_profile)==null?void 0:s.settings)!=null&&u.onboard_redirect_url)&&(this.isRedirecting=!0,window.location.href=this.space_profile.settings.onboard_redirect_url)}},FP={key:0,style:{"text-align":"center",margin:"50px 0"}},IP={key:0,class:"space_default_lockscreen"},EP={class:"space_lock_box space_default_lock_box"},UP={key:0,class:"lock_desc"},AP={key:1,class:"lock_desc"},BP=["href"],DP={key:1,class:"space_lock_box"},RP={key:2,class:"space_lock_box"},xP=["href"];function HP(e,t,s,u,o,i){var b;const m=p("welcome-banner"),f=p("Lock"),h=O,g=p("default-lockscreen-paywall"),k=p("custom-lockscreen-view");return o.isRedirecting?(n(),c("h3",FP,d(e.$t("Please wait....")),1)):(n(),c(P,{key:1},[s.space_profile.lockscreen_config?(n(),c(P,{key:0},[s.space_profile.lockscreen_config.showCustom?(n(),y(k,{key:1,sections:s.sections,profile:s.space_profile},null,8,["sections","profile"])):(n(),c("div",IP,[s.space_profile.welcome_banner&&s.space_profile.lockscreen_config.showWelcomeBanner?(n(),y(m,{key:0,config:s.space_profile.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.space_profile.id+(s.space_profile.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",EP,[a(h,null,{default:r(()=>[a(f)]),_:1}),l("h4",null,d(e.$t("This is a private course")),1),s.space_profile.lockscreen_config.showPaywalls?(n(),c("p",UP,d(e.$t("Purchase access below or log in if you are already a member.")),1)):(n(),c("p",AP,d(e.$t("Members have to be invited to this course.")),1)),e.auth.user_id?_("",!0):(n(),c("a",{key:2,href:e.getCurrentAuthUrl(),class:"fcom_btn el-button el-button--primary"},d(e.$t("Login or Signup")),9,BP))]),s.space_profile.lockscreen_config.showPaywalls?(n(),y(g,{key:1,space_id:(b=s.space_profile)==null?void 0:b.id},null,8,["space_id"])):_("",!0)]))],64)):s.space_profile.permissions.is_pending?(n(),c("div",DP,[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):(n(),c("div",RP,[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,xP)]))],64))}const OP=I(PP,[["render",HP]]),jP={name:"CollapseIcon"},NP={width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function zP(e,t,s,u,o,i){return n(),c("svg",NP,[...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 qP=I(jP,[["render",zP]]),GP={name:"ViewCourse",components:{VideoPlay:eo,RenderSpaceLinks:ys,LockScreenView:OP,AppLayout:Me,Layout:$e,CircleIcon:vs,LockIcon:CP,SocialLinks:Rt,PlayIcon:Lo,LessonIcon:To,PlayPlaceholderIcon:Po,CollapseIcon:qP,WelcomeBanner:bs,ActionPopover:pt},props:["course","sections","track","lessonsCount"],$emit:["setNextLesson","goToLesson","reload"],data(){return{enrolling:!1,restarting:!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((s,u)=>s+(u.meta.video_length||0),0);return this.formatSeconds(t)||null}},isCollapsed(){return this.sections.some(e=>e.is_closed)},showSidebar(){return!this.isMobile&&(this.track.isEnrolled||this.course.creator)}},methods:{toggleAllSections(){const e=this.isCollapsed;this.sections.forEach(t=>{t.is_closed=!e})},isEnabledMedia(e){var t;return((t=e.meta)==null?void 0:t.enable_media)=="yes"},showPlayIcon(e){return this.hasMediaVideo(e)&&(this.hasMediaImage(e)||e.featured_image)},hasMediaVideo(e){var s;const t=(s=e.meta)==null?void 0:s.media;return this.isEnabledMedia(e)&&(t==null?void 0:t.content_type)=="video"&&(!!(t!=null&&t.html)||(t==null?void 0:t.type)=="fluent_player")},hasMediaImage(e){var t,s;return this.isEnabledMedia(e)&&((s=(t=e.meta)==null?void 0:t.media)==null?void 0:s.image)},isFreePreview(e){var t;return this.has_pro&&((t=e==null?void 0:e.meta)==null?void 0:t.free_preview_lesson)=="yes"},isLockLesson(e,t){return(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")},handleRestartCourse(e){!this.track.progress||this.restarting||(e(),this.restartCourse())},restartCourse(){this.$confirm(this.$t("This will reset your progress for this course to 0%. Continue?"),this.$t("Restart Course"),{confirmButtonText:this.$t("Yes, restart"),cancelButtonText:this.$t("Cancel"),confirmButtonClass:"fcom_primary_button",cancelButtonClass:"fcom_secondary_button",type:"warning"}).then(()=>{this.restarting=!0,this.$del("courses/"+this.course.id+"/progress").then(e=>{this.$notify.success(e.message),this.$emit("reload")}).catch(e=>{this.$handleError(e)}).finally(()=>{this.restarting=!1})}).catch(()=>{})},maybeGotoLesson(e,t,s){if(e.can_view){this.$emit("goToLesson",e.slug);return}if(!t.isEnrolled){this.$notify.info({message:this.$t("You need to enroll in this course to access this lesson"),type:"info"});return}if(s.is_locked){s.unlock_date&&this.$notify.info({message:this.$t("This lesson will be unlocked on %s",s.unlock_date),type:"info"});return}if(e.lock_type==="sequential"){this.$notify.info({message:this.$t("Complete the previous lesson to unlock this one."),type:"info"});return}this.$notify.info({message:this.$t("This lesson is locked."),type:"info"})},formatSeconds(e){if(e<1)return null;let t=Math.floor(e/3600),s=Math.floor(e%3600/60),u=e%60,o="";return t>0&&(o+=this.$t("%dh ",t)),s>0&&(o+=this.$t("%dm ",s)),u>0&&(o+=this.$t("%ds",u)),o.trim()||null}},mounted(){this.appVars.course_sections_collapsed=="yes"&&this.toggleAllSections()}},YP=["href"],WP={class:"fcom_course_actions"},ZP=["href"];const KP={key:0,class:"fcom_sub_header"},JP={key:0,class:"fcom_notice"},QP={class:"fcom_feed_box course_box"},XP={class:"fcom_course_sections"},eF={class:"fcom_course_intro"},tF={class:"fcom_course_labels"},sF={class:"fcom_course_info"},oF=["innerHTML"],iF={class:"fcom_card_sections"},nF={class:"fcom_section_items"},lF=["onClick"],aF={class:"fcom_section_primary_item_title"},rF={class:"title_line_container"},cF={class:"title_line"},dF={key:0,class:"section_lock_badge"},uF={class:"fcom_meta_text"},_F={key:0,class:"fcom_meta_text"},mF={class:"fcom_section_primary_item_actions"},hF=["onClick"],fF={class:"fcom_heading_item clickable"},pF={class:"lesson_feature_media"},gF=["src","alt"],yF=["src","alt"],vF={class:"lesson_title"},bF=["innerHTML"],kF={class:"lesson_duration"},wF={key:0},CF={key:1},$F=["innerHTML"],SF={key:0,class:"fcom_section_item_actions"},VF={class:"fcom_meta_text"},MF={class:"fcom_main_side_wrap"},TF={class:"fcom_side_box"},LF={key:0,class:"app_side_widget course_widget"},PF={class:"widget_header"},FF={class:"widget_body"},IF={class:"progress_label"},EF={key:0,style:{margin:"20px 0"}},UF={key:1,class:"app_side_widget course_widget"},AF={class:"widget_header"},BF={class:"widget_body"},DF={class:"creator_details"},RF={class:"creator_details_item"},xF={class:"creator_details_info"},HF={class:"info_text"},OF={class:"details_name"},jF={class:"details_meta"},NF={class:"fcom_meta_text"},zF={key:0,class:"fcom_meta_text"},qF=["innerHTML"],GF={key:2};function YF(e,t,s,u,o,i){const m=ls,f=as,h=H,g=p("action-popover"),k=p("render-space-links"),b=p("welcome-banner"),w=p("CollapseIcon"),S=p("Lock"),C=O,v=p("ArrowRight"),$=p("ArrowDown"),T=p("SuccessFilled"),V=p("LockIcon"),F=p("CircleIcon"),L=p("PlayPlaceholderIcon"),A=p("LessonIcon"),D=p("PlayIcon"),U=p("VideoPlay"),E=Le,q=os,j=p("UserAvatar"),N=p("UserRouteLink"),W=p("SocialLinks"),le=et,B=qe,J=p("LockScreenView"),me=p("layout"),Q=p("app-layout"),he=ee("loading");return n(),y(Q,{wrapper_class:"fcom_single_layout fcom_max_layout fcom_course_view_layout"},{default:r(()=>[a(me,{wrapper_class:["no_bg_layout",{custom_lockscreen:!i.showCourseSections}],title:e.$t("Courses")},{title:r(()=>[a(f,{"separator-class":"el-icon-arrow-right"},{default:r(()=>[a(m,{to:{name:"courses"}},{default:r(()=>[M(d(e.$t("Courses")),1)]),_:1}),a(m,null,{default:r(()=>[M(d(s.course.title)+" ",1),s.course.is_course_admin?(n(),c("a",{key:0,class:"fcom_edit_course fcom_secondary_button",style:{cursor:"pointer"},href:i.editLessonLink()},d(e.$t("Edit Lessons")),9,YP)):_("",!0)]),_:1})]),_:1})]),actions:r(()=>[l("div",WP,[e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),y(h,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[he,o.enrolling]]):s.track.isEnrolled?(n(),c(P,{key:2},[s.track.progress!=100?(n(),y(h,{key:0,class:"fcom_primary_button",onClick:i.continueCourse},{default:r(()=>[M(d(e.$t("Continue Course")),1)]),_:1},8,["onClick"])):_("",!0),_("",!0)],64)):_("",!0):(n(),c(P,{key:0},[i.isCustomLockScreen?_("",!0):(n(),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,ZP))],64))])]),sub_header:r(()=>{var X,se;return[s.course&&i.showCourseSections&&((se=(X=s.course)==null?void 0:X.settings)!=null&&se.links.length)?(n(),c("div",KP,[a(k,{links:s.course.settings.links},null,8,["links"])])):_("",!0)]}),default:r(()=>[s.course.status==="draft"?(n(),c("div",JP,[l("p",null,d(e.$t("This course is in Draft status and only visible to Admin / Moderators")),1)])):_("",!0),i.showCourseSections?(n(),y(B,{key:1,class:"fcom_resp_container fcom_space_container fcom_main_container"},{default:r(()=>[a(E,{class:"fcom_main"},{default:r(()=>{var X;return[s.course.welcome_banner?(n(),y(b,{key:0,config:s.course.welcome_banner,"close-key":"fcom_course_welcome_banner_closed_"+s.course.id+(s.course.isEnrolled?"_enrolled":"_not_enrolled"),"wrapper-class":"fcom_course_welcome_box","content-class":"fcom_course_welcome_content"},null,8,["config","close-key"])):_("",!0),l("div",QP,[l("div",XP,[l("div",eF,[l("div",tF,[l("h3",null,d(s.course.title),1),l("p",sF,[M(d(e.$_n("%s Topic","%s Topics",i.sectionsCount))+" ",1),t[0]||(t[0]=l("span",null," • ",-1)),M(" "+d(e.$_n("%s Lesson","%s Lessons",s.lessonsCount)),1)])])]),(X=s.course.settings)!=null&&X.course_details_rendered?(n(),c("div",{key:0,class:"fcom_course_details feed_md_content",innerHTML:s.course.settings.course_details_rendered},null,8,oF)):_("",!0),l("div",{class:x(["course_contents_header",{is_collapsed:i.isCollapsed}])},[l("h4",null,d(e.$t("Course Contents")),1),i.sectionsCount>1?(n(),y(w,{key:0,class:"collapse_icon clickable",onClick:i.toggleAllSections},null,8,["onClick"])):_("",!0)],2),l("div",iF,[l("div",nF,[(n(!0),c(P,null,R(s.sections,se=>(n(),c("div",{key:se.id,class:"fcom_section_primary"},[l("div",{onClick:oe=>se.is_closed=!se.is_closed,class:x(["clickable fcom_section_primary_item",{is_closed:se.is_closed}])},[l("div",aF,[l("div",rF,[l("div",cF,[l("h4",null,d(se.title),1),se.unlock_date?(n(),c("span",dF,[se.is_locked?(n(),y(C,{key:0},{default:r(()=>[a(S)]),_:1})):_("",!0),l("span",null," ("+d(e.$t("will unlock at %s",e.smartDate(se.unlock_date,!0,!0)))+") ",1)])):_("",!0)]),l("span",uF,d(e.$_n("%s lesson","%s lessons",se.lessons.length)),1),i.lessonDuration(se)?(n(),c("span",_F," • "+d(i.lessonDuration(se)),1)):_("",!0)])]),l("div",mF,[a(C,null,{default:r(()=>[se.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y($,{key:1}))]),_:2},1024)])],10,lF),se.is_closed?_("",!0):(n(!0),c(P,{key:0},R(se.lessons,oe=>(n(),c("div",{key:oe.id,class:x(["fcom_section_item",{is_locked:i.isLockLesson(se,oe)}])},[l("div",{onClick:bt=>i.maybeGotoLesson(oe,s.track,se),class:"fcom_section_item_title"},[l("p",fF,[s.track.completed_lessons.includes(oe.id.toString())?(n(),y(C,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(T)]),_:1})):i.isLockLesson(se,oe)?(n(),y(C,{key:1},{default:r(()=>[a(V)]),_:1})):(n(),y(C,{key:2},{default:r(()=>[a(F)]),_:1})),i.isModernLayout?(n(),c(P,{key:3},[l("span",pF,[oe.featured_image?(n(),c("img",{key:0,src:oe.featured_image,alt:oe.title},null,8,gF)):i.hasMediaImage(oe)?(n(),c("img",{key:1,src:oe.meta.media.image,alt:oe.title},null,8,yF)):i.hasMediaVideo(oe)?(n(),y(L,{key:2})):(n(),y(A,{key:3})),i.showPlayIcon(oe)?(n(),y(D,{key:4,class:"play_icon"})):_("",!0)]),l("span",vF,[l("span",{innerHTML:oe.title},null,8,bF),l("span",kF,[oe.meta.video_length?(n(),c("span",wF,d(i.formatSeconds(oe.meta.video_length)),1)):(n(),c("span",CF,d("---")))])])],64)):(n(),c("span",{key:4,innerHTML:oe.title},null,8,$F))])],8,hF),!i.isModernLayout&&oe.meta.enable_media=="yes"&&oe.meta.video_length?(n(),c("div",SF,[l("span",VF,[oe.meta.video_length?(n(),y(h,{key:0,onClick:bt=>i.maybeGotoLesson(oe,s.track,se),text:""},{default:r(()=>[a(C,{class:"fcom_play_btn_icon"},{default:r(()=>[a(U)]),_:1}),l("span",null,d(i.formatSeconds(oe.meta.video_length)),1)]),_:2},1032,["onClick"])):_("",!0)])])):_("",!0)],2))),128))]))),128))])])])])]}),_:1}),i.showSidebar?(n(),y(le,{key:0,class:"fcom_resp_side",width:"306px"},{default:r(()=>[l("div",MF,[l("div",TF,[s.track.isEnrolled?(n(),c("div",LF,[l("div",PF,[l("h3",null,d(e.$t("Course progress")),1)]),l("div",FF,[l("div",IF,[l("p",null,d(e.$t("Completed %1$s of %2$s",s.track.completed_lessons.length,s.lessonsCount)),1),l("span",null,d(parseInt(s.track.progress))+"%",1)]),a(q,{class:"fcom_progress","stroke-width":10,percentage:parseInt(s.track.progress),"show-text":!1},null,8,["percentage"]),s.track.progress==100?(n(),c("div",EF,[l("h5",null,d(e.$t("Congratulations! Course completed! 🎉")),1)])):_("",!0)])])):_("",!0),s.course.creator?(n(),c("div",UF,[l("div",AF,[l("h3",null,d(e.$t("Course Instructor")),1)]),l("div",BF,[l("div",DF,[l("div",RF,[l("div",xF,[a(j,{with_level:!1,xprofile:s.course.creator},null,8,["xprofile"]),l("div",HF,[l("div",OF,[a(N,{show_badge:!0,xprofile:s.course.creator},null,8,["xprofile"])]),l("div",jF,[l("span",NF,d(e.$_n("%d Course","%d Courses",s.course.creator.total_courses)),1),s.course.creator.total_students?(n(),c("span",zF," • "+d(e.$_n("%d Student","%d Students",s.course.creator.total_students)),1)):_("",!0)])])]),s.course.creator.short_description_rendered?(n(),c("div",{key:0,class:"creator_details_description feed_md_content",innerHTML:s.course.creator.short_description_rendered},null,8,qF)):_("",!0)]),a(W,{xprofile:s.course.creator},null,8,["xprofile"])])])])):_("",!0)])])]),_:1})):_("",!0)]),_:1})):_("",!0),i.showCourseSections?_("",!0):(n(),c("div",GF,[a(J,{space_profile:s.course,sections:s.sections},null,8,["space_profile","sections"])]))]),_:1},8,["wrapper_class","title"])]),_:1})}const WF=I(GP,[["render",YF]]),ZF={name:"CommentBox",mixins:[Dt],components:{FeedComments:fo,FeedTextComposer:gt},props:{feed:{type:Object,required:!0},showAll:{type:Boolean,default:!0},checkPermission:{type:Boolean,default:!0},is_single:{type:Boolean,default:!0},show_comment_form:{type:Boolean,default:!0}},data(){return{show_all_comments:this.showAll,commenting:!1,comment:{message:"",media_images:[]},saving:!1,showCommentBox:!0,sortBy:"oldest"}},methods:{postComment(){var t,s,u;const e=((t=this.comment.media_images)==null?void 0:t.length)>0||((u=(s=this.comment.meta)==null?void 0:s.media_preview)==null?void 0:u.image);!this.comment.message&&!e||(this.saving=!0,this.$post("feeds/"+this.feed.id+"/comments",{comment:this.comment.message,media_images:this.comment.media_images,meta:this.comment.meta}).then(o=>{this.feed.comments||(this.feed.comments=[]),this.feed.comments.unshift(o.comment),this.$emit("commented",o.comment),this.$eventBus.emit("recent_activities_refresh"),this.feed.comments_count=parseInt(this.feed.comments_count)+1,this.commenting=!1,this.comment=null,this.showCommentBox=!1,this.$nextTick(()=>{this.scrollCommentIntoView(o.comment.id),this.comment={message:"",media_image:""}}),this.showCommentBox=!0}).catch(o=>{this.$handleError(o)}).finally(()=>{this.saving=!1}))},showCommentForm(){this.show_all_comments=!0,this.commenting=!0,this.$nextTick(()=>{this.$refs.commentInput&&this.$refs.commentInput.focus()})},showAllComments(){this.show_all_comments=!0,this.commenting=!0},getSpaceId(){var e,t;return((e=this.feed)==null?void 0:e.course_id)||((t=this.feed)==null?void 0:t.space_id)},changeCommentsSortBy(){this.$storeLocalData("comments_sort_by",this.sortBy)}},mounted(){let e=this.feed.default_comment_sort_by||"oldest";this.sortBy=this.$getLocalData("comments_sort_by",e)}},KF=["id"],JF={key:0,class:"feed_commenting"},QF={class:"person_avatar"},XF=["src"],eI={key:0,class:"feed_comment_input"},tI={key:1,class:""},sI={style:{padding:"0",margin:"0","text-align":"center"}},oI={key:0,class:"fcom_comment_sorting"};function iI(e,t,s,u,o,i){const m=H,f=p("feed-text-composer"),h=p("router-link"),g=ie,k=ne,b=p("feed-comments");return n(),c("div",{class:x(["fcom_comment_box","fcom_comment_box_"+s.feed.type])},[G(e.$slots,"before_comment_box"),(o.commenting||s.is_single)&&s.show_comment_form?(n(),c("div",{key:0,id:"feed_comment_form_"+s.feed.id,class:"feed_comment"},[!s.checkPermission||e.hasCommentPermission(s.feed)?(n(),c(P,{key:0},[o.comment?(n(),c("div",JF,[l("div",QF,[l("img",{alt:"",src:e.auth.avatar},null,8,XF)]),o.showCommentBox?(n(),c("div",eI,[a(f,{context:"comment",mentionQuery:{space_id:i.getSpaceId()},autofocus_changed:o.commenting,autofocus:o.commenting,disabled:o.saving,placeholder:e.$t("Write a comment"),content:o.comment},{default:r(()=>[a(m,{loading:o.saving,disabled:o.saving,class:"fcom_primary_button",size:"small",onClick:t[0]||(t[0]=w=>i.postComment())},{default:r(()=>[M(d(e.$t("Post Comment")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["mentionQuery","autofocus_changed","autofocus","disabled","placeholder","content"])])):_("",!0)])):_("",!0)],64)):(n(),c("div",tI,[l("p",sI,[M(d(e.$t("Please join the Space to post a comment."))+" ",1),s.feed.space?(n(),y(h,{key:0,to:{name:"space_feeds",params:{space:s.feed.space.slug}}},{default:r(()=>[M(d(e.$t("Go to community")),1)]),_:1},8,["to"])):_("",!0)])]))],8,KF)):_("",!0),a(b,{sortBy:o.sortBy,checkPermission:s.checkPermission,onForceShowAll:i.showAllComments,show_all:o.show_all_comments,feed:s.feed},{before_comments_start:r(()=>[s.feed.comments_count>=2?(n(),c("div",oI,[a(k,{"aria-label":e.$t("Sort comments by"),onChange:t[1]||(t[1]=w=>i.changeCommentsSortBy()),modelValue:o.sortBy,"onUpdate:modelValue":t[2]||(t[2]=w=>o.sortBy=w),class:"fcom_off_color fcom_minimal_select","popper-class":"plain_select",placeholder:e.$t("Sort by")},{default:r(()=>[a(g,{value:"oldest",label:e.$t("Earliest")},null,8,["label"]),a(g,{value:"latest",label:e.$t("Latest")},null,8,["label"]),a(g,{value:"popular",label:e.$t("Popular")},null,8,["label"]),a(g,{value:"most_replied",label:e.$t("Most Replied")},null,8,["label"])]),_:1},8,["aria-label","modelValue","placeholder"])])):_("",!0)]),_:1},8,["sortBy","checkPermission","onForceShowAll","show_all","feed"]),G(e.$slots,"after_comment_box")],2)}const nI=I(ZF,[["render",iI]]),lI={name:"ExitFullScreen"},aI={viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"};function rI(e,t,s,u,o,i){return n(),c("svg",aI,[...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 cI=I(lI,[["render",rI]]),dI={name:"QuizView",props:{lesson:{type:Object,required:!0},isEnrolled:{type:Boolean,required:!0},questions:{type:Array,required:!0}},components:{Check:Qs},data(){return{userResult:{},answers:this.initAnswers(),isNew:!1,submitting:!1,loading:!1}},computed:{alreadyAttempted(){var e;return(e=this.userResult)==null?void 0:e.id},isAllAnswersSelected(){return this.questions.every(e=>this.isSingleChoice(e)?this.answers[e.slug]!==null:this.isWrittenAnswer(e)?this.answers[e.slug]&&this.answers[e.slug].trim()!=="":this.answers[e.slug]&&this.answers[e.slug].length>0)},quizSettings(){return this.lesson.meta},showResult(){var e;return this.quizSettings.hide_result=="no"&&((e=this.userResult)==null?void 0:e.id)},isPassed(){var e;return((e=this.userResult)==null?void 0:e.status)==="passed"}},methods:{initAnswers(){return this.questions.reduce((e,t)=>(t.type=="single_choice"?e[t.slug]=null:t.type=="written_answer"?e[t.slug]="":e[t.slug]=[],e),{})},syncAnswers(){var t;const e=((t=this.userResult)==null?void 0:t.message)||[];this.answers=this.initAnswers(),e&&nn.each(e,(s,u)=>{this.answers[u]=s.user_answer})},retakeQuiz(){this.answers=this.initAnswers(),this.userResult={},this.submitting=!1,this.loading=!1,this.isNew=!0},showQuestion(e){var s;if(!this.alreadyAttempted)return!0;const t=((s=this.userResult)==null?void 0:s.message)||[];return!!(this.isNew||t[e.slug])},isSingleChoice(e){return e.type=="single_choice"},isMultipleChoice(e){return e.type=="multiple_choice"},isWrittenAnswer(e){return e.type=="written_answer"},isExactMatchQuestion(e){return e.grading_mode==="exact_match"},freeTextBadgeClass(e){return this.isExactMatchQuestion(e)?this.isQuestionCorrect(e)?"correct":"incorrect":"correct"},showQuestionImage(e){return e.image_enabled&&e.image_url},isQuestionCorrect(e){var t,s,u;return(u=(s=(t=this.userResult)==null?void 0:t.message)==null?void 0:s[e.slug])==null?void 0:u.is_correct},isOptionSelected(e,t){return this.isSingleChoice(e)?this.answers[e.slug]===t.label:(this.answers[e.slug]||[]).includes(t.label)},handleOptionChange(e,t){if(this.isSingleChoice(e)&&(this.answers[e.slug]===t.label?this.answers[e.slug]=null:this.answers[e.slug]=t.label),this.isMultipleChoice(e)){const s=this.answers[e.slug]||[];s.indexOf(t.label)>-1?this.answers[e.slug]=s.filter(o=>o!==t.label):this.answers[e.slug]=[...s,t.label]}},fetchAnswers(){this.loading=!0,this.$get("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/result").then(e=>{this.userResult=e.result||{},this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})},submitQuiz(){this.has_pro&&(this.submitting=!0,this.$post("courses/"+this.lesson.course_id+"/lessons/"+this.lesson.id+"/quiz/submit",{course_id:this.lesson.course_id,lesson_id:this.lesson.id,answers:this.answers}).then(e=>{this.$notify.success(e.message),this.userResult=e.result,this.isNew=!1,this.syncAnswers()}).catch(e=>{this.$handleError(e)}).finally(()=>{this.submitting=!1}))}},mounted(){this.isEnrolled&&this.has_pro&&this.fetchAnswers()}},uI={key:0,class:"fcom_questions_wrap"},_I={key:0,class:"fcom_quiz_result"},mI={class:"result_status"},hI={key:0,class:"result_status_text"},fI={key:0},pI={key:1},gI={class:"result_score"},yI={class:"score_part"},vI={class:"part_label"},bI={class:"part_value"},kI={class:"score_part"},wI={class:"part_label"},CI={class:"part_value"},$I={key:0,class:"fcom_question_image"},SI={class:"fcom_question_header"},VI=["innerHTML"],MI={class:"fcom_question_body"},TI={key:0,class:"correct_text"},LI={key:1,class:"correct_text"},PI={class:"fcom_written_answer_answer"},FI={key:1,class:"fcom_user_answer_text"},II={key:0,class:"correct_text"},EI={key:1,class:"correct_text"},UI={class:"fcom_question_options"},AI={key:2,class:"question_help_text"},BI={key:2,class:"fcom_quiz_footer"},DI={key:0};function RI(e,t,s,u,o,i){var C,v;const m=H,f=Fe,h=p("Check"),g=O,k=p("Close"),b=te,w=fe,S=Z;return n(),c(P,null,[o.loading?(n(),y(S,{key:1,rows:5,animated:""})):(n(),c("div",uI,[i.alreadyAttempted?(n(),c("div",_I,[l("div",mI,[["passed","failed"].includes(o.userResult.status)?(n(),c("div",hI,[l("p",null,[i.isPassed?(n(),c("span",fI,"🎉 ")):(n(),c("span",pI,"😞 ")),l("span",null,d(e.$t("You")),1),l("span",{style:re({color:i.isPassed?"green":"red"})},d(i.isPassed?" "+e.$t("passed")+" ":" "+e.$t("failed")+" "),5),l("span",null,d(e.$t("the quiz.")),1)]),l("p",null,d(i.isPassed?e.$t("Great job!"):e.$t("Try again!")),1)])):(n(),c(P,{key:1},[l("p",null,d(e.$t("We have saved your quiz results.")),1),l("p",null,d(e.$t("Please await the grading.")),1)],64)),a(m,{class:"fcom_secondary_button",onClick:i.retakeQuiz},{default:r(()=>[M(d(e.$t("Retake Quiz")),1)]),_:1},8,["onClick"])]),l("div",gI,[l("div",yI,[l("span",vI,d(e.$t("Score")),1),l("span",bI,d(o.userResult.score)+"%",1)]),l("div",kI,[l("span",wI,d(e.$t("Correct Answers")),1),l("span",CI,d(((C=o.userResult.meta)==null?void 0:C.correct_answers)+" / "+((v=o.userResult.meta)==null?void 0:v.total_questions)),1)])])])):_("",!0),(n(!0),c(P,null,R(s.questions,$=>(n(),c(P,{key:$.slug},[i.showQuestion($)?(n(),c("div",{key:0,class:x(["fcom_question",$.type])},[i.showQuestionImage($)?(n(),c("div",$I,[a(f,{src:$.image_url},null,8,["src"])])):_("",!0),l("div",SI,[l("div",{innerHTML:$.label_rendered,class:"fcom_question_label"},null,8,VI)]),l("div",MI,[i.isWrittenAnswer($)?(n(),c(P,{key:0},[i.showResult?(n(),c("div",{key:0,class:x(["fcom_is_correct",i.freeTextBadgeClass($)])},[i.isExactMatchQuestion($)?(n(),c("p",TI,[i.isQuestionCorrect($)?(n(),c(P,{key:0},[a(g,null,{default:r(()=>[a(h)]),_:1}),M(" "+d(e.$t("Correct")),1)],64)):(n(),c(P,{key:1},[a(g,null,{default:r(()=>[a(k)]),_:1}),M(" "+d(e.$t("Incorrect")),1)],64))])):(n(),c("p",LI,[a(g,null,{default:r(()=>[a(h)]),_:1}),M(" "+d(e.$t("Answered")),1)]))],2)):_("",!0),l("div",PI,[!i.alreadyAttempted||o.isNew?(n(),c(P,{key:0},[i.isExactMatchQuestion($)?(n(),y(b,{key:0,type:"text",modelValue:o.answers[$.slug],"onUpdate:modelValue":T=>o.answers[$.slug]=T,placeholder:e.$t("Type your answer"),maxlength:500},null,8,["modelValue","onUpdate:modelValue","placeholder"])):(n(),y(b,{key:1,type:"textarea",rows:4,modelValue:o.answers[$.slug],"onUpdate:modelValue":T=>o.answers[$.slug]=T,placeholder:e.$t("Write your answer here..."),maxlength:1e4,"show-word-limit":""},null,8,["modelValue","onUpdate:modelValue","placeholder"]))],64)):(n(),c("div",FI,d(o.answers[$.slug]),1))])],64)):(n(),c(P,{key:1},[i.showResult?(n(),c("div",{key:0,class:x(["fcom_is_correct",i.isQuestionCorrect($)?"correct":"incorrect"])},[i.isQuestionCorrect($)?(n(),c("p",II,[a(g,null,{default:r(()=>[a(h)]),_:1}),M(" "+d(e.$t("Correct")),1)])):(n(),c("p",EI,[a(g,null,{default:r(()=>[a(k)]),_:1}),M(" "+d(e.$t("Incorrect")),1)]))],2)):_("",!0),l("div",UI,[(n(!0),c(P,null,R($.options,T=>(n(),c("div",{key:T.label,class:"fcom_question_option"},[a(w,{class:x({single_choice:i.isSingleChoice($)}),"model-value":i.isOptionSelected($,T),onChange:V=>i.handleOptionChange($,T)},{default:r(()=>[M(d(T.label),1)]),_:2},1032,["class","model-value","onChange"])]))),128))])],64)),$.help_text?(n(),c("div",AI,d($.help_text),1)):_("",!0)])],2)):_("",!0)],64))),128))])),!o.loading&&!i.alreadyAttempted?(n(),c("div",BI,[l("p",null,d(e.$t("Answer all questions to submit")),1),a(m,{class:"fcom_primary_button",onClick:i.submitQuiz,loading:o.submitting,disabled:o.submitting||!i.isAllAnswersSelected},{default:r(()=>[M(d(e.$t("Submit Quiz"))+" ",1),e.has_pro?_("",!0):(n(),c("span",DI," ("+d(e.$t("Pro Required"))+")",1))]),_:1},8,["onClick","loading","disabled"])])):_("",!0)],64)}const xI=I(dI,[["render",RI]]),HI={name:"ViewLesson",components:{PaperClipIcon:co,DocumentLists:ot,CircleIcon:vs,AppLayout:Me,Layout:$e,MediaPreview:Oe,CommentBox:nI,ChatIcon:tt,ExitFullScreen:cI,QuizView:xI},props:["course","sections","track","currentLesson","lessonsCount","lesson_slug","currentLessonIndex"],emits:["setNextLesson","setPrevLesson","goToLesson","reload"],data(){return{completing:!1,isFullScreen:!1,sm_side_show:!1,isTransiting:!1,enrolling:!1,lightboxImages:[],lightboxIndex:0,_lightboxHandler:null}},watch:{currentLessonIndex(){this.sm_side_show=!1},lesson_slug(){this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this.currentLesson.slug&&this.currentLesson.slug!=this.lesson_slug&&this.gotoLesson({slug:this.lesson_slug})},"currentLesson.content":{handler(e){e&&this.$nextTick(()=>{var t;e.includes("<media-player")&&e.includes("fluent-player")&&document.dispatchEvent(new CustomEvent("FComMediaReady",{detail:{media:((t=this.currentLesson.meta)==null?void 0:t.media)||{},feed:this.currentLesson}})),this.setupLightboxImages()})},immediate:!0}},computed:{isCompleted(){return this.track.completed_lessons.includes(this.currentLesson.id.toString())},isQuizContent(){return this.currentLesson.content_type=="quiz"},commentsEnabled(){return this.course.settings.disable_comments!="yes"&&this.currentLesson.can_view&&this.currentLesson.meta.enable_comments==="yes"},containerHeight(){if(!this.isFullScreen){const e=document.querySelector(".fcom_mobile_menu");return`calc(100dvh - (var(--fcom-header-height, 0px) + ${e?e.offsetHeight:0}px))`}return"100dvh !important"},hasDocuments(){return this.currentLesson.meta.document_lists&&this.currentLesson.meta.document_lists.length>0},showMediaPreview(){var e,t,s,u,o,i;return((s=(t=(e=this.currentLesson)==null?void 0:e.meta)==null?void 0:t.media)==null?void 0:s.url)||((i=(o=(u=this.currentLesson)==null?void 0:u.meta)==null?void 0:o.media)==null?void 0:i.html)},isVideoGated(){var e,t;return!!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.is_video_gated)},isVideoGateLocked(){var e,t;return this.isCompleted||this.course.is_course_admin?!1:this.isVideoGated&&!((t=(e=this.currentLesson)==null?void 0:e.meta)!=null&&t.video_watched)}},methods:{markAsComplete(){if(this.isVideoGateLocked||this.completing)return;this.completing=!0;let e=this.isCompleted?"incomplete":"completed";this.$put("courses/"+this.course.id+"/lessons/"+this.currentLesson.id+"/completion",{state:e}).then(t=>{this.track.completed_lessons=t.track.completed_lessons,this.$emit("updateTrack",t.track),e=="completed"?this.$emit("setNextLesson"):this.isVideoGated&&(this.currentLesson.meta.video_watched=!1,document.dispatchEvent(new CustomEvent("FComLessonVideoUnwatched",{detail:{lessonId:this.currentLesson.id}})))}).catch(t=>{this.$handleError(t)}).finally(()=>{this.completing=!1})},toggleFullScreen(){this.isFullScreen=!this.isFullScreen,this.$storeLocalData("lesson_fs",this.isFullScreen?"yes":"no")},onFullScreenKeydown(e){e.key==="Escape"&&this.isFullScreen&&this.toggleFullScreen()},scrollToComments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_comments.offsetTop-100})},enroll(){this.enrolling=!0,this.$post("courses/"+this.course.id+"/enroll").then(e=>{this.$emit("reload"),this.$notify.success(e.message)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.enrolling=!1})},scrollToDocuments(){this.$refs.lesson_scroller&&this.$refs.lesson_scroller.scrollTo({top:this.$refs.fcom_course_documents.offsetTop-100})},gotoLesson(e){this.$emit("goToLesson",e.slug)},setupLightboxImages(){const e=this.$refs.lessonContent;if(!e)return;const t=e.querySelectorAll(".wp-lightbox-container img");if(!t.length)return;const s=Array.from(t).map(u=>u.src).filter(Boolean);s.length&&(this._lightboxHandler&&e.removeEventListener("click",this._lightboxHandler),this._lightboxHandler=u=>{const o=u.target.closest("img");u.target.closest(".wp-lightbox-container")&&o&&(u.preventDefault(),u.stopPropagation(),this.lightboxImages=s,this.lightboxIndex=Math.max(0,s.indexOf(o.src)))},e.addEventListener("click",this._lightboxHandler))},setSidebarScroll(){let e=document.getElementById("fcom_lesson_title_"+this.currentLesson.id),t=this.$refs.lesson_index_sidebar.wrapRef;const s=e.getBoundingClientRect(),u=t.getBoundingClientRect();s.top>=u.top&&s.bottom<=u.bottom&&s.left>=u.left&&s.right<=u.right||e.scrollIntoView({behavior:"instant",block:"center"})}},mounted(){this.isFullScreen=this.$getLocalData("lesson_fs",this.appVars.course_lesson_fullscreen)=="yes",window.scrollTo(0,0),this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(0),this.$route.query.comment_id&&setTimeout(()=>{let t=document.getElementById("comment_"+this.$route.query.comment_id);t&&(this.$refs.lesson_scroller&&this.$refs.lesson_scroller.setScrollTop(t.offsetTop),t.classList.add("fcom_highlight_comment"))},500),document.body.classList.add("fcom-no-scroll"),document.addEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler=t=>{var s,u,o;((s=t.detail)==null?void 0:s.lessonId)==((u=this.currentLesson)==null?void 0:u.id)&&((o=this.currentLesson)!=null&&o.meta)&&(this.currentLesson.meta.video_watched=!0)},document.addEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler=t=>{var o,i,m,f,h;const s=(o=t.detail)==null?void 0:o.lessonId;if(s!=((i=this.currentLesson)==null?void 0:i.id)||!((f=(m=this.currentLesson)==null?void 0:m.meta)!=null&&f.video_auto_complete)||!this.track.isEnrolled||this.isCompleted||this._autoCompleteTimer)return;const u=parseInt((h=window.fcomLessonVideoGate)==null?void 0:h.auto_complete_delay);this._autoCompleteTimer=setTimeout(()=>{var g;this._autoCompleteTimer=null,((g=this.currentLesson)==null?void 0:g.id)==s&&!this.isCompleted&&this.markAsComplete()},(isNaN(u)?3:u)*1e3)},document.addEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this.setSidebarScroll();const e=document.getElementById("fcom_lesson_inline_css");if(e&&e.remove(),this.currentLesson.inline_css){const t=document.createElement("style");t.type="text/css",t.id="fcom_lesson_inline_css",t.appendChild(document.createTextNode(this.currentLesson.inline_css)),document.head.appendChild(t)}},beforeUnmount(){document.body.classList.remove("fcom-no-scroll"),document.removeEventListener("keydown",this.onFullScreenKeydown),this._videoWatchedHandler&&document.removeEventListener("FComLessonVideoWatched",this._videoWatchedHandler),this._videoFullyWatchedHandler&&document.removeEventListener("FComLessonVideoFullyWatched",this._videoFullyWatchedHandler),this._autoCompleteTimer&&(clearTimeout(this._autoCompleteTimer),this._autoCompleteTimer=null),this._lightboxHandler&&this.$refs.lessonContent&&this.$refs.lessonContent.removeEventListener("click",this._lightboxHandler)}},OI={key:0},jI={class:"fcom_back_space"},NI={class:"fcom_lesson_details",style:{padding:"2rem"}},zI={class:"fcom_back_space"},qI={class:"fcom_lesson_name"},GI={class:"fcom_lesson_nav"},YI={key:1},WI=["href"],ZI={class:"fcom_lesson_details"},KI={class:"fcom_lesson_header"},JI={class:"fcom_lesson_title"},QI={class:"fcom_lesson_number"},XI=["href"],eE=["innerHTML"],tE={class:"fcom_lesson_nav"},sE=["innerHTML"],oE={class:"fcom_lesson_body feed_texts"},iE={key:0,class:"fcom_lesson_content"},nE=["innerHTML"],lE={key:0,class:"fcom_lesson_quiz"},aE={key:1,ref:"fcom_course_documents",class:"fcom_lesson_documents"},rE={class:"fcom_lesson_documents_header"},cE={key:0,class:"fcom_lesson_documents_list"},dE={key:0,ref:"fcom_course_comments",class:"fcom_lesson_comments"},uE={class:"fcom_lesson_comment_box"},_E={key:0,style:{"text-align":"center",padding:"20px","margin-top":"30px","border-radius":"8px","background-color":"var(--fcom-primary-bg, white)"}},mE={style:{padding:"0",margin:"0 0 20px"}},hE=["href"],fE={class:"fcom_section_sidebar_title"},pE={class:"fcom_section_items"},gE={class:"fcom_section_primary_item"},yE={class:"fcom_section_primary_item_title"},vE=["id","onClick"],bE={class:"fcom_heading_item clickable"},kE=["innerHTML"],wE={key:0,class:"fcom_section_footer course_progress_footer_wrap"},CE={class:"fcom_course_progress_footer"};function $E(e,t,s,u,o,i){const m=Z,f=p("ArrowLeft"),h=O,g=p("FullScreen"),k=p("ExitFullScreen"),b=H,w=p("ChatIcon"),S=p("PaperClipIcon"),C=p("Lock"),v=p("ArrowRight"),$=xe,T=p("Operation"),V=p("media-preview"),F=p("QuizView"),L=p("DocumentLists"),A=p("CommentBox"),D=Ce,U=Le,E=p("ArrowDown"),q=p("SuccessFilled"),j=p("CircleIcon"),N=os,W=et,le=Bs,B=qe,J=p("layout"),me=p("app-layout"),Q=ee("loading");return n(),y(me,{class:x({fcom_full_screen:o.isFullScreen,fcom_show_right_aside:o.sm_side_show}),wrapper_class:"fcom_single_layout fcom_full_layout"},{default:r(()=>[s.course&&s.currentLesson?(n(),y(J,{key:0,wrapper_class:"no_bg_layout"},{default:r(()=>[a(B,{class:"fcom_lesson_container fcom_resp_container"},{default:r(()=>[a(U,{style:re({height:i.containerHeight}),class:"fcom_lesson_wrap"},{default:r(()=>[o.isTransiting?(n(),c("div",OI,[Y((n(),c("div",jI,[...t[5]||(t[5]=[M(" ...... ",-1)])])),[[Q,!0]]),l("div",NI,[a(m,{rows:10,animated:!0})])])):(n(),y(D,{key:1,ref:"lesson_scroller"},{default:r(()=>{var he;return[l("div",zI,[l("div",{class:"clickable fcom_go_back",onClick:t[0]||(t[0]=X=>e.$router.push({name:"view_course"}))},[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(f)]),_:1}),l("span",qI,d(s.course.title),1)]),l("div",GI,[a(b,{title:o.isFullScreen?e.$t("Exit Full Screen"):e.$t("Go Full Screen"),onClick:i.toggleFullScreen,size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[o.isFullScreen?(n(),y(k,{key:1})):(n(),y(g,{key:0}))]),_:1})]),_:1},8,["title","onClick"]),s.currentLesson.can_view?(n(),c(P,{key:0},[i.commentsEnabled?(n(),y(b,{key:0,onClick:i.scrollToComments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(w)]),_:1})]),_:1},8,["onClick"])):_("",!0),i.hasDocuments?(n(),y(b,{key:1,onClick:i.scrollToDocuments,bg:"",size:"small",text:""},{default:r(()=>[a(h,null,{default:r(()=>[a(S)]),_:1})]),_:1},8,["onClick"])):_("",!0),s.track.isEnrolled?(n(),y($,{key:2,disabled:!i.isVideoGateLocked,content:e.$t("Watch the video to complete this lesson"),trigger:["hover","focus"],placement:"bottom"},{default:r(()=>[a(b,{class:x([i.isCompleted||i.isVideoGateLocked?"":"fcom_primary_button",{"is-disabled":i.isVideoGateLocked}]),"aria-disabled":i.isVideoGateLocked?"true":void 0,"aria-label":i.isVideoGateLocked?e.$t("Watch the video to complete this lesson"):void 0,loading:o.completing,style:{"margin-left":"15px"},type:"info",onClick:i.markAsComplete,size:"small"},{default:r(()=>[i.isCompleted?(n(),c("span",YI,d(e.$t("Completed")),1)):(n(),c(P,{key:0},[i.isVideoGateLocked?(n(),y(h,{key:0},{default:r(()=>[a(C)]),_:1})):_("",!0),l("span",null,d(e.$t("Complete Lesson")),1),i.isVideoGateLocked?_("",!0):(n(),y(h,{key:1,class:"fcom_arrow_icon"},{default:r(()=>[a(v)]),_:1}))],64))]),_:1},8,["class","aria-disabled","aria-label","loading","onClick"])]),_:1},8,["disabled","content"])):e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),y(b,{key:4,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Q,o.enrolling]]):_("",!0):(n(),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,WI))],64)):_("",!0),a(b,{style:{"margin-left":"15px"},size:"small",text:"",class:"fcom_sm_only",onClick:t[1]||(t[1]=X=>o.sm_side_show=!o.sm_side_show)},{default:r(()=>[a(h,null,{default:r(()=>[a(T)]),_:1})]),_:1})])]),l("div",ZI,[l("div",KI,[l("div",JI,[l("p",QI,[M(d(e.$t("Lesson %1$s of %2$s",s.currentLessonIndex+1,s.lessonsCount))+" ",1),e.isAdmin()?(n(),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:s.course.id,lesson_id:s.currentLesson.id})},d(i.isQuizContent?e.$t("Edit Quiz"):e.$t("Edit Lesson")),9,XI)):_("",!0)]),l("h1",{innerHTML:s.currentLesson.title},null,8,eE)]),l("div",tE,[a(b,{onClick:t[2]||(t[2]=X=>e.$emit("setPrevLesson")),disabled:s.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]=X=>e.$emit("setNextLesson")),disabled:s.currentLessonIndex+1===s.lessonsCount,size:"small"},{default:r(()=>[a(h,{class:"fcom_arrow_icon"},{default:r(()=>[a(v)]),_:1})]),_:1},8,["disabled"])])]),s.currentLesson.can_view?(n(),c(P,{key:1},[i.showMediaPreview?(n(),y(V,{key:0,media_item:s.currentLesson.meta.media},null,8,["media_item"])):_("",!0),l("div",oE,[s.currentLesson.content_loading?(n(),c("div",iE,[a(m,{rows:5,animated:!0})])):(n(),c(P,{key:1},[l("div",{ref:"lessonContent",class:"fcom_lesson_content feed_md_content",innerHTML:s.currentLesson.content},null,8,nE),(he=s.currentLesson.meta)!=null&&he.quiz_questions?(n(),c("div",lE,[a(F,{lesson:s.currentLesson,isEnrolled:s.track.isEnrolled,questions:s.currentLesson.meta.quiz_questions},null,8,["lesson","isEnrolled","questions"])])):_("",!0)],64))]),i.hasDocuments&&!s.currentLesson.content_loading?(n(),c("div",aE,[l("div",rE,[l("h3",null,d(e.$t("Documents & Files")),1)]),e.has_pro?(n(),c("div",cE,[a(L,{class:"fcom_boxed_documents",document_lists:s.currentLesson.meta.document_lists},null,8,["document_lists"])])):_("",!0)],512)):_("",!0)],64)):(n(),c("div",{key:0,class:"fcom_locked_container",innerHTML:s.currentLesson.access_message},null,8,sE))]),i.commentsEnabled&&!s.currentLesson.content_loading?(n(),c("div",dE,[l("div",uE,[a(A,{show_comment_form:s.track.isEnrolled,feed:s.currentLesson,showAll:!0,checkPermission:!0},ve({before_comment_box:r(()=>[l("h3",null,d(e.$t("Lesson Discussions")),1)]),_:2},[s.track.isEnrolled?void 0:{name:"after_comment_box",fn:r(()=>[!e.auth.user_id||s.course.can_self_enroll?(n(),c("div",_E,[l("p",mE,d(e.$t("Please enroll the course to join the conversation.")),1),e.auth.user_id?!s.track.isEnrolled&&s.course.id&&s.course.can_self_enroll?Y((n(),y(b,{key:1,disabled:o.enrolling,onClick:i.enroll,class:"fcom_primary_button"},{default:r(()=>[M(d(e.$t("Enroll in this course")),1)]),_:1},8,["disabled","onClick"])),[[Q,o.enrolling]]):_("",!0):(n(),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,hE))])):_("",!0)]),key:"0"}]),1032,["show_comment_form","feed"])])],512)):_("",!0)]}),_:1},512))]),_:1},8,["style"]),a(W,{class:"fcom_lesson_sidebar fcom_resp_side",width:"320px"},{default:r(()=>[a(D,{ref:"lesson_index_sidebar",height:i.containerHeight},{default:r(()=>[l("div",fE,[l("h3",null,d(e.$t("Lessons")),1)]),l("div",pE,[(n(!0),c(P,null,R(s.sections,he=>(n(),c("div",{key:he.id,class:"fcom_section_primary"},[l("div",gE,[l("div",yE,[a(h,{class:"clickable",onClick:X=>he.is_closed=!he.is_closed},{default:r(()=>[he.is_closed?(n(),y(v,{key:0,class:"fcom_arrow_icon"})):(n(),y(E,{key:1}))]),_:2},1032,["onClick"]),l("h4",null,d(he.title),1)])]),he.is_closed?_("",!0):(n(!0),c(P,{key:0},R(he.lessons,X=>(n(),c("div",{class:x([{fcom_current_lesson:X.id==s.currentLesson.id},"fcom_section_item"]),key:X.id},[l("div",{id:"fcom_lesson_title_"+X.id,onClick:se=>i.gotoLesson(X),class:"fcom_section_item_title"},[l("p",bE,[s.track.completed_lessons.includes(X.id.toString())?(n(),y(h,{key:0,style:{color:"#008a2e"}},{default:r(()=>[a(q)]),_:1})):X.can_view?(n(),y(h,{key:2},{default:r(()=>[a(j)]),_:1})):(n(),y(h,{key:1},{default:r(()=>[a(C)]),_:1})),l("span",{innerHTML:X.title},null,8,kE)])],8,vE)],2))),128))]))),128))]),s.track.progress?(n(),c("div",wE,[l("div",CE,[l("p",null,d(e.$t("Course progress")),1),a(N,{class:"fcom_progress","stroke-width":8,percentage:parseInt(s.track.progress)},null,8,["percentage"])])])):_("",!0)]),_:1},8,["height"])]),_:1}),o.lightboxImages.length?(n(),y(le,{key:0,"url-list":o.lightboxImages,"initial-index":o.lightboxIndex,"hide-on-click-modal":!0,"show-progress":o.lightboxImages.length>1,onClose:t[4]||(t[4]=he=>o.lightboxImages=[])},null,8,["url-list","initial-index","show-progress"])):_("",!0)]),_:1})]),_:1})):_("",!0)]),_:1},8,["class"])}const SE=I(HI,[["render",$E]]),VE={name:"LeaderLists",props:["leaders"],computed:{isAll(){return this.leaders.key==="all_time"}}},ME={class:"fcom_box_list"},TE={class:"fcom_box_list_header"},LE={class:"fcom_box_list_body"},PE={class:"fcom_person_lists"},FE={class:"fcom_leader"},IE={key:0,class:"fcom_serial_suffix"},EE={key:0,class:"fcom_leader_stat"};function UE(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink");return n(),c("div",ME,[l("div",TE,d(s.leaders.title),1),l("div",LE,[l("ul",PE,[(n(!0),c(P,null,R(s.leaders.items,(h,g)=>(n(),c("li",{key:h.user_id},[l("div",FE,[l("div",{class:x(["fcom_serial_"+(g+1),"fcom_serial"])},[l("span",null,d(g+1),1),g<3?(n(),c("div",IE,[...t[0]||(t[0]=[l("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M0 0L11 0V10.0442L5.73392 6.32786L0 10.0442L0 0Z",fill:"currentColor"})],-1)])])):_("",!0)],2),a(m,{with_level:!1,xprofile:h.xprofile},null,8,["xprofile"]),a(f,{show_badge:!0,xprofile:h.xprofile,show_follow:!0},null,8,["xprofile"])]),parseInt(h.total_points)?(n(),c("div",EE,[Y(l("span",null,"+",512),[[wt,!i.isAll]]),M(" "+d(h.total_points),1)])):_("",!0)]))),128))])])])}const AE=I(VE,[["render",UE]]),BE={name:"LeaderTooltip",components:{InfoFilled:Ft},props:{levelChunks:{type:Array,required:!0}}},DE={class:"fcoml_tooltip_content"},RE={class:"fcoml_tooltip_title"},xE={class:"fcoml_tooltip_subtitle"},HE=["innerHTML"],OE={class:"fcoml_tooltip_subtitle"},jE={class:"fcoml_tooltip_desc"},NE={class:"fcoml_tooltip_levels"},zE={class:"levels_list"},qE={class:"level_title"},GE={class:"level_points"};function YE(e,t,s,u,o,i){const m=p("InfoFilled"),f=O,h=H,g=ye;return n(),y(g,{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",DE,[l("h5",RE,d(e.$t("Leaderboard Points")),1),l("p",xE,d(e.$t("1 Like = 1 Point")),1),l("p",{class:"fcoml_tooltip_desc",innerHTML:e.$t("__LEADERBOARD_DESC_INS")},null,8,HE),l("p",OE,d(e.$t("Levels")),1),l("p",jE,d(e.$t("As you gain points, you level up. Your level is shown at the bottom right of your avatar.")),1),l("div",NE,[(n(!0),c(P,null,R(s.levelChunks,(k,b)=>(n(),c("div",{key:b},[l("ul",zE,[(n(!0),c(P,null,R(k,w=>(n(),c("li",{key:w.level,class:"level_item"},[l("div",qE,d(w.title),1),l("div",GE,d(e.$_n("%d point","%d points",w.min_points)),1)]))),128))])]))),128))])])]),_:1})}const WE=I(BE,[["render",YE]]),ZE={name:"LeaderBoard",components:{InfoFilled:Ft,LeaderLists:AE,AppLayout:Me,Layout:$e,LeaderTooltip:WE},data(){return{leaderboard:[],loading:!1}},computed:{userLevel(){return this.appVars.auth.user_id?Be(this.appVars.auth.total_points):null},requiredPoints(){return parseInt(this.userLevel.max_points)-parseInt(this.appVars.auth.total_points)+1},levelChunks(){let e=Object.values(this.appVars.leaderboard_levels);const t=Math.ceil(e.length/3);return e.reduce((s,u,o)=>{const i=Math.floor(o/t);return s[i]||(s[i]=[]),s[i].push(u),s},[])}},methods:{fetchLeaders(){this.loading=!0,this.$get("leaderboard").then(e=>{this.leaderboard=e.leaderboard,e.current_user_follows&&this.setFollowIds(e.current_user_follows)}).catch(e=>{this.$handleError(e)}).finally(()=>{this.loading=!1})}},mounted(){this.appVars.view_leaderboard_members&&this.fetchLeaders(),this.changeTitle(this.$t("Leaderboard"))}},KE={key:0,style:{"text-align":"center",padding:"20px 20px 40px"}},JE={class:"permission_failed"},QE=["href"],XE={key:0,class:"fcom_leaderboard_profile"},eU={class:"fcom_leaderboard_profile_inner"},tU={class:"fcom_profile_header"},sU={class:"fcom_profile_info"},oU={class:"info_avatar"},iU={class:"info_user"},nU={class:"fcom_level_name"},lU={class:"fcoml_level_sub"},aU={class:"fcoml_level_sub_icon"},rU={class:"fcoml_level_sub_text"},cU={class:"fcom_leaderboard_profile_avatar"},dU={class:"fcom_leaderboard_levels"},uU=["title"],_U={key:1},mU={class:"fcoml_level_detail"},hU={class:"fcoml_level_title"},fU={class:"fcoml_level_sub"},pU={class:"fcom_leaderboard_items"},gU={key:1,class:"white_loaded"};function yU(e,t,s,u,o,i){const m=p("UserAvatar"),f=p("UserRouteLink"),h=p("LeaderTooltip"),g=p("Lock"),k=O,b=ht,w=ft,S=p("leader-lists"),C=Z,v=p("layout"),$=p("app-layout");return n(),y($,{wrapper_class:"fcom_single_layout fcom_max_layout"},{default:r(()=>[a(v,{wrapper_class:"no_bg_layout",title:e.$t("Leaderboards")},{default:r(()=>[e.appVars.view_leaderboard_members?(n(),c(P,{key:1},[i.userLevel?(n(),c("div",XE,[l("div",eU,[l("div",tU,[l("div",sU,[l("div",oU,[a(m,{with_level:!0,with_completion:!0,xprofile:e.appVars.auth},null,8,["xprofile"])]),l("div",iU,[a(f,{show_badge:!0,show_pop:!1,xprofile:e.appVars.auth},null,8,["xprofile"]),l("div",nU,d(i.userLevel.title),1)])]),l("div",lU,[l("div",aU,[l("span",null,"🏆 "+d(e.auth.total_points),1),t[0]||(t[0]=M(" | ",-1)),l("span",null,d(e.$t("Level %d",i.userLevel.level)),1)]),l("div",rU,[M(d(e.$t("%d points to level up!",i.requiredPoints))+" ",1),a(h,{levelChunks:i.levelChunks},null,8,["levelChunks"])])])]),l("div",cU,[a(w,{gutter:20},{default:r(()=>[(n(!0),c(P,null,R(i.levelChunks,T=>(n(),y(b,{sm:24,md:8},{default:r(()=>[l("ul",dU,[(n(!0),c(P,null,R(T,V=>(n(),c("li",null,[l("div",{title:`${V.min_points} points`,class:x(["fcom_level_icon",{fcom_is_in_level:i.userLevel.max_points>=V.max_points}])},[i.userLevel.max_points<V.max_points?(n(),y(k,{key:0},{default:r(()=>[a(g)]),_:1})):(n(),c("span",_U,d(V.level),1))],10,uU),l("div",mU,[l("div",hU,d(V.title),1),l("div",fU,d(V.tagline),1)])]))),256))])]),_:2},1024))),256))]),_:1})])])])):_("",!0),l("div",pU,[a(w,{gutter:20},{default:r(()=>[(n(!0),c(P,null,R(o.leaderboard,T=>(n(),y(b,{key:T.key,md:8,sm:24},{default:r(()=>[a(S,{leaders:T},null,8,["leaders"])]),_:2},1024))),128))]),_:1})]),o.loading?(n(),c("div",gU,[a(C,{rows:16,animated:!0})])):_("",!0)],64)):(n(),c("div",KE,[l("div",JE,[l("h3",null,d(e.$t("Permission Denied")),1),l("p",null,d(e.$t("You do not have permission to view the leaderboard")),1),l("a",{href:e.$getRouteLink("/"),class:"el-button fcom_primary_button"},d(e.$t("Go To All Feeds")),9,QE)])]))]),_:1},8,["title"])]),_:1})}const vU=I(ZE,[["render",yU]]),bU=[{name:"dashboard",path:"/dashboard",component:Rv,meta:{active_menu:"dashboard",title:"Dashboard"}},{path:"/",component:e2,meta:{active_menu:"dashboard"},children:[{name:"all_feeds",path:"",component:c2},{name:"single_feed",path:"post/:feed_slug",component:Ls,props:!0}]},{path:"/space/:space/",component:d4,props:!0,meta:{in_space:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]},children:[{name:"space_home",path:"",component:p4,props:!0,meta:{show_sidebar:!0}},{name:"space_feeds",path:"home",component:f4,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_about",path:"about",component:Uo,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_feed",path:"post/:feed_slug",component:Ls,props:!0,meta:{in_space:!0,show_sidebar:!0}},{name:"space_members",path:"members",component:iC,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_invitations",path:"invitations",component:V$,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_documents",path:"documents",component:qC,props:!0,meta:{in_space:!0,show_sidebar:!1}},{name:"space_media",path:"media",component:W6,props:!0,meta:{in_space:!0,show_sidebar:!1}}]},{path:"/discover/spaces",name:"spaces",component:l7,meta:{active_menu:"spaces"}},{name:"all_members",path:"/members",component:bL,props:!0,meta:{active_menu:"all_members"}},{path:"/u/:username/",component:c9,props:!0,meta:{active_menu:"all_members"},children:[{name:"user_profile",path:"",component:rV,meta:{active_menu:"all_members"}},{name:"user_spaces",path:"spaces",component:mS,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"update_profile",path:"update",component:zS,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_profile_about",path:"about",component:Oo,meta:{active_menu:"all_members"}},{name:"user_profile_feeds",path:"posts",component:k9,meta:{active_menu:"all_members"}},{name:"user_scheduled_posts",path:"scheduled-posts",component:Y9,meta:{active_menu:"all_members"}},{name:"user_comments",path:"comments",component:wV,meta:{active_menu:"all_members"}},{name:"user_courses",path:"courses",component:GV,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_notification_settings",path:"notification-settings",component:qM,meta:{active_menu:"all_members",disable_sidebar:!0}},{name:"user_follows",path:"follow",component:zT,meta:{active_menu:"all_members"},children:[{name:"user_followers",path:"followers",component:mT,props:!0,meta:{active_menu:"all_members"}},{name:"user_followings",path:"followings",props:!0,component:AT,meta:{active_menu:"all_members"}}]}]},{path:"/notifications",name:"notifications",component:PL,meta:{}},{name:"bookmarks",path:"/bookmarks",component:BL,meta:{active_menu:"bookmarks"}},{name:"courses",path:"/courses",component:_P,meta:{active_menu:"courses",lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}},{path:"/course/:course_slug",component:vP,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:WF,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:SE,name:"view_lesson",meta:{in_course:!0,lazy_styles:["wp-block-library-css","fcom-block-content-styling-css"]}}]},{name:"leaderboards",path:"/leaderboards",component:vU,meta:{active_menu:"leaderboards"}}],kU={name:"NotFound",data(){return{message:this.$t("Please wait while we redirect you to the appropriate page.."),is404:!1,require_auth:!1}},methods:{lookForPost(e){this.$get("feeds/"+e+"/by-slug").then(t=>{this.$router.push({name:"single_feed",params:{feed_slug:e}})}).catch(t=>{this.$router.push({name:"all_feeds"}),this.is404=!0})}},mounted(){let e=this.$route.path;if(!e){this.message=this.$t("The requested page could not be found");return}e=e.replace(/^\/+/,"");let s=e.split("/")[0];if(s=="community"){e=e.replace(/^community\//,"/space/"),this.$router.push(e);return}else if(s=="fcom_route"){if(this.$route.query.route=="user_notification_settings")if(this.auth.username){this.$router.push({name:"user_notification_settings",params:{username:this.auth.username}});return}else{window.location.href=this.getCurrentAuthUrl();return}}else if(s=="u")if(this.auth.username){this.$router.push({name:"user_profile",params:{username:this.auth.username}});return}else{window.location.href=this.appVars.auth_url;return}this.lookForPost(s)}};function wU(e,t,s,u,o,i){return n(),c("h1",null,d(o.message),1)}const CU=I(kU,[["render",wU]]),$U=(e,{maxWaitMs:t=600,signal:s}={})=>new Promise(u=>{if(s!=null&&s.aborted)return u();const o=performance.now()+t,i=()=>{var h;if(s!=null&&s.aborted)return u();const m=(h=window.fcomLayoutRef)==null?void 0:h.wrapRef;m&&m.scrollHeight-m.clientHeight>=e||performance.now()>=o?u():requestAnimationFrame(i)};requestAnimationFrame(i)}),SU={name:"VerifiedSign"};function VU(e,t,s,u,o,i){const m=xe;return n(),y(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 MU=I(SU,[["render",VU]]),TU=[vi,Ws,bi,ki,qs,wi,Ci,$i,Si,Vi,Mi,Ti,Li,Pi,Fi,Ii,Ei,Ui,Zs,Ks,Ai,Bi,Di,Js,Ri,xi,Hi,Xs,Lt,Oi,ji,Ni,zi,rs,qi,Gi,Yi,Wi,Zi,Ki,Ji,Gs,Qi,Ft,Ee,Xi,eo];function _t(e){const t=[];if(typeof e=="object"&&e.join===void 0)for(const s in e)t.push(_t(e[s]));else if(typeof e=="object"&&e.join!==void 0)for(const s in e)t.push(_t(e[s]));else typeof e=="function"||typeof e=="string"&&t.push(e);return t.join("<br />")}function LU(e){let t;try{t=new URL(e)}catch{t=new URL(e,"https://fluentcommunity.co")}let s=t.pathname;return s=s.replace(/^\//,""),s.split("/")[0]||""}const de=Yo(Tv),ks=ii();ks.use(ni);ks.use(({store:e})=>{e.$api={get:(t,s)=>window.FluentCommunityUtil.Rest.get(t,s),post:(t,s)=>window.FluentCommunityUtil.Rest.post(t,s),put:(t,s)=>window.FluentCommunityUtil.Rest.put(t,s),patch:(t,s)=>window.FluentCommunityUtil.Rest.patch(t,s),delete:t=>window.FluentCommunityUtil.Rest.delete(t)}});de.use(ks);de.use(ti);var Es,Us;de.use(yi,{loading:(((Es=window.fluentComAdmin)==null?void 0:Es.assets_url)||"")+"images/image-loader.svg",error:(((Us=window.fluentComAdmin)==null?void 0:Us.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")}}});de.config.globalProperties.appVars=window.fluentComAdmin;de.config.globalProperties.auth=window.fluentComAdmin.auth;de.config.globalProperties.has_pro=!!window.fluentComAdmin.pro;let Xt="40%",es="60%",jo="500px";window.innerWidth<600?(es="95%",Xt="90%",jo="90%"):window.innerWidth<800&&(es="80%",Xt="80%");TU.forEach(e=>{de.component(e.name,e)});de.component("VerifiedSign",MU);de.component("UserAvatar",fs);de.component("UserRouteLink",Ie);de.component("WelcomeBanner",bs);de.component("UserBadge",Ho);function Is(){var k,b,w,S,C;de.use(window.FluentCommunityUtil.eventBus);const e=window.FluentCommunityUtil.Rest;de.mixin({data(){return{Storage:window.FluentCommunityUtil.Storage,is_rtl:!1,drawerWidth:Xt,dialogWidth:es,modalWidth:jo,feedMonitorCache:{},mounted:!1,isMobile:window.innerWidth<=768,has_leaderboard:this.appVars.features.leaderboard}},computed:{siteDateFormat(){return this.appVars.date_formatter||"MMM D, YYYY"},siteTimeFormat(){return this.appVars.time_formatter||"HH:mm"},siteDateTimeFormat(){return this.appVars.date_time_formatter||"MMM D, YYYY HH:mm"}},methods:{$get:e.get,$post:e.post,$uploadFile:e.uploadFile,$put:e.put,$del:e.delete,$patch:e.patch,$ajax:e.ajax,changeTitle(v){document.title=v+" - "+this.appVars.site_title},$handleError(v){let $="";typeof v=="string"?$=v:v&&v.message?$=v.message:$=_t(v),$||($="Something is wrong!"),typeof $!="string"&&($=_t($)),this.$notify({type:"error",title:this.$t("Error"),message:$,dangerouslyUseHTMLString:!0})},convertToText:_t,$t(v){v=window.fluentComAdmin.i18n[v]||v;const $=Array.prototype.slice.call(arguments,1);if($.length===0)return v;const T=/%(\d*)\$?s|%d/g;let V=0;return v=v.replace(T,(F,L)=>{if(L){const A=parseInt(L,10)-1;return A<$.length?$[A]:F}else return V<$.length?$[V++]:F}),v},$_n(v,$,T){return parseInt(T.toString().replace(/,/g,""),10)>1?this.$t($,T):this.$t(v,T)},$labelize(v){return v?(v=v.charAt(0).toUpperCase()+v.slice(1),window.fluentComAdmin.i18n[v]?window.fluentComAdmin.i18n[v]:v.replace(/_/g," ").replace(/\b\w/g,$=>$.toUpperCase())):""},$toClipboard(v,$="Copied to clipboard"){navigator.clipboard.writeText(v).then(()=>{this.$notify.success(this.$t($))}).catch(T=>{this.$notify.error(this.$t("Failed to copy"))})},dayjs,relativeTimeFromUtc(v){return dayjs.utc(v).local().fromNow()},$storeLocalData(v,$){this.Storage.set(v,$)},$getLocalData(v,$=""){return this.Storage.get(v,$)},ucFirst(v){return v?v.charAt(0).toUpperCase()+v.slice(1):""},convertTo24Hour(v){if(!v)return v;const $=v.match(/^(\d{1,2}):(\d{2})(?::\d{2})?\s*([AaPp][Mm])?$/);if(!$)return v;let T=parseInt($[1],10);const V=$[2],F=$[3];if(F){const L=F.toUpperCase()==="PM";L&&T!==12&&(T+=12),!L&&T===12&&(T=0)}return String(T).padStart(2,"0")+":"+V},ucWords(v){return v?v.replace(/\b[a-z]/g,function($){return $.toUpperCase()}):""},smartDate(v,$=!1,T=!1){if(!v)return"";const V=this.siteTimeFormat;let F="D MMM, YYYY";dayjs(v).isSame(new Date,"year")?(F="D MMM",$&&(Math.abs(dayjs(v).diff(new Date,"days"))<=5||T)&&(F="D MMM, "+V)):$&&T&&(F="D MMM, YYYY, "+V);const L=dayjs(v);return L.isValid()?L.format(F):null},hasPermission(v){return this.appVars.permissions[v]},isAdmin(){return!!this.appVars.permissions.community_admin},hasCourseAdminAccess(){return!!this.appVars.permissions.course_admin},hasCourseCreatorAccess(){return!!this.appVars.permissions.course_creator},hasSpaceAdminAccess(v=null){return this.hasPermissionOrInCurrentSpace("community_admin")||v&&this.isSpaceAdmin(v)},hasSpaceModeratorAccess(v=null){return this.hasPermissionOrInCurrentSpace("community_moderator")||v&&this.isSpaceModerator(v)},canDeleteFeed(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_feed"))},canEditFeed(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_feed"))},canDeleteComment(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("delete_any_comment"))},canEditComment(v){return this.auth.user_id&&(v.user_id==this.auth.user_id||this.hasPermissionOrInCurrentSpace("edit_any_comment"))},hasSpaceAccess(v){return v?this.appVars.user_membership_slugs.indexOf(v)!==-1:!0},$upgradeUrl(v,$){const T=this.appVars&&this.appVars.upgrade_url;if(!T)return T;try{const V=new URL(T);return v&&V.searchParams.set("utm_content",v),$&&V.searchParams.set("utm_campaign",$),V.toString()}catch{return T}},hasInPermission(v,$){return!$||typeof $!="object"?!1:$[v]},hasCurrentSpacePermission(v){return window.fcom_current_community?this.hasInPermission(v,window.fcom_current_community.permissions):!1},hasPermissionOrInCurrentSpace(v){return this.hasPermission(v)?!0:this.hasCurrentSpacePermission(v)},humanDateDiff(v){if(!v)return"";const $=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");if(!$.isValid())return"";const T=$.add(this.appVars.date_offset,"s");return dayjs(T.format("YYYY-MM-DD HH:mm:ss")).from(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss")))},isToday(v){return dayjs(v).isSame(dayjs(),"day")},isPastDate(v){if(!v)return!0;const $=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss");return $.isValid()?$.add(this.appVars.date_offset,"s").isBefore(dayjs(dayjs.utc().format("YYYY-MM-DD HH:mm:ss"))):!0},formattedDate(v){return dayjs(v).format(this.siteDateFormat)},formattedTime(v){return dayjs(v).format(this.siteTimeFormat)},formattedDateTime(v){return dayjs(v).format(this.siteDateTimeFormat)},hasCommentPermission(v){var $;return this.auth.user_id?!v.space_id&&!v.course_id?this.auth.user_id&&(v.user_id==this.auth.user_id||v.privacy=="public"):this.hasSpaceAccess(($=v.space)==null?void 0:$.slug):!1},getExcerpt(v,$=250){if(!v)return"";let T=v.replace(/(<([^>]+)>)/ig,"");return T=T.replace(/(\*\*|__)(.*?)\1/g,"$2"),T=T.replace(/(#+)(.*)/g,"$2"),T=T.replace(/\[(.*?)\]\((.*?)\)/g,"$1"),typeof DOMParser<"u"&&(T=new DOMParser().parseFromString(T,"text/html").body.textContent||""),T.length>$&&(T=T.substring(0,$)+"..."),T},mdToHtml(v){return v?(v=v.replace(" ","",v),v=v.replace(/\*\*(.*?)\*\*/g,"<strong>$1</strong>"),v=v.replace(/\*(.*?)\*/g,"<em>$1</em>"),v=v.replace(/\~\~(.*?)\~\~/g,"<del>$1</del>"),v=v.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),v=v.replace(/<(https?:\/\/[^\s>]+)>/g,'<a href="$1">$1</a>'),v=v.replace(/^##\s+(.*?)$/gm,"<h2>$1</h2>"),v=v.replace(/^###\s+(.*?)$/gm,"<h3>$1</h3>"),v=v.replace(/^####\s+(.*?)$/gm,"<h4>$1</h4>"),v=v.replace(/^>\s+(.*?)$/gm,"<blockquote>$1</blockquote>"),v=v.replace(/`{3}([\s\S]*?)`{3}/g,"<pre><code>$1</code></pre>"),v=v.replace(/`([^`]+)`/g,"<code>$1</code>"),v=v.replace(/^([\*\-])\s+(.*)$/gm,"<li>$2</li>"),v=v.replace(/(<li>.*?<\/li>(?:\n<li>.*?<\/li>)*)/g,function($){return"<ul>"+$.replace(/\n/g,"")+"</ul>"}),v=v.replace(/\n/g,"<br>"),v):""},$convertToBoolean(v){return v==="true"||v===!0||v===1||v==="1"||v==="yes"||v==="on"},each:je,hasFeature(v){return this.appVars.features[v]},isCommunityModerator(){return window.fluentComAdmin.auth.community_roles.some(v=>v==="admin"||v==="moderator")},isSpaceModerator(v){var T,V;return["admin","moderator"].includes((V=(T=v==null?void 0:v.membership)==null?void 0:T.pivot)==null?void 0:V.role)},isSpaceAdmin(v){var $,T;return((T=($=v==null?void 0:v.membership)==null?void 0:$.pivot)==null?void 0:T.role)=="admin"},isModerator(v){if(this.isCommunityModerator())return!0;if(!v)return!1;const $=this.auth.spaces[v];return this.isSpaceModerator($)},getCurrentAuthUrl(){let v=window.location.href,$=this.appVars.auth_url;return $=$.replace(/(\?|&)redirect_to=[^&]+/,""),$.indexOf("?")===-1?$+="?":$+="&",$+"redirect_to="+encodeURIComponent(v)},$formatNumber(v){return v&&v.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},$getRouteLink(v,$={}){return je($,(T,V)=>{v=v.replace(":"+V,T)}),this.appVars.portal_url+v},isOnline(v){if(!v)return!1;const T=dayjs.utc(v,"YYYY-MM-DD HH:mm:ss").add(this.appVars.date_offset,"seconds").diff(dayjs.utc(),"minutes");return T<=5&&T>=0},setFollowIds(v){De().setFollows(v)},$exportToCsv(v,$="fcom-export.csv"){if(!v||!Array.isArray(v)||v.length===0){this.$notify({type:"error",title:this.$t("Error"),message:this.$t("No data available to export.")});return}const T=Object.keys(v[0]),V=[T.join(",")];v.forEach(D=>{const U=T.map(E=>`"${String(D[E]??"").replace(/"/g,'""')}"`);V.push(U.join(","))});const F="\uFEFF"+V.join(` |
| 5 |
`),L=new Blob([F],{type:"text/csv;charset=utf-8;"}),A=document.createElement("a");A.href=URL.createObjectURL(L),A.download=$,document.body.appendChild(A),A.click(),document.body.removeChild(A),URL.revokeObjectURL(A.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",$=>{if($.metaKey||$.ctrlKey)return;const T=$.target.closest("a");if(T&&T.target==="_blank")return;let V=$.target.getAttribute("href");if(V||T&&(V=T.getAttribute("href")),!!V){if(window.fluentComAdmin.is_absolute_url){let F=LU(V);if(F){if(window.fluentComAdmin.portal_paths.indexOf(F)===-1){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}));return}}else{let L=window.location.origin,A=new URL(V).origin;if(L==A&&new URL(V).search){document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}));return}}}if(V.startsWith(window.fluentComAdmin.urls.portal_base)){if(V.indexOf("fcom_action")!==-1||V.startsWith(window.fluentComAdmin.urls.portal_base+"admin"))return;$.preventDefault(),V=V.replace(window.fluentComAdmin.urls.portal_base,"/"),this.$router.push(V)}else document.dispatchEvent(new CustomEvent("fcomExternalLinkClicked",{detail:{href:V}}))}});let v=window.fluentComAdmin.dateTime18n;dayjs.updateLocale("en",{weekdays:v.weekdays.split("_"),months:v.months.split("_"),weekdaysShort:v.weekdaysShort.split("_"),monthsShort:v.monthsShort.split("_"),weekdaysMin:v.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?v.relativeTimeMobile:v.relativeTime}),document.addEventListener("fcom_renew_rest_nonce",$=>{if(window.__fcomNonceRenewInFlight)return;window.__fcomNonceRenewInFlight=!0;const T=()=>{window.__fcomSessionExpiredShown||(window.__fcomSessionExpiredShown=!0,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:V=>{location.reload()}}))};this.$ajax("GET","fluent_community_renew_nonce",{ajax_nonce:window.fluentComAdmin.ajax_nonce}).then(V=>{V&&V.rest_nonce?(window.fluentComAdmin.rest.nonce=V.rest_nonce,window.fluentComAdmin.ajax_nonce=V.ajax_nonce,window.__fcomNonceRenewInFlight=!1):T()}).catch(()=>{T()})})}}),de.config.globalProperties.$notify=si,de.config.globalProperties.$confirm=Zt.confirm,de.config.globalProperties.$promt=Zt.prompt,de.config.globalProperties.$messageBox=Zt,de.config.globalProperties.$gloablStorage={},de.config.globalProperties.currentTimeZoneName=window.dayjs.tz.guess();const t=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_routes",bU);t.push({path:"/:catchAll(.*)",name:"not-found",component:CU});let s=null;const u=["all_feeds","space_feeds","user_profile_feeds"];let o=null;const i=(v,$,T)=>{if(o&&o.abort(),$&&v.path===$.path&&v.query.comment_id!==$.query.comment_id)return!1;if(!u.includes(v==null?void 0:v.name))return T||{top:0};if(!T)return{top:0};o=new AbortController;const V=o.signal;return $U(T.top,{signal:V}).then(()=>V.aborted?!1:T)};window.fluentComAdmin.routing_system=="hash"?s=$s({routes:t,history:Wo(),scrollBehavior:i}):s=$s({routes:t,history:Zo(window.fluentComAdmin.portal_slug),scrollBehavior:i});const m=window.FluentCommunityUtil.hooks.applyFilters("fluent_com_portal_app",de);window.fluentFrameworkApp=m.use(s).mount("#fluent_com_portal");const f=to();f.initialize();const h=De();h.initializeCurrentUser();const g=ds();(b=(k=window.fluentComAdmin)==null?void 0:k.auth)!=null&&b.user_id&&((S=(w=window.fluentComAdmin)==null?void 0:w.features)!=null&&S.notifications_polling)&&g.startPolling(6e4),(C=window.fluentComAdmin)!=null&&C.debug_mode&&(window.fcomDevTools={stores:{feed:Te(),space:Ne(),cache:ce(),ui:f,user:h,notification:g},memory:{getStats:()=>{const v=Te(),$=ce(),T=Ne(),V={feeds:v.getMemoryStats,cache:$.getCacheStats,spaces:{total:Object.keys(T.spacesBySlug).length,mySpaces:T.mySpaces.length}};if("memory"in performance){const F=performance.memory;V.browser={usedMB:(F.usedJSHeapSize/1048576).toFixed(2),totalMB:(F.totalJSHeapSize/1048576).toFixed(2),limitMB:(F.jsHeapSizeLimit/1048576).toFixed(2),percentage:(F.usedJSHeapSize/F.jsHeapSizeLimit*100).toFixed(2)+"%"}}return console.table(V),V},cleanup:()=>{const v=Te(),$=ce();console.log("🧹 Running memory cleanup..."),v.pruneOldFeeds(),$.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=s}window.FluentCommunityUtil?Is():document.addEventListener("fluentCommunityUtilReady",function(){Is()}); |
| 16 |
|