@lmvz-ds/components 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/assets-CJzJZPzV.js +26 -0
- package/dist/cjs/{assets-CB5ikzmP.js → icons-FIfJEo6G.js} +1251 -773
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/lmvz-card.cjs.entry.js +3 -3
- package/dist/cjs/lmvz-icon.cjs.entry.js +3 -3
- package/dist/collection/components/lmvz-card/lmvz-card.js +3 -4
- package/dist/collection/components/lmvz-icon/icons.js +2 -2
- package/dist/collection/utils/assets.js +9 -6
- package/dist/collection/utils/http.js +2 -2
- package/dist/collection/utils/http.unit.js +1 -1
- package/dist/collection/utils/validation/svg.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/lmvz-card.js +1 -1
- package/dist/components/lmvz-header.js +1 -1
- package/dist/components/lmvz-icon.js +1 -1
- package/dist/components/p-BsS3QvWn.js +1 -0
- package/dist/components/p-CdYWDK7m.js +1 -0
- package/dist/esm/assets-BelZNJ1W.js +23 -0
- package/dist/esm/{assets-ozES4zSA.js → icons-CM7lsnuO.js} +1249 -708
- package/dist/esm/index.js +3 -2
- package/dist/esm/lmvz-card.entry.js +3 -3
- package/dist/esm/lmvz-icon.entry.js +2 -2
- package/dist/lmvz-components/index.esm.js +1 -1
- package/dist/lmvz-components/lmvz-components.esm.js +1 -1
- package/dist/lmvz-components/p-6e3314ab.entry.js +1 -0
- package/dist/lmvz-components/p-BoR31cjC.js +1 -0
- package/dist/lmvz-components/p-CVf2C8dL.js +1 -0
- package/dist/lmvz-components/p-d9dc29a1.entry.js +1 -0
- package/dist/manifest.json +1 -1
- package/dist/types/utils/assets.d.ts +1 -8
- package/dist/types/utils/http.d.ts +3 -3
- package/dist/types/utils/validation/svg.d.ts +2 -2
- package/hydrate/index.js +2131 -12411
- package/hydrate/index.mjs +2131 -12411
- package/package.json +4 -4
- package/dist/cjs/icons-DM_TTn48.js +0 -857
- package/dist/components/p-BBDH9X49.js +0 -1
- package/dist/components/p-Bs6_m7Uw.js +0 -1
- package/dist/esm/icons-kpJZ1u9g.js +0 -853
- package/dist/lmvz-components/p-4ad8c332.entry.js +0 -1
- package/dist/lmvz-components/p-5eee0752.entry.js +0 -1
- package/dist/lmvz-components/p-D9lc4ayG.js +0 -1
- package/dist/lmvz-components/p-iviTjlUy.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as i,r as e,h as s,H as t}from"./p-T5ljELGS.js";import{r,t as o,l as n,c,b as m}from"./p-D9lc4ayG.js";import{R as a,A as l}from"./p-CZ3dGAjR.js";import{f as h,e as v}from"./p-iviTjlUy.js";const d=class extends a{intersectionObserver;get el(){return i(this)}icon;weight="medium";size="md";iconData;visible=!1;ariaLabel;get ariaHidden(){return!this.ariaLabel}constructor(i){super(),e(this,i),this.addController(new l(this))}connectedCallback(){this.waitUntilVisible((()=>{this.visible=!0,this.loadIconPathData()}))}disconnectedCallback(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null)}async loadIconPathData(){const{icon:i,visible:e}=this;i&&e&&(this.iconData=await r(h(this.icon).pipe(o((e=>n(`Error loading icon "${i}":`,e.message,e.cause,e.stack))),c((()=>m(v()))))))}render(){return s(t,{key:"d4c1cbfbaf39ebf6aa26415d46100763b9f89b5b",role:"img","aria-hidden":`${this.ariaHidden}`,innerHTML:this.iconData})}waitUntilVisible(i,e=50){"undefined"!=typeof window&&window.IntersectionObserver?(this.intersectionObserver=new IntersectionObserver((e=>{e.some((e=>!!e.isIntersecting&&(this.intersectionObserver.disconnect(),this.intersectionObserver=null,i(),!0)))}),{rootMargin:`${e}px`}),this.intersectionObserver.observe(this.el)):i()}static get assetsDirs(){return["../../assets/icons"]}static get watchers(){return{icon:[{loadIconPathData:0}]}}};d.style=".sc-lmvz-icon-h{--lmvz-icon-color:var(--lmvz-component-color, var(--lmvz-semantic-color-on-surface-input-primary, #000000));display:inline-block;line-height:0;svg{display:block}svg>path{stroke:var(--lmvz-icon-color);fill:none}}[size='xs'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem));height:var(--lmvz-component-icon-size-xs, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))}}[size='sm'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem));height:var(--lmvz-component-icon-size-sm, clamp(0.88rem, 0.81rem + 0.26vw, 1.13rem))}}[size='md'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem));height:var(--lmvz-component-icon-size-md, clamp(1rem, 0.88rem + 0.52vw, 1.5rem))}}[size='lg'].sc-lmvz-icon-h{svg{width:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem));height:var(--lmvz-component-icon-size-lg, clamp(1.5rem, 1.38rem + 0.52vw, 2rem))}}[size='inherit'].sc-lmvz-icon-h{svg{width:inherit;height:inherit}}[weight='light'].sc-lmvz-icon-h{svg>path{stroke-width:1}}[weight='medium'].sc-lmvz-icon-h{svg>path{stroke-width:1.5}}[weight='bold'].sc-lmvz-icon-h{svg>path{stroke-width:2}}[weight='filled'].sc-lmvz-icon-h{svg>path{stroke-width:2;fill:var(--lmvz-icon-color)}}";export{d as lmvz_icon}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as r,h as t,H as a}from"./p-T5ljELGS.js";import{a as o,s as m}from"./p-D9lc4ayG.js";const n=class{constructor(t){e(this,t),this.primaryAction=r(this,"primaryAction")}cardTitle;imageUrl;description;primaryActionLabel="";primaryAction;get fallbackImage(){return o(m("card-placeholder.svg"))}_onPrimaryClick(){this.primaryAction.emit()}_onOverflowClick(e){console.log(e)}render(){return t(a,{key:"1438354a53604954320d01652aa1d84f8712e875",role:"article"},t("div",{key:"dcffae2c48ebf8f8769cf07c2e78806f12df6888",class:"top"},t("div",{key:"e41e1d0aafbfc5879b86022e91958ef3373b48b2",class:"image-wrapper",style:{backgroundImage:`url(${this.imageUrl??this.fallbackImage})`}},t("div",{key:"f6a1fc9706012f39aca9dd0b995290e6042e3407",class:"chip-slot"},t("slot",{key:"4e014519c147705cc30b3268d652ea6c76c749ec",name:"chip"})))),t("div",{key:"e7baf78b660e9a97edd0b6a0aa1bdb1afa593fed",class:"bottom"},t("header",{key:"a8dad9f91df60f535725328a4901833d47652678"},t("h2",{key:"1cdbca46469750187856a46fa155128f1f8a677f",class:"title"},this.cardTitle)),t("p",{key:"f33c2c0af86d7be31fcbd676833b27c7d06e2dd9",class:"description"},this.description),t("div",{key:"a12595d514167fb957aac71fe3d144810b442f9d",class:"actions"},t("button",{key:"9730cedbf83599c09eedaaae43331147691486d6",class:"primary",onClick:this._onPrimaryClick.bind(this),"data-testid":"primary"},this.primaryActionLabel),t("button",{key:"48e9c511c406beb75334452769beade3dec9a3f5",class:"tertiary","aria-label":"More actions",onClick:this._onOverflowClick},t("span",{key:"81cc1af42a15dddb9dbd4f373a6a047c2e2cd563",class:"icon-placeholder"},"...")))))}static get assetsDirs(){return["../../assets"]}};n.style="@layer lmvz-ds.reset, lmvz-ds.theme, lmvz-ds.components, lmvz-ds.overrides; @layer lmvz-ds.theme { @font-face { font-family: Router; src: local('Router-Book'), url('/assets/fonts/Router-Book.woff') format('woff'), local('Router'); font-weight: 400 normal; } @font-face { font-family: Router; src: local('Router-Medium'), url('/assets/fonts/Router-Medium.woff') format('woff'), local('Router'); font-weight: 500; } @font-face { font-family: Router; src: local('Router-Bold'), url('/assets/fonts/Router-Bold.woff') format('woff'), local('Router'); font-weight: 700 bold; } } @layer lmvz-ds.reset { h1, h2, h3, h4, h5, h6 { margin: 0; } } .sc-lmvz-card-h { button { --lmvz-button-color: var(--lmvz-component-color, var(--lmvz-semantic-color-int-on-primary, #ffffff)); --lmvz-button-padding-inline: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-x, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-padding-block: var(--lmvz-button-padding, var(--lmvz-component-input-md-padding-y, clamp(0.75rem, 0.69rem + 0.26vw, 1rem))); --lmvz-button-gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); --lmvz-button-radius: var(--lmvz-component-input-radius-default, 999px); --lmvz-button-border-width: 0; --lmvz-button-border-color: transparent; --lmvz-button-background: var(--lmvz-semantic-color-int-primary, #000000); display: inline-flex; align-items: center; justify-content: center; gap: var(--lmvz-button-gap); padding-block: var(--lmvz-button-padding-block); padding-inline: var(--lmvz-button-padding-inline); border-radius: var(--lmvz-button-radius); border: var(--lmvz-button-border-width) solid var(--lmvz-button-border-color); background-color: var(--lmvz-button-background); color: var(--lmvz-button-color); cursor: pointer; font: var(--lmvz-button-font); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; } button > * { font: inherit; color: inherit; } button:focus-visible { outline: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-status-selected, #f1f9fe); outline-offset: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); } button:is([disabled], .disabled) { cursor: not-allowed; pointer-events: none; opacity: var(--lmvz-component-input-disabled-opacity, 40%); } button:not([disabled]):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-hover, #2e2e2e); } button:not([disabled]):active { --lmvz-button-background: var(--lmvz-semantic-color-int-primary-active, #545454); } button.secondary { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary, #f0f0f0); --lmvz-button-color: var(--lmvz-semantic-color-int-on-secondary, #000000); --lmvz-button-border-width: var(--lmvz-semantic-border-width-default, 1px); --lmvz-button-border-color: var(--lmvz-semantic-color-border-default, #e0e0e0); } button.secondary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-hover, #e0e0e0); --lmvz-button-border-color: var(--lmvz-semantic-color-border-hover, #c7c7c7); } button.secondary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-secondary-active, #d4d4d4); --lmvz-button-border-color: var(--lmvz-semantic-color-border-active, #d4d4d4); } button.tertiary { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary, #ffffff); --lmvz-button-color: var(--lmvz-semantic-color-int-on-tertiary, #545454); } button.tertiary:not([disabled], .disabled):hover { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-hover, #f0f0f0); } button.tertiary:not([disabled], .disabled):active { --lmvz-button-background: var(--lmvz-semantic-color-int-tertiary-active, #e0e0e0); } button.small { --lmvz-button-padding-inline: var(--lmvz-component-input-sm-padding-x, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-padding-block: var(--lmvz-component-input-sm-padding-y, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); --lmvz-button-gap: var(--lmvz-component-input-sm-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } button.large { --lmvz-button-padding-inline: var(--lmvz-component-input-lg-padding-x, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-padding-block: var(--lmvz-component-input-lg-padding-y, clamp(0.88rem, 0.78rem + 0.39vw, 1.25rem)); --lmvz-button-gap: var(--lmvz-component-input-lg-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); --lmvz-button-font: var(--lmvz-typography-body-lg, 400 clamp(1rem, 0.97rem + 0.13vw, 1.13rem) / 1.4 Router); } display: flex; min-width: var(--lmvz-other-component-card-minwidth, 20.4375rem); max-width: var(--lmvz-other-component-card-maxwidth, 21.6875rem); flex-direction: column; align-items: flex-start; border-radius: var(--lmvz-semantic-border-radius-lg, 14px); border: var(--lmvz-semantic-border-width-default, 1px) solid var(--lmvz-semantic-color-border-default, #e0e0e0); background: var(--lmvz-semantic-color-surface-primary, #ffffff); } *.sc-lmvz-card { color: var(--lmvz-semantic-color-on-surface-primary, #000000); font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .top.sc-lmvz-card { display: flex; padding: var(--lmvz-dimension-8-12, clamp(0.5rem, 0.44rem + 0.26vw, 0.75rem)); flex-direction: column; justify-content: center; align-items: center; align-self: stretch; } .bottom.sc-lmvz-card { display: flex; min-width: 150px; padding: var(--lmvz-dimension-4-6, clamp(0.25rem, 0.22rem + 0.13vw, 0.38rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)) var(--lmvz-dimension-10-14, clamp(0.63rem, 0.56rem + 0.26vw, 0.88rem)); flex-direction: column; align-items: flex-start; align-self: stretch; } .title.sc-lmvz-card { margin: 0; display: flex; justify-content: center; align-items: center; align-self: stretch; padding-bottom: var(--lmvz-global-s4, 4px); overflow-wrap: break-word; font: var(--lmvz-typography-heading-2xl, 500 clamp(2rem, 1.94rem + 0.26vw, 2.25rem) / 1.2 Router); } .description.sc-lmvz-card { display: flex; margin: 0; padding-bottom: var(--lmvz-component-body-sm-padding-bottom, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-items: flex-start; align-self: stretch; white-space: pre-line; font: var(--lmvz-typography-body-md, 400 clamp(0.88rem, 0.84rem + 0.13vw, 1rem) / 1.4 Router); } .image-wrapper.sc-lmvz-card { aspect-ratio: 4 / 3; width: 100%; background-size: cover; background-position: center; flex: 1 0 0; align-self: stretch; border-radius: var(--lmvz-semantic-border-radius-md, 6px); } .actions.sc-lmvz-card { margin-top: var(--lmvz-component-form-wrapper-gap-y, clamp(1.13rem, 0.97rem + 0.65vw, 1.75rem)); display: flex; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); align-self: stretch; } button.primary.sc-lmvz-card, lmvz-button.primary.sc-lmvz-card { display: flex; justify-content: center; align-items: center; gap: var(--lmvz-component-input-md-gap-x, clamp(0.25rem, 0.16rem + 0.39vw, 0.63rem)); flex: 1 0 0; }";export{n as lmvz_card}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./p-T5ljELGS.js";const e=function(t,e){if("function"==typeof t)return function(){return t(arguments)?e.apply(this,arguments):t=>e(t,...arguments)};switch(t){case 0:case 1:throw new RangeError(`Invalid arity ${t}`);case 2:return function(t,r){return arguments.length>=2?e(t,r):function(r){return e(r,t)}};case 3:return function(t,r,n){return arguments.length>=3?e(t,r,n):function(n){return e(n,t,r)}};case 4:return function(t,r,n,s){return arguments.length>=4?e(t,r,n,s):function(s){return e(s,t,r,n)}};case 5:return function(t,r,n,s,i){return arguments.length>=5?e(t,r,n,s,i):function(i){return e(i,t,r,n,s)}};default:return function(){if(arguments.length>=t)return e.apply(this,arguments);const r=arguments;return function(t){return e(t,...r)}}}},r=t=>t,n=t=>()=>t,s=n(!0),i=n(!1),o=n(void 0),c=o;function u(t,e,r,n,s,i,o,c,u){switch(arguments.length){case 1:return t;case 2:return e(t);case 3:return r(e(t));case 4:return n(r(e(t)));case 5:return s(n(r(e(t))));case 6:return i(s(n(r(e(t)))));case 7:return o(i(s(n(r(e(t))))));case 8:return c(o(i(s(n(r(e(t)))))));case 9:return u(c(o(i(s(n(r(e(t))))))));default:{let t=arguments[0];for(let e=1;e<arguments.length;e++)t=arguments[e](t);return t}}}const a=t=>(e,r)=>e===r||t(e,r),h=e(2,((t,e)=>a(((r,n)=>t(e(r),e(n)))))),l="effect/GlobalValue";let f;const b=(t,e)=>(f||(globalThis[l]??=new Map,f=globalThis[l]),f.has(t)||f.set(t,e()),f.get(t)),d=t=>"number"==typeof t,p=t=>"function"==typeof t,m=t=>(t=>"object"==typeof t&&null!==t)(t)||p(t),g=e(2,((t,e)=>m(t)&&e in t)),y=e(2,((t,e)=>g(t,"_tag")&&t._tag===e)),S=t=>null==t,w=t=>"string"==typeof t||g(t,Symbol.iterator),_=t=>`BUG: ${t} - please report an issue at https://github.com/Effect-TS/effect/issues`;let v=class t{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new t(this.self)}};class O{_state;constructor(t,e,r,n){return S(e)&&S(t)?(e=4294967295*Math.random()>>>0,t=0):S(e)&&(e=t,t=0),S(n)&&S(r)?(n=this._state?this._state[3]:4150755663,r=this._state?this._state[2]:335903614):S(n)&&(n=r,r=0),this._state=new Int32Array([0,0,r>>>0,(1|(n||0))>>>0]),this._next(),E(this._state,this._state[0],this._state[1],t>>>0,e>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(t){this._state[0]=t[0],this._state[1]=t[1],this._state[2]=t[2],this._state[3]=1|t[3]}integer(t){return Math.round(this.number()*Number.MAX_SAFE_INTEGER)%t}number(){return(1*(67108863&this._next())*134217728+1*(134217727&this._next()))/9007199254740992}_next(){const t=this._state[0]>>>0,e=this._state[1]>>>0;!function(t,e,r,n,s){let i=32557*(r>>>16)>>>0,o=19605*(65535&r)>>>0,c=32557*(65535&r)>>>0,u=19605*(r>>>16)+((o>>>16)+(i>>>16))>>>0;o=o<<16>>>0,c=c+o>>>0,c>>>0<o>>>0&&(u=u+1>>>0),i=i<<16>>>0,c=c+i>>>0,c>>>0<i>>>0&&(u=u+1>>>0),u=u+Math.imul(r,1481765933)>>>0,u=u+Math.imul(e,s)>>>0,t[0]=u,t[1]=c}(this._state,t,e,0,1284865837),E(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let r=t>>>18,n=(e>>>18|t<<14)>>>0;r=(r^t)>>>0,n=(n^e)>>>0;const s=(n>>>27|r<<5)>>>0,i=t>>>27;return(s>>>i|s<<((-i>>>0&31)>>>0))>>>0}}function E(t,e,r,n,s){let i=e+n>>>0;const o=r+s>>>0;o>>>0<r>>>0&&(i=i+1|0),t[0]=i,t[1]=o}const M=Symbol.for("effect/Utils/YieldWrap");class k{#t;constructor(t){this.#t=t}[M](){return this.#t}}function I(t){if("object"==typeof t&&null!==t&&M in t)return t[M]();throw new Error(_("yieldWrapGet"))}const N=b("effect/Utils/isStructuralRegion",(()=>({enabled:!1,tester:void 0}))),j={effect_internal_function:t=>t()},C=!0===j.effect_internal_function((()=>(new Error).stack))?.includes("effect_internal_function")?j.effect_internal_function:t=>{try{return t()}finally{}},F=b(Symbol.for("effect/Hash/randomHashCache"),(()=>new WeakMap)),R=Symbol.for("effect/Hash"),A=t=>{if(!0===N.enabled)return 0;switch(typeof t){case"number":return B(t);case"bigint":return D(t.toString(10));case"boolean":case"symbol":return D(String(t));case"string":return D(t);case"undefined":return D("undefined");case"function":case"object":return null===t?D("null"):t instanceof Date?Number.isNaN(t.getTime())?D("Invalid Date"):A(t.toISOString()):t instanceof URL?A(t.href):L(t)?t[R]():x(t);default:throw new Error(`BUG: unhandled typeof ${typeof t} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},x=t=>(F.has(t)||F.set(t,B(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),F.get(t)),$=t=>e=>53*e^t,T=t=>3221225471&t|t>>>1&1073741824,L=t=>g(t,R),B=t=>{if(t!=t||t===1/0)return 0;let e=0|t;for(e!==t&&(e^=4294967295*t);t>4294967295;)e^=t/=4294967295;return T(e)},D=t=>{let e=5381,r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return T(e)},P=t=>((t,e)=>{let r=12289;for(let n=0;n<e.length;n++)r^=u(D(e[n]),$(A(t[e[n]])));return T(r)})(t,Object.keys(t)),q=t=>{let e=6151;for(let r=0;r<t.length;r++)e=u(e,$(A(t[r])));return T(e)},U=function(){if(1===arguments.length){const t=arguments[0];return function(e){return Object.defineProperty(t,R,{value:()=>e,enumerable:!1}),e}}const t=arguments[1];return Object.defineProperty(arguments[0],R,{value:()=>t,enumerable:!1}),t},J=Symbol.for("effect/Equal");function G(){return 1===arguments.length?t=>H(t,arguments[0]):H(arguments[0],arguments[1])}function H(t,e){if(t===e)return!0;const r=typeof t;if(r!==typeof e)return!1;if("object"===r||"function"===r){if(null!==t&&null!==e){if(V(t)&&V(e))return!(A(t)!==A(e)||!t[J](e))||!(!N.enabled||!N.tester)&&N.tester(t,e);if(t instanceof Date&&e instanceof Date){const r=t.getTime(),n=e.getTime();return r===n||Number.isNaN(r)&&Number.isNaN(n)}if(t instanceof URL&&e instanceof URL)return t.href===e.href}if(N.enabled){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,r)=>H(t,e[r])));if(Object.getPrototypeOf(t)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){const r=Object.keys(t),n=Object.keys(e);if(r.length===n.length){for(const n of r)if(!(n in e)||!H(t[n],e[n]))return!!N.tester&&N.tester(t,e);return!0}}return!!N.tester&&N.tester(t,e)}}return!(!N.enabled||!N.tester)&&N.tester(t,e)}const V=t=>g(t,J),W=()=>G,Y=Symbol.for("nodejs.util.inspect.custom"),K=t=>{try{if(g(t,"toJSON")&&p(t.toJSON)&&0===t.toJSON.length)return t.toJSON();if(Array.isArray(t))return t.map(K)}catch{return{}}return rt(t)},z=t=>JSON.stringify(t,null,2),Q=(t,e=2)=>{if("string"==typeof t)return t;try{return"object"==typeof t?Z(t,e):String(t)}catch{return String(t)}},Z=(t,e)=>{let r=[];const n=JSON.stringify(t,((t,e)=>"object"==typeof e&&null!==e?r.includes(e)?void 0:r.push(e)&&(void 0!==et.fiberRefs&&tt(e)?e[X](et.fiberRefs):e):e),e);return r=void 0,n},X=Symbol.for("effect/Inspectable/Redactable"),tt=t=>"object"==typeof t&&null!==t&&X in t,et=b("effect/Inspectable/redactableState",(()=>({fiberRefs:void 0}))),rt=t=>tt(t)&&void 0!==et.fiberRefs?t[X](et.fiberRefs):t,nt=(t,e)=>{switch(e.length){case 0:return t;case 1:return e[0](t);case 2:return e[1](e[0](t));case 3:return e[2](e[1](e[0](t)));case 4:return e[3](e[2](e[1](e[0](t))));case 5:return e[4](e[3](e[2](e[1](e[0](t)))));case 6:return e[5](e[4](e[3](e[2](e[1](e[0](t))))));case 7:return e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))));case 8:return e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t))))))));case 9:return e[8](e[7](e[6](e[5](e[4](e[3](e[2](e[1](e[0](t)))))))));default:{let r=t;for(let t=0,n=e.length;t<n;t++)r=e[t](r);return r}}},st="Async",it="Commit",ot="Failure",ct="OnFailure",ut="OnSuccess",at="OnSuccessAndFailure",ht="Success",lt="Sync",ft="Tag",bt="UpdateRuntimeFlags",dt="While",pt="Iterator",mt="WithRuntime",gt="Yield",yt="RevertFlags",St=()=>"3.19.14",wt=Symbol.for("effect/Effect"),_t=Symbol.for("effect/Stream"),vt=Symbol.for("effect/Sink"),Ot=Symbol.for("effect/Channel"),Et={_R:t=>t,_E:t=>t,_A:t=>t,_V:St()},Mt={[wt]:Et,[_t]:Et,[vt]:{_A:t=>t,_In:t=>t,_L:t=>t,_E:t=>t,_R:t=>t},[Ot]:{_Env:t=>t,_InErr:t=>t,_InElem:t=>t,_InDone:t=>t,_OutErr:t=>t,_OutElem:t=>t,_OutDone:t=>t},[J](t){return this===t},[R](){return U(this,x(this))},[Symbol.iterator](){return new v(new k(this))},pipe(){return nt(this,arguments)}},kt={[R](){return U(this,P(this))},[J](t){const e=Object.keys(this),r=Object.keys(t);if(e.length!==r.length)return!1;for(const r of e)if(!(r in t)||!G(this[r],t[r]))return!1;return!0}},It={...Mt,_op:it},Nt={...It,...kt},jt=function(){function t(){}return t.prototype=It,t}(),Ct=Symbol.for("effect/Option"),Ft={...Mt,[Ct]:{_A:t=>t},[Y](){return this.toJSON()},toString(){return z(this.toJSON())}},Rt=Object.assign(Object.create(Ft),{_tag:"Some",_op:"Some",[J](t){return $t(t)&&Lt(t)&&G(this.value,t.value)},[R](){return U(this,$(A(this._tag))(A(this.value)))},toJSON(){return{_id:"Option",_tag:this._tag,value:K(this.value)}}}),At=A("None"),xt=Object.assign(Object.create(Ft),{_tag:"None",_op:"None",[J]:t=>$t(t)&&Tt(t),[R]:()=>At,toJSON(){return{_id:"Option",_tag:this._tag}}}),$t=t=>g(t,Ct),Tt=t=>"None"===t._tag,Lt=t=>"Some"===t._tag,Bt=Object.create(xt),Dt=t=>{const e=Object.create(Rt);return e.value=t,e},Pt=Symbol.for("effect/Either"),qt={...Mt,[Pt]:{_R:t=>t},[Y](){return this.toJSON()},toString(){return z(this.toJSON())}},Ut=Object.assign(Object.create(qt),{_tag:"Right",_op:"Right",[J](t){return Gt(t)&&Vt(t)&&G(this.right,t.right)},[R](){return $(A(this._tag))(A(this.right))},toJSON(){return{_id:"Either",_tag:this._tag,right:K(this.right)}}}),Jt=Object.assign(Object.create(qt),{_tag:"Left",_op:"Left",[J](t){return Gt(t)&&Ht(t)&&G(this.left,t.left)},[R](){return $(A(this._tag))(A(this.left))},toJSON(){return{_id:"Either",_tag:this._tag,left:K(this.left)}}}),Gt=t=>g(t,Pt),Ht=t=>"Left"===t._tag,Vt=t=>"Right"===t._tag,Wt=t=>{const e=Object.create(Ut);return e.right=t,e},Yt=t=>{const e=Object.create(Jt);return e.left=t,e},Kt=Ht,zt=Vt,Qt=e(2,((t,{onLeft:e,onRight:r})=>Kt(t)?e(t.left):r(t.right)))({onLeft:r,onRight:r}),Zt=e(2,((t,e)=>{if(zt(t))return t.right;throw e(t.left)})),Xt=t=>t.length>0,te=t=>(e,r)=>e===r?0:t(e,r),ee=te(((t,e)=>t<e?-1:1)),re=e(2,((t,e)=>te(((r,n)=>t(e(r),e(n)))))),ne=t=>e(2,((e,r)=>1===t(e,r))),se=()=>Bt,ie=Dt,oe=Tt,ce=Lt,ue=e(2,((t,{onNone:e,onSome:r})=>oe(t)?e():r(t.value))),ae=t=>Ht(t)?Bt:Dt(t.right),he=e(2,((t,e)=>oe(t)?e():t.value)),le=e(2,((t,e)=>oe(t)?ie(e()):t)),fe=t=>null==t?se():ie(t),be=he(o),de=e(2,((t,e)=>{if(ce(t))return t.value;throw e()}))((()=>new Error("getOrThrow called on a None"))),pe=e(2,((t,e)=>oe(t)?se():ie(e(t.value)))),me=e(2,((t,e)=>oe(t)?se():e(t.value))),ge=(t=>e(2,((e,r)=>!oe(e)&&t(e.value,r))))(W()),ye=t=>(e,r)=>oe(e)?r:oe(r)?e:ie(t(e.value,r.value)),Se=(...t)=>t,we=t=>new Array(t),_e=e(2,((t,e)=>{const r=Math.max(1,Math.floor(t)),n=new Array(r);for(let t=0;t<r;t++)n[t]=e(t);return n})),ve=t=>Array.isArray(t)?t:Array.from(t),Oe=e(2,((t,e)=>[e,...t])),Ee=e(2,((t,e)=>[...t,e])),Me=e(2,((t,e)=>ve(t).concat(ve(e)))),ke=Xt,Ie=Xt,Ne=(t,e)=>t<0||t>=e.length,je=e(2,((t,e)=>{const r=Math.floor(e);return Ne(r,t)?se():ie(t[r])})),Ce=e(2,((t,e)=>{const r=Math.floor(e);if(Ne(r,t))throw new Error(`Index ${r} out of bounds`);return t[r]})),Fe=je(0),Re=Ce(0),Ae=t=>t[t.length-1],xe=t=>t.slice(1),$e=e(2,((t,e)=>Ue(t,((t,e)=>{let r=0;for(const n of t){if(!e(n,r))break;r++}return r})(t,e)))),Te=e(2,((t,e)=>{const r=ve(t);return r.slice(((t,e)=>Math.floor(Math.min(Math.max(0,t),e.length)))(e,r),r.length)})),Le=t=>Array.from(t).reverse(),Be=e(2,((t,e)=>{const r=Array.from(t);return r.sort(e),r})),De=e(2,((t,e)=>Pe(t,e,Se))),Pe=e(3,((t,e,r)=>{const n=ve(t),s=ve(e);if(Ie(n)&&Ie(s)){const t=[r(Re(n),Re(s))],e=Math.min(n.length,s.length);for(let i=1;i<e;i++)t[i]=r(n[i],s[i]);return t}return[]})),qe=W(),Ue=e(2,((t,e)=>{const r=Array.from(t),n=Math.floor(e);return Ie(r)?n>=1?Je(r,n):[[],r]:[r,[]]})),Je=e(2,((t,e)=>{const r=Math.max(1,Math.floor(e));return r>=t.length?[Ge(t),[]]:[Oe(t.slice(1,r),Re(t)),t.slice(r)]})),Ge=t=>t.slice(),He=e(3,((t,e,r)=>{const n=ve(t),s=ve(e);return Ie(n)?Ie(s)?Xe(r)(Me(n,s)):n:s})),Ve=e(2,((t,e)=>He(t,e,qe))),We=t=>[t],Ye=e(2,((t,e)=>t.map(e))),Ke=e(2,((t,e)=>{if((t=>0===t.length)(t))return[];const r=[];for(let n=0;n<t.length;n++){const s=e(t[n],n);for(let t=0;t<s.length;t++)r.push(s[t])}return r}))(r),ze=e(3,((t,e,r)=>ve(t).reduce(((t,e,n)=>r(t,e,n)),e))),Qe=(t,e)=>{const r=[];let n,s=t;for(;ce(n=e(s));){const[t,e]=n.value;r.push(t),s=e}return r},Ze=t=>a(((e,r)=>{if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1;return!0})),Xe=e(2,((t,e)=>{const r=ve(t);if(Ie(r)){const t=[Re(r)],n=xe(r);for(const r of n)t.every((t=>!e(r,t)))&&t.push(r);return t}return[]})),tr=t=>Xe(t,W()),er=e(2,((t,e)=>ve(t).join(e))),rr=ee,nr=Symbol.for("effect/Context/Tag"),sr=Symbol.for("effect/Context/Reference"),ir=Symbol.for("effect/STM"),or={...Mt,_op:"Tag",[ir]:Et,[nr]:{_Service:t=>t,_Identifier:t=>t},toString(){return z(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Y](){return this.toJSON()},of:t=>t,context(t){return br(this,t)}},cr={...or,[sr]:sr},ur=Symbol.for("effect/Context"),ar={[ur]:{_Services:t=>t},[J](t){if(lr(t)&&this.unsafeMap.size===t.unsafeMap.size){for(const e of this.unsafeMap.keys())if(!t.unsafeMap.has(e)||!G(this.unsafeMap.get(e),t.unsafeMap.get(e)))return!1;return!0}return!1},[R](){return U(this,B(this.unsafeMap.size))},pipe(){return nt(this,arguments)},toString(){return z(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(K)}},[Y](){return this.toJSON()}},hr=t=>{const e=Object.create(ar);return e.unsafeMap=t,e},lr=t=>g(t,ur),fr=hr(new Map),br=(t,e)=>hr(new Map([[t.key,e]])),dr=e(3,((t,e,r)=>{const n=new Map(t.unsafeMap);return n.set(e.key,r),hr(n)})),pr=b("effect/Context/defaultValueCache",(()=>new Map)),mr=t=>{if(pr.has(t.key))return pr.get(t.key);const e=t.defaultValue();return pr.set(t.key,e),e},gr=e(2,((t,e)=>{if(!t.unsafeMap.has(e.key)){if(sr in e)return mr(e);throw(t=>{const e=new Error("Service not found"+(t.key?`: ${String(t.key)}`:""));if(t.stack){const r=t.stack.split("\n");if(r.length>2){const t=r[2].match(/at (.*)/);t&&(e.message=e.message+` (defined at ${t[1]})`)}}if(e.stack){const t=e.stack.split("\n");t.splice(1,3),e.stack=t.join("\n")}return e})(e)}return t.unsafeMap.get(e.key)})),yr=gr,Sr=e(2,((t,e)=>t.unsafeMap.has(e.key)?Dt(t.unsafeMap.get(e.key)):g(e,sr)?Dt(mr(e)):Bt)),wr=e(2,((t,e)=>{const r=new Map(t.unsafeMap);for(const[t,n]of e.unsafeMap)r.set(t,n);return hr(r)})),_r=t=>{const e=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=e;const n=Object.create(or);return Object.defineProperty(n,"stack",{get:()=>r.stack}),n.key=t,n},vr=()=>fr,Or=br,Er=dr,Mr=yr,kr=gr,Ir=Sr,Nr=wr,jr=()=>(t,e)=>{const r=Error.stackTraceLimit;Error.stackTraceLimit=2;const n=new Error;function s(){}return Error.stackTraceLimit=r,Object.setPrototypeOf(s,cr),s.key=t,s.defaultValue=e.defaultValue,Object.defineProperty(s,"stack",{get:()=>n.stack}),s},Cr=Symbol.for("effect/Chunk"),Fr=[],Rr=(t=>a(((e,r)=>e.length===r.length&&Ur(e).every(((e,n)=>t(e,Vr(r,n)))))))(G),Ar={[Cr]:{_A:t=>t},toString(){return z(this.toJSON())},toJSON(){return{_id:"Chunk",values:Ur(this).map(K)}},[Y](){return this.toJSON()},[J](t){return $r(t)&&Rr(this,t)},[R](){return U(this,q(Ur(this)))},[Symbol.iterator](){switch(this.backing._tag){case"IArray":return this.backing.array[Symbol.iterator]();case"IEmpty":return Fr[Symbol.iterator]();default:return Ur(this)[Symbol.iterator]()}},pipe(){return nt(this,arguments)}},xr=t=>{const e=Object.create(Ar);switch(e.backing=t,t._tag){case"IEmpty":e.length=0,e.depth=0,e.left=e,e.right=e;break;case"IConcat":e.length=t.left.length+t.right.length,e.depth=1+Math.max(t.left.depth,t.right.depth),e.left=t.left,e.right=t.right;break;case"IArray":e.length=t.array.length,e.depth=0,e.left=Tr,e.right=Tr;break;case"ISingleton":e.length=1,e.depth=0,e.left=Tr,e.right=Tr;break;case"ISlice":e.length=t.length,e.depth=t.chunk.depth+1,e.left=Tr,e.right=Tr}return e},$r=t=>g(t,Cr),Tr=xr({_tag:"IEmpty"}),Lr=()=>Tr,Br=(...t)=>Hr(t),Dr=t=>xr({_tag:"ISingleton",a:t}),Pr=t=>$r(t)?t:Gr(ve(t)),qr=(t,e,r)=>{switch(t.backing._tag){case"IArray":!function(t,e,r,n,s){for(let e=0;e<Math.min(t.length,0+s);e++)r[n+e-0]=t[e]}(t.backing.array,0,e,r,t.length);break;case"IConcat":qr(t.left,e,r),qr(t.right,e,r+t.left.length);break;case"ISingleton":e[r]=t.backing.a;break;case"ISlice":{let n=0,s=r;for(;n<t.length;)e[s]=Vr(t,n),n+=1,s+=1;break}}},Ur=t=>{switch(t.backing._tag){case"IEmpty":return Fr;case"IArray":return t.backing.array;default:{const e=new Array(t.length);return qr(t,e,0),t.backing={_tag:"IArray",array:e},t.left=Tr,t.right=Tr,t.depth=0,e}}},Jr=t=>{switch(t.backing._tag){case"IEmpty":case"ISingleton":return t;case"IArray":return xr({_tag:"IArray",array:Le(t.backing.array)});case"IConcat":return xr({_tag:"IConcat",left:Jr(t.backing.right),right:Jr(t.backing.left)});case"ISlice":return Gr(Le(Ur(t)))}},Gr=t=>0===t.length?Lr():1===t.length?Dr(t[0]):xr({_tag:"IArray",array:t}),Hr=t=>Gr(t),Vr=e(2,((t,e)=>{switch(t.backing._tag){case"IEmpty":throw new Error("Index out of bounds");case"ISingleton":if(0!==e)throw new Error("Index out of bounds");return t.backing.a;case"IArray":if(e>=t.length||e<0)throw new Error("Index out of bounds");return t.backing.array[e];case"IConcat":return e<t.left.length?Vr(t.left,e):Vr(t.right,e-t.left.length);case"ISlice":return Vr(t.backing.chunk,e+t.backing.offset)}})),Wr=e(2,((t,e)=>zr(t,Dr(e)))),Yr=e(2,((t,e)=>zr(Dr(e),t))),Kr=e(2,((t,e)=>{if(e<=0)return t;if(e>=t.length)return Tr;switch(t.backing._tag){case"ISlice":return xr({_tag:"ISlice",chunk:t.backing.chunk,offset:t.backing.offset+e,length:t.backing.length-e});case"IConcat":return e>t.left.length?Kr(t.right,e-t.left.length):xr({_tag:"IConcat",left:Kr(t.left,e),right:t.right});default:return xr({_tag:"ISlice",chunk:t,offset:e,length:t.length-e})}})),zr=e(2,((t,e)=>{if("IEmpty"===t.backing._tag)return e;if("IEmpty"===e.backing._tag)return t;const r=e.depth-t.depth;if(Math.abs(r)<=1)return xr({_tag:"IConcat",left:t,right:e});if(r<-1){if(t.left.depth>=t.right.depth){const r=zr(t.right,e);return xr({_tag:"IConcat",left:t.left,right:r})}{const r=zr(t.right.right,e);if(r.depth===t.depth-3){const e=xr({_tag:"IConcat",left:t.right.left,right:r});return xr({_tag:"IConcat",left:t.left,right:e})}{const e=xr({_tag:"IConcat",left:t.left,right:t.right.left});return xr({_tag:"IConcat",left:e,right:r})}}}if(e.right.depth>=e.left.depth){const r=zr(t,e.left);return xr({_tag:"IConcat",left:r,right:e.right})}{const r=zr(t,e.left.left);if(r.depth===e.depth-3){const t=xr({_tag:"IConcat",left:r,right:e.left.right});return xr({_tag:"IConcat",left:t,right:e.right})}{const t=xr({_tag:"IConcat",left:e.left.right,right:e.right});return xr({_tag:"IConcat",left:r,right:t})}}})),Qr=t=>t.length>0,Zr=t=>Vr(t,0),Xr=Zr,tn=t=>Kr(t,1),en=Symbol.for("effect/Duration"),rn=BigInt(0),nn=BigInt(24),sn=BigInt(60),on=BigInt(1e3),cn=BigInt(1e6),un=BigInt(1e9),an=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,hn=t=>{if(pn(t))return t;if(d(t))return wn(t);if((t=>"bigint"==typeof t)(t))return yn(t);if(Array.isArray(t)&&2===t.length&&t.every(d))return t[0]===-1/0||t[1]===-1/0||Number.isNaN(t[0])||Number.isNaN(t[1])?mn:t[0]===1/0||t[1]===1/0?gn:yn(BigInt(Math.round(1e9*t[0]))+BigInt(Math.round(t[1])));if((t=>"string"==typeof t)(t)){const e=an.exec(t);if(e){const[t,r,n]=e,s=Number(r);switch(n){case"nano":case"nanos":return yn(BigInt(r));case"micro":case"micros":return Sn(BigInt(r));case"milli":case"millis":return wn(s);case"second":case"seconds":return _n(s);case"minute":case"minutes":return vn(s);case"hour":case"hours":return On(s);case"day":case"days":return En(s);case"week":case"weeks":return Mn(s)}}}throw new Error("Invalid DurationInput")},ln={_tag:"Millis",millis:0},fn={_tag:"Infinity"},bn={[en]:en,[R](){return U(this,P(this.value))},[J](t){return pn(t)&&Rn(this,t)},toString(){return`Duration(${An(this)})`},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",hrtime:In(this)};case"Infinity":return{_id:"Duration",_tag:"Infinity"}}},[Y](){return this.toJSON()},pipe(){return nt(this,arguments)}},dn=t=>{const e=Object.create(bn);return e.value=d(t)?isNaN(t)||t<=0?ln:Number.isFinite(t)?Number.isInteger(t)?{_tag:"Millis",millis:t}:{_tag:"Nanos",nanos:BigInt(Math.round(1e6*t))}:fn:t<=rn?ln:{_tag:"Nanos",nanos:t},e},pn=t=>g(t,en),mn=dn(0),gn=dn(1/0),yn=t=>dn(t),Sn=t=>dn(t*on),wn=t=>dn(t),_n=t=>dn(1e3*t),vn=t=>dn(6e4*t),On=t=>dn(36e5*t),En=t=>dn(864e5*t),Mn=t=>dn(6048e5*t),kn=t=>Nn(t,{onMillis:t=>t,onNanos:t=>Number(t)/1e6}),In=t=>{const e=hn(t);switch(e.value._tag){case"Infinity":return[1/0,0];case"Nanos":return[Number(e.value.nanos/un),Number(e.value.nanos%un)];case"Millis":return[Math.floor(e.value.millis/1e3),Math.round(e.value.millis%1e3*1e6)]}},Nn=e(2,((t,e)=>{const r=hn(t);switch(r.value._tag){case"Nanos":return e.onNanos(r.value.nanos);case"Infinity":return e.onMillis(1/0);case"Millis":return e.onMillis(r.value.millis)}})),jn=e(3,((t,e,r)=>{const n=hn(t),s=hn(e);if("Infinity"===n.value._tag||"Infinity"===s.value._tag)return r.onMillis(kn(n),kn(s));if("Nanos"===n.value._tag||"Nanos"===s.value._tag){const t="Nanos"===n.value._tag?n.value.nanos:BigInt(Math.round(1e6*n.value.millis)),e="Nanos"===s.value._tag?s.value.nanos:BigInt(Math.round(1e6*s.value.millis));return r.onNanos(t,e)}return r.onMillis(n.value.millis,s.value.millis)})),Cn=e(2,((t,e)=>jn(t,e,{onMillis:(t,e)=>t<=e,onNanos:(t,e)=>t<=e}))),Fn=e(2,((t,e)=>jn(t,e,{onMillis:(t,e)=>t>=e,onNanos:(t,e)=>t>=e}))),Rn=e(2,((t,e)=>((t,e)=>jn(t,e,{onMillis:(t,e)=>t===e,onNanos:(t,e)=>t===e}))(hn(t),hn(e)))),An=t=>{const e=hn(t);if("Infinity"===e.value._tag)return"Infinity";if((t=>{switch(t.value._tag){case"Millis":return 0===t.value.millis;case"Nanos":return t.value.nanos===rn;case"Infinity":return!1}})(e))return"0";const r=(t=>{const e=hn(t);if("Infinity"===e.value._tag)return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};const r=(t=>{const e=hn(t);switch(e.value._tag){case"Infinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return e.value.nanos;case"Millis":return BigInt(Math.round(1e6*e.value.millis))}})(e),n=r/cn,s=n/on,i=s/sn,o=i/sn;return{days:Number(o/nn),hours:Number(o%nn),minutes:Number(i%sn),seconds:Number(s%sn),millis:Number(n%on),nanos:Number(r%cn)}})(e),n=[];return 0!==r.days&&n.push(`${r.days}d`),0!==r.hours&&n.push(`${r.hours}h`),0!==r.minutes&&n.push(`${r.minutes}m`),0!==r.seconds&&n.push(`${r.seconds}s`),0!==r.millis&&n.push(`${r.millis}ms`),0!==r.nanos&&n.push(`${r.nanos}ns`),n.join(" ")},xn=Math.pow(2,5),$n=xn-1,Tn=xn/2,Ln=xn/4;function Bn(t,e){return e>>>t&$n}function Dn(t){return 1<<t}function Pn(t,e){return r=t&e-1,r=(r=(858993459&(r-=r>>1&1431655765))+(r>>2&858993459))+(r>>4)&252645135,127&(r+=r>>8)+(r>>16);var r}function qn(t,e,r,n){let s=n;if(!t){const t=n.length;s=new Array(t);for(let e=0;e<t;++e)s[e]=n[e]}return s[e]=r,s}function Un(t,e,r){const n=r.length-1;let s=0,i=0,o=r;if(t)s=i=e;else for(o=new Array(n);s<e;)o[i++]=r[s++];for(++s;s<=n;)o[i++]=r[s++];return t&&(o.length=n),o}class Jn{_tag="EmptyNode";modify(t,e,r,n,s,i){const o=r(se());return oe(o)?new Jn:(++i.value,new Vn(t,n,s,o))}}function Gn(t){return y(t,"EmptyNode")}function Hn(t,e){return!Gn(t)&&e===t.edit}class Vn{edit;hash;key;value;_tag="LeafNode";constructor(t,e,r,n){this.edit=t,this.hash=e,this.key=r,this.value=n}modify(t,e,r,n,s,i){if(G(s,this.key)){const e=r(this.value);return e===this.value?this:oe(e)?(--i.value,new Jn):Hn(this,t)?(this.value=e,this):new Vn(t,n,s,e)}const o=r(se());return oe(o)?this:(++i.value,Qn(t,e,this.hash,this,n,new Vn(t,n,s,o)))}}class Wn{edit;hash;children;_tag="CollisionNode";constructor(t,e,r){this.edit=t,this.hash=e,this.children=r}modify(t,e,r,n,s,i){if(n===this.hash){const e=Hn(this,t),n=this.updateCollisionList(e,t,this.hash,this.children,r,s,i);return n===this.children?this:n.length>1?new Wn(t,this.hash,n):n[0]}const o=r(se());return oe(o)?this:(++i.value,Qn(t,e,this.hash,this,n,new Vn(t,n,s,o)))}updateCollisionList(t,e,r,n,s,i,o){const c=n.length;for(let u=0;u<c;++u){const c=n[u];if("key"in c&&G(i,c.key)){const a=c.value,h=s(a);return h===a?n:oe(h)?(--o.value,Un(t,u,n)):qn(t,u,new Vn(e,r,i,h),n)}}const u=s(se());return oe(u)?n:(++o.value,qn(t,c,new Vn(e,r,i,u),n))}}class Yn{edit;mask;children;_tag="IndexedNode";constructor(t,e,r){this.edit=t,this.mask=e,this.children=r}modify(t,e,r,n,s,i){const o=this.mask,c=this.children,u=Bn(e,n),a=Dn(u),h=Pn(o,a),l=o&a,f=Hn(this,t);if(!l){const l=(new Jn).modify(t,e+5,r,n,s,i);return l?c.length>=Tn?function(t,e,r,n,s){const i=[];let o=n,c=0;for(let t=0;o;++t)1&o&&(i[t]=s[c++]),o>>>=1;return i[e]=r,new Kn(t,c+1,i)}(t,u,l,o,c):new Yn(t,o|a,function(t,e,r,n){const s=n.length;if(t){let t=s;for(;t>=e;)n[t--]=n[t];return n[e]=r,n}let i=0,o=0;const c=new Array(s+1);for(;i<e;)c[o++]=n[i++];for(c[e]=r;i<s;)c[++o]=n[i++];return c}(f,h,l,c)):this}const b=c[h],d=b.modify(t,e+5,r,n,s,i);if(b===d)return this;let p,m=o;if(Gn(d)){if(m&=~a,!m)return new Jn;if(c.length<=2&&(Gn(g=c[1^h])||"LeafNode"===g._tag||"CollisionNode"===g._tag))return c[1^h];p=Un(f,h,c)}else p=qn(f,h,d,c);var g;return f?(this.mask=m,this.children=p,this):new Yn(t,m,p)}}class Kn{edit;size;children;_tag="ArrayNode";constructor(t,e,r){this.edit=t,this.size=e,this.children=r}modify(t,e,r,n,s,i){let o=this.size;const c=this.children,u=Bn(e,n),a=c[u],h=(a||new Jn).modify(t,e+5,r,n,s,i);if(a===h)return this;const l=Hn(this,t);let f;if(Gn(a)&&!Gn(h))++o,f=qn(l,u,h,c);else if(!Gn(a)&&Gn(h)){if(--o,o<=Ln)return function(t,e,r,n){const s=new Array(e-1);let i=0,o=0;for(let t=0,e=n.length;t<e;++t)if(t!==r){const e=n[t];e&&!Gn(e)&&(s[i++]=e,o|=1<<t)}return new Yn(t,o,s)}(t,o,u,c);f=qn(l,u,new Jn,c)}else f=qn(l,u,h,c);return l?(this.size=o,this.children=f,this):new Kn(t,o,f)}}function zn(t,e,r,n,s,i){if(r===s)return new Wn(t,r,[i,n]);const o=Bn(e,r),c=Bn(e,s);if(o===c)return e=>new Yn(t,Dn(o)|Dn(c),[e]);{const e=o<c?[n,i]:[i,n];return new Yn(t,Dn(o)|Dn(c),e)}}function Qn(t,e,r,n,s,i){let o,c=e;for(;;){const e=zn(t,c,r,n,s,i);if("function"!=typeof e){let t=e;for(;null!=o;)t=o.value(t),o=o.previous;return t}o={value:e,previous:o},c+=5}}const Zn="effect/HashMap",Xn=Symbol.for(Zn),ts={[Xn]:Xn,[Symbol.iterator](){return new rs(this,((t,e)=>[t,e]))},[R](){let t=A(Zn);for(const e of this)t^=u(A(e[0]),$(A(e[1])));return U(this,t)},[J](t){if(us(t)){if(t._size!==this._size)return!1;for(const e of this){const r=u(t,hs(e[0],A(e[0])));if(oe(r))return!1;if(!G(e[1],r.value))return!1}return!0}return!1},toString(){return z(this.toJSON())},toJSON(){return{_id:"HashMap",values:Array.from(this).map(K)}},[Y](){return this.toJSON()},pipe(){return nt(this,arguments)}},es=(t,e,r,n)=>{const s=Object.create(ts);return s._editable=t,s._edit=e,s._root=r,s._size=n,s};class rs{map;f;v;constructor(t,e){this.map=t,this.f=e,this.v=ss(this.map._root,this.f,void 0)}next(){if(oe(this.v))return{done:!0,value:void 0};const t=this.v.value;return this.v=ns(t.cont),{done:!1,value:t.value}}[Symbol.iterator](){return new rs(this.map,this.f)}}const ns=t=>t?is(t[0],t[1],t[2],t[3],t[4]):se(),ss=(t,e,r)=>{switch(t._tag){case"LeafNode":return ce(t.value)?ie({value:e(t.key,t.value.value),cont:r}):ns(r);case"CollisionNode":case"ArrayNode":case"IndexedNode":{const n=t.children;return is(n.length,n,0,e,r)}default:return ns(r)}},is=(t,e,r,n,s)=>{for(;r<t;){const i=e[r++];if(i&&!Gn(i))return ss(i,n,[t,e,r,n,s])}return ns(s)},os=es(!1,0,new Jn,0),cs=()=>os,us=t=>g(t,Xn),as=e(2,((t,e)=>hs(t,e,A(e)))),hs=e(3,((t,e,r)=>{let n=t._root,s=0;for(;;)switch(n._tag){case"LeafNode":return G(e,n.key)?n.value:se();case"CollisionNode":if(r===n.hash){const t=n.children;for(let r=0,n=t.length;r<n;++r){const n=t[r];if("key"in n&&G(e,n.key))return n.value}}return se();case"IndexedNode":{const t=Dn(Bn(s,r));if(n.mask&t){n=n.children[Pn(n.mask,t)],s+=5;break}return se()}case"ArrayNode":if(n=n.children[Bn(s,r)],n){s+=5;break}return se();default:return se()}})),ls=e(2,((t,e)=>ce(hs(t,e,A(e))))),fs=e(3,((t,e,r)=>gs(t,e,(()=>ie(r))))),bs=e(3,((t,e,r)=>t._editable?(t._root=e,t._size=r,t):e===t._root?t:es(t._editable,t._edit,e,r))),ds=t=>new rs(t,(t=>t)),ps=t=>t._size,ms=t=>es(!0,t._edit+1,t._root,t._size),gs=e(3,((t,e,r)=>ys(t,e,A(e),r))),ys=e(4,((t,e,r,n)=>{const s={value:t._size},i=t._root.modify(t._editable?t._edit:NaN,0,n,r,e,s);return u(t,bs(i,s.value))})),Ss=e(2,((t,e)=>gs(t,e,se))),ws=e(2,((t,e)=>vs(t,cs(),((t,r,n)=>fs(t,n,e(r,n)))))),_s=e(2,((t,e)=>vs(t,void 0,((t,r,n)=>e(r,n))))),vs=e(3,((t,e,r)=>{const n=t._root;if("LeafNode"===n._tag)return ce(n.value)?r(e,n.value.value,n.key):e;if("EmptyNode"===n._tag)return e;const s=[n.children];let i;for(;i=s.pop();)for(let t=0,n=i.length;t<n;){const n=i[t++];n&&!Gn(n)&&("LeafNode"===n._tag?ce(n.value)&&(e=r(e,n.value.value,n.key)):s.push(n.children))}return e})),Os="effect/HashSet",Es=Symbol.for(Os),Ms={[Es]:Es,[Symbol.iterator](){return ds(this._keyMap)},[R](){return U(this,$(A(this._keyMap))(A(Os)))},[J](t){return!!Is(t)&&ps(this._keyMap)===ps(t._keyMap)&&G(this._keyMap,t._keyMap)},toString(){return z(this.toJSON())},toJSON(){return{_id:"HashSet",values:Array.from(this).map(K)}},[Y](){return this.toJSON()},pipe(){return nt(this,arguments)}},ks=t=>{const e=Object.create(Ms);return e._keyMap=t,e},Is=t=>g(t,Es),Ns=ks(cs()),js=()=>Ns,Cs=e(2,((t,e)=>ls(t._keyMap,e))),Fs=t=>ks(ms(t._keyMap)),Rs=t=>(t._keyMap._editable=!1,t),As=e(2,((t,e)=>{const r=Fs(t);return e(r),Rs(r)})),xs=e(2,((t,e)=>t._keyMap._editable?(fs(e,!0)(t._keyMap),t):ks(fs(e,!0)(t._keyMap)))),$s=e(2,((t,e)=>t._keyMap._editable?(Ss(e)(t._keyMap),t):ks(Ss(e)(t._keyMap)))),Ts=e(2,((t,e)=>As(t,(t=>{for(const r of e)$s(t,r)})))),Ls=e(2,((t,e)=>As(js(),(r=>{Bs(t,(t=>xs(r,t)));for(const t of e)xs(r,t)})))),Bs=e(2,((t,e)=>_s(t._keyMap,((t,r)=>e(r))))),Ds=e(3,((t,e,r)=>vs(t._keyMap,e,((t,e,n)=>r(t,n))))),Ps=js,qs=(...t)=>{const e=Fs(js());for(const r of t)xs(e,r);return Rs(e)},Us=Cs,Js=t=>ps(t._keyMap),Gs=xs,Hs=$s,Vs=Ts,Ws=Ls,Ys=Ds,Ks=Symbol.for("effect/MutableRef"),zs={[Ks]:Ks,toString(){return z(this.toJSON())},toJSON(){return{_id:"MutableRef",current:K(this.current)}},[Y](){return this.toJSON()},pipe(){return nt(this,arguments)}},Qs=t=>{const e=Object.create(zs);return e.current=t,e},Zs=e(3,((t,e,r)=>!!G(e,t.current)&&(t.current=r,!0))),Xs=t=>t.current,ti=e(2,((t,e)=>(t.current=e,t))),ei="effect/FiberId",ri=Symbol.for(ei),ni="None",si="Runtime",ii=D(`${ei}-${ni}`);let oi=class{[ri]=ri;_tag=ni;id=-1;startTimeMillis=-1;[R](){return ii}[J](t){return ai(t)&&t._tag===ni}toString(){return z(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag}}[Y](){return this.toJSON()}};class ci{id;startTimeMillis;[ri]=ri;_tag=si;constructor(t,e){this.id=t,this.startTimeMillis=e}[R](){return U(this,D(`${ei}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[J](t){return ai(t)&&t._tag===si&&this.id===t.id&&this.startTimeMillis===t.startTimeMillis}toString(){return z(this.toJSON())}toJSON(){return{_id:"FiberId",_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[Y](){return this.toJSON()}}const ui=new oi,ai=t=>g(t,ri),hi=t=>{switch(t._tag){case ni:return Ps();case si:return qs(t.id);case"Composite":return u(hi(t.left),Ws(hi(t.right)))}},li=b(Symbol.for("effect/Fiber/Id/_fiberCounter"),(()=>Qs(0))),fi=t=>Array.from(hi(t)).map((t=>`#${t}`)).join(","),bi=ui,di=fi,pi=()=>{const t=Xs(li);return u(li,ti(t+1)),new ci(t,Date.now())},mi=cs,gi=as,yi=fs,Si=ds,wi=gs,_i=ws,vi=vs,Oi=Symbol.for("effect/List"),Ei=t=>ve(t),Mi=(()=>h(Ze(G),Ei))(),ki={[Oi]:Oi,_tag:"Cons",toString(){return z(this.toJSON())},toJSON(){return{_id:"List",_tag:"Cons",values:Ei(this).map(K)}},[Y](){return this.toJSON()},[J](t){return Fi(t)&&this._tag===t._tag&&Mi(this,t)},[R](){return U(this,q(Ei(this)))},[Symbol.iterator](){let t=!1,e=this;return{next(){if(t)return this.return();if("Nil"===e._tag)return t=!0,this.return();const r=e.head;return e=e.tail,{done:t,value:r}},return:e=>(t||(t=!0),{done:!0,value:e})}},pipe(){return nt(this,arguments)}},Ii=(t,e)=>{const r=Object.create(ki);return r.head=t,r.tail=e,r},Ni=D("Nil"),ji={[Oi]:Oi,_tag:"Nil",toString(){return z(this.toJSON())},toJSON:()=>({_id:"List",_tag:"Nil"}),[Y](){return this.toJSON()},[R]:()=>Ni,[J](t){return Fi(t)&&this._tag===t._tag},[Symbol.iterator]:()=>({next:()=>({done:!0,value:void 0})}),pipe(){return nt(this,arguments)}},Ci=Object.create(ji),Fi=t=>g(t,Oi),Ri=t=>"Nil"===t._tag,Ai=(t,e)=>Ii(t,e),xi=()=>Ci,$i=t=>Ii(t,Ci),Ti=e(2,((t,e)=>Bi(e,t))),Li=e(2,((t,e)=>Ai(e,t))),Bi=e(2,((t,e)=>{if(Ri(t))return e;if(Ri(e))return t;{const r=Ii(e.head,t);let n=r,s=e.tail;for(;!Ri(s);){const e=Ii(s.head,t);n.tail=e,n=e,s=s.tail}return r}})),Di=e(3,((t,e,r)=>{let n=e,s=t;for(;!Ri(s);)n=r(n,s.head),s=s.tail;return n})),Pi=t=>{let e=xi(),r=t;for(;!Ri(r);)e=Li(e,r.head),r=r.tail;return e},qi=function(){function t(t){t&&Object.assign(this,t)}return t.prototype=kt,t}(),Ui=t=>Object.assign(Object.create(kt),t),Ji=Symbol.for("effect/DifferContextPatch");function Gi(t){return t}const Hi={...qi.prototype,[Ji]:{_Value:Gi,_Patch:Gi}},Vi=Object.create(Object.assign(Object.create(Hi),{_tag:"Empty"})),Wi=()=>Vi,Yi=Object.assign(Object.create(Hi),{_tag:"AndThen"}),Ki=Object.assign(Object.create(Hi),{_tag:"AddService"}),zi=(t,e)=>{const r=Object.create(Ki);return r.key=t,r.service=e,r},Qi=Object.assign(Object.create(Hi),{_tag:"RemoveService"}),Zi=t=>{const e=Object.create(Qi);return e.key=t,e},Xi=Object.assign(Object.create(Hi),{_tag:"UpdateService"}),to=(t,e)=>{const r=Object.create(Xi);return r.key=t,r.update=e,r},eo=e(2,((t,e)=>((t,e)=>{const r=Object.create(Yi);return r.first=t,r.second=e,r})(t,e))),ro=e(2,((t,e)=>{if("Empty"===t._tag)return e;let r=!1,n=Dr(t);const s=new Map(e.unsafeMap);for(;Qr(n);){const t=Xr(n),e=tn(n);switch(t._tag){case"Empty":n=e;break;case"AddService":s.set(t.key,t.service),n=e;break;case"AndThen":n=Yr(Yr(e,t.second),t.first);break;case"RemoveService":s.delete(t.key),n=e;break;case"UpdateService":s.set(t.key,t.update(s.get(t.key))),r=!0,n=e}}if(!r)return hr(s);const i=new Map;for(const[t]of e.unsafeMap)s.has(t)&&(i.set(t,s.get(t)),s.delete(t));for(const[t,e]of s)i.set(t,e);return hr(i)})),no=Symbol.for("effect/DifferHashSetPatch");function so(t){return t}const io={...qi.prototype,[no]:{_Value:so,_Key:so,_Patch:so}},oo=Object.create(Object.assign(Object.create(io),{_tag:"Empty"})),co=()=>oo,uo=Object.assign(Object.create(io),{_tag:"AndThen"}),ao=Object.assign(Object.create(io),{_tag:"Add"}),ho=t=>{const e=Object.create(ao);return e.value=t,e},lo=Object.assign(Object.create(io),{_tag:"Remove"}),fo=e(2,((t,e)=>((t,e)=>{const r=Object.create(uo);return r.first=t,r.second=e,r})(t,e))),bo=e(2,((t,e)=>{if("Empty"===t._tag)return e;let r=e,n=Dr(t);for(;Qr(n);){const t=Xr(n),e=tn(n);switch(t._tag){case"Empty":n=e;break;case"AndThen":n=Yr(t.first)(Yr(t.second)(e));break;case"Add":r=Gs(t.value)(r),n=e;break;case"Remove":r=Hs(t.value)(r),n=e}}return r})),po=Symbol.for("effect/DifferReadonlyArrayPatch");function mo(t){return t}const go={...qi.prototype,[po]:{_Value:mo,_Patch:mo}},yo=Object.create(Object.assign(Object.create(go),{_tag:"Empty"})),So=()=>yo,wo=Object.assign(Object.create(go),{_tag:"AndThen"}),_o=Object.assign(Object.create(go),{_tag:"Append"}),vo=Object.assign(Object.create(go),{_tag:"Slice"}),Oo=Object.assign(Object.create(go),{_tag:"Update"}),Eo=(t,e)=>{const r=Object.create(Oo);return r.index=t,r.patch=e,r},Mo=e(2,((t,e)=>((t,e)=>{const r=Object.create(wo);return r.first=t,r.second=e,r})(t,e))),ko=e(3,((t,e,r)=>{if("Empty"===t._tag)return e;let n=e.slice(),s=We(t);for(;ke(s);){const t=Re(s),e=xe(s);switch(t._tag){case"Empty":s=e;break;case"AndThen":e.unshift(t.first,t.second),s=e;break;case"Append":for(const e of t.values)n.push(e);s=e;break;case"Slice":n=n.slice(t.from,t.until),s=e;break;case"Update":n[t.index]=r.patch(t.patch,n[t.index]),s=e}}return n})),Io=Symbol.for("effect/Differ"),No={[Io]:{_P:r,_V:r},pipe(){return nt(this,arguments)}},jo=t=>{const e=Object.create(No);return e.empty=t.empty,e.diff=t.diff,e.combine=t.combine,e.patch=t.patch,e},Co=()=>Fo(((t,e)=>e)),Fo=t=>jo({empty:r,combine:(t,e)=>t===r?e:e===r?t:r=>e(t(r)),diff:(t,e)=>G(t,e)?r:n(e),patch:(e,r)=>t(r,e(r))}),Ro=255,Ao=t=>t&Ro,xo=t=>t>>8&Ro,$o=(t,e)=>(t&Ro)+((e&t&Ro)<<8),To=$o(0,0),Lo=e(2,((t,e)=>$o(Ao(t)&~e,xo(t)))),Bo=e(2,((t,e)=>t|e)),Do=e(2,((t,e)=>t|e)),Po=t=>qo(t)&&!Vo(t),qo=t=>Uo(t,1),Uo=e(2,((t,e)=>!!(t&e))),Jo=(...t)=>t.reduce(((t,e)=>t|e),0),Go=Jo(0),Ho=t=>Uo(t,4),Vo=t=>Uo(t,16),Wo=e(2,((t,e)=>$o(t^e,e))),Yo=e(2,((t,e)=>t&(~Ao(e)>>>0&Ro|xo(e))|Ao(e)&xo(e))),Ko=jo({empty:To,diff:(t,e)=>Wo(t,e),combine:(t,e)=>Bo(e)(t),patch:(t,e)=>Yo(e,t)}),zo=t=>$o(t,0),Qo=Lo,Zo=(t,e)=>({_tag:"Par",left:t,right:e}),Xo=(t,e)=>({_tag:"Seq",left:t,right:e}),tc=t=>{let e=t,r=ic(),n=xi(),s=xi();for(;;)switch(e._tag){case"Empty":if(Ri(n))return[r,s];e=n.head,n=n.tail;break;case"Par":n=Ai(e.right,n),e=e.left;break;case"Seq":{const t=e.left,r=e.right;switch(t._tag){case"Empty":e=r;break;case"Par":{const n=t.right;e=Zo(Xo(t.left,r),Xo(n,r));break}case"Seq":e=Xo(t.left,Xo(t.right,r));break;case"Single":e=t,s=Ai(r,s)}break}case"Single":if(r=oc(r,e),Ri(n))return[r,s];e=n.head,n=n.tail}throw new Error("BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues")},ec=(t,e)=>{if(Ri(t))return $i(hc(e));if(uc(e))return t;const r=mc(t.head),n=ac(e);return 1===r.length&&1===n.length&&G(r[0],n[0])?Ai(pc(t.head,hc(e)),t.tail):Ai(hc(e),t)},rc=Symbol.for("effect/RequestBlock/RequestBlockParallel"),nc={_R:t=>t};class sc{map;[rc]=nc;constructor(t){this.map=t}}const ic=()=>new sc(mi()),oc=(t,e)=>new sc(wi(t.map,e.dataSource,(t=>le(pe(t,Wr(e.blockedRequest)),(()=>Dr(e.blockedRequest)))))),cc=(t,e)=>new sc(vi(t.map,e.map,((t,e,r)=>yi(t,r,ue(gi(t,r),{onNone:()=>e,onSome:t=>zr(e,t)}))))),uc=t=>(t=>t&&Gn(t._root))(t.map),ac=t=>Array.from(Si(t.map)),hc=t=>dc(_i(t.map,(t=>Dr(t)))),lc=Symbol.for("effect/RequestBlock/RequestBlockSequential"),fc={_R:t=>t};class bc{map;[lc]=fc;constructor(t){this.map=t}}const dc=t=>new bc(t),pc=(t,e)=>new bc(vi(e.map,t.map,((t,e,r)=>yi(t,r,ue(gi(t,r),{onNone:()=>Lr(),onSome:t=>zr(t,e)}))))),mc=t=>Array.from(Si(t.map)),gc="Die",yc="Empty",Sc="Fail",wc="Interrupt",_c="Parallel",vc="Sequential",Oc="effect/Cause",Ec=Symbol.for(Oc),Mc={[Ec]:{_E:t=>t},[R](){return u(A(Oc),$(A(Bc(this))),U(this))},[J](t){return Rc(t)&&Lc(this,t)},pipe(){return nt(this,arguments)},toJSON(){switch(this._tag){case"Empty":return{_id:"Cause",_tag:this._tag};case"Die":return{_id:"Cause",_tag:this._tag,defect:K(this.defect)};case"Interrupt":return{_id:"Cause",_tag:this._tag,fiberId:this.fiberId.toJSON()};case"Fail":return{_id:"Cause",_tag:this._tag,failure:K(this.error)};case"Sequential":case"Parallel":return{_id:"Cause",_tag:this._tag,left:K(this.left),right:K(this.right)}}},toString(){return Yc(this)},[Y](){return this.toJSON()}},kc=(()=>{const t=Object.create(Mc);return t._tag=yc,t})(),Ic=t=>{const e=Object.create(Mc);return e._tag=Sc,e.error=t,e},Nc=t=>{const e=Object.create(Mc);return e._tag=gc,e.defect=t,e},jc=t=>{const e=Object.create(Mc);return e._tag=wc,e.fiberId=t,e},Cc=(t,e)=>{const r=Object.create(Mc);return r._tag=_c,r.left=t,r.right=e,r},Fc=(t,e)=>{const r=Object.create(Mc);return r._tag=vc,r.left=t,r.right=e,r},Rc=t=>g(t,Ec),Ac=t=>Wc(void 0,Uc)(t),xc=t=>Jr(Vc(t,Lr(),((t,e)=>e._tag===gc?ie(u(t,Yr(e.defect))):se()))),$c=t=>{const e=(t=>Pc(t,(t=>t._tag===Sc?ie(t.error):se())))(t);switch(e._tag){case"None":return Wt(t);case"Some":return Yt(e.value)}},Tc=t=>Hc(t,{onEmpty:kc,onFail:()=>kc,onDie:Nc,onInterrupt:jc,onSequential:Fc,onParallel:Cc}),Lc=(t,e)=>{let r=Dr(t),n=Dr(e);for(;Qr(r)&&Qr(n);){const[t,e]=u(Xr(r),Vc([Ps(),Lr()],(([t,e],r)=>{const[n,s]=qc(r);return ie([u(t,Ws(n)),u(e,zr(s))])}))),[s,i]=u(Xr(n),Vc([Ps(),Lr()],(([t,e],r)=>{const[n,s]=qc(r);return ie([u(t,Ws(n)),u(e,zr(s))])})));if(!G(t,s))return!1;r=e,n=i}return!0},Bc=t=>Dc(Dr(t),Lr()),Dc=(t,e)=>{for(;;){const[r,n]=u(t,ze([Ps(),Lr()],(([t,e],r)=>{const[n,s]=qc(r);return[u(t,Ws(n)),u(e,zr(s))]}))),s=Js(r)>0?u(e,Yr(r)):e;if(0===n.length)return Jr(s);t=n,e=s}throw new Error(_("Cause.flattenCauseLoop"))},Pc=e(2,((t,e)=>{const r=[t];for(;r.length>0;){const t=r.pop(),n=e(t);switch(n._tag){case"None":switch(t._tag){case vc:case _c:r.push(t.right),r.push(t.left)}break;case"Some":return n}}return se()})),qc=t=>{let e=t;const r=[];let n=Ps(),s=Lr();for(;void 0!==e;)switch(e._tag){case yc:if(0===r.length)return[n,s];e=r.pop();break;case Sc:if(n=Gs(n,Br(e._tag,e.error)),0===r.length)return[n,s];e=r.pop();break;case gc:if(n=Gs(n,Br(e._tag,e.defect)),0===r.length)return[n,s];e=r.pop();break;case wc:if(n=Gs(n,Br(e._tag,e.fiberId)),0===r.length)return[n,s];e=r.pop();break;case vc:switch(e.left._tag){case yc:e=e.right;break;case vc:e=Fc(e.left.left,Fc(e.left.right,e.right));break;case _c:e=Cc(Fc(e.left.left,e.right),Fc(e.left.right,e.right));break;default:s=Yr(s,e.right),e=e.left}break;case _c:r.push(e.right),e=e.left}throw new Error(_("Cause.evaluateCauseLoop"))},Uc={emptyCase:s,failCase:i,dieCase:i,interruptCase:s,sequentialCase:(t,e,r)=>e&&r,parallelCase:(t,e,r)=>e&&r},Jc="SequentialCase",Gc="ParallelCase",Hc=e(2,((t,{onDie:e,onEmpty:r,onFail:n,onInterrupt:s,onParallel:i,onSequential:o})=>Wc(t,void 0,{emptyCase:()=>r,failCase:(t,e)=>n(e),dieCase:(t,r)=>e(r),interruptCase:(t,e)=>s(e),sequentialCase:(t,e,r)=>o(e,r),parallelCase:(t,e,r)=>i(e,r)}))),Vc=e(3,((t,e,r)=>{let n=e,s=t;const i=[];for(;void 0!==s;){const t=r(n,s);switch(n=ce(t)?t.value:n,s._tag){case vc:case _c:i.push(s.right),s=s.left;break;default:s=void 0}void 0===s&&i.length>0&&(s=i.pop())}return n})),Wc=e(3,((t,e,r)=>{const n=[t],s=[];for(;n.length>0;){const t=n.pop();switch(t._tag){case yc:s.push(Wt(r.emptyCase(e)));break;case Sc:s.push(Wt(r.failCase(e,t.error)));break;case gc:s.push(Wt(r.dieCase(e,t.defect)));break;case wc:s.push(Wt(r.interruptCase(e,t.fiberId)));break;case vc:n.push(t.right),n.push(t.left),s.push(Yt({_tag:Jc}));break;case _c:n.push(t.right),n.push(t.left),s.push(Yt({_tag:Gc}))}}const i=[];for(;s.length>0;){const t=s.pop();switch(t._tag){case"Left":switch(t.left._tag){case Jc:{const t=i.pop(),n=i.pop(),s=r.sequentialCase(e,t,n);i.push(s);break}case Gc:{const t=i.pop(),n=i.pop(),s=r.parallelCase(e,t,n);i.push(s);break}}break;case"Right":i.push(t.right)}}if(0===i.length)throw new Error("BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues");return i.pop()})),Yc=(t,e)=>Ac(t)?"All fibers interrupted without errors.":ru(t).map((function(t){return!0!==e?.renderErrorCause||void 0===t.cause?t.stack:`${t.stack} {\n${Kc(t.cause," ")}\n}`})).join("\n"),Kc=(t,e)=>{const r=t.stack.split("\n");let n=`${e}[cause]: ${r[0]}`;for(let t=1,s=r.length;t<s;t++)n+=`\n${e}${r[t]}`;return t.cause&&(n+=` {\n${Kc(t.cause,`${e} `)}\n${e}}`),n};class zc extends globalThis.Error{span=void 0;constructor(t){const e="object"==typeof t&&null!==t,r=Error.stackTraceLimit;Error.stackTraceLimit=1,super(Qc(t),e&&"cause"in t&&void 0!==t.cause?{cause:new zc(t.cause)}:void 0),""===this.message&&(this.message="An error has occurred"),Error.stackTraceLimit=r,this.name=t instanceof Error?t.name:"Error",e&&(eu in t&&(this.span=t[eu]),Object.keys(t).forEach((e=>{e in this||(this[e]=t[e])}))),this.stack=tu(`${this.name}: ${this.message}`,t instanceof Error&&t.stack?t.stack:"",this.span)}}const Qc=t=>{if("string"==typeof t)return t;if("object"==typeof t&&null!==t&&t instanceof Error)return t.message;try{if(g(t,"toString")&&p(t.toString)&&t.toString!==Object.prototype.toString&&t.toString!==globalThis.Array.prototype.toString)return t.toString()}catch{}return Z(t)},Zc=/\((.*)\)/g,Xc=b("effect/Tracer/spanToTrace",(()=>new WeakMap)),tu=(t,e,r)=>{const n=[t],s=e.startsWith(t)?e.slice(t.length).split("\n"):e.split("\n");for(let t=1;t<s.length;t++)if(s[t].includes(" at new BaseEffectError")||s[t].includes(" at new YieldableError"))t++;else{if(s[t].includes("Generator.next"))break;if(s[t].includes("effect_internal_function"))break;n.push(s[t].replace(/at .*effect_instruction_i.*\((.*)\)/,"at $1").replace(/EffectPrimitive\.\w+/,"<anonymous>"))}if(r){let t=r,e=0;for(;t&&"Span"===t._tag&&e<10;){const r=Xc.get(t);if("function"==typeof r){const e=r();if("string"==typeof e){const r=e.matchAll(Zc);let s=!1;for(const[,e]of r)s=!0,n.push(` at ${t.name} (${e})`);s||n.push(` at ${t.name} (${e.replace(/^at /,"")})`)}else n.push(` at ${t.name}`)}else n.push(` at ${t.name}`);t=be(t.parent),e++}}return n.join("\n")},eu=Symbol.for("effect/SpanAnnotation"),ru=t=>Wc(t,void 0,{emptyCase:()=>[],dieCase:(t,e)=>[new zc(e)],failCase:(t,e)=>[new zc(e)],interruptCase:()=>[],parallelCase:(t,e,r)=>[...e,...r],sequentialCase:(t,e,r)=>[...e,...r]}),nu="Pending",su="Done",iu=Symbol.for("effect/Deferred"),ou={_E:t=>t,_A:t=>t},cu=t=>({_tag:su,effect:t});class uu{self;called=!1;constructor(t){this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(t){return{value:t,done:!0}}throw(t){throw t}[Symbol.iterator](){return new uu(this.self)}}const au=(t,e)=>{const r=new fu("Blocked");return r.effect_instruction_i0=t,r.effect_instruction_i1=e,r},hu=Symbol.for("effect/Effect");class lu{patch;op;_op=yt;constructor(t,e){this.patch=t,this.op=e}}class fu{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[hu]=Et;constructor(t){this._op=t}[J](t){return this===t}[R](){return U(this,x(this))}pipe(){return nt(this,arguments)}toJSON(){return{_id:"Effect",_op:this._op,effect_instruction_i0:K(this.effect_instruction_i0),effect_instruction_i1:K(this.effect_instruction_i1),effect_instruction_i2:K(this.effect_instruction_i2)}}toString(){return z(this.toJSON())}[Y](){return this.toJSON()}[Symbol.iterator](){return new uu(new k(this))}}class bu{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[hu]=Et;constructor(t){this._op=t,this._tag=t}[J](t){return Za(t)&&"Failure"===t._op&&G(this.effect_instruction_i0,t.effect_instruction_i0)}[R](){return u(D(this._tag),$(A(this.effect_instruction_i0)),U(this))}get cause(){return this.effect_instruction_i0}pipe(){return nt(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,cause:this.cause.toJSON()}}toString(){return z(this.toJSON())}[Y](){return this.toJSON()}[Symbol.iterator](){return new uu(new k(this))}}class du{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[hu]=Et;constructor(t){this._op=t,this._tag=t}[J](t){return Za(t)&&"Success"===t._op&&G(this.effect_instruction_i0,t.effect_instruction_i0)}[R](){return u(D(this._tag),$(A(this.effect_instruction_i0)),U(this))}get value(){return this.effect_instruction_i0}pipe(){return nt(this,arguments)}toJSON(){return{_id:"Exit",_tag:this._op,value:K(this.value)}}toString(){return z(this.toJSON())}[Y](){return this.toJSON()}[Symbol.iterator](){return new uu(new k(this))}}const pu=t=>g(t,hu),mu=t=>{const e=new fu(mt);return e.effect_instruction_i0=t,e},gu=e(3,((t,e,r)=>na((n=>Tu(t,(t=>Tu(ju(Zu((()=>n(e(t))))),(e=>Zu((()=>r(t,e))).pipe(Pu({onFailure:t=>{switch(e._tag){case ot:return Ru(Fc(e.effect_instruction_i0,t));case ht:return Ru(t)}},onSuccess:()=>e})))))))))),yu=e(2,((t,e)=>Tu(t,(()=>Qu(e))))),Su=t=>yu(t,void 0),wu=function(){const t=new fu(it);switch(arguments.length){case 2:t.effect_instruction_i0=arguments[0],t.commit=arguments[1];break;case 3:t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.commit=arguments[2];break;case 4:t.effect_instruction_i0=arguments[0],t.effect_instruction_i1=arguments[1],t.effect_instruction_i2=arguments[2],t.commit=arguments[3];break;default:throw new Error(_("you're not supposed to end up here"))}return t},_u=(t,e=bi)=>{const r=new fu(st);let n;return r.effect_instruction_i0=e=>{n=t(e)},r.effect_instruction_i1=e,Ku(r,(()=>pu(n)?n:sa))},vu=(t,e=bi)=>wu(t,(function(){let t,r;function n(e){t?t(e):void 0===r&&(r=e)}const s=new fu(st);let i,o;return s.effect_instruction_i0=e=>{t=e,r&&e(r)},s.effect_instruction_i1=e,1!==this.effect_instruction_i0.length?(o=new AbortController,i=C((()=>this.effect_instruction_i0(n,o.signal)))):i=C((()=>this.effect_instruction_i0(n))),i||o?Ku(s,(()=>(o&&o.abort(),i??sa))):s})),Ou=e(2,((t,e)=>qu(t,{onFailure:e,onSuccess:Qu}))),Eu=Symbol.for("effect/OriginalAnnotation"),Mu=(t,e)=>ce(e)?new Proxy(t,{has:(t,e)=>e===eu||e===Eu||e in t,get:(r,n)=>n===eu?e.value:n===Eu?t:r[n]}):t,ku=t=>m(t)&&!(eu in t)?mu((e=>Ru(Nc(Mu(t,wh(e)))))):Ru(Nc(t)),Iu=t=>Au((()=>Nc(new Va(t)))),Nu=t=>qu(t,{onFailure:t=>Qu(Yt(t)),onSuccess:t=>Qu(Wt(t))}),ju=t=>Du(t,{onFailure:eh,onSuccess:sh}),Cu=t=>m(t)&&!(eu in t)?mu((e=>Ru(Ic(Mu(t,wh(e)))))):Ru(Ic(t)),Fu=t=>Tu(Xu(t),Cu),Ru=t=>{const e=new bu(ot);return e.effect_instruction_i0=t,e},Au=t=>Tu(Xu(t),Ru),xu=mu((t=>Qu(t.id()))),$u=t=>mu((e=>t(e.id()))),Tu=e(2,((t,e)=>{const r=new fu(ut);return r.effect_instruction_i0=t,r.effect_instruction_i1=e,r})),Lu=t=>{const e=new fu("OnStep");return e.effect_instruction_i0=t,e},Bu=t=>Tu(t,r),Du=e(2,((t,e)=>Pu(t,{onFailure:t=>Qu(e.onFailure(t)),onSuccess:t=>Qu(e.onSuccess(t))}))),Pu=e(2,((t,e)=>{const r=new fu(at);return r.effect_instruction_i0=t,r.effect_instruction_i1=e.onFailure,r.effect_instruction_i2=e.onSuccess,r})),qu=e(2,((t,e)=>Pu(t,{onFailure:t=>{if(xc(t).length>0)return Ru((t=>Hc(t,{onEmpty:kc,onFail:Nc,onDie:Nc,onInterrupt:jc,onSequential:Fc,onParallel:Cc}))(t));const r=(t=>Jr(Vc(t,Lr(),((t,e)=>e._tag===Sc?ie(u(t,Yr(e.error))):se()))))(t);return r.length>0?e.onFailure(Zr(r)):Ru(t)},onSuccess:e.onSuccess}))),Uu=e(2,((t,e)=>Zu((()=>{const r=ve(t),n=we(r.length);let s=0;return yu(ia({while:()=>s<r.length,body:()=>e(r[s],s),step:t=>{n[s++]=t}}),n)})))),Ju=e(2,((t,e)=>Zu((()=>{const r=ve(t);let n=0;return ia({while:()=>n<r.length,body:()=>e(r[n],n),step:()=>{n++}})})))),Gu=t=>{const e=new fu(bt);return e.effect_instruction_i0=$o(r=1,r),e.effect_instruction_i1=()=>t,e;var r},Hu=e(2,((t,e)=>Tu(t,(t=>Xu((()=>e(t))))))),Vu=e(2,((t,e)=>qu(t,{onFailure:t=>Fu((()=>e.onFailure(t))),onSuccess:t=>Xu((()=>e.onSuccess(t)))}))),Wu=e(2,((t,e)=>Pu(t,{onFailure:t=>{const r=$c(t);switch(r._tag){case"Left":return Fu((()=>e(r.left)));case"Right":return Ru(r.right)}},onSuccess:Qu}))),Yu=e(2,((t,e)=>na((r=>Pu(r(t),{onFailure:t=>{const r=eh(t);return Pu(e(r),{onFailure:e=>eh(Fc(t,e)),onSuccess:()=>r})},onSuccess:t=>{const r=sh(t);return aa(e(r),r)}}))))),Ku=e(2,((t,e)=>Yu(t,nh({onFailure:t=>Ac(t)?Su(e((t=>Vc(t,Ps(),((t,e)=>e._tag===wc?ie(u(t,Gs(e.fiberId))):se())))(t))):sa,onSuccess:()=>sa})))),zu=e(2,((t,e)=>ea(t,e,Qu))),Qu=t=>{const e=new du(ht);return e.effect_instruction_i0=t,e},Zu=t=>{const e=new fu(it);return e.commit=t,e},Xu=t=>{const e=new fu(lt);return e.effect_instruction_i0=t,e},ta=e((t=>3===t.length||2===t.length&&!(m(t[1])&&"onlyEffect"in t[1])),((t,e)=>Tu(t,(t=>{const r="function"==typeof e?e(t):e;return pu(r)?yu(r,t):g(n=r,"then")&&p(n.then)?_u((e=>{r.then((()=>e(Qu(t))),(t=>e(Cu(new Qa(t,"An unknown error occurred in Effect.tap")))))})):Qu(t);var n})))),ea=e(3,((t,e,r)=>Pu(t,{onFailure:t=>xc(t).length>0?Ru(de((t=>Hc(t,{onEmpty:se(),onFail:t=>ie(Nc(t)),onDie:t=>ie(Nc(t)),onInterrupt:()=>se(),onSequential:ye(Fc),onParallel:ye(Cc)}))(t))):e(),onSuccess:r}))),ra=t=>{const e=new fu(bt);return e.effect_instruction_i0=zo(1),e.effect_instruction_i1=()=>t,e},na=t=>wu(t,(function(){const t=new fu(bt);return t.effect_instruction_i0=zo(1),t.effect_instruction_i1=t=>qo(t)?C((()=>this.effect_instruction_i0(Gu))):C((()=>this.effect_instruction_i0(ra))),t})),sa=Qu(void 0),ia=t=>{const e=new fu(dt);return e.effect_instruction_i0=t.while,e.effect_instruction_i1=t.body,e.effect_instruction_i2=t.step,e},oa=t=>{const e=new fu(gt);return void 0!==t?.priority?xa(e,t.priority):e},ca=e(2,((t,e)=>Tu(t,(t=>Hu(e,(e=>[t,e])))))),ua=e(2,((t,e)=>Tu(t,(t=>yu(e,t))))),aa=e(2,((t,e)=>Tu(t,(()=>e)))),ha=e(2,((t,e)=>Tu(t.interruptAsFork(e),(()=>t.await)))),la={_tag:"Error",syslog:3,label:"ERROR",ordinal:4e4,pipe(){return nt(this,arguments)}},fa={_tag:"Warning",syslog:4,label:"WARN",ordinal:3e4,pipe(){return nt(this,arguments)}},ba={_tag:"Info",syslog:6,label:"INFO",ordinal:2e4,pipe(){return nt(this,arguments)}},da={_tag:"Debug",syslog:7,label:"DEBUG",ordinal:1e4,pipe(){return nt(this,arguments)}},pa=Symbol.for("effect/FiberRef"),ma={_A:t=>t},ga=t=>mu((e=>sh(e.getFiberRef(t)))),ya=e(2,((t,e)=>Tu(ga(t),e))),Sa=e(2,((t,e)=>wa(t,(()=>[void 0,e])))),wa=e(2,((t,e)=>mu((r=>{const[n,s]=e(r.getFiberRef(t));return r.setFiberRef(t,s),Qu(n)})))),_a=e(3,((t,e,r)=>gu(ua(ga(e),Sa(e,r)),(()=>t),(t=>Sa(e,t))))),va=(t,e)=>ka(t,{differ:Co(),fork:e?.fork??r,join:e?.join}),Oa=t=>{const e=jo({empty:co(),combine:(t,e)=>fo(e)(t),diff:(t,e)=>((t,e)=>{const[r,n]=Ys([t,co()],(([t,e],r)=>Us(r)(t)?[Hs(r)(t),e]:[t,fo(ho(r))(e)]))(e);return Ys(n,((t,e)=>fo((t=>{const e=Object.create(lo);return e.value=t,e})(e))(t)))(r)})(t,e),patch:(t,e)=>bo(e)(t)});return ka(t,{differ:e,fork:e.empty})},Ea=t=>{const e=(t=>jo({empty:So(),combine:(t,e)=>Mo(t,e),diff:(e,r)=>(t=>{let e=0,r=So();for(;e<t.oldValue.length&&e<t.newValue.length;){const n=t.differ.diff(t.oldValue[e],t.newValue[e]);G(n,t.differ.empty)||(r=Mo(r,Eo(e,n))),e+=1}return e<t.oldValue.length&&(r=Mo(r,((t,e)=>{const r=Object.create(vo);return r.from=0,r.until=e,r})(0,e))),e<t.newValue.length&&(r=Mo(r,(t=>{const e=Object.create(_o);return e.values=t,e})(Te(e)(t.newValue)))),r})({oldValue:e,newValue:r,differ:t}),patch:(e,r)=>ko(e,r,t)}))(Co());return ka(t,{differ:e,fork:e.empty})},Ma=t=>{const e=jo({empty:Wi(),combine:(t,e)=>eo(e)(t),diff:(t,e)=>((t,e)=>{const r=new Map(t.unsafeMap);let n=Wi();for(const[t,s]of e.unsafeMap.entries())if(r.has(t)){const e=r.get(t);r.delete(t),G(e,s)||(n=eo(to(t,(()=>s)))(n))}else r.delete(t),n=eo(zi(t,s))(n);for(const[t]of r.entries())n=eo(Zi(t))(n);return n})(t,e),patch:(t,e)=>ro(e)(t)});return ka(t,{differ:e,fork:e.empty})},ka=(t,e)=>({...It,[pa]:ma,initial:t,commit(){return ga(this)},diff:(t,r)=>e.differ.diff(t,r),combine:(t,r)=>e.differ.combine(t,r),patch:t=>r=>e.differ.patch(t,r),fork:e.fork,join:e.join??((t,e)=>e)}),Ia=t=>ka(t,{differ:Ko,fork:Ko.empty}),Na=b(Symbol.for("effect/FiberRef/currentContext"),(()=>Ma(vr()))),ja=b(Symbol.for("effect/FiberRef/currentSchedulingPriority"),(()=>va(0))),Ca=b(Symbol.for("effect/FiberRef/currentMaxOpsBeforeYield"),(()=>va(2048))),Fa=b(Symbol.for("effect/FiberRef/currentLogAnnotation"),(()=>va(mi()))),Ra=b(Symbol.for("effect/FiberRef/currentLogLevel"),(()=>va(ba))),Aa=b(Symbol.for("effect/FiberRef/currentLogSpan"),(()=>va(xi()))),xa=e(2,((t,e)=>_a(t,ja,e))),$a=b(Symbol.for("effect/FiberRef/currentConcurrency"),(()=>va("unbounded"))),Ta=b(Symbol.for("effect/FiberRef/currentRequestBatching"),(()=>va(!0))),La=b(Symbol.for("effect/FiberRef/currentUnhandledErrorLogLevel"),(()=>va(ie(da)))),Ba=b(Symbol.for("effect/FiberRef/versionMismatchErrorLogLevel"),(()=>va(ie(fa)))),Da=b(Symbol.for("effect/FiberRef/currentMetricLabels"),(()=>Ea([]))),Pa=b(Symbol.for("effect/FiberRef/currentForkScopeOverride"),(()=>va(se(),{fork:()=>se(),join:t=>t}))),qa=b(Symbol.for("effect/FiberRef/currentInterruptedCause"),(()=>va(kc,{fork:()=>kc,join:t=>t}))),Ua=(t,e)=>t.fork(e),Ja=function(){class t extends globalThis.Error{commit(){return Cu(this)}toJSON(){const t={...this};return this.message&&(t.message=this.message),this.cause&&(t.cause=this.cause),t}[Y](){return this.toString!==globalThis.Error.prototype.toString?this.stack?`${this.toString()}\n${this.stack.split("\n").slice(1).join("\n")}`:this.toString():"Bun"in globalThis?Yc(Ic(this),{renderErrorCause:!0}):this}}return Object.assign(t.prototype,Nt),t}(),Ga=(t,e)=>{class r extends Ja{_tag=e}return Object.assign(r.prototype,t),r.prototype.name=e,r},Ha=Symbol.for("effect/Cause/errors/RuntimeException"),Va=Ga({[Ha]:Ha},"RuntimeException"),Wa=Symbol.for("effect/Cause/errors/InterruptedException"),Ya=Symbol.for("effect/Cause/errors/NoSuchElement"),Ka=Ga({[Ya]:Ya},"NoSuchElementException"),za=Symbol.for("effect/Cause/errors/UnknownException"),Qa=function(){class t extends Ja{_tag="UnknownException";error;constructor(t,e){super(e??"An unknown error occurred",{cause:t}),this.error=t}}return Object.assign(t.prototype,{[za]:za,name:"UnknownException"}),t}(),Za=t=>pu(t)&&"_tag"in t&&("Success"===t._tag||"Failure"===t._tag),Xa=(t,e)=>ch(t,e?.parallel?Cc:Fc),th=t=>eh(Ic(t)),eh=t=>{const e=new bu(ot);return e.effect_instruction_i0=t,e},rh=e(2,((t,e)=>{switch(t._tag){case ot:return eh(t.effect_instruction_i0);case ht:return sh(e(t.effect_instruction_i0))}})),nh=e(2,((t,{onFailure:e,onSuccess:r})=>{switch(t._tag){case ot:return e(t.effect_instruction_i0);case ht:return r(t.effect_instruction_i0)}})),sh=t=>{const e=new du(ht);return e.effect_instruction_i0=t,e},ih=sh(void 0),oh=e(3,((t,e,{onFailure:r,onSuccess:n})=>{switch(t._tag){case ot:switch(e._tag){case ht:return eh(t.effect_instruction_i0);case ot:return eh(r(t.effect_instruction_i0,e.effect_instruction_i0))}case ht:switch(e._tag){case ht:return sh(n(t.effect_instruction_i0,e.effect_instruction_i0));case ot:return eh(e.effect_instruction_i0)}}})),ch=(t,e)=>{const r=Pr(t);return Qr(r)?u(tn(r),ze(u(Xr(r),rh(Dr)),((t,r)=>u(t,oh(r,{onSuccess:(t,e)=>u(t,Yr(e)),onFailure:e})))),rh(Jr),rh((t=>Ur(t))),ie):se()},uh=t=>{var e;return{...It,[iu]:ou,state:Qs((e=[],{_tag:nu,joiners:e})),commit(){return ah(this)},blockingOn:t}},ah=t=>((t,e=bi)=>Zu((()=>_u(t,e))))((e=>{const r=Xs(t.state);switch(r._tag){case su:return e(r.effect);case nu:return r.joiners.push(e),dh(t,e)}}),t.blockingOn),hh=e(2,((t,e)=>Xu((()=>{const r=Xs(t.state);switch(r._tag){case su:return!1;case nu:ti(t.state,cu(e));for(let t=0,n=r.joiners.length;t<n;t++)r.joiners[t](e);return!0}})))),lh=e(2,((t,e)=>hh(t,e))),fh=t=>Tu(xu,(e=>hh(t,(t=>Ru(jc(t)))(e)))),bh=(t,e)=>{const r=Xs(t.state);if(r._tag===nu){ti(t.state,cu(e));for(let t=0,n=r.joiners.length;t<n;t++)r.joiners[t](e)}},dh=(t,e)=>Xu((()=>{const r=Xs(t.state);if(r._tag===nu){const t=r.joiners.indexOf(e);t>=0&&r.joiners.splice(t,1)}})),ph=mu((t=>sh(t.currentContext))),mh=()=>ph,gh=t=>Tu(mh(),t),yh=e(2,((t,e)=>_a(Na,e)(t))),Sh=e(2,((t,e)=>gh((r=>yh(t,e(r)))))),wh=t=>{const e=t.currentSpan;return void 0!==e&&"Span"===e._tag?ie(e):se()},_h=Symbol.for("effect/MutableHashMap"),vh={[_h]:_h,[Symbol.iterator](){return new Oh(this)},toString(){return z(this.toJSON())},toJSON(){return{_id:"MutableHashMap",values:Array.from(this).map(K)}},[Y](){return this.toJSON()},pipe(){return nt(this,arguments)}};class Oh{self;referentialIterator;bucketIterator;constructor(t){this.self=t,this.referentialIterator=t.referential[Symbol.iterator]()}next(){if(void 0!==this.bucketIterator)return this.bucketIterator.next();const t=this.referentialIterator.next();return t.done?(this.bucketIterator=new Eh(this.self.buckets.values()),this.next()):t}[Symbol.iterator](){return new Oh(this.self)}}class Eh{backing;constructor(t){this.backing=t}currentBucket;next(){if(void 0===this.currentBucket){const t=this.backing.next();if(t.done)return t;this.currentBucket=t.value[Symbol.iterator]()}const t=this.currentBucket.next();return t.done?(this.currentBucket=void 0,this.next()):t}}const Mh=()=>{const t=Object.create(vh);return t.referential=new Map,t.buckets=new Map,t.bucketsSize=0,t},kh=e(2,((t,e)=>{if(!1===V(e))return t.referential.has(e)?ie(t.referential.get(e)):se();const r=e[R](),n=t.buckets.get(r);return void 0===n?se():Ih(t,n,e)})),Ih=(t,e,r,n=!1)=>{for(let s=0,i=e.length;s<i;s++)if(r[J](e[s][0])){const r=e[s][1];return n&&(e.splice(s,1),t.bucketsSize--),ie(r)}return se()},Nh=e(2,((t,e)=>ce(kh(t,e)))),jh=e(3,((t,e,r)=>{if(!1===V(e))return t.referential.set(e,r),t;const n=e[R](),s=t.buckets.get(n);return void 0===s?(t.buckets.set(n,[[e,r]]),t.bucketsSize++,t):(Ch(t,s,e),s.push([e,r]),t.bucketsSize++,t)})),Ch=(t,e,r)=>{for(let n=0,s=e.length;n<s;n++)if(r[J](e[n][0]))return e.splice(n,1),void t.bucketsSize--},Fh=e(2,((t,e)=>{if(!1===V(e))return t.referential.delete(e),t;const r=e[R](),n=t.buckets.get(r);return void 0===n||(Ch(t,n,e),0===n.length&&t.buckets.delete(r)),t})),Rh=t=>t.referential.size+t.bucketsSize,Ah=Symbol.for("effect/Clock"),xh=_r("effect/Clock"),$h={unsafeSchedule(t,e){const r=kn(e);if(r>2147483647)return i;let n=!1;const s=setTimeout((()=>{n=!0,t()}),r);return()=>(clearTimeout(s),!n)}},Th=function(){const t=BigInt(1e6);if("undefined"==typeof performance||"function"!=typeof performance.now)return()=>BigInt(Date.now())*t;let e;return()=>(void 0===e&&(e=BigInt(Date.now())*t-BigInt(Math.round(1e6*performance.now()))),e+BigInt(Math.round(1e6*performance.now())))}(),Lh=function(){const t="object"==typeof process&&"hrtime"in process&&"function"==typeof process.hrtime.bigint?process.hrtime:void 0;if(!t)return Th;const e=Th()-t.bigint();return()=>e+t.bigint()}();class Bh{[Ah]=Ah;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return Lh()}currentTimeMillis=Xu((()=>this.unsafeCurrentTimeMillis()));currentTimeNanos=Xu((()=>this.unsafeCurrentTimeNanos()));scheduler(){return Qu($h)}sleep(t){return vu((e=>{const r=$h.unsafeSchedule((()=>e(sa)),t);return Su(Xu(r))}))}}const Dh=()=>new Bh,Ph="InvalidData",qh="MissingData",Uh="SourceUnavailable",Jh="Unsupported",Gh=Symbol.for("effect/ConfigError"),Hh={_tag:"ConfigError",[Gh]:Gh},Vh=(t,e)=>{const r=Object.create(Hh);return r._op="And",r.left=t,r.right=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},Wh=(t,e)=>{const r=Object.create(Hh);return r._op="Or",r.left=t,r.right=e,Object.defineProperty(r,"toString",{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(r,"message",{enumerable:!1,get(){return this.toString()}}),r},Yh=(t,e,r={pathDelim:"."})=>{const n=Object.create(Hh);return n._op=Ph,n.path=t,n.message=e,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Invalid data at ${u(this.path,er(r.pathDelim))}: "${this.message}")`}}),n},Kh=(t,e,r={pathDelim:"."})=>{const n=Object.create(Hh);return n._op=qh,n.path=t,n.message=e,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Missing data at ${u(this.path,er(r.pathDelim))}: "${this.message}")`}}),n},zh=(t,e,r,n={pathDelim:"."})=>{const s=Object.create(Hh);return s._op=Uh,s.path=t,s.message=e,s.cause=r,Object.defineProperty(s,"toString",{enumerable:!1,value(){return`(Source unavailable at ${u(this.path,er(n.pathDelim))}: "${this.message}")`}}),s},Qh=(t,e,r={pathDelim:"."})=>{const n=Object.create(Hh);return n._op=Jh,n.path=t,n.message=e,Object.defineProperty(n,"toString",{enumerable:!1,value(){return`(Unsupported operation at ${u(this.path,er(r.pathDelim))}: "${this.message}")`}}),n},Zh=e(2,((t,e)=>{switch(t._op){case"And":return Vh(Zh(t.left,e),Zh(t.right,e));case"Or":return Wh(Zh(t.left,e),Zh(t.right,e));case Ph:return Yh([...e,...t.path],t.message);case qh:return Kh([...e,...t.path],t.message);case Uh:return zh([...e,...t.path],t.message,t.cause);case Jh:return Qh([...e,...t.path],t.message)}})),Xh={_tag:"Empty"},tl=e(2,((t,e)=>{let r=$i(e),n=t;for(;"Cons"===r._tag;){const t=r.head;switch(t._tag){case"Empty":r=r.tail;break;case"AndThen":r=Ai(t.first,Ai(t.second,r.tail));break;case"MapName":n=Ye(n,t.f),r=r.tail;break;case"Nested":n=Oe(n,t.name),r=r.tail;break;case"Unnested":if(!u(Fe(n),ge(t.name)))return Yt(Kh(n,`Expected ${t.name} to be in path in ConfigProvider#unnested`));n=xe(n),r=r.tail}}return Wt(n)})),el=(t,e)=>[...t,...e],rl=Symbol.for("effect/ConfigProvider"),nl=_r("effect/ConfigProvider"),sl=Symbol.for("effect/ConfigProviderFlat"),il=t=>({[rl]:rl,pipe(){return nt(this,arguments)},...t}),ol=t=>{const{pathDelim:e,seqDelim:r}=Object.assign({},{pathDelim:"_",seqDelim:","},t),n=()=>"undefined"!=typeof process&&"env"in process&&"object"==typeof process.env?process.env:{};return s=(t=>({[sl]:sl,patch:t.patch,load:(e,r,n=!0)=>t.load(e,r,n),enumerateChildren:t.enumerateChildren}))({load:(t,s,i=!0)=>{const o=(t=>u(t,er(e)))(t),c=n();return u(o in c?ie(c[o]):se(),Wu((()=>Kh(t,`Expected ${o} to exist in the process context`))),Tu((e=>al(e,t,s,r,i))))},enumerateChildren:t=>Xu((()=>{const r=n();return(t=>{const e=Fs(js());for(const r of t)xs(e,r);return Rs(e)})(Object.keys(r).map((t=>t.toUpperCase().split(e))).filter((e=>{for(let r=0;r<t.length;r++){const n=u(t,Ce(r)),s=e[r];if(void 0===s||n!==s)return!1}return!0})).flatMap((e=>e.slice(t.length,t.length+1))))})),patch:Xh}),il({load:t=>Tu(cl(s,[],t,!1),(e=>ue(Fe(e),{onNone:()=>Cu(Kh([],`Expected a single value having structure: ${t}`)),onSome:Qu}))),flattened:s});var s},cl=(t,e,r,n)=>{const s=r;switch(s._tag){case"Constant":return Qu(We(s.value));case"Described":return Zu((()=>cl(t,e,s.config,n)));case"Fail":return Cu(Kh(e,s.message));case"Fallback":return u(Zu((()=>cl(t,e,s.first,n))),Ou((r=>s.condition(r)?u(cl(t,e,s.second,n),Ou((t=>Cu(Wh(r,t))))):Cu(r))));case"Lazy":return Zu((()=>cl(t,e,s.config(),n)));case"MapOrFail":return Zu((()=>u(cl(t,e,s.original,n),Tu(Uu((t=>u(s.mapOrFail(t),Wu(Zh(((t,e)=>{let r=e;if("Nested"===r._tag){const e=t.slice();for(;"Nested"===r._tag;)e.push(r.name),r=r.config;return e}return t})(e,s.original))))))))));case"Nested":return Zu((()=>cl(t,el(e,We(s.name)),s.config,n)));case"Primitive":return u(tl(e,t.patch),Tu((e=>u(t.load(e,s,n),Tu((t=>{if(0===t.length){const t=u(Ie(r=e)?ie(Ae(r)):se(),he((()=>"<n/a>")));return Cu(Kh([],`Expected ${s.description} with name ${t}`))}var r;return Qu(t)}))))));case"Sequence":return u(tl(e,t.patch),Tu((r=>u(t.enumerateChildren(r),Tu(ll),Tu((r=>0===r.length?Zu((()=>Hu(cl(t,e,s.config,!0),We))):u(Uu(r,(r=>cl(t,Ee(e,`[${r}]`),s.config,!0))),Hu((t=>{const e=Ke(t);return We(0===e.length?[]:e)})))))))));case"HashMap":return Zu((()=>u(tl(e,t.patch),Tu((e=>u(t.enumerateChildren(e),Tu((r=>u(r,Uu((r=>cl(t,el(e,We(r)),s.valueConfig,n))),Hu((t=>0===t.length?We(mi()):u(hl(t),Ye((t=>(t=>{const e=ms(cs());for(const r of t)fs(e,r[0],r[1]);return(r=e)._editable=!1,r;var r})(De(ve(r),t))))))))))))))));case"ZipWith":return Zu((()=>u(cl(t,e,s.left,n),Nu,Tu((r=>u(cl(t,e,s.right,n),Nu,Tu((t=>{if(Kt(r)&&Kt(t))return Cu(Vh(r.left,t.left));if(Kt(r)&&zt(t))return Cu(r.left);if(zt(r)&&Kt(t))return Cu(t.left);if(zt(r)&&zt(t)){const n=u(e,er(".")),i=ul(e,n),[o,c]=((t,e,r,n)=>{const s=Qe(r.length,(e=>e>=n.length?se():ie([t(e),e+1]))),i=Qe(n.length,(t=>t>=r.length?se():ie([e(t),t+1])));return[el(r,s),el(n,i)]})(i,i,u(r.right,Ye(Wt)),u(t.right,Ye(Wt)));return u(o,De(c),Uu((([t,e])=>u(ca(t,e),Hu((([t,e])=>s.zip(t,e)))))))}throw new Error("BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues")}))))))))}},ul=(t,e)=>r=>Yt(Kh(t,`The element at index ${r} in a sequence at path "${e}" was missing`)),al=(t,e,r,n,s)=>s?u(((t,e)=>{const r=t.split(new RegExp(`\\s*${(t=>t.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"))(e)}\\s*`));return r})(t,n),Uu((t=>r.parse(t.trim()))),Wu(Zh(e))):u(r.parse(t),Vu({onFailure:Zh(e),onSuccess:We})),hl=t=>Object.keys(t[0]).map((e=>t.map((t=>t[e])))),ll=t=>u(Uu(t,bl),Vu({onFailure:()=>[],onSuccess:Be(rr)}),Nu,Hu(Qt)),fl=/^(\[(\d+)\])$/,bl=t=>{const e=t.match(fl);if(null!==e){const t=e[2];return u(void 0!==t&&t.length>0?ie(t):se(),me(dl))}return se()},dl=t=>{const e=Number.parseInt(t);return Number.isNaN(e)?se():ie(e)},pl=Symbol.for("effect/Console"),ml=_r("effect/Console"),gl={[pl]:pl,assert:(t,...e)=>Xu((()=>{console.assert(t,...e)})),clear:Xu((()=>{console.clear()})),count:t=>Xu((()=>{console.count(t)})),countReset:t=>Xu((()=>{console.countReset(t)})),debug:(...t)=>Xu((()=>{console.debug(...t)})),dir:(t,e)=>Xu((()=>{console.dir(t,e)})),dirxml:(...t)=>Xu((()=>{console.dirxml(...t)})),error:(...t)=>Xu((()=>{console.error(...t)})),group:t=>Xu(t?.collapsed?()=>console.groupCollapsed(t?.label):()=>console.group(t?.label)),groupEnd:Xu((()=>{console.groupEnd()})),info:(...t)=>Xu((()=>{console.info(...t)})),log:(...t)=>Xu((()=>{console.log(...t)})),table:(t,e)=>Xu((()=>{console.table(t,e)})),time:t=>Xu((()=>console.time(t))),timeEnd:t=>Xu((()=>console.timeEnd(t))),timeLog:(t,...e)=>Xu((()=>{console.timeLog(t,...e)})),trace:(...t)=>Xu((()=>{console.trace(...t)})),warn:(...t)=>Xu((()=>{console.warn(...t)})),unsafe:console},yl=Symbol.for("effect/Random"),Sl=_r("effect/Random");class wl{seed;[yl]=yl;PRNG;constructor(t){this.seed=t,this.PRNG=new O(t)}get next(){return Xu((()=>this.PRNG.number()))}get nextBoolean(){return Hu(this.next,(t=>t>.5))}get nextInt(){return Xu((()=>this.PRNG.integer(Number.MAX_SAFE_INTEGER)))}nextRange(t,e){return Hu(this.next,(r=>(e-t)*r+t))}nextIntBetween(t,e){return Xu((()=>this.PRNG.integer(e-t)+t))}shuffle(t){return _l(t,(t=>this.nextIntBetween(0,t)))}}const _l=(t,e)=>Zu((()=>u(Xu((()=>Array.from(t))),Tu((t=>{const r=[];for(let e=t.length;e>=2;e-=1)r.push(e);return u(r,Ju((r=>u(e(r),Hu((e=>vl(t,r-1,e)))))),yu(Pr(t)))}))))),vl=(t,e,r)=>{const n=t[e];return t[e]=t[r],t[r]=n,t},Ol=t=>new wl(A(t)),El=Symbol.for("effect/Tracer"),Ml=t=>({[El]:El,...t}),kl=_r("effect/Tracer"),Il=_r("effect/ParentSpan"),Nl=function(){return function(t){let e="";for(let r=0;r<t;r++)e+="abcdef0123456789".charAt(Math.floor(16*Math.random()));return e}}();class jl{name;parent;context;startTime;kind;_tag="Span";spanId;traceId="native";sampled=!0;status;attributes;events=[];links;constructor(t,e,r,n,s,i){this.name=t,this.parent=e,this.context=r,this.startTime=s,this.kind=i,this.status={_tag:"Started",startTime:s},this.attributes=new Map,this.traceId="Some"===e._tag?e.value.traceId:Nl(32),this.spanId=Nl(16),this.links=Array.from(n)}end(t,e){this.status={_tag:"Ended",endTime:t,exit:e,startTime:this.status.startTime}}attribute(t,e){this.attributes.set(t,e)}event(t,e,r){this.events.push([t,e,r??{}])}addLinks(t){this.links.push(...t)}}const Cl=Ml({span:(t,e,r,n,s,i)=>new jl(t,e,r,n,s,i),context:t=>t()}),Fl=u(vr(),Er(xh,Dh()),Er(ml,gl),Er(Sl,Ol(Math.random())),Er(nl,ol()),Er(kl,Cl)),Rl=b(Symbol.for("effect/DefaultServices/currentServices"),(()=>Ma(Fl))),Al=Symbol.for("effect/FiberRefs");class xl{locals;[Al]=Al;constructor(t){this.locals=t}pipe(){return nt(this,arguments)}}const $l=e(3,((t,e,r)=>{const n=new Map(t.locals);return r.locals.forEach(((t,r)=>{const s=t[0][1];if(!t[0][0][J](e)){if(!n.has(r)){if(G(s,r.initial))return;return void n.set(r,[[e,r.join(r.initial,s)]])}const i=n.get(r),[o,c]=((t,e,r,n=!1)=>{const s=t;let i,o=e,c=r,u=n;for(;void 0===i;)if(Ie(o)&&Ie(c)){const t=Re(o)[0],e=xe(o),r=Re(c)[0],n=Re(c)[1],s=xe(c);t.startTimeMillis<r.startTimeMillis?(c=s,u=!0):t.startTimeMillis>r.startTimeMillis?o=e:t.id<r.id?(c=s,u=!0):t.id>r.id?o=e:i=[n,u]}else i=[s.initial,!0];return i})(r,i,t);if(c){const t=r.diff(o,s),c=i[0][1],u=r.join(c,r.patch(t)(c));if(!G(c,u)){let t;const s=i[0][0];t=s[J](e)?[[s,u],...i.slice(1)]:[[e,u],...i],n.set(r,t)}}}})),new xl(n)})),Tl=e(2,((t,e)=>{const r=new Map;return Ll(t,r,e),new xl(r)})),Ll=(t,e,r)=>{t.locals.forEach(((t,n)=>{const s=t[0][1],i=n.patch(n.fork)(s);G(s,i)?e.set(n,t):e.set(n,[[r,i],...t])}))},Bl=e(2,((t,e)=>{const r=new Map(t.locals);return r.delete(e),new xl(r)})),Dl=e(2,((t,e)=>t.locals.has(e)?ie(Re(t.locals.get(e))[1]):se())),Pl=e(2,((t,e)=>u(Dl(t,e),he((()=>e.initial))))),ql=e(2,((t,{fiberId:e,fiberRef:r,value:n})=>{if(0===t.locals.size)return new xl(new Map([[r,[[e,n]]]]));const s=new Map(t.locals);return Ul(s,e,r,n),new xl(s)})),Ul=(t,e,r,n)=>{const s=t.get(r)??[];let i;if(Ie(s)){const[t,r]=Re(s);if(t[J](e)){if(G(r,n))return;i=[[e,n],...s.slice(1)]}else i=[[e,n],...s]}else i=[[e,n]];t.set(r,i)},Jl=e(2,((t,{entries:e,forkAs:r})=>{if(0===t.locals.size)return new xl(new Map(e));const n=new Map(t.locals);return void 0!==r&&Ll(t,n,r),e.forEach((([t,e])=>{1===e.length?Ul(n,e[0][0],t,e[0][1]):e.forEach((([e,r])=>{Ul(n,e,t,r)}))})),new xl(n)})),Gl=Pl,Hl=Jl,Vl=function(){return t=new Map,new xl(t);var t},Wl=la,Yl=fa,Kl=ba,zl=ne(u(rr,re((t=>t.ordinal)))),Ql=t=>t.replace(/[\s="]/g,"_"),Zl=t=>e=>`${Ql(e.label)}=${t-e.startTime}ms`,Xl=Mt,tf=jt;class ef extends tf{}const rf="Empty",nf="Remove",sf="Update",of="AndThen",cf={_tag:rf},uf=e(2,((t,e)=>({_tag:of,first:t,second:e}))),af=e(3,((t,e,r)=>{let n=r,s=We(t);for(;Ie(s);){const t=Re(s),r=xe(s);switch(t._tag){case rf:s=r;break;case"Add":n=ql(n,{fiberId:e,fiberRef:t.fiberRef,value:t.value}),s=r;break;case nf:n=Bl(n,t.fiberRef),s=r;break;case sf:{const i=Pl(n,t.fiberRef);n=ql(n,{fiberId:e,fiberRef:t.fiberRef,value:t.fiberRef.patch(t.patch)(i)}),s=r;break}case of:s=Oe(t.first)(Oe(t.second)(r))}}return n})),hf="effect/MetricLabel",lf=Symbol.for(hf);class ff{key;value;[lf]=lf;_hash;constructor(t,e){this.key=t,this.value=e,this._hash=D(hf+this.key+this.value)}[R](){return this._hash}[J](t){return df(t)&&this.key===t.key&&this.value===t.value}pipe(){return nt(this,arguments)}}const bf=(t,e)=>new ff(t,e),df=t=>g(t,lf),pf=t=>(t=>mu((e=>t(e.currentDefaultServices))))((e=>t(e.unsafeMap.get(xh.key)))),mf=t=>(...e)=>{const r=fe(t);let n;for(let t=0,r=e.length;t<r;t++){const r=e[t];Rc(r)&&(n=void 0!==n?Fc(n,r):r,e=[...e.slice(0,t),...e.slice(t+1)],t--)}return void 0===n&&(n=kc),mu((t=>(t.log(e,n,r),sa)))},gf=mf(Yl),yf=mf(Wl),Sf=e(2,((t,e)=>zu(t,(()=>Xu(e))))),wf=e(2,((t,e)=>Pu(t,{onFailure:t=>{const r=$c(t);switch(r._tag){case"Left":return aa(e(r.left),Ru(t));case"Right":return Ru(t)}},onSuccess:Qu}))),_f=e(2,((t,e)=>Zu((()=>e()?Hu(t,ie):Qu(se()))))),vf={_tag:"Sequential"},Of=vf,Ef={_tag:"Parallel"},Mf=t=>({_tag:"ParallelN",parallelism:t}),kf=af,If="effect/FiberStatus",Nf=Symbol.for(If),jf="Done",Cf="Running",Ff="Suspended",Rf=D(`${If}-${jf}`);class Af{[Nf]=Nf;_tag=jf;[R](){return Rf}[J](t){return Tf(t)&&t._tag===jf}}class xf{runtimeFlags;[Nf]=Nf;_tag=Cf;constructor(t){this.runtimeFlags=t}[R](){return u(A(If),$(A(this._tag)),$(A(this.runtimeFlags)),U(this))}[J](t){return Tf(t)&&t._tag===Cf&&this.runtimeFlags===t.runtimeFlags}}class $f{runtimeFlags;blockingOn;[Nf]=Nf;_tag=Ff;constructor(t,e){this.runtimeFlags=t,this.blockingOn=e}[R](){return u(A(If),$(A(this._tag)),$(A(this.runtimeFlags)),$(A(this.blockingOn)),U(this))}[J](t){return Tf(t)&&t._tag===Ff&&this.runtimeFlags===t.runtimeFlags&&G(this.blockingOn,t.blockingOn)}}const Tf=t=>g(t,Nf),Lf=new Af,Bf=t=>new xf(t),Df=Symbol.for("effect/Micro"),Pf=Symbol.for("effect/Micro/MicroExit"),qf=Symbol.for("effect/Micro/MicroCause"),Uf={_E:r};class Jf extends globalThis.Error{_tag;traces;[qf];constructor(t,e,r){const n=`MicroCause.${t}`;let s,i,o;if(e instanceof globalThis.Error){s=`(${n}) ${e.name}`,i=e.message;const t=i.split("\n").length;o=e.stack?`(${n}) ${e.stack.split("\n").slice(0,t+3).join("\n")}`:`${s}: ${i}`}else s=n,i=Q(e,0),o=`${s}: ${i}`;r.length>0&&(o+=`\n ${r.join("\n ")}`),super(i),this._tag=t,this.traces=r,this[qf]=Uf,this.name=s,this.stack=o}pipe(){return nt(this,arguments)}toString(){return this.stack}[Y](){return this.stack}}class Gf extends Jf{defect;constructor(t,e=[]){super("Die",t,e),this.defect=t}}class Hf extends Jf{constructor(t=[]){super("Interrupt","interrupted",t)}}const Vf=(t=[])=>new Hf(t),Wf=Symbol.for("effect/Micro/MicroFiber"),Yf={_A:r,_E:r};class Kf{context;interruptible;[Wf];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(t,e=!0){this.context=t,this.interruptible=e,this[Wf]=Yf}getRef(t){return(e=this.context).unsafeMap.has((r=t).key)?e.unsafeMap.get(r.key):mr(r);var e,r}addObserver(t){return this._exit?(t(this._exit),c):(this._observers.push(t),()=>{const e=this._observers.indexOf(t);e>=0&&this._observers.splice(e,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(wb))}unsafePoll(){return this._exit}evaluate(t){if(this._exit)return;if(void 0!==this._yielded){const t=this._yielded;this._yielded=void 0,t()}const e=this.runLoop(t);if(e===nb)return;const r=zf.interruptChildren&&zf.interruptChildren(this);if(void 0!==r)return this.evaluate(pb(r,(()=>e)));this._exit=e;for(let t=0;t<this._observers.length;t++)this._observers[t](e);this._observers.length=0}runLoop(t){let e=!1,r=t;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!e&&this.getRef(Nb).shouldYield(this)){e=!0;const t=r;r=pb(fb,(()=>t))}if(r=r[Xf](this),r===nb){const t=this._yielded;return Pf in t?(this._yielded=void 0,t):nb}}}catch(t){return g(r,Xf)?_b(t):_b(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(t){for(;;){const e=this._stack.pop();if(!e)return;const r=e[rb]&&e[rb](this);if(r)return{[t]:r};if(e[t])return e}}_yielded=void 0;yieldWith(t){return this._yielded=t,nb}children(){return this._children??=new Set}}const zf=b("effect/Micro/fiberMiddleware",(()=>({interruptChildren:void 0}))),Qf=Symbol.for("effect/Micro/identifier"),Zf=Symbol.for("effect/Micro/args"),Xf=Symbol.for("effect/Micro/evaluate"),tb=Symbol.for("effect/Micro/successCont"),eb=Symbol.for("effect/Micro/failureCont"),rb=Symbol.for("effect/Micro/ensureCont"),nb=Symbol.for("effect/Micro/Yield"),sb={_A:r,_E:r,_R:r},ib={...Xl,_op:"Micro",[Df]:sb,pipe(){return nt(this,arguments)},[Symbol.iterator](){return new v(new k(this))},toJSON(){return{_id:"Micro",op:this[Qf],...Zf in this?{args:this[Zf]}:void 0}},toString(){return z(this)},[Y](){return z(this)}};function ob(){return _b("Micro.evaluate: Not implemented")}const cb=t=>({...ib,[Qf]:t.op,[Xf]:t.eval??ob,[tb]:t.contA,[eb]:t.contE,[rb]:t.ensure}),ub=t=>{const e=cb(t);return function(){const r=Object.create(e);return r[Zf]=!1===t.single?arguments:arguments[0],r}},ab=t=>{const e={...cb(t),[Pf]:Pf,_tag:t.op,get[t.prop](){return this[Zf]},toJSON(){return{_id:"MicroExit",_tag:t.op,[t.prop]:this[Zf]}},[J](e){return gb(e)&&e._tag===t.op&&G(this[Zf],e[Zf])},[R](){return U(this,$(D(t.op))(A(this[Zf])))}};return function(t){const r=Object.create(e);return r[Zf]=t,r[tb]=void 0,r[eb]=void 0,r[rb]=void 0,r}},hb=ab({op:"Success",prop:"value",eval(t){const e=t.getCont(tb);return e?e[tb](this[Zf],t):t.yieldWith(this)}}),lb=ab({op:"Failure",prop:"cause",eval(t){let e=t.getCont(eb);for(;"Interrupt"===this[Zf]._tag&&e&&t.interruptible;)e=t.getCont(eb);return e?e[eb](this[Zf],t):t.yieldWith(this)}}),fb=ub({op:"Yield",eval(t){let e=!1;return t.getRef(Nb).scheduleTask((()=>{e||t.evaluate(vb)}),this[Zf]??0),t.yieldWith((()=>{e=!0}))}})(0),bb=hb(void 0),db=ub({op:"WithMicroFiber",eval(t){return this[Zf](t)}}),pb=e(2,((t,e)=>{const r=Object.create(mb);return r[Zf]=t,r[tb]=e,r})),mb=cb({op:"OnSuccess",eval(t){return t._stack.push(this),this[Zf]}}),gb=t=>g(t,Pf),yb=hb,Sb=lb,wb=Sb(Vf()),_b=t=>Sb(((t,e=[])=>new Gf(t,e))(t)),vb=yb(void 0),Ob="setImmediate"in globalThis?globalThis.setImmediate:t=>setTimeout(t,0);class Eb{tasks=[];running=!1;scheduleTask(t,e){this.tasks.push(t),this.running||(this.running=!0,Ob(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const t=this.tasks;this.tasks=[];for(let e=0,r=t.length;e<r;e++)t[e]()}shouldYield(t){return t.currentOpCount>=t.getRef(Ib)}flush(){for(;this.tasks.length>0;)this.runTasks()}}const Mb=e(2,((t,e)=>db((r=>{const n=r.context;return r.context=e(n),Fb(t,(()=>(r.context=n,bb)))})))),kb=e(2,((t,e)=>Mb(t,Nr(e))));class Ib extends(jr()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048})){}class Nb extends(jr()("effect/Micro/currentScheduler",{defaultValue:()=>new Eb})){}const jb=e(2,((t,e)=>{const r=Object.create(Cb);return r[Zf]=t,r[tb]=e.onSuccess,r[eb]=e.onFailure,r})),Cb=cb({op:"OnSuccessAndFailure",eval(t){return t._stack.push(this),this[Zf]}}),Fb=e(2,((t,e)=>xb((r=>jb(r(t),{onFailure:t=>pb(e(Sb(t)),(()=>lb(t))),onSuccess:t=>pb(e(yb(t)),(()=>hb(t)))}))))),Rb=ub({op:"SetInterruptible",ensure(t){if(t.interruptible=this[Zf],t._interrupted&&t.interruptible)return()=>wb}}),Ab=t=>db((e=>e.interruptible?t:(e.interruptible=!0,e._stack.push(Rb(!1)),e._interrupted?wb:t))),xb=t=>db((e=>e.interruptible?(e.interruptible=!1,e._stack.push(Rb(!0)),t(Ab)):t(r)));class $b{buckets=[];scheduleTask(t,e){const r=this.buckets.length;let n,s=0;for(;s<r&&this.buckets[s][0]<=e;s++)n=this.buckets[s];n&&n[0]===e?n[1].push(t):s===r?this.buckets.push([e,[t]]):this.buckets.splice(s,0,[e,[t]])}}class Tb{maxNextTickBeforeTimer;running=!1;tasks=new $b;constructor(t){this.maxNextTickBeforeTimer=t}starveInternal(t){const e=this.tasks.buckets;this.tasks.buckets=[];for(const[t,r]of e)for(let t=0;t<r.length;t++)r[t]();0===this.tasks.buckets.length?this.running=!1:this.starve(t)}starve(t=0){t>=this.maxNextTickBeforeTimer?setTimeout((()=>this.starveInternal(0)),0):Promise.resolve(void 0).then((()=>this.starveInternal(t+1)))}shouldYield(t){return t.currentOpCount>t.getFiberRef(Ca)&&t.getFiberRef(ja)}scheduleTask(t,e){this.tasks.scheduleTask(t,e),this.running||(this.running=!0,this.starve())}}const Lb=b(Symbol.for("effect/Scheduler/defaultScheduler"),(()=>new Tb(2048)));class Bb{tasks=new $b;deferred=!1;scheduleTask(t,e){this.deferred?Lb.scheduleTask(t,e):this.tasks.scheduleTask(t,e)}shouldYield(t){return t.currentOpCount>t.getFiberRef(Ca)&&t.getFiberRef(ja)}flush(){for(;this.tasks.buckets.length>0;){const t=this.tasks.buckets;this.tasks.buckets=[];for(const[e,r]of t)for(let t=0;t<r.length;t++)r[t]()}this.deferred=!0}}const Db=b(Symbol.for("effect/FiberRef/currentScheduler"),(()=>va(Lb))),Pb=b(Symbol.for("effect/FiberRef/currentRequestMap"),(()=>va(new Map))),qb=(t,e,r,n)=>{switch(t){case void 0:return e();case"unbounded":return r();case"inherit":return ya($a,(t=>"unbounded"===t?r():t>1?n(t):e()));default:return t>1?n(t):e()}},Ub="InterruptSignal",Jb="Stateful",Gb="Resume",Hb="YieldNow",Vb=t=>({_tag:Ub,cause:t}),Wb=t=>({_tag:Jb,onFiber:t}),Yb=t=>({_tag:Gb,effect:t}),Kb=Symbol.for("effect/FiberScope");class zb{[Kb]=Kb;fiberId=bi;roots=new Set;add(t,e){this.roots.add(e),e.addObserver((()=>{this.roots.delete(e)}))}}class Qb{fiberId;parent;[Kb]=Kb;constructor(t,e){this.fiberId=t,this.parent=e}add(t,e){this.parent.tell(Wb((t=>{t.addChild(e),e.addObserver((()=>{t.removeChild(e)}))})))}}const Zb=b(Symbol.for("effect/FiberScope/Global"),(()=>new zb)),Xb=Symbol.for("effect/Fiber"),td={_E:t=>t,_A:t=>t},ed=Symbol.for("effect/Fiber"),rd=t=>ua(Bu(t.await),t.inheritAll),nd="effect/FiberCurrent",sd=Symbol.for("effect/Logger"),id={_Message:t=>t,_Output:t=>t},od=t=>({[sd]:id,log:t,pipe(){return nt(this,arguments)}}),cd=/^[^\s"=]*$/,ud=(t,e)=>({annotations:r,cause:n,date:s,fiberId:i,logLevel:o,message:c,spans:u})=>{const a=(e,r)=>`${Ql(e)}=${(e=>e.match(cd)?e:t(e))(r)}`,h=(t,e)=>" "+a(t,e);let l=a("timestamp",s.toISOString());l+=h("level",o.label),l+=h("fiber",fi(i));const f=(b=c,Array.isArray(b)?b:[b]);var b;for(let t=0;t<f.length;t++)l+=h("message",Q(f[t],e));(t=>t._tag===yc)(n)||(l+=h("cause",Yc(n,{renderErrorCause:!0})));for(const t of u)l+=" "+Zl(s.getTime())(t);for(const[t,n]of r)l+=h(t,Q(n,e));return l},ad=od(ud((t=>`"${t.replace(/\\([\s\S])|(")/g,"\\$1$2")}"`)));"object"==typeof process&&null!==process&&"object"==typeof process.stdout&&null!==process.stdout&&process;const hd="effect/MetricBoundaries",ld=Symbol.for(hd);class fd{values;[ld]=ld;constructor(t){this.values=t,this._hash=u(D(hd),$(q(this.values)))}_hash;[R](){return this._hash}[J](t){return bd(t)&&G(this.values,t.values)}pipe(){return nt(this,arguments)}}const bd=t=>g(t,ld),dd=t=>{const e=u(t,Me(Dr(Number.POSITIVE_INFINITY)),tr);return new fd(e)},pd=t=>u(_e(t.count-1,(e=>t.start*Math.pow(t.factor,e))),Gr,dd),md=Symbol.for("effect/MetricKeyType"),gd="effect/MetricKeyType/Counter",yd=Symbol.for(gd),Sd=Symbol.for("effect/MetricKeyType/Frequency"),wd=Symbol.for("effect/MetricKeyType/Gauge"),_d="effect/MetricKeyType/Histogram",vd=Symbol.for(_d),Od=Symbol.for("effect/MetricKeyType/Summary"),Ed={_In:t=>t,_Out:t=>t};class Md{incremental;bigint;[md]=Ed;[yd]=yd;constructor(t,e){this.incremental=t,this.bigint=e,this._hash=D(gd)}_hash;[R](){return this._hash}[J](t){return Id(t)}pipe(){return nt(this,arguments)}}class kd{boundaries;[md]=Ed;[vd]=vd;constructor(t){this.boundaries=t,this._hash=u(D(_d),$(A(this.boundaries)))}_hash;[R](){return this._hash}[J](t){return Nd(t)&&G(this.boundaries,t.boundaries)}pipe(){return nt(this,arguments)}}const Id=t=>g(t,yd),Nd=t=>g(t,vd),jd=Symbol.for("effect/MetricKey"),Cd={_Type:t=>t},Fd=Ze(G);class Rd{name;keyType;description;tags;[jd]=Cd;constructor(t,e,r,n=[]){this.name=t,this.keyType=e,this.description=r,this.tags=n,this._hash=u(D(this.name+this.description),$(A(this.keyType)),$(q(this.tags)))}_hash;[R](){return this._hash}[J](t){return Ad(t)&&this.name===t.name&&G(this.keyType,t.keyType)&&G(this.description,t.description)&&Fd(this.tags,t.tags)}pipe(){return nt(this,arguments)}}const Ad=t=>g(t,jd),xd=e(2,((t,e)=>0===e.length?t:new Rd(t.name,t.keyType,t.description,Ve(t.tags,e)))),$d=Symbol.for("effect/MetricState"),Td="effect/MetricState/Counter",Ld=Symbol.for(Td),Bd="effect/MetricState/Frequency",Dd=Symbol.for(Bd),Pd="effect/MetricState/Gauge",qd=Symbol.for(Pd),Ud="effect/MetricState/Histogram",Jd=Symbol.for(Ud),Gd="effect/MetricState/Summary",Hd=Symbol.for(Gd),Vd={_A:t=>t};class Wd{count;[$d]=Vd;[Ld]=Ld;constructor(t){this.count=t}[R](){return u(A(Td),$(A(this.count)),U(this))}[J](t){return Xd(t)&&this.count===t.count}pipe(){return nt(this,arguments)}}const Yd=Ze(G);class Kd{occurrences;[$d]=Vd;[Dd]=Dd;constructor(t){this.occurrences=t}_hash;[R](){return u(D(Bd),$(q(ve(this.occurrences.entries()))),U(this))}[J](t){return tp(t)&&Yd(ve(this.occurrences.entries()),ve(t.occurrences.entries()))}pipe(){return nt(this,arguments)}}class zd{value;[$d]=Vd;[qd]=qd;constructor(t){this.value=t}[R](){return u(A(Pd),$(A(this.value)),U(this))}[J](t){return ep(t)&&this.value===t.value}pipe(){return nt(this,arguments)}}class Qd{buckets;count;min;max;sum;[$d]=Vd;[Jd]=Jd;constructor(t,e,r,n,s){this.buckets=t,this.count=e,this.min=r,this.max=n,this.sum=s}[R](){return u(A(Ud),$(A(this.buckets)),$(A(this.count)),$(A(this.min)),$(A(this.max)),$(A(this.sum)),U(this))}[J](t){return rp(t)&&G(this.buckets,t.buckets)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return nt(this,arguments)}}class Zd{error;quantiles;count;min;max;sum;[$d]=Vd;[Hd]=Hd;constructor(t,e,r,n,s,i){this.error=t,this.quantiles=e,this.count=r,this.min=n,this.max=s,this.sum=i}[R](){return u(A(Gd),$(A(this.error)),$(A(this.quantiles)),$(A(this.count)),$(A(this.min)),$(A(this.max)),$(A(this.sum)),U(this))}[J](t){return np(t)&&this.error===t.error&&G(this.quantiles,t.quantiles)&&this.count===t.count&&this.min===t.min&&this.max===t.max&&this.sum===t.sum}pipe(){return nt(this,arguments)}}const Xd=t=>g(t,Ld),tp=t=>g(t,Dd),ep=t=>g(t,qd),rp=t=>g(t,Jd),np=t=>g(t,Hd),sp=Symbol.for("effect/MetricHook"),ip={_In:t=>t,_Out:t=>t},op=t=>({[sp]:ip,pipe(){return nt(this,arguments)},...t}),cp=BigInt(0),up=(t,e,r)=>{const n=r.length;if(!Ie(e))return[];const s=e[0],i=e.slice(1),o=ap(t,n,se(),0,s,r),c=We(o);return i.forEach((e=>{c.push(ap(t,n,o.value,o.consumed,e,o.rest))})),Ye(c,(t=>[t.quantile,t.value]))},ap=(t,e,r,n,s,i)=>{let o=t,c=e,u=r,a=n,h=s,l=i,f=t,b=e,d=r,p=n,m=s,g=i;for(;;){if(!Ie(l))return{quantile:h,value:se(),consumed:a,rest:[]};if(1===h)return{quantile:h,value:ie(Ae(l)),consumed:a+l.length,rest:[]};const t=Re(l),e=$e(l,(e=>e===t)),r=h*c,n=o/2*r,s=a+e[0].length,i=Math.abs(s-r);if(s<r-n)f=o,b=c,d=Fe(l),p=s,m=h,g=e[1],o=f,c=b,u=d,a=p,h=m,l=g;else{if(s>r+n)return{quantile:h,value:oe(u)?ie(t):u,consumed:a,rest:l};switch(u._tag){case"None":f=o,b=c,d=Fe(l),p=s,m=h,g=e[1],o=f,c=b,u=d,a=p,h=m,l=g;continue;case"Some":if(i<Math.abs(r-u.value)){f=o,b=c,d=Fe(l),p=s,m=h,g=e[1],o=f,c=b,u=d,a=p,h=m,l=g;continue}return{quantile:h,value:ie(u.value),consumed:a,rest:l}}}}throw new Error("BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues")},hp=Symbol.for("effect/MetricPair"),lp={_Type:t=>t},fp=(t,e)=>({[hp]:lp,metricKey:t,metricState:e,pipe(){return nt(this,arguments)}}),bp=Symbol.for("effect/MetricRegistry");class dp{[bp]=bp;map=Mh();snapshot(){const t=[];for(const[e,r]of this.map)t.push(fp(e,r.get()));return t}get(t){const e=u(this.map,kh(t),be);if(null==e){if(Id(t.keyType))return this.getCounter(t);if(g(t.keyType,wd))return this.getGauge(t);if(g(t.keyType,Sd))return this.getFrequency(t);if(Nd(t.keyType))return this.getHistogram(t);if((t=>g(t,Od))(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")}return e}getCounter(t){let e=u(this.map,kh(t),be);if(null==e){const r=(t=>{let e=t.keyType.bigint?cp:0;const r=t.keyType.incremental?t.keyType.bigint?t=>t>=cp:t=>t>=0:()=>!0,n=t=>{r(t)&&(e+=t)};return op({get:()=>new Wd(e),update:n,modify:n})})(t);u(this.map,Nh(t))||u(this.map,jh(t,r)),e=r}return e}getFrequency(t){let e=u(this.map,kh(t),be);if(null==e){const r=(t=>{const e=new Map;for(const r of t.keyType.preregisteredWords)e.set(r,0);const r=t=>{const r=e.get(t)??0;e.set(t,r+1)};return op({get:()=>new Kd(e),update:r,modify:r})})(t);u(this.map,Nh(t))||u(this.map,jh(t,r)),e=r}return e}getGauge(t){let e=u(this.map,kh(t),be);if(null==e){const r=((t,e)=>{let r=e;return op({get:()=>new zd(r),update:t=>{r=t},modify:t=>{r+=t}})})(0,t.keyType.bigint?BigInt(0):0);u(this.map,Nh(t))||u(this.map,jh(t,r)),e=r}return e}getHistogram(t){let e=u(this.map,kh(t),be);if(null==e){const r=(t=>{const e=t.keyType.boundaries.values,r=e.length,n=new Uint32Array(r+1),s=new Float64Array(r);let i=0,o=0,c=Number.MAX_VALUE,a=Number.MIN_VALUE;u(e,Be(rr),Ye(((t,e)=>{s[e]=t})));const h=t=>{let e=0,u=r;for(;e!==u;){const r=Math.floor(e+(u-e)/2);t<=s[r]?u=r:e=r,u===e+1&&(t<=s[e]?u=e:e=u)}n[e]=n[e]+1,i+=1,o+=t,t<c&&(c=t),t>a&&(a=t)},l=()=>{const t=we(r);let e=0;for(let i=0;i<r;i++)e+=n[i],t[i]=[s[i],e];return t};return op({get:()=>{return t={buckets:l(),count:i,min:c,max:a,sum:o},new Qd(t.buckets,t.count,t.min,t.max,t.sum);var t},update:h,modify:h})})(t);u(this.map,Nh(t))||u(this.map,jh(t,r)),e=r}return e}getSummary(t){let e=u(this.map,kh(t),be);if(null==e){const r=(t=>{const{error:e,maxAge:r,maxSize:n,quantiles:s}=t.keyType,i=u(s,Be(rr)),o=we(n);let c=0,a=0,h=0,l=0,f=0;const b=t=>{const s=[];let c=0;for(;c!==n-1;){const e=o[c];if(null!=e){const[n,i]=e,o=wn(t-n);Fn(o,mn)&&Cn(o,r)&&s.push(i)}c+=1}return up(e,i,Be(s,rr))},d=(t,e)=>{n>0&&(c+=1,o[c%n]=[e,t]),l=0===a?t:Math.min(l,t),f=0===a?t:Math.max(f,t),a+=1,h+=t};return op({get:()=>{return t={error:e,quantiles:b(Date.now()),count:a,min:l,max:f,sum:h},new Zd(t.error,t.quantiles,t.count,t.min,t.max,t.sum);var t},update:([t,e])=>d(t,e),modify:([t,e])=>d(t,e)})})(t);u(this.map,Nh(t))||u(this.map,jh(t,r)),e=r}return e}}const pp=Symbol.for("effect/Metric"),mp={_Type:t=>t,_In:t=>t,_Out:t=>t},gp=b(Symbol.for("effect/Metric/globalMetricRegistry"),(()=>new dp)),yp=function(t,e,r,n){const s=Object.assign((t=>ta(t,(t=>Ep(s,t)))),{[pp]:mp,keyType:t,unsafeUpdate:e,unsafeValue:r,unsafeModify:n,register(){return this.unsafeValue([]),this},pipe(){return nt(this,arguments)}});return s},Sp=(t,e)=>wp(((t,e)=>new Rd(t,(t=>new Md(t?.incremental??!1,t?.bigint??!1))(e),fe(e?.description)))(t,e)),wp=t=>{let e;const r=new WeakMap,n=n=>{if(0===n.length)return void 0!==e||(e=gp.get(t)),e;let s=r.get(n);return void 0!==s||(s=gp.get(xd(t,n)),r.set(n,s)),s};return yp(t.keyType,((t,e)=>n(e).update(t)),(t=>n(t).get()),((t,e)=>n(e).modify(t)))},_p=(t,e,r)=>wp(((t,e,r)=>new Rd(t,(t=>new kd(t))(e),fe(r)))(t,e,r)),vp=e(3,((t,e,r)=>Op(t,[bf(e,r)]))),Op=e(2,((t,e)=>yp(t.keyType,((r,n)=>t.unsafeUpdate(r,Ve(e,n))),(r=>t.unsafeValue(Ve(e,r))),((r,n)=>t.unsafeModify(r,Ve(e,n)))))),Ep=e(2,((t,e)=>ya(Da,(r=>Xu((()=>t.unsafeUpdate(e,r))))))),Mp=e(2,((t,e)=>ya(Pb,(r=>Xu((()=>{if(r.has(t)){const n=r.get(t);n.state.completed||(n.state.completed=!0,bh(n.result,e))}})))))),kp=Symbol.for("effect/Supervisor"),Ip={_T:t=>t};class Np{underlying;value0;[kp]=Ip;constructor(t,e){this.underlying=t,this.value0=e}get value(){return this.value0}onStart(t,e,r,n){this.underlying.onStart(t,e,r,n)}onEnd(t,e){this.underlying.onEnd(t,e)}onEffect(t,e){this.underlying.onEffect(t,e)}onSuspend(t){this.underlying.onSuspend(t)}onResume(t){this.underlying.onResume(t)}map(t){return new Np(this,u(this.value,Hu(t)))}zip(t){return new jp(this,t)}}class jp{left;right;_tag="Zip";[kp]=Ip;constructor(t,e){this.left=t,this.right=e}get value(){return ca(this.left.value,this.right.value)}onStart(t,e,r,n){this.left.onStart(t,e,r,n),this.right.onStart(t,e,r,n)}onEnd(t,e){this.left.onEnd(t,e),this.right.onEnd(t,e)}onEffect(t,e){this.left.onEffect(t,e),this.right.onEffect(t,e)}onSuspend(t){this.left.onSuspend(t),this.right.onSuspend(t)}onResume(t){this.left.onResume(t),this.right.onResume(t)}map(t){return new Np(this,u(this.value,Hu(t)))}zip(t){return new jp(this,t)}}const Cp=t=>g(t,kp)&&y(t,"Zip");class Fp{effect;[kp]=Ip;constructor(t){this.effect=t}get value(){return this.effect}onStart(t,e,r,n){}onEnd(t,e){}onEffect(t,e){}onSuspend(t){}onResume(t){}map(t){return new Np(this,u(this.value,Hu(t)))}zip(t){return new jp(this,t)}onRun(t,e){return t()}}const Rp=b("effect/Supervisor/none",(()=>new Fp(sa))),Ap="Empty",xp="AddSupervisor",$p="RemoveSupervisor",Tp="AndThen",Lp={_tag:Ap},Bp=(t,e)=>({_tag:Tp,first:t,second:e}),Dp=(t,e)=>G(t,e)?Rp:Cp(t)?Dp(t.left,e).zip(Dp(t.right,e)):t,Pp=t=>G(t,Rp)?Ps():Cp(t)?u(Pp(t.left),Ws(Pp(t.right))):qs(t),qp=jo({empty:Lp,patch:(t,e)=>((t,e)=>{let r=t,n=e;for(;Qr(n);){const t=Xr(n);switch(t._tag){case Ap:n=tn(n);break;case xp:r=r.zip(t.supervisor),n=tn(n);break;case $p:r=Dp(r,t.supervisor),n=tn(n);break;case Tp:n=Yr(t.first)(Yr(t.second)(tn(n)))}}return r})(e,Dr(t)),combine:Bp,diff:(t,e)=>{if(G(t,e))return Lp;const r=Pp(t),n=Pp(e),s=u(n,Vs(r),Ys(Lp,((t,e)=>Bp(t,{_tag:xp,supervisor:e})))),i=u(r,Vs(n),Ys(Lp,((t,e)=>Bp(t,{_tag:$p,supervisor:e}))));return Bp(s,i)}}),Up=Sp("effect_fiber_started",{incremental:!0}),Jp=Sp("effect_fiber_active"),Gp=Sp("effect_fiber_successes",{incremental:!0}),Hp=Sp("effect_fiber_failures",{incremental:!0}),Vp=vp(_p("effect_fiber_lifetimes",pd({start:.5,factor:2,count:35})),"time_unit","milliseconds"),Wp="Continue",Yp="Yield",Kp={_E:t=>t,_A:t=>t},zp=t=>{throw new Error(`BUG: FiberRuntime - ${Q(t)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},Qp=Symbol.for("effect/internal/fiberRuntime/YieldedOp"),Zp=b("effect/internal/fiberRuntime/yieldedOpChannel",(()=>({currentOp:null}))),Xp={[ut]:(t,e,r)=>C((()=>e.effect_instruction_i1(r))),OnStep:(t,e,r)=>sh(sh(r)),[at]:(t,e,r)=>C((()=>e.effect_instruction_i2(r))),[yt]:(t,e,r)=>(t.patchRuntimeFlags(t.currentRuntimeFlags,e.patch),Po(t.currentRuntimeFlags)&&t.isInterrupted()?eh(t.getInterruptedCause()):sh(r)),[dt]:(t,e,r)=>(C((()=>e.effect_instruction_i2(r))),C((()=>e.effect_instruction_i0()))?(t.pushStack(e),C((()=>e.effect_instruction_i1()))):sa),[pt]:(t,e,r)=>{for(;;){const n=C((()=>e.effect_instruction_i0.next(r)));if(n.done)return sh(n.value);const s=I(n.value);if(!Za(s))return t.pushStack(e),s;if("Failure"===s._tag)return s;r=s.value}}},tm={[Ub]:(t,e,r,n)=>(t.processNewInterruptSignal(n.cause),Po(e)?eh(n.cause):r),[Gb]:()=>{throw new Error("It is illegal to have multiple concurrent run loops in a single fiber")},[Jb]:(t,e,r,n)=>(n.onFiber(t,Bf(e)),r),[Hb]:(t,e,r)=>Tu(oa(),(()=>r))},em=St();class rm extends ef{[Xb]=td;[ed]=Kp;_fiberRefs;_fiberId;_queue=new Array;_children=null;_observers=new Array;_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(t,e,r){if(super(),this.currentRuntimeFlags=r,this._fiberId=t,this._fiberRefs=e,Ho(r)){const t=this.getFiberRef(Da);Up.unsafeUpdate(1,t),Jp.unsafeUpdate(1,t)}this.refreshRefCache()}commit(){return rd(this)}id(){return this._fiberId}resume(t){this.tell(Yb(t))}get status(){return this.ask(((t,e)=>e))}get runtimeFlags(){return this.ask(((t,e)=>e._tag===jf?t.currentRuntimeFlags:e.runtimeFlags))}scope(){return new Qb((t=this).id(),t);var t}get children(){return this.ask((t=>Array.from(t.getChildren())))}getChildren(){return null===this._children&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(qa)}fiberRefs(){return this.ask((t=>t.getFiberRefs()))}ask(t){return Zu((()=>{const e=uh(this._fiberId);return this.tell(Wb(((r,n)=>{bh(e,Xu((()=>t(r,n))))}))),ah(e)}))}tell(t){this._queue.push(t),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return vu((t=>{const e=e=>t(Qu(e));return this.tell(Wb((t=>{null!==t._exitValue?e(this._exitValue):t.addObserver(e)}))),Xu((()=>this.tell(Wb((t=>{t.removeObserver(e)})))))}),this.id())}get inheritAll(){return mu(((t,e)=>{const r=t.id(),n=t.getFiberRefs(),s=e.runtimeFlags,i=this.getFiberRefs(),o=$l(n,r,i);t.setFiberRefs(o);const c=t.getFiberRef(Om);return(t=>{const e=new fu(bt);return e.effect_instruction_i0=t,e.effect_instruction_i1=void 0,e})(u(Wo(s,c),Qo(1),Qo(16)))}))}get poll(){return Xu((()=>fe(this._exitValue)))}unsafePoll(){return this._exitValue}interruptAsFork(t){return Xu((()=>this.tell(Vb(jc(t)))))}unsafeInterruptAsFork(t){this.tell(Vb(jc(t)))}addObserver(t){null!==this._exitValue?t(this._exitValue):this._observers.push(t)}removeObserver(t){this._observers=this._observers.filter((e=>e!==t))}getFiberRefs(){return this.setFiberRef(Om,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(t){this._fiberRefs=Bl(this._fiberRefs,t)}getFiberRef(t){return this._fiberRefs.locals.has(t)?this._fiberRefs.locals.get(t)[0][1]:t.initial}setFiberRef(t,e){this._fiberRefs=ql(this._fiberRefs,{fiberId:this._fiberId,fiberRef:t,value:e}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(Rl),this.currentTracer=this.currentDefaultServices.unsafeMap.get(kl.key),this.currentSupervisor=this.getFiberRef(Em),this.currentScheduler=this.getFiberRef(Db),this.currentContext=this.getFiberRef(Na),this.currentSpan=this.currentContext.unsafeMap.get(Il.key)}setFiberRefs(t){this._fiberRefs=t,this.refreshRefCache()}addChild(t){this.getChildren().add(t)}removeChild(t){this.getChildren().delete(t)}transferChildren(t){const e=this._children;if(this._children=null,null!==e&&e.size>0)for(const r of e)null===r._exitValue&&t.add(this.currentRuntimeFlags,r)}drainQueueOnCurrentThread(){let t=!0;for(;t;){let e=Wp;const r=globalThis[nd];globalThis[nd]=this;try{for(;e===Wp;)e=0===this._queue.length?"Done":this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[nd]=r}this._queue.length>0&&!this._running?(this._running=!0,e===Yp?(this.drainQueueLaterOnExecutor(),t=!1):t=!0):t=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(ja))}drainQueueWhileRunning(t,e){let r=e;for(;this._queue.length>0;){const e=this._queue.splice(0,1)[0];r=tm[e._tag](this,t,r,e)}return r}isInterrupted(){return!((t=this.getFiberRef(qa))._tag===yc||Vc(t,!0,((t,e)=>{switch(e._tag){case yc:return ie(t);case gc:case Sc:case wc:return ie(!1);default:return se()}})));var t}addInterruptedCause(t){const e=this.getFiberRef(qa);this.setFiberRef(qa,Fc(e,t))}processNewInterruptSignal(t){this.addInterruptedCause(t),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(null===this._children||0===this._children.size)return!1;let t=!1;for(const e of this._children)e.tell(Vb(jc(this.id()))),t=!0;return t}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){const t=this._children.values();this._children=null;let e=!1;return ia({while:()=>!e,body:()=>{const r=t.next();return r.done?Xu((()=>{e=!0})):Su(r.value.await)},step:()=>{}})}return null}reportExitValue(t){if(Ho(this.currentRuntimeFlags)){const e=this.getFiberRef(Da),r=this.id().startTimeMillis,n=Date.now();switch(Vp.unsafeUpdate(n-r,e),Jp.unsafeUpdate(-1,e),t._tag){case ht:Gp.unsafeUpdate(1,e);break;case ot:Hp.unsafeUpdate(1,e)}}if("Failure"===t._tag){const e=this.getFiberRef(La);Ac(t.cause)||"Some"!==e._tag||this.log("Fiber terminated with an unhandled error",t.cause,e)}}setExitValue(t){this._exitValue=t,this.reportExitValue(t);for(let e=this._observers.length-1;e>=0;e--)this._observers[e](t);this._observers=[]}getLoggers(){return this.getFiberRef(om)}log(t,e,r){const n=ce(r)?r.value:this.getFiberRef(Ra),s=this.getFiberRef(nm);if(zl(s,n))return;const i=this.getFiberRef(Aa),o=this.getFiberRef(Fa),c=this.getLoggers(),u=this.getFiberRefs();if(Js(c)>0){const r=Mr(this.getFiberRef(Rl),xh),s=new Date(r.unsafeCurrentTimeMillis());((t,e)=>{const r=et.fiberRefs;et.fiberRefs=t;try{return e()}finally{et.fiberRefs=r}})(u,(()=>{for(const r of c)r.log({fiberId:this.id(),logLevel:n,message:t,cause:e,context:u,spans:i,annotations:o,date:s})}))}}evaluateMessageWhileSuspended(t){switch(t._tag){case Hb:return Yp;case Ub:return this.processNewInterruptSignal(t.cause),null!==this._asyncInterruptor&&(this._asyncInterruptor(eh(t.cause)),this._asyncInterruptor=null),Wp;case Gb:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(t.effect),Wp;case Jb:return t.onFiber(this,null!==this._exitValue?Lf:new $f(this.currentRuntimeFlags,this._asyncBlockingOn)),Wp;default:return zp(t)}}evaluateEffect(t){this.currentSupervisor.onResume(this);try{let e=Po(this.currentRuntimeFlags)&&this.isInterrupted()?eh(this.getInterruptedCause()):t;for(;null!==e;){const t=this.runLoop(e);if(t===Qp){const t=Zp.currentOp;Zp.currentOp=null,t._op===gt?Uo(this.currentRuntimeFlags,32)?(this.tell({_tag:Hb}),this.tell(Yb(ih)),e=null):e=ih:t._op===st&&(e=null)}else{this.currentRuntimeFlags=u(this.currentRuntimeFlags,Do(16));const r=this.interruptAllChildren();null!==r?e=Tu(r,(()=>t)):(0===this._queue.length?this.setExitValue(t):this.tell(Yb(t)),e=null)}}}finally{this.currentSupervisor.onSuspend(this)}}start(t){if(this._running)this.tell(Yb(t));else{this._running=!0;const e=globalThis[nd];globalThis[nd]=this;try{this.evaluateEffect(t)}finally{this._running=!1,globalThis[nd]=e,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(t){this.tell(Yb(t))}patchRuntimeFlags(t,e){const r=Yo(t,e);return globalThis[nd]=this,this.currentRuntimeFlags=r,r}initiateAsync(t,e){let r=!1;const n=t=>{r||(r=!0,this.tell(Yb(t)))};Po(t)&&(this._asyncInterruptor=n);try{e(n)}catch(t){n(Ru(Nc(t)))}}pushStack(t){this._stack.push(t),"OnStep"===t._op&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){const t=this._stack.pop();if(t)return"OnStep"===t._op&&this._steps.pop(),t}getNextSuccessCont(){let t=this.popStack();for(;t;){if(t._op!==ct)return t;t=this.popStack()}}getNextFailCont(){let t=this.popStack();for(;t;){if(t._op!==ut&&t._op!==dt&&t._op!==pt)return t;t=this.popStack()}}[ft](t){return Xu((()=>kr(this.currentContext,t)))}Left(t){return Cu(t.left)}None(t){return Cu(new Ka)}Right(t){return sh(t.right)}Some(t){return sh(t.value)}Micro(t){return _u((e=>{let r=e;const n=(t=>{const e=new Kf(Nb.context(new Eb));return e.evaluate(t),e})(kb(t,this.currentContext));return n.addObserver((t=>{if("Success"===t._tag)return r(sh(t.value));switch(t.cause._tag){case"Interrupt":return r(eh(jc(bi)));case"Fail":return r(Cu(t.cause.error));case"Die":return r(ku(t.cause.defect))}})),_u((t=>{r=()=>{t(sa)},n.unsafeInterrupt()}))}))}[lt](t){const e=C((()=>t.effect_instruction_i0())),r=this.getNextSuccessCont();return void 0!==r?(r._op in Xp||zp(r),Xp[r._op](this,r,e)):(Zp.currentOp=sh(e),Qp)}[ht](t){const e=t,r=this.getNextSuccessCont();return void 0!==r?(r._op in Xp||zp(r),Xp[r._op](this,r,e.effect_instruction_i0)):(Zp.currentOp=e,Qp)}[ot](t){const e=t.effect_instruction_i0,r=this.getNextFailCont();if(void 0===r)return Zp.currentOp=eh(e),Qp;switch(r._op){case ct:case at:return Po(this.currentRuntimeFlags)&&this.isInterrupted()?eh(Tc(e)):C((()=>r.effect_instruction_i1(e)));case"OnStep":return Po(this.currentRuntimeFlags)&&this.isInterrupted()?eh(Tc(e)):sh(eh(e));case yt:return this.patchRuntimeFlags(this.currentRuntimeFlags,r.patch),Po(this.currentRuntimeFlags)&&this.isInterrupted()?eh(Fc(e,this.getInterruptedCause())):eh(e);default:zp(r)}}[mt](t){return C((()=>t.effect_instruction_i0(this,Bf(this.currentRuntimeFlags))))}Blocked(t){const e=this.getFiberRefs(),r=this.currentRuntimeFlags;if(this._steps.length>0){const n=[],s=this._steps[this._steps.length-1];let i=this.popStack();for(;i&&"OnStep"!==i._op;)n.push(i),i=this.popStack();this.setFiberRefs(s.refs),this.currentRuntimeFlags=s.flags;const o=((t,e)=>{const r=new Map(t.locals);let n=cf;for(const[t,s]of e.locals.entries()){const e=Re(s)[1],i=r.get(t);if(void 0!==i){const r=Re(i)[1];G(r,e)||(n=uf({_tag:sf,fiberRef:t,patch:t.diff(r,e)})(n))}else n=uf({_tag:"Add",fiberRef:t,value:e})(n);r.delete(t)}for(const[t]of r.entries())n=uf({_tag:nf,fiberRef:t})(n);return n})(s.refs,e),c=Wo(s.flags,r);return sh(au(t.effect_instruction_i0,mu((e=>{for(;n.length>0;)e.pushStack(n.pop());return e.setFiberRefs(kf(e.id(),e.getFiberRefs())(o)),e.currentRuntimeFlags=Yo(c)(e.currentRuntimeFlags),t.effect_instruction_i1}))))}return na((e=>Tu(fm((t=>{const e=new fu("RunBlocked");return e.effect_instruction_i0=t,e})(t.effect_instruction_i0)),(()=>e(t.effect_instruction_i1)))))}RunBlocked(t){return Ju((t=>{let e=$i(t),r=xi();for(;;){const[t,n]=Di(e,[ic(),xi()],(([t,e],r)=>{const[n,s]=tc(r);return[cc(t,n),Ti(e,s)]}));if(r=ec(r,t),Ri(n))return Pi(r);e=n}throw new Error("BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues")})(t.effect_instruction_i0),(t=>hm((t=>Array.from(t.map))(t),(([t,e])=>{const r=new Map,n=[];for(const t of e){n.push(Ur(t));for(const e of t)r.set(e.request,e)}const s=n.flat();return _a(Mm(t.runAll(n),s,(()=>s.forEach((t=>{t.listeners.interrupted=!0})))),Pb,r)}),!1,!1)))}[bt](t){const e=t.effect_instruction_i0,r=this.currentRuntimeFlags,n=Yo(r,e);if(Po(n)&&this.isInterrupted())return eh(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,e),t.effect_instruction_i1){const e=Wo(n,r);return this.pushStack(new lu(e,t)),C((()=>t.effect_instruction_i1(r)))}return ih}[ut](t){return this.pushStack(t),t.effect_instruction_i0}OnStep(t){return this.pushStack(t),t.effect_instruction_i0}[ct](t){return this.pushStack(t),t.effect_instruction_i0}[at](t){return this.pushStack(t),t.effect_instruction_i0}[st](t){return this._asyncBlockingOn=t.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,t.effect_instruction_i0),Zp.currentOp=t,Qp}[gt](t){return this._isYielding=!1,Zp.currentOp=t,Qp}[dt](t){const e=t.effect_instruction_i1;return(0,t.effect_instruction_i0)()?(this.pushStack(t),e()):ih}[pt](t){return Xp[pt](this,t,void 0)}[it](t){return C((()=>t.commit()))}runLoop(t){let e=t;for(this.currentOpCount=0;;){if(2&this.currentRuntimeFlags&&this.currentSupervisor.onEffect(this,e),this._queue.length>0&&(e=this.drainQueueWhileRunning(this.currentRuntimeFlags,e)),!this._isYielding){this.currentOpCount+=1;const t=this.currentScheduler.shouldYield(this);if(!1!==t){this._isYielding=!0,this.currentOpCount=0;const r=e;e=Tu(oa({priority:t}),(()=>r))}}try{if(e=this.currentTracer.context((()=>{if(em!==e[hu]._V){const t=this.getFiberRef(Ba);"Some"===t._tag&&this.log(`Executing an Effect versioned ${e[hu]._V} with a Runtime of version 3.19.14, you may want to dedupe the effect dependencies, you can use the language service plugin to detect this at compile time: https://github.com/Effect-TS/language-service`,kc,t)}return this[e._op](e)}),this),e===Qp){const t=Zp.currentOp;return t._op===gt||t._op===st?Qp:(Zp.currentOp=null,t._op===ht||t._op===ot?t:eh(Nc(t)))}}catch(t){e=e!==Qp&&!g(e,"_op")||!(e._op in this)?Iu(`Not a valid effect: ${Q(e)}`):g(t,Wa)?eh(Fc(Nc(t),jc(bi))):ku(t)}}}run=()=>{this.drainQueueOnCurrentThread()}}const nm=b("effect/FiberRef/currentMinimumLogLevel",(()=>va(Kl))),sm=b(Symbol.for("effect/Logger/defaultLogger"),(()=>{return t=ad,od((e=>{const r=Gl(e.context,Rl);Mr(r,ml).unsafe.log(t.log(e))}));var t})),im=b(Symbol.for("effect/Logger/tracerLogger"),(()=>od((({annotations:t,cause:e,context:r,fiberId:n,logLevel:s,message:i})=>{const o=Ir(Pl(r,Na),Il);if("None"===o._tag||"ExternalSpan"===o.value._tag)return;const c=kr(Pl(r,Rl),xh),u={};for(const[e,r]of t)u[e]=r;u["effect.fiberId"]=di(n),u["effect.logLevel"]=s.label,null!==e&&"Empty"!==e._tag&&(u["effect.cause"]=Yc(e,{renderErrorCause:!0})),o.value.event(Q(Array.isArray(i)&&1===i.length?i[0]:i),c.unsafeCurrentTimeNanos(),u)})))),om=b(Symbol.for("effect/FiberRef/currentLoggers"),(()=>Oa(qs(sm,im)))),cm=(t,e)=>{const[n,s]=(t=>{if(Array.isArray(t)||w(t))return[t,se()];const e=Object.keys(t),r=e.length;return[e.map((e=>t[e])),ie((t=>{const n={};for(let s=0;s<r;s++)n[e[s]]=t[s];return n}))]})(t);return"validate"===e?.mode?((t,e,n)=>{const s=[];for(const e of t)s.push(Nu(e));return Tu(um(s,r,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),(t=>{const r=se(),s=t.length,i=new Array(s),o=new Array(s);let c=!1;for(let e=0;e<s;e++){const n=t[e];"Left"===n._tag?(i[e]=ie(n.left),c=!0):(o[e]=n.right,i[e]=r)}return c?Cu("Some"===e._tag?e.value(i):i):n?.discard?sa:Qu("Some"===e._tag?e.value(o):o)}))})(n,s,e):"either"===e?.mode?((t,e,n)=>{const s=[];for(const e of t)s.push(Nu(e));return n?.discard?um(s,r,{concurrency:n?.concurrency,batching:n?.batching,discard:!0,concurrentFinalizers:n?.concurrentFinalizers}):Hu(um(s,r,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),(t=>"Some"===e._tag?e.value(t):t))})(n,s,e):!0!==e?.discard&&"Some"===s._tag?Hu(um(n,r,e),s.value):um(n,r,e)},um=e((t=>w(t[0])),((t,e,r)=>mu((n=>{const s=!0===r?.batching||"inherit"===r?.batching&&n.getFiberRef(Ta);return r?.discard?qb(r.concurrency,(()=>ym(Of,r?.concurrentFinalizers)((r=>s?hm(t,((t,n)=>r(e(t,n))),!0,!1,1):Ju(t,((t,n)=>r(e(t,n))))))),(()=>ym(Ef,r?.concurrentFinalizers)((r=>hm(t,((t,n)=>r(e(t,n))),s,!1)))),(n=>ym(Mf(n),r?.concurrentFinalizers)((r=>hm(t,((t,n)=>r(e(t,n))),s,!1,n))))):qb(r?.concurrency,(()=>ym(Of,r?.concurrentFinalizers)((r=>s?lm(t,1,((t,n)=>r(e(t,n))),!0):Uu(t,((t,n)=>r(e(t,n))))))),(()=>ym(Ef,r?.concurrentFinalizers)((r=>am(t,((t,n)=>r(e(t,n))),s)))),(n=>ym(Mf(n),r?.concurrentFinalizers)((r=>lm(t,n,((t,n)=>r(e(t,n))),s)))))})))),am=(t,e,r)=>Zu((()=>{const n=ve(t),s=new Array(n.length);return aa(hm(n,((t,r)=>Tu(e(t,r),(t=>Xu((()=>s[r]=t))))),r,!1),Qu(s))})),hm=(t,e,r,n,s)=>na((i=>(t=>mu((e=>{const r=u(e.getFiberRef(Pa),he((()=>e.scope())));return t(_a(Pa,ie(r)))})))((o=>mu((c=>{let u=Array.from(t).reverse(),a=u.length;if(0===a)return sa;let h=0,l=!1;const f=s?Math.min(u.length,s):u.length,b=new Set,d=new Array,p=new Array,m=new Array,g=new Array,y=()=>{const t=d.filter((({exit:t})=>"Failure"===t._tag)).sort(((t,e)=>t.index<e.index?-1:t.index===e.index?0:1)).map((({exit:t})=>t));return 0===t.length&&t.push(ih),t},S=(t,e=!1)=>{const r=ra(o(t)),n=bm(r,c,c.currentRuntimeFlags,Zb);return c.currentScheduler.scheduleTask((()=>{e&&n.unsafeInterruptAsFork(c.id()),n.resume(r)}),0),n},w=()=>{n||(a-=u.length,u=[]),l=!0,b.forEach((t=>{t.currentScheduler.scheduleTask((()=>{t.unsafeInterruptAsFork(c.id())}),0)}))},_=r?Lu:ju,v=S(vu((t=>{const n=(t,e)=>{"Blocked"===t._op?g.push(t):(d.push({index:e,exit:t}),"Failure"!==t._op||l||w())},o=()=>{if(u.length>0){const f=u.pop();let w=h++;const v=()=>{const t=u.pop();return w=h++,Tu(oa(),(()=>Tu(_(i(e(t,w))),O)))},O=t=>u.length>0&&(n(t,w),u.length>0)?v():Qu(t),E=Tu(_(i(e(f,w))),O),M=S(E);p.push(M),b.add(M),l&&M.currentScheduler.scheduleTask((()=>{M.unsafeInterruptAsFork(c.id())}),0),M.addObserver((e=>{let i;if(i="Failure"===e._op?e:e.effect_instruction_i0,m.push(M),b.delete(M),n(i,w),d.length===a)t(Qu(he(Xa(y(),{parallel:!0}),(()=>ih))));else if(g.length+d.length===a){const e=y(),n=g.map((t=>t.effect_instruction_i0)).reduce(Zo);t(Qu(au(n,hm([he(Xa(e,{parallel:!0}),(()=>ih)),...g.map((t=>t.effect_instruction_i1))],(t=>t),r,!0,s))))}else o()}))}};for(let t=0;t<f;t++)o()})));return Su(Yu(Bu(i(rd(v))),nh({onFailure:t=>{w();const e=g.length+1,r=Math.min("number"==typeof s?s:g.length,g.length),n=Array.from(g);return vu((s=>{let i=0;const o=(r,o)=>()=>{i++,i===e&&s(sh(eh(t))),n.length>0&&o&&c()},c=()=>{S(n.pop(),!0).addObserver(o(0,!0))};v.addObserver(o(0,!1));for(let t=0;t<r;t++)c()}))},onSuccess:()=>Uu(m,(t=>t.inheritAll))})))})))))),lm=(t,e,r,n)=>Zu((()=>{const s=ve(t),i=new Array(s.length);return aa(hm(s,((t,e)=>Hu(r(t,e),(t=>i[e]=t))),n,!1,e),Qu(i))})),fm=t=>pm(t,Zb),bm=(t,e,r,n=null)=>dm(t,e,r,n),dm=(t,e,r,n=null)=>{const s=pi(),i=e.getFiberRefs(),o=Tl(i,s),c=new rm(s,o,r),a=Pl(o,Na),h=c.currentSupervisor;return h.onStart(a,t,ie(e),c),c.addObserver((t=>h.onEnd(t,c))),(null!==n?n:u(e.getFiberRef(Pa),he((()=>e.scope())))).add(r,c),c},pm=(t,e)=>mu(((r,n)=>Qu(((t,e,r,n=null)=>{const s=dm(t,e,r,n);return s.resume(t),s})(t,r,n.runtimeFlags,e)))),mm=t=>gh((e=>ue(Ir(e,wm),{onNone:()=>t,onSome:e=>{switch(e.strategy._tag){case"Parallel":return t;case"Sequential":case"ParallelN":return Tu(Ua(e,Ef),(e=>_m(t,e)))}}}))),gm=t=>e=>gh((r=>ue(Ir(r,wm),{onNone:()=>e,onSome:r=>"ParallelN"===r.strategy._tag&&r.strategy.parallelism===t?e:Tu(Ua(r,Mf(t)),(t=>_m(e,t)))}))),ym=(t,e)=>n=>gh((s=>ue(Ir(s,wm),{onNone:()=>n(r),onSome:s=>{if(!0!==e)return n(r);{const e="Parallel"===t._tag?mm:"Sequential"===t._tag?Sm:gm(t.parallelism);switch(s.strategy._tag){case"Parallel":return e(n(mm));case"Sequential":return e(n(Sm));case"ParallelN":return e(n(gm(s.strategy.parallelism)))}}}}))),Sm=t=>gh((e=>ue(Ir(e,wm),{onNone:()=>t,onSome:e=>{switch(e.strategy._tag){case"Sequential":return t;case"Parallel":case"ParallelN":return Tu(Ua(e,Of),(e=>_m(t,e)))}}}))),wm=_r("effect/Scope"),_m=e(2,((t,e)=>Sh(t,Nr(Or(wm,e))))),vm=t=>ka(t,{differ:qp,fork:Lp}),Om=Ia(Go),Em=vm(Rp),Mm=(t,e,r)=>$u((n=>Tu(Tu(fm(Gu(t)),(t=>vu((n=>{const s=e.map((t=>t.listeners.count)),i=()=>{s.every((t=>0===t))&&e.every((t=>"Pending"===t.result.state.current._tag||!("Done"!==t.result.state.current._tag||!Za(t.result.state.current.effect)||"Failure"!==t.result.state.current.effect._tag||!(t=>ce((t=>Pc(t,(t=>t._tag===wc?ie(t.fiberId):se())))(t)))(t.result.state.current.effect.cause))))&&(o.forEach((t=>t())),r?.(),n((t=>Tu(xu,(e=>u(t,ha(e)))))(t)))};t.addObserver((t=>{o.forEach((t=>t())),n(t)}));const o=e.map(((t,e)=>{const r=t=>{s[e]=t,i()};return t.listeners.addObserver(r),()=>t.listeners.removeObserver(r)}));return i(),Xu((()=>{o.forEach((t=>t()))}))})))),(()=>Zu((()=>{const t=e.flatMap((t=>t.state.completed?[]:[t]));return Ju(t,(t=>Mp(t.request,(t=>eh(jc(t)))(n))))})))))),km=Ua,Im=t=>function(){if(1===arguments.length){const e=arguments[0];return(r,...n)=>t(e,r,...n)}return t.apply(this,arguments)},Nm=Im(((t,e,r)=>{const n=pi(),s=[[Na,[[n,t.context]]]];r?.scheduler&&s.push([Db,[[n,r.scheduler]]]);let i=Hl(t.fiberRefs,{entries:s,forkAs:n});r?.updateRefs&&(i=r.updateRefs(i,n));const o=new rm(n,i,t.runtimeFlags);let c=e;r?.scope&&(c=Tu(km(r.scope,vf),(t=>aa(((t,e)=>t.addFinalizer((()=>Su(e))))(t,$u((t=>G(t,o.id())?sa:ha(o,t)))),Yu(e,(e=>((t,e)=>t.close(e))(t,e)))))));const u=o.currentSupervisor;return u!==Rp&&(u.onStart(t.context,c,se(),o),o.addObserver((t=>u.onEnd(t,o)))),Zb.add(t.runtimeFlags,o),!1===r?.immediate?o.resume(c):o.start(c),o})),jm=Im(((t,e)=>{const r=Tm(t)(e);if("Failure"===r._tag)throw xm(r.effect_instruction_i0);return r.effect_instruction_i0}));class Cm extends Error{fiber;_tag="AsyncFiberException";constructor(t){super(`Fiber #${t.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=t,this.name=this._tag,this.stack=this.message}}const Fm=Symbol.for("effect/Runtime/FiberFailure"),Rm=Symbol.for("effect/Runtime/FiberFailure/Cause");class Am extends Error{[Fm];[Rm];constructor(t){const e=ru(t)[0];super(e?.message||"An error has occurred"),this[Fm]=Fm,this[Rm]=t,this.name=e?`(FiberFailure) ${e.name}`:"FiberFailure",e?.stack&&(this.stack=e.stack)}toJSON(){return{_id:"FiberFailure",cause:this[Rm].toJSON()}}toString(){return"(FiberFailure) "+Yc(this[Rm],{renderErrorCause:!0})}[Y](){return this.toString()}}const xm=t=>{const e=Error.stackTraceLimit;Error.stackTraceLimit=0;const r=new Am(t);return Error.stackTraceLimit=e,r},$m=t=>{const e=t;switch(e._op){case"Failure":case"Success":return e;case"Left":return th(e.left);case"Right":return sh(e.right);case"Some":return sh(e.value);case"None":return th(new Ka)}},Tm=Im(((t,e)=>{const r=$m(e);if(r)return r;const n=new Bb,s=Nm(t)(e,{scheduler:n});n.flush();return s.unsafePoll()||(i=Mu((t=>{const e=Error.stackTraceLimit;Error.stackTraceLimit=0;const r=new Cm(t);return Error.stackTraceLimit=e,r})(s),wh(s)),eh(Nc(i)));var i})),Lm=Im(((t,e,r)=>Bm(t,e,r).then((t=>{switch(t._tag){case ht:return t.effect_instruction_i0;case ot:throw xm(t.effect_instruction_i0)}})))),Bm=Im(((t,e,r)=>new Promise((n=>{const s=$m(e);s&&n(s);const i=Nm(t)(e);i.addObserver((t=>{n(t)})),void 0!==r?.signal&&(r.signal.aborted?i.unsafeInterruptAsFork(i.id()):r.signal.addEventListener("abort",(()=>{i.unsafeInterruptAsFork(i.id())}),{once:!0}))}))));class Dm{context;runtimeFlags;fiberRefs;constructor(t,e,r){this.context=t,this.runtimeFlags=e,this.fiberRefs=r}pipe(){return nt(this,arguments)}}const Pm=t=>new Dm(t.context,t.runtimeFlags,t.fiberRefs),qm=Jo(1,32,4),Um=Pm({context:vr(),runtimeFlags:qm,fiberRefs:Vl()}),Jm=Lm(Um),Gm=jm(Um),Hm=function(){const t=Symbol.for("effect/Data/Error/plainArgs");return class extends Ja{constructor(e){super(e?.message,e?.cause?{cause:e.cause}:void 0),e&&(Object.assign(this,e),Object.defineProperty(this,t,{value:e,enumerable:!1}))}toJSON(){return{...this[t],...this}}}}(),Vm=t=>{const e={BaseEffectError:class extends Hm{_tag=t}};return e.BaseEffectError.prototype.name=t,e.BaseEffectError},Wm=function(){const t=1===arguments.length?arguments[0]:arguments[1].bind(arguments[0]);return e=()=>t(u),Zu((()=>{const t=new fu(pt);return t.effect_instruction_i0=e(),t}));var e},Ym=Qu,Km=Ou,zm=t=>{let e,r;return"function"==typeof t?e=t:(e=t.try,r=t.catch),Zu((()=>{try{return Qu(C(e))}catch(t){return Cu(r?C((()=>r(t))):new Qa(t,"An unknown error occurred in Effect.try"))}}))},Qm=t=>{let e,r;"function"==typeof t?e=t:(e=t.try,r=t.catch);const n=t=>r?Fu((()=>r(t))):Cu(new Qa(t,"An unknown error occurred in Effect.tryPromise"));return vu(e.length>=1?(t,r)=>{try{e(r).then((e=>t(Qu(e))),(e=>t(n(e))))}catch(e){t(n(e))}}:t=>{try{e().then((e=>t(Qu(e))),(e=>t(n(e))))}catch(e){t(n(e))}})},Zm=wf,Xm=gf,tg=yf,eg=Sf,rg=Jm,ng=Gm;Vm("URLCreationError");const sg=(e,r)=>{const n=function(...t){return t.filter(Boolean).join("/").replace("//","/").replace("/./","/")}("../../assets",r,e);return zm((()=>t(n))).pipe(Zm((()=>Xm(`Failed to create URL for asset "${e}" in path "${r}".\n Please provide an absolute URL in your app's 'setAssetPath(...)' configuration! Falling back to a relative URL, which may work in some environments but is not guaranteed to be correct.`))),eg((()=>new URL(n,import.meta?.url??window?.location?.origin??""))))};export{g as $,Qt as A,Xu as B,Rh as C,Zu as D,kh as E,Qu as F,se as G,Nh as H,ce as I,ie as J,be as K,jh as L,Ui as M,Y as N,Tu as O,Fh as P,Mh as Q,pf as R,Zs as S,ti as T,Qs as U,R as V,u as W,U as X,$ as Y,A as Z,J as _,ng as a,G as a0,Su as a1,_f as a2,kn as a3,Ku as a4,aa as a5,ju as a6,yh as a7,mh as a8,xu as a9,Vm as aa,Wm as ab,Qm as ac,zm as ad,gn as ae,Xm as af,Ym as b,Km as c,Wt as d,Yt as e,zt as f,Zt as g,ae as h,r as i,uh as j,ah as k,tg as l,ue as m,fh as n,lh as o,sh as p,e as q,rg as r,sg as s,Zm as t,nt as u,K as v,z as w,hn as x,Hu as y,cm as z}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t,d as s,e,i,f as r,h as n,m as o,j as a,k as h,n as c,o as u,p as d,q as l,u as v,N as f,v as m,w as p,x as y,y as g,z as S,A as b,B as w,C as x,D as C,E as k,F as E,G as M,H as _,I as O,J as N,K as V,L as A,M as L,O as R,P,Q as T,R as j,S as B,T as z,U as F,V as G,W as K,X as Q,Y as D,Z as J,_ as $,$ as H,a0 as I,a1 as W,a2 as q,a3 as U,a4 as X,a5 as Y,a6 as Z,a7 as tt,a8 as st,a9 as et,aa as it,ab as rt,ac as nt,ad as ot,ae as at,s as ht,af as ct}from"./p-D9lc4ayG.js";const ut=Symbol.for("effect/Brand/Refined"),dt=h,lt=u,vt=c,ft=a,mt=d,pt=Symbol.for("effect/MutableList"),yt={[pt]:pt,[Symbol.iterator](){let t=!1,s=this.head;return{next(){if(t)return this.return();if(null==s)return t=!0,this.return();const e=s.value;return s=s.next,{done:t,value:e}},return:s=>(t||(t=!0),{done:!0,value:s})}},toString(){return p(this.toJSON())},toJSON(){return{_id:"MutableList",values:Array.from(this).map(m)}},[f](){return this.toJSON()},pipe(){return v(this,arguments)}},gt=t=>t._length,St=l(2,((t,s)=>{const e=(t=>({value:t,removed:!1,prev:void 0,next:void 0}))(s);return void 0===t.head&&(t.head=e),void 0===t.tail||(t.tail.next=e,e.prev=t.tail),t.tail=e,t._length+=1,t})),bt=Symbol.for("effect/MutableQueue"),wt=Symbol.for("effect/mutable/MutableQueue/Empty"),xt={[bt]:bt,[Symbol.iterator](){return Array.from(this.queue)[Symbol.iterator]()},toString(){return p(this.toJSON())},toJSON(){return{_id:"MutableQueue",values:Array.from(this).map(m)}},[f](){return this.toJSON()},pipe(){return v(this,arguments)}},Ct=t=>{const s=Object.create(xt);return s.queue=(()=>{const t=Object.create(yt);return t.head=void 0,t.tail=void 0,t._length=0,t})(),s.capacity=t,s},kt=l(2,((t,s)=>{const e=gt(t.queue);return(void 0===t.capacity||e!==t.capacity)&&(St(s)(t.queue),!0)})),Et=l(2,((t,s)=>(t=>0===gt(t))(t.queue)?s:(t=>{const s=t.head;if(void 0!==s)return((t,s)=>{s.removed||(s.removed=!0,void 0!==s.prev&&void 0!==s.next?(s.prev.next=s.next,s.next.prev=s.prev):void 0!==s.prev?(t.tail=s.prev,s.prev.next=void 0):void 0!==s.next?(t.head=s.next,s.next.prev=void 0):(t.tail=void 0,t.head=void 0),t._length>0&&(t._length-=1))})(t,s),s.value})(t.queue))),Mt=(t,s,e,i)=>L({_tag:"Complete",key:t,exit:s,entryStats:e,timeToLiveMillis:i}),_t=(t,s)=>L({_tag:"Pending",key:t,deferred:s}),Ot=Symbol.for("effect/Cache/MapKey");class Nt{current;[Ot]=Ot;previous=void 0;next=void 0;constructor(t){this.current=t}[G](){return K(J(this.current),D(J(this.previous)),D(J(this.next)),Q(this))}[$](t){return this===t||At(t)&&I(this.current,t.current)&&I(this.previous,t.previous)&&I(this.next,t.next)}}const Vt=t=>new Nt(t),At=t=>H(t,Ot);class Lt{head=void 0;tail=void 0;add(t){if(t!==this.tail)if(void 0===this.tail)this.head=t,this.tail=t;else{const s=t.previous,e=t.next;void 0!==e&&(t.next=void 0,void 0!==s?(s.next=e,e.previous=s):(this.head=e,this.head.previous=void 0)),this.tail.next=t,t.previous=this.tail,this.tail=t}}remove(){const t=this.head;if(void 0!==t){const s=t.next;void 0!==s?(t.next=void 0,this.head=s,this.head.previous=void 0):(this.head=void 0,this.tail=void 0)}return t}}const Rt=Symbol.for("effect/Cache"),Pt={_Key:t=>t,_Error:t=>t,_Value:t=>t},Tt=Symbol.for("effect/ConsumerCache"),jt={_Key:t=>t,_Error:t=>t,_Value:t=>t},Bt=t=>({loadedMillis:t});class zt{capacity;context;fiberId;lookup;timeToLive;[Rt]=Pt;[Tt]=jt;cacheState;constructor(t,s,e,i,r){this.capacity=t,this.context=s,this.fiberId=e,this.lookup=i,this.timeToLive=r,this.cacheState={map:T(),keys:new Lt,accesses:Ct(void 0),updating:F(!1),hits:0,misses:0}}get(t){return g(this.getEither(t),b)}get cacheStats(){return w((()=>({hits:this.cacheState.hits,misses:this.cacheState.misses,size:x(this.cacheState.map)})))}getOption(t){return C((()=>o(k(this.cacheState.map,t),{onNone:()=>{const s=Vt(t);return this.trackAccess(s),this.trackMiss(),E(M())},onSome:t=>this.resolveMapValue(t)})))}getOptionComplete(t){return C((()=>o(k(this.cacheState.map,t),{onNone:()=>{const s=Vt(t);return this.trackAccess(s),this.trackMiss(),E(M())},onSome:t=>this.resolveMapValue(t,!0)})))}contains(t){return w((()=>_(this.cacheState.map,t)))}entryStats(t){return w((()=>{const s=k(this.cacheState.map,t);if(O(s))switch(s.value._tag){case"Complete":return N(Bt(s.value.entryStats.loadedMillis));case"Pending":return M();case"Refreshing":return N(Bt(s.value.complete.entryStats.loadedMillis))}return M()}))}getEither(t){return C((()=>{const i=t;let r,n,a=V(k(this.cacheState.map,i));return void 0===a&&(n=ft(this.fiberId),r=Vt(i),_(this.cacheState.map,i)?a=V(k(this.cacheState.map,i)):A(this.cacheState.map,i,_t(r,n))),void 0===a?(this.trackAccess(r),this.trackMiss(),g(this.lookupValueOf(t,n),s)):R(this.resolveMapValue(a),o({onNone:()=>this.getEither(t),onSome:t=>E(e(t))}))}))}invalidate(t){return w((()=>{P(this.cacheState.map,t)}))}invalidateWhen(t,s){return w((()=>{const e=k(this.cacheState.map,t);O(e)&&"Complete"===e.value._tag&&"Success"===e.value.exit._tag&&s(e.value.exit.value)&&P(this.cacheState.map,t)}))}get invalidateAll(){return w((()=>{this.cacheState.map=T()}))}refresh(t){return j((s=>C((()=>{const e=t,i=ft(this.fiberId);let r=V(k(this.cacheState.map,e));if(void 0===r&&(_(this.cacheState.map,e)?r=V(k(this.cacheState.map,e)):A(this.cacheState.map,e,_t(Vt(e),i))),void 0===r)return W(this.lookupValueOf(t,i));switch(r._tag){case"Complete":if(this.hasExpired(s,r.timeToLiveMillis)){const s=V(k(this.cacheState.map,e));return I(s,r)&&P(this.cacheState.map,e),W(this.get(t))}return K(this.lookupValueOf(t,i),q((()=>{const t=V(k(this.cacheState.map,e));if(I(t,r)){const t=((t,s)=>L({_tag:"Refreshing",deferred:t,complete:s}))(i,r);return A(this.cacheState.map,e,t),!0}return!1})),W);case"Pending":case"Refreshing":return dt(r.deferred)}}))))}set(t,s){return j((e=>w((()=>{const i=e.unsafeCurrentTimeMillis(),r=t,n=mt(s),o=Mt(Vt(r),n,Bt(i),i+U(y(this.timeToLive(n))));A(this.cacheState.map,r,o)}))))}get size(){return w((()=>x(this.cacheState.map)))}get values(){return w((()=>{const t=[];for(const s of this.cacheState.map)"Complete"===s[1]._tag&&"Success"===s[1].exit._tag&&t.push(s[1].exit.value);return t}))}get entries(){return w((()=>{const t=[];for(const s of this.cacheState.map)"Complete"===s[1]._tag&&"Success"===s[1].exit._tag&&t.push([s[0],s[1].exit.value]);return t}))}get keys(){return w((()=>{const t=[];for(const s of this.cacheState.map)"Complete"===s[1]._tag&&"Success"===s[1].exit._tag&&t.push(s[0]);return t}))}resolveMapValue(t,s=!1){return j((e=>{switch(t._tag){case"Complete":return this.trackAccess(t.key),this.hasExpired(e,t.timeToLiveMillis)?(P(this.cacheState.map,t.key.current),E(M())):(this.trackHit(),g(t.exit,N));case"Pending":return this.trackAccess(t.key),this.trackHit(),s?E(M()):g(dt(t.deferred),N);case"Refreshing":return this.trackAccess(t.complete.key),this.trackHit(),this.hasExpired(e,t.complete.timeToLiveMillis)?s?E(M()):g(dt(t.deferred),N):g(t.complete.exit,N)}}))}trackHit(){this.cacheState.hits=this.cacheState.hits+1}trackMiss(){this.cacheState.misses=this.cacheState.misses+1}trackAccess(t){if(kt(this.cacheState.accesses,t),B(this.cacheState.updating,!1,!0)){let t=!0;for(;t;){const s=Et(this.cacheState.accesses,wt);s===wt?t=!1:this.cacheState.keys.add(s)}let s=x(this.cacheState.map);for(t=s>this.capacity;t;){const e=this.cacheState.keys.remove();void 0!==e?_(this.cacheState.map,e.current)&&(P(this.cacheState.map,e.current),s-=1,t=s>this.capacity):t=!1}z(this.cacheState.updating,!1)}}hasExpired(t,s){return t.unsafeCurrentTimeMillis()>s}lookupValueOf(t,s){return j((e=>C((()=>{const i=t;return K(this.lookup(t),tt(this.context),Z,R((t=>{const r=e.unsafeCurrentTimeMillis(),n=Bt(r),o=Mt(Vt(i),t,n,r+U(y(this.timeToLive(t))));return A(this.cacheState.map,i,o),Y(lt(s,t),t)})),X((()=>Y(vt(s),w((()=>{P(this.cacheState.map,i)}))))))}))))}}const Ft=t=>{const s=y(t.timeToLive);return(t=>g(S([st(),et]),(([s,e])=>new zt(t.capacity,s,e,t.lookup,(s=>y(t.timeToLive(s)))))))({capacity:t.capacity,lookup:t.lookup,timeToLive:()=>s})};class Gt extends(it("FetchError")){}class Kt extends(it("NotFoundError")){}class Qt extends(it("ResponseTextError")){constructor(t){super(new Error("Failed to read response text",{cause:t}))}}const Dt=function(...a){const h=2===a.length?t=>a[0](t)?s(t):e(a[1](t)):t=>o(a[0](t),{onNone:()=>s(t),onSome:e});return Object.assign((s=>t(h(s),i)),{[ut]:ut,option:t=>n(h(t)),either:h,is:t=>r(h(t))})}((function(t){if("string"!=typeof t)return!1;try{return"svg"===(new DOMParser).parseFromString(t,"image/svg+xml").documentElement.nodeName}catch{return!1}}),(()=>[{message:"SVG data is malformed",meta:undefined}]));class Jt extends(it("BrandValidationError")){constructor(t,s){super(new Error(`Brand validation failed for type ${s}.`,{cause:t}))}}const $t=()=>Dt('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>');let Ht=null;function It(t){const s=t;return rt((function*(){return Ht||(Ht=yield*Ft({capacity:200,timeToLive:at,lookup:t=>rt((function*(){const s=t,e=yield*ht(`${s}.svg`,"icons"),i=yield*(r=e,rt((function*(){const t=yield*nt({try:()=>fetch(r,void 0),catch:t=>new Gt({cause:t})});return 404===t.status?yield*new Kt({url:t.url}):t})));var r;const n=yield*(t=>nt({try:()=>t.text(),catch:t=>new Qt(t)}))(i);return yield*(o=n,ot({try:()=>Dt(o),catch:t=>new Jt(t,"SVGString")}));var o}))})),yield*Ht.get(s)}))}function Wt(){return rt((function*(){Ht?yield*Ht.invalidateAll:ct("Attempted to clear icon cache before it was initialized")}))}export{Wt as c,$t as e,It as f}
|