import{a as e}from"./preload-helper-CggyeTPP.js";var t=e,n=[`pixsafe`,`recast`,`ALL`];function r(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`)+`=`.repeat((4-e.length%4)%4),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}var i=null;function a(){return i??=crypto.subtle.importKey(`jwk`,t,{name:`ECDSA`,namedCurve:`P-256`},!1,[`verify`]),i}async function o(e){let t=e.split(`.`);if(t.length!==3)return null;try{let e=JSON.parse(new TextDecoder().decode(r(t[0]??``)));if(e.alg!==`ES256`||e.typ!==`JWT`)return null;let n=r(t[2]??``),i=new TextEncoder().encode(`${t[0]}.${t[1]}`);if(!await crypto.subtle.verify({name:`ECDSA`,hash:`SHA-256`},await a(),n,i))return null;let o=JSON.parse(new TextDecoder().decode(r(t[1]??``))),s=Date.now()/1e3;return o.typ!==`entitlement`||o.iss!==`exly`||o.aud!==`extensionsly-entitlement-production`||o.env!==`production`||typeof o.exp!=`number`||s>o.exp||typeof o.iat!=`number`||o.iat>s+300?null:o}catch{return null}}function s(e){let t=Date.now()/1e3;return!n.includes(e.product)||e.expires_at&&t>e.expires_at?!1:e.status===`active`}function c(e){return(e.entitlements??[]).some(s)}export{o as n,c as r,n as t};