1import{_ as Z}from"./XhKbKJjk.js";import{d as ee,x as te,ag as oe,c as C,r as x,z as ne,a as u,b as n,e as v,f as i,t as l,i as A,G as S,u as o,k as c,n as m,F as h,h as V,g as f,E as le,o as d,a1 as ae,_ as se}from"#entry";import{_ as ie}from"./KG9SZRUY.js";import{_ as re}from"./D1moRq8b.js";import{_ as de}from"./CCQvkNKx.js";import{_ as ue}from"./CQb-t0T4.js";import{_ as ce}from"./BEWfX2r_.js";import{u as me,m as G,M as T,C as L}from"./CM-p7KeO.js";import{u as pe}from"./CvEC43-o.js";import"./DWGMdCOl.js";import"./C0eqi79C.js";import"./B4Y5vQb5.js";import"./BNJyC5Wi.js";import"./BHXtKXmh.js";import"./48N8_tIC.js";import"./Bi2tIwDO.js";import"./CcFiapl1.js";import"./B67DMGju.js";const ye={class:"flex flex-col gap-5 p-6"},_e={class:"flex items-start justify-between gap-4 flex-wrap"},ve={class:"text-xl font-bold text-gray-900"},fe={class:"text-sm text-gray-500 mt-0.5 max-w-2xl"},ge={class:"flex items-center gap-3"},be={class:"grid grid-cols-2 lg:grid-cols-4 gap-3"},xe={class:"bg-white rounded-xl border border-gray-200 px-4 py-3"},he={class:"text-2xl font-bold text-gray-900"},$e={class:"text-xs text-gray-500 mt-0.5"},we={class:"bg-white rounded-xl border border-gray-200 px-4 py-3"},ke={class:"text-2xl font-bold text-gray-900"},Ce={class:"text-xs text-gray-500 mt-0.5"},Ve={class:"bg-white rounded-xl border border-gray-200 px-4 py-3"},Ue={class:"text-xs text-gray-500 mt-0.5"},Me={class:"bg-white rounded-xl border border-gray-200 px-4 py-3"},Ee={class:"text-xs text-gray-500 mt-0.5"},Re={key:0,class:"bg-white rounded-xl border border-gray-200 px-4 py-4"},qe={class:"text-sm font-semibold text-gray-800 mb-3"},Be={class:"flex h-3 rounded-full overflow-hidden gap-px"},Ne={class:"flex flex-wrap gap-x-4 gap-y-1.5 mt-3"},Se={class:"font-semibold tabular-nums"},Te={class:"flex gap-2 flex-wrap"},Ie=["onClick"],je={key:1,class:"py-16 text-center text-sm text-gray-400"},ze={key:2,class:"bg-white rounded-xl border border-gray-200 py-16 text-center"},Fe={class:"text-sm text-gray-500"},Oe={key:3,class:"bg-white rounded-xl border border-gray-200 overflow-x-auto"},Ae={class:"w-full text-sm"},Ge={class:"bg-gray-50 text-[11px] uppercase tracking-wide text-gray-400"},Le={class:"text-left font-medium px-3 py-2.5"},Ye={class:"text-left font-medium px-3 py-2.5"},De={class:"text-left font-medium px-3 py-2.5 hidden md:table-cell"},Pe={class:"text-right font-medium px-3 py-2.5"},We={class:"text-right font-medium px-3 py-2.5"},He={key:0,class:"w-16"},Je={class:"px-3 py-3 w-full max-w-0"},Ke=["href"],Qe={class:"text-xs text-gray-400 block truncate"},Xe={class:"px-3 py-3"},Ze={class:"px-3 py-3 text-xs text-gray-500 w-32 hidden md:table-cell"},et={class:"px-3 py-3 text-right tabular-nums text-gray-600 whitespace-nowrap"},tt={key:0,class:"px-1 py-3"},ot={class:"flex items-center justify-end gap-1"},nt={class:"flex items-center justify-between"},lt={class:"font-semibold text-gray-800"},at={class:"space-y-4"},st={class:"grid grid-cols-1 sm:grid-cols-2 gap-3"},it={class:"rounded-lg bg-emerald-50/60 border border-emerald-100 px-3 py-2.5 space-y-1"},rt={class:"flex items-center justify-between text-xs text-gray-600"},dt={class:"font-semibold tabular-nums"},ut={class:"flex items-center justify-between text-xs text-gray-600"},ct={key:1,class:"text-gray-400"},mt={class:"flex justify-end gap-2"},Bt=ee({__name:"index",setup(pt){const s=me(),U=pe(),Y=te(),D=oe("company_id"),$=C(()=>Y.isCompanyEmployee(Number(D.value))),I=new Date,g=x(I.getFullYear()),b=x(I.getMonth()+1);ne([g,b],([e,a])=>{s.fetchAll(e,a),U.fetchAll(e,a)},{immediate:!0});const p=x(!1),w=x(null);function j(){return{title:"",url:"",category:"avis",mention_type:"rec",reads:null,visibility_mention_id:null}}const r=x(j());function z(){w.value=null,r.value=j(),p.value=!0}function P(e){w.value=e,r.value={title:e.title,url:e.url,category:e.category,mention_type:e.mention_type,reads:e.reads,visibility_mention_id:e.visibility_mention_id},p.value=!0}const F=C(()=>r.value.title.trim().length>0&&r.value.url.trim().length>0),O=C(()=>G(r.value.mention_type).weight),M=C(()=>r.value.reads?Math.round(r.value.reads*O.value):null);async function W(){if(!F.value)return;await s.save(r.value,w.value,{year:g.value,month:b.value})&&(p.value=!1)}const E=e=>
1e.toLocaleString("fr-FR"),R=e=>(e>0?"+ ":e<0?"â ":"")+E(Math.abs(e)),q=e=>`Ã ${String(e).replace(".",",").replace("-","â")}`;function H(e){try{return new URL(e).host.replace(/^www\./,"")}catch{return e}}return(e,a)=>{const J=Z,y=le,K=se,B=ie,_=re,N=de,Q=ue,X=ce;return d(),u("div",ye,[n("div",_e,[n("div",null,[n("h1",ve,l(e.$t("company.contents.title")),1),n("p",fe,l(e.$t("company.contents.subtitle")),1)]),n("div",ge,[i(J,{year:o(g),"onUpdate:year":a[0]||(a[0]=t=>S(g)?g.value=t:null),month:o(b),"onUpdate:month":a[1]||(a[1]=t=>S(b)?b.value=t:null)},null,8,["year","month"]),o($)?v("",!0):(d(),A(y,{key:0,icon:"i-heroicons-plus",color:"emerald",onClick:z},{default:c(()=>[f(l(e.$t("company.contents.add")),1)]),_:1}))])]),n("div",be,[n("div",xe,[n("p",he,l(o(s).totalCount.value),1),n("p",$e,l(e.$t("company.contents.kpi_sources")),1)]),n("div",we,[n("p",ke,l(E(o(s).totalReads.value)),1),n("p",Ce,l(e.$t("company.contents.kpi_reads")),1)]),n("div",Ve,[n("p",{class:m(["text-2xl font-bold",o(s).totalImpact.value<0?"text-red-500":"text-emerald-600"])},l(R(o(s).totalImpact.value)),3),n("p",Ue,l(e.$t("company.contents.kpi_impact")),1)]),n("div",Me,[n("p",{class:m(["text-2xl font-bold",o(s).impactRatio.value<0?"text-red-500":"text-emerald-600"])},l(o(s).impactRatio.value>0?"+ ":o(s).impactRatio.value<0?"â ":"")+l(Math.abs(o(s).impactRatio.value))+" % ",3),n("p",Ee,l(e.$t("company.contents.kpi_ratio")),1)])]),o(s).totalCount.value?(d(),u("div",Re,[n("p",qe,l(e.$t("company.contents.breakdown_title")),1),n("div",Be,[(d(!0),u(h,null,V(o(T),t=>(d(),u(h,{key:t.value},[o(s).countByMentionType.value[t.value]?(d(),u("div",{key:0,class:m(t.bar),style:ae({flexGrow:o(s).countByMentionType.value[t.value]})},null,6)):v("",!0)],64))),128))]),n("div",Ne,[(d(!0),u(h,null,V(o(T),t=>(d(),u("span",{key:t.value,class:"flex items-center gap-1.5 text-xs text-gray-600"},[n("span",{class:m(["w-2 h-2 rounded-full",t.bar])},null,2),n("span",Se,l(o(s).countByMentionType.value[t.value]),1),f(" "+l(e.$t(`company.contents.mention_${t.value}`))+" ("+l(q(t.weight))+") ",1)]))),128))])])):v("",!0),n("div",Te,[n("button",{class:m(["text-xs font-medium rounded-full px-3.5 py-2 transition-colors",o(s).filterCategory.value==="all"?"bg-gray-900 text-white":"bg-white border border-gray-200 text-gray-600 hover:bg-gray-50"]),onClick:a[2]||(a[2]=t=>o(s).filterCategory.value="all")},l(e.$t("company.contents.filter_all",{n:o(s).totalCount.value})),3),(d(!0),u(h,null,V(o(L),t=>(d(),u("button",{key:t,class:m(["text-xs font-medium rounded-full px-3.5 py-2 transition-colors",o(s).filterCategory.value===t?"bg-gray-900 text-white":"bg-white border border-gray-200 text-gray-600 hover:bg-gray-50"]),onClick:k=>o(s).filterCategory.value=t},l(e.$t(`company.contents.cat_${t}`))+" ("+l(o(s).countByCategory.value[t])+") ",11,Ie))),128))]),o(s).loading.value?(d(),u("div",je,[i(K,{name:"i-heroicons-arrow-path",class:"w-5 h-5 animate-spin mx-auto mb-2",dynamic:""}),f(" "+l(e.$t("admin.common.loading")),1)])):o(s).totalCount.value?(d(),u("div",Oe,[n("table",Ae,[n("thead",null,[n("tr",Ge,[n("th",Le,l(e.$t("company.contents.col_source")),1),n("th",Ye,l(e.$t("company.contents.col_mention")),1),n("th",De,l(e.$t("company.contents.col_query")),1),n("th",Pe,l(e.$t("company.contents.col_reads")),1),n("th",We,l(e.$t("company.contents.col_impact")),1),o($)?v("",!0):(d(),u("th",He))])]),n("tbody",null,[(d(!0),u(h,null,V(o(s).filteredContents.value,t=>(d(),u("tr",{key:t.id,class:"border-t border-gray-100 hover:bg-gray-50/60"},[n("td",Je,[n("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",class:"font-medium text-gray-900 hover:text-emerald-700 block truncate"},l(t.title),9,Ke),n("span",Qe,l(H(t.url)),1)]),n("td",Xe,[n("span",{class:m(["inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap",o(G)(t.mention_type).color])},l(e.$t(`company.contents.mention_${t.mention_type}`)),3)]),n("td",Ze,l(o(U).mentions.value.find(k=>k.id===t.visibility_mention_id)?.query_text??"â"),1),n("td",et,l(t.reads!=null?E(t.reads):"â"),1),n("td",{class:m(["px-3 py-3 text-right tabular-nums font-semibold whitespace-nowrap",t.weighted_impact<0?"text-red-500":"text-emerald-600"])},l(t.reads!=null?R(t.weighted_impact):"â"),3),o($)?v("",!0):(d(),u("td",tt,[n("div",ot,[i(y,{icon:"i-heroicons-pencil-square",color:"gray",variant:"ghost",size:"xs","aria-label":e.$t("admin.common.edit"),onClick:k=>P(t)},null,8,["aria-label","onClick"]),i(y,{icon:"i-heroicons-trash",color:"red",variant:"ghost",size:"xs","aria-label":e.$t("admin.common.delete"),onClick:k=>o(s).remove(t.id)},null,8,["aria-label","onClick"])])]))]))),128))])])])):(d(),u("div",ze,[n("p",Fe,l(e.$t("company.contents.empty")),1),o($)?v("",!0):(d(),A(y,{key:0,class:"mt-4",icon:"i-heroicons-plus",color:"emerald",variant:"soft",onClick:z},{default:c(()=>[f(l(e.$t("company.contents.add")),1)]),_:1}))])),i(X,{modelValue:o(p),"onUpdate:modelValue":a[11]||(a[11]=t=>S(p)?p.value=t:null),ui:{width:"sm:max-w-xl"}},{default:c(()=>[i(Q,null,{header:c(()=>[n("div",nt,[n("p",lt,l(o(w)?e.$t("company.contents.modal_edit"):e.$t("company.contents.modal_create")),1),i(y,{icon:"i-heroicons-x-mark",color:"gray",variant:"ghost",size:"sm",onClick:a[3]||(a[3]=t=>p.value=!1)})])]),footer:c(()=>[n("div",mt,[i(y,{color:"gray",variant:"soft",onClick:a[10]||(a[10]=t=>p.value=!1)},{default:c(()=>[f(l(e.$t("admin.common.cancel")),1)]),_:1}),i(y,{color:"emerald",loading:o(s).saving.value,disabled:!o(F),onClick:W},{default:c(()=>[f(l(e.$t("admin.common.save")),1)]),_:1},8,["loading","disabled"])])]),default:c(()=>[n("div",at,[i(_,{label:e.$t("company.contents.field_title"),required:""},{default:c(()=>[i(B,{modelValue:o(r).title,"onUpdate:modelValue":a[4]||(a[4]=t=>o(r).title=t),placeholder:e.$t("company.contents.ph_title")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),i(_,{label:e.$t("company.contents.field_url"),required:""},{default:c(()=>[i(B,{modelValue:o(r).url,"onUpdate:modelValue":a[5]||(a[5]=t=>o(r).url=t),type:"url",placeholder:"https://..."},null,8,["modelValue"])]),_:1},8,["label"]),n("div",st,[i(_,{label:e.$t("company.contents.field_category"),required:""},{default:c(()=>[i(N,{modelValue:o(r).category,"onUpdate:modelValue":a[6]||(a[6]=t=>o(r).category=t),options:o(L).map(t=>({value:t,label:e.$t(`company.contents.cat_${t}`)}
1)),"value-attribute":"value","option-attribute":"label"},null,8,["modelValue","options"])]),_:1},8,["label"]),i(_,{label:e.$t("company.contents.field_mention_type"),required:""},{default:c(()=>[i(N,{modelValue:o(r).mention_type,"onUpdate:modelValue":a[7]||(a[7]=t=>o(r).mention_type=t),options:o(T).map(t=>({value:t.value,label:`${e.$t(`company.contents.mention_${t.value}`)} (${q(t.weight)})`})),"value-attribute":"value","option-attribute":"label"},null,8,["modelValue","options"])]),_:1},8,["label"])]),i(_,{label:e.$t("company.contents.field_mention")},{default:c(()=>[i(N,{modelValue:o(r).visibility_mention_id,"onUpdate:modelValue":a[8]||(a[8]=t=>o(r).visibility_mention_id=t),options:[{value:null,label:e.$t("company.contents.field_mention_none")},...o(U).mentions.value.map(t=>({value:t.id,label:t.query_text}))],"value-attribute":"value","option-attribute":"label"},null,8,["modelValue","options"])]),_:1},8,["label"]),i(_,{label:e.$t("company.contents.field_reads")},{default:c(()=>[i(B,{modelValue:o(r).reads,"onUpdate:modelValue":a[9]||(a[9]=t=>o(r).reads=t),modelModifiers:{number:!0},type:"number",min:"0",placeholder:"â"},null,8,["modelValue"])]),_:1},8,["label"]),n("div",it,[n("div",rt,[n("span",null,l(e.$t("company.contents.preview_weight")),1),n("span",dt,l(q(o(O))),1)]),n("div",ut,[n("span",null,l(e.$t("company.contents.preview_impact")),1),o(M)!=null?(d(),u("span",{key:0,class:m(["font-semibold tabular-nums",o(M)<0?"text-red-500":"text-emerald-600"])},l(R(o(M))),3)):(d(),u("span",ct,l(e.$t("company.contents.preview_pending")),1))])])])]),_:1})]),_:1},8,["modelValue"])])}}});export{Bt 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.