diff --git a/docs/cv-maker/assets/index-BqA5Dcdy.js b/docs/cv-maker/assets/index-DkVUQZm6.js similarity index 99% rename from docs/cv-maker/assets/index-BqA5Dcdy.js rename to docs/cv-maker/assets/index-DkVUQZm6.js index f8ea340..24c37d4 100644 --- a/docs/cv-maker/assets/index-BqA5Dcdy.js +++ b/docs/cv-maker/assets/index-DkVUQZm6.js @@ -27,4 +27,4 @@ ${this.stack.split(` `)}`:`${i}: ${c}`}else i=o,c=er(r,0),a=`${i}: ${c}`;s.length>0&&(a+=` ${s.join(` `)}`);super(c);u(this,"_tag");u(this,"traces");u(this,th);this._tag=n,this.traces=s,this[ad]=_I,this.name=i,this.stack=a}pipe(){return N(this,arguments)}toString(){return this.stack}[(th=ad,ne)](){return this.stack}}class yI extends K_{constructor(n,r=[]){super("Die",n,r);u(this,"defect");this.defect=n}}const bI=(e,t=[])=>new yI(e,t);class SI extends K_{constructor(t=[]){super("Interrupt","interrupted",t)}}const wI=(e=[])=>new SI(e),vI=e=>e._tag==="Interrupt",ud=Symbol.for("effect/Micro/MicroFiber"),kI={_A:te,_E:te};var nh;nh=ud;class OI{constructor(t,n=!0){u(this,"context");u(this,"interruptible");u(this,nh);u(this,"_stack",[]);u(this,"_observers",[]);u(this,"_exit");u(this,"_children");u(this,"currentOpCount",0);u(this,"_interrupted",!1);u(this,"_yielded");this.context=t,this.interruptible=n,this[ud]=kI}getRef(t){return ek(this.context,t)}addObserver(t){return this._exit?(t(this._exit),pw):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(ml))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const n=this.runLoop(t);if(n===so)return;const r=ld.interruptChildren&&ld.interruptChildren(this);if(r!==void 0)return this.evaluate(ri(r,()=>n));this._exit=n;for(let s=0;ss)}if(r=r[Ma](this),r===so){const s=this._yielded;return ti in s?(this._yielded=void 0,s):so}}}catch(s){return j(r,Ma)?Ra(s):Ra(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const r=n[ni]&&n[ni](this);if(r)return{[t]:r};if(n[t])return n}}yieldWith(t){return this._yielded=t,so}children(){return this._children??(this._children=new Set)}}const ld=J("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),D_=Symbol.for("effect/Micro/identifier"),ye=Symbol.for("effect/Micro/args"),Ma=Symbol.for("effect/Micro/evaluate"),mr=Symbol.for("effect/Micro/successCont"),Yn=Symbol.for("effect/Micro/failureCont"),ni=Symbol.for("effect/Micro/ensureCont"),so=Symbol.for("effect/Micro/Yield"),EI={_A:te,_E:te,_R:te},TI={...q$,_op:"Micro",[gI]:EI,pipe(){return N(this,arguments)},[Symbol.iterator](){return new Vp(new Os(this))},toJSON(){return{_id:"Micro",op:this[D_],...ye in this?{args:this[ye]}:void 0}},toString(){return Te(this)},[ne](){return Te(this)}};function xI(e){return Ra("Micro.evaluate: Not implemented")}const zi=e=>({...TI,[D_]:e.op,[Ma]:e.eval??xI,[mr]:e.contA,[Yn]:e.contE,[ni]:e.ensure}),fl=e=>{const t=zi(e);return function(){const n=Object.create(t);return n[ye]=e.single===!1?arguments:arguments[0],n}},U_=e=>{const t={...zi(e),[ti]:ti,_tag:e.op,get[e.prop](){return this[ye]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[ye]}},[L](n){return RI(n)&&n._tag===e.op&&D(this[ye],n[ye])},[K](){return oe(this,V(de(e.op))(A(this[ye])))}};return function(n){const r=Object.create(t);return r[ye]=n,r[mr]=void 0,r[Yn]=void 0,r[ni]=void 0,r}},dl=U_({op:"Success",prop:"value",eval(e){const t=e.getCont(mr);return t?t[mr](this[ye],e):e.yieldWith(this)}}),B_=U_({op:"Failure",prop:"cause",eval(e){let t=e.getCont(Yn);for(;vI(this[ye])&&t&&e.interruptible;)t=e.getCont(Yn);return t?t[Yn](this[ye],e):e.yieldWith(this)}}),$I=fl({op:"Yield",eval(e){let t=!1;return e.getRef(gl).scheduleTask(()=>{t||e.evaluate(CI)},this[ye]??0),e.yieldWith(()=>{t=!0})}}),II=$I(0),AI=dl(void 0),hl=fl({op:"WithMicroFiber",eval(e){return this[ye](e)}}),ri=h(2,(e,t)=>{const n=Object.create(MI);return n[ye]=e,n[mr]=t,n}),MI=zi({op:"OnSuccess",eval(e){return e._stack.push(this),this[ye]}}),RI=e=>j(e,ti),q_=dl,pl=B_,ml=pl(wI()),Ra=e=>pl(bI(e)),CI=q_(void 0),NI="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class J_{constructor(){u(this,"tasks",[]);u(this,"running",!1);u(this,"afterScheduled",()=>{this.running=!1,this.runTasks()})}scheduleTask(t,n){this.tasks.push(t),this.running||(this.running=!0,NI(this.afterScheduled))}runTasks(){const t=this.tasks;this.tasks=[];for(let n=0,r=t.length;n=t.getRef(jI)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const FI=h(2,(e,t)=>hl(n=>{const r=n.context;return n.context=t(r),DI(e,()=>(n.context=r,AI))})),PI=h(2,(e,t)=>FI(e,Gm(t)));class jI extends zm()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class gl extends zm()("effect/Micro/currentScheduler",{defaultValue:()=>new J_}){}const LI=h(2,(e,t)=>{const n=Object.create(KI);return n[ye]=e,n[mr]=t.onSuccess,n[Yn]=t.onFailure,n}),KI=zi({op:"OnSuccessAndFailure",eval(e){return e._stack.push(this),this[ye]}}),DI=h(2,(e,t)=>BI(n=>LI(n(e),{onFailure:r=>ri(t(pl(r)),()=>B_(r)),onSuccess:r=>ri(t(q_(r)),()=>dl(r))}))),V_=fl({op:"SetInterruptible",ensure(e){if(e.interruptible=this[ye],e._interrupted&&e.interruptible)return()=>ml}}),UI=e=>hl(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(V_(!1)),t._interrupted?ml:e)),BI=e=>hl(t=>t.interruptible?(t.interruptible=!1,t._stack.push(V_(!0)),e(UI)):e(te)),qI=(e,t)=>{const n=new OI(gl.context(new J_));return n.evaluate(e),n};class H_{constructor(){u(this,"buckets",[])}scheduleTask(t,n){const r=this.buckets.length;let s,o=0;for(;o=this.maxNextTickBeforeTimer?setTimeout(()=>this.starveInternal(0),0):Promise.resolve(void 0).then(()=>this.starveInternal(t+1))}shouldYield(t){return t.currentOpCount>t.getFiberRef(d_)?t.getFiberRef(Hi):!1}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running||(this.running=!0,this.starve())}}const W_=J(Symbol.for("effect/Scheduler/defaultScheduler"),()=>new JI(2048));class VI{constructor(){u(this,"tasks",new H_);u(this,"deferred",!1)}scheduleTask(t,n){this.deferred?W_.scheduleTask(t,n):this.tasks.scheduleTask(t,n)}shouldYield(t){return t.currentOpCount>t.getFiberRef(d_)?t.getFiberRef(Hi):!1}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[n,r]of t)for(let s=0;sVe(W_)),z_=J(Symbol.for("effect/FiberRef/currentRequestMap"),()=>Ve(new Map)),fd=(e,t,n,r)=>{switch(e){case void 0:return t();case"unbounded":return n();case"inherit":return rl(tx,s=>s==="unbounded"?n():s>1?r(s):t());default:return e>1?r(e):t()}},_l="InterruptSignal",yl="Stateful",bl="Resume",Sl="YieldNow",Sc=e=>({_tag:_l,cause:e}),Oo=e=>({_tag:yl,onFiber:e}),Ln=e=>({_tag:bl,effect:e}),HI=()=>({_tag:Sl}),WI="effect/FiberScope",si=Symbol.for(WI);var rh;rh=si;class GI{constructor(){u(this,rh,si);u(this,"fiberId",En);u(this,"roots",new Set)}add(t,n){this.roots.add(n),n.addObserver(()=>{this.roots.delete(n)})}}var sh;sh=si;class zI{constructor(t,n){u(this,"fiberId");u(this,"parent");u(this,sh,si);this.fiberId=t,this.parent=n}add(t,n){this.parent.tell(Oo(r=>{r.addChild(n),n.addObserver(()=>{r.removeChild(n)})}))}}const YI=e=>new zI(e.id(),e),wl=J(Symbol.for("effect/FiberScope/Global"),()=>new GI),ZI="effect/Fiber",Y_=Symbol.for(ZI),Z_={_E:e=>e,_A:e=>e},QI={[Y_]:Z_,pipe(){return N(this,arguments)}},XI="effect/Fiber",eA=Symbol.for(XI),vl=e=>c_(t_(e.await),e.inheritAll);({...$s,...QI});const nn="effect/FiberCurrent",tA="effect/Logger",nA=Symbol.for(tA),rA={_Message:e=>e,_Output:e=>e},kl=e=>({[nA]:rA,log:e,pipe(){return N(this,arguments)}}),sA=/^[^\s"=]*$/,oA=(e,t)=>({annotations:n,cause:r,date:s,fiberId:o,logLevel:i,message:c,spans:a})=>{const l=_=>_.match(sA)?_:e(_),f=(_,k)=>`${A_(_)}=${l(k)}`,d=(_,k)=>" "+f(_,k);let p=f("timestamp",s.toISOString());p+=d("level",i.label),p+=d("fiber",bg(o));const m=gv(c);for(let _=0;_`"${e.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`,cA=kl(oA(iA)),aA=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;aA&&process.stdout.isTTY;const Q_="effect/MetricBoundaries",Ca=Symbol.for(Q_);var oh;class uA{constructor(t){u(this,"values");u(this,oh,Ca);u(this,"_hash");this.values=t,this._hash=y(de(Q_),V(Es(this.values)))}[(oh=Ca,K)](){return this._hash}[L](t){return lA(t)&&D(this.values,t.values)}pipe(){return N(this,arguments)}}const lA=e=>j(e,Ca),fA=e=>{const t=y(e,pm(qe(Number.POSITIVE_INFINITY)),Pv);return new uA(t)},dA=e=>y(mv(e.count-1,t=>e.start*Math.pow(e.factor,t)),Fu,fA),hA="effect/MetricKeyType",X_=Symbol.for(hA),ey="effect/MetricKeyType/Counter",Na=Symbol.for(ey),pA="effect/MetricKeyType/Frequency",mA=Symbol.for(pA),gA="effect/MetricKeyType/Gauge",_A=Symbol.for(gA),ty="effect/MetricKeyType/Histogram",Fa=Symbol.for(ty),yA="effect/MetricKeyType/Summary",bA=Symbol.for(yA),ny={_In:e=>e,_Out:e=>e};var ih,ch;class SA{constructor(t,n){u(this,"incremental");u(this,"bigint");u(this,ch,ny);u(this,ih,Na);u(this,"_hash");this.incremental=t,this.bigint=n,this._hash=de(ey)}[(ch=X_,ih=Na,K)](){return this._hash}[L](t){return ry(t)}pipe(){return N(this,arguments)}}var ah,uh;class wA{constructor(t){u(this,"boundaries");u(this,uh,ny);u(this,ah,Fa);u(this,"_hash");this.boundaries=t,this._hash=y(de(ty),V(A(this.boundaries)))}[(uh=X_,ah=Fa,K)](){return this._hash}[L](t){return sy(t)&&D(this.boundaries,t.boundaries)}pipe(){return N(this,arguments)}}const vA=e=>new SA((e==null?void 0:e.incremental)??!1,(e==null?void 0:e.bigint)??!1),kA=e=>new wA(e),ry=e=>j(e,Na),OA=e=>j(e,mA),EA=e=>j(e,_A),sy=e=>j(e,Fa),TA=e=>j(e,bA),xA="effect/MetricKey",oy=Symbol.for(xA),$A={_Type:e=>e},IA=ku(D);var lh;class Ol{constructor(t,n,r,s=[]){u(this,"name");u(this,"keyType");u(this,"description");u(this,"tags");u(this,lh,$A);u(this,"_hash");this.name=t,this.keyType=n,this.description=r,this.tags=s,this._hash=y(de(this.name+this.description),V(A(this.keyType)),V(Es(this.tags)))}[(lh=oy,K)](){return this._hash}[L](t){return AA(t)&&this.name===t.name&&D(this.keyType,t.keyType)&&D(this.description,t.description)&&IA(this.tags,t.tags)}pipe(){return N(this,arguments)}}const AA=e=>j(e,oy),MA=(e,t)=>new Ol(e,vA(t),vi(t==null?void 0:t.description)),RA=(e,t,n)=>new Ol(e,kA(t),vi(n)),CA=h(2,(e,t)=>t.length===0?e:new Ol(e.name,e.keyType,e.description,_o(e.tags,t))),NA="effect/MetricState",Js=Symbol.for(NA),iy="effect/MetricState/Counter",Pa=Symbol.for(iy),cy="effect/MetricState/Frequency",ja=Symbol.for(cy),ay="effect/MetricState/Gauge",La=Symbol.for(ay),uy="effect/MetricState/Histogram",Ka=Symbol.for(uy),ly="effect/MetricState/Summary",Da=Symbol.for(ly),Vs={_A:e=>e};var fh,dh;class FA{constructor(t){u(this,"count");u(this,dh,Vs);u(this,fh,Pa);this.count=t}[(dh=Js,fh=Pa,K)](){return y(A(iy),V(A(this.count)),oe(this))}[L](t){return HA(t)&&this.count===t.count}pipe(){return N(this,arguments)}}const PA=ku(D);var hh,ph;class jA{constructor(t){u(this,"occurrences");u(this,ph,Vs);u(this,hh,ja);u(this,"_hash");this.occurrences=t}[(ph=Js,hh=ja,K)](){return y(de(cy),V(Es(le(this.occurrences.entries()))),oe(this))}[L](t){return WA(t)&&PA(le(this.occurrences.entries()),le(t.occurrences.entries()))}pipe(){return N(this,arguments)}}var mh,gh;class LA{constructor(t){u(this,"value");u(this,gh,Vs);u(this,mh,La);this.value=t}[(gh=Js,mh=La,K)](){return y(A(ay),V(A(this.value)),oe(this))}[L](t){return GA(t)&&this.value===t.value}pipe(){return N(this,arguments)}}var _h,yh;class KA{constructor(t,n,r,s,o){u(this,"buckets");u(this,"count");u(this,"min");u(this,"max");u(this,"sum");u(this,yh,Vs);u(this,_h,Ka);this.buckets=t,this.count=n,this.min=r,this.max=s,this.sum=o}[(yh=Js,_h=Ka,K)](){return y(A(uy),V(A(this.buckets)),V(A(this.count)),V(A(this.min)),V(A(this.max)),V(A(this.sum)),oe(this))}[L](t){return zA(t)&&D(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return N(this,arguments)}}var bh,Sh;class DA{constructor(t,n,r,s,o,i){u(this,"error");u(this,"quantiles");u(this,"count");u(this,"min");u(this,"max");u(this,"sum");u(this,Sh,Vs);u(this,bh,Da);this.error=t,this.quantiles=n,this.count=r,this.min=s,this.max=o,this.sum=i}[(Sh=Js,bh=Da,K)](){return y(A(ly),V(A(this.error)),V(A(this.quantiles)),V(A(this.count)),V(A(this.min)),V(A(this.max)),V(A(this.sum)),oe(this))}[L](t){return YA(t)&&this.error===t.error&&D(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return N(this,arguments)}}const UA=e=>new FA(e),BA=e=>new jA(e),qA=e=>new LA(e),JA=e=>new KA(e.buckets,e.count,e.min,e.max,e.sum),VA=e=>new DA(e.error,e.quantiles,e.count,e.min,e.max,e.sum),HA=e=>j(e,Pa),WA=e=>j(e,ja),GA=e=>j(e,La),zA=e=>j(e,Ka),YA=e=>j(e,Da),ZA="effect/MetricHook",QA=Symbol.for(ZA),XA={_In:e=>e,_Out:e=>e},Hs=e=>({[QA]:XA,pipe(){return N(this,arguments)},...e}),dd=BigInt(0),eM=e=>{let t=e.keyType.bigint?dd:0;const n=e.keyType.incremental?e.keyType.bigint?s=>s>=dd:s=>s>=0:s=>!0,r=s=>{n(s)&&(t=t+s)};return Hs({get:()=>UA(t),update:r,modify:r})},tM=e=>{const t=new Map;for(const r of e.keyType.preregisteredWords)t.set(r,0);const n=r=>{const s=t.get(r)??0;t.set(r,s+1)};return Hs({get:()=>BA(t),update:n,modify:n})},nM=(e,t)=>{let n=t;return Hs({get:()=>qA(n),update:r=>{n=r},modify:r=>{n=n+r}})},rM=e=>{const t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),s=new Float32Array(n);let o=0,i=0,c=Number.MAX_VALUE,a=Number.MIN_VALUE;y(t,os(rr),qn((d,p)=>{s[p]=d}));const l=d=>{let p=0,m=n;for(;p!==m;){const _=Math.floor(p+(m-p)/2),k=s[_];d<=k?m=_:p=_,m===p+1&&(d<=s[p]?m=p:p=m)}r[p]=r[p]+1,o=o+1,i=i+d,da&&(a=d)},f=()=>{const d=Oi(n);let p=0;for(let m=0;mJA({buckets:f(),count:o,min:c,max:a,sum:i}),update:l,modify:l})},sM=e=>{const{error:t,maxAge:n,maxSize:r,quantiles:s}=e.keyType,o=y(s,os(rr)),i=Oi(r);let c=0,a=0,l=0,f=Number.MAX_VALUE,d=Number.MIN_VALUE;const p=_=>{const k=[];let g=0;for(;g!==r-1;){const b=i[g];if(b!=null){const[S,w]=b,T=ua(_-S);$k(T,_k)&&T<=n&&k.push(w)}g=g+1}return oM(t,o,os(k,rr))},m=(_,k)=>{if(r>0){c=c+1;const g=c%r;i[g]=[k,_]}a=a+1,l=l+_,_d&&(d=_)};return Hs({get:()=>VA({error:t,quantiles:p(Date.now()),count:a,min:f,max:d,sum:l}),update:([_,k])=>m(_,k),modify:([_,k])=>m(_,k)})},oM=(e,t,n)=>{const r=n.length;if(!se(t))return nr();const s=t[0],o=t.slice(1),i=hd(e,r,I(),0,s,n),c=rt(i);return o.forEach(a=>{c.push(hd(e,r,i.value,i.consumed,a,i.rest))}),qn(c,a=>[a.quantile,a.value])},hd=(e,t,n,r,s,o)=>{let i=e,c=t,a=n,l=r,f=s,d=o,p=e,m=t,_=n,k=r,g=s,b=o;for(;;){if(!se(d))return{quantile:f,value:I(),consumed:l,rest:[]};if(f===1)return{quantile:f,value:R(_m(d)),consumed:l+d.length,rest:[]};const S=Tv(d,O=>O<=d[0]),w=f*c,T=i/2*w,v=l+S[0].length,E=Math.abs(v-w);if(vw+T)return{quantile:f,value:a,consumed:l,rest:d};switch(a._tag){case"None":{p=i,m=c,_=Qr(d),k=v,g=f,b=S[1],i=p,c=m,a=_,l=k,f=g,d=b;continue}case"Some":{const O=Math.abs(w-a.value);if(Ee},uM=(e,t)=>({[cM]:aM,metricKey:e,metricState:t,pipe(){return N(this,arguments)}}),lM="effect/MetricRegistry",pd=Symbol.for(lM);var wh;wh=pd;class fM{constructor(){u(this,wh,pd);u(this,"map",kx())}snapshot(){const t=[];for(const[n,r]of this.map)t.push(uM(n,r.get()));return t}get(t){const n=y(this.map,on(t),Tt);if(n==null){if(ry(t.keyType))return this.getCounter(t);if(EA(t.keyType))return this.getGauge(t);if(OA(t.keyType))return this.getFrequency(t);if(sy(t.keyType))return this.getHistogram(t);if(TA(t.keyType))return this.getSummary(t);throw new Error("BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues")}else return n}getCounter(t){let n=y(this.map,on(t),Tt);if(n==null){const r=eM(t);y(this.map,Pr(t))||y(this.map,jr(t,r)),n=r}return n}getFrequency(t){let n=y(this.map,on(t),Tt);if(n==null){const r=tM(t);y(this.map,Pr(t))||y(this.map,jr(t,r)),n=r}return n}getGauge(t){let n=y(this.map,on(t),Tt);if(n==null){const r=nM(t,t.keyType.bigint?BigInt(0):0);y(this.map,Pr(t))||y(this.map,jr(t,r)),n=r}return n}getHistogram(t){let n=y(this.map,on(t),Tt);if(n==null){const r=rM(t);y(this.map,Pr(t))||y(this.map,jr(t,r)),n=r}return n}getSummary(t){let n=y(this.map,on(t),Tt);if(n==null){const r=sM(t);y(this.map,Pr(t))||y(this.map,jr(t,r)),n=r}return n}}const dM=()=>new fM,hM="effect/Metric",pM=Symbol.for(hM),mM={_Type:e=>e,_In:e=>e,_Out:e=>e},md=J(Symbol.for("effect/Metric/globalMetricRegistry"),()=>dM()),fy=function(e,t,n,r){const s=Object.assign(o=>CT(o,i=>bM(s,i)),{[pM]:mM,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return N(this,arguments)}});return s},Yi=(e,t)=>dy(MA(e,t)),dy=e=>{let t;const n=new WeakMap,r=s=>{if(s.length===0)return t!==void 0||(t=md.get(e)),t;let o=n.get(s);return o!==void 0||(o=md.get(CA(e,s)),n.set(s,o)),o};return fy(e.keyType,(s,o)=>r(o).update(s),s=>r(s).get(),(s,o)=>r(o).modify(s))},gM=(e,t,n)=>dy(RA(e,t,n)),_M=h(3,(e,t,n)=>yM(e,[Y$(t,n)])),yM=h(2,(e,t)=>fy(e.keyType,(n,r)=>e.unsafeUpdate(n,_o(t,r)),n=>e.unsafeValue(_o(t,n)),(n,r)=>e.unsafeModify(n,_o(t,r)))),bM=h(2,(e,t)=>rl(ka,n=>F(()=>e.unsafeUpdate(t,n)))),SM="effect/Request",wM=Symbol.for(SM),vM={_E:e=>e,_A:e=>e};({...vu,[wM]:0});const kM=h(2,(e,t)=>rl(z_,n=>F(()=>{if(n.has(e)){const r=n.get(e);r.state.completed||(r.state.completed=!0,g_(r.result,t))}}))),OM="effect/Supervisor",Zi=Symbol.for(OM),El={_T:e=>e};var vh;vh=Zi;const jl=class jl{constructor(t,n){u(this,"underlying");u(this,"value0");u(this,vh,El);this.underlying=t,this.value0=n}get value(){return this.value0}onStart(t,n,r,s){this.underlying.onStart(t,n,r,s)}onEnd(t,n){this.underlying.onEnd(t,n)}onEffect(t,n){this.underlying.onEffect(t,n)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new jl(this,y(this.value,Pe(t)))}zip(t){return new ii(this,t)}};let oi=jl;var kh;kh=Zi;const Ll=class Ll{constructor(t,n){u(this,"left");u(this,"right");u(this,"_tag","Zip");u(this,kh,El);this.left=t,this.right=n}get value(){return i_(this.left.value,this.right.value)}onStart(t,n,r,s){this.left.onStart(t,n,r,s),this.right.onStart(t,n,r,s)}onEnd(t,n){this.left.onEnd(t,n),this.right.onEnd(t,n)}onEffect(t,n){this.left.onEffect(t,n),this.right.onEffect(t,n)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new oi(this,y(this.value,Pe(t)))}zip(t){return new Ll(this,t)}};let ii=Ll;const hy=e=>j(e,Zi)&&Jp(e,"Zip");var Oh;Oh=Zi;class EM{constructor(t){u(this,"effect");u(this,Oh,El);this.effect=t}get value(){return this.effect}onStart(t,n,r,s){}onEnd(t,n){}onEffect(t,n){}onSuspend(t){}onResume(t){}map(t){return new oi(this,y(this.value,Pe(t)))}zip(t){return new ii(this,t)}onRun(t,n){return t()}}const TM=e=>new EM(e),Qi=J("effect/Supervisor/none",()=>TM(dt)),xM=kr,py="Empty",my="AddSupervisor",gy="RemoveSupervisor",_y="AndThen",ts={_tag:py},Eo=(e,t)=>({_tag:_y,first:e,second:t}),$M=(e,t)=>IM(t,qe(e)),IM=(e,t)=>{let n=e,r=t;for(;ir(r);){const s=cr(r);switch(s._tag){case py:{r=ln(r);break}case my:{n=n.zip(s.supervisor),r=ln(r);break}case gy:{n=Ua(n,s.supervisor),r=ln(r);break}case _y:{r=ft(s.first)(ft(s.second)(ln(r)));break}}}return n},Ua=(e,t)=>D(e,t)?Qi:hy(e)?Ua(e.left,t).zip(Ua(e.right,t)):e,ci=e=>D(e,Qi)?On():hy(e)?y(ci(e.left),ls(ci(e.right))):Ju(e),AM=(e,t)=>{if(D(e,t))return ts;const n=ci(e),r=ci(t),s=y(r,Tf(n),Jo(ts,(i,c)=>Eo(i,{_tag:my,supervisor:c}))),o=y(n,Tf(r),Jo(ts,(i,c)=>Eo(i,{_tag:gy,supervisor:c})));return Eo(s,o)},MM=xM({empty:ts,patch:$M,combine:Eo,diff:AM}),RM=Yi("effect_fiber_started",{incremental:!0}),gd=Yi("effect_fiber_active"),CM=Yi("effect_fiber_successes",{incremental:!0}),NM=Yi("effect_fiber_failures",{incremental:!0}),FM=_M(gM("effect_fiber_lifetimes",dA({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Lr="Continue",PM="Done",_d="Yield",jM={_E:e=>e,_A:e=>e},oo=e=>{throw new Error(`BUG: FiberRuntime - ${er(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},kt=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Ot=J("effect/internal/fiberRuntime/yieldedOpChannel",()=>({currentOp:null})),Kr={[Fo]:(e,t,n)=>Me(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>_e(_e(n)),[Po]:(e,t,n)=>Me(()=>t.effect_instruction_i2(n)),[wu]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),Ut(e.currentRuntimeFlags)&&e.isInterrupted()?ee(e.getInterruptedCause()):_e(n)),[jo]:(e,t,n)=>(Me(()=>t.effect_instruction_i2(n)),Me(()=>t.effect_instruction_i0())?(e.pushStack(t),Me(()=>t.effect_instruction_i1())):dt),[po]:(e,t,n)=>{const r=Me(()=>t.effect_instruction_i0.next(n));return r.done?_e(r.value):(e.pushStack(t),Cw(r.value))}},LM={[_l]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),Ut(t)?ee(r.cause):n),[bl]:(e,t,n,r)=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[yl]:(e,t,n,r)=>(r.onFiber(e,L_(t)),n),[Sl]:(e,t,n,r)=>P(tl(),()=>n)},KM=e=>Ui(KE(e),t=>Sn(XE(t),([n,r])=>{const s=new Map,o=[];for(const c of r){o.push(yn(c));for(const a of c)s.set(a.request,a)}const i=o.flat();return Vi(XM(n.runAll(o),i,()=>i.forEach(c=>{c.listeners.interrupted=!0})),z_,s)},!1,!1)),DM=gi();var Eh,Th;class yy extends V${constructor(n,r,s){super();u(this,Th,Z_);u(this,Eh,jM);u(this,"_fiberRefs");u(this,"_fiberId");u(this,"_queue",new Array);u(this,"_children",null);u(this,"_observers",new Array);u(this,"_running",!1);u(this,"_stack",[]);u(this,"_asyncInterruptor",null);u(this,"_asyncBlockingOn",null);u(this,"_exitValue",null);u(this,"_steps",[]);u(this,"_isYielding",!1);u(this,"currentRuntimeFlags");u(this,"currentOpCount",0);u(this,"currentSupervisor");u(this,"currentScheduler");u(this,"currentTracer");u(this,"currentSpan");u(this,"currentContext");u(this,"currentDefaultServices");u(this,"run",()=>{this.drainQueueOnCurrentThread()});if(this.currentRuntimeFlags=s,this._fiberId=n,this._fiberRefs=r,Mf(s)){const o=this.getFiberRef(ka);RM.unsafeUpdate(1,o),gd.unsafeUpdate(1,o)}this.refreshRefCache()}commit(){return vl(this)}id(){return this._fiberId}resume(n){this.tell(Ln(n))}get status(){return this.ask((n,r)=>r)}get runtimeFlags(){return this.ask((n,r)=>mI(r)?n.currentRuntimeFlags:r.runtimeFlags)}scope(){return YI(this)}get children(){return this.ask(n=>Array.from(n.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(ro)}fiberRefs(){return this.ask(n=>n.getFiberRefs())}ask(n){return ge(()=>{const r=mx(this._fiberId);return this.tell(Oo((s,o)=>{g_(r,F(()=>n(s,o)))})),m_(r)})}tell(n){this._queue.push(n),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return ms(n=>{const r=s=>n(z(s));return this.tell(Oo((s,o)=>{s._exitValue!==null?r(this._exitValue):s.addObserver(r)})),F(()=>this.tell(Oo((s,o)=>{s.removeObserver(r)})))},this.id())}get inheritAll(){return Je((n,r)=>{const s=n.id(),o=n.getFiberRefs(),i=r.runtimeFlags,c=this.getFiberRefs(),a=O$(o,s,c);n.setFiberRefs(a);const l=n.getFiberRef(vd),f=y(vo(i,l),Cf(Or),Cf(Sa));return PT(f)})}get poll(){return F(()=>vi(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(n){return F(()=>this.tell(Sc(Bt(n))))}unsafeInterruptAsFork(n){this.tell(Sc(Bt(n)))}addObserver(n){this._exitValue!==null?n(this._exitValue):this._observers.push(n)}removeObserver(n){this._observers=this._observers.filter(r=>r!==n)}getFiberRefs(){return this.setFiberRef(vd,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(n){this._fiberRefs=I_(this._fiberRefs,n)}getFiberRef(n){return this._fiberRefs.locals.has(n)?this._fiberRefs.locals.get(n)[0][1]:n.initial}setFiberRef(n,r){this._fiberRefs=Ea(this._fiberRefs,{fiberId:this._fiberId,fiberRef:n,value:r}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Xo),this.currentTracer=this.currentDefaultServices.unsafeMap.get(T_.key),this.currentSupervisor=this.getFiberRef(QM),this.currentScheduler=this.getFiberRef(G_),this.currentContext=this.getFiberRef(Bs),this.currentSpan=this.currentContext.unsafeMap.get(x_.key)}setFiberRefs(n){this._fiberRefs=n,this.refreshRefCache()}addChild(n){this.getChildren().add(n)}removeChild(n){this.getChildren().delete(n)}transferChildren(n){const r=this._children;if(this._children=null,r!==null&&r.size>0)for(const s of r)s._exitValue===null&&n.add(this.currentRuntimeFlags,s)}drainQueueOnCurrentThread(){let n=!0;for(;n;){let r=Lr;const s=globalThis[nn];globalThis[nn]=this;try{for(;r===Lr;)r=this._queue.length===0?PM:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[nn]=s}this._queue.length>0&&!this._running?(this._running=!0,r===_d?(this.drainQueueLaterOnExecutor(),n=!1):n=!0):n=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Hi))}drainQueueWhileRunning(n,r){let s=r;for(;this._queue.length>0;){const o=this._queue.splice(0,1)[0];s=LM[o._tag](this,n,s,o)}return s}isInterrupted(){return!rT(this.getFiberRef(ro))}addInterruptedCause(n){const r=this.getFiberRef(ro);this.setFiberRef(ro,Ue(r,n))}processNewInterruptSignal(n){this.addInterruptedCause(n),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let n=!1;for(const r of this._children)r.tell(Sc(Bt(this.id()))),n=!0;return n}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const n=this._children.values();this._children=null;let r=!1;return el({while:()=>!r,body:()=>{const o=n.next();return o.done?F(()=>{r=!0}):Us(o.value.await)},step:()=>{}})}return null}reportExitValue(n){if(Mf(this.currentRuntimeFlags)){const r=this.getFiberRef(ka),s=this.id().startTimeMillis,o=Date.now();switch(FM.unsafeUpdate(o-s,r),gd.unsafeUpdate(-1,r),n._tag){case ut:{CM.unsafeUpdate(1,r);break}case at:{NM.unsafeUpdate(1,r);break}}}if(n._tag==="Failure"){const r=this.getFiberRef(rx);!zu(n.cause)&&r._tag==="Some"&&this.log("Fiber terminated with an unhandled error",n.cause,r)}}setExitValue(n){this._exitValue=n,this.reportExitValue(n);for(let r=this._observers.length-1;r>=0;r--)this._observers[r](n);this._observers=[]}getLoggers(){return this.getFiberRef(VM)}log(n,r,s){const o=Z(s)?s.value:this.getFiberRef(QT),i=this.getFiberRef(UM);if(D$(i,o))return;const c=this.getFiberRef(XT),a=this.getFiberRef(ZT),l=this.getLoggers(),f=this.getFiberRefs();if(pg(l)>0){const d=Hm(this.getFiberRef(Xo),ul),p=new Date(d.unsafeCurrentTimeMillis());jw(f,()=>{for(const m of l)m.log({fiberId:this.id(),logLevel:o,message:n,cause:r,context:f,spans:c,annotations:a,date:p})})}}evaluateMessageWhileSuspended(n){switch(n._tag){case Sl:return _d;case _l:return this.processNewInterruptSignal(n.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(ee(n.cause)),this._asyncInterruptor=null),Lr;case bl:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(n.effect),Lr;case yl:return n.onFiber(this,this._exitValue!==null?hI:pI(this.currentRuntimeFlags,this._asyncBlockingOn)),Lr;default:return oo(n)}}evaluateEffect(n){this.currentSupervisor.onResume(this);try{let r=Ut(this.currentRuntimeFlags)&&this.isInterrupted()?ee(this.getInterruptedCause()):n;for(;r!==null;){const s=r,o=this.runLoop(s);if(o===kt){const i=Ot.currentOp;Ot.currentOp=null,i._op===mo?NE(this.currentRuntimeFlags)?(this.tell(HI()),this.tell(Ln(fn)),r=null):r=fn:i._op===Zr&&(r=null)}else{this.currentRuntimeFlags=y(this.currentRuntimeFlags,FE(Sa));const i=this.interruptAllChildren();i!==null?r=P(i,()=>o):(this._queue.length===0?this.setExitValue(o):this.tell(Ln(o)),r=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(n){if(this._running)this.tell(Ln(n));else{this._running=!0;const r=globalThis[nn];globalThis[nn]=this;try{this.evaluateEffect(n)}finally{this._running=!1,globalThis[nn]=r,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(n){this.tell(Ln(n))}patchRuntimeFlags(n,r){const s=ko(n,r);return globalThis[nn]=this,this.currentRuntimeFlags=s,s}initiateAsync(n,r){let s=!1;const o=i=>{s||(s=!0,this.tell(Ln(i)))};Ut(n)&&(this._asyncInterruptor=o);try{r(o)}catch(i){o(et(Qe(i)))}}pushStack(n){this._stack.push(n),n._op==="OnStep"&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const n=this._stack.pop();if(n)return n._op==="OnStep"&&this._steps.pop(),n}getNextSuccessCont(){let n=this.popStack();for(;n;){if(n._op!==ic)return n;n=this.popStack()}}getNextFailCont(){let n=this.popStack();for(;n;){if(n._op!==Fo&&n._op!==jo&&n._op!==po)return n;n=this.popStack()}}[(Th=Y_,Eh=eA,Kw)](n){return F(()=>Wm(this.currentContext,n))}Left(n){return Ne(n.left)}None(n){return Ne(new h_)}Right(n){return _e(n.right)}Some(n){return _e(n.value)}Micro(n){return zo(r=>{let s=r;const o=qI(PI(n,this.currentContext));return o.addObserver(i=>{if(i._tag==="Success")return s(_e(i.value));switch(i.cause._tag){case"Interrupt":return s(ee(Bt(En)));case"Fail":return s(Ne(i.cause.error));case"Die":return s(Kf(i.cause.defect))}}),zo(i=>{s=c=>{i(dt)},o.unsafeInterrupt()})})}[Yp](n){const r=Me(()=>n.effect_instruction_i0()),s=this.getNextSuccessCont();return s!==void 0?(s._op in Kr||oo(s),Kr[s._op](this,s,r)):(Ot.currentOp=_e(r),kt)}[ut](n){const r=n,s=this.getNextSuccessCont();return s!==void 0?(s._op in Kr||oo(s),Kr[s._op](this,s,r.effect_instruction_i0)):(Ot.currentOp=r,kt)}[at](n){const r=n.effect_instruction_i0,s=this.getNextFailCont();if(s!==void 0)switch(s._op){case ic:case Po:return Ut(this.currentRuntimeFlags)&&this.isInterrupted()?ee(Nf(r)):Me(()=>s.effect_instruction_i1(r));case"OnStep":return Ut(this.currentRuntimeFlags)&&this.isInterrupted()?ee(Nf(r)):_e(ee(r));case wu:return this.patchRuntimeFlags(this.currentRuntimeFlags,s.patch),Ut(this.currentRuntimeFlags)&&this.isInterrupted()?ee(Ue(r,this.getInterruptedCause())):ee(r);default:oo(s)}else return Ot.currentOp=ee(r),kt}[Zp](n){return Me(()=>n.effect_instruction_i0(this,L_(this.currentRuntimeFlags)))}Blocked(n){const r=this.getFiberRefs(),s=this.currentRuntimeFlags;if(this._steps.length>0){const o=[],i=this._steps[this._steps.length-1];let c=this.popStack();for(;c&&c._op!=="OnStep";)o.push(c),c=this.popStack();this.setFiberRefs(i.refs),this.currentRuntimeFlags=i.flags;const a=rI(i.refs,r),l=vo(i.flags,s);return _e(Wg(n.effect_instruction_i0,Je(f=>{for(;o.length>0;)f.pushStack(o.pop());return f.setFiberRefs(sI(f.id(),f.getFiberRefs())(a)),f.currentRuntimeFlags=ko(l)(f.currentRuntimeFlags),n.effect_instruction_i1})))}return qi(o=>P(by(ET(n.effect_instruction_i0)),()=>o(n.effect_instruction_i1)))}RunBlocked(n){return KM(n.effect_instruction_i0)}[Ts](n){const r=n.effect_instruction_i0,s=this.currentRuntimeFlags,o=ko(s,r);if(Ut(o)&&this.isInterrupted())return ee(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,r),n.effect_instruction_i1){const i=vo(o,s);return this.pushStack(new TT(i,n)),Me(()=>n.effect_instruction_i1(s))}else return fn}[Fo](n){return this.pushStack(n),n.effect_instruction_i0}OnStep(n){return this.pushStack(n),n.effect_instruction_i0}[ic](n){return this.pushStack(n),n.effect_instruction_i0}[Po](n){return this.pushStack(n),n.effect_instruction_i0}[Zr](n){return this._asyncBlockingOn=n.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,n.effect_instruction_i0),Ot.currentOp=n,kt}[mo](n){return this._isYielding=!1,Ot.currentOp=n,kt}[jo](n){const r=n.effect_instruction_i0,s=n.effect_instruction_i1;return r()?(this.pushStack(n),s()):fn}[po](n){return Kr[po](this,n,void 0)}[wi](n){return Me(()=>n.commit())}runLoop(n){let r=n;for(this.currentOpCount=0;;){if(this.currentRuntimeFlags&CE&&this.currentSupervisor.onEffect(this,r),this._queue.length>0&&(r=this.drainQueueWhileRunning(this.currentRuntimeFlags,r)),!this._isYielding){this.currentOpCount+=1;const s=this.currentScheduler.shouldYield(this);if(s!==!1){this._isYielding=!0,this.currentOpCount=0;const o=r;r=P(tl({priority:s}),()=>o)}}try{if(r=this.currentTracer.context(()=>DM!==r[pr]._V?Df(`Cannot execute an Effect versioned ${r[pr]._V} with a Runtime of version ${gi()}`):this[r._op](r),this),r===kt){const s=Ot.currentOp;return s._op===mo||s._op===Zr?kt:(Ot.currentOp=null,s._op===ut||s._op===at?s:ee(Qe(s)))}}catch(s){r!==kt&&!j(r,"_op")||!(r._op in this)?r=Df(`Not a valid effect: ${er(r)}`):ax(s)?r=ee(Ue(Qe(s),Bt(En))):r=Kf(s)}}}}const UM=J("effect/FiberRef/currentMinimumLogLevel",()=>Ve(U$("Info"))),BM=e=>kl(t=>{const n=$$(t.context,Xo);Hm(n,E_).unsafe.log(e.log(t))}),qM=J(Symbol.for("effect/Logger/defaultLogger"),()=>BM(cA)),JM=J(Symbol.for("effect/Logger/tracerLogger"),()=>kl(({annotations:e,cause:t,context:n,fiberId:r,logLevel:s,message:o})=>{const i=Rs(gs(n,Bs),x_);if(i._tag==="None"||i.value._tag==="ExternalSpan")return;const c=Wm(gs(n,Xo),ul),a={};for(const[l,f]of e)a[l]=f;a["effect.fiberId"]=SO(r),a["effect.logLevel"]=s.label,t!==null&&t._tag!=="Empty"&&(a["effect.cause"]=Ls(t,{renderErrorCause:!0})),i.value.event(er(Array.isArray(o)?o[0]:o),c.unsafeCurrentTimeNanos(),a)})),VM=J(Symbol.for("effect/FiberRef/currentLoggers"),()=>GT(Ju(qM,JM))),HM=h(e=>vw(e[0]),(e,t,n)=>Je(r=>{const s=(n==null?void 0:n.batching)===!0||(n==null?void 0:n.batching)==="inherit"&&r.getFiberRef(nx);return n!=null&&n.discard?fd(n.concurrency,()=>Kn($a,n==null?void 0:n.concurrentFinalizers)(o=>s?Sn(e,(i,c)=>o(t(i,c)),!0,!1,1):Ui(e,(i,c)=>o(t(i,c)))),()=>Kn(Ia,n==null?void 0:n.concurrentFinalizers)(o=>Sn(e,(i,c)=>o(t(i,c)),s,!1)),o=>Kn(Aa(o),n==null?void 0:n.concurrentFinalizers)(i=>Sn(e,(c,a)=>i(t(c,a)),s,!1,o))):fd(n==null?void 0:n.concurrency,()=>Kn($a,n==null?void 0:n.concurrentFinalizers)(o=>s?yd(e,1,(i,c)=>o(t(i,c)),!0):qt(e,(i,c)=>o(t(i,c)))),()=>Kn(Ia,n==null?void 0:n.concurrentFinalizers)(o=>WM(e,(i,c)=>o(t(i,c)),s)),o=>Kn(Aa(o),n==null?void 0:n.concurrentFinalizers)(i=>yd(e,o,(c,a)=>i(t(c,a)),s)))})),WM=(e,t,n)=>ge(()=>{const r=le(e),s=new Array(r.length);return Ji(Sn(r,(i,c)=>P(t(i,c),a=>F(()=>s[c]=a)),n,!1),z(s))}),Sn=(e,t,n,r,s)=>qi(o=>NT(i=>Je(c=>{let a=Array.from(e).reverse(),l=a.length;if(l===0)return dt;let f=0,d=!1;const p=s?Math.min(a.length,s):a.length,m=new Set,_=new Array,k=()=>m.forEach(x=>{x.currentScheduler.scheduleTask(()=>{x.unsafeInterruptAsFork(c.id())},0)}),g=new Array,b=new Array,S=new Array,w=()=>{const x=_.filter(({exit:M})=>M._tag==="Failure").sort((M,B)=>M.indexM);return x.length===0&&x.push(fn),x},T=(x,M=!1)=>{const B=o_(i(x)),U=zM(B,c,c.currentRuntimeFlags,wl);return c.currentScheduler.scheduleTask(()=>{M&&U.unsafeInterruptAsFork(c.id()),U.resume(B)},0),U},v=()=>{r||(l-=a.length,a=[]),d=!0,k()},E=n?AT:Qg,O=T(ms(x=>{const M=(U,G)=>{U._op==="Blocked"?S.push(U):(_.push({index:G,exit:U}),U._op==="Failure"&&!d&&v())},B=()=>{if(a.length>0){const U=a.pop();let G=f++;const ie=()=>{const C=a.pop();return G=f++,P(tl(),()=>P(E(o(t(C,G))),X))},X=C=>a.length>0&&(M(C,G),a.length>0)?ie():z(C),me=P(E(o(t(U,G))),X),Y=T(me);g.push(Y),m.add(Y),d&&Y.currentScheduler.scheduleTask(()=>{Y.unsafeInterruptAsFork(c.id())},0),Y.addObserver(C=>{let H;if(C._op==="Failure"?H=C:H=C.effect_instruction_i0,b.push(Y),m.delete(Y),M(H,G),_.length===l)x(z(we(gc(w(),{parallel:!0}),()=>fn)));else if(S.length+_.length===l){const tt=S.map(He=>He.effect_instruction_i0).reduce(jg);x(z(Wg(tt,Sn([we(gc(w(),{parallel:!0}),()=>fn),...S.map(He=>He.effect_instruction_i1)],He=>He,n,!0,s))))}else B()})}};for(let U=0;U{v();const x=S.length+1,M=Math.min(typeof s=="number"?s:S.length,S.length),B=Array.from(S);return ms(U=>{const G=[];let ie=0,X=0;const me=(C,H)=>tt=>{G[C]=tt,ie++,ie===x&&U(dm(gc(G,{parallel:!0}))),B.length>0&&H&&Y()},Y=()=>{T(B.pop(),!0).addObserver(me(X,!0)),X++};O.addObserver(me(X,!1)),X++;for(let C=0;Cqt(b,x=>x.inheritAll)})))}))),yd=(e,t,n,r)=>ge(()=>{const s=le(e),o=new Array(s.length);return Ji(Sn(s,(c,a)=>Pe(n(c,a),l=>o[a]=l),r,!1,t),z(o))}),by=e=>YM(e,wl),GM=(e,t,n,r=null)=>{const s=Sy(e,t,n,r);return s.resume(e),s},zM=(e,t,n,r=null)=>Sy(e,t,n,r),Sy=(e,t,n,r=null)=>{const s=Sg(),o=t.getFiberRefs(),i=E$(o,s),c=new yy(s,i,n),a=gs(i,Bs),l=c.currentSupervisor;return l.onStart(a,e,R(t),c),c.addObserver(d=>l.onEnd(d,c)),(r!==null?r:y(t.getFiberRef(Oa),we(()=>t.scope()))).add(n,c),c},YM=(e,t)=>Je((n,r)=>z(GM(e,n,r.runtimeFlags,t))),bd=e=>qs(t=>Xe(Rs(t,Ws),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Parallel":return e;case"Sequential":case"ParallelN":return P(Wi(n,Ia),r=>Tl(e,r))}}})),Sd=e=>t=>qs(n=>Xe(Rs(n,Ws),{onNone:()=>t,onSome:r=>r.strategy._tag==="ParallelN"&&r.strategy.parallelism===e?t:P(Wi(r,Aa(e)),s=>Tl(t,s))})),Kn=(e,t)=>n=>qs(r=>Xe(Rs(r,Ws),{onNone:()=>n(te),onSome:s=>{if(t===!0){const o=e._tag==="Parallel"?bd:e._tag==="Sequential"?wd:Sd(e.parallelism);switch(s.strategy._tag){case"Parallel":return o(n(bd));case"Sequential":return o(n(wd));case"ParallelN":return o(n(Sd(s.strategy.parallelism)))}}else return n(te)}})),wd=e=>qs(t=>Xe(Rs(t,Ws),{onNone:()=>e,onSome:n=>{switch(n.strategy._tag){case"Sequential":return e;case"Parallel":case"ParallelN":return P(Wi(n,$a),r=>Tl(e,r))}}})),Ws=Nn("effect/Scope"),Tl=h(2,(e,t)=>Sx(e,Gm(sk(Ws,t)))),ZM=e=>$r(e,{differ:MM,fork:ts}),vd=YT(PE),QM=ZM(Qi),XM=(e,t,n)=>e_(r=>P(P(by(n_(e)),s=>ms(o=>{const i=t.map(l=>l.listeners.count),c=()=>{i.every(l=>l===0)&&t.every(l=>l.result.state.current._tag==="Pending"?!0:!!(l.result.state.current._tag==="Done"&&il(l.result.state.current.effect)&&l.result.state.current.effect._tag==="Failure"&&sT(l.result.state.current.effect.cause)))&&(a.forEach(l=>l()),n==null||n(),o(jT(s)))};s.addObserver(l=>{a.forEach(f=>f()),o(l)});const a=t.map((l,f)=>{const d=p=>{i[f]=p,c()};return l.listeners.addObserver(d),()=>l.listeners.removeObserver(d)});return c(),F(()=>{a.forEach(l=>l())})})),()=>ge(()=>{const s=t.flatMap(o=>o.state.completed?[]:[o]);return Ui(s,o=>kM(o.request,dx(r)))}))),e1=ux,t1=ox,n1=Wi,r1=Fi,s1=function(){const e=Symbol.for("effect/Data/Error/plainArgs");return class extends sl{constructor(n){super(n==null?void 0:n.message,n!=null&&n.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),o1=e=>{class t extends s1{constructor(){super(...arguments);u(this,"_tag",e)}}return t.prototype.name=e,t},Ba=Symbol.for("effect/DateTime"),i1={[Ba]:Ba,pipe(){return N(this,arguments)},[ne](){return this.toString()},toJSON(){return wy(this).toJSON()}},c1={...i1,_tag:"Utc",[K](){return oe(this,Si(this.epochMillis))},[L](e){return xl(e)&&e._tag==="Utc"&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${wy(this).toJSON()})`}},xl=e=>j(e,Ba),a1=e=>xl(e[0]),u1=e=>{const t=Object.create(c1);return t.epochMillis=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},wc=e=>{const t=e.getTime();if(Number.isNaN(t))throw new e1("Invalid date");return u1(t)},l1=e=>{if(xl(e))return e;if(e instanceof Date)return wc(e);if(typeof e=="object"){const t=new Date(0);return p1(t,e),wc(t)}return wc(new Date(e))},f1=h(2,(e,t)=>kd(t)-kd(e)),wy=e=>new Date(e.epochMillis),d1=e=>{if(e._tag==="Utc")return new Date(e.epochMillis);if(e.zone._tag==="Offset")return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);const t=e.zone.format.formatToParts(e.epochMillis).filter(r=>r.type!=="literal"),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},h1=e=>{const t=Math.abs(e);let n=Math.floor(t/(60*60*1e3)),r=Math.round(t%(60*60*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?"-":"+"}${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`},kd=e=>e.epochMillis,p1=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){const n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},m1=e=>e._tag==="Named"?e.id:h1(e.offset),g1=h(a1,(e,t)=>{try{return new Intl.DateTimeFormat(t==null?void 0:t.locale,{timeZone:e._tag==="Utc"?"UTC":m1(e.zone),...t}).format(e.epochMillis)}catch{return new Intl.DateTimeFormat(t==null?void 0:t.locale,{timeZone:"UTC",...t}).format(d1(e))}}),_1=e=>(t,n)=>{const r=Sg(),s=[[Bs,[[r,e.context]]]];n!=null&&n.scheduler&&s.push([G_,[[r,n.scheduler]]]);let o=I$(e.fiberRefs,{entries:s,forkAs:r});n!=null&&n.updateRefs&&(o=n.updateRefs(o,r));const i=new yy(r,o,e.runtimeFlags);let c=t;n!=null&&n.scope&&(c=P(n1(n.scope,j_),l=>Ji(sx(l,e_(f=>D(f,i.id())?dt:a_(i,f))),Xu(t,f=>t1(l,f)))));const a=i.currentSupervisor;return a!==Qi&&(a.onStart(e.context,c,I(),i),i.addObserver(l=>a.onEnd(l,i))),wl.add(e.runtimeFlags,i),(n==null?void 0:n.immediate)===!1?i.resume(c):i.start(c),i},y1=e=>t=>{const n=O1(e)(t);if(n._tag==="Failure")throw v1(n.effect_instruction_i0);return n.effect_instruction_i0};class b1 extends Error{constructor(n){super(`Fiber #${n.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`);u(this,"fiber");u(this,"_tag","AsyncFiberException");this.fiber=n,this.name=this._tag,this.stack=this.message}}const S1=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new b1(e);return Error.stackTraceLimit=t,n},vc=Symbol.for("effect/Runtime/FiberFailure"),io=Symbol.for("effect/Runtime/FiberFailure/Cause");var xh,$h;class w1 extends Error{constructor(n){const r=Vg(n)[0];super((r==null?void 0:r.message)||"An error has occurred");u(this,$h);u(this,xh);this[vc]=vc,this[io]=n,this.name=r?`(FiberFailure) ${r.name}`:"FiberFailure",r!=null&&r.stack&&(this.stack=r.stack)}toJSON(){return{_id:"FiberFailure",cause:this[io].toJSON()}}toString(){return"(FiberFailure) "+Ls(this[io],{renderErrorCause:!0})}[($h=vc,xh=io,ne)](){return this.toString()}}const v1=e=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=0;const n=new w1(e);return Error.stackTraceLimit=t,n},k1=e=>{const t=e;switch(t._op){case"Failure":case"Success":return t;case"Left":return Hf(t.left);case"Right":return _e(t.right);case"Some":return _e(t.value);case"None":return Hf(h_())}},O1=e=>t=>{const n=k1(t);if(n)return n;const r=new VI,s=_1(e)(t,{scheduler:r});r.flush();const o=s.unsafePoll();return o||fx(Qu(S1(s),cl(s)))};class E1{constructor(t,n,r){u(this,"context");u(this,"runtimeFlags");u(this,"fiberRefs");this.context=t,this.runtimeFlags=n,this.fiberRefs=r}pipe(){return N(this,arguments)}}const T1=e=>new E1(e.context,e.runtimeFlags,e.fiberRefs),x1=Fg(Or,Cg,Rg),$1=T1({context:Nu(),runtimeFlags:x1,fiberRefs:A$()}),I1=y1($1),A1=Ki,To=HM,Nt=z,co=ge,We=dt,$l=va,st=Pe,M1=Bi,cn=Zo,De=P,R1=Di,C1=RT,vy=I1,Od=l1,N1=f1,Ed=g1;class xe{constructor(t,n,r){u(this,"path");u(this,"actual");u(this,"issue");u(this,"_tag","Pointer");this.path=t,this.actual=n,this.issue=r}}class Td{constructor(t,n){u(this,"actual");u(this,"message");u(this,"_tag","Unexpected");this.actual=t,this.message=n}}class Dr{constructor(t,n){u(this,"ast");u(this,"message");u(this,"_tag","Missing");u(this,"actual");this.ast=t,this.message=n}}class ce{constructor(t,n,r,s){u(this,"ast");u(this,"actual");u(this,"issues");u(this,"output");u(this,"_tag","Composite");this.ast=t,this.actual=n,this.issues=r,this.output=s}}class kc{constructor(t,n,r,s){u(this,"ast");u(this,"actual");u(this,"kind");u(this,"issue");u(this,"_tag","Refinement");this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class Oc{constructor(t,n,r,s){u(this,"ast");u(this,"actual");u(this,"kind");u(this,"issue");u(this,"_tag","Transformation");this.ast=t,this.actual=n,this.kind=r,this.issue=s}}class ot{constructor(t,n,r){u(this,"ast");u(this,"actual");u(this,"message");u(this,"_tag","Type");this.ast=t,this.actual=n,this.message=r}}class F1{constructor(t,n,r){u(this,"ast");u(this,"actual");u(this,"message");u(this,"_tag","Forbidden");this.ast=t,this.actual=n,this.message=r}}const xd=Symbol.for("effect/Schema/ParseErrorTypeId");var Ih;class P1 extends o1("ParseError"){constructor(){super(...arguments);u(this,Ih,xd)}get message(){return this.toString()}toString(){return xo.formatIssueSync(this.issue)}toJSON(){return{_id:"ParseError",message:this.toString()}}[(Ih=xd,ne)](){return this.toJSON()}}const j1=e=>new P1({issue:e}),_s=be,ky=q,ao=h(2,(e,t)=>{const n=e;return n._tag==="Left"?n:n._tag==="Right"?t(n.right):De(e,t)}),Oy=h(2,(e,t)=>{const n=e;return n._tag==="Left"?n:n._tag==="Right"?be(t(n.right)):st(e,t)}),Ec=h(2,(e,t)=>{const n=e;return n._tag==="Left"?q(t(n.left)):n._tag==="Right"?n:M1(e,t)}),Et=e=>{const t=e;if(t._tag==="Left"||t._tag==="Right")return t},Ey=h(2,(e,t)=>{const n=e;return n._tag==="Left"?t(n.left):n._tag==="Right"?n:$l(e,t)}),Xi=(e,t)=>t===void 0||bt(t)?e:e===void 0?t:{...e,...t},L1=(e,t,n)=>{const r=ke(e,t);return(s,o)=>r(s,Xi(n,o))},Ty=(e,t,n)=>{const r=L1(e,t,n);return(s,o)=>rv(r(s,o),j1)},K1=(e,t,n)=>{const r=ke(e,t);return(s,o)=>r(s,{...Xi(n,o),isEffectAllowed:!0})},D1=(e,t)=>Ty(e.ast,!0,t),U1=(e,t)=>K1(e.ast,!1,t),Il=(e,t)=>Ty(ae(e.ast),!0,t),B1=(e,t)=>{const n=ke(ae(e.ast),!0);return(r,s)=>$t(n(r,{exact:!0,...Xi(t,s)}))},q1=J(Symbol.for("effect/ParseResult/decodeMemoMap"),()=>new WeakMap),J1=J(Symbol.for("effect/ParseResult/encodeMemoMap"),()=>new WeakMap),ke=(e,t)=>{const n=t?q1:J1,r=n.get(e);if(r)return r;const s=V1(e,t),o=c0(e),i=Z(o)?(l,f)=>s(l,Xi(f,o.value)):s,c=a0(e),a=t&&Z(c)?(l,f)=>Vr(Ey(i(l,f),c.value),e,l,f):i;return n.set(e,a),a},Tc=e=>Tt(s0(e)),xc=e=>Tt(o0(e)),V1=(e,t)=>{switch(e._tag){case"Refinement":if(t){const n=ke(e.from,!0);return(r,s)=>{s=s??ac;const o=(s==null?void 0:s.errors)==="all",i=ao(Ey(n(r,s),c=>{const a=new kc(e,r,"From",c);return o&&l0(e)&&Ay(c)?Xe(e.filter(r,s,e),{onNone:()=>q(a),onSome:l=>q(new ce(e,r,[a,new kc(e,r,"Predicate",l)]))}):q(a)}),c=>Xe(e.filter(c,s,e),{onNone:()=>be(c),onSome:a=>q(new kc(e,r,"Predicate",a))}));return Vr(i,e,r,s)}}else{const n=ke(ae(e),!0),r=ke(xy(e.from),!1);return(s,o)=>Vr(ao(n(s,o),i=>r(i,o)),e,s,o)}case"Transformation":{const n=G1(e.transformation,t),r=t?ke(e.from,!0):ke(e.to,!1),s=t?ke(e.to,!0):ke(e.from,!1);return(o,i)=>Vr(ao(Ec(r(o,i),c=>new Oc(e,o,t?"Encoded":"Type",c)),c=>ao(Ec(n(c,i??ac,e,o),a=>new Oc(e,o,"Transformation",a)),a=>Ec(s(a,i),l=>new Oc(e,o,t?"Type":"Encoded",l)))),e,o,i)}case"Declaration":{const n=t?e.decodeUnknown(...e.typeParameters):e.encodeUnknown(...e.typeParameters);return(r,s)=>Vr(n(r,s??ac,e),e,r,s)}case"Literal":return Le(e,n=>n===e.literal);case"UniqueSymbol":return Le(e,n=>n===e.symbol);case"UndefinedKeyword":return Le(e,yw);case"NeverKeyword":return Le(e,bw);case"UnknownKeyword":case"AnyKeyword":case"VoidKeyword":return be;case"StringKeyword":return Le(e,Be);case"NumberKeyword":return Le(e,bt);case"BooleanKeyword":return Le(e,Xn);case"BigIntKeyword":return Le(e,_i);case"SymbolKeyword":return Le(e,zc);case"ObjectKeyword":return Le(e,Qt);case"Enums":return Le(e,n=>e.enums.some(([r,s])=>s===n));case"TemplateLiteral":{const n=j0(e);return Le(e,r=>Be(r)&&n.test(r))}case"TupleType":{const n=e.elements.map(l=>ke(l.type,t)),r=e.rest.map(l=>ke(l.type,t));let s=e.elements.filter(l=>!l.isOptional);e.rest.length>0&&(s=s.concat(e.rest.slice(1)));const o=s.length,i=e.elements.length>0?e.elements.map((l,f)=>f).join(" | "):"never",c=Tc(e),a=xc(e);return(l,f)=>{if(!Qc(l))return q(new ot(e,l));const d=(f==null?void 0:f.errors)==="all",p=[];let m=0;const _=[],k=l.length;for(let w=k;w<=o-1;w++){const T=new xe(w,l,new Dr(s[w-k]));if(d){p.push([m++,T]);continue}else return q(new ce(e,l,T,_))}if(e.rest.length===0)for(let w=e.elements.length;w<=k-1;w++){const T=new xe(w,l,new Td(l[w],`is unexpected, expected: ${i}`));if(d){p.push([m++,T]);continue}else return q(new ce(e,l,T,_))}let g=0,b;for(;gDe(cn(T),B=>{if(Ie(B)){const U=new xe(O,l,B.left);return d?(x.push([E,U]),We):q(new ce(e,l,U,nt(M)))}return M.push([E,B.right]),We}))}}if(se(r)){const[w,...T]=r;for(;gDe(cn(v),U=>{if(Ie(U)){const G=new xe(x,l,U.left);return d?(M.push([O,G]),We):q(new ce(e,l,G,nt(B)))}else return B.push([O,U.right]),We}))}}for(let v=0;vDe(cn(E),G=>{if(Ie(G)){const ie=new xe(M,l,G.left);return d?(B.push([x,ie]),We):q(new ce(e,l,ie,nt(U)))}return U.push([x,G.right]),We}))}}}const S=({es:w,output:T})=>go(w)?q(new ce(e,l,nt(w),nt(T))):be(nt(T));if(b&&b.length>0){const w=b;return co(()=>{const T={es:Br(p),output:Br(_)};return De(To(w,v=>v(T),{concurrency:c,batching:a,discard:!0}),()=>S(T))})}return S({output:_,es:p})}}case"TypeLiteral":{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return Le(e,Sw);const n=[],r={},s=[];for(const f of e.propertySignatures)n.push([ke(f.type,t),f]),r[f.name]=null,s.push(f.name);const o=e.indexSignatures.map(f=>[ke(f.parameter,t),ke(f.type,t),f.parameter]),i=Fe.make(e.indexSignatures.map(f=>f.parameter).concat(s.map(f=>zc(f)?new h0(f):new Xc(f)))),c=ke(i,t),a=Tc(e),l=xc(e);return(f,d)=>{if(!kw(f))return q(new ot(e,f));const p=(d==null?void 0:d.errors)==="all",m=[];let _=0;const k=(d==null?void 0:d.onExcessProperty)==="error",g=(d==null?void 0:d.onExcessProperty)==="preserve",b={};let S;if(k||g){S=It(f);for(const E of S){const O=Et(c(E,d));if(Ie(O))if(k){const x=new xe(E,f,new Td(f[E],`is unexpected, expected: ${String(i)}`));if(p){m.push([_++,x]);continue}else return q(new ce(e,f,x,b))}else b[E]=f[E]}}let w;const T=(d==null?void 0:d.exact)===!0;for(let E=0;EDe(cn(U),C=>{if(Ie(C)){const H=new xe(X,f,M?C.left:new Dr(O));return p?(me.push([ie,H]),We):q(new ce(e,f,H,Y))}return Y[X]=C.right,We}))}}for(let E=0;EDe(cn(ie),tt=>{if(Ie(tt)){const He=new xe(Y,f,tt.left);return p?(C.push([me,He]),We):q(new ce(e,f,He,H))}else return Object.prototype.hasOwnProperty.call(r,U)||(H[U]=tt.right),We}))}}}}const v=({es:E,output:O})=>{if(go(E))return q(new ce(e,f,nt(E),O));if((d==null?void 0:d.propertyOrder)==="original"){const x=S||It(f);for(const B of s)x.indexOf(B)===-1&&x.push(B);const M={};for(const B of x)Object.prototype.hasOwnProperty.call(O,B)&&(M[B]=O[B]);return be(M)}return be(O)};if(w&&w.length>0){const E=w;return co(()=>{const O={es:Br(m),output:Object.assign({},b)};return De(To(E,x=>x(O),{concurrency:a,batching:l,discard:!0}),()=>v(O))})}return v({es:m,output:b})}}case"Union":{const n=H1(e.types,t),r=It(n.keys),s=r.length,o=e.types.length,i=new Map;for(let l=0;l{const d=[];let p=0,m=[];if(s>0)if(_u(l))for(let g=0;g0&&(m=m.concat(n.otherwise));let _;for(let g=0;gco(()=>"finalResult"in v?We:De(cn(S),E=>($t(E)?v.finalResult=E:v.es.push([T,E.left]),We))))}}const k=g=>go(g)?g.length===1&&g[0][1]._tag==="Type"?q(g[0][1]):q(new ce(e,l,nt(g))):q(new ot(e,l));if(_&&_.length>0){const g=_;return co(()=>{const b={es:Br(d)};return De(To(g,S=>S(b),{concurrency:c,batching:a,discard:!0}),()=>"finalResult"in b?b.finalResult:k(b.es))})}return k(d)}}case"Suspend":{const n=Sm(()=>ke(cs(e.f(),e.annotations),t));return(r,s)=>n()(r,s)}}},Le=(e,t)=>n=>t(n)?be(n):q(new ot(e,n)),Jr=(e,t)=>{switch(e._tag){case"Declaration":{const n=Fm(e);if(Z(n))return Jr(n.value,t);break}case"TypeLiteral":{const n=[];for(let r=0;r{const n={},r=[],s=[];for(let o=0;o0){s.push(i);for(let a=0;aHn(e)?xy(e.from):e,Vr=(e,t,n,r)=>{const s=Et(e);if(s)return s;if((r==null?void 0:r.isEffectAllowed)===!0)return e;try{return vy(cn(e))}catch{return q(new F1(t,n,"cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work"))}},W1=([e],[t])=>e>t?1:et[1])}const G1=(e,t)=>{switch(e._tag){case"FinalTransformation":return t?e.decode:e.encode;case"ComposeTransformation":return be;case"TypeLiteralTransformation":return n=>{let r=be(n);for(const s of e.propertySignatureTransformations){const[o,i]=t?[s.from,s.to]:[s.to,s.from],c=t?s.decode:s.encode;r=Oy(r,l=>{const f=c(Object.prototype.hasOwnProperty.call(l,o)?R(l[o]):I());return delete l[o],Z(f)&&(l[i]=f.value),l})}return r}}},Ke=(e,t=[])=>({value:e,forest:t}),xo={formatIssue:e=>st(Un(e),z1),formatIssueSync:e=>vy(xo.formatIssue(e)),formatError:e=>xo.formatIssue(e.issue),formatErrorSync:e=>xo.formatIssueSync(e.issue)},z1=e=>e.value+$y(` -`,e.forest),$y=(e,t)=>{let n="";const r=t.length;let s;for(let o=0;o1&&!i?"│ ":" "),s.forest)}return n},Y1=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},Z1=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},Iy=e=>"ast"in e?R(e.ast):I(),Q1=e=>Iy(e).pipe(ki(n0),De(t=>{const n=t(e);return Be(n)?Nt({message:n,override:!1}):A1(n)?st(n,r=>({message:r,override:!1})):Be(n.message)?Nt({message:n.message,override:n.override}):st(n.message,r=>({message:r,override:n.override}))})),Al=e=>t=>t._tag===e,Ay=Al("Composite"),$d=Al("Refinement"),Id=Al("Transformation"),Ml=e=>Q1(e).pipe(De(t=>!t.override&&(Ay(e)||$d(e)&&e.kind==="From"||Id(e)&&e.kind!=="Transformation")?Id(e)||$d(e)?Ml(e.issue):I():Nt(t.message))),My=e=>Iy(e).pipe(ki(i0),uv(t=>vi(t(e))));function X1(e){return Nm(e).pipe(Jt(()=>Rm(e)),Jt(()=>Cm(e)),Jt(()=>Ei(e)),we(()=>`{ ${e.from} | filter }`))}function eR(e){return e.message!==void 0?e.message:`Expected ${Hn(e.ast)?X1(e.ast):String(e.ast)}, actual ${St(e.actual)}`}const tR=e=>Ml(e).pipe(C1(()=>My(e)),$l(()=>Nt(eR(e)))),uo=e=>we(My(e),()=>String(e.ast)),nR=e=>e.message??"is forbidden",rR=e=>e.message??"is unexpected",sR=e=>r0(e.ast).pipe(De(t=>{const n=t();return Be(n)?Nt(n):n}),$l(()=>Nt(e.message??"is missing"))),$c=(e,t)=>R1(Ml(e),{onFailure:t,onSuccess:n=>Nt(Ke(n))}),Un=e=>{switch(e._tag){case"Type":return st(tR(e),Ke);case"Forbidden":return Nt(Ke(uo(e),[Ke(nR(e))]));case"Unexpected":return Nt(Ke(rR(e)));case"Missing":return st(sR(e),Ke);case"Transformation":return $c(e,()=>st(Un(e.issue),t=>Ke(uo(e),[Ke(Y1(e.kind),[t])])));case"Refinement":return $c(e,()=>st(Un(e.issue),t=>Ke(uo(e),[Ke(Z1(e.kind),[t])])));case"Pointer":return st(Un(e.issue),t=>Ke(km(e.path),[t]));case"Composite":{const t=uo(e);return $c(e,()=>vm(e.issues)?st(To(e.issues,Un),n=>Ke(t,n)):st(Un(e.issues),n=>Ke(t,[n])))}}},oR=h(e=>Qt(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),iR=h(e=>Qt(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),gr=Symbol.for("effect/Schema"),he=e=>{var t,n,r;return n=gr,t=gr,r=class{constructor(){u(this,n,qa)}static annotations(o){return he(tn(this.ast,o))}static pipe(){return N(this,arguments)}static toString(){return String(e)}},u(r,"ast",e),u(r,"Type"),u(r,"Encoded"),u(r,"Context"),u(r,t,qa),r},qa={_A:e=>e,_I:e=>e,_R:e=>e},Ad={schemaId:Hv,message:Tm,missingMessage:Eu,identifier:Tu,title:Pt,description:Is,examples:Wv,default:Gv,documentation:Xv,jsonSchema:zv,arbitrary:Yv,pretty:Zv,equivalence:Qv,concurrency:xm,batching:$m,parseIssueTitle:Im,parseOptions:Am,decodingFallback:Mm},Ar=e=>{if(!e)return{};const t={...e};for(const n in Ad)if(n in e){const r=Ad[n];t[r]=e[n],delete t[n]}return t},tn=(e,t)=>cs(e,Ar(t)),cR=e=>he(ra(e.ast)),Md=e=>he(ae(e.ast)),Yt=e=>j(e,gr)&&Qt(e[gr]),aR=e=>Au(e)?Fe.make(I0(e,t=>new Xc(t))):new Xc(e[0]),Ry=(e,t=aR(e))=>{var n;return n=class extends he(t){static annotations(s){return Ry(this.literals,tn(this.ast,s))}},u(n,"literals",[...e]),n};function Cy(...e){return se(e)?Ry(e):Ny}const uR=(e,t,n)=>he(new Ti(e.map(r=>r.ast),(...r)=>t.decode(...r.map(he)),(...r)=>t.encode(...r.map(he)),Ar(n))),lR=(e,t)=>{const n=()=>(s,o,i)=>e(s)?_s(s):ky(new ot(i,s)),r=n;return he(new Ti([],n,r,Ar(t)))},fR=function(){if(Array.isArray(arguments[0])){const n=arguments[0],r=arguments[1],s=arguments[2];return uR(n,r,s)}const e=arguments[0],t=arguments[1];return lR(e,t)};class dR extends he(is){}class Ny extends he($u){}class hR extends he(ea){}class pR extends he(na){}const mR=e=>Fe.make(e.map(t=>t.ast)),Fy=(e,t=mR(e))=>{var n;return n=class extends he(t){static annotations(s){return Fy(this.members,tn(this.ast,s))}},u(n,"members",[...e]),n};function gR(...e){return Au(e)?Fy(e):se(e)?e[0]:Ny}const _R=e=>gR(e,dR),yR=(e,t)=>new xi(e.map(n=>Yt(n)?new en(n.ast,!1):n.ast),t.map(n=>Yt(n)?new As(n.ast):n.ast),!0),Py=(e,t,n=yR(e,t))=>{var r;return r=class extends he(n){static annotations(o){return Py(this.elements,this.rest,tn(this.ast,o))}},u(r,"elements",[...e]),u(r,"rest",[...t]),r},jy=(e,t)=>{var n;return n=class extends Py([e],[e],t){static annotations(s){return jy(this.value,tn(this.ast,s))}},u(n,"value",e),n},yt=e=>jy(e),Ja=e=>e?'"?:"':'":"';class Ly extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"defaultValue");u(this,"_tag","PropertySignatureDeclaration");this.isReadonly=s,this.defaultValue=i}toString(){const n=Ja(this.isOptional),r=String(this.type);return`PropertySignature<${n}, ${r}, never, ${n}, ${r}>`}}class bR extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"fromKey");this.isReadonly=s,this.fromKey=i}}class SR extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"defaultValue");this.isReadonly=s,this.defaultValue=i}}const wR=e=>e===void 0?"never":Be(e)?JSON.stringify(e):String(e);class vR{constructor(t,n,r,s){u(this,"from");u(this,"to");u(this,"decode");u(this,"encode");u(this,"_tag","PropertySignatureTransformation");this.from=t,this.to=n,this.decode=r,this.encode=s}toString(){return`PropertySignature<${Ja(this.to.isOptional)}, ${this.to.type}, ${wR(this.from.fromKey)}, ${Ja(this.from.isOptional)}, ${this.from.type}>`}}const Ky=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new Ly(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new vR(new bR(e.from.type,e.from.isOptional,e.from.isReadonly,e.from.annotations),new SR(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},Dy=Symbol.for("effect/PropertySignature"),Rl=e=>j(e,Dy);var Ah,Mh;Mh=gr,Ah=Dy;const Kl=class Kl{constructor(t){u(this,"ast");u(this,Mh);u(this,Ah,null);u(this,"_TypeToken");u(this,"_Key");u(this,"_EncodedToken");u(this,"_HasDefault");this.ast=t}pipe(){return N(this,arguments)}annotations(t){return new Kl(Ky(this.ast,Ar(t)))}toString(){return String(this.ast)}};let Va=Kl;class Cl extends Va{constructor(n,r){super(n);u(this,"from");this.from=r}annotations(n){return new Cl(Ky(this.ast,Ar(n)),this.from)}}const Mn=e=>{const t=e.ast===is||e.ast===$u?is:_R(e).ast;return new Cl(new Ly(t,!0,!0,{},void 0),e)},kR=L0([Eu]),OR=(e,t)=>{const n=It(e),r=[];if(n.length>0){const o=[],i=[],c=[];for(let a=0;a{o.push(m),i.push(new Oe(m.name,ae(m.type),m.isOptional,m.isReadonly,m.annotations))}),d.forEach(m=>{a.push(m),l.push(new Ms(m.parameter,ae(m.type),m.isReadonly))})}return new Wn(new At(o,a,{[Jn]:"Struct (Encoded side)"}),new At(i,l,{[Jn]:"Struct (Type side)"}),new yo(c))}}const s=[];for(const o of t){const{indexSignatures:i,propertySignatures:c}=Sf(o.key.ast,o.value.ast);c.forEach(a=>r.push(a)),i.forEach(a=>s.push(a))}return new At(r,s)},Uy=(e,t)=>{const n=It(e);for(const r of n){const s=e[r];if(t[r]===void 0&&Rl(s)){const o=s.ast,i=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;i!==void 0&&(t[r]=i())}}return t},By=(e,t,n=OR(e,t))=>{var r;return r=class extends he(n){static annotations(o){return By(this.fields,this.records,tn(this.ast,o))}static pick(...o){return vt(oR(e,...o))}static omit(...o){return vt(iR(e,...o))}},u(r,"fields",{...e}),u(r,"records",[...t]),u(r,"make",(o,i)=>{const c=Uy(e,{...o});return Fl(i)?c:Il(r)(c)}),r};function vt(e,...t){return By(e,t)}const ER=e=>he(qr(e.ast)),rn=(e,t,n)=>{if(bf(e)&&bf(t)){const r=[...e.propertySignatures];for(const s of t.propertySignatures){const o=s.name,i=r.findIndex(c=>c.name===o);if(i===-1)r.push(s);else{const{isOptional:c,type:a}=r[i];r[i]=new Oe(o,ns(a,s.type,n.concat(o)),c,!0)}}return new At(r,e.indexSignatures.concat(t.indexSignatures))}throw new Error(Om(e,t,n))},TR=K0([Tu]),Dn=(e,t)=>t.map(n=>new Ru(n,e.filter,TR(e))),ns=(e,t,n)=>Fe.make(mt([e],[t],n)),Kt=e=>Mu(e)?e.types:[e],mt=(e,t,n)=>Ko(e,r=>Ko(t,s=>{switch(s._tag){case"Literal":{if(Be(s.literal)&&ta(r)||bt(s.literal)&&mf(r)||Xn(s.literal)&&_f(r))return[s];break}case"StringKeyword":{if(s===ea){if(ta(r)||Xr(r)&&Be(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===ea)return[s];break}case"NumberKeyword":{if(s===na){if(mf(r)||Xr(r)&&bt(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===na)return[s];break}case"BooleanKeyword":{if(s===gf){if(_f(r)||Xr(r)&&Xn(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===gf)return[s];break}case"Union":return mt(Kt(r),s.types,n);case"Suspend":return[new Vn(()=>ns(r,s.f(),n))];case"Refinement":return Dn(s,mt(Kt(r),Kt(s.from),n));case"TypeLiteral":{switch(r._tag){case"Union":return mt(r.types,[s],n);case"Suspend":return[new Vn(()=>ns(r.f(),s,n))];case"Refinement":return Dn(r,mt(Kt(r.from),[s],n));case"TypeLiteral":return[rn(r,s,n)];case"Transformation":{if(bo(r.transformation))return[new Wn(rn(r.from,s,n),rn(r.to,ae(s),n),new yo(r.transformation.propertySignatureTransformations))];break}}break}case"Transformation":{if(bo(s.transformation))switch(r._tag){case"Union":return mt(r.types,[s],n);case"Suspend":return[new Vn(()=>ns(r.f(),s,n))];case"Refinement":return Dn(r,mt(Kt(r.from),[s],n));case"TypeLiteral":return[new Wn(rn(r,s.from,n),rn(ae(r),s.to,n),new yo(s.transformation.propertySignatureTransformations))];case"Transformation":if(bo(r.transformation))return[new Wn(rn(r.from,s.from,n),rn(r.to,s.to,n),new yo(s.transformation.propertySignatureTransformations.concat(r.transformation.propertySignatureTransformations)))];break}break}}throw new Error(Om(r,s,n))})),xR=h(2,(e,t)=>he(ns(e.ast,t.ast,[]))),qy=Symbol.for("effect/SchemaId/Refine"),Jy=(e,t,n)=>{var r,s,o;return o=class extends(s=he(n),r=qy,s){static annotations(c){return Jy(this.from,this.filter,tn(this.ast,c))}},u(o,r,e),u(o,"from",e),u(o,"filter",t),u(o,"make",(c,a)=>Fl(a)?c:Il(o)(c)),o},Rd=(e,t,n)=>{if(Xn(e))return e?I():R(new ot(t,n));if(Be(e))return R(new ot(t,n,e));if(e!==void 0){if("_tag"in e)return R(e);const r=new ot(t,n,e.message);return R(se(e.path)?new xe(e.path,n,r):r)}return I()},$R=(e,t,n)=>{if(Lv(e))return Rd(e,t,n);if(se(e)){const r=Fv(e,s=>Rd(s,t,n));if(se(r))return R(r.length===1?r[0]:new ce(t,n,r))}return I()};function Vy(e,t){return n=>{function r(o,i,c){return $R(e(o,i,c),c,o)}const s=new Ru(n.ast,r,Ar(t));return Jy(n,r,s)}}const Hy=(e,t,n)=>{var r;return r=class extends he(n){static annotations(o){return Hy(this.from,this.to,tn(this.ast,o))}},u(r,"from",e),u(r,"to",t),r},Ha=h(e=>Yt(e[0])&&Yt(e[1]),(e,t,n)=>Hy(e,t,new Wn(e.ast,t.ast,new A0(n.decode,n.encode)))),IR=h(e=>Yt(e[0])&&Yt(e[1]),(e,t,n)=>Ha(e,t,{strict:!0,decode:(r,s,o,i)=>_s(n.decode(r,i)),encode:(r,s,o,i)=>_s(n.encode(r,i))})),AR=Jv,MR=(e,t)=>n=>n.pipe(Vy(r=>r.length>=e,{schemaId:AR,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Cd=Symbol.for("effect/SchemaId/Pattern"),Wy=(e,t)=>n=>{const r=e.source;return n.pipe(Vy(s=>(e.lastIndex=0,e.test(s)),{schemaId:Cd,[Cd]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},RR=e=>MR(1,{title:"nonEmptyString",description:"a non empty string",...e});class W extends hR.pipe(RR({identifier:"NonEmptyString"})){}const CR=e=>Yt(e)||Rl(e),Gy=e=>It(e).every(t=>CR(e[t])),Nl=e=>"fields"in e?e.fields:Nl(e[qy]),zy=e=>Gy(e)?vt(e):Yt(e)?e:vt(Nl(e)),Yy=e=>Gy(e)?e:Nl(e),Gs=e=>(t,n)=>$o({kind:"Class",identifier:e,schema:zy(t),fields:Yy(t),Base:r1,annotations:n}),Ic=(e,t)=>{const n={...e};for(const r of It(t)){if(r in e)throw new Error(Em(r));n[r]=t[r]}return n},Fl=e=>Xn(e)?e:(e==null?void 0:e.disableValidation)??!1,Nd=J("effect/Schema/astCache",()=>new WeakMap),NR=e=>e===void 0?[]:Array.isArray(e)?e:[e],$o=({Base:e,annotations:t,disableToString:n,fields:r,identifier:s,kind:o,schema:i})=>{var w,T;const c=Symbol.for(`effect/Schema/${o}/${s}`),[a,l,f]=NR(t),d=Md(i),p=d.annotations({identifier:s,...a}),m=d.annotations({[Jn]:`${s} (Type side)`,...a}),_=i.annotations({[Jn]:`${s} (Constructor)`,...a}),k=i.annotations({[Jn]:`${s} (Encoded side)`,...f}),g=i.annotations({[xu]:s,...f,...a,...l}),b=v=>j(v,c)&&B1(m)(v),S=(T=class extends e{constructor(v={},E=!1){v={...v},o!=="Class"&&delete v._tag,v=Uy(r,v),Fl(E)||(v=Il(_)(v)),super(v,!0)}static get ast(){let v=Nd.get(this);if(v)return v;const E=fR([m],{decode:()=>(O,x,M)=>O instanceof this||b(O)?_s(O):ky(new ot(M,O)),encode:()=>(O,x)=>O instanceof this?_s(O):Oy(U1(m)(O,x),M=>new this(M,!0))},{identifier:s,pretty:O=>x=>`${s}(${O(x)})`,arbitrary:O=>x=>O(x).map(M=>new this(M)),equivalence:te,[Uo]:p.ast,...a});return v=IR(k,E,{strict:!0,decode:O=>new this(O,!0),encode:te}).annotations({[Uo]:g.ast,...l}).ast,Nd.set(this,v),v}static pipe(){return N(this,arguments)}static annotations(v){return he(this.ast).annotations(v)}static toString(){return`(${String(k)} <-> ${s})`}static make(...v){return new this(...v)}static extend(v){return(E,O)=>{const x=Yy(E),M=zy(E),B=Ic(r,x);return $o({kind:o,identifier:v,schema:xR(i,M),fields:B,Base:this,annotations:O})}}static transformOrFail(v){return(E,O,x)=>{const M=Ic(r,E);return $o({kind:o,identifier:v,schema:Ha(i,Md(vt(M)),O),fields:M,Base:this,annotations:x})}}static transformOrFailFrom(v){return(E,O,x)=>{const M=Ic(r,E);return $o({kind:o,identifier:v,schema:Ha(cR(i),vt(M),O),fields:M,Base:this,annotations:x})}}get[(w=gr,c)](){return c}},u(T,w,qa),u(T,"fields",{...r}),u(T,"identifier",s),T);return n!==!0&&Object.defineProperty(S.prototype,"toString",{value(){return`${s}({ ${It(r).map(v=>`${wm(v)}: ${St(this[v])}`).join(", ")} })`},configurable:!0}),S};var Zy,Ee,Qy,FR=[];function PR(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?Zy.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return jR(e,i,r,s,null)}function jR(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Qy,__i:-1,__u:0};return s==null&&Ee.vnode!=null&&Ee.vnode(o),o}function Hr(e){return e.children}Zy=FR.slice,Ee={__e:function(e,t,n,r){for(var s,o,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),i=s.__d),i)return s.__E=s}catch(c){e=c}throw e}},Qy=0,typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var Fd=/[\s\n\\/='"\0<>]/,Pd=/^(xlink|xmlns|xml)([A-Z])/,LR=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,KR=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,DR=new Set(["draggable","spellcheck"]),UR=/["&<]/;function lo(e){if(e.length===0||UR.test(e)===!1)return e;for(var t=0,n=0,r="",s="";n";S=g.children}else{if((b=k.contextType)!=null){var x=t[b.__c];T=x?x.props.value:b.__}var M=k.prototype&&typeof k.prototype.render=="function";if(M)S=Dd(e,T),w=e.__c;else{e.__c=w=VR(e,T);for(var B=0;w.__d&&B++<25;)w.__d=!1,ys&&ys(e),S=k.call(w,g,T);w.__d=!0}if(w.getChildContext!=null&&(t=Ga({},t,w.getChildContext())),M&&Ee.errorBoundaries&&(k.getDerivedStateFromError||w.componentDidCatch)){S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S;try{return Dt(S,t,n,r,e,o,i)}catch(Fn){return k.getDerivedStateFromError&&(w.__s=k.getDerivedStateFromError(Fn)),w.componentDidCatch&&w.componentDidCatch(Fn,Pl),w.__d?(S=Dd(e,t),(w=e.__c).getChildContext!=null&&(t=Ga({},t,w.getChildContext())),Dt(S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S,t,n,r,e,o,i)):Ae}finally{an&&an(e),Wr&&Wr(e)}}}S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S;try{var U=Dt(S,t,n,r,e,o,i);return an&&an(e),Ee.unmount&&Ee.unmount(e),U}catch(Fn){if(i&&i.onError){var G=i.onError(Fn,e,function(eb,tb){return Dt(eb,t,n,r,tb,o,i)});if(G!==void 0)return G;var ie=Ee.__e;return ie&&ie(Fn,e),Ae}throw Fn}}var X,me="<"+k,Y=Ae;for(var C in g){var H=g[C];if(typeof H!="function"||C==="class"||C==="className"){switch(C){case"children":X=H;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in g)continue;C="for";break;case"className":if("class"in g)continue;C="class";break;case"defaultChecked":C="checked";break;case"defaultSelected":C="selected";break;case"defaultValue":case"value":switch(C="value",k){case"textarea":X=H;continue;case"select":r=H;continue;case"option":r!=H||"selected"in g||(me+=" selected")}break;case"dangerouslySetInnerHTML":Y=H&&H.__html;continue;case"style":typeof H=="object"&&(H=JR(H));break;case"acceptCharset":C="accept-charset";break;case"httpEquiv":C="http-equiv";break;default:if(Pd.test(C))C=C.replace(Pd,"$1:$2").toLowerCase();else{if(Fd.test(C))continue;C[4]!=="-"&&!DR.has(C)||H==null?n?KR.test(C)&&(C=C==="panose1"?"panose-1":C.replace(/([A-Z])/g,"-$1").toLowerCase()):LR.test(C)&&(C=C.toLowerCase()):H+=Ae}}H!=null&&H!==!1&&(me=H===!0||H===Ae?me+" "+C:me+" "+C+'="'+(typeof H=="string"?lo(H):H+Ae)+'"')}}if(Fd.test(k))throw new Error(k+" is not a valid HTML tag name in "+me+">");if(Y||(typeof X=="string"?Y=lo(X):X!=null&&X!==!1&&X!==!0&&(Y=Dt(X,t,k==="svg"||k!=="foreignObject"&&n,r,e,o,i))),an&&an(e),Wr&&Wr(e),!Y&&WR.has(k))return me+"/>";var tt="",He=me+">";return Gr(Y)?[He].concat(Y,[tt]):typeof Y!="string"?[He,Y,tt]:He+Y+tt}var WR=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),GR=HR;const Xy=/https:\/\//;class zR extends Gs("ProjectTechnology")({id:W,name:W,category:Cy("programming language","framework","cloud computing","database","devops tool","testing","collaboration tool","frontend","other"),version:W.pipe(Mn),url:W.pipe(Mn)}){}class YR extends Gs("ProjectDetails")({order:pR,client:vt({name:W,description:W}).pipe(Mn),title:W,stack:W.pipe(yt),tools:W.pipe(yt),roles:W.pipe(yt),achivements:vt({technical:W,human:W.pipe(Mn)}).pipe(yt)}){}class ZR extends Gs("EmploymentRecord")({position:W,workType:Cy("hybrid","on-site","remote"),companyName:W,companyDescription:W,website:W.pipe(Wy(Xy)),start:W,end:W,location:vt({city:W,country:W,timezone:W}).pipe(ER),projects:YR.pipe(yt)}){}class QR extends Gs("Me")({name:W,expertise:W.pipe(yt),location:W.pipe(Mn),phone:W.pipe(Mn),email:W,profiles:vt({url:W.pipe(Wy(Xy)),icon:W}).pipe(yt),expertSummary:W.pipe(yt)}){}class XR extends Gs("ResumeObject")({$schema:W.pipe(Mn),me:QR,technologies:zR.pipe(yt),employmentHistory:ZR.pipe(yt)}){}var eC=0;function $(e,t,n,r,s,o){t||(t={});var i,c,a=t;if("ref"in a)for(c in a={},t)c=="ref"?i=t[c]:a[c]=t[c];var l={type:e,props:a,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eC,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)a[c]===void 0&&(a[c]=i[c]);return Ee.vnode&&Ee.vnode(l),l}function tC(e){return $("div",{id:"resume",children:[iC(e),$("div",{className:"section-header",children:$("span",{id:"label",children:"Summary"})}),$("div",{id:"summary",children:e.me.expertSummary.map(t=>$("p",{dangerouslySetInnerHTML:{__html:t}}))}),$("div",{className:"section-header",children:$("span",{id:"label",children:"Skills"})}),$("div",{id:"skills",children:Object.entries(lC(e)).map(([t,n])=>$("div",{className:"skill-group",children:[$("span",{children:t}),$("div",{className:"group-list",children:n.map(r=>$("span",{className:"stack-item",children:r.technology.name}))})]}))}),$("div",{className:"section-header",children:$("span",{id:"label",children:"Employment"})}),$("div",{id:"employment",children:aC(e)})]})}function nC(e){var t;return $("span",{children:["Software Engineer. ",$("span",{id:"expertise",children:["Expertise: ",(t=e.me)==null?void 0:t.expertise.join("/")]})]})}function rC(e){return $("span",{children:[e.position," · ",e.location.city,", ",e.location.country," · ",e.workType]})}function sC(e){return $("span",{children:[$("a",{className:"companyLink",href:e.website,children:e.companyName})," · ",e.companyDescription]})}function oC(e){return $("span",{children:e.stack.map(t=>$("span",{className:"stack-item",children:t}))})}function iC(e){var t;return $("div",{id:"head",children:[$("div",{id:"name",children:e.me.name}),$("div",{id:"role",children:nC(e)}),$("div",{id:"location",children:(t=e.me)==null?void 0:t.location}),$("div",{id:"contact",children:[$("div",{id:"email",children:[$("span",{className:"fa-regular fa-envelope"}),$("a",{href:`mailto:${e.me.email}`,children:[" ",e.me.email]})]}),$("div",{id:"phone",children:[$("span",{className:"fa-solid fa-mobile-screen-button"}),$("a",{href:`tel:${e.me.phone}`,children:[" ",e.me.phone]})]})]}),$("div",{id:"profiles",children:e.me.profiles.map(n=>{const r=`fa-${n.icon.split(" ").at(0)}`;return $("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",children:$("span",{className:`fa-brands fa-lg ${r}`,style:{color:n.icon.split(" ").at(1)}})})})})]})}function cC(e){return $("div",{className:"project",children:[$("div",{style:{display:"flex"},children:[$("div",{style:{marginBottom:"3px"},children:[$("b",{children:"Project: "}),$("span",{children:e.title})]}),$("div",{style:{marginLeft:"auto"},children:[$("b",{children:"Roles: "}),$("span",{children:e.roles.join("/")})]})]}),$("span",{style:{display:"block"},children:[$("b",{children:"Stack: "}),oC(e)]}),$("ul",{children:e.achivements.map(t=>$("div",{children:$("li",{children:t.human??t.technical})}))})]})}function aC(e){return $("div",{id:"employment",children:e.employmentHistory.map(t=>$("div",{className:"company",children:[$("div",{style:{display:"flex"},children:[$("span",{children:sC(t)}),$("span",{style:{marginLeft:"auto"},children:uC(t)})]}),$("span",{style:{display:"block",marginBottom:"5px"},children:rC(t)}),t.projects.map(cC),$("hr",{})]}))})}function uC(e){const t=Od(e.start),n=Od(e.end),r=N1(t,n),s=365.25*24*60*60*1e3,o=s/12;let i=Math.floor(r/s),c=Math.ceil(r%s/o);c===12&&(i=i+1,c=0);const a=Ed(t,{month:"short",year:"numeric"}),l=Ed(n,{month:"short",year:"numeric"});let f=`${c} mos`;return i&&(f=`${i} yr ${f}`),$("span",{children:[a," - ",l," · ",f]})}function lC(e){var r;const t=(r=e.employmentHistory)==null?void 0:r.flatMap(s=>s.projects.flatMap(o=>[...o.stack,...o.tools].flatMap(i=>{var a;const c=(a=e.technologies)==null?void 0:a.find(l=>l.id==i);return c?[{code:i,category:c.category,technology:c}]:[]})));return t?y(t,Ou((s,o)=>s.code==o.code),Rv(s=>s.technology.category)):(console.warn("Skill categories not found"),{})}const Ac=e=>{try{return GR(tC(e))}catch(t){return console.log("render error",t),""}},fC=async()=>{const e=await fetch("/john-doe.json").then(n=>n.json());return console.log({resume:e}),D1(XR)(e)},dC=e=>{if(e)try{return JSON.parse(e)}catch{}},hC=e=>fetch(e).then(t=>t.text()),pC=()=>{if(!("monaco_loader"in window)||typeof window.monaco_loader!="object"||window.monaco_loader==null){console.warn("monaco loader is not available");return}return window.monaco_loader},mC=()=>{const e=pC();if(e)return e.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@latest/min/vs"}}),e.init()},gC=async(e,t)=>{const n=document.getElementById("code-editor");if(!n){console.warn("code-editor node not found");return}return e.editor.create(n,{model:t,contextmenu:!1,minimap:{enabled:!1}})},_C=async e=>{const t=await hC("./john-doe.json");return{model:e.editor.createModel(t,"json")}},yC=(e,t,n)=>{const s=e.editor.getModelMarkers({resource:t.uri}).find(o=>n.has(o.severity.valueOf()));return s?(console.log("editor code error",s),!0):!1},bC=async()=>{const e=await mC();if(!e)return;const t=await _C(e);if(await gC(e,t.model))return{monaco:e,textModel:t}};window.Alpine=ss;SC();ss.data("sections",()=>({sections:[{id:"all",label:"All"},{id:"me",label:"Me"},{id:"employmentHistory",label:"My Employment"},{id:"technologies",label:"Tecnologies"}]}));ss.start();async function SC(){const e=ss.reactive({resumeObject:{},resumeHtml:"

My Resume

",editorSection:"me",mode:"editor",editorHasError:!1});ss.store("state",e);const t=await bC(),n=await fetch("/resume-schema.json").then(i=>i.json());if(!t){console.warn("can not load editor");return}const r=i=>t.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"resume.json",fileMatch:["*"],schema:{...n,$ref:i}}]}),s=()=>{e.editorSection=="all"?(delete e.resumeObject.$schema,t.textModel.model.setValue(JSON.stringify(e.resumeObject,void 0,2)),r("#/$defs/ResumeObject")):(t.textModel.model.setValue(JSON.stringify(e.resumeObject[e.editorSection],void 0,2)),r(`#/$defs/ResumeObject/properties/${e.editorSection}`))};t.textModel.model.onDidChangeContent(()=>{const i=dC(t.textModel.model.getValue());console.log("parsed",i),i&&(e.editorSection=="all"?e.resumeObject=i:e.resumeObject[e.editorSection]=i,e.resumeHtml=Ac(e.resumeObject))}),document.addEventListener("section-changed",()=>{s()});const o=await fC();t.monaco.editor.onDidChangeMarkers(()=>{const i=yC(t.monaco,t.textModel.model,new Set([4,8]));console.log("markers changed",{hasErrors:i}),e.editorHasError=i,i||(e.resumeHtml=Ac(e.resumeObject))}),e.resumeObject=o,e.resumeHtml=Ac(o),s()} +`,e.forest),$y=(e,t)=>{let n="";const r=t.length;let s;for(let o=0;o1&&!i?"│ ":" "),s.forest)}return n},Y1=e=>{switch(e){case"Encoded":return"Encoded side transformation failure";case"Transformation":return"Transformation process failure";case"Type":return"Type side transformation failure"}},Z1=e=>{switch(e){case"From":return"From side refinement failure";case"Predicate":return"Predicate refinement failure"}},Iy=e=>"ast"in e?R(e.ast):I(),Q1=e=>Iy(e).pipe(ki(n0),De(t=>{const n=t(e);return Be(n)?Nt({message:n,override:!1}):A1(n)?st(n,r=>({message:r,override:!1})):Be(n.message)?Nt({message:n.message,override:n.override}):st(n.message,r=>({message:r,override:n.override}))})),Al=e=>t=>t._tag===e,Ay=Al("Composite"),$d=Al("Refinement"),Id=Al("Transformation"),Ml=e=>Q1(e).pipe(De(t=>!t.override&&(Ay(e)||$d(e)&&e.kind==="From"||Id(e)&&e.kind!=="Transformation")?Id(e)||$d(e)?Ml(e.issue):I():Nt(t.message))),My=e=>Iy(e).pipe(ki(i0),uv(t=>vi(t(e))));function X1(e){return Nm(e).pipe(Jt(()=>Rm(e)),Jt(()=>Cm(e)),Jt(()=>Ei(e)),we(()=>`{ ${e.from} | filter }`))}function eR(e){return e.message!==void 0?e.message:`Expected ${Hn(e.ast)?X1(e.ast):String(e.ast)}, actual ${St(e.actual)}`}const tR=e=>Ml(e).pipe(C1(()=>My(e)),$l(()=>Nt(eR(e)))),uo=e=>we(My(e),()=>String(e.ast)),nR=e=>e.message??"is forbidden",rR=e=>e.message??"is unexpected",sR=e=>r0(e.ast).pipe(De(t=>{const n=t();return Be(n)?Nt(n):n}),$l(()=>Nt(e.message??"is missing"))),$c=(e,t)=>R1(Ml(e),{onFailure:t,onSuccess:n=>Nt(Ke(n))}),Un=e=>{switch(e._tag){case"Type":return st(tR(e),Ke);case"Forbidden":return Nt(Ke(uo(e),[Ke(nR(e))]));case"Unexpected":return Nt(Ke(rR(e)));case"Missing":return st(sR(e),Ke);case"Transformation":return $c(e,()=>st(Un(e.issue),t=>Ke(uo(e),[Ke(Y1(e.kind),[t])])));case"Refinement":return $c(e,()=>st(Un(e.issue),t=>Ke(uo(e),[Ke(Z1(e.kind),[t])])));case"Pointer":return st(Un(e.issue),t=>Ke(km(e.path),[t]));case"Composite":{const t=uo(e);return $c(e,()=>vm(e.issues)?st(To(e.issues,Un),n=>Ke(t,n)):st(Un(e.issues),n=>Ke(t,[n])))}}},oR=h(e=>Qt(e[0]),(e,...t)=>{const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}),iR=h(e=>Qt(e[0]),(e,...t)=>{const n={...e};for(const r of t)delete n[r];return n}),gr=Symbol.for("effect/Schema"),he=e=>{var t,n,r;return n=gr,t=gr,r=class{constructor(){u(this,n,qa)}static annotations(o){return he(tn(this.ast,o))}static pipe(){return N(this,arguments)}static toString(){return String(e)}},u(r,"ast",e),u(r,"Type"),u(r,"Encoded"),u(r,"Context"),u(r,t,qa),r},qa={_A:e=>e,_I:e=>e,_R:e=>e},Ad={schemaId:Hv,message:Tm,missingMessage:Eu,identifier:Tu,title:Pt,description:Is,examples:Wv,default:Gv,documentation:Xv,jsonSchema:zv,arbitrary:Yv,pretty:Zv,equivalence:Qv,concurrency:xm,batching:$m,parseIssueTitle:Im,parseOptions:Am,decodingFallback:Mm},Ar=e=>{if(!e)return{};const t={...e};for(const n in Ad)if(n in e){const r=Ad[n];t[r]=e[n],delete t[n]}return t},tn=(e,t)=>cs(e,Ar(t)),cR=e=>he(ra(e.ast)),Md=e=>he(ae(e.ast)),Yt=e=>j(e,gr)&&Qt(e[gr]),aR=e=>Au(e)?Fe.make(I0(e,t=>new Xc(t))):new Xc(e[0]),Ry=(e,t=aR(e))=>{var n;return n=class extends he(t){static annotations(s){return Ry(this.literals,tn(this.ast,s))}},u(n,"literals",[...e]),n};function Cy(...e){return se(e)?Ry(e):Ny}const uR=(e,t,n)=>he(new Ti(e.map(r=>r.ast),(...r)=>t.decode(...r.map(he)),(...r)=>t.encode(...r.map(he)),Ar(n))),lR=(e,t)=>{const n=()=>(s,o,i)=>e(s)?_s(s):ky(new ot(i,s)),r=n;return he(new Ti([],n,r,Ar(t)))},fR=function(){if(Array.isArray(arguments[0])){const n=arguments[0],r=arguments[1],s=arguments[2];return uR(n,r,s)}const e=arguments[0],t=arguments[1];return lR(e,t)};class dR extends he(is){}class Ny extends he($u){}class hR extends he(ea){}class pR extends he(na){}const mR=e=>Fe.make(e.map(t=>t.ast)),Fy=(e,t=mR(e))=>{var n;return n=class extends he(t){static annotations(s){return Fy(this.members,tn(this.ast,s))}},u(n,"members",[...e]),n};function gR(...e){return Au(e)?Fy(e):se(e)?e[0]:Ny}const _R=e=>gR(e,dR),yR=(e,t)=>new xi(e.map(n=>Yt(n)?new en(n.ast,!1):n.ast),t.map(n=>Yt(n)?new As(n.ast):n.ast),!0),Py=(e,t,n=yR(e,t))=>{var r;return r=class extends he(n){static annotations(o){return Py(this.elements,this.rest,tn(this.ast,o))}},u(r,"elements",[...e]),u(r,"rest",[...t]),r},jy=(e,t)=>{var n;return n=class extends Py([e],[e],t){static annotations(s){return jy(this.value,tn(this.ast,s))}},u(n,"value",e),n},yt=e=>jy(e),Ja=e=>e?'"?:"':'":"';class Ly extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"defaultValue");u(this,"_tag","PropertySignatureDeclaration");this.isReadonly=s,this.defaultValue=i}toString(){const n=Ja(this.isOptional),r=String(this.type);return`PropertySignature<${n}, ${r}, never, ${n}, ${r}>`}}class bR extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"fromKey");this.isReadonly=s,this.fromKey=i}}class SR extends en{constructor(n,r,s,o,i){super(n,r,o);u(this,"isReadonly");u(this,"defaultValue");this.isReadonly=s,this.defaultValue=i}}const wR=e=>e===void 0?"never":Be(e)?JSON.stringify(e):String(e);class vR{constructor(t,n,r,s){u(this,"from");u(this,"to");u(this,"decode");u(this,"encode");u(this,"_tag","PropertySignatureTransformation");this.from=t,this.to=n,this.decode=r,this.encode=s}toString(){return`PropertySignature<${Ja(this.to.isOptional)}, ${this.to.type}, ${wR(this.from.fromKey)}, ${Ja(this.from.isOptional)}, ${this.from.type}>`}}const Ky=(e,t)=>{switch(e._tag){case"PropertySignatureDeclaration":return new Ly(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case"PropertySignatureTransformation":return new vR(new bR(e.from.type,e.from.isOptional,e.from.isReadonly,e.from.annotations),new SR(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},Dy=Symbol.for("effect/PropertySignature"),Rl=e=>j(e,Dy);var Ah,Mh;Mh=gr,Ah=Dy;const Kl=class Kl{constructor(t){u(this,"ast");u(this,Mh);u(this,Ah,null);u(this,"_TypeToken");u(this,"_Key");u(this,"_EncodedToken");u(this,"_HasDefault");this.ast=t}pipe(){return N(this,arguments)}annotations(t){return new Kl(Ky(this.ast,Ar(t)))}toString(){return String(this.ast)}};let Va=Kl;class Cl extends Va{constructor(n,r){super(n);u(this,"from");this.from=r}annotations(n){return new Cl(Ky(this.ast,Ar(n)),this.from)}}const Mn=e=>{const t=e.ast===is||e.ast===$u?is:_R(e).ast;return new Cl(new Ly(t,!0,!0,{},void 0),e)},kR=L0([Eu]),OR=(e,t)=>{const n=It(e),r=[];if(n.length>0){const o=[],i=[],c=[];for(let a=0;a{o.push(m),i.push(new Oe(m.name,ae(m.type),m.isOptional,m.isReadonly,m.annotations))}),d.forEach(m=>{a.push(m),l.push(new Ms(m.parameter,ae(m.type),m.isReadonly))})}return new Wn(new At(o,a,{[Jn]:"Struct (Encoded side)"}),new At(i,l,{[Jn]:"Struct (Type side)"}),new yo(c))}}const s=[];for(const o of t){const{indexSignatures:i,propertySignatures:c}=Sf(o.key.ast,o.value.ast);c.forEach(a=>r.push(a)),i.forEach(a=>s.push(a))}return new At(r,s)},Uy=(e,t)=>{const n=It(e);for(const r of n){const s=e[r];if(t[r]===void 0&&Rl(s)){const o=s.ast,i=o._tag==="PropertySignatureDeclaration"?o.defaultValue:o.to.defaultValue;i!==void 0&&(t[r]=i())}}return t},By=(e,t,n=OR(e,t))=>{var r;return r=class extends he(n){static annotations(o){return By(this.fields,this.records,tn(this.ast,o))}static pick(...o){return vt(oR(e,...o))}static omit(...o){return vt(iR(e,...o))}},u(r,"fields",{...e}),u(r,"records",[...t]),u(r,"make",(o,i)=>{const c=Uy(e,{...o});return Fl(i)?c:Il(r)(c)}),r};function vt(e,...t){return By(e,t)}const ER=e=>he(qr(e.ast)),rn=(e,t,n)=>{if(bf(e)&&bf(t)){const r=[...e.propertySignatures];for(const s of t.propertySignatures){const o=s.name,i=r.findIndex(c=>c.name===o);if(i===-1)r.push(s);else{const{isOptional:c,type:a}=r[i];r[i]=new Oe(o,ns(a,s.type,n.concat(o)),c,!0)}}return new At(r,e.indexSignatures.concat(t.indexSignatures))}throw new Error(Om(e,t,n))},TR=K0([Tu]),Dn=(e,t)=>t.map(n=>new Ru(n,e.filter,TR(e))),ns=(e,t,n)=>Fe.make(mt([e],[t],n)),Kt=e=>Mu(e)?e.types:[e],mt=(e,t,n)=>Ko(e,r=>Ko(t,s=>{switch(s._tag){case"Literal":{if(Be(s.literal)&&ta(r)||bt(s.literal)&&mf(r)||Xn(s.literal)&&_f(r))return[s];break}case"StringKeyword":{if(s===ea){if(ta(r)||Xr(r)&&Be(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===ea)return[s];break}case"NumberKeyword":{if(s===na){if(mf(r)||Xr(r)&&bt(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===na)return[s];break}case"BooleanKeyword":{if(s===gf){if(_f(r)||Xr(r)&&Xn(r.literal))return[r];if(Hn(r))return Dn(r,mt(Kt(r.from),[s],n))}else if(r===gf)return[s];break}case"Union":return mt(Kt(r),s.types,n);case"Suspend":return[new Vn(()=>ns(r,s.f(),n))];case"Refinement":return Dn(s,mt(Kt(r),Kt(s.from),n));case"TypeLiteral":{switch(r._tag){case"Union":return mt(r.types,[s],n);case"Suspend":return[new Vn(()=>ns(r.f(),s,n))];case"Refinement":return Dn(r,mt(Kt(r.from),[s],n));case"TypeLiteral":return[rn(r,s,n)];case"Transformation":{if(bo(r.transformation))return[new Wn(rn(r.from,s,n),rn(r.to,ae(s),n),new yo(r.transformation.propertySignatureTransformations))];break}}break}case"Transformation":{if(bo(s.transformation))switch(r._tag){case"Union":return mt(r.types,[s],n);case"Suspend":return[new Vn(()=>ns(r.f(),s,n))];case"Refinement":return Dn(r,mt(Kt(r.from),[s],n));case"TypeLiteral":return[new Wn(rn(r,s.from,n),rn(ae(r),s.to,n),new yo(s.transformation.propertySignatureTransformations))];case"Transformation":if(bo(r.transformation))return[new Wn(rn(r.from,s.from,n),rn(r.to,s.to,n),new yo(s.transformation.propertySignatureTransformations.concat(r.transformation.propertySignatureTransformations)))];break}break}}throw new Error(Om(r,s,n))})),xR=h(2,(e,t)=>he(ns(e.ast,t.ast,[]))),qy=Symbol.for("effect/SchemaId/Refine"),Jy=(e,t,n)=>{var r,s,o;return o=class extends(s=he(n),r=qy,s){static annotations(c){return Jy(this.from,this.filter,tn(this.ast,c))}},u(o,r,e),u(o,"from",e),u(o,"filter",t),u(o,"make",(c,a)=>Fl(a)?c:Il(o)(c)),o},Rd=(e,t,n)=>{if(Xn(e))return e?I():R(new ot(t,n));if(Be(e))return R(new ot(t,n,e));if(e!==void 0){if("_tag"in e)return R(e);const r=new ot(t,n,e.message);return R(se(e.path)?new xe(e.path,n,r):r)}return I()},$R=(e,t,n)=>{if(Lv(e))return Rd(e,t,n);if(se(e)){const r=Fv(e,s=>Rd(s,t,n));if(se(r))return R(r.length===1?r[0]:new ce(t,n,r))}return I()};function Vy(e,t){return n=>{function r(o,i,c){return $R(e(o,i,c),c,o)}const s=new Ru(n.ast,r,Ar(t));return Jy(n,r,s)}}const Hy=(e,t,n)=>{var r;return r=class extends he(n){static annotations(o){return Hy(this.from,this.to,tn(this.ast,o))}},u(r,"from",e),u(r,"to",t),r},Ha=h(e=>Yt(e[0])&&Yt(e[1]),(e,t,n)=>Hy(e,t,new Wn(e.ast,t.ast,new A0(n.decode,n.encode)))),IR=h(e=>Yt(e[0])&&Yt(e[1]),(e,t,n)=>Ha(e,t,{strict:!0,decode:(r,s,o,i)=>_s(n.decode(r,i)),encode:(r,s,o,i)=>_s(n.encode(r,i))})),AR=Jv,MR=(e,t)=>n=>n.pipe(Vy(r=>r.length>=e,{schemaId:AR,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),Cd=Symbol.for("effect/SchemaId/Pattern"),Wy=(e,t)=>n=>{const r=e.source;return n.pipe(Vy(s=>(e.lastIndex=0,e.test(s)),{schemaId:Cd,[Cd]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},RR=e=>MR(1,{title:"nonEmptyString",description:"a non empty string",...e});class W extends hR.pipe(RR({identifier:"NonEmptyString"})){}const CR=e=>Yt(e)||Rl(e),Gy=e=>It(e).every(t=>CR(e[t])),Nl=e=>"fields"in e?e.fields:Nl(e[qy]),zy=e=>Gy(e)?vt(e):Yt(e)?e:vt(Nl(e)),Yy=e=>Gy(e)?e:Nl(e),Gs=e=>(t,n)=>$o({kind:"Class",identifier:e,schema:zy(t),fields:Yy(t),Base:r1,annotations:n}),Ic=(e,t)=>{const n={...e};for(const r of It(t)){if(r in e)throw new Error(Em(r));n[r]=t[r]}return n},Fl=e=>Xn(e)?e:(e==null?void 0:e.disableValidation)??!1,Nd=J("effect/Schema/astCache",()=>new WeakMap),NR=e=>e===void 0?[]:Array.isArray(e)?e:[e],$o=({Base:e,annotations:t,disableToString:n,fields:r,identifier:s,kind:o,schema:i})=>{var w,T;const c=Symbol.for(`effect/Schema/${o}/${s}`),[a,l,f]=NR(t),d=Md(i),p=d.annotations({identifier:s,...a}),m=d.annotations({[Jn]:`${s} (Type side)`,...a}),_=i.annotations({[Jn]:`${s} (Constructor)`,...a}),k=i.annotations({[Jn]:`${s} (Encoded side)`,...f}),g=i.annotations({[xu]:s,...f,...a,...l}),b=v=>j(v,c)&&B1(m)(v),S=(T=class extends e{constructor(v={},E=!1){v={...v},o!=="Class"&&delete v._tag,v=Uy(r,v),Fl(E)||(v=Il(_)(v)),super(v,!0)}static get ast(){let v=Nd.get(this);if(v)return v;const E=fR([m],{decode:()=>(O,x,M)=>O instanceof this||b(O)?_s(O):ky(new ot(M,O)),encode:()=>(O,x)=>O instanceof this?_s(O):Oy(U1(m)(O,x),M=>new this(M,!0))},{identifier:s,pretty:O=>x=>`${s}(${O(x)})`,arbitrary:O=>x=>O(x).map(M=>new this(M)),equivalence:te,[Uo]:p.ast,...a});return v=IR(k,E,{strict:!0,decode:O=>new this(O,!0),encode:te}).annotations({[Uo]:g.ast,...l}).ast,Nd.set(this,v),v}static pipe(){return N(this,arguments)}static annotations(v){return he(this.ast).annotations(v)}static toString(){return`(${String(k)} <-> ${s})`}static make(...v){return new this(...v)}static extend(v){return(E,O)=>{const x=Yy(E),M=zy(E),B=Ic(r,x);return $o({kind:o,identifier:v,schema:xR(i,M),fields:B,Base:this,annotations:O})}}static transformOrFail(v){return(E,O,x)=>{const M=Ic(r,E);return $o({kind:o,identifier:v,schema:Ha(i,Md(vt(M)),O),fields:M,Base:this,annotations:x})}}static transformOrFailFrom(v){return(E,O,x)=>{const M=Ic(r,E);return $o({kind:o,identifier:v,schema:Ha(cR(i),vt(M),O),fields:M,Base:this,annotations:x})}}get[(w=gr,c)](){return c}},u(T,w,qa),u(T,"fields",{...r}),u(T,"identifier",s),T);return n!==!0&&Object.defineProperty(S.prototype,"toString",{value(){return`${s}({ ${It(r).map(v=>`${wm(v)}: ${St(this[v])}`).join(", ")} })`},configurable:!0}),S};var Zy,Ee,Qy,FR=[];function PR(e,t,n){var r,s,o,i={};for(o in t)o=="key"?r=t[o]:o=="ref"?s=t[o]:i[o]=t[o];if(arguments.length>2&&(i.children=arguments.length>3?Zy.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)i[o]===void 0&&(i[o]=e.defaultProps[o]);return jR(e,i,r,s,null)}function jR(e,t,n,r,s){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Qy,__i:-1,__u:0};return s==null&&Ee.vnode!=null&&Ee.vnode(o),o}function Hr(e){return e.children}Zy=FR.slice,Ee={__e:function(e,t,n,r){for(var s,o,i;t=t.__;)if((s=t.__c)&&!s.__)try{if((o=s.constructor)&&o.getDerivedStateFromError!=null&&(s.setState(o.getDerivedStateFromError(e)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),i=s.__d),i)return s.__E=s}catch(c){e=c}throw e}},Qy=0,typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var Fd=/[\s\n\\/='"\0<>]/,Pd=/^(xlink|xmlns|xml)([A-Z])/,LR=/^(?:accessK|auto[A-Z]|cell|ch|col|cont|cross|dateT|encT|form[A-Z]|frame|hrefL|inputM|maxL|minL|noV|playsI|popoverT|readO|rowS|src[A-Z]|tabI|useM|item[A-Z])/,KR=/^ac|^ali|arabic|basel|cap|clipPath$|clipRule$|color|dominant|enable|fill|flood|font|glyph[^R]|horiz|image|letter|lighting|marker[^WUH]|overline|panose|pointe|paint|rendering|shape|stop|strikethrough|stroke|text[^L]|transform|underline|unicode|units|^v[^i]|^w|^xH/,DR=new Set(["draggable","spellcheck"]),UR=/["&<]/;function lo(e){if(e.length===0||UR.test(e)===!1)return e;for(var t=0,n=0,r="",s="";n";S=g.children}else{if((b=k.contextType)!=null){var x=t[b.__c];T=x?x.props.value:b.__}var M=k.prototype&&typeof k.prototype.render=="function";if(M)S=Dd(e,T),w=e.__c;else{e.__c=w=VR(e,T);for(var B=0;w.__d&&B++<25;)w.__d=!1,ys&&ys(e),S=k.call(w,g,T);w.__d=!0}if(w.getChildContext!=null&&(t=Ga({},t,w.getChildContext())),M&&Ee.errorBoundaries&&(k.getDerivedStateFromError||w.componentDidCatch)){S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S;try{return Dt(S,t,n,r,e,o,i)}catch(Fn){return k.getDerivedStateFromError&&(w.__s=k.getDerivedStateFromError(Fn)),w.componentDidCatch&&w.componentDidCatch(Fn,Pl),w.__d?(S=Dd(e,t),(w=e.__c).getChildContext!=null&&(t=Ga({},t,w.getChildContext())),Dt(S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S,t,n,r,e,o,i)):Ae}finally{an&&an(e),Wr&&Wr(e)}}}S=S!=null&&S.type===Hr&&S.key==null&&S.props.tpl==null?S.props.children:S;try{var U=Dt(S,t,n,r,e,o,i);return an&&an(e),Ee.unmount&&Ee.unmount(e),U}catch(Fn){if(i&&i.onError){var G=i.onError(Fn,e,function(eb,tb){return Dt(eb,t,n,r,tb,o,i)});if(G!==void 0)return G;var ie=Ee.__e;return ie&&ie(Fn,e),Ae}throw Fn}}var X,me="<"+k,Y=Ae;for(var C in g){var H=g[C];if(typeof H!="function"||C==="class"||C==="className"){switch(C){case"children":X=H;continue;case"key":case"ref":case"__self":case"__source":continue;case"htmlFor":if("for"in g)continue;C="for";break;case"className":if("class"in g)continue;C="class";break;case"defaultChecked":C="checked";break;case"defaultSelected":C="selected";break;case"defaultValue":case"value":switch(C="value",k){case"textarea":X=H;continue;case"select":r=H;continue;case"option":r!=H||"selected"in g||(me+=" selected")}break;case"dangerouslySetInnerHTML":Y=H&&H.__html;continue;case"style":typeof H=="object"&&(H=JR(H));break;case"acceptCharset":C="accept-charset";break;case"httpEquiv":C="http-equiv";break;default:if(Pd.test(C))C=C.replace(Pd,"$1:$2").toLowerCase();else{if(Fd.test(C))continue;C[4]!=="-"&&!DR.has(C)||H==null?n?KR.test(C)&&(C=C==="panose1"?"panose-1":C.replace(/([A-Z])/g,"-$1").toLowerCase()):LR.test(C)&&(C=C.toLowerCase()):H+=Ae}}H!=null&&H!==!1&&(me=H===!0||H===Ae?me+" "+C:me+" "+C+'="'+(typeof H=="string"?lo(H):H+Ae)+'"')}}if(Fd.test(k))throw new Error(k+" is not a valid HTML tag name in "+me+">");if(Y||(typeof X=="string"?Y=lo(X):X!=null&&X!==!1&&X!==!0&&(Y=Dt(X,t,k==="svg"||k!=="foreignObject"&&n,r,e,o,i))),an&&an(e),Wr&&Wr(e),!Y&&WR.has(k))return me+"/>";var tt="",He=me+">";return Gr(Y)?[He].concat(Y,[tt]):typeof Y!="string"?[He,Y,tt]:He+Y+tt}var WR=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),GR=HR;const Xy=/https:\/\//;class zR extends Gs("ProjectTechnology")({id:W,name:W,category:Cy("programming language","framework","cloud computing","database","devops tool","testing","collaboration tool","frontend","other"),version:W.pipe(Mn),url:W.pipe(Mn)}){}class YR extends Gs("ProjectDetails")({order:pR,client:vt({name:W,description:W}).pipe(Mn),title:W,stack:W.pipe(yt),tools:W.pipe(yt),roles:W.pipe(yt),achivements:vt({technical:W,human:W.pipe(Mn)}).pipe(yt)}){}class ZR extends Gs("EmploymentRecord")({position:W,workType:Cy("hybrid","on-site","remote"),companyName:W,companyDescription:W,website:W.pipe(Wy(Xy)),start:W,end:W,location:vt({city:W,country:W,timezone:W}).pipe(ER),projects:YR.pipe(yt)}){}class QR extends Gs("Me")({name:W,expertise:W.pipe(yt),location:W.pipe(Mn),phone:W.pipe(Mn),email:W,profiles:vt({url:W.pipe(Wy(Xy)),icon:W}).pipe(yt),expertSummary:W.pipe(yt)}){}class XR extends Gs("ResumeObject")({$schema:W.pipe(Mn),me:QR,technologies:zR.pipe(yt),employmentHistory:ZR.pipe(yt)}){}var eC=0;function $(e,t,n,r,s,o){t||(t={});var i,c,a=t;if("ref"in a)for(c in a={},t)c=="ref"?i=t[c]:a[c]=t[c];var l={type:e,props:a,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--eC,__i:-1,__u:0,__source:s,__self:o};if(typeof e=="function"&&(i=e.defaultProps))for(c in i)a[c]===void 0&&(a[c]=i[c]);return Ee.vnode&&Ee.vnode(l),l}function tC(e){return $("div",{id:"resume",children:[iC(e),$("div",{className:"section-header",children:$("span",{id:"label",children:"Summary"})}),$("div",{id:"summary",children:e.me.expertSummary.map(t=>$("p",{dangerouslySetInnerHTML:{__html:t}}))}),$("div",{className:"section-header",children:$("span",{id:"label",children:"Skills"})}),$("div",{id:"skills",children:Object.entries(lC(e)).map(([t,n])=>$("div",{className:"skill-group",children:[$("span",{children:t}),$("div",{className:"group-list",children:n.map(r=>$("span",{className:"stack-item",children:r.technology.name}))})]}))}),$("div",{className:"section-header",children:$("span",{id:"label",children:"Employment"})}),$("div",{id:"employment",children:aC(e)})]})}function nC(e){var t;return $("span",{children:["Software Engineer. ",$("span",{id:"expertise",children:["Expertise: ",(t=e.me)==null?void 0:t.expertise.join("/")]})]})}function rC(e){return $("span",{children:[e.position," · ",e.location.city,", ",e.location.country," · ",e.workType]})}function sC(e){return $("span",{children:[$("a",{className:"companyLink",href:e.website,children:e.companyName})," · ",e.companyDescription]})}function oC(e){return $("span",{children:e.stack.map(t=>$("span",{className:"stack-item",children:t}))})}function iC(e){var t;return $("div",{id:"head",children:[$("div",{id:"name",children:e.me.name}),$("div",{id:"role",children:nC(e)}),$("div",{id:"location",children:(t=e.me)==null?void 0:t.location}),$("div",{id:"contact",children:[$("div",{id:"email",children:[$("span",{className:"fa-regular fa-envelope"}),$("a",{href:`mailto:${e.me.email}`,children:[" ",e.me.email]})]}),$("div",{id:"phone",children:[$("span",{className:"fa-solid fa-mobile-screen-button"}),$("a",{href:`tel:${e.me.phone}`,children:[" ",e.me.phone]})]})]}),$("div",{id:"profiles",children:e.me.profiles.map(n=>{const r=`fa-${n.icon.split(" ").at(0)}`;return $("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",children:$("span",{className:`fa-brands fa-lg ${r}`,style:{color:n.icon.split(" ").at(1)}})})})})]})}function cC(e){return $("div",{className:"project",children:[$("div",{style:{display:"flex"},children:[$("div",{style:{marginBottom:"3px"},children:[$("b",{children:"Project: "}),$("span",{children:e.title})]}),$("div",{style:{marginLeft:"auto"},children:[$("b",{children:"Roles: "}),$("span",{children:e.roles.join("/")})]})]}),$("span",{style:{display:"block"},children:[$("b",{children:"Stack: "}),oC(e)]}),$("ul",{children:e.achivements.map(t=>$("div",{children:$("li",{children:t.human??t.technical})}))})]})}function aC(e){return $("div",{id:"employment",children:e.employmentHistory.map(t=>$("div",{className:"company",children:[$("div",{style:{display:"flex"},children:[$("span",{children:sC(t)}),$("span",{style:{marginLeft:"auto"},children:uC(t)})]}),$("span",{style:{display:"block",marginBottom:"5px"},children:rC(t)}),t.projects.map(cC),$("hr",{})]}))})}function uC(e){const t=Od(e.start),n=Od(e.end),r=N1(t,n),s=365.25*24*60*60*1e3,o=s/12;let i=Math.floor(r/s),c=Math.ceil(r%s/o);c===12&&(i=i+1,c=0);const a=Ed(t,{month:"short",year:"numeric"}),l=Ed(n,{month:"short",year:"numeric"});let f=`${c} mos`;return i&&(f=`${i} yr ${f}`),$("span",{children:[a," - ",l," · ",f]})}function lC(e){var r;const t=(r=e.employmentHistory)==null?void 0:r.flatMap(s=>s.projects.flatMap(o=>[...o.stack,...o.tools].flatMap(i=>{var a;const c=(a=e.technologies)==null?void 0:a.find(l=>l.id==i);return c?[{code:i,category:c.category,technology:c}]:[]})));return t?y(t,Ou((s,o)=>s.code==o.code),Rv(s=>s.technology.category)):(console.warn("Skill categories not found"),{})}const Ac=e=>{try{return GR(tC(e))}catch(t){return console.log("render error",t),""}},fC=async()=>{const e=await fetch("/john-doe.json").then(n=>n.json());return console.log({resume:e}),D1(XR)(e)},dC=e=>{if(e)try{return JSON.parse(e)}catch{}},hC=e=>fetch(e).then(t=>t.text()),pC=()=>{if(!("monaco_loader"in window)||typeof window.monaco_loader!="object"||window.monaco_loader==null){console.warn("monaco loader is not available");return}return window.monaco_loader},mC=()=>{const e=pC();if(e)return e.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@latest/min/vs"}}),e.init()},gC=async(e,t)=>{const n=document.getElementById("code-editor");if(!n){console.warn("code-editor node not found");return}return e.editor.create(n,{model:t,contextmenu:!1,minimap:{enabled:!1}})},_C=async e=>{const t=await hC("./john-doe.json");return{model:e.editor.createModel(t,"json")}},yC=(e,t,n)=>{const s=e.editor.getModelMarkers({resource:t.uri}).find(o=>n.has(o.severity.valueOf()));return s?(console.log("editor code error",s),!0):!1},bC=async()=>{const e=await mC();if(!e)return;const t=await _C(e);if(await gC(e,t.model))return{monaco:e,textModel:t}};window.Alpine=ss;SC();ss.data("sections",()=>({sections:[{id:"all",label:"All"},{id:"me",label:"Me"},{id:"employmentHistory",label:"My Employment"},{id:"technologies",label:"Tecnologies"}]}));ss.start();async function SC(){const e=ss.reactive({resumeObject:{},resumeHtml:"

My Resume

",editorSection:"me",mode:"editor",editorHasError:!1});ss.store("state",e);const t=await bC(),n=await fetch("./resume-schema.json").then(i=>i.json());if(delete n.$schema,!t){console.warn("can not load editor");return}const r=i=>t.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0,schemas:[{uri:"resume.json",fileMatch:["*"],schema:{...n,$ref:i}}]}),s=()=>{e.editorSection=="all"?(delete e.resumeObject.$schema,t.textModel.model.setValue(JSON.stringify(e.resumeObject,void 0,2)),r("#/$defs/ResumeObject")):(t.textModel.model.setValue(JSON.stringify(e.resumeObject[e.editorSection],void 0,2)),r(`#/$defs/ResumeObject/properties/${e.editorSection}`))};t.textModel.model.onDidChangeContent(()=>{const i=dC(t.textModel.model.getValue());console.log("parsed",i),i&&(e.editorSection=="all"?e.resumeObject=i:e.resumeObject[e.editorSection]=i,e.resumeHtml=Ac(e.resumeObject))}),document.addEventListener("section-changed",()=>{s()});const o=await fC();t.monaco.editor.onDidChangeMarkers(()=>{const i=yC(t.monaco,t.textModel.model,new Set([4,8]));console.log("markers changed",{hasErrors:i}),e.editorHasError=i,i||(e.resumeHtml=Ac(e.resumeObject))}),e.resumeObject=o,e.resumeHtml=Ac(o),s()} diff --git a/docs/cv-maker/index.html b/docs/cv-maker/index.html index 3526bf5..fe7c84e 100644 --- a/docs/cv-maker/index.html +++ b/docs/cv-maker/index.html @@ -12,7 +12,7 @@ CV Maker - + diff --git a/src/cv-maker/main.ts b/src/cv-maker/main.ts index 79b256f..13d4a29 100644 --- a/src/cv-maker/main.ts +++ b/src/cv-maker/main.ts @@ -53,7 +53,9 @@ async function setup() { const editor = await makeJsonEditor(); - const resumeSchemaObject = await fetch("/resume-schema.json").then(_ => _.json()); + const resumeSchemaObject = await fetch("./resume-schema.json").then(_ => _.json()); + + delete resumeSchemaObject["$schema"] if (!editor) { console.warn("can not load editor");