1import{f as q}from"./formatNumber-buDO6fFf.js";import{f as L}from"./formatDate-C1YYpkoX.js";import{q as d,s as t,z as v,y as g,J as I,C as _,u as c,F as m,k as r,N as z,I as P,j as u,g as x,t as f,A as T,x as D,K as B,a9 as R,L as V,v as h}from"./charts-D6UZp-Tt.js";import{_ as w,e as S,u as C,a as U}from"./VueFinalModal.esm-DFl72DMY.js";import{e as K}from"./popper.esm-eU8PXKyC.js";import{S as M}from"./SubmitButton-DrxH_XeR.js";import{T as G}from"./TagField-CQfjwli5.js";import{L as j}from"./LanguageSelector-CHh_8Zcn.js";import{g as J}from"./getNestedCategories-C0Mg9Wt4.js";import{a as Y}from"./apiPost-ghyv-hva.js";import{g as A}from"./getCategories-DSHqt59s.js";import{s as Q}from"./vue3-pagination.esm-UNvUU23X.js";import{N as X}from"./NoData-B5C1uLPO.js";import{C as H}from"./CloseModalIcon-BYoT_1LR.js";import{R as Z}from"./RoleSelector-BdZ0KADJ.js";import{a as $}from"./apiDelete-CoOa1ijB.js";import"./maps-czH8Rgnd.js";import"./codemirror-core-Bynwwsul.js";import"./getTags-DF1JADea.js";import"./vue3-multiselect.umd.min-CA2XfTw6.js";import"./index-CgzFiUr4.js";const ee={props:{source:{type:Object,required:!0}},data(){return{checked:!1}},mounted(){this.eventBus.on("toggle-all",this.toggleAll)},unmounted(){this.eventBus.off("toggle-all",this.toggleAll)},methods:{formatNumber:q,formatDate:L,toggleAll(o){this.checked=o,this.eventBus.emit("selection-toggled",{sourceId:this.source.id,checked:this.checked})},toggleCheckbox(o){this.eventBus.emit("selection-toggled",{sourceId:this.source.id,checked:o})}}},te={class:"invisible hidden lg:visible lg:block"},se={class:"flex flex-wrap items-center group"},oe={class:"w-5/12"},le={class:"p-3 flex items-center"},ie={class:"w-2/12"},re={class:"p-3"},ne={class:"w-2/12"},de={class:"p-3"},ae={class:"w-2/12"},ue={class:"p-3"},ce={class:"visible block lg:invisible lg:hidden"},me={class:"p-4 flex items-start"},ge={class:""},ve={class:""},fe={class:"mt-2 flex items-center"},ye={class:""},pe={class:"mt-2 flex items-center"},he={class:""},be={class:"mt-2 flex items-center"},ke={class:""};function we(o,e,l,k,s,i){return r(),d("div",{class:"mt-4 lg:mt-2 bg-white rounded hover:bg-gray-50 cursor-pointer",onClick:e[7]||(e[7]=a=>o.eventBus.emit("toggle-source-panel",{source:l.source}))},[t("div",te,[t("div",se,[t("div",oe,[t("div",le,[v(t("input",{type:"checkbox","onUpdate:modelValue":e[0]||(e[0]=a=>s.checked=a),onChange:e[1]||(e[1]=a=>i.toggleCheckbox(a.target.checked)),onClick:e[2]||(e[2]=_(()=>{},["stop"])),class:"mr-4"},null,544),[[I,s.checked]]),g(" "+c(l.source.value),1)])]),t("div",ie,[t("div",re,c(i.formatNumber(l.source.num_contents)),1)]),t("div",ne,[t("div",de,c(i.formatDate(l.source.created_at,"YYYY-MM-DD HH:mm:ss","YYYY-MM-DD",!0)),1)]),t("div",ae,[t("div",ue,[l.source.crawled_at!=null?(r(),d("a",{key:0,href:"#",class:"text-blue-500 hover:underline",onClick:e[3]||(e[3]=_(a=>o.eventBus.emit("toggle-crawl-panel",{source:l.source}),["prevent","stop"]))},c(i.formatDate(l.source.crawled_at,"YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm",!0)),1)):(r(),d(m,{key:1},[g("-")],64))])])])]),t("div",ce,[t("div",me,[t("div",ge,[v(t("input",{type:"checkbox","onUpdate:modelValue":e[4]||(e[4]=a=>s.checked=a),onChange:e[5]||(e[5]=a=>i.toggleCheckbox(a.target.checked)),onClick:e[6]||(e[6]=_(()=>{},["stop"])),class:"mr-4"},null,544),[[I,s.checked]])]),t("div",ve,[g(c(l.source.value)+" ",1),t("div",fe,[e[8]||(e[8]=t("div",{class:"w-24 text-gray-600"}," # Posts ",-1)),t("div",ye,c(i.formatNumber(l.source.num_contents)),1)]),t("div",pe,[e[9]||(e[9]=t("div",{class:"w-24 text-gray-600"}," Created ",-1)),t("div",he,c(i.formatDate(l.source.created_at,"YYYY-MM-DD HH:mm:ss","YYYY-MM-DD",!0)),1)]),t("div",be,[e[10]||(e[10]=t("div",{class:"w-24 text-gray-600"}," Crawled ",-1)),t("div",ke,[l.source.crawled_at!=null?(r(),d(m,{key:0},[g(c(i.formatDate(l.source.crawled_at,"YYYY-MM-DD HH:mm:ss","YYYY-MM-DD",!0)),1)],64)):(r(),d(m,{key:1},[g("-")],64))])])])])])])}const _e=w(ee,[["render",we]]),xe={props:{sources:{type:Array,required:!0}},components:{Source:_e,Popper:K},data(){return{selectAllCheckbox:!1}},computed:{...S(C)},methods:{toggleSelectAll(){this.eventBus.emit("toggle-all",this.selectAllCheckbox)}}},Se={class:"invisible hidden lg:visible lg:block"},Ce={class:"mt-4 bg-white rounded flex flex-wrap items-center text-sm text-gray-400 font-semibold"},Be={class:"w-5/12"},Ie={class:"p-3 flex items-center"};function Ee(o,e,l,k,s,i){const a=u("Source");return r(),d(m,null,[t("div",Se,[t("div",Ce,[t("div",Be,[t("div",Ie,[v(t("input",{type:"checkbox","onUpdate:modelValue":e[0]||(e[0]=n=>s.selectAllCheckbox=n),onChange:e[1]||(e[1]=(...n)=>i.toggleSelectAll&&i.toggleSelectAll(...n)),onClick:e[2]||(e[2]=_(()=>{},["stop"])),class:"mr-4"},null,544),[[I,s.selectAllCheckbox]]),e[3]||(e[3]=g(" Source ",-1))])]),e[4]||(e[4]=z('<div class="w-2/12"><div class="p-3"> # Contents </div></div><div class="w-2/12"><div class="p-3"> Created </div></div><div class="w-2/12"><div class="p-3"> Crawled </div></div>',3))])]),(r(!0),d(m,null,P(l.sources,(n,b)=>(r(),x(a,{key:n.id,source:n},null,8,["source"]))),128))],64)}const Te=w(xe,[["render",Ee]]),Pe={props:{source:{type:Object,required:!0},valueError:{type:String,required:!1}},data(){return{loading:!1,nameError:null}},created(){},mounted(){this.$nextTick(()=>{this.$refs.value.focus()})},beforeDestroy(){},computed:{...S(C)}},Me={class:"form-line"},Ye=["disabled"],De={key:0,class:"input-error"};function Ve(o,e,l,k,s,i){return r(),d(m,null,[e[1]||(e[1]=t("div",{class:""}," RSS Feed URL ",-1)),t("div",Me,[v(t("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=a=>l.source.value=a),ref:"value",class:"input-standard",disabled:s.loading},null,8,Ye),[[T,l.source.value]]),l.valueError!==null?(r(),d("div",De,c(l.valueError),1)):f("",!0)])],64)}
1const Oe=w(Pe,[["render",Ve]]),Ne={props:{source:{type:Object,required:!0},valueError:{type:String,required:!1},keywordSourcesError:{type:String,required:!1}},watch:{source:{immediate:!0,handler:function(o,e){this.selectedSources=this.source.keyword_sources,this.source.id==null&&this.selectSources("all")}},selectedSources:{immediate:!0,handler:function(o,e){this.source.keyword_sources=this.selectedSources}}},data(){return{config:window.config,loading:!1,visible:!1,category:null,site:null,selectedSources:[],sources:[{key:"cnn",value:"CNN",enabled:!0},{key:"dailymotion",value:"Daily Motion",enabled:!0,tier:"basic"},{key:"coverr",value:"Coverr",enabled:!0,tier:"premium"},{key:"ccc",value:"media.ccc.de",enabled:!0,tier:"premium"},{key:"mixkit",value:"Mixkit",enabled:!0,tier:"premium"},{key:"nyt",value:"New York Times",enabled:!0,tier:"premium"},{key:"odysee",value:"Odysee",enabled:!0,tier:"premium"},{key:"peertube",value:"PeerTube",enabled:!0,tier:"premium"},{key:"reddit",value:"Reddit",enabled:!0,tier:"premium"},{key:"pixabay",value:"Pixabay",enabled:!1},{key:"rumble",value:"Rumble",enabled:!0,tier:"premium"},{key:"sciencecast",value:"ScienceCast",enabled:!0,tier:"premium"},{key:"ted",value:"TED",enabled:!0,tier:"premium"},{key:"videvo",value:"Videvo",enabled:!0,tier:"premium"},{key:"vimeo",value:"Vimeo",enabled:!0,tier:"premium"},{key:"wallstreetjournal",value:"Wall Street Journal",enabled:!1,tier:"premium"},{key:"wikimedia",value:"Wikimedia",enabled:!0,tier:"basic"},{key:"youtube",value:"YouTube",enabled:!0,tier:"basic"}]}},created(){this.site=this.adminStore.getCurrSite},computed:{...S(C)},methods:{selectSources(o){if(o=="all")for(let e=0;e<this.sources.length;e++)this.sources[e].enabled&&(this.sources[e].tier=="basic"?this.selectedSources.push(this.sources[e].key):this.adminStore.getCurrSite.subscription!=null&&this.selectedSources.push(this.sources[e].key));else this.selectedSources=[];this.selectedSources=[...new Set(this.selectedSources)]}}},qe={class:"form-line"},Le=["disabled"],Ue={key:0,class:"input-error"},je={class:"label-line flex items-center justify-between"},Ae={class:"flex items-center text-sm"},He={class:"form-line flex flex-wrap -mx-1"},We={key:0,class:"w-1/3 p-1"},Fe=["for"],ze=["value","id","disabled"],Re={class:""},Ke={key:0,class:"input-error"},Ge={class:"mt-1 text-gray-600"},Je=["href"],Qe={class:"form-line"},Xe=["disabled"],Ze={class:"mt-1 text-gray-600"},$e={class:"form-line flex items-center"};function et(o,e,l,k,s,i){const a=u("router-link");return r(),d(m,null,[e[16]||(e[16]=t("div",{class:""}," Keyword ",-1)),t("div",qe,[v(t("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=n=>l.source.value=n),ref:"sourceValue",class:"input-standard",disabled:s.loading},null,8,Le),[[T,l.source.value]]),l.valueError!==null?(r(),d("div",Ue,c(l.valueError),1)):f("",!0)]),t("div",je,[e[8]||(e[8]=t("div",{class:""},"Where would you like to get data from?",-1)),t("div",Ae,[t("a",{href:"#",onClick:e[1]||(e[1]=_(n=>i.selectSources("all"),["prevent"])),class:"text-gray-600 hover:underline"},"Select All"),e[7]||(e[7]=t("span",{class:"mx-2 text-gray-300"},"/",-1)),t("a",{href:"#",onClick:e[2]||(e[2]=_(n=>i.selectSources("none"),["prevent"])),class:"text-gray-600 hover:underline"},"None")])]),t("div",He,[(r(!0),d(m,null,P(s.sources,(n,b)=>(r(),d(m,null,[n.enabled?(r(),d("div",We,[t("label",{for:"input-source-"+n.key,class:"flex items-center space-x-2 bg-gray-100 p-2 rounded cursor-pointer hover:bg-gray-200"},[v(t("input",{type:"checkbox","onUpdate:modelValue":e[3]||(e[3]=y=>s.selectedSources=y),value:n.key,id:"input-source-"+n.key,disabled:(s.site.subscription==null||s.site.subscription.id===0)&&n.tier=="premium"},null,8,ze),[[I,s.selectedSources]]),t("div",Re,c(n.value),1)],8,Fe)])):f("",!0)],64))),256))]),l.keywordSourcesError!==null?(r(),d("div",Ke,c(l.keywordSourcesError),1)):f("",!0),s.site.subscription==null||s.site.subscription.id===0?(r(),x(a,{key:1,to:{name:"billing",params:{siteId:o.adminStore.getCurrSite.id}},class:"mt-4 block bg-orange-500 hover:bg-orange-400 text-white rounded py-1 px-2 text-sm"},{default:D(()=>[...e[9]||(e[9]=[g(" Only some of the video sources are available on a free plan. Upgrade now to access all of them! ",-1)])]),_:1},8,["to"])):f("",!0),s.selectedSources.indexOf("peertube")>-1&&s.site.subscription!=null?(r(),d(m,{key:2},[e[12]||(e[12]=t("div",{class:"label-line label-standard"}," PeerTube instance domain ",-1)),t("div",Ge,[e[10]||(e[10]=g(" Searching for videos in PeerTube requires specific PeerTube instance domain. Please see ",-1)),t("a",{href:s.config.global.helpUrl+"/video/sources",class:"underline"},"our documentation",8,Je),e[11]||(e[11]=g(" for more information. ",-1))]),t("div",Qe,[v(t("input",{type:"text","onUpdate:modelValue":e[4]||(e[4]=n=>l.source.peertube_url=n),class:"input-standard",disabled:s.loading},null,8,Xe),[[T,l.source.peertube_url]])])],64)):f("",!0),s.selectedSources.indexOf("youtube")>-1?(r(),d(m,{key:3},[e[15]||(e[15]=t("div",{class:"label-line label-standard"}," For YouTube videos, only add videos that are embeddable. ",-1)),t("div",Ze," Some videos on YouTube have embedding disabled. "+c(s.config.global.appName)+" can automatically filter out those videos if you enable this option. ",1),t("div",$e,[v(t("input",{type:"radio","onUpdate:modelValue":e[5]||(e[5]=n=>l.source.embeddable_only=n),id:"input-embeddable-only-yes",value:!0,class:"mr-2"},null,512),[[B,l.source.embeddable_only]]),e[13]||(e[13]=t("label",{for:"input-embeddable-only-yes"},"Yes",-1)),v(t("input",{type:"radio","onUpdate:modelValue":e[6]||(e[6]=n=>l.source.embeddable_only=n),id:"input-embeddable-only-no",value:!1,class:"ml-8 mr-2"},null,512),[[B,l.source.embeddable_only]]),e[14]||(e[14]=t("label",{for:"input-embeddable-only-no"},"No",-1))])],64)):f("",!0)],64)}const tt=w(Ne,[["render",et]]),st={props:{category:{type:Object,required:!0},categories:{type:Array,required:!1},excludedCategoryId:{type:Number,required:!1}}},ot=["value"];function lt(o,e,l,k,s,i){const a=u("CategoryOption",!0);return l.excludedCategoryId==null||l.category.id!=l.excludedCategoryId?(r(),d(m,{key:0},[t("option",{value:l.category.id},[g(c("Â ".repeat(l.category.level*2))+" ",1),l.category.level>0?(r(),d(m,{key:0},[g("â³")],64)):f("",!0),g(" "+c(l.category.name),1)],8,ot),l.category.subcategories.length>0?(r(!0),d(m,{key:0},P(l.category.subcategories,(n,b)=>(r(),x(a,{category:n,categories:l.category.subcategories},null,8,["category","categories"]))),256)):f("",!0)],64)):f("",!0)}const it=w(st,[["render",lt]]),rt={props:{categories:{type:Array,required:!0},objectToBeChanged:{type:Object,required:!1},objectKey:{type:String,required:!1,default:"category_id"},excludedCategoryId:{type:Number,required:!1},showTopLevel:{type:Boolean,required:!1,default:!1},topLevelLabel:{type:String,required:!1,default:"Top level"},className:{type:String,required:!1,default:"select-standard"},showAny:{type:Boolean,required:!1,default:!1},showNull:{type:Boolean,required:!1,default:!0}},components:{CategoryOption:it},methods:{getNestedCategories:J}},nt={key:0,value:null},dt={key:1,value:"top"},at={key:2,value:"all"};function ut(o,e,l,k,s,i){const a=u("CategoryOption");return v((r(),d("select",{"onUpdate:modelValue":e[0]||(e[0]=n=>l.objectToBeChanged[l.objectKey]=n),class:V(l.className)},[l.showNull?(r(),d("option",nt)):f("",!0),l.showTopLevel?(r(),d("option",dt,c(l.topLevelLabel),
11)):f("",!0),l.showAny?(r(),d("option",at,"Any")):f("",!0),(r(!0),d(m,null,P(i.getNestedCategories(l.categories),(n,b)=>(r(),x(a,{category:n,excludedCategoryId:l.excludedCategoryId},null,8,["category","excludedCategoryId"]))),256))],2)),[[R,l.objectToBeChanged[l.objectKey]]])}const W=w(rt,[["render",ut]]),ct={components:{RSS:Oe,Keyword:tt,SubmitButton:M,TagField:G,CategorySelector:W,LanguageSelector:j},data(){return{loading:!1,visible:!1,source:null,valueError:null,keywordSourcesError:null,categories:null}},async created(){this.categories=await A("/site/category/data",{siteId:this.adminStore.getCurrSite.id,orderBy:"order",orderType:"asc"},this.adminStore.getToken)},mounted(){this.eventBus.on("toggle-source-panel",async o=>{if(this.visible=!this.visible,this.visible){if(o!=null&&o.source!=null?this.source=o.source:this.source={site_id:this.adminStore.getCurrSite.id,name:null,type:"keyword",value:null,keyword_sources:[],requires_approval:!1,auto_add_tags:!0,languages:[],bad_words:null,good_words:null,embeddable_only:!1},this.source.selectedTags=[],this.source.tags!=null)for(let e=0;e<this.source.tags.length;e++)this.source.selectedTags.push(this.source.tags[e]);this.source.languages==null&&(this.source.languages=[])}})},beforeDestroy(){this.eventBus.off("toggle-source-panel")},computed:{...S(C)},methods:{closeSourcePanel(){this.eventBus.emit("toggle-source-panel")},async submit(){let o=!0;if(this.valueError=null,this.keywordSourcesError=null,(this.source.value==null||this.source.value.length==0)&&(this.valueError="Please type a valid source.",o=!1),this.source.type=="keyword"&&(this.source.keyword_sources==null||this.source.keyword_sources.length==0)&&(this.keywordSourcesError="Please select valid data sources.",o=!1),o){this.loading=!0;const e=await Y("/site/content-source/save",{getWhat:"sources",siteId:this.source.site_id,source:this.source},this.adminStore.getToken);this.loading=!1,(await e.body).error!=null||(this.postProcess("Source saved successfully"),this.source.id==null&&this.$vfm.show("info-modal"))}},async crawl(){await Y("/site/content-source/crawl",{getWhat:"sources",siteId:this.source.site_id,sourceId:this.source.id},this.adminStore.getToken),this.postProcess("Source crawled successfully")},postProcess(o){this.eventBus.emit("get-sources"),this.closeSourcePanel(),this.eventBus.emit("notification-event",{type:"success",message:o})}}},mt={class:"fixed top-0 right-0 h-full bg-white w-full sm:w-3/4 md:w-2/3 lg:w-2/5",style:{"max-width":"580px","z-index":"21"}},gt={key:0,class:"absolute w-full",style:{height:"calc(100% - 0px)","overflow-y":"auto"}},vt={class:"flex items-center justify-between bg-gray-100 px-4 h-16"},ft={class:"flex items-center"},yt={class:"p-4"},pt={class:"form-line"},ht={class:"form-line"},bt={class:"form-line flex items-center"},kt={class:"form-line"},wt={class:"form-line"},_t={class:"form-line"},xt={class:"form-line flex items-center"},St={class:"button-line"},Ct={key:3,class:"mt-4 p-4 bg-gray-100 rounded"};function Bt(o,e,l,k,s,i){const a=u("RSS"),n=u("Keyword"),b=u("CategorySelector"),y=u("TagField"),O=u("LanguageSelector"),N=u("SubmitButton");return r(),d("div",{class:V({visible:s.visible,invisible:!s.visible})},[t("div",{class:"fixed top-0 left-0 w-full h-full bg-gray-800 opacity-50",style:{"z-index":"20"},onClick:e[0]||(e[0]=(...p)=>i.closeSourcePanel&&i.closeSourcePanel(...p))}),t("div",mt,[s.source!=null?(r(),d("div",gt,[t("div",vt,[t("div",ft,[s.source.id==null?(r(),d(m,{key:0},[g("New Content Source")],64)):(r(),d(m,{key:1},[g("View/edit content source")],64))]),t("a",{href:"#",onClick:e[1]||(e[1]=_((...p)=>i.closeSourcePanel&&i.closeSourcePanel(...p),["prevent"])),class:"text-gray-700 hover:text-gray-600"},[...e[9]||(e[9]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])])]),t("div",yt,[s.source.type=="rss"?(r(),x(a,{key:0,source:s.source,valueError:s.valueError},null,8,["source","valueError"])):(r(),x(n,{key:1,source:s.source,valueError:s.valueError,keywordSourcesError:s.keywordSourcesError},null,8,["source","valueError","keywordSourcesError"])),s.categories!=null&&s.categories.length>0?(r(),d(m,{key:2},[e[10]||(e[10]=t("div",{class:"label-line"}," Category ",-1)),t("div",pt,[h(b,{categories:s.categories,objectToBeChanged:s.source},null,8,["categories","objectToBeChanged"])])],64)):f("",!0),e[15]||(e[15]=t("div",{class:"label-line"}," Tags ",-1)),e[16]||(e[16]=t("div",{class:"mt-1 text-sm text-gray-500"}," Below tags will be added automatically to the contents from this source. ",-1)),t("div",ht,[h(y,{isAdminOrSite:"admin",selectedTags:s.source.selectedTags,token:o.adminStore.getToken,siteId:o.adminStore.getCurrSite.id,maxTags:o.adminStore.getCurrSite.content_settings.num_tags_per_post},null,8,["selectedTags","token","siteId","maxTags"])]),e[17]||(e[17]=t("div",{class:"label-line"}," Add content keywords as tags ",-1)),e[18]||(e[18]=t("div",{class:"mt-1 text-sm text-gray-500"}," Contents from this source may have their own keywords specified. Select yes if you would like to add these keywords as tags. ",-1)),t("div",bt,[v(t("input",{type:"radio","onUpdate:modelValue":e[2]||(e[2]=p=>s.source.auto_add_tags=p),id:"input-auto-add-tags-yes",value:!0,class:"mr-2"},null,512),[[B,s.source.auto_add_tags]]),e[11]||(e[11]=t("label",{for:"input-auto-add-tags-yes"},"Yes",-1)),v(t("input",{type:"radio","onUpdate:modelValue":e[3]||(e[3]=p=>s.source.auto_add_tags=p),id:"input-auto-add-tags-no",value:!1,class:"ml-8 mr-2"},null,512),[[B,s.source.auto_add_tags]]),e[12]||(e[12]=t("label",{for:"input-auto-add-tags-no"},"No",-1))]),e[19]||(e[19]=t("div",{class:"label-line"}," Only accept contents in the following languages - Leave empty for any types ",-1)),t("div",kt,[h(O,{isAdminOrSite:"admin",selectedLanguages:s.source.languages,token:o.adminStore.getToken,siteId:o.adminStore.getCurrSite.id},null,8,["selectedLanguages","token","siteId"])]),e[20]||(e[20]=t("div",{class:"label-line"}," Reject videos from this keyword if they contain any of following words ",-1)),e[21]||(e[21]=t("div",{class:"mt-1 text-sm text-gray-600"},[g(" Separate keywords by a comma or a new line. By default, searching is case-insensitive. If you want to make it case-sensitive please add "),t("span",{class:"font-semibold"},"[cs]"),g(" after the keyword. ")],-1)),t("div",wt,[v(t("textarea",{class:"input-standard h-20","onUpdate:modelValue":e[4]||(e[4]=p=>s.source.bad_words=p)},null,512),[[T,s.source.bad_words]])]),e[22]||(e[22]=t("div",{class:"label-line"},[g(" Only accept videos from this keyword if they contain "),t("span",{class:"underline"},"any of following words"),g(". ")],-1)),e[23]||(e[23]=t("div",{class:"mt-1 text-sm text-gray-600"},[g(" Separate keywords by a comma or a new line. By default, searching is case-insensitive. If you want to make it case-sensitive please add "),t("span",{class:"font-semibold"},"[cs]"),g(" after the keyword. ")],-1)),t("div",_t,[v(t("textarea",{class:"input-standard h-20","onUpdate:modelValue":e[5]||(e[5]=p=>
1s.source.good_words=p)},null,512),[[T,s.source.good_words]])]),e[24]||(e[24]=t("div",{class:"label-line"}," Approve contents from this keyword before displaying ",-1)),e[25]||(e[25]=t("div",{class:"mt-1 text-gray-600 text-sm"}," Selecting this option means you will need to manually approve the videos before they are displayed on your site. Un-approved videos are available in the un-approved tab in videos section. Un-approved videos will be available for 7 days before being automatically deleted. ",-1)),t("div",xt,[v(t("input",{type:"radio",name:"input-requires-approval","onUpdate:modelValue":e[6]||(e[6]=p=>s.source.requires_approval=p),id:"input-requires-approval-yes",value:!0,class:"mr-2"},null,512),[[B,s.source.requires_approval]]),e[13]||(e[13]=t("label",{for:"input-requires-approval-yes"},"Yes",-1)),v(t("input",{type:"radio",name:"input-requires-approval","onUpdate:modelValue":e[7]||(e[7]=p=>s.source.requires_approval=p),id:"input-requires-approval-no",value:!1,class:"ml-8 mr-2"},null,512),[[B,s.source.requires_approval]]),e[14]||(e[14]=t("label",{for:"input-requires-approval-no"},"No",-1))]),t("div",St,[h(N,{onClick:i.submit,loading:s.loading,label:"Save",isFullWidth:!0},null,8,["onClick","loading"])]),o.adminStore.getCurrUser.email=="[email protected]"?(r(),d("div",Ct,[t("a",{href:"#",onClick:e[8]||(e[8]=_((...p)=>i.crawl&&i.crawl(...p),["prevent"])),class:"hover:underline"},"Crawl")])):f("",!0)])])):f("",!0)])],2)}const It=w(ct,[["render",Bt]]),Et={components:{SubmitButton:M},data(){return{loading:!1,visible:!1,source:null,crawls:null}},mounted(){this.eventBus.on("toggle-crawl-panel",async o=>{if(this.visible=!this.visible,this.visible&&o!=null&&o.source!=null){this.source=o.source;const e=await U("/site/source/crawls",{getWhat:"sources",siteId:this.source.site_id,sourceId:this.source.id},this.adminStore.getToken);this.crawls=await e.body}})},beforeDestroy(){this.eventBus.off("toggle-crawl-panel")},computed:{...S(C)},methods:{formatDate:L,formatNumber:q,closeCrawlPanel(){this.eventBus.emit("toggle-crawl-panel")},async submit(){let o=!0;if(this.valueError=null,this.keywordSourcesError=null,(this.source.value==null||this.source.value.length==0)&&(this.valueError="Please type a valid source.",o=!1),this.source.type=="keyword"&&(this.source.keyword_sources==null||this.source.keyword_sources.length==0)&&(this.keywordSourcesError="Please select valid data sources.",o=!1),o){this.loading=!0;const e=await Y("/site/content-source/save",{getWhat:"sources",siteId:this.source.site_id,source:this.source},this.adminStore.getToken);this.loading=!1,(await e.body).error!=null||(this.postProcess("Source saved successfully"),this.source.id==null&&this.$vfm.show("info-modal"))}}}},Tt={class:"fixed top-0 right-0 h-full bg-white w-full sm:w-3/4 md:w-2/3 lg:w-2/5",style:{"max-width":"560px","z-index":"21"}},Pt={key:0,class:"absolute w-full",style:{height:"calc(100% - 0px)","overflow-y":"auto"}},Mt={class:"flex items-center justify-between bg-gray-100 px-4 h-16"},Yt={class:"divide-y"},Dt={class:"p-4"},Vt={class:"flex items-center space-x-2"},Ot={class:"text-gray-900"},Nt={class:"flex items-center space-x-2"},qt={class:"text-gray-900"},Lt={class:"flex items-center space-x-2"},Ut={class:"text-gray-900"},jt={class:"flex items-center space-x-2"},At={class:"text-gray-900"};function Ht(o,e,l,k,s,i){return r(),d("div",{class:V({visible:s.visible,invisible:!s.visible})},[t("div",{class:"fixed top-0 left-0 w-full h-full bg-gray-800 opacity-50",style:{"z-index":"20"},onClick:e[0]||(e[0]=(...a)=>i.closeCrawlPanel&&i.closeCrawlPanel(...a))}),t("div",Tt,[s.source!=null?(r(),d("div",Pt,[t("div",Mt,[e[3]||(e[3]=t("div",{class:"flex items-center"}," Last 20 crawl history ",-1)),t("a",{href:"#",onClick:e[1]||(e[1]=_((...a)=>i.closeCrawlPanel&&i.closeCrawlPanel(...a),["prevent"])),class:"text-gray-700 hover:text-gray-600"},[...e[2]||(e[2]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])])]),t("div",Yt,[(r(!0),d(m,null,P(s.crawls,(a,n)=>(r(),d("div",Dt,[t("div",Vt,[e[4]||(e[4]=t("div",{class:"text-gray-500 w-32"},"Crawled at",-1)),t("div",Ot,c(i.formatDate(a.created_at,"YYYY-MM-DD HH:mm:ss","YYYY-MM-DD HH:mm",!0)),1)]),t("div",Nt,[e[5]||
1(e[5]=t("div",{class:"text-gray-500 w-32"},"Videos found",-1)),t("div",qt,c(i.formatNumber(a.num_found)),1)]),t("div",Lt,[e[6]||(e[6]=t("div",{class:"text-gray-500 w-32"},"Videos added",-1)),t("div",Ut,c(i.formatNumber(a.num_added)),1)]),t("div",jt,[e[7]||(e[7]=t("div",{class:"text-gray-500 w-32"},"Videos published",-1)),t("div",At,c(i.formatNumber(a.num_published)),1)])]))),256))])])):f("",!0)])],2)}const Wt=w(Et,[["render",Ht]]),Ft={components:{SubmitButton:M,CloseModalIcon:H},data(){return{loading:!1,showModal:!1}},computed:{...S(C)},methods:{beforeOpen(o){},opened(){},submit(){this.$vfm.hide("info-modal")}}},zt={class:"",style:{width:"500px"}},Rt={class:"modal-body"},Kt={class:"mt-4"};function Gt(o,e,l,k,s,i){const a=u("SubmitButton"),n=u("vue-final-modal");return r(),x(n,{modelValue:s.showModal,"onUpdate:modelValue":e[0]||(e[0]=b=>s.showModal=b),name:"info-modal",classes:"modal-container","content-class":"modal-content",onBeforeOpen:i.beforeOpen,onOpened:i.opened},{default:D(()=>[t("div",zt,[t("div",Rt,[e[1]||(e[1]=t("div",{class:""}," Your data source will be processed shortly. It will also be processed on a regular interval throughout the day. ",-1)),t("div",Kt,[h(a,{onClick:i.submit,label:"Got it.",loading:s.loading,isFullWidth:!0},null,8,["onClick","loading"])])])])]),_:1},8,["modelValue","onBeforeOpen","onOpened"])}const Jt=w(Ft,[["render",Gt]]),Qt={components:{SubmitButton:M,RoleSelector:Z,CategorySelector:W,LanguageSelector:j},data(){return{loading:!1,visible:!1,selectedIds:null,categories:null,bulkEdit:null}},async created(){this.site=this.adminStore.getCurrSite,this.categories=await A("/site/category/data",{getWhat:"categories",siteId:this.adminStore.getCurrSite.id,orderBy:"order",orderType:"asc"},this.adminStore.getToken)},mounted(){this.eventBus.on("toggle-bulk-edit-panel",o=>{this.visible=!this.visible,this.visible&&(this.resetBulkEdit(),o!=null&&o.selectedIds!=null&&(this.selectedIds=o.selectedIds))})},beforeDestroy(){this.eventBus.off("toggle-bulk-edit-panel")},computed:{...S(C)},methods:{closeBulkEditPanel(){this.eventBus.emit("toggle-bulk-edit-panel")},resetBulkEdit(){this.bulkEdit={editCategoryId:!1,categoryId:null,editLanguages:!1,languages:[]}},async submit(){{this.loading=!0;const o=await Y("/site/source/bulk-edit",{getWhat:"sources",siteId:this.adminStore.getCurrSite.id,selectedIds:this.selectedIds,bulkEdit:this.bulkEdit},this.adminStore.getToken);this.loading=!1,(await o.body).error!=null||(this.eventBus.emit("get-sources"),this.closeBulkEditPanel(),this.eventBus.emit("notification-event",{type:"success",message:"Sources saved successfully"}))}}}},Xt={class:"fixed top-0 right-0 h-full bg-white w-full sm:w-3/4 md:w-2/3 lg:w-2/5",style:{"max-width":"500px","z-index":"21"}},Zt={key:0,class:"absolute w-full",style:{height:"calc(100% - 0px)","overflow-y":"auto"}},$t={class:"flex items-center justify-between bg-gray-100 px-4 h-16"},es={class:"p-4"},ts={for:"input-bulk-edit-categories",class:"flex items-center block space-x-2"},ss={class:"form-line"},os={for:"input-bulk-edit-languages",class:"flex items-start block space-x-2 label-line"},ls={class:"form-line"},is={class:"button-line"};function rs(o,e,l,k,s,i){const a=u("CategorySelector"),n=u("LanguageSelector"),b=u("SubmitButton");return r(),d("div",{class:V({visible:s.visible,invisible:!s.visible})},[t("div",{class:"fixed top-0 left-0 w-full h-full bg-gray-800 opacity-50",style:{"z-index":"20"},onClick:e[0]||(e[0]=(...y)=>i.closeBulkEditPanel&&i.closeBulkEditPanel(...y))}),t("div",Xt,[s.selectedIds!=null&&s.bulkEdit!=null?(r(),d("div",Zt,[t("div",$t,[e[5]||(e[5]=t("div",{class:"flex items-center"}," Bulk edit sources ",-1)),t("a",{href:"#",onClick:e[1]||(e[1]=_((...y)=>i.closeBulkEditPanel&&i.closeBulkEditPanel(...y),["prevent"])),class:"text-gray-700 hover:text-gray-600"},[...e[4]||(e[4]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"w-6 h-6"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 9.75l4.5 4.5m0-4.5l-4.5 4.5M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)])])]),t("div",es,[t("label",ts,[v(t("input",{type:"checkbox",id:"input-bulk-edit-categories","onUpdate:modelValue":e[2]||(e[2]=y=>s.bulkEdit.editCategoryId=y)},null,512),[[I,s.bulkEdit.editCategoryId]]),e[6]||(e[6]=t("div",{class:""},"Change category",-1))]),t("div",ss,[h(a,{categories:s.categories,objectToBeChanged:s.bulkEdit,objectKey:"categoryId",showTopLevel:!1,disabled:!s.bulkEdit.editCategoryId},null,8,["categories","objectToBeChanged","disabled"])]),t("label",os,[v(t("input",{type:"checkbox",class:"mt-2",id:"input-bulk-edit-languages","onUpdate:modelValue":e[3]||(e[3]=y=>s.bulkEdit.editLanguages=y)},null,512),[[I,s.bulkEdit.editLanguages]]),e[7]||(e[7]=t("div",{class:""},"Only accept contents in the following languages - Leave empty for any types",-1))]),t("div",ls,[h(n,{isAdminOrSite:"admin",token:o.adminStore.getToken,siteId:o.adminStore.getCurrSite.id,selectedLanguages:s.bulkEdit.languages,disabled:!s.bulkEdit.editLanguages},null,8,["token","siteId","selectedLanguages","disabled"])]),t("div",is,[h(b,{onClick:i.submit,loading:s.loading,label:"Save",isFullWidth:!0},null,8,["onClick","loading"])])])])):f("",!0)])],2)}const ns=w(Qt,[["render",rs]]),ds={components:{SubmitButton:M,CloseModalIcon:H},data(){return{loading:!1,showModal:!1,selectedIds:[],deleteType:"all"}},computed:{...S(C)},methods:{beforeOpen(o){let e=o.ref.params.value;this.selectedIds=e.selectedIds,this.deleteType="all",this.loading=!1},opened(){},async submit(){this.loading=!0,await $("/site/content-source/delete",{getWhat:"sources",siteId:this.adminStore.getCurrSite.id,sourceIds:this.selectedIds,deleteType:this.deleteType},this.adminStore.getToken),this.$vfm.hide("delete-sources-modal"),this.eventBus.emit("get-sources"),this.eventBus.emit("notification-event",{type:"success",message:"Sources deleted successfully"}),this.loading=!1}}},as={class:"",style:{width:"500px"}},us={class:"modal-header"},cs={class:"title-box"},ms={class:"modal-body"},gs={class:"mt-4 space-y-1"},vs={class:"flex items-center"},fs={class:"flex items-center"},ys={class:"button-line flex space-x-3"};function ps(o,e,l,k,s,i){const a=u("CloseModalIcon"),n=u("SubmitButton"),b=u("vue-final-modal");return r(),x(b,{modelValue:s.showModal,"onUpdate:modelValue":e[2]||(e[2]=y=>s.showModal=y),name:"delete-sources-modal",classes:"modal-container","content-class":"modal-content",onBeforeOpen:i.beforeOpen,onOpened:i.opened},{default:D(()=>[t("div",as,[t("div",us,[t("div",cs,[e[3]||(e[3]=t("div",{class:"modal-title"},"Please confirm your action",-1)),h(a,{modalName:"image-upload-modal"})])]),t("div",ms,[e[6]||(e[6]=t("div",{class:""}," Please confirm that you want to delete the selected sources and all of its data. ",-1)),t("div",gs,[t("label",vs,[v(t("input",{type:"radio","onUpdate:modelValue":e[0]||(e[0]=y=>s.deleteType=y),value:"all",class:"mr-3"},null,512),[[B,s.deleteType]]),e[4]||(e[4]=t("span",null,"Delete selected sources and all of its data",-1))]),t("label",fs,[v(t("input",{type:"radio","onUpdate:modelValue":e[1]||(e[1]=y=>s.deleteType=y),value:"sources",class:"mr-3"},null,512),[[B,s.deleteType]]),e[5]||(e[5]=t("span",null,"Delete sources but not the videos",-1))])]),t("div",ys,[h(n,{onClick:i.submit,label:"Delete",color:"red",loading:s.loading,isFullWidth:!0},null,8,["onClick","loading"]),h(n,{onClick:()=>this.$vfm.hide("delete-sources-modal"),label:"Cancel",color:"gray",isFullWidth:!0},null,8,["onClick"])])])])]),_:1},8,["modelValue","onBeforeOpen","onOpened"])}const hs=w(ds,[["render",ps]]);async function bs(o,e,l){return await(await U(o,e,l)).body}const ks={components:{SourceList:Te,CrawlPanel:Wt,SourcePanel:It,VPagination:Q,InfoModal:Jt,BulkEditPanel:ns,DeleteSourcesModal:hs,NoData:X},watch:{$route:{immediate:!0,handler:async function(o,e){this.resetParams(),Ob
1ject.keys(o.params).length>0&&this.setParams(o.params),this.getSources()}}},data(){return{config:window.config,site:null,sources:null,selectedIds:[],params:{},currentPage:1}},created(){this.site=this.adminStore.getCurrSite},mounted(){this.eventBus.on("get-sources",this.getSources),this.eventBus.on("selection-toggled",this.selectionToggled),this.eventBus.on("params-changed",this.paramsChanged)},unmounted(){this.eventBus.off("get-sources"),this.eventBus.off("selection-toggled"),this.eventBus.off("params-changed")},computed:{...S(C)},methods:{updateHandler(o){this.paramsChanged([{key:"offset",value:this.params.limit*(o-1)}])},paramsChanged(o){for(let l=0;l<o.length;l++)this.params[o[l].key]=o[l].value;let e={name:"sources-search",params:this.params};this.$router.push(e)},resetParams(){this.params={getWhat:"sources",siteId:this.adminStore.getCurrSite.id,orderBy:"created_at",orderType:"desc",limit:50,offset:0}},setParams(o){for(let e=0;e<Object.keys(o).length;e++){let l=Object.keys(o)[e];this.params[l]=o[l]}this.currentPage=(parseInt(this.params.offset)+parseInt(this.params.limit))/parseInt(this.params.limit)},selectionToggled(o){o.checked?this.selectedIds.indexOf(o.sourceId)==-1&&this.selectedIds.push(o.sourceId):this.selectedIds=this.selectedIds.filter(e=>e!==o.sourceId)},async getSources(){this.loading=!0,this.sources=await bs("/site/content-source/data",this.params,this.adminStore.getToken),this.loading=!1,this.selectedIds=[],this.eventBus.emit("toggle-all",!1)},bulkEdit(){this.eventBus.emit("toggle-bulk-edit-panel",{selectedIds:this.selectedIds})},deleteSelected(){this.$vfm.show("delete-sources-modal",{selectedIds:this.selectedIds})}}},ws={class:"mt-4 lg:mt-8 flex items-center ml-1 h-12"},_s={class:"text-xl flex items-center"},xs={key:0,class:"space-x-4 flex items-center"},Ss={class:"ml-12 text-gray-800 text-sm"},Cs={class:"mt-4 pl-2 flex items-center text-sm"},Bs={class:"text-gray-500 mr-12"};function Is(o,e,l,k,s,i){const a=u("NoData"),n=u("SourceList"),b=u("v-pagination"),y=u("SourcePanel"),O=u("CrawlPanel"),N=u("InfoModal"),p=u("BulkEditPanel"),F=u("DeleteSourcesModal");return r(),d(m,null,[t("div",ws,[t("div",_s,[e[3]||(e[3]=t("div",{class:"mr-12 font-light"},"Video Sources",-1)),s.selectedIds.length>0?(r(),d("div",xs,[t("div",Ss,c(s.selectedIds.length)+" selected",1),t("button",{class:"text-sm text-green-600 hover:text-white bg-green-50 border border-green-600 w-20 hover:bg-green-600 py-1 rounded",onClick:e[0]||(e[0]=(...E)=>i.bulkEdit&&i.bulkEdit(...E))},"Edit"),t("button",{class:"text-sm text-red-600 hover:text-white bg-red-50 border border-red-600 w-20 hover:bg-red-600 py-1 rounded",onClick:e[1]||(e[1]=(...E)=>i.deleteSelected&&i.deleteSelected(...E))},"Delete")])):f("",!0)])]),s.sources==null?(r(),d(m,{key:0},[],64)):s.sources.length==0?(r(),x(a,{key:1},{default:D(()=>[...e[4]||(e[4]=[g(" No sources were found. ",-1)])]),_:1})):(r(),d(m,{key:2},[h(n,{sources:s.sources},null,8,["sources"]),t("div",Cs,[t("div",Bs,c(s.sources[0].total)+" Found",1),s.sources!=null&&s.sources.length>0&&s.sources[0].total>s.params.limit?(r(),x(b,{key:0,modelValue:s.currentPage,"onUpdate:modelValue":[e[2]||(e[2]=E=>s.currentPage=E),i.updateHandler],pages:Math.ceil(s.sources[0].total/s.params.limit),"range-size":1,"active-color":"#DCEDFF"},null,8,["modelValue","pages","onUpdate:modelValue"])):f("",!0)])],64)),h(y),h(O),h(N),h(p),h(F)],64)}const Js=w(ks,[["render",Is]]);export{Js as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.