1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4904],{44904:(e,s,a)=>{"use strict";a.r(s),a.d(s,{ctaLabel:()=>J.hk,daysRunningOf:()=>J.Ki,default:()=>eo,fmtCount:()=>J.bg,hookOf:()=>J.pd,platformHint:()=>J.zg,safeUrl:()=>J.Pl});var n=a(95155),t=a(12115),l=a(10383),i=a(76907),r=a(60235),c=a(4788),o=a(19408),d=a(27209),u=a(79397),h=a(65229),m=a(35299),p=a(39867),v=a(17181),x=a(75426),j=a(39347),b=a(22198),g=a(5917),f=a(6191),y=a(23540),N=a(90368),k=a(27937),w=a(85921),A=a(5789),C=a(93499),S=a(65341),_=a(37107),L=a(65506),D=a(42196),M=a(23327),E=a(71360),P=a(21170),T=a(16443),R=a(87910),F=a(53511),I=a(2068),U=a(35130),O=a(89652),K=a(31959),W=a(21397);a(82301);let z=[.5,1,1.5,2],B=e=>{(!Number.isFinite(e)||e<0)&&(e=0);let s=Math.floor(e);return"".concat(Math.floor(s/60),":").concat(String(s%60).padStart(2,"0"))};function H(e,s){if(!e||!s||e<=0||s<=0)return{ar:.8,cover:!1};let a=e/s;return a>=.5&&a<=1.91?{ar:a,cover:!1}:{ar:Math.min(1.91,Math.max(.5,a)),cover:!0}}function V(e){let{src:s,poster:a,width:l,height:i,autoPlay:r=!0,onResolution:c,onError:o,onDownload:d,className:u}=e,h=(0,t.useRef)(null),m=(0,t.useRef)(null),v=(0,t.useRef)(null),x=(0,t.useRef)(null),j=(0,t.useRef)(null),[b,g]=(0,t.useState)(()=>H(l,i)),[f,y]=(0,t.useState)(null),[N,k]=(0,t.useState)(!1),[A,C]=(0,t.useState)(!0),[S,_]=(0,t.useState)(1),[L,D]=(0,t.useState)(0),[M,E]=(0,t.useState)(0),[P,T]=(0,t.useState)(0),[R,V]=(0,t.useState)(!0),[q,Z]=(0,t.useState)(1),[G,J]=(0,t.useState)(!1),[$,X]=(0,t.useState)(!0),[Y,Q]=(0,t.useState)(!1),[ee,es]=(0,t.useState)(null),ea=(0,t.useCallback)(()=>{let e=h.current;if(!e)return;if(document.fullscreenElement&&m.current&&e.contains(m.current))return void y({w:e.clientWidth,h:e.clientHeight});let s=e.clientWidth;if(!s)return;let a=Math.min(.56*window.innerHeight,600),n=s,t=n/b.ar;t>a&&(n=(t=a)*b.ar),y({w:Math.round(n),h:Math.round(t)})},[b.ar]);(0,t.useLayoutEffect)(()=>{ea()},[ea]),(0,t.useEffect)(()=>{let e=h.current;if(!e)return;let s=new ResizeObserver(()=>ea());return s.observe(e),window.addEventListener("resize",ea),()=>{s.disconnect(),window.removeEventListener("resize",ea)}},[ea]);let en=(0,t.useCallback)(e=>{E(e.duration||0),e.videoWidth&&e.videoHeight&&(g(H(e.videoWidth,e.videoHeight)),null==c||c(e.videoWidth,e.videoHeight)),e.playbackRate=q},[c,q]);(0,t.useEffect)(()=>{g(H(l,i)),D(0),E(0),T(0),k(!1),J(!1),X(!0);let e=v.current;e&&(e.playbackRate=q,e.loop=R)},[s]),(0,t.useEffect)(()=>{let e=v.current;if(!e)return;let s=()=>en(e);return e.addEventListener("loadedmetadata",s),e.addEventListener("loadeddata",s),e.addEventListener("resize",s),e.readyState>=1&&en(e),()=>{e.removeEventListener("loadedmetadata",s),e.removeEventListener("loadeddata",s),e.removeEventListener("resize",s)}},[s,en]),(0,t.useEffect)(()=>{let e=()=>{Q(!!document.fullscreenElement),ea()};return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[ea]);let et=(0,t.useCallback)(()=>{var e;let s=m.current;s&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):null==(e=s.requestFullscreen)||e.call(s).catch(()=>{}))},[]),el=(0,t.useCallback)(()=>{let e=v.current;e&&(e.paused?e.play().catch(()=>{}):e.pause())},[]),ei=(0,t.useCallback)(e=>{let s=v.current;s&&Number.isFinite(s.duration)&&(s.currentTime=Math.min(s.duration,Math.max(0,s.currentTime+e)))},[]),er=(0,t.useCallback)(()=>{let e=v.current;if(!e)return;let s=!e.muted;e.muted=s,C(s),s||0!==e.volume||(e.volume=1,_(1))},[]),ec=(0,t.useCallback)(()=>{X(!0),j.current&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{var e;(null==(e=v.current)?void 0:e.paused)||X(!1)},2200)},[]);(0,t.useEffect)(()=>()=>{j.current&&window.clearTimeout(j.current)},[]);let eo=e=>{let s=x.current;if(!s)return 0;let a=s.getBoundingClientRect();return Math.min(1,Math.max(0,(e-a.left)/a.width))},ed=M>0?L/M*100:0,eu=M>0?P/M*100:0,eh=Y?{width:"100%",height:"100%"}:f?{width:f.w,height:f.h}:{width:"100%",aspectRatio:String(b.ar)};return(0,n.jsx)("div",{ref:h,className:"kvp-wrap"+(u?" "+u:""),children:(0,n.jsxs)("div",{ref:m,className:"kvp"+(N?" playing":" paused")+($?" show":"")+(Y?" fs":""),style:eh,tabIndex:0,role:"group","aria-label":"Video player",onPointerMove:ec,onFocus:ec,onKeyDown:e=>{let s=e.key;" "===s||"k"===s?(e.preventDefault(),e.stopPropagation(),el(),ec()):"ArrowRight"===s?(e.preventDefault(),e.stopPropagation(),ei(5),ec()):"ArrowLeft"===s?(e.preventDefault(),e.stopPropagation(),ei(-5),ec()):"m"===s?(e.preventDefault(),e.stopPropagation(),er(),ec()):"f"===s&&(e.preventDefault(),e.stopPropagation(),et())}
1,children:[(0,n.jsx)("video",{ref:v,src:s,poster:a,playsInline:!0,muted:A,loop:R,autoPlay:r,preload:"metadata",style:{objectFit:b.cover?"cover":"contain"},onClick:el,onLoadedMetadata:e=>en(e.currentTarget),onDurationChange:e=>E(e.currentTarget.duration||0),onTimeUpdate:e=>D(e.currentTarget.currentTime||0),onProgress:e=>{let s=e.currentTarget;s.buffered.length&&T(s.buffered.end(s.buffered.length-1))},onPlay:()=>{k(!0),ec()},onPause:()=>{k(!1),X(!0)},onVolumeChange:e=>{C(e.currentTarget.muted),_(e.currentTarget.volume)},onError:()=>null==o?void 0:o()}),(0,n.jsx)("div",{className:"kvp-veil","aria-hidden":!0}),d?(0,n.jsx)("div",{className:"kvp-top",children:(0,n.jsxs)("button",{type:"button",className:"kvp-chip",onClick:d,children:[(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{children:"Save"})]})}):null,(0,n.jsx)("button",{type:"button",className:"kvp-big","aria-label":N?"Pause":"Play",onClick:el,children:N?(0,n.jsx)(F.A,{}):(0,n.jsx)(w.A,{})}),(0,n.jsxs)("div",{className:"kvp-bar",children:[(0,n.jsxs)("div",{ref:x,className:"kvp-scrub",role:"slider",tabIndex:0,"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(M),"aria-valuenow":Math.round(L),"aria-valuetext":"".concat(B(L)," of ").concat(B(M)),onPointerDown:e=>{let s=v.current;s&&Number.isFinite(s.duration)&&(e.currentTarget.setPointerCapture(e.pointerId),s.currentTime=eo(e.clientX)*s.duration)},onPointerMove:e=>{let s=v.current,a=eo(e.clientX);s&&Number.isFinite(s.duration)&&es({x:a,t:a*s.duration}),e.currentTarget.hasPointerCapture(e.pointerId)&&s&&Number.isFinite(s.duration)&&(s.currentTime=a*s.duration)},onPointerLeave:()=>es(null),onKeyDown:e=>{"ArrowRight"===e.key?(e.preventDefault(),e.stopPropagation(),ei(5)):"ArrowLeft"===e.key&&(e.preventDefault(),e.stopPropagation(),ei(-5))},children:[(0,n.jsxs)("div",{className:"kvp-rail",children:[(0,n.jsx)("div",{className:"kvp-buf",style:{width:"".concat(eu,"%")}}),(0,n.jsx)("div",{className:"kvp-fill",style:{width:"".concat(ed,"%")}})]}),(0,n.jsx)("div",{className:"kvp-knob",style:{left:"".concat(ed,"%")}}),ee?(0,n.jsx)("div",{className:"kvp-tip",style:{left:"".concat(100*ee.x,"%")},children:B(ee.t)}):null]}),(0,n.jsxs)("div",{className:"kvp-ctrls",children:[(0,n.jsx)("button",{type:"button",className:"kvp-btn","aria-label":N?"Pause":"Play",onClick:el,children:N?(0,n.jsx)(F.A,{}):(0,n.jsx)(w.A,{})}),(0,n.jsxs)("div",{className:"kvp-vol",children:[(0,n.jsx)("button",{type:"button",className:"kvp-btn","aria-label":A||0===S?"Unmute":"Mute",onClick:er,children:A||0===S?(0,n.jsx)(I.A,{}):(0,n.jsx)(U.A,{})}),(0,n.jsx)("span",{className:"kvp-slider",children:(0,n.jsx)("input",{type:"range",min:0,max:1,step:.05,value:A?0:S,"aria-label":"Volume",onChange:e=>{let s=Number(e.target.value),a=v.current;a&&(a.volume=s,a.muted=0===s),_(s),C(0===s)}})})]}),(0,n.jsxs)("span",{className:"kvp-time",children:[(0,n.jsx)("b",{children:B(L)})," / ",B(M)]}),(0,n.jsx)("span",{className:"kvp-sp"}),(0,n.jsx)("button",{type:"button",className:"kvp-btn"+(R?" on":""),"aria-pressed":R,title:"Loop",onClick:()=>{let e=!R;V(e),v.current&&(v.current.loop=e)},children:(0,n.jsx)(O.A,{})}),(0,n.jsxs)("div",{className:"kvp-menu"+(G?" open":""),children:[(0,n.jsxs)("button",{type:"button",className:"kvp-btn kvp-speed","aria-haspopup":"menu","aria-expanded":G,title:"Playback speed",onClick:()=>J(e=>!e),children:[q,"\xd7"]}),G?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"kvp-menu-backdrop",onPointerDown:()=>J(!1)}),(0,n.jsx)("div",{className:"kvp-pop",role:"menu",children:z.map(e=>(0,n.jsxs)("button",{type:"button",role:"menuitemradio","aria-checked":e===q,onClick:()=>{Z(e),v.current&&(v.current.playbackRate=e),J(!1)},children:[e,"\xd7 ",1===e?"Normal":""]},e))})]}):null]}),(0,n.jsx)("button",{type:"button",className:"kvp-btn",title:"Fullscreen","aria-label":"Fullscreen",onClick:et,children:Y?(0,n.jsx)(K.A,{}):(0,n.jsx)(W.A,{})})]})]})]})})}var q=a(4313),Z=a(10997),G=a(56457);a(60363);var J=a(26286);let $=e=>e.startsWith("data:")?e:"/api/studio/media/".concat(encodeURIComponent(e),"?go=1"),X=e=>e>=1e6?"".concat((e/1e6).toFixed(e>=1e7?0:1),"M"):e>=1e3?"".concat((e/1e3).toFixed(e>=1e4?0:1),"K"):String(e),Y=["Offer","Social proof","UGC","Problem-solution","Comparison","Founder story","Demo","Testimonial","Urgency"],Q=["Overview","Thread","Ad details"],ee=e=>e&&!Number.isNaN(Date.parse(e))?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"â",es=e=>e<1048576?"".concat(Math.max(1,Math.round(e/1024))," KB"):e<0x40000000?"".concat((e/1048576).toFixed(1)," MB"):"".concat((e/0x40000000).toFixed(2)," GB"),ea=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40;return(e||"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,s)};function en(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,a=new Map;for(let s of e){let e=s.replace(/\s+/g," ").trim();e&&!a.has(e.toLocaleLowerCase())&&a.set(e.toLocaleLowerCase(),e.slice(0,80))}return[...a.values()].slice(0,s)}function et(e){var s,a;let n="running"===e.live_status||"stopped"===e.live_status?e.live_status:"unknown",t=e.first_seen&&Date.parse(e.first_seen)>0?Date.parse(e.first_seen):null,l=e.live_checked&&Date.parse(e.live_checked)>0?Date.parse(e.live_checked):null,i=(e,s)=>Math.max(0,Math.floor((s-e)/864e5)),r="stopped"===n?null!=(s=e.live_days)?s:t?i(t,l||Date.now()):null:t?i(t,Date.now()):"running"===n&&null!=(a=e.live_days)?a:null;return{status:n,since:t,checked:l,days:r,label:"running"===n?"Running"+(null!=r?" \xb7 ".concat(r,"d"):""):"stopped"===n?"Stopped":"Unknown"}}let el=e=>"mixed"===e?"Carousel / mixed":e?e.charAt(0).toUpperCase()+e.slice(1):"â",ei=e=>e.startsWith("video/")?"Video":e.startsWith("image/")?"Image":"File";function er(e){let{ad:s,size:a=32}=e,t=(0,G.LL)(s);return(0,n.jsx)(Z.RV,{name:t.markName||s.title||"K",logo:t.markLogo,pageId:t.markPageId,size:a,tile:!0})}let ec=e=>{let{icon:s,children:a}=e;return(0,n.jsxs)("h3",{className:"sv-label",children:[s,(0,n.jsx)("span",{children:a})]})};function eo(e){var s;let{ad:a,media:F,collection:I,boards:U,readOnly:O,knownTags:K,variantIds:W,findAd:z,onNavigate:B,onClose:H,onToggleFav:Z,onBoards:eo,onNoteSaved:ed,onDelete:eu,onGate:eh}=e,em=(0,t.useMemo)(()=>(0,q.mr)()?{...a,...(0,q.dx)(a.id)}:a,[a]),{toast:ep}=(0,T.d)(),ev=(0,t.useRef)(null),ex=(0,t.useRef)(null),ej=(0,t.useRef)(null),[eb,eg]=(0,t.useState)(0),[ef,ey]=(0,t.useState)(null),[eN]=(0,t.useState)(()=>new URLSearchParams(window.location.search).get("c"));(0,t.useEffect)(()=>{eN&&eg(1)},[eN]);let[ek,ew]=(0,t.useState)(0),[eA,eC]=(0,t.useState)(!1),[eS,e_]=(0,t.useState)(()=>new Set),eL=e=>eS.has(e.id)?$(e.id):e.url,eD=e=>!(eS.has(e.id)||e.url.startsWith("/api/")||e.url.startsWith("data:"))&&(e_(s=>new Set(s).add(e.id)),!0),[eM,eE]=(0,t.useState)(!1),[eP,eT]=(0,t.useState)("Saved media"),[eR,eF]=(0,t.useState)(null),[eI,eU]=(0,t.useState)(null),[eO,eK]=(0,t.useState)(!1),[eW,ez]=(0,t.useState)(null),[eB,eH]=(0,t.useState)(""),[eV,eq]=(0,t.useState)(!1),[eZ,eG]=(0,t.useState)(em.note||""),[eJ,e$]=(0,t.useState)(()=>en(em.tags||[])),[eX,eY]=(0,t.useState)(em.note||""),[eQ,e0]=(0,t.useState)(()=>en(em.tags||[])),[e1,e2]=(0,t.useState)(""),[e3,e5]=(0,t.useState)(!1),[e4,e6]=(0,t.useState)(""),[e9,e7]=(0,t.useState)(null),e8=(0,t.useMemo)(()=>en([...eQ,...e1.split(",")]),[eQ,e1]),se=eX!==eZ||!(e8.length===eJ.length&&e8.every((e,s)=>e===eJ[s])),ss=(0,t.useRef)(se);ss.current=se;let sa=(0,t.useRef)(em.id);(0,t.useEffect)(()=>{let e=em.note||"",s=en(em.tags||[]);if(sa.current!==em.id){var a;sa.current=em.id,ew(0),eC(!1),eE(!1),eF(null),eU(null),eH(""),eG(e),eY(e),e$(s),e0(s),e2(""),e6(""),e7(null),null==(a=ex.current)||a.scrollTo({top:0});return}ss.current?(eG(e),e$(s)):(eG(e),eY(e),e$(s),e0(s))},[em.id,em.note,em.tags]);let sn=F.list,st=sn.length?sn[Math.min(ek,sn.length-1)]:null,sl=!!st&&st.mime.startsWith("video/"),si=(em.media_ids||[]).length>0||!!em.thumb_media,sr=sn.reduce((e,s)=>e+(s.bytes||0),0),sc=sn.length>0&&sn.every(e=>"number"==typeof e.bytes);(0,t.useEffect)(()=>{eT("Saved media"),eE(!1),eC(!1)},[null==st?void 0:st.id]);let so=(0,t.useCallback)(e=>{ew(Math.max(0,Math.min(sn.length-1,e)))},[sn.length]),sd=I.findIndex(e=>e.id===em.id),su=sd>
10?I[sd-1]:null,sh=sd>=0&&sd<I.length-1?I[sd+1]:null,sm=(0,t.useCallback)(async e=>{(!ss.current||await (0,P.ZD)({title:"Discard unsaved notes?",message:"Your note and tag changes on this ad haven't been saved.",confirmLabel:"Discard",destructive:!0}))&&e()},[]),sp=(0,t.useCallback)(()=>{sm(H)},[sm,H]),sv=(0,t.useCallback)(e=>{e&&sm(()=>B(e))},[sm,B]);(0,t.useEffect)(()=>{let e=e=>{if(e.defaultPrevented)return;let s=ev.current,a=document.activeElement;if(!s||a&&a!==document.body&&!s.contains(a))return;if("Escape"===e.key){e.preventDefault(),eR?eF(null):sp();return}if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key||e.metaKey||e.ctrlKey||e.altKey)return;let n=e.target;n&&n.closest("input,textarea,select,video,audio,[contenteditable=true],[role=tablist]")||(e.preventDefault(),sv("ArrowLeft"===e.key?su:sh))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eR,sp,sv,su,sh]),(0,t.useEffect)(()=>{let e=ev.current;if(!e)return;let s=document.activeElement,a=document.documentElement,n=document.body,t={h:a.style.overflow,b:n.style.overflow};a.style.overflow="hidden",n.style.overflow="hidden";let l=requestAnimationFrame(()=>e.focus({preventScroll:!0})),i=s=>{if("Tab"!==s.key)return;let a=Array.from(e.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(e=>null!==e.offsetParent);if(!a.length){s.preventDefault(),e.focus();return}let n=a[0],t=a[a.length-1],l=document.activeElement;s.shiftKey&&(l===n||l===e||!e.contains(l))?(s.preventDefault(),t.focus()):s.shiftKey||l!==t&&e.contains(l)||(s.preventDefault(),n.focus())};return e.addEventListener("keydown",i),()=>{if(cancelAnimationFrame(l),e.removeEventListener("keydown",i),a.style.overflow=t.h,n.style.overflow=t.b,s&&document.contains(s))try{s.focus({preventScroll:!0})}catch(e){}}},[]);let sx=(0,t.useCallback)(async(e,s)=>{try{await navigator.clipboard.writeText(e),eU(null),ep(s,"success")}catch(s){eU(e),ep("Couldn't reach the clipboard â copy it from the field below","info")}},[ep]),sj=(0,J.pd)(em.body,200),sb=et(em),sg=em.id.startsWith("meta:")||!!em.source_ad_id,sf=em.source_ad_id||(em.id.startsWith("meta:")?em.id.slice(5):null),sy=(0,J.Pl)(em.source_url)||(sf&&/^\d+$/.test(sf)?"https://www.facebook.com/ads/library/?id=".concat(sf):null),sN=(0,J.Pl)(em.landing_url),sk=function(e){let s=(0,J.Pl)(e);if(!s)return null;try{return new URL(s).hostname.replace(/^www\./,"")}catch(e){return null}}(em.landing_url),sw=(em.platforms||[]).filter(Boolean).map(e=>String(e).replace(/_/g," ").toLowerCase().replace(/\b\w/g,e=>e.toUpperCase())).join(", "),sA=sn.length||(em.media_ids||[]).length,sC=U.filter(e=>(em.board_ids||[]).includes(e.id)),sS=sC.filter(e=>e.share_token),s_=(0,G.LL)(em).title||em.title||"Saved ad",sL=W.map(e=>z(e)).filter(Boolean);async function sD(){if(eO)return;let e=em.media_ids||[];if(sn.length||e.length){eK(!0);try{if(e.length<=1&&sn.length<=1){let e=sn[0];if(!e)return void ep("This file is still uploading from the extension","info");sM(e,0),ep("".concat(ei(e.mime)," download started"),"success");return}let s=await fetch("/api/studio/download-media",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ad_ids:[em.id]})});if(!s.ok){let e=await s.json().catch(()=>({}));ep((null==e?void 0:e.error)||"Couldn't build the download","error");return}let a=await s.blob(),n=URL.createObjectURL(a),t=document.createElement("a");t.href=n,t.download="klipio-".concat(ea(s_)||"ad","-").concat(ea(sf||em.id,24),".zip"),document.body.appendChild(t),t.click(),t.remove(),setTimeout(()=>URL.revokeObjectURL(n),4e3),ep("".concat(sA," files saved as a ZIP"),"success")}catch(e){ep("Couldn't build the download","error")}finally{eK(!1)}}}function sM(e,s){let a="".concat(ea(s_)||"klipio-ad","-").concat(s+1),n=document.createElement("a");n.href="/api/studio/media/".concat(encodeURIComponent(e.id),"?go=1&dl=").concat(encodeURIComponent(a)),n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}async function sE(){if(O)return void eh();if(eV)return;eq(!0);let e=!em.favorite,s=await Z(em);eq(!1),s&&ep(e?"Saved to favourites":"Removed from favourites","success")}async function sP(e){if(O)return void eh();let s=(em.board_ids||[]).includes(e.id);ez(e.id),await eo(em,s?{remove:[e.id]}:{add:[e.id]}),ez(null)}
1async function sT(){if(O)return void eh();let e=eB.replace(/\s+/g," ").trim();if(!e)return;ez("new");let s=await eo(em,{create:e});ez(null),s&&eH("")}function sR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e1;e0(s=>en([...s,...e.split(",")])),e2("")}async function sF(e,s){if(O)return eh(),!1;e5(!0),e6("");try{var a,n;let t=await fetch("/api/studio/note",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ad_id:em.id,note:e,tags:s})}),l=await t.json().catch(()=>({}));if(!t.ok||!(null==l?void 0:l.ok))return 402===t.status&&eh(),e6((null==l?void 0:l.error)||"Couldn't save this change. Try again."),!1;let i=en(l.tags||s);return eG(null!=(a=l.note)?a:e),e$(i),ed(em.id,null!=(n=l.note)?n:e,i,l.updated_at||new Date().toISOString()),!0}catch(e){return e6("Couldn't save this change. Check your connection and try again."),!1}finally{e5(!1)}}async function sI(e){null==e||e.preventDefault(),se&&!e3&&(e0(e8),e2(""),await sF(eX,e8)&&ep("Notes saved","success"))}async function sU(e){if(e3)return;let s=e8.some(s=>s.toLocaleLowerCase()===e.toLocaleLowerCase()),a=s?e8.filter(s=>s.toLocaleLowerCase()!==e.toLocaleLowerCase()):en([...e8,e]);e0(a),e2(""),await sF(eZ,a)?ep(s?"Removed â".concat(e,"â"):"Tagged â".concat(e,"â"),"success"):e0(eQ)}let sO=(0,t.useMemo)(()=>{let e=e1.trim().toLocaleLowerCase();return e?K.filter(s=>s.toLocaleLowerCase().includes(e)&&!eQ.some(e=>e.toLocaleLowerCase()===s.toLocaleLowerCase())).slice(0,5):[]},[e1,K,eQ]),sK=[s_&&"".concat(s_).concat(sj?":":""),sj?"â".concat(sj,"â"):null].filter(Boolean).join(" "),sW=!!sy||sS.length>0,sz="undefined"!=typeof navigator&&"function"==typeof navigator.share,sB="unknown"===sb.status?sg?"Not checked yet":"Not a Meta Ad Library ad":"".concat(sb.label).concat(sb.checked?" \xb7 checked ".concat(ee(new Date(sb.checked).toISOString())):""),sH=[];sb.since&&sH.push([(0,n.jsx)(l.A,{},"i"),"blue","stopped"===sb.status?"Ran":"running"===sb.status?"Running":"Seen","unknown"===sb.status?"since ".concat(ee(new Date(sb.since).toISOString())):"".concat(null!=sb.days?"".concat(sb.days," day").concat(1===sb.days?"":"s"):"â"," \xb7 since ").concat(ee(new Date(sb.since).toISOString()))]),sg&&sH.push([(0,n.jsx)(i.A,{},"i"),"running"===sb.status?"green":"stopped"===sb.status?"grey":"amber","Status",(0,n.jsx)("span",{className:"sv-status "+sb.status,children:"unknown"===sb.status?"Unknown \xb7 not checked":"".concat(sb.label).concat(sb.checked?" \xb7 checked ".concat(ee(new Date(sb.checked).toISOString())):" \xb7 not checked")},"s")]);let sV=(0,J.hk)(em);sV&&sH.push([(0,n.jsx)(r.A,{},"i"),"orange","Call to action",em.cta_type&&em.cta&&em.cta.trim().toLowerCase()!==sV.toLowerCase()?"".concat(sV," \xb7 â").concat(em.cta.trim().slice(0,40),"â"):sV]);let sq=(0,J.zg)(em.landing_url);sk&&sH.push([(0,n.jsx)(c.A,{},"i"),"violet","Landing page",sq?(0,n.jsxs)("span",{title:"Detected from the landing-page link",children:[sk," \xb7 ",(0,n.jsx)("em",{className:"sv-hint",children:sq.name})]},"l"):sk]),null!=em.page_like_count&&sH.push([(0,n.jsx)(o.A,{},"i"),"blue","Page likes","".concat(em.page_like_count.toLocaleString()," at capture")]),em.end_date&&Date.parse(em.end_date)>0&&sH.push([(0,n.jsx)(l.A,{},"i"),"grey","Ended",ee(em.end_date)]),sH.push([(0,n.jsx)(d.A,{},"i"),"teal",sw?"Format \xb7 platforms":"Media format",sw?"".concat(el(em.format)," \xb7 ").concat(sw):el(em.format)]),sH.push([(0,n.jsx)(l.A,{},"i"),"amber","Captured",ee(em.captured_at)]),sH.push([(0,n.jsx)(u.A,{},"i"),"pink","Saved files","".concat(sA," file").concat(1===sA?"":"s")]),sH.push([(0,n.jsx)(o.A,{},"i"),"ink",em.payer_brand?"Creator page":"Brand",em.brand||"â"]),em.payer_brand&&(em.payer_brand||"").trim()&&(em.payer_brand||"").trim().toLowerCase()!==(em.brand||"").trim().toLowerCase()&&sH.push([(0,n.jsx)(o.A,{},"i"),"ink","Paid for by",em.payer_brand]);let sZ=st?1===sn.length?sl?"Saved video":st.mime.startsWith("image/")?"Saved image":"Saved file":"".concat(Math.min(ek,sn.length-1)+1," / ").concat(sn.length):si?"Media still uploading":"0 files",sG=sn.length?sc?1===sn.length?"".concat(es(sr)," \xb7 saved file"):"".concat(es(sr)," \xb7 ").concat(sn.length," saved files"):"".concat(sn.length," saved file").concat(1===sn.length?"":"s"):F.loading?"Loading saved filesâ¦"
1:si?"Media still uploading":"No saved file";return(0,n.jsx)("div",{className:"st-modal-scrim",onMouseDown:e=>{e.target===e.currentTarget&&sp()},children:(0,n.jsxs)("div",{className:"st-modal sv",role:"dialog","aria-modal":"true","aria-labelledby":"sv-title",tabIndex:-1,ref:ev,children:[(0,n.jsxs)("header",{className:"sv-head",children:[(0,n.jsx)(er,{ad:em}),(0,n.jsx)("h2",{id:"sv-title",children:s_}),(0,n.jsx)("button",{type:"button",className:"sv-close",onClick:sp,"aria-label":"Close",children:(0,n.jsx)(h.A,{})})]}),(0,n.jsxs)("div",{className:"sv-scroll",ref:ex,children:[(0,n.jsxs)("div",{className:"sv-toolbar",role:"toolbar","aria-label":"Ad actions",children:[(0,n.jsxs)("button",{type:"button",className:"sv-tb primary",onClick:sD,disabled:eO||!sn.length&&!(em.media_ids||[]).length,title:sn.length||(em.media_ids||[]).length?sA>1?"Download all ".concat(sA," files (ZIP)"):sl?"Download video":"Download image":"No saved file to download",children:[eO?(0,n.jsx)(m.A,{className:"st-spin"}):(0,n.jsx)(p.A,{}),(0,n.jsx)("span",{children:eO?"Savingâ¦":"Download"})]}),(0,n.jsxs)("div",{className:"sv-pop-wrap",children:[(0,n.jsxs)("button",{type:"button",className:"sv-tb","aria-haspopup":"menu","aria-expanded":"share"===eR,disabled:!sW,title:sW?"Share this ad":"This reference has no source link",onClick:()=>eF("share"===eR?null:"share"),children:[(0,n.jsx)(v.A,{}),(0,n.jsx)("span",{children:"Share"})]}),"share"===eR?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"st-menu-backdrop",onMouseDown:()=>eF(null)}),(0,n.jsxs)("div",{className:"st-menu sv-pop",role:"menu",children:[sy?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",role:"menuitem",className:"st-menu-opt",onClick:()=>{eF(null),sx(sy,"Ad link copied")},children:[(0,n.jsx)("span",{className:"st-menu-check",children:(0,n.jsx)(c.A,{})}),(0,n.jsxs)("span",{className:"st-menu-optlabel",children:["Copy ad link",(0,n.jsx)("em",{children:"The original Meta Ad Library link"})]})]}),(0,n.jsxs)("button",{type:"button",role:"menuitem",className:"st-menu-opt",onClick:()=>{eF(null),sx("".concat(sK?sK+"\n":"").concat(sy),"Share text copied")},children:[(0,n.jsx)("span",{className:"st-menu-check",children:(0,n.jsx)(x.A,{})}),(0,n.jsxs)("span",{className:"st-menu-optlabel",children:["Copy hook + link",(0,n.jsx)("em",{children:sK?sK.slice(0,70)+(sK.length>70?"â¦":""):"Brand, hook and the ad link"})]})]})]}):null,sS.map(e=>(0,n.jsxs)("button",{type:"button",role:"menuitem",className:"st-menu-opt",onClick:()=>{eF(null),sx("".concat("https://klipio.io","/b/").concat(e.share_token),"Link to â".concat(e.name,"â copied"))},children:[(0,n.jsx)("span",{className:"st-menu-check",children:(0,n.jsx)(r.A,{})}),(0,n.jsxs)("span",{className:"st-menu-optlabel",children:["Copy board link",(0,n.jsxs)("em",{children:[e.name," \xb7 public, read-only"]})]})]},e.id)),sC.length>0&&!sS.length?(0,n.jsxs)("p",{className:"st-menu-note",children:["Turn on a board's share link to share it publicly â it's on ",sC.map(e=>e.name).join(", "),"."]}):null,sz&&sy?(0,n.jsxs)("button",{type:"button",role:"menuitem",className:"st-menu-opt",onClick:()=>{eF(null),navigator.share({title:s_,text:sK||s_,url:sy}).catch(()=>{})},children:[(0,n.jsx)("span",{className:"st-menu-check",children:(0,n.jsx)(v.A,{})}),(0,n.jsx)("span",{className:"st-menu-optlabel",children:"Share viaâ¦"})]}):null]})]}):null]}),(0,n.jsxs)("button",{type:"button",className:"sv-tb"+(em.favorite?" on":""),"aria-pressed":em.favorite,disabled:eV,onClick:sE,title:em.favorite?"Remove from favourites":"Save to favourites",children:[(0,n.jsx)(j.A,{}),(0,n.jsx)("span",{children:em.favorite?"Saved":"Save"})]}),(0,n.jsxs)("div",{className:"sv-pop-wrap",children:[(0,n.jsxs)("button",{type:"button",className:"sv-tb","aria-haspopup":"menu","aria-expanded":"board"===eR,onClick:()=>eF("board"===eR?null:"board"),children:[(0,n.jsx)(b.A,{}),(0,n.jsx)("span",{children:"Add to board"}),sC.length?(0,n.jsx)("span",{className:"sv-tb-count",children:sC.length}):null]}),"board"===eR?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"st-menu-backdrop",onMouseDown:()=>eF(null)}),(0,n.jsxs)("div",{className:"st-menu sv-pop wide",role:"menu","aria-label":"Add to board",children:[(0,n.jsx)("p",{className:"sv-pop-h",children:"Add to board"}),U.length?U.map(e=>{let s=(em.board_ids||[]).includes(e.id);return(0,n.jsxs)("button",{type:"button",role:"menuitemcheckbox","aria-checked":s,className:"st-menu-opt"+(s?" sel":""),disabled:O||!!eW,onClick:()=>sP(e),children:[(0,n.jsx)("span",{className:"st-menu-check",children:eW===e.id?(0,n.jsx)(m.A,{className:"st-spin"}):s?(0,n.jsx)(g.A,{}):null}),(0,n.jsx)("span",{className:"st-menu-optlabel",children:e.name}),(0,n.jsx)("span",{className:"st-menu-cnt",children:e.count.toLocaleStr
1ing()})]},e.id)}):(0,n.jsx)("p",{className:"st-menu-note",children:"No boards yet â create your first one below."}),(0,n.jsxs)("form",{className:"sv-newboard",onSubmit:e=>{e.preventDefault(),sT()},children:[(0,n.jsx)("label",{htmlFor:"sv-newboard",children:"Or create a new board"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("input",{id:"sv-newboard",value:eB,maxLength:120,placeholder:"e.g. September launch",disabled:O||!!eW,onChange:e=>eH(e.target.value)}),(0,n.jsxs)("button",{type:"submit",className:"sv-tb primary",disabled:O||!!eW||!eB.trim(),children:["new"===eW?(0,n.jsx)(m.A,{className:"st-spin"}):(0,n.jsx)(f.A,{}),(0,n.jsx)("span",{children:"Create"})]})]})]})]})]}):null]})]}),eI?(0,n.jsxs)("div",{className:"sv-fallback",children:[(0,n.jsx)("span",{children:"Copy this text"}),(0,n.jsx)("textarea",{readOnly:!0,value:eI,rows:Math.min(4,eI.split("\n").length),"aria-label":"Text to copy",onFocus:e=>e.currentTarget.select(),autoFocus:!0})]}):null,(0,n.jsxs)("div",{className:"sv-body",children:[(0,n.jsxs)("section",{className:"sv-visual","aria-label":"Saved media",children:[(0,n.jsx)("div",{ref:ej,className:"sv-stage"+(sl?" video premium":"")+(eM?" zoomed":""),tabIndex:0,"aria-label":"Saved media. Use left and right arrows to change files.",onKeyDown:e=>{if(eM&&["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)){e.preventDefault(),e.stopPropagation();let s=e.currentTarget;s.scrollLeft+="ArrowRight"===e.key?80:"ArrowLeft"===e.key?-80:0,s.scrollTop+="ArrowDown"===e.key?80:"ArrowUp"===e.key?-80:0;return}if(["+","=","-","0"].includes(e.key)&&st&&!sl){e.preventDefault(),eE("+"===e.key||"="===e.key);return}("ArrowLeft"===e.key||"ArrowRight"===e.key)&&sn.length>1&&(e.preventDefault(),e.stopPropagation(),so(ek+("ArrowRight"===e.key?1:-1)))},children:F.loading&&!sn.length?(0,n.jsxs)("div",{className:"sv-stage-msg",children:[(0,n.jsx)(m.A,{className:"st-spin"}),(0,n.jsx)("h3",{children:"Opening saved mediaâ¦"})]}):st?eA?(0,n.jsxs)("div",{className:"sv-stage-msg",children:[(0,n.jsx)(y.A,{}),(0,n.jsx)("h3",{children:"Preview unavailable"}),(0,n.jsx)("p",{children:"This saved file could not be displayed."})]}):sl?(0,n.jsx)(V,{src:eL(st),onResolution:(e,s)=>eT("".concat(e," \xd7 ").concat(s," px")),onError:()=>{eD(st)||(eC(!0),eT("Preview unavailable"))},onDownload:()=>{sM(st,Math.min(ek,sn.length-1)),ep("".concat(ei(st.mime)," download started"),"success")}},st.id):(0,n.jsx)("img",{src:eL(st),alt:"".concat(s_," \xb7 file ").concat(Math.min(ek,sn.length-1)+1),decoding:"async",onLoad:e=>{let s=e.currentTarget;eT("".concat(s.naturalWidth," \xd7 ").concat(s.naturalHeight," px"))},onDoubleClick:()=>eE(e=>!e),onError:()=>{eD(st)||(eC(!0),eT("Preview unavailable"))}},st.id):(0,n.jsxs)("div",{className:"sv-stage-msg",children:[si?(0,n.jsx)(m.A,{className:"st-spin"}):(0,n.jsx)(y.A,{}),(0,n.jsx)("h3",{children:si?"Media still uploading":"No saved media"}),(0,n.jsx)("p",{children:si?"The extension is still sending this ad's files to the cloud.":"The reference is saved. Its files are unavailable."}),sy?(0,n.jsx)("a",{className:"sv-link",href:sy,target:"_blank",rel:"noopener noreferrer nofollow",children:"View source â"}):null]})}),(0,n.jsxs)("div",{className:"sv-caption",children:[sn.length>1?(0,n.jsx)("button",{type:"button",className:"sv-arrow",disabled:0===ek,onClick:()=>so(ek-1),"aria-label":"Previous file",children:(0,n.jsx)(N.A,{})}):null,(0,n.jsx)("span",{className:"sv-position","aria-live":"polite",children:sZ}),sn.length>1?(0,n.jsx)("button",{type:"button",className:"sv-arrow",disabled:ek>=sn.length-1,onClick:()=>so(ek+1),"aria-label":"Next file",children:(0,n.jsx)(k.A,{})}):null]}),sn.length>1?(0,n.jsx)("div",{className:"sv-rail","aria-label":"Choose saved media",children:sn.map((e,s)=>(0,n.jsx)("button",{type:"button",className:"sv-thumb",onClick:()=>so(s),"aria-label":"File ".concat(s+1),"aria-pressed":s===Math.min(ek,sn.length-1),children:e.mime.startsWith("image/")?(0,n.jsx)("img",{src:eL(e),alt:"",loading:"lazy",decoding:"async",onError:()=>{eD(e)}}):(0,n.jsxs)("span",{className:"sv-thumb-v",children:[(0,n.jsx)(w.A,{fill:"currentColor"}),(0,n.jsx)("small",{children:s+1})]})},e.id))}
1):null,st&&!eA?(0,n.jsxs)("div",{className:"sv-viewtools",children:[(0,n.jsx)("span",{className:"sv-resolution",children:eP}),sl?null:(0,n.jsx)("button",{type:"button",className:"sv-mini","aria-pressed":eM,onClick:()=>eE(e=>!e),children:eM?"Fit to view":"View at 100%"}),sn.length>1?(0,n.jsxs)("button",{type:"button",className:"sv-mini",onClick:()=>{sM(st,Math.min(ek,sn.length-1)),ep("".concat(ei(st.mime)," download started"),"success")},children:[(0,n.jsx)(p.A,{}),"This file"]}):null]}):null,(0,n.jsxs)("div",{className:"sv-downloadbar",children:[(0,n.jsx)("span",{className:"sv-hint","aria-live":"polite",children:sG}),sd>=0&&I.length>1?(0,n.jsxs)("nav",{className:"sv-refnav","aria-label":"Browse references",children:[(0,n.jsxs)("span",{children:["Reference ",sd+1," of ",I.length.toLocaleString()]}),(0,n.jsx)("button",{type:"button",className:"sv-arrow",disabled:!su,onClick:()=>sv(su),"aria-label":"Previous reference",title:"Previous (â)",children:(0,n.jsx)(N.A,{})}),(0,n.jsx)("button",{type:"button",className:"sv-arrow",disabled:!sh,onClick:()=>sv(sh),"aria-label":"Next reference",title:"Next (â)",children:(0,n.jsx)(k.A,{})})]}):null]})]}),(0,n.jsxs)("section",{className:"sv-side",children:[(0,n.jsx)("div",{className:"sv-tabs",role:"tablist","aria-label":"Ad information",onKeyDown:e=>{var s;if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault(),e.stopPropagation();let a=(eb+("ArrowRight"===e.key?1:2))%3;eg(a),null==(s=e.currentTarget.querySelectorAll("button")[a])||s.focus()},children:Q.map((e,s)=>(0,n.jsxs)("button",{type:"button",role:"tab",id:"sv-tab-".concat(s),"aria-controls":"sv-panel-".concat(s),"aria-selected":eb===s,tabIndex:eb===s?0:-1,onClick:()=>eg(s),children:[e,1===s&&(null==ef?void 0:ef.unread)?(0,n.jsx)("span",{className:"sv-tabcount","aria-label":"".concat(ef.unread," new"),children:ef.unread}):1===s&&(null==ef?void 0:ef.total)?(0,n.jsx)("span",{className:"sv-tabcount dim",children:ef.total}):null,1===s&&se?(0,n.jsx)("span",{className:"sv-dot","aria-label":"unsaved"}):null]},e))}),(0,n.jsxs)("div",{className:"sv-panel sv-overview",role:"tabpanel",id:"sv-panel-0","aria-labelledby":"sv-tab-0",hidden:0!==eb,children:[sj?(0,n.jsxs)("section",{className:"sv-card sv-hookcard",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(A.A,{}),children:"Hook"}),(0,n.jsx)("p",{className:"sv-hook",children:sj}),(0,n.jsxs)("div",{className:"sv-chiprow",children:[(0,n.jsxs)("button",{type:"button",className:"sv-chipbtn",onClick:()=>sx(sj,"Hook copied"),children:[(0,n.jsx)(x.A,{}),"Copy hook"]}),(0,n.jsxs)("button",{type:"button",className:"sv-chipbtn",onClick:()=>sx(em.body||"","Full text copied"),children:[(0,n.jsx)(x.A,{}),"Copy full text"]})]})]}):null,em.hook_frames&&em.hook_frames.length>=2?(0,n.jsxs)("section",{className:"sv-card",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(d.A,{}),children:"Opening frames"}),(0,n.jsx)("div",{className:"sv-hookstrip",role:"group","aria-label":"First seconds of the video",children:em.hook_frames.slice(0,4).map((e,s)=>(0,n.jsxs)("button",{type:"button",title:"Jump to ".concat(s,"s"),onClick:()=>{var e;let a=null==(e=ej.current)?void 0:e.querySelector("video");if(a)try{a.currentTime=s,a.play()}catch(e){}},children:[(0,n.jsx)("img",{src:$(e),alt:"Frame at ".concat(s," seconds"),loading:"lazy",decoding:"async"}),(0,n.jsxs)("span",{"aria-hidden":!0,children:[s,"s"]})]},e))}),(0,n.jsx)("p",{className:"sv-foot",style:{marginTop:8},children:"Cut by the extension at 0, 1, 2 and 3 seconds. Tap a frame to jump there."})]}):null,(0,n.jsxs)("section",{className:"sv-card",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(A.A,{}),children:"Full copy"}),(0,n.jsx)("p",{className:"sv-copy",children:em.body?em.body.split(RegExp("(#[\\p{L}\\p{N}_]+)","u")).map((e,s)=>e.startsWith("#")?(0,n.jsx)("span",{className:"sv-hashtag",children:e},s):e):"No copy captured."}),em.body&&!sj?(0,n.jsx)("div",{className:"sv-chiprow",children:(0,n.jsxs)("button",{type:"button",className:"sv-chipbtn",onClick:()=>sx(em.body||"","Full text copied"),children:[(0,n.jsx)(x.A,{}),"Copy full text"]})}):null]}),(0,n.jsx)("dl",{className:"sv-rows",children:sH.map(e=>{let[s,a,t,l]=e;return(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile "+a,"aria-hidden":!0,
1children:s}),(0,n.jsx)("span",{children:t})]}),(0,n.jsx)("dd",{children:l})]},t)})}),(0,n.jsxs)("div",{className:"sv-live",children:[(0,n.jsx)("span",{className:"sv-live-dot "+sb.status,"aria-hidden":!0}),(0,n.jsxs)("div",{className:"sv-live-copy",children:[(0,n.jsx)("strong",{children:sB}),(0,n.jsx)("span",{children:sg?"Checked from the Klipio extension â run âCheck if still runningâ there to refresh it.":"Live status is only tracked for Meta Ad Library ads."})]}),sy?(0,n.jsxs)("a",{className:"sv-chipbtn",href:sy,target:"_blank",rel:"noopener noreferrer nofollow",children:[(0,n.jsx)(C.A,{}),"Open in Ad Library"]}):null]}),sL.length?(0,n.jsxs)("section",{className:"sv-card",children:[(0,n.jsxs)(ec,{icon:(0,n.jsx)(u.A,{}),children:[sL.length+1," variants"]}),(0,n.jsx)("p",{className:"sv-foot",children:"Same creative or opening copy across these ad ids."}),(0,n.jsx)("div",{className:"sv-variants",children:sL.map(e=>{let s=et(e);return(0,n.jsxs)("button",{type:"button",className:"sv-variant",onClick:()=>sv(e),children:[(0,n.jsxs)("strong",{children:["Ad ",(e.source_ad_id||e.id).replace(/^meta:/,"")]}),(0,n.jsx)("span",{children:s.since?"".concat(s.label," \xb7 since ").concat(ee(new Date(s.since).toISOString())):(0,J.pd)(e.body,60)||"Open"})]},e.id)})})]}):null,"number"==typeof em.eu_reach&&em.eu_reach>0?(0,n.jsxs)("section",{className:"sv-card",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(S.A,{}),children:"EU reach"}),(0,n.jsxs)("p",{className:"sv-reach",children:[(0,n.jsx)("b",{children:X(em.eu_reach)}),(0,n.jsx)("span",{children:"unique accounts \xb7 Meta's figure for EU delivery"})]}),(null==(s=em.eu_countries)?void 0:s.length)?(0,n.jsx)("div",{className:"sv-reach-bars","aria-label":"Top countries",children:(()=>{var e;let s=[...em.eu_countries].sort((e,s)=>s.reach-e.reach).slice(0,5),a=(null==(e=s[0])?void 0:e.reach)||1;return s.map(e=>{let s;return(0,n.jsxs)("div",{className:"sv-reach-bar",children:[(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{"aria-hidden":!0,children:(s=e.country,/^[A-Za-z]{2}$/.test(s)?String.fromCodePoint(...[...s.toUpperCase()].map(e=>127462+e.charCodeAt(0)-65)):"")})," ",e.country.toUpperCase()]}),(0,n.jsx)("span",{className:"t",children:(0,n.jsx)("span",{className:"f",style:{width:"".concat(Math.max(4,Math.round(e.reach/a*100)),"%")}})}),(0,n.jsx)("span",{className:"v",children:X(e.reach)})]},e.country)})})()}):null]}):null,sN&&em.landing_media?(0,n.jsxs)("section",{className:"sv-card",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(c.A,{}),children:"Landing page"}),(0,n.jsx)("a",{className:"sv-landing",href:sN,target:"_blank",rel:"noopener noreferrer nofollow","aria-label":"Open landing page",children:(0,n.jsx)("img",{src:$(em.landing_media),alt:"Snapshot of ".concat(sk||"the landing page"),loading:"lazy",decoding:"async"})}),(0,n.jsxs)("div",{className:"sv-landing-d",children:[(0,n.jsx)("span",{className:"sv-tile violet","aria-hidden":!0,style:{width:22,height:22},children:(0,n.jsx)(c.A,{style:{width:11,height:11}})}),sk]}),(0,n.jsx)("div",{className:"sv-chiprow",children:(0,n.jsxs)("a",{className:"sv-chipbtn",href:sN,target:"_blank",rel:"noopener noreferrer nofollow",children:[(0,n.jsx)(C.A,{}),"Open landing page"]})})]}):sN?(0,n.jsxs)("section",{className:"sv-card sv-linkcard",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(c.A,{}),children:"Landing page"}),(0,n.jsx)("a",{className:"sv-link",href:sN,target:"_blank",rel:"noopener noreferrer nofollow",children:sN})]}):null,sy?(0,n.jsxs)("section",{className:"sv-card sv-linkcard",children:[(0,n.jsx)(ec,{icon:(0,n.jsx)(c.A,{}),children:"Original ad"}),(0,n.jsx)("a",{className:"sv-link",href:sy,target:"_blank",rel:"noopener noreferrer nofollow",children:sy})]}):null]}),(0,n.jsx)("div",{className:"sv-panel sv-notes",role:"tabpanel",id:"sv-panel-1","aria-labelledby":"sv-tab-1",hidden:1!==eb,children:(0,n.jsx)(R.default,{kind:"ad",id:em.id,readOnly:O,boards:U.map(e=>({id:e.id,name:e.name,count:e.count})),resolveAd:e=>{let s=z(e);return s?{id:s.id,brand:s.brand,title:s.title,thumb_media:s.thumb_media}:void 0},onOpenAd:e=>{let s=z(e);s&&B(s)},onCounts:ey,focusCommentId:eN,children:(0,n.jsxs)("form",{onSubmit:sI,onKeyDown:e=>
1{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),sI())},children:[(0,n.jsxs)("div",{className:"sv-field",children:[(0,n.jsxs)("div",{className:"sv-field-head",children:[(0,n.jsx)("label",{htmlFor:"sv-note",children:"Why I saved this"}),eX?(0,n.jsx)("button",{type:"button",className:"sv-textbtn danger",disabled:e3||O,onClick:()=>{e7(eX),eY("")},children:"Clear note"}):null]}),(0,n.jsx)("textarea",{id:"sv-note",value:eX,maxLength:2e4,rows:3,placeholder:"What caught your eye? What would you try?",disabled:O,onChange:e=>{eY(e.target.value),e7(null)}}),null==e9||eX?null:(0,n.jsxs)("div",{className:"sv-undo",children:[(0,n.jsx)("span",{children:"Note cleared â save to delete it."}),(0,n.jsx)("button",{type:"button",className:"sv-textbtn",onClick:()=>{eY(e9),e7(null)},children:"Undo"})]})]}),(0,n.jsxs)("div",{className:"sv-field",children:[(0,n.jsx)("label",{htmlFor:"sv-tag-entry",children:"Tags"}),eQ.length?(0,n.jsx)("div",{className:"sv-tagchips",children:eQ.map(e=>(0,n.jsxs)("span",{className:"sv-edtag",children:[(0,n.jsx)("span",{children:e}),(0,n.jsx)("button",{type:"button","aria-label":"Remove tag ".concat(e),disabled:O,onClick:()=>e0(s=>s.filter(s=>s!==e)),children:(0,n.jsx)(h.A,{})})]},e))}):null,(0,n.jsx)("input",{id:"sv-tag-entry",className:"sv-input",value:e1,maxLength:80,placeholder:"Add a tagâ¦",autoComplete:"off",disabled:O,onChange:e=>{let s=e.target.value;if(s.includes(",")){let e=s.split(","),a=e.pop()||"";e0(s=>en([...s,...e])),e2(a)}else e2(s)},onKeyDown:e=>{e.nativeEvent.isComposing||("Enter"!==e.key||e.metaKey||e.ctrlKey?"Backspace"===e.key&&!e1&&eQ.length&&(e.preventDefault(),e0(e=>e.slice(0,-1))):(e.preventDefault(),sR()))},onBlur:()=>{e1.trim()&&sR()}}),sO.length?(0,n.jsx)("div",{className:"sv-suggest",children:sO.map(e=>(0,n.jsx)("button",{type:"button",className:"sv-suggestion",onMouseDown:e=>e.preventDefault(),onClick:()=>sR(e),children:e},e))}):null,(0,n.jsx)("small",{className:"sv-hintline",children:"Enter to add \xb7 Backspace to remove"}),(0,n.jsxs)("div",{className:"sv-angles",children:[(0,n.jsx)("span",{className:"sv-eyebrow",children:"ANGLE"}),(0,n.jsx)("div",{className:"sv-anglechips",role:"group","aria-label":"Angle tags",children:Y.map(e=>{let s=e8.some(s=>s.toLocaleLowerCase()===e.toLocaleLowerCase());return(0,n.jsx)("button",{type:"button",className:"sv-angle"+(s?" on":""),"aria-pressed":s,disabled:e3||O,onClick:()=>sU(e),children:e},e)})})]})]}),sC.length?(0,n.jsxs)("div",{className:"sv-boardlist",children:[(0,n.jsx)("span",{className:"sv-eyebrow",children:"IN BOARDS"}),sC.map(e=>(0,n.jsx)("span",{className:"sv-boardchip",children:e.name},e.id))]}):null,e4?(0,n.jsx)("p",{className:"sv-err",role:"alert",children:e4}):null,(0,n.jsxs)("div",{className:"sv-footer",children:[(0,n.jsx)("span",{children:O?"Studio is read-only â notes can't be edited":e3?"Savingâ¦":se?"Unsaved changes":"Notes stay with this reference \xb7 synced to the extension"}),(0,n.jsxs)("button",{type:"submit",className:"sv-save",disabled:!se||e3||O,children:[e3?(0,n.jsx)(m.A,{className:"st-spin"}):null,"Save notes"]})]})]})})}),(0,n.jsxs)("div",{className:"sv-panel sv-facts",role:"tabpanel",id:"sv-panel-2","aria-labelledby":"sv-tab-2",hidden:2!==eb,children:[(0,n.jsxs)("div",{className:"sv-receipt",children:[(0,n.jsxs)("strong",{children:[sA," saved file",1===sA?"":"s",sc?" \xb7 ".concat(es(sr)):""]}),(0,n.jsx)("span",{children:(em.media_ids||[]).length>sn.length&&!F.loading?"".concat((em.media_ids||[]).length-sn.length," still uploading"):"Stored in your Klipio cloud"})]}),(0,n.jsxs)("dl",{className:"sv-rows",children:[(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile ink","aria-hidden":!0,children:(0,n.jsx)(_.A,{})}),(0,n.jsx)("span",{children:"Ad Library ID"})]}),(0,n.jsx)("dd",{children:sf?(0,n.jsxs)("span",{className:"sv-idval",children:[sf,(0,n.jsx)("button",{type:"button",className:"sv-iconbtn","aria-label":"Copy Ad Library ID",onClick:()=>sx(sf,"Ad Library ID copied"),children:(0,n.jsx)(x.A,{})})]}):"â"})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile ink","aria-hidden":!0,
1children:(0,n.jsx)(o.A,{})}),(0,n.jsx)("span",{children:"Page ID"})]}),(0,n.jsx)("dd",{children:em.page_id?(0,n.jsxs)("span",{className:"sv-idval",children:[em.page_id,(0,n.jsx)("button",{type:"button",className:"sv-iconbtn","aria-label":"Copy Page ID",onClick:()=>sx(em.page_id||"","Page ID copied"),children:(0,n.jsx)(x.A,{})})]}):"â"})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile violet","aria-hidden":!0,children:(0,n.jsx)(c.A,{})}),(0,n.jsx)("span",{children:"Source"})]}),(0,n.jsx)("dd",{children:sy?(0,n.jsxs)("a",{className:"sv-link",href:sy,target:"_blank",rel:"noopener noreferrer nofollow",children:[sy.replace(/^https?:\/\/(www\.)?/,"").slice(0,60),sy.length>70?"â¦":""," â"]}):"â"})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile violet","aria-hidden":!0,children:(0,n.jsx)(c.A,{})}),(0,n.jsx)("span",{children:"Landing page"})]}),(0,n.jsx)("dd",{children:sN?(0,n.jsxs)("a",{className:"sv-link",href:sN,target:"_blank",rel:"noopener noreferrer nofollow",children:[sN.replace(/^https?:\/\/(www\.)?/,"").slice(0,60),sN.length>70?"â¦":""," â"]}):"â"})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile teal","aria-hidden":!0,children:(0,n.jsx)(d.A,{})}),(0,n.jsx)("span",{children:"Format"})]}),(0,n.jsx)("dd",{children:el(em.format)})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile teal","aria-hidden":!0,children:(0,n.jsx)(L.A,{})}),(0,n.jsx)("span",{children:"Platforms"})]}),(0,n.jsx)("dd",{children:sw||"â"})]}),sV?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile orange","aria-hidden":!0,children:(0,n.jsx)(r.A,{})}),(0,n.jsx)("span",{children:"Call to action"})]}),(0,n.jsxs)("dd",{children:[sV,em.cta_type?(0,n.jsxs)("span",{className:"sv-dim",children:[" \xb7 ",em.cta_type]}):null]})]}):null,sq?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile pink","aria-hidden":!0,children:(0,n.jsx)(c.A,{})}),(0,n.jsx)("span",{children:"Store"})]}),(0,n.jsxs)("dd",{title:"Detected from the landing-page link",children:[sq.name," ",(0,n.jsx)("span",{className:"sv-dim",children:"from the landing-page link"})]})]}):null,null!=em.page_like_count?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile blue","aria-hidden":!0,children:(0,n.jsx)(o.A,{})}),(0,n.jsx)("span",{children:"Page likes"})]}),(0,n.jsxs)("dd",{children:[em.page_like_count.toLocaleString()," ",(0,n.jsx)("span",{className:"sv-dim",children:"at capture"})]})]}):null,em.end_date&&Date.parse(em.end_date)>0?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile grey","aria-hidden":!0,children:(0,n.jsx)(l.A,{})}),(0,n.jsx)("span",{children:"Ended (Meta)"})]}),(0,n.jsx)("dd",{children:ee(em.end_date)})]}):null,em.reach_countries&&em.reach_countries.length?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile teal","aria-hidden":!0,children:(0,n.jsx)(L.A,{})}),(0,n.jsx)("span",{children:"Countries (Meta)"})]}),(0,n.jsxs)("dd",{children:[em.reach_countries.slice(0,12).join(", "),em.reach_countries.length>12?" +".concat(em.reach_countries.length-12):""]})]}):null,em.is_aaa_eligible?(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile teal","aria-hidden":!0,children:(0,n.jsx)(i.A,{})}),(0,n.jsx)("span",{children:"EU transparency"})]}),(0,n.jsxs)("dd",{children:["Meta shows EU reach for this ad ",(0,n.jsx)("span",{className:"sv-dim",children:"(open it in the Ad Library)"})]})]}):null,(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile blue","aria-hidden":!0,children:(0,n.jsx)(l.A,{})}),(0,n.jsx)("span",{children:"First seen on Meta"})]}),(0,n.jsx)("dd",{children:ee(em.first_seen)})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile amber","aria-hidden":!0,
1children:(0,n.jsx)(l.A,{})}),(0,n.jsx)("span",{children:"Captured"})]}),(0,n.jsx)("dd",{children:ee(em.captured_at)})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile blue","aria-hidden":!0,children:(0,n.jsx)(l.A,{})}),(0,n.jsx)("span",{children:"Last updated"})]}),(0,n.jsx)("dd",{children:ee(em.updated_at)})]}),(0,n.jsxs)("div",{className:"sv-row",children:[(0,n.jsxs)("dt",{children:[(0,n.jsx)("span",{className:"sv-tile green","aria-hidden":!0,children:(0,n.jsx)(i.A,{})}),(0,n.jsx)("span",{children:"Status"})]}),(0,n.jsx)("dd",{children:(0,n.jsx)("span",{className:"sv-status "+sb.status,children:"unknown"===sb.status?"Not checked":"".concat(sb.label).concat(sb.checked?" \xb7 checked ".concat(ee(new Date(sb.checked).toISOString())):"")})})]})]}),(0,n.jsx)("h4",{className:"sv-h4",children:"Saved files"}),sn.length?(0,n.jsx)("ul",{className:"sv-files",children:sn.map((e,s)=>(0,n.jsxs)("li",{children:[(0,n.jsx)("span",{className:"sv-fileic",children:e.mime.startsWith("video/")?(0,n.jsx)(w.A,{fill:"currentColor"}):(0,n.jsx)(D.A,{})}),(0,n.jsxs)("span",{className:"sv-filename",children:[(0,n.jsxs)("strong",{children:["File ",s+1," \xb7 ",ei(e.mime)]}),(0,n.jsxs)("em",{children:[(e.mime.split("/")[1]||"file").replace("jpeg","jpg").replace("quicktime","mov").toUpperCase(),"number"==typeof e.bytes?" \xb7 ".concat(es(e.bytes)):""]})]}),(0,n.jsx)("button",{type:"button",className:"sv-iconbtn","aria-label":"View file ".concat(s+1),title:"View",onClick:()=>{var e;so(s),null==(e=ex.current)||e.scrollTo({top:0,behavior:"smooth"})},children:(0,n.jsx)(C.A,{})}),(0,n.jsx)("button",{type:"button",className:"sv-iconbtn","aria-label":"Download file ".concat(s+1),title:"Download",onClick:()=>{sM(e,s),ep("".concat(ei(e.mime)," download started"),"success")},children:(0,n.jsx)(p.A,{})})]},e.id))}):(0,n.jsx)("p",{className:"sv-foot",children:F.loading?"Loading saved filesâ¦":si?"The files are still uploading from the extension.":"No saved files."}),(0,n.jsx)("h4",{className:"sv-h4",children:"Boards"}),sC.length?(0,n.jsx)("div",{className:"sv-boardlist",children:sC.map(e=>(0,n.jsxs)("span",{className:"sv-boardchip",children:[e.name,e.share_token?" \xb7 shared":""]},e.id))}):(0,n.jsx)("p",{className:"sv-foot",children:"Not on a board yet â use âAdd to boardâ above."}),(0,n.jsxs)("p",{className:"sv-foot",children:[(0,n.jsx)(M.A,{className:"sv-inline"}),"Saved reference \xb7 not live ad performance"]}),(0,n.jsx)("div",{className:"sv-danger",children:(0,n.jsxs)("button",{type:"button",className:"sv-textbtn danger",disabled:O,onClick:()=>eu(em),children:[(0,n.jsx)(E.A,{}),"Delete from library"]})})]})]})]})]})]})})}},60363:()=>{},82301:()=>{}}]);
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.