PageSourceSearch

https://csmarketcap.com/_nuxt/BXck5qy1.js

js csmarketcap.com collected 2026-09-24 10:15:37 UTC 43,369 bytes, 2 lines download raw bytes

1import{_ as it,n as Ft,o as Ht,p as qt,q as Kt,r as Zt,s as Qe,t as Gt,u as Yt,v as Jt,w as Qt,x as Xt,y as en}from"./CqsYjXfz.js";import{D as tn,a as nn,_ as an,e as D,n as Xe,f as F,d as ln,i as Q,q as on}from"./BaLyrhAw.js";import{_ as sn}from"./BGC56s0H.js";import{_ as dn}from"./_7AV2CIu.js";import{_ as rn}from"./C7bt9c96.js";import{a as Be,V as dt,N as mn,o as s,b as i,F as P,f as l,t as T,e,c as X,bp as De,aw as rt,g as ve,n as Ne,h,T as un,v as O,K as pn,C as cn,w as v,E as d,D as Pe,G as et,A as mt,a0 as _n,s as bn,bV as tt,M as fn,ab as b,r as G,S as be,P as C,br as fe,R as V,W as nt,k as U,ag as Ce,y as yn}from"./F-A8tqvQ.js";import{_ as hn}from"./CB6xJ9jr.js";import{_ as ut}from"./Bw9lJPIH.js";import{b as vn}from"./B77LaUnD.js";import{u as gn}from"./C4PtzmC5.js";import{u as kn}from"./CFzW1f4W.js";import{u as wn}from"./vvTJgUdS.js";const xn=["aria-expanded","aria-label"],$n=Be({__name:"Menu",props:{label:{default:"More actions"}},setup(p){const m=O(!1),u=O(null),_=O(null),y=O({});function g(){m.value?S(!0):L()}async function L(){m.value=!0,await pn(),H(),q(0)}function H(){const x=u.value?.getBoundingClientRect(),f=_.value?.getBoundingClientRect();if(!x||!f)return;const R=8,ee=Math.max(R,Math.min(x.right-f.width,window.innerWidth-f.width-R)),me=x.bottom+6,ue=me+f.height+R>window.innerHeight?Math.max(R,x.top-6-f.height):me;y.value={top:`${ue}px`,left:`${ee}px`}}function S(x=!1){m.value&&(m.value=!1,x&&u.value?.focus())}function w(){return[..._.value?.querySelectorAll('[role="menuitem"]:not([disabled])')??[]]}function q(x){const f=w();f.length&&f[(x%f.length+f.length)%f.length]?.focus()}function B(x){const R=w().indexOf(document.activeElement);q(R<0?0:R+x)}function W(x){x.target.closest('[role="menuitem"]')&&S(!0)}const z=()=>S();return dt(m,x=>{x?(window.addEventListener("scroll",z,!0),window.addEventListener("resize",z)):(window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z))}),mn(()=>{window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}),(x,f)=>{const R=it;return s(),i(P,null,[l("button",{ref_key:"trigger",ref:u,"aria-expanded":e(m),"aria-label":p.label,"aria-haspopup":"menu",class:"adm-btn adm-btn--sm adm-menu__trigger",type:"button",onClick:g},[T(R,{size:16,name:"more"})],8,xn),(s(),X(un,{to:"body"},[e(m)?(s(),i("div",{key:0,class:"adm adm-menu",onKeydown:f[3]||(f[3]=De(ee=>S(!0),["esc"]))},[l("div",{class:"adm-menu__scrim",onClick:f[0]||(f[0]=ee=>S())}),l("div",{ref_key:"panel",ref:_,style:Ne(e(y)),class:"adm-menu__panel",role:"menu",tabindex:"-1",onClick:W,onKeydown:[f[1]||(f[1]=De(ve(ee=>B(1),["prevent"]),["down"])),f[2]||(f[2]=De(ve(ee=>B(-1),["prevent"]),["up"]))]},[rt(x.$slots,"default")],36)],32)):h("",!0)]))],64)}}}),Cn=Object.assign($n,{__name:"AdminUiMenu"}),Un={class:"adm-confirm"},Tn=["disabled"],En=Be({__name:"Confirm",props:et({title:{},confirmLabel:{},cancelLabel:{default:"Cancel"},tone:{default:"danger"},busy:{type:Boolean,default:!1}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:et(["confirm"],["update:modelValue"]),setup(p,{emit:m}){const u=m,_=cn(p,"modelValue");return(y,g)=>{const L=ut;return s(),X(L,{modelValue:_.value,"onUpdate:modelValue":g[2]||(g[2]=H=>_.value=H),title:p.title},{footer:v(()=>[l("button",{class:"adm-btn",type:"button",onClick:g[0]||(g[0]=H=>_.value=!1)},d(p.cancelLabel),1),l("button",{class:Pe(p.tone==="danger"?"adm-btn adm-btn--danger":"adm-btn adm-btn--primary"),disabled:p.busy,type:"button",onClick:g[1]||(g[1]=H=>u("confirm"))},d(p.confirmLabel),11,Tn)]),default:v(()=>[l("div",Un,[rt(y.$slots,"default",{},void 0,!0)])]),_:3},8,["modelValue","title"])}}}),Pn=Object.assign(mt(En,[["__scopeId","data-v-839894a0"]]),{__name:"AdminUiConfirm"}),N={STARTER:{label:"Starter",priceUsd:50,fixedLimit:5e3,branding:!1,expiryRequired:!0,note:"$50 a month, 5,000 views, our branding"},PRO:{label:"Pro",priceUsd:100,fixedLimit:1e4,branding:!0,expiryRequired:!0,note:"$100 a month, 10,000 views, their branding"},SCALE:{label:"Scale",priceUsd:null,fixedLimit:null,branding:!0,expiryRequired:!0,note:"Negotiated: the limit is typed in, their branding"},CUSTOM:{label:"Custom",priceUsd:null,fixedLimit:null,branding:null,expiryRequired:!1,note:"Free: every limit by hand, may run forever"}},at=["STARTER","PRO","SCALE","CUSTOM"],lt=new Set(["STARTER","PRO","SCALE"]);function ye(p){return N[p??"CUSTOM"]??N.CUSTOM}function pt(p){return new Date(p).toISOString().slice(0,10)}function Ae(p,m){const[u,_,y]=p.split("-").map(Number),g=new Date(Date.UTC(u,_-1+m,1)),L=new Date(Date.UTC(g.getUTCFullYear(),g.getUTCMonth()+1,0)).getUTCDate();return g.setUTCDate(Math.min(y,L)),g.toISOString().slice(0,10)}function An(p,m){if(m<=p)return 1;let u=0;for(;Ae(p,u+1)<=m;)u+=1;const _=Ae(p,u);return Math.max(1,u+(m>_?1:0))}function he(p,m){if(!p)return null;const u=Date.parse(`${pt(m)}T00:00:00Z`);return Math.round((Date.parse(`${p}T00:00:00Z`)-u)/tn)}function Ue(p,m){const u=he(p.plan_expires_at,m);return u===null?"never":u<0?"expired":u<=14?"soon":"fine"}function Oe(p){return ye(p.plan).fixedLimit??(p.monthly_limit||null)}function Sn(p){return p.split(",").map(m=>{const u=m.trim().toLowerCase().replace(/\.+$/,"");if(!u)return"";const _=u.startsWith("*."),y=_?u.slice(2):u;try{const g=new URL(/^[a-z][a-z0-9+.-]*:\/\//.test(y)?y:`https://${y}`).hostname;return _?`*.${g}`:g}catch{return u}}
1).filter(Boolean)}function Rn(p,m){const u=p.trim().toLowerCase();if(!u)return!1;if(u.startsWith("*.")){const _=u.slice(2);return m===_||m.endsWith(`.${_}`)}return m===u}function ot(p,m){const u=p.domains??[];if(!u.length||!m)return!1;const _=m.trim().toLowerCase();return!u.some(y=>Rn(y,_))}const Te=32,Ee=18;function Ie(p){const m=p/255;return m<=.04045?m/12.92:((m+.055)/1.055)**2.4}async function Vn(p){if(typeof createImageBitmap=="function")try{return await createImageBitmap(p)}catch{}const m=URL.createObjectURL(p);try{return await new Promise((u,_)=>{const y=new Image;y.onload=()=>u(y),y.onerror=()=>_(new Error("The picture could not be decoded")),y.src=m})}finally{URL.revokeObjectURL(m)}}function st(p,m,u){const _=document.createElement("canvas");_.width=m,_.height=u;const y=_.getContext("2d",{willReadFrequently:!0});if(!y)throw new Error("No canvas available to measure the picture");return y.imageSmoothingQuality="high",y.drawImage(p,0,0,m,u),_}async function Ln(p){const m=await Vn(p),u="naturalWidth"in m?m.naturalWidth:m.width,_="naturalHeight"in m?m.naturalHeight:m.height;let y=m,g=u,L=_;for(;g/2>=Te&&L/2>=Ee;)g=Math.round(g/2),L=Math.round(L/2),y=st(y,g,L);const H=st(y,Te,Ee),{data:S}=H.getContext("2d").getImageData(0,0,Te,Ee);let w=0,q=0,B=0;const W=Te*Ee;for(let f=0;f<S.length;f+=4)w+=Ie(S[f]??0),q+=Ie(S[f+1]??0),B+=Ie(S[f+2]??0);w/=W,q/=W,B/=W;const z=.2126*w+.7152*q+.0722*B;if(!(z>0))throw new Error("The picture is black; a tint cannot be measured from it");const x=f=>Math.round(f/z*1e3)/1e3;return{width:u,height:_,tint:[x(w),x(q),x(B)]}}const Mn={key:0,class:"adm-note em-note"},Dn={class:"adm-grid adm-grid--stats"},On={class:"adm-user__sub"},In={class:"em-key"},Nn={class:"adm-mono"},Bn=["onClick"],Wn={class:"adm-num"},zn={class:"adm-user__sub"},jn={class:"adm-user__sub"},Fn={key:0,class:"adm-muted"},Hn={class:"adm-user__sub"},qn={class:"adm-user__sub"},Kn={class:"adm-user__sub"},Zn={class:"adm-num"},Gn={class:"adm-user__sub"},Yn={class:"em-actions"},Jn=["onClick"],Qn=["onClick"],Xn={class:"adm-menu__head"},ea=["onClick"],ta=["onClick"],na=["onClick"],aa=["onClick"],la=["onClick"],oa=["onClick"],sa={class:"adm-grid adm-grid--main-side"},ia={key:0,class:"em-total"},da={key:0,class:"adm-muted"},ra={key:1,class:"adm-muted"},ma={key:2,class:"em-bars"},ua={class:"em-bar__value adm-num"},pa={class:"em-bar__month"},ca={class:"em-bar__paid"},_a={key:0,class:"adm-list"},ba={class:"adm-user__sub"},fa=["onClick"],ya={key:1,class:"adm-muted"},ha=["value"],va=["value"],ga={key:0,class:"adm-muted"},ka={key:1,class:"adm-muted"},wa={key:0,class:"adm-user__sub"},xa={class:"em-nowrap"},$a={class:"adm-user__sub"},Ca=["onClick"],Ua={class:"em-foot adm-num"},Ta={class:"adm-field"},Ea={class:"adm-field"},Pa={class:"adm-field"},Aa={class:"adm-field"},Sa=["value"],Ra={class:"adm-muted adm-small"},Va={key:0,class:"adm-field"},La={key:1,class:"adm-field"},Ma={class:"adm-field"},Da={key:2,class:"adm-field em-check"},Oa={key:3,class:"adm-field"},Ia={key:1,class:"adm-field"},Na={key:2,class:"adm-note"},Ba=["disabled"],Wa={class:"adm-field"},za=["value"],ja={class:"em-dates"},Fa={class:"adm-field"},Ha={class:"adm-field"},qa={class:"em-quick"},Ka=["onClick"],Za={class:"adm-muted adm-small"},Ga={class:"adm-field"},Ya={class:"adm-muted adm-small"},Ja={class:"adm-field"},Qa={class:"adm-field"},Xa={class:"adm-note"},el={key:0,class:"adm-note"},tl=["disabled"],nl={key:0,class:"adm-note"},al={class:"adm-field"},ll={class:"em-preview em-preview--strip"},ol=["src"],sl={key:1,class:"adm-muted adm-small"},il={class:"em-upload"},dl={class:"adm-btn adm-btn--sm"},rl=["disabled"],ml={class:"adm-field"},ul=["disabled"],pl={key:1,class:"adm-field"},cl={class:"adm-muted adm-small"},_l={class:"adm-field em-check"},bl={class:"adm-field"},fl={class:"em-preview em-preview--wide"},yl=["src"],hl={key:1,class:"adm-muted adm-small"},vl={class:"em-upload"},gl={class:"adm-btn adm-btn--sm"},kl=["disabled"],wl={key:1,class:"adm-muted adm-small"},xl={class:"adm-field"},$l={class:"adm-field"},Cl={key:0,class:"adm-muted adm-small"},Ul={key:1,class:"em-item"},Tl=["src"],El={key:2,class:"em-bad adm-small"},Pl={class:"adm-field"},Al=["aria-label","value","onInput"],Sl={class:"em-colour__role"},Rl=["onUpdate:modelValue","aria-label","placeholder"],Vl=["disabled","onClick"],Ll={class:"em-theme__plate"},Ml={class:"em-theme__mark"},Dl={key:3,class:"adm-muted adm-small"},Ol={key:4,class:"adm-note"},Il=["disabled"],Nl="#725df8",Bl="#1b1f28",Wl=Be({__name:"index",async setup(p){let m,u;_n({title:"Embed keys · CSMC Admin"});const _=gn(),{notify:y}=kn(),{can:g}=wn(),L=U(()=>g("content.edit")),H=U(()=>g("money.view")),S=U(()=>g("money.edit")),{data:w,error:q,refresh:B}=([m,u]=bn(()=>
1yn("adm-embed",Zt)),m=await m,u(),m),{data:W,pending:z,error:x,refresh:f}=tt("adm-embed-revenue",()=>Ft(12),{server:!1,immediate:!1}),{data:R,pending:ee,error:me,refresh:ue}=tt("adm-embed-payments",()=>Ht({limit:200}),{server:!1,immediate:!1});fn(()=>{w.value?.plansAvailable&&H.value&&(f(),ue())});const ae=U(()=>w.value?.partners??[]),Se=U(()=>ae.value.filter(a=>a.is_active)),ge=U(()=>ae.value.filter(a=>!a.is_active)),le=O("active"),ct=U(()=>[{key:"active",label:"Active",count:Se.value.length},{key:"inactive",label:"Switched off or revoked",count:ge.value.length},{key:"all",label:"All",count:ae.value.length}]),_t=U(()=>le.value==="active"?Se.value:le.value==="inactive"?ge.value:ae.value);function bt(a){const t=Oe(a);return!!t&&(a.stats?.views_month??0)>=t}const ke=U(()=>ae.value.filter(a=>a.is_active&&lt.has(a.plan)&&a.plan_expires_at&&(he(a.plan_expires_at,_.value)??99)<=30).sort((a,t)=>(a.plan_expires_at??"").localeCompare(t.plan_expires_at??"")));function ft(a){const t=he(a.plan_expires_at,_.value);return t===null?"never expires":t<0?`expired ${-t} ${t===-1?"day":"days"} ago`:t===0?"last day today":`ends in ${t} ${t===1?"day":"days"}`}const yt=U(()=>{const a=ae.value,t=a.reduce((M,A)=>M+(A.stats?.views_month??0),0),k=a.reduce((M,A)=>M+(A.stats?.views_today??0),0),E=a.filter(M=>M.is_active&&lt.has(M.plan)&&Ue(M,_.value)==="expired").length;return[{label:"Active keys",value:D(Se.value.length),hint:ge.value.length?`${D(ge.value.length)} switched off or revoked`:"Every key issued is active"},{label:"Views this month",value:D(t),hint:`${D(k)} today`},{label:"CDN this month, estimated",value:`${(t*6.4/1024).toFixed(1)} GB`,hint:"About 6.4 MB per view"},w.value?.plansAvailable?{label:"Expiring within 30 days",value:D(ke.value.length),hint:E?`${D(E)} already expired and refusing frames`:"Paid plans that end soon"}:{label:"Views today",value:D(k)}]}),ht=U(()=>(W.value??[]).reduce((a,t)=>a+t.amount_usd,0)),We=U(()=>Math.max(0,...(W.value??[]).map(a=>a.amount_usd))),Y=Ce({partner:"",year:""}),vt=U(()=>[...new Set((R.value??[]).map(a=>a.partner_name))].sort()),gt=U(()=>[...new Set((R.value??[]).map(a=>a.paid_at.slice(0,4)))].sort().reverse()),pe=U(()=>(R.value??[]).filter(a=>(!Y.partner||a.partner_name===Y.partner)&&(!Y.year||a.paid_at.startsWith(Y.year)))),kt=U(()=>pe.value.reduce((a,t)=>a+t.amount_usd,0)),j=O(null),Re=U({get:()=>!!j.value,set:a=>{a||(j.value=null)}});function wt(){const a=j.value;j.value=null,a?.run()}const I=O(!1),Ve=O("");async function oe(a,t){I.value=!0;try{y(await a()),t?.(),await B()}catch(k){y(k.message||"The action failed",!1)}finally{I.value=!1}}function xt(a){const t=`<div data-csmc-inspect data-key="${a.key}" data-item="AK-47 | Redline"></div>
2<script src="https://csmarketcap.com/embed.js" async><\/script>`;navigator.clipboard?.writeText(t).then(()=>{Ve.value=a.id,setTimeout(()=>{Ve.value=""},2e3)}).catch(()=>y("Could not copy. Select the key by hand.",!1))}function $t(a){return oe(async()=>{const t=await Qe(a.id,{is_active:!a.is_active});return`${t.name} is ${t.is_active?"switched on":"switched off"}`})}function Ct(a){j.value={title:`Rotate ${a.name}'s key`,body:`${a.name} gets a new key, and the one in their page stops working the moment you confirm: until they paste the new snippet their visitors see a refusal instead of the viewer. Views, payments and branding are untouched.`,confirmLabel:"Rotate the key",run:()=>Ut(a)}}function Ut(a){return oe(async()=>(await Gt(a.id),`${a.name} has a new key. The old one stopped working; send them the new snippet.`))}function Tt(a){j.value={title:`Revoke ${a.name}'s key`,body:`Frames on ${a.name} stop rendering at once. The key stays on record with its views and its payments and moves to the Revoked tab, and you can issue them a new one whenever they come back.`,confirmLabel:"Revoke the key",run:()=>Et(a)}}function Et(a){return oe(async()=>(await Yt(a.id),`${a.name}'s key is revoked. Its history stays.`))}function Pt(a){const t=a.stats?.views_total??0;j.value={title:`Delete ${a.name}`,body:`${a.name} is removed for good${t?`, and ${Xe(t)} recorded views go with it`:""}. A partner with payments on record cannot be deleted at all — revoke the key instead, and the history stays.`,confirmLabel:"Delete the key",run:()=>At(a)}}function At(a){return oe(async()=>
2{if(!await Jt(a.id))throw new Error(`${a.name} has payments on record, so it cannot be deleted. Revoke the key instead; the history stays.`);return`${a.name} is deleted`})}function St(a){j.value={title:"Delete this payment",body:`The record of ${Q(a.amount_usd,{cents:!0})} from ${a.partner_name} goes. The plan and the expiry date stay exactly where they are — if the money is going back, move the date on the key itself.`,confirmLabel:"Delete the payment",run:()=>Rt(a)}}function Rt(a){return oe(async()=>(await Qt(a.id),ue(),f(),`Payment of ${Q(a.amount_usd,{cents:!0})} from ${a.partner_name} deleted. The plan and expiry were left as they are.`))}const te=O(!1),se=O(""),c=Ce({id:"",name:"",domains:"",rate_limit_per_min:null,plan:"CUSTOM",monthly_limit:null,plan_expires_at:"",branding_allowed:!1,hadExpiry:!1}),ne=U(()=>N[c.plan]);function Vt(){Object.assign(c,{id:"",name:"",domains:"",rate_limit_per_min:null,plan:"CUSTOM",monthly_limit:null,plan_expires_at:"",branding_allowed:!1,hadExpiry:!1}),se.value="",te.value=!0}function ze(a){Object.assign(c,{id:a.id,name:a.name,domains:(a.domains??[]).join(", "),rate_limit_per_min:a.rate_limit_per_min??null,plan:a.plan,monthly_limit:a.monthly_limit??null,plan_expires_at:a.plan_expires_at??"",branding_allowed:a.branding_allowed,hadExpiry:!!a.plan_expires_at}),se.value="",te.value=!0}function je(){if(I.value||!c.name)return;const a=w.value?.plansAvailable??!1;if(a&&ne.value.expiryRequired&&!c.plan_expires_at){se.value=`A ${ne.value.label} key needs an end date. Record the first payment afterwards to move it.`;return}se.value="";const t={name:c.name,domains:Sn(c.domains)};return oe(async()=>{if(c.id){const E={...t,rate_limit_per_min:c.rate_limit_per_min||0,monthly_limit:c.monthly_limit||0};return a&&(E.plan=c.plan,E.branding_allowed=c.branding_allowed,c.plan_expires_at?E.plan_expires_at=c.plan_expires_at:c.hadExpiry&&(E.plan_expires_at=null)),`${(await Qe(c.id,E)).name} saved`}return`Key issued for ${(await Xt({...t,rate_limit_per_min:c.rate_limit_per_min||null,monthly_limit:c.monthly_limit||null,...a?{plan:c.plan,plan_expires_at:c.plan_expires_at||null,branding_allowed:c.branding_allowed}:{}})).name}. Copy the snippet from the list.`},()=>{te.value=!1})}const ie=O(!1),ce=O(""),r=Ce({partnerId:"",partnerName:"",plan:"PRO",amount:null,amountTouched:!1,from:"",to:"",paidOn:"",note:""}),we=U(()=>r.from&&r.to?An(r.from,r.to):1),Le=U(()=>!!(r.from&&r.to&&r.to>=r.from&&r.paidOn&&r.amount!==null&&r.amount!==void 0&&Number.isFinite(r.amount)&&r.amount>=0));function Fe(a){const t=pt(_.value),k=a.plan_expires_at??"",E=k&&k>t?k:t;Object.assign(r,{partnerId:a.id,partnerName:a.name,plan:a.plan==="CUSTOM"?"PRO":a.plan,amountTouched:!1,from:E,to:Ae(E,1),paidOn:t,note:""}),ce.value="",He(),ie.value=!0}function He(){if(r.amountTouched)return;const a=N[r.plan].priceUsd;r.amount=a===null?null:a*we.value}dt(()=>[r.plan,r.from,r.to],He);function qe(){I.value||!Le.value||(ce.value="",I.value=!0,qt({partner_id:r.partnerId,amount_usd:r.amount??0,plan:r.plan,period_from:r.from,period_to:r.to,paid_at:r.paidOn,note:r.note||null}).then(async a=>{ie.value=!1,y(`${Q(a.amount_usd,{cents:!0})} recorded. ${a.partner_name} is on ${N[a.plan].label} until ${F(`${a.period_to}T00:00:00Z`)}.`),await Promise.all([B(),ue(),f()])}).catch(a=>{ce.value=a.message||"The payment was not recorded"}).finally(()=>{I.value=!1}))}const Lt={logo:{maxBytes:512*1024,types:["image/png","image/svg+xml","image/webp"],label:"PNG, SVG or WebP up to 512 KB"},backdrop:{maxBytes:4*1024*1024,types:["image/jpeg","image/png","image/webp"],label:"JPG, PNG or WebP up to 4 MB"}},de=O(!1),K=O(""),o=Ce({partnerId:"",partnerName:"",allowed:!1,logo_url:"",logo_link:"",hide_mark:!1,backdrop_url:"",backdrop_tint:null,backdropNote:"",default_view:"",default_item:"",itemState:"idle",itemImage:"",site_label:"",accent_color:"",surface_color:"",uploading:"",replaced:[],uploaded:[]}),xe=/^#?[0-9a-f]{6}$/i,Mt=U(()=>vn({accent_color:xe.test(o.accent_color)?o.accent_color:null,surface_color:xe.test(o.surface_color)?o.surface_color:null})),Dt=[{key:"accent_color",label:"Accent",ours:Nl},{key:"surface_color",label:"Surface",ours:Bl}],Ot=a=>(a.startsWith("#")?a:`#${a}`).toLowerCase();function It(a,t){o[a]=t.target.value}function Nt(a){const t=a.branding;Object.assign(o,{partnerId:a.id,partnerName:a.name,allowed:a.branding_allowed,logo_url:t?.logo_url??"",logo_link:t?.logo_link??"",hide_mark:t?.hide_mark??!1,backdrop_url:t?.backdrop_url??"",backdrop_tint:t?.backdrop_tint?[...t.backdrop_tint]:null,backdropNote:"",default_view:t?.default_view??"",default_item:t?.default_item??"",itemState:"idle",itemImage:"",site_label:t?.site_label??"",accent_color:t?.accent_color??"",surface_color:t?.surface_color??"",uploading:"",replaced:[],uploaded:[]}),K.value="",de.value=!0,o.default_item&&Ye()}
2async function Ke(a){for(const t of a)await en(t).catch(()=>{})}async function Ze(a,t){const k=t.target,E=k.files?.[0];if(k.value="",!E)return;const M=Lt[a];if(!M.types.includes(E.type)||E.size>M.maxBytes){K.value=`The ${a==="logo"?"logo":"background"} must be ${M.label}.`;return}K.value="",o.uploading=a;try{let A=null;a==="backdrop"&&(A=await Ln(E).catch(()=>null));const $e=new FormData;$e.append("data",E,E.name);const Z=await fetch(`/api/admin/embed-upload?kind=${a}`,{method:"POST",body:$e,credentials:"include"});if(!Z.ok){const J=await Z.text().catch(()=>"");throw new Error(J.replace(/^.*"statusMessage":"([^"]*)".*$/s,"$1")||`The upload failed (${Z.status})`)}const{path:_e}=await Z.json(),re=a==="logo"?o.logo_url:o.backdrop_url;if(re&&!o.uploaded.includes(re)&&o.replaced.push(re),o.uploaded.push(_e),a==="logo")o.logo_url=_e;else{o.backdrop_url=_e,o.backdrop_tint=A?.tint??null;const J=A&&(A.width<1920||A.height<1080);o.backdropNote=A?`${A.width} × ${A.height}${J?", smaller than 1920 × 1080: it will look soft in the frame":""}. Tint ${A.tint.join(", ")}.`:"The picture could not be measured, so it is saved without a tint and the frame lights it neutrally."}}catch(A){K.value=A.message||"The upload failed"}finally{o.uploading=""}}function Ge(a){const t=a==="logo"?o.logo_url:o.backdrop_url;t&&!o.uploaded.includes(t)&&o.replaced.push(t),a==="logo"?(o.logo_url="",o.logo_link=""):(o.backdrop_url="",o.backdrop_tint=null,o.backdropNote="")}async function Ye(){const a=o.default_item;if(!a){o.itemState="idle",o.itemImage="";return}o.itemState="checking";try{const t=await fetch(`/api/inspect/lookup?name=${encodeURIComponent(a)}`);if(a!==o.default_item)return;if(t.ok){const k=await t.json();o.itemState="ok",o.itemImage=k.image??""}else o.itemState="missing",o.itemImage=""}catch{o.itemState="idle"}}function Je(){if(!(I.value||o.uploading)){if(o.logo_url&&o.logo_link&&!/^https:\/\/[^/\s]+/.test(o.logo_link)){K.value="The logo link must start with https:// and name a host.";return}for(const[a,t]of[["accent",o.accent_color],["surface",o.surface_color]])if(t&&!xe.test(t)){K.value=`The ${a} colour must be six hex digits, like #725df8.`;return}K.value="",I.value=!0,Kt(o.partnerId,{logo_url:o.logo_url||null,logo_link:o.logo_url&&o.logo_link?o.logo_link:null,hide_mark:o.hide_mark,backdrop_url:o.backdrop_url||null,backdrop_tint:o.backdrop_url?o.backdrop_tint:null,default_view:o.default_view||null,default_item:o.default_item||null,...w.value?.brandingNextAvailable?{site_label:o.site_label.trim()||null,accent_color:o.accent_color||null,surface_color:o.surface_color||null}:{}}).then(async a=>{const t=new Set([a.branding?.logo_url,a.branding?.backdrop_url]);await Ke(o.replaced.filter(k=>!t.has(k))),o.replaced=[],o.uploaded=[],de.value=!1,y(`Branding for ${a.name} saved. It reaches the frame within a minute${a.branding_allowed?"":", once the plan allows it"}.`),await B()}).catch(a=>{K.value=a.message||"The branding was not saved"}).finally(()=>{I.value=!1})}}function Bt(){const a=o.uploaded;o.uploaded=[],o.replaced=[],de.value=!1,Ke(a)}const Wt=U(()=>[{key:"name",label:"Partner",sortable:!0},{key:"domains",label:"Domains"},{key:"limits",label:"Limits"},...w.value?.plansAvailable?[{key:"plan",label:"Plan",sortable:!0},{key:"plan_expires_at",label:"Until",sortable:!0}]:[],{key:"views",label:"Views this month"},{key:"actions",label:"",align:"right"}]),zt=[{key:"paid_at",label:"Paid on",sortable:!0,format:a=>F(`${a}T00:00:00Z`)},{key:"partner_name",label:"Partner",sortable:!0},{key:"plan",label:"Plan",format:a=>ye(a).label},{key:"amount_usd",label:"Amount",align:"right",sortable:!0,format:a=>Q(a,{cents:!0})},{key:"period",label:"Period"},{key:"act",label:"",align:"right"}];return(a,t)=>{const k=it,E=nn,M=an,A=sn,$e=dn,Z=rn,_e=Cn,re=hn,J=ln,jt=Pn,Me=ut;return s(),i("div",null,[T(E,{description:"Keys for the embeddable 3D viewer: who may render it, on which domains, how often, and what they pay for it. A key travels in the partner's HTML and is public by design; the domain list and the plan are what protect it.",title:"Embed keys"},{default:v(()=>[e(L)?(s(),i("button",{key:0,class:"adm-btn adm-btn--primary",type:"button",onClick:Vt},[T(k,{size:14,name:"plus"}),t[33]||(t[33]=b(" Issue a key ",-1))])):h("",!0)]),_:1}),e(q)?(s(),X(M,{key:0,error:e(q),retry:e(B)},null,8,["error","retry"])):e(w)?(s(),i(P,{key:1},[e(w).plansAvailable?h("",!0):(s(),i("p",Mn," Plans are not available on the backend yet. Keys, domains and limits work as before; plans, expiry dates and payments appear once the backend with them is deployed. ")),l("div",Dn,[(s(!0),i(P,null,G(e(yt),n=>(s(),X(A,{key:n.label,stat:n},null,8,["stat"]))),128))]),T(J,null,{default:v(()=>[T($e,{modelValue:e(le),"onUpdate:modelValue":t[0]||(t[0]=n=>be(le)?le.value=n:null),tabs:e(ct)},null,8,["modelValue","tabs"]),T(re,{columns:e(Wt),"empty-text":e(le)==="active"?"No active keys. Issue one above and hand over the snippet.":"Nothing here.","page-size":20,rows:e(_t),"row-key":"id"},{"cell-name":v(({row:n})=>[l("strong",null,d(n.name),1),l("span",On,"since "+d(e(F)(n.created_at)),1),l("span",In,[l("code",Nn,d(n.key),1),l("button",{class:"adm-btn adm-btn--sm",type:"button",onClick:$=>xt(n)},d(e(Ve)===n.id?"Copied":"Copy snippet"),9,Bn)]),n.revoked_at?(s(),X(Z,{key:0,label:`Revoked ${e(F)(n.revoked_at)}`,class:"em-state",tone:"critical"},null,8,["label"])):n.is_active?h("",!0):(s(),X(Z,{key:1,class:"em-state",label:"Switched off",tone:"neutral"}))]),"cell-domains":v(({row:n})=>[l("span",{class:Pe({"em-open":!n.domains?.length})},d(n.domains?.length?n.domains.join(", "):"any domain"),3),(s(!0),i(P,null,G(n.stats?.top_domains??[],$=>(s(),i("span",{key:$.domain,class:Pe([{"em-seen--alien":e(ot)(n,$.domain)},"em-seen"])},[b(d($.domain||"unknown host")+" · "+d(e(D)($.views)),1),e(ot)(n,$.domain)?(s(),i(P,{key:0},[b(" · not on the list")],64)):h("",!0)],2))),128))]),"cell-limits":v(({row:n})=>[l("span",Wn,d(e(Oe)(n)?`${e(D)(e(Oe)(n)??0)} a month`:"Unlimited"),1),l("span",zn,d(n.rate_limit_per_min?`${e(D)(n.rate_limit_per_min)} a minute`:"No per-minute limit")+d(e(ye)(n.plan).fixedLimit?" · from the plan":""),1),bt(n)?(s(),X(Z,{key:0,class:"em-state",label:"Over limit",tone:"serious"})):h("",!0)]),"cell-plan":v(({row:n})=>[l("span",{class:Pe({"adm-muted":n.plan==="CUSTOM"})},d(e(ye)(n.plan).label),3),l("span",jn,d(n.branding_allowed?"Their branding":"Our branding")+d(n.branding?.logo_url||n.branding?.backdrop_url?" · files set":""),1)]),"cell-plan_expires_at":v(({row:n})=>[e(Ue)(n,e(_))==="never"?(s(),i("span",Fn,"never")):e(Ue)(n,e(_))==="expired"?(s(),i(P,{key:1},[T(Z,{label:"Expired",tone:"critical"}),l("span",Hn,d(e(F)(`${n.plan_expires_at}T00:00:00Z`))+" · frames are refused",1)],64)):e(Ue)(n,e(_))==="soon"?(s(),i(P,{key:2},[T(Z,{label:`In ${e(he)(n.plan_expires_at,e(_))}
2 days`,tone:"warning"},null,8,["label"]),l("span",qn,d(e(F)(`${n.plan_expires_at}T00:00:00Z`)),1)],64)):(s(),i(P,{key:3},[b(d(e(F)(`${n.plan_expires_at}T00:00:00Z`))+" ",1),l("span",Kn,"in "+d(e(he)(n.plan_expires_at,e(_)))+" days",1)],64))]),"cell-views":v(({row:n})=>[l("span",Zn,d(e(D)(n.stats?.views_month??0)),1),l("span",Gn,d(e(D)(n.stats?.views_today??0))+" today · "+d(e(Xe)(n.stats?.views_total??0))+" all time",1)]),"cell-actions":v(({row:n})=>[l("div",Yn,[e(S)&&e(w).plansAvailable?(s(),i("button",{key:0,class:"adm-btn adm-btn--sm adm-btn--primary",type:"button",onClick:$=>Fe(n)}," Record payment ",8,Jn)):e(L)?(s(),i("button",{key:1,class:"adm-btn adm-btn--sm",type:"button",onClick:$=>ze(n)}," Edit ",8,Qn)):h("",!0),e(L)?(s(),X(_e,{key:2,label:`More actions for ${n.name}`},{default:v(()=>[l("p",Xn,d(n.name),1),e(S)&&e(w).plansAvailable?(s(),i("button",{key:0,class:"adm-menu__item",role:"menuitem",type:"button",onClick:$=>ze(n)},[T(k,{size:16,name:"edit"}),t[34]||(t[34]=b(" Edit the key ",-1))],8,ea)):h("",!0),e(w).plansAvailable?(s(),i("button",{key:1,class:"adm-menu__item",role:"menuitem",type:"button",onClick:$=>Nt(n)},[T(k,{size:16,name:"palette"}),t[35]||(t[35]=b(" Branding… ",-1))],8,ta)):h("",!0),l("button",{class:"adm-menu__item",role:"menuitem",type:"button",onClick:$=>$t(n)},[T(k,{size:16,name:"power"}),b(" "+d(n.is_active?"Switch off":"Switch on"),1)],8,na),t[39]||(t[39]=l("div",{class:"adm-menu__sep"},null,-1)),l("button",{class:"adm-menu__item adm-menu__item--danger",role:"menuitem",type:"button",onClick:$=>Ct(n)},[T(k,{size:16,name:"refresh"}),t[36]||(t[36]=b(" Rotate the key… ",-1))],8,aa),n.revoked_at?h("",!0):(s(),i("button",{key:2,class:"adm-menu__item adm-menu__item--danger",role:"menuitem",type:"button",onClick:$=>Tt(n)},[T(k,{size:16,name:"ban"}),t[37]||(t[37]=b(" Revoke… ",-1))],8,la)),l("button",{class:"adm-menu__item adm-menu__item--danger",role:"menuitem",type:"button",onClick:$=>Pt(n)},[T(k,{size:16,name:"trash"}),t[38]||(t[38]=b(" Delete… ",-1))],8,oa)]),_:2},1032,["label"])):h("",!0)])]),_:1},8,["columns","empty-text","rows"])]),_:1}),e(w).plansAvailable&&e(H)?(s(),i(P,{key:1},[t[42]||(t[42]=l("div",{class:"em-gap"},null,-1)),l("div",sa,[T(J,{subtitle:"What partners paid, by the month the money arrived. Months with nothing are zero, not gaps.",title:"Revenue, last 12 months"},{actions:v(()=>[e(W)?(s(),i("span",ia,d(e(Q)(e(ht)))+" in twelve months",1)):h("",!0)]),default:v(()=>[e(z)||!e(W)&&!e(x)?(s(),i("p",da," Loading… ")):e(x)||!e(W)?(s(),i("p",ra," The API did not answer. The rest of the page is unaffected. ")):(s(),i("div",ma,[(s(!0),i(P,null,G(e(W),n=>(s(),i("div",{key:n.month,class:"em-bar"},[l("span",ua,d(n.amount_usd?e(Q)(n.amount_usd):""),1),l("span",{style:Ne({height:`${e(We)?Math.max(n.amount_usd/e(We)*100,n.amount_usd?3:1):1}%`}),class:"em-bar__fill"},null,4),l("span",pa,d(e(on)(n.month)),1),l("span",ca,d(n.partners_paid?`${n.partners_paid} paid`:"–"),1)]))),128))]))]),_:1}),T(J,{count:e(ke).length,subtitle:"Paid plans that end within 30 days or have ended. Soonest first.",title:"Expiring within 30 days"},{default:v(()=>[e(ke).length?(s(),i("ul",_a,[(s(!0),i(P,null,G(e(ke),n=>(s(),i("li",{key:n.id,class:"em-expiring"},[l("div",null,[l("strong",null,d(n.name),1),l("span",ba,d(e(ye)(n.plan).label)+" · "+d(ft(n)),1)]),e(S)?(s(),i("button",{key:0,class:"adm-btn adm-btn--sm",type:"button",onClick:$=>Fe(n)}," Record payment ",8,fa)):h("",!0)]))),128))])):(s(),i("p",ya," Nothing expiring. "))]),_:1},8,["count"])]),T(J,{count:e(pe).length,subtitle:"Every payment an administrator recorded, newest first. Deleting one removes the record only: the partner's plan and expiry stay where they are.",title:"Payments"},{actions:v(()=>[C(l("select",{"onUpdate:modelValue":t[1]||(t[1]=n=>e(Y).partner=n),"aria-label":"Partner",class:"adm-select"},[t[40]||(t[40]=l("option",{value:""}," Every partner ",-1)),(s(!0),i(P,null,G(e(vt),n=>(s(),i("option",{key:n,value:n},d(n),9,ha))),128))],512),[[fe,e(Y).partner]]),C(l("select",{"onUpdate:modelValue":t[2]||(t[2]=n=>e(Y).year=n),"aria-label":"Year",class:"adm-select"},[t[41]||(t[41]=l("option",{value:""}," Every year ",-1)),(s(!0),i(P,null,G(e(gt),n=>(s(),i("option",{key:n,value:n},d(n),9,va))),128))],512),[[fe,e(Y).year]])]),default:v(()=>[e(ee)||!e(R)&&!e(me)?(s(),i("p",ga," Loading… ")):e(me)||!e(R)?(s(),i("p",ka," The API did not answer. The rest of the page is unaffected. ")):(s(),i(P,{key:2},[T(re,{columns:zt,"page-size":15,rows:e(pe),"empty-text":"No payments recorded yet.","row-key":"id"},{"cell-partner_name":v(({row:n})=>[b(d(n.partner_name)+" ",1),n.note?(s(),i("span",wa,d(n.note),1)):h("",!0)]),"cell-period":v(({row:n})=>[l("span",xa,d(e(F)(`${n.period_from}T00:00:00Z`))+" to "+d(e(F)(`${n.period_to}T00:00:00Z`)),1),l("span",$a,"recorded by "+d(n.recorded_by??"an account since removed"),1)]),"cell-act":v(({row:n})=>[e(S)?(s(),i("button",{key:0,class:"adm-btn adm-btn--sm adm-btn--danger em-nowrap",type:"button",onClick:$=>St(n)}," Delete ",8,Ca)):h("",!0)]),_:1},8,["rows"]),l("p",Ua,d(e(D)(e(pe).length))+" "+d(e(pe).length===1?"payment":"payments")+", "+d(e(Q)(e(kt),{cents:!0})),1)],64))]),_:1},8,["count"])],64)):h("",!0),T(jt,{modelValue:e(Re),"onUpdate:modelValue":t[3]||(t[3]=n=>be(Re)?Re.value=n:null),busy:e(I),"confirm-label":e(j)?.confirmLabel??"Confirm",title:e(j)?.title??"",onConfirm:wt},{default:v(()=>[l("p",null,d(e(j)?.body),1)]),_:1}
2,8,["modelValue","busy","confirm-label","title"]),T(Me,{modelValue:e(te),"onUpdate:modelValue":t[13]||(t[13]=n=>be(te)?te.value=n:null),title:e(c).id?`Edit ${e(c).name||"the key"}`:"Issue a key"},{footer:v(()=>[l("button",{class:"adm-btn",type:"button",onClick:t[12]||(t[12]=n=>te.value=!1)}," Cancel "),l("button",{disabled:e(I)||!e(c).name,class:"adm-btn adm-btn--primary",type:"button",onClick:je},d(e(c).id?"Save":"Issue the key"),9,Ba)]),default:v(()=>[l("form",{class:"adm-form",onSubmit:ve(je,["prevent"])},[l("label",Ta,[t[43]||(t[43]=b(" Partner ",-1)),C(l("input",{"onUpdate:modelValue":t[4]||(t[4]=n=>e(c).name=n),class:"adm-input",placeholder:"Waxpeer",type:"text"},null,512),[[V,e(c).name,void 0,{trim:!0}]])]),l("label",Ea,[t[44]||(t[44]=b(" Domains, comma separated. Empty means any domain: trials only ",-1)),C(l("input",{"onUpdate:modelValue":t[5]||(t[5]=n=>e(c).domains=n),class:"adm-input",placeholder:"waxpeer.com, *.waxpeer.com",type:"text"},null,512),[[V,e(c).domains,void 0,{trim:!0}]])]),l("label",Pa,[t[45]||(t[45]=b(" Requests a minute. Empty means no limit ",-1)),C(l("input",{"onUpdate:modelValue":t[6]||(t[6]=n=>e(c).rate_limit_per_min=n),class:"adm-input",min:"0",placeholder:"240",type:"number"},null,512),[[V,e(c).rate_limit_per_min,void 0,{number:!0}]])]),e(w).plansAvailable?(s(),i(P,{key:0},[l("label",Aa,[t[46]||(t[46]=b(" Plan ",-1)),C(l("select",{"onUpdate:modelValue":t[7]||(t[7]=n=>e(c).plan=n),class:"adm-select"},[(s(!0),i(P,null,G(e(at),n=>(s(),i("option",{key:n,value:n},d(e(N)[n].label),9,Sa))),128))],512),[[fe,e(c).plan]]),l("span",Ra,d(e(N)[e(c).plan].note),1)]),e(ne).fixedLimit===null?(s(),i("label",Va,[t[47]||(t[47]=b(" Views a month. Empty means unlimited ",-1)),C(l("input",{"onUpdate:modelValue":t[8]||(t[8]=n=>e(c).monthly_limit=n),class:"adm-input",min:"0",placeholder:"50000",type:"number"},null,512),[[V,e(c).monthly_limit,void 0,{number:!0}]])])):(s(),i("p",La,[t[48]||(t[48]=b(" Views a month ",-1)),l("span",null,d(e(D)(e(ne).fixedLimit))+" a month, from the plan",1)])),l("label",Ma,[b(d(e(ne).expiryRequired?"Expires on":"Expires on. Empty means never")+" ",1),C(l("input",{"onUpdate:modelValue":t[9]||(t[9]=n=>e(c).plan_expires_at=n),class:"adm-input",type:"date"},null,512),[[V,e(c).plan_expires_at]]),t[49]||(t[49]=l("span",{class:"adm-muted adm-small"},"The key works through the whole of that day. Changing it here records no payment.",-1))]),e(ne).branding===null?(s(),i("div",Da,[C(l("input",{id:"em-branding-allowed","onUpdate:modelValue":t[10]||(t[10]=n=>e(c).branding_allowed=n),type:"checkbox"},null,512),[[nt,e(c).branding_allowed]]),t[50]||(t[50]=l("label",{for:"em-branding-allowed"},"May use their own branding in the frame",-1))])):(s(),i("p",Oa,[t[51]||(t[51]=b(" Branding ",-1)),l("span",null,d(e(ne).branding?"Their branding, from the plan":"Our branding, from the plan"),1)]))],64)):(s(),i("label",Ia,[t[52]||(t[52]=b(" Views a month. Empty means unlimited ",-1)),C(l("input",{"onUpdate:modelValue":t[11]||(t[11]=n=>e(c).monthly_limit=n),class:"adm-input",min:"0",type:"number"},null,512),[[V,e(c).monthly_limit,void 0,{number:!0}]])])),e(se)?(s(),i("p",Na,d(e(se)),1)):h("",!0)],32)]),_:1},8,["modelValue","title"]),T(Me,{modelValue:e(ie),"onUpdate:modelValue":t[22]||(t[22]=n=>be(ie)?ie.value=n:null),title:`Record a payment from ${e(r).partnerName}`},{footer:v(()=>[l("button",{class:"adm-btn",type:"button",onClick:t[21]||(t[21]=n=>ie.value=!1)}," Cancel "),l("button",{disabled:e(I)||!e(Le),class:"adm-btn adm-btn--primary",type:"button",onClick:qe}," Record "+d(e(r).amount!==null&&e(r).amount!==void 0&&e(Le)?e(Q)(e(r).amount,{cents:!0}):"the payment"),9,tl)]),default:v(()=>[l("form",{class:"adm-form",onSubmit:ve(qe,["prevent"])},[l("label",Wa,[t[53]||(t[53]=b(" Plan bought ",-1)),C(l("select",{"onUpdate:modelValue":t[14]||(t[14]=n=>e(r).plan=n),class:"adm-select"},[(s(!0),i(P,null,G(e(at),n=>(s(),i("option",{key:n,value:n},d(e(N)[n].label)+d(e(N)[n].priceUsd?` · $${e(N)[n].priceUsd} a month`:""),9,za))),128))],512),[[fe,e(r).plan]])]),l("div",ja,[l("label",Fa,[t[54]||(t[54]=b(" Period from ",-1)),C(l("input",{"onUpdate:modelValue":t[15]||(t[15]=n=>e(r).from=n),class:"adm-input",type:"date"},null,512),[[V,e(r).from]])]),l("label",Ha,[t[55]||(t[55]=b(" Period to ",-1)),C(l("input",{"onUpdate:modelValue":t[16]||(t[16]=n=>e(r).to=n),class:"adm-input",type:"date"},null,512),[[V,e(r).to]])])]),l("div",qa,[(s(),i(P,null,G([1,6,12],n=>l("button",{key:n,class:"adm-btn adm-btn--sm",type:"button",onClick:$=>e(r).to=e(Ae)(e(r).from,n)}," +"+d(n)+" mo ",9,Ka)),64)),l("span",Za,d(e(we))+" "+d(e(we)===1?"month":"months")+" · the key will work through "+d(e(r).to?e(F)(`${e(r).to}T00:00:00Z`):"…"),1)]),l("label",Ga,[t[56]||(t[56]=b(" Amount, USD ",-1)),C(l("input",{"onUpdate:modelValue":t[17]||(t[17]=n=>e(r).amount=n),class:"adm-input",min:"0",step:"0.01",type:"number",onInput:t[18]||(t[18]=n=>e(r).amountTouched=!0)},null,544),[[V,e(r).amount,void 0,{number:!0}]]),l("span",Ya,d(e(N)[e(r).plan].priceUsd?`Prefilled from $${e(N)[e(r).plan].priceUsd} × ${e(we)}. Type over it for a discount.`:"No list price for this plan: type the agreed amount."),1)]),l("label",Ja,[t[57]||(t[57]=b(" Paid on ",-1)),C(l("input",{"onUpdate:modelValue":t[19]||(t[19]=n=>e(r).paidOn=n),class:"adm-input",type:"date"},null,512),[[V,e(r).paidOn]])]),l("label",Qa,[t[58]||(t[58]=b(" Note, optional ",-1)),C(l("input",{"onUpdate:modelValue":t[20]||(t[20]=n=>e(r).note=n),class:"adm-input",placeholder:"invoice 1042, paid in USDT…",type:"text"},null,512),[[V,e(r).note,void 0,{trim:!0}]])]),l("p",Xa," This records the money and moves the partner to "+d(e(N)[e(r).plan].label)+" until "+d(e(r).to?e(F)(`${e(r).to}
2T00:00:00Z`):"the end of the period")+", in one step. ",1),e(ce)?(s(),i("p",el,d(e(ce)),1)):h("",!0)],32)]),_:1},8,["modelValue","title"]),T(Me,{modelValue:e(de),"onUpdate:modelValue":t[32]||(t[32]=n=>be(de)?de.value=n:null),title:`Branding for ${e(o).partnerName}`},{footer:v(()=>[t[74]||(t[74]=l("span",{class:"adm-muted adm-small em-reach"},"Reaches the frame within a minute.",-1)),l("button",{class:"adm-btn",type:"button",onClick:Bt}," Cancel "),l("button",{disabled:e(I)||e(o).uploading!=="",class:"adm-btn adm-btn--primary",type:"button",onClick:Je}," Save ",8,Il)]),default:v(()=>[l("form",{class:"adm-form",onSubmit:ve(Je,["prevent"])},[e(o).allowed?h("",!0):(s(),i("p",nl," This plan does not show branding in the frame. The settings are kept and will apply when the plan allows it. ")),l("div",al,[t[59]||(t[59]=b(" Logo. PNG, SVG or WebP up to 512 KB, shown 18 px high ",-1)),l("div",ll,[e(o).logo_url?(s(),i("img",{key:0,src:e(o).logo_url,alt:"Partner logo, as the frame shows it",class:"em-preview__logo"},null,8,ol)):(s(),i("span",sl,"No logo: the frame shows our mark"+d(e(o).hide_mark?", hidden by the switch below":""),1))]),l("div",il,[l("label",dl,[b(d(e(o).uploading==="logo"?"Uploading…":e(o).logo_url?"Replace":"Upload")+" ",1),l("input",{disabled:e(o).uploading!=="",accept:".png,.svg,.webp,image/png,image/svg+xml,image/webp",class:"em-upload__input",type:"file",onChange:t[23]||(t[23]=n=>Ze("logo",n))},null,40,rl)]),e(o).logo_url?(s(),i("button",{key:0,class:"adm-btn adm-btn--sm",type:"button",onClick:t[24]||(t[24]=n=>Ge("logo"))}," Remove ")):h("",!0)])]),l("label",ml,[t[60]||(t[60]=b(" Logo link. Must start with https://; empty means the logo is not a link ",-1)),C(l("input",{"onUpdate:modelValue":t[25]||(t[25]=n=>e(o).logo_link=n),disabled:!e(o).logo_url,class:"adm-input",placeholder:"https://partner.example/",type:"url"},null,8,ul),[[V,e(o).logo_link,void 0,{trim:!0}]])]),e(w)?.brandingNextAvailable?(s(),i("label",pl,[t[61]||(t[61]=b(" Site label. What the frame writes beside the logo and what signs the share card; empty means the picture alone ",-1)),C(l("input",{"onUpdate:modelValue":t[26]||(t[26]=n=>e(o).site_label=n),class:"adm-input",maxlength:"40",placeholder:"Waxpeer",type:"text"},null,512),[[V,e(o).site_label]]),l("span",cl,d(e(o).site_label.trim().length)+" of 40 characters.",1)])):h("",!0),l("div",_l,[C(l("input",{id:"em-hide-mark","onUpdate:modelValue":t[27]||(t[27]=n=>e(o).hide_mark=n),type:"checkbox"},null,512),[[nt,e(o).hide_mark]]),t[62]||(t[62]=l("label",{for:"em-hide-mark"},"Hide our mark",-1))]),t[73]||(t[73]=l("p",{class:"adm-muted adm-small em-under"}," With a logo uploaded the mark is replaced anyway; this hides it when there is no logo. ",-1)),l("div",bl,[t[63]||(t[63]=b(" Backgroun
2d. JPG, PNG or WebP up to 4 MB, 1920 × 1080 or larger ",-1)),l("div",fl,[e(o).backdrop_url?(s(),i("img",{key:0,src:e(o).backdrop_url,alt:"Partner background",class:"em-preview__backdrop"},null,8,yl)):(s(),i("span",hl,"No background: the frame opens on its usual studio"))]),l("div",vl,[l("label",gl,[b(d(e(o).uploading==="backdrop"?"Uploading…":e(o).backdrop_url?"Replace":"Upload")+" ",1),l("input",{disabled:e(o).uploading!=="",accept:".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp",class:"em-upload__input",type:"file",onChange:t[28]||(t[28]=n=>Ze("backdrop",n))},null,40,kl)]),e(o).backdrop_url?(s(),i("button",{key:0,class:"adm-btn adm-btn--sm",type:"button",onClick:t[29]||(t[29]=n=>Ge("backdrop"))}," Remove ")):h("",!0),e(o).backdropNote?(s(),i("span",wl,d(e(o).backdropNote),1)):h("",!0)])]),l("label",xl,[t[65]||(t[65]=b(" Default view ",-1)),C(l("select",{"onUpdate:modelValue":t[30]||(t[30]=n=>e(o).default_view=n),class:"adm-select"},[...t[64]||(t[64]=[l("option",{value:""}," Frame default ",-1),l("option",{value:"3d"}," 3D ",-1),l("option",{value:"fpv"}," First person ",-1)])],512),[[fe,e(o).default_view]])]),l("label",$l,[t[67]||(t[67]=b(" Default item. An English base name; empty means ours ",-1)),C(l("input",{"onUpdate:modelValue":t[31]||(t[31]=n=>e(o).default_item=n),class:"adm-input",placeholder:"AK-47 | Redline",type:"text",onBlur:Ye},null,544),[[V,e(o).default_item,void 0,{trim:!0}]]),e(o).itemState==="checking"?(s(),i("span",Cl,"Checking the catalogue…")):e(o).itemState==="ok"?(s(),i("span",Ul,[e(o).itemImage?(s(),i("img",{key:0,src:e(o).itemImage,alt:"",class:"em-item__image"},null,8,Tl)):h("",!0),t[66]||(t[66]=b(" In the catalogue ",-1))])):e(o).itemState==="missing"?(s(),i("span",El,"Not in the catalogue. Check the spelling; the frame would fall back to our item.")):h("",!0)]),e(w)?.brandingNextAvailable?(s(),i(P,{key:2},[l("div",Pl,[t[68]||(t[68]=b(" Colours. Two swatches; the frame derives every other tone from them. Empty means ours ",-1)),(s(),i(P,null,G(Dt,n=>l("div",{key:n.key,class:"em-colour"},[l("input",{"aria-label":`${n.label} colour picker`,value:xe.test(e(o)[n.key])?Ot(e(o)[n.key]):n.ours,class:"em-colour__swatch",type:"color",onInput:$=>It(n.key,$)},null,40,Al),l("span",Sl,d(n.label),1),C(l("input",{"onUpdate:modelValue":$=>e(o)[n.key]=$,"aria-label":`${n.label} colour`,placeholder:n.ours,class:"adm-input em-colour__hex",maxlength:"7",spellcheck:"false",type:"text"},null,8,Rl),[[V,e(o)[n.key],void 0,{trim:!0}]]),l("button",{disabled:!e(o)[n.key],class:"adm-btn adm-btn--sm",type:"button",onClick:$=>e(o)[n.key]=""}," Ours ",8,Vl)])),64)),t[69]||(t[69]=l("span",{class:"adm-muted adm-small"},"The accent is every control the site paints purple; the surface is the plate the HUD stands on.",-1))]),l("div",{style:Ne(e(Mt)),class:"em-theme"},[l("div",Ll,[l("span",Ml,d(e(o).site_label.trim()||e(o).partnerName),1),t[70]||(t[70]=l("span",{class:"em-theme__muted"},"3D · First person",-1)),t[71]||(t[71]=l("button",{class:"em-theme__accent",type:"button"}," Buy ",-1))]),t[72]||(t[72]=l("span",{class:"adm-muted adm-small"},"How a HUD plate and a control would read in the frame.",-1))],4)],64)):(s(),i("p",Dl," The partner's name beside the logo and their colours need the newer API; this backend does not have them yet. ")),e(K)?(s(),i("p",Ol,d(e(K)),1)):h("",!0)],32)]),_:1},8,["modelValue","title"])],64)):h("",!0)])}}}),eo=mt(Wl,[["__scopeId","data-v-78cfd921"]]);export{eo 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.