1import{d as A,E as g,q as B,H as N,I as j,S as I,r as v,x as O,c as F,w as b,s as P,o as k,a as s,j as y,b as r,f as h,t as _,g as z,i as U,F as q}from"./app.0910bc5f.js";import{A as E}from"./AdminIndex.c4297845.js";import{s as J}from"./focustrap.esm.fa167002.js";import{s as M}from"./dialog.esm.768e2748.js";import{s as x}from"./toast.esm.0d046d16.js";import{_ as H}from"./_plugin-vue_export-helper.cdc0426e.js";import"./AdminLayout.35064541.js";import"./cartStore.18679c79.js";import"./datatable.esm.ed6d3750.js";import"./ripple.esm.4dd86dd7.js";import"./index.esm.71f75d81.js";import"./dropdown.esm.2f138a85.js";import"./index.esm.2501d83a.js";import"./portal.esm.e7473283.js";import"./index.esm.e87d3cb0.js";import"./index.esm.2be4ce49.js";import"./column.esm.3933fbeb.js";import"./calendar.esm.6e7ab20d.js";import"./index.esm.de052757.js";import"./confirmdialog.esm.d2d703cf.js";import"./index.esm.c2643f12.js";const R=A({props:{title:String,showAdd:Boolean,insertViewLink:String,insertViewLinkText:String,listViewLink:String},setup(e){const o=g(!1),w=g(1),l=g({}),D=t=>{l.value=t,o.value=!0},u=g(!1),a=async t=>{const n="TO-DO: Set up generated route for "+t;navigator.clipboard.writeText(n),u.value=!0,setTimeout(()=>{u.value=!1},5e3)},C=B(()=>"https://technomancer.biz/admin/social-media-token"),f=t=>{let n=t.split("_");for(const[d,m]of n.entries())n[d]=m[0].toUpperCase()+m.substr(1);return n.join(" ")},$=t=>t.length<30?t:t.substr(0,30)+"...",c=()=>{let t=`Name: ${l.value.page_name} (${l.value.platform}) 2`;t+=l.value.page_id?`Page ID: ${l.value.page_id} 3`:"";for(const[n,d]of Object.entries(JSON.parse(l.value.token)))t+=`${f(n)}: ${d} 4`;return t},i=t=>{navigator.clipboard.writeText(t),alert("Copied: "+t)},p=N(),L=t=>{p.require({header:"Delete token?",message:`Are you sure you want to delete the following token: ${t.page_name} (${t.platform})?`,icon:"bi bi-trash",rejectLabel:"Cancel",acceptLabel:"Delete",rejectClass:"p-button-secondary p-button-outlined",acceptClass:"p-button-danger",accept:()=>V(t.id)})},S=j(),V=async t=>{var n,d,m;try{await P.delete(route("admin.api.social-media-token.destroy",t)),S.add({summary:"Successfully deleted token",severity:"success",life:5e3}),w.value*=-1}catch(T){console.error(T),S.add({summary:(m=(d=(n=T.response)==null?void 0:n.data)==null?void 0:d.message)!=null?m:T.message,severity:"error",life:5e3})}};return{columns:[{label:"Client",field:"client",formatter:t=>t.name},{label:"Platform",field:"platform"},{label:"Page Name",field:"page_name"},{label:"Actions",slot:"actions"}],...e,visible:o,refreshFlag:w,selectedToken:l,openModal:D,copied:u,copyLoginLink:a,itemUrl:C,getLabel:f,getTokenDisplay:$,getAllData:c,copy:i,confirmDelete:L}},components:{AdminIndex:E,Button:J,Dialog:M,Link:I,Toast:x}}),G={class:"d-flex gap-1"},K={key:0,class:"d-flex mt-1"},Q={class:"flex-grow-1 align-content-center"},W={class:"col-1"},X={class:"d-flex"},Y={class:"col-3 align-content-center"},Z={class:"flex-grow-1 align-content-center"},ee={class:"col-1"};function te(e,o,w,l,D,u){const a=v("Button"),C=v("Dialog"),f=v("Toast"),$=v("admin-index"),c=O("tooltip");return k(),F($,{controller:"social-media-token",columns:e.columns,title:e.title,"insert-view-link":e.insertViewLink,"insert-view-link-text":e.insertViewLinkText,"list-view-l
4ink":e.listViewLink,"refresh-flag":e.refreshFlag},{actions:b(({data:i})=>[s("span",G,[y(r(a,{class:"rounded-3",icon:"bi bi-eye",size:"small",onClick:p=>e.openModal(i)},null,8,["onClick"]),[[c,"View token"]]),y(r(a,{class:"rounded-3",icon:"bi bi-trash",severity:"danger",size:"small",onClick:p=>e.confirmDelete(i)},null,8,["onClick"]),[[c,"Delete token"]])])]),modal:b(()=>[r(C,{visible:e.visible,"onUpdate:visible":o[2]||(o[2]=i=>e.visible=i),header:`${e.selectedToken.page_name} (${e.selectedToken.platform})`,modal:""},{footer:b(()=>[r(a,{icon:"bi bi-clipboard",label:"Copy All",onClick:o[1]||(o[1]=i=>e.copy(e.getAllData()))})]),default:b(()=>[e.selectedToken.page_id?(k(),h("div",K,[o[3]||(o[3]=s("div",{class:"col-3 align-content-center"},[s("b",null,"Page Id:")],-1)),s("div",Q,_(e.selectedToken.page_id),1),s("div",W,[y(r(a,{icon:"bi bi-clipboard",class:"py-0",text:"",onClick:o[0]||(o[0]=i=>e.copy(e.selectedToken.page_id))},null,512),[[c,"Copy"]])])])):z("",!0),(k(!0),h(q,null,U(JSON.parse(e.selectedToken.token),(i,p)=>(k(),h("div",X,[s("div",Y,[s("b",null,_(e.getLabel(p))+":",1)]),s("div",Z,_(e.getTokenDisplay(i)),1),s("div",ee,[y(r(a,{icon:"bi bi-clipboard",class:"py-0",text:"",onClick:L=>e.copy(i)},null,8,["onClick"]),[[c,"Copy"]])])]))),256))]),_:1},8,["visible","header"]),r(f,{position:"bottom-right"})]),_:1},8,["columns","title","insert-view-link","insert-view-link-text","list-view-l
4ink","refresh-flag"])}const Te=H(R,[["render",te]]);export{Te 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.