1import{u as A,T as B,d as S,r as n,o as k,e as c,g as t,t as o,i as a,F as E,k as _,b4 as F,d4 as h,cN as L,Z as V,D as p}from"./index-HRqdy4hL.js";import{F as D}from"./FilterDropdown-CcLq9q2C.js";import"./useTableStyles-BgWXxHOI.js";const C={class:"p-4 sm:p-6 lg:p-8"},R={class:"max-w-2xl"},T={class:"bg-card border border-border rounded-lg shadow-sm"},I={class:"px-6 py-4 border-b border-border"},N={class:"text-lg font-semibold text-card-foreground"},W={class:"px-6 py-5 space-y-6"},K={key:0,class:"space-y-4 animate-pulse",role:"status","aria-busy":"true","aria-live":"polite"},M={class:"sr-only"},U={key:1,role:"status",class:"text-sm text-muted-foreground"},$={class:"text-sm text-muted-foreground"},j={class:"flex items-center gap-3 cursor-pointer w-fit"},H={class:"text-sm font-medium text-card-foreground"},O=["id"],P={class:"-mt-1 mb-1.5 text-xs text-muted-foreground leading-snug"},Z={class:"px-6 py-4 border-t border-border flex justify-end"},q=["disabled","aria-busy"],X={__name:"BetterAds",setup(z){const{t:e}=A(),m=B(),g=V();S([{id:"tour-betterads-toggle",title:e("betterads.tour_enable","Enable Better Ads"),description:e("betterads.tour_enable_desc","Toggle this switch to enable the Better Ads Standards filter. When active, ad formats that fall below consumer acceptability thresholds will be automatically blocked on your websites."),side:"right"},{id:"tour-betterads-websites",title:e("betterads.tour_websites","Website Selection"),description:e("betterads.tour_websites_desc","Choose which websites the Better Ads filter applies to. Leave empty to apply it to all your websites, or select specific ones for targeted compliance."),side:"bottom"}]);const u=n(!0),v=n(!1),i=n(!1),f=n([]),l=n({isactive:0,sites:[]});async function w(){u.value=!0;try{const[r,s]=await Promise.all([h.get(),L.list({per_page:100})]),d=r.data.data||r.data;l.value.isactive=d.isactive?1:0,l.value.sites=Array.isArray(d.sites)?d.sites:[];const y=s.data.data||s.data;f.value=(Array.isArray(y)?y:[]).map(b=>({id:String(b.id),name:b.name||b.sitename||`Site #${b.id}`}))}catch(r){console.error("Failed to load Better Ads data:",r),v.value=!0,m.error(e("betterads.load_failed","Could not load your Better Ads settings. Reload the page to try again."))}finally{u.value=!1}}async function x(){i.value=!0;try{await h.save({isactive:l.value.isactive,sites:l.value.sites}),m.success(e("global.saved","Saved"))}catch(r){m.error(r.response?.data?.message||e("global.something_went_wrong","Something went wrong"))}finally{i.value=!1}}return k(()=>{w()}),(r,s)=>(p(),c("div",C,[t("div",R,[t("div",T,[t("div",I,[t("h1",N,o(a(e)("betterads.betterads","Better Ads")),1)]),t("div",W,[u.value?(p(),c("div",K,[t("span",M,o(a(e)("global.loading","Loading...")),1),s[2]||(s[2]=t("div",{class:"h-4 w-64 bg-muted-foreground/20 rounded","aria-hidden":"true"},null,-1)),s[3]||(s[3]=t("div",{class:"h-9 w-12 bg-muted-foreground/20 rounded-full","aria-hidden":"true"},null,-1)),s[4]||(s[4]=t("div",{class:"h-4 w-48 bg-muted-foreground/20 rounded","aria-hidden":"true"},null,-1)),s[5]||(s[5]=t("div",{class:"h-10 w-52 bg-muted-foreground/20 rounded","aria-hidden":"true"},null,-1))])):v.value?(p(),c("p",U,o(a(e)("betterads.load_failed","Could not load your Better Ads settings. Reload the page to try again.")),1)):(p(),c(E,{key:2},[t("p",$,o(a(e)("betterads.info_txt","The Better Ads Standards identify the ad experiences that fall beneath a threshold of consumer acceptability. Enable this filter to comply with the Better Ads Standards on your websites.")),1),t("label",j,[_(F,{"model-value":l.value.isactive===1,"aria-label":a(e)("betterads.enable_betterads","Enable Better Ads"),"onUpdate:modelValue":s[0]||(s[0]=d=>l.value.isactive=d?1:0)},null,8,["model-value","aria-label"]),t("span",H,o(a(e)("betterads.enable_betterads","Enable Better Ads")),1)]),t("div",null,[t("div",{id:a(g),class:"flex items-center gap-1 text-sm font-medium text-card-foreground mb-1.5"},o(a(e)("betterads.websites","Websites")),9,O),t("p",P,o(a(e)("betterads.sites_help","Leave empty to apply to all websites, or select specific ones.")),1),_(D,{modelValue:l.value.sites,options:f.value,label:a(e)("betterads.all_sites","All Sites"),multiple:!0,searchable:!0,showAllOption:!0,allLabel:a(e)("betterads.all_sites","All Sites"),emptyMeansAll:!0,valueKey:"id",labelKey:"name","aria-labelledby":a(g),"onUpdate:modelValue":s[1]||(s[1]=d=>l.value.sites=d),width:"w-full sm:w-64"},null,8,["modelValue","options","label","allLabel","aria-labelledby"])])],64))]),t("div",Z,[t("button",{type:"button",class:"ui-btn-primary",disabled:i.value||u.value||v.value,"aria-busy":i.value,onClick:x},o(i.value?a(e)("global.saving","Saving..."):a(e)("global.save","Save")),9,q)])])])]))}};export{X 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.