var M=class{name;constructor(e){this.name=e?.replace(/[^A-Za-z0-9_$]/g,"_")}},V=Symbol(),E=class Y{strings;values;#e;constructor(t,n,r){this.strings=t,this.values=n,this.#e=r}eval(){let t=new Map,n=[],r=[],i=0,h=s=>{let c=s.strings[0];for(let a=0;ae,B=[],z=e=>{let t=U;if(e?.policyName!==void 0){let r=globalThis.trustedTypes?.createPolicy(e.policyName,{createScript:U});r!==void 0&&(t=i=>r.createScript(i))}let n=(r,...i)=>new E(r,i,t);return Object.defineProperties(n,{empty:{configurable:!0,get(){let r=new E([""],B,t);return Object.defineProperty(n,"empty",{configurable:!1,value:r}),r}},local:{value:r=>new M(r)},raw:{value:r=>new E([r],B,t)}})};var g=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),I=e=>({get value(){let t=e();return g(this,"value",t)}}),D=Array.isArray,T=e=>typeof e=="object"&&e!==null&&!D(e),G=e=>{try{let t=z(e);return t.empty.eval(),t}catch{return}},F=I(()=>{if(!(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare")))return G({policyName:"atcute-lexicons"})??G()});var w=(e,t)=>e?{ok:!1,code:"join",left:e,right:t}:t,A=(e,t)=>({ok:!1,code:"prepend",key:e,tree:t}),N=e=>({ok:!0,value:e}),K=0,j=1,ee=2,te=(e,t)=>{let{ok:n,msg:r,...i}=e;return{...i,path:t}},W=(e,t=[],n=[])=>{for(;;)switch(e.code){case"join":{W(e.left,t.slice(),n),e=e.right;continue}case"prepend":{t.push(e.key),e=e.tree;continue}default:return n.push(te(e,t)),n}},X=e=>{let t=0;for(;;)switch(e.code){case"join":{t+=X(e.left),e=e.right;continue}case"prepend":{e=e.tree;continue}default:return t+1}};var ne=e=>{let t="",n=0;for(;;){switch(e.code){case"join":{n+=X(e.right),e=e.left;continue}case"prepend":{t+=`.${e.key}`,e=e.tree;continue}}break}let r=e.msg(),i=`${e.code} at ${t||"."} (${r})`;return n>0&&(i+=` (+${n} other issue(s))`),i},P=class extends Error{name="ValidationError";#e;constructor(t){super(),this.#e=t}get message(){return ne(this.#e)}get issues(){return W(this.#e)}};var q=(e,t,n)=>{let r=K;n?.strict&&(r|=ee);let i=e["~run"](t,r);if(i===void 0)return t;if(i.ok)return i.value;throw new P(i)},J=(e,t=[],n=[])=>{for(;;)switch(e.code){case"join":{J(e.left,t.slice(),n),e=e.right;continue}case"prepend":{t.push(e.key),e=e.tree;continue}default:return n.push({message:e.msg(),path:t.length>0?t:void 0}),n}},O=e=>({version:1,vendor:"@atcute/lexicons",validate(t){let n=e["~run"](t,K);return n===void 0?{value:t}:n.ok?{value:n.value}:{issues:J(n)}}});var re={ok:!1,code:"invalid_type",expected:"string",msg(){return"expected string"}},se={kind:"schema",type:"string",format:null,"~run"(e,t){if(typeof e!="string")return re},get"~standard"(){return g(this,"~standard",O(this))}},$=()=>se;var C=(e,t)=>({kind:"schema",type:"optional",wrapped:e,default:t,"~run"(n,r){if(n===void 0){if(t===void 0)return;let i=typeof t=="function"?t():t;return N(i)}return e["~run"](n,r)},get"~standard"(){return g(this,"~standard",O(this))}}),ie=e=>e.type==="optional";var H={ok:!1,code:"invalid_type",expected:"object",msg(){return"expected object"}},oe={ok:!1,code:"missing_value",msg(){return"missing value"}},ae=(e,t,n)=>{t==="__proto__"?Object.defineProperty(e,t,{value:n}):e[t]=n},Z=e=>{let t=I(()=>{let n=[];for(let r in e){let i=e[r];n.push({key:r,schema:i,optional:ie(i),missing:A(r,oe)})}return n});return{kind:"schema",type:"object",get shape(){let n=t.value,r={};for(let i of n)r[i.key]=i.schema;return g(this,"shape",r)},get"~run"(){let n=t.value,r=n.length,i=s=>{let c=s.local(),a=s.local(),o=s.local(),l=s.local(),u=(d,p)=>d==="__proto__"?s`Object.defineProperty(${l}??={...${c}},${d},{value:${p}})`:s`(${l}??={...${c}})[${d}]=${p}`,y=d=>s`if(((${o}=${w}(${o},${d})),${a}&${j}))return ${o};`,f=s.empty;for(let d=0;dT(a)?s(a,o):H)}return g(this,"~run",(s,c)=>{if(!T(s))return H;let a,o;for(let l=0;lq(ue,e);export{ye as parseIdentityProfile};