@galaxy-tool-util/gxwf-web 1.4.0 → 1.5.0

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.
Files changed (64) hide show
  1. package/package.json +5 -5
  2. package/public/assets/{FileView-CsOpVj29.js → FileView-fG7RG6QP.js} +1 -1
  3. package/public/assets/{ToolCacheView-bRFTq8lT.js → ToolCacheView-TNGPFceD.js} +2 -2
  4. package/public/assets/WorkflowView-D0y_HEKs.js +198 -0
  5. package/public/assets/{architectureDiagram-Q4EWVU46-jinf4bpr.js → architectureDiagram-Q4EWVU46-CAgVzFqE.js} +1 -1
  6. package/public/assets/{blockDiagram-DXYQGD6D-DyH9QtyX.js → blockDiagram-DXYQGD6D-BgA362BK.js} +1 -1
  7. package/public/assets/{c4Diagram-AHTNJAMY-eIaaNFF5.js → c4Diagram-AHTNJAMY-KGdXuDOE.js} +1 -1
  8. package/public/assets/channel-DDEfYj9m.js +1 -0
  9. package/public/assets/{chunk-336JU56O-K6Z1vrz8.js → chunk-336JU56O-DU7Z6ZqP.js} +2 -2
  10. package/public/assets/{chunk-426QAEUC-B7stkjff.js → chunk-426QAEUC-DYNMZOw6.js} +1 -1
  11. package/public/assets/{chunk-4TB4RGXK-DzYiMt8K.js → chunk-4TB4RGXK-ClYdUZGQ.js} +1 -1
  12. package/public/assets/{chunk-5FUZZQ4R-BXjMW0vl.js → chunk-5FUZZQ4R-BTrpKOs2.js} +1 -1
  13. package/public/assets/{chunk-5PVQY5BW-DpYMb9bR.js → chunk-5PVQY5BW-Dc2FZZd9.js} +1 -1
  14. package/public/assets/{chunk-EDXVE4YY-B13SDZ3c.js → chunk-EDXVE4YY-Cb_jQNPc.js} +1 -1
  15. package/public/assets/{chunk-ENJZ2VHE-DrVCiAoi.js → chunk-ENJZ2VHE-D72PJYFH.js} +1 -1
  16. package/public/assets/{chunk-ICPOFSXX-DwxYmUOT.js → chunk-ICPOFSXX-BfFbNaWT.js} +1 -1
  17. package/public/assets/{chunk-OYMX7WX6-CmfQJYSW.js → chunk-OYMX7WX6-BJ7HnA9i.js} +1 -1
  18. package/public/assets/{chunk-U2HBQHQK-oBXc92ns.js → chunk-U2HBQHQK-Cw2C_MTw.js} +1 -1
  19. package/public/assets/{chunk-X2U36JSP-CWkpvLVO.js → chunk-X2U36JSP-D9cn8Q0g.js} +1 -1
  20. package/public/assets/{chunk-YZCP3GAM-0MxWrEbo.js → chunk-YZCP3GAM-DbF6Xmqb.js} +1 -1
  21. package/public/assets/{chunk-ZZ45TVLE-BqOxN5U6.js → chunk-ZZ45TVLE-jc5HPlLj.js} +1 -1
  22. package/public/assets/classDiagram-6PBFFD2Q-BonxU2Pr.js +1 -0
  23. package/public/assets/classDiagram-v2-HSJHXN6E-DIw72pvQ.js +1 -0
  24. package/public/assets/clone-b9hz-7Rr.js +1 -0
  25. package/public/assets/{dagre-BxiFovGJ.js → dagre-CgPPoXdp.js} +1 -1
  26. package/public/assets/{dagre-KV5264BT-1zSgR5z0.js → dagre-KV5264BT-CEnKOkJD.js} +1 -1
  27. package/public/assets/{diagram-5BDNPKRD-DpWxP0aE.js → diagram-5BDNPKRD-9tqQbmWk.js} +1 -1
  28. package/public/assets/{diagram-G4DWMVQ6-BhUB45RQ.js → diagram-G4DWMVQ6-BmYgThWl.js} +1 -1
  29. package/public/assets/{diagram-MMDJMWI5-D3tAT1JA.js → diagram-MMDJMWI5-DivvwOWS.js} +1 -1
  30. package/public/assets/{diagram-TYMM5635-Y66BFGuY.js → diagram-TYMM5635-D1_Tj6pF.js} +1 -1
  31. package/public/assets/{erDiagram-SMLLAGMA-olVV48Hp.js → erDiagram-SMLLAGMA-CYSV0BE4.js} +1 -1
  32. package/public/assets/{flowDiagram-DWJPFMVM-QayyKS33.js → flowDiagram-DWJPFMVM-BGIkFQ6t.js} +1 -1
  33. package/public/assets/{ganttDiagram-T4ZO3ILL-DmE3LL1i.js → ganttDiagram-T4ZO3ILL-VI4Gbq3U.js} +1 -1
  34. package/public/assets/{gitGraphDiagram-UUTBAWPF-KhK3dvbQ.js → gitGraphDiagram-UUTBAWPF-Do1y70il.js} +1 -1
  35. package/public/assets/{graphlib-Bi-ymRsv.js → graphlib-DgT5U4LD.js} +1 -1
  36. package/public/assets/{index-4Ycp0GGC.js → index-DujJTa6m.js} +2 -2
  37. package/public/assets/{infoDiagram-42DDH7IO-BmhfgIe-.js → infoDiagram-42DDH7IO-CsPsiDMr.js} +1 -1
  38. package/public/assets/{ishikawaDiagram-UXIWVN3A-D-BfQrbQ.js → ishikawaDiagram-UXIWVN3A-BKfIGTr_.js} +1 -1
  39. package/public/assets/{journeyDiagram-VCZTEJTY-CT0HRztw.js → journeyDiagram-VCZTEJTY-Dew-JWJP.js} +1 -1
  40. package/public/assets/{kanban-definition-6JOO6SKY-BZnydE-0.js → kanban-definition-6JOO6SKY-B49jS5tm.js} +1 -1
  41. package/public/assets/{line-qKqldnLj.js → line-DLs8pe8_.js} +1 -1
  42. package/public/assets/{mermaid-parser.core-C09j9HB7.js → mermaid-parser.core-C7uDfEv_.js} +1 -1
  43. package/public/assets/{mermaid.core-BDhviqRd.js → mermaid.core-DZ5cLraE.js} +3 -3
  44. package/public/assets/{mindmap-definition-QFDTVHPH-Dt3WMSPV.js → mindmap-definition-QFDTVHPH-Dtd9nryT.js} +1 -1
  45. package/public/assets/{pieDiagram-DEJITSTG-Yqe8uCAr.js → pieDiagram-DEJITSTG-DecnWuHL.js} +1 -1
  46. package/public/assets/{quadrantDiagram-34T5L4WZ-D6S_SKNN.js → quadrantDiagram-34T5L4WZ-rwtCHNqR.js} +1 -1
  47. package/public/assets/{requirementDiagram-MS252O5E-jfbAS50v.js → requirementDiagram-MS252O5E-B_KKFFTQ.js} +1 -1
  48. package/public/assets/{sankeyDiagram-XADWPNL6-BAUJwgc9.js → sankeyDiagram-XADWPNL6-6dvvnj4L.js} +1 -1
  49. package/public/assets/{sequenceDiagram-FGHM5R23-D7HLbuOf.js → sequenceDiagram-FGHM5R23--QMwD4p7.js} +1 -1
  50. package/public/assets/{stateDiagram-FHFEXIEX-BX7o31BE.js → stateDiagram-FHFEXIEX-CG8TGK15.js} +1 -1
  51. package/public/assets/stateDiagram-v2-QKLJ7IA2-Diy8mz-j.js +1 -0
  52. package/public/assets/{timeline-definition-GMOUNBTQ-CZLMeEm3.js → timeline-definition-GMOUNBTQ-RU_gK7LU.js} +1 -1
  53. package/public/assets/useToolInfoService-C1D4X77C.js +276 -0
  54. package/public/assets/{vennDiagram-DHZGUBPP-CU_yL8Jq.js → vennDiagram-DHZGUBPP-DkBDAkqR.js} +1 -1
  55. package/public/assets/{wardleyDiagram-NUSXRM2D-BJ2G793c.js → wardleyDiagram-NUSXRM2D-BC-MZSUZ.js} +1 -1
  56. package/public/assets/{xychartDiagram-5P7HB3ND-CtCVgkGt.js → xychartDiagram-5P7HB3ND-YSSUwZXU.js} +1 -1
  57. package/public/index.html +1 -1
  58. package/public/assets/WorkflowView-CRSqinCX.js +0 -198
  59. package/public/assets/channel-B9wkeALp.js +0 -1
  60. package/public/assets/classDiagram-6PBFFD2Q-A_f6K02B.js +0 -1
  61. package/public/assets/classDiagram-v2-HSJHXN6E-DrcrbPO1.js +0 -1
  62. package/public/assets/clone-grQBEjNN.js +0 -1
  63. package/public/assets/stateDiagram-v2-QKLJ7IA2-Co5H7aCg.js +0 -1
  64. package/public/assets/useToolInfoService-BoFJqmDR.js +0 -276
@@ -1,276 +0,0 @@
1
- import{n as e,o as t,r as n,t as r}from"./chunk-Bj-mKKzh.js";import{$t as i,Cn as a,E as o,En as s,Ft as c,I as l,It as u,Jt as d,Lt as f,Nt as p,Qt as m,Rt as h,St as g,Wt as _,Xt as v,Yt as ee,Z as te,Zt as ne,_ as re,_n as ie,at as ae,c as oe,dn as se,fn as ce,gn as le,it as ue,ln as de,lt as fe,pn as pe,qt as me,rn as he,sn as ge,un as _e,x as ve,xt as ye,yt as be}from"./useApi-CXAk43j3.js";import{g as xe,h as Se,l as Ce,u as we}from"./index-4Ycp0GGC.js";import"./browser-DVDf39JZ.js";var Te=o.extend({name:`togglebutton`,style:`
2
- .p-togglebutton {
3
- display: inline-flex;
4
- cursor: pointer;
5
- user-select: none;
6
- overflow: hidden;
7
- position: relative;
8
- color: dt('togglebutton.color');
9
- background: dt('togglebutton.background');
10
- border: 1px solid dt('togglebutton.border.color');
11
- padding: dt('togglebutton.padding');
12
- font-size: 1rem;
13
- font-family: inherit;
14
- font-feature-settings: inherit;
15
- transition:
16
- background dt('togglebutton.transition.duration'),
17
- color dt('togglebutton.transition.duration'),
18
- border-color dt('togglebutton.transition.duration'),
19
- outline-color dt('togglebutton.transition.duration'),
20
- box-shadow dt('togglebutton.transition.duration');
21
- border-radius: dt('togglebutton.border.radius');
22
- outline-color: transparent;
23
- font-weight: dt('togglebutton.font.weight');
24
- }
25
-
26
- .p-togglebutton-content {
27
- display: inline-flex;
28
- flex: 1 1 auto;
29
- align-items: center;
30
- justify-content: center;
31
- gap: dt('togglebutton.gap');
32
- padding: dt('togglebutton.content.padding');
33
- background: transparent;
34
- border-radius: dt('togglebutton.content.border.radius');
35
- transition:
36
- background dt('togglebutton.transition.duration'),
37
- color dt('togglebutton.transition.duration'),
38
- border-color dt('togglebutton.transition.duration'),
39
- outline-color dt('togglebutton.transition.duration'),
40
- box-shadow dt('togglebutton.transition.duration');
41
- }
42
-
43
- .p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover {
44
- background: dt('togglebutton.hover.background');
45
- color: dt('togglebutton.hover.color');
46
- }
47
-
48
- .p-togglebutton.p-togglebutton-checked {
49
- background: dt('togglebutton.checked.background');
50
- border-color: dt('togglebutton.checked.border.color');
51
- color: dt('togglebutton.checked.color');
52
- }
53
-
54
- .p-togglebutton-checked .p-togglebutton-content {
55
- background: dt('togglebutton.content.checked.background');
56
- box-shadow: dt('togglebutton.content.checked.shadow');
57
- }
58
-
59
- .p-togglebutton:focus-visible {
60
- box-shadow: dt('togglebutton.focus.ring.shadow');
61
- outline: dt('togglebutton.focus.ring.width') dt('togglebutton.focus.ring.style') dt('togglebutton.focus.ring.color');
62
- outline-offset: dt('togglebutton.focus.ring.offset');
63
- }
64
-
65
- .p-togglebutton.p-invalid {
66
- border-color: dt('togglebutton.invalid.border.color');
67
- }
68
-
69
- .p-togglebutton:disabled {
70
- opacity: 1;
71
- cursor: default;
72
- background: dt('togglebutton.disabled.background');
73
- border-color: dt('togglebutton.disabled.border.color');
74
- color: dt('togglebutton.disabled.color');
75
- }
76
-
77
- .p-togglebutton-label,
78
- .p-togglebutton-icon {
79
- position: relative;
80
- transition: none;
81
- }
82
-
83
- .p-togglebutton-icon {
84
- color: dt('togglebutton.icon.color');
85
- }
86
-
87
- .p-togglebutton:not(:disabled):not(.p-togglebutton-checked):hover .p-togglebutton-icon {
88
- color: dt('togglebutton.icon.hover.color');
89
- }
90
-
91
- .p-togglebutton.p-togglebutton-checked .p-togglebutton-icon {
92
- color: dt('togglebutton.icon.checked.color');
93
- }
94
-
95
- .p-togglebutton:disabled .p-togglebutton-icon {
96
- color: dt('togglebutton.icon.disabled.color');
97
- }
98
-
99
- .p-togglebutton-sm {
100
- padding: dt('togglebutton.sm.padding');
101
- font-size: dt('togglebutton.sm.font.size');
102
- }
103
-
104
- .p-togglebutton-sm .p-togglebutton-content {
105
- padding: dt('togglebutton.content.sm.padding');
106
- }
107
-
108
- .p-togglebutton-lg {
109
- padding: dt('togglebutton.lg.padding');
110
- font-size: dt('togglebutton.lg.font.size');
111
- }
112
-
113
- .p-togglebutton-lg .p-togglebutton-content {
114
- padding: dt('togglebutton.content.lg.padding');
115
- }
116
-
117
- .p-togglebutton-fluid {
118
- width: 100%;
119
- }
120
- `,classes:{root:function(e){var t=e.instance,n=e.props;return[`p-togglebutton p-component`,{"p-togglebutton-checked":t.active,"p-invalid":t.$invalid,"p-togglebutton-fluid":n.fluid,"p-togglebutton-sm p-inputfield-sm":n.size===`small`,"p-togglebutton-lg p-inputfield-lg":n.size===`large`}]},content:`p-togglebutton-content`,icon:`p-togglebutton-icon`,label:`p-togglebutton-label`}}),Ee={name:`BaseToggleButton`,extends:oe,props:{onIcon:String,offIcon:String,onLabel:{type:String,default:`Yes`},offLabel:{type:String,default:`No`},readonly:{type:Boolean,default:!1},tabindex:{type:Number,default:null},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null},size:{type:String,default:null},fluid:{type:Boolean,default:null}},style:Te,provide:function(){return{$pcToggleButton:this,$parentInstance:this}}};function De(e){"@babel/helpers - typeof";return De=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},De(e)}function Oe(e,t,n){return(t=ke(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ke(e){var t=Ae(e,`string`);return De(t)==`symbol`?t:t+``}function Ae(e,t){if(De(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(De(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var je={name:`ToggleButton`,extends:Ee,inheritAttrs:!1,emits:[`change`],methods:{getPTOptions:function(e){return(e===`root`?this.ptmi:this.ptm)(e,{context:{active:this.active,disabled:this.disabled}})},onChange:function(e){!this.disabled&&!this.readonly&&(this.writeValue(!this.d_value,e),this.$emit(`change`,e))},onBlur:function(e){var t,n;(t=(n=this.formField).onBlur)==null||t.call(n,e)}},computed:{active:function(){return this.d_value===!0},hasLabel:function(){return f(this.onLabel)&&f(this.offLabel)},label:function(){return this.hasLabel?this.d_value?this.onLabel:this.offLabel:`\xA0`},dataP:function(){return g(Oe({checked:this.active,invalid:this.$invalid},this.size,this.size))}},directives:{ripple:re}},Me=[`tabindex`,`disabled`,`aria-pressed`,`aria-label`,`aria-labelledby`,`data-p-checked`,`data-p-disabled`,`data-p`],Ne=[`data-p`];function Pe(e,t,n,r,i,o){var c=ce(`ripple`);return ie((ge(),v(`button`,he({type:`button`,class:e.cx(`root`),tabindex:e.tabindex,disabled:e.disabled,"aria-pressed":e.d_value,onClick:t[0]||=function(){return o.onChange&&o.onChange.apply(o,arguments)},onBlur:t[1]||=function(){return o.onBlur&&o.onBlur.apply(o,arguments)}},o.getPTOptions(`root`),{"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"data-p-checked":o.active,"data-p-disabled":e.disabled,"data-p":o.dataP}),[me(`span`,he({class:e.cx(`content`)},o.getPTOptions(`content`),{"data-p":o.dataP}),[_e(e.$slots,`default`,{},function(){return[_e(e.$slots,`icon`,{value:e.d_value,class:a(e.cx(`icon`))},function(){return[e.onIcon||e.offIcon?(ge(),v(`span`,he({key:0,class:[e.cx(`icon`),e.d_value?e.onIcon:e.offIcon]},o.getPTOptions(`icon`)),null,16)):ee(``,!0)]}),me(`span`,he({class:e.cx(`label`)},o.getPTOptions(`label`)),s(o.label),17)]})],16,Ne)],16,Me)),[[c]])}je.render=Pe;var Fe=o.extend({name:`selectbutton`,style:`
121
- .p-selectbutton {
122
- display: inline-flex;
123
- user-select: none;
124
- vertical-align: bottom;
125
- outline-color: transparent;
126
- border-radius: dt('selectbutton.border.radius');
127
- }
128
-
129
- .p-selectbutton .p-togglebutton {
130
- border-radius: 0;
131
- border-width: 1px 1px 1px 0;
132
- }
133
-
134
- .p-selectbutton .p-togglebutton:focus-visible {
135
- position: relative;
136
- z-index: 1;
137
- }
138
-
139
- .p-selectbutton .p-togglebutton:first-child {
140
- border-inline-start-width: 1px;
141
- border-start-start-radius: dt('selectbutton.border.radius');
142
- border-end-start-radius: dt('selectbutton.border.radius');
143
- }
144
-
145
- .p-selectbutton .p-togglebutton:last-child {
146
- border-start-end-radius: dt('selectbutton.border.radius');
147
- border-end-end-radius: dt('selectbutton.border.radius');
148
- }
149
-
150
- .p-selectbutton.p-invalid {
151
- outline: 1px solid dt('selectbutton.invalid.border.color');
152
- outline-offset: 0;
153
- }
154
-
155
- .p-selectbutton-fluid {
156
- width: 100%;
157
- }
158
-
159
- .p-selectbutton-fluid .p-togglebutton {
160
- flex: 1 1 0;
161
- }
162
- `,classes:{root:function(e){var t=e.props,n=e.instance;return[`p-selectbutton p-component`,{"p-invalid":n.$invalid,"p-selectbutton-fluid":t.fluid}]}}}),Ie={name:`BaseSelectButton`,extends:oe,props:{options:Array,optionLabel:null,optionValue:null,optionDisabled:null,multiple:Boolean,allowEmpty:{type:Boolean,default:!0},dataKey:null,ariaLabelledby:{type:String,default:null},size:{type:String,default:null},fluid:{type:Boolean,default:null}},style:Fe,provide:function(){return{$pcSelectButton:this,$parentInstance:this}}};function Le(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=Be(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
163
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function Re(e){return He(e)||Ve(e)||Be(e)||ze()}function ze(){throw TypeError(`Invalid attempt to spread non-iterable instance.
164
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Be(e,t){if(e){if(typeof e==`string`)return Ue(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ue(e,t):void 0}}function Ve(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function He(e){if(Array.isArray(e))return Ue(e)}function Ue(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var We={name:`SelectButton`,extends:Ie,inheritAttrs:!1,emits:[`change`],methods:{getOptionLabel:function(e){return this.optionLabel?u(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?u(e,this.optionValue):e},getOptionRenderKey:function(e){return this.dataKey?u(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled:function(e){return this.optionDisabled?u(e,this.optionDisabled):!1},isOptionReadonly:function(e){if(this.allowEmpty)return!1;var t=this.isSelected(e);return this.multiple?t&&this.d_value.length===1:t},onOptionSelect:function(e,t,n){var r=this;if(!(this.disabled||this.isOptionDisabled(t)||this.isOptionReadonly(t))){var i=this.isSelected(t),a=this.getOptionValue(t),o;if(this.multiple)if(i){if(o=this.d_value.filter(function(e){return!p(e,a,r.equalityKey)}),!this.allowEmpty&&o.length===0)return}else o=this.d_value?[].concat(Re(this.d_value),[a]):[a];else{if(i&&!this.allowEmpty)return;o=i?null:a}this.writeValue(o,e),this.$emit(`change`,{originalEvent:e,value:o})}},isSelected:function(e){var t=!1,n=this.getOptionValue(e);if(this.multiple){if(this.d_value){var r=Le(this.d_value),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;if(p(a,n,this.equalityKey)){t=!0;break}}}catch(e){r.e(e)}finally{r.f()}}}else t=p(this.d_value,n,this.equalityKey);return t}},computed:{equalityKey:function(){return this.optionValue?null:this.dataKey},dataP:function(){return g({invalid:this.$invalid})}},directives:{ripple:re},components:{ToggleButton:je}},Ge=[`aria-labelledby`,`data-p`];function Ke(e,t,n,r,i,a){var o=se(`ToggleButton`);return ge(),v(`div`,he({class:e.cx(`root`),role:`group`,"aria-labelledby":e.ariaLabelledby},e.ptmi(`root`),{"data-p":a.dataP}),[(ge(!0),v(_,null,de(e.options,function(t,n){return ge(),d(o,{key:a.getOptionRenderKey(t),modelValue:a.isSelected(t),onLabel:a.getOptionLabel(t),offLabel:a.getOptionLabel(t),disabled:e.disabled||a.isOptionDisabled(t),unstyled:e.unstyled,size:e.size,readonly:a.isOptionReadonly(t),onChange:function(e){return a.onOptionSelect(e,t,n)},pt:e.ptm(`pcToggleButton`)},ne({_:2},[e.$slots.option?{name:`default`,fn:le(function(){return[_e(e.$slots,`option`,{option:t,index:n},function(){return[me(`span`,he({ref_for:!0},e.ptm(`pcToggleButton`).label),s(a.getOptionLabel(t)),17)]})]}),key:`0`}:void 0]),1032,[`modelValue`,`onLabel`,`offLabel`,`disabled`,`unstyled`,`size`,`readonly`,`onChange`,`pt`])}),128))],16,Ge)}We.render=Ke;var qe=o.extend({name:`menu`,style:`
165
- .p-menu {
166
- background: dt('menu.background');
167
- color: dt('menu.color');
168
- border: 1px solid dt('menu.border.color');
169
- border-radius: dt('menu.border.radius');
170
- min-width: 12.5rem;
171
- }
172
-
173
- .p-menu-list {
174
- margin: 0;
175
- padding: dt('menu.list.padding');
176
- outline: 0 none;
177
- list-style: none;
178
- display: flex;
179
- flex-direction: column;
180
- gap: dt('menu.list.gap');
181
- }
182
-
183
- .p-menu-item-content {
184
- transition:
185
- background dt('menu.transition.duration'),
186
- color dt('menu.transition.duration');
187
- border-radius: dt('menu.item.border.radius');
188
- color: dt('menu.item.color');
189
- overflow: hidden;
190
- }
191
-
192
- .p-menu-item-link {
193
- cursor: pointer;
194
- display: flex;
195
- align-items: center;
196
- text-decoration: none;
197
- overflow: hidden;
198
- position: relative;
199
- color: inherit;
200
- padding: dt('menu.item.padding');
201
- gap: dt('menu.item.gap');
202
- user-select: none;
203
- outline: 0 none;
204
- }
205
-
206
- .p-menu-item-label {
207
- line-height: 1;
208
- }
209
-
210
- .p-menu-item-icon {
211
- color: dt('menu.item.icon.color');
212
- }
213
-
214
- .p-menu-item.p-focus .p-menu-item-content {
215
- color: dt('menu.item.focus.color');
216
- background: dt('menu.item.focus.background');
217
- }
218
-
219
- .p-menu-item.p-focus .p-menu-item-icon {
220
- color: dt('menu.item.icon.focus.color');
221
- }
222
-
223
- .p-menu-item:not(.p-disabled) .p-menu-item-content:hover {
224
- color: dt('menu.item.focus.color');
225
- background: dt('menu.item.focus.background');
226
- }
227
-
228
- .p-menu-item:not(.p-disabled) .p-menu-item-content:hover .p-menu-item-icon {
229
- color: dt('menu.item.icon.focus.color');
230
- }
231
-
232
- .p-menu-overlay {
233
- box-shadow: dt('menu.shadow');
234
- }
235
-
236
- .p-menu-submenu-label {
237
- background: dt('menu.submenu.label.background');
238
- padding: dt('menu.submenu.label.padding');
239
- color: dt('menu.submenu.label.color');
240
- font-weight: dt('menu.submenu.label.font.weight');
241
- }
242
-
243
- .p-menu-separator {
244
- border-block-start: 1px solid dt('menu.separator.border.color');
245
- }
246
- `,classes:{root:function(e){var t=e.props;return[`p-menu p-component`,{"p-menu-overlay":t.popup}]},start:`p-menu-start`,list:`p-menu-list`,submenuLabel:`p-menu-submenu-label`,separator:`p-menu-separator`,end:`p-menu-end`,item:function(e){var t=e.instance;return[`p-menu-item`,{"p-focus":t.id===t.focusedOptionId,"p-disabled":t.disabled()}]},itemContent:`p-menu-item-content`,itemLink:`p-menu-item-link`,itemIcon:`p-menu-item-icon`,itemLabel:`p-menu-item-label`}}),Je={name:`BaseMenu`,extends:ve,props:{popup:{type:Boolean,default:!1},model:{type:Array,default:null},appendTo:{type:[String,Object],default:`body`},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:qe,provide:function(){return{$pcMenu:this,$parentInstance:this}}},Ye={name:`Menuitem`,hostName:`Menu`,extends:ve,inheritAttrs:!1,emits:[`item-click`,`item-mousemove`],props:{item:null,templates:null,id:null,focusedOptionId:null,index:null},methods:{getItemProp:function(e,t){return e&&e.item?c(e.item[t]):void 0},getPTOptions:function(e){return this.ptm(e,{context:{item:this.item,index:this.index,focused:this.isItemFocused(),disabled:this.disabled()}})},isItemFocused:function(){return this.focusedOptionId===this.id},onItemClick:function(e){var t=this.getItemProp(this.item,`command`);t&&t({originalEvent:e,item:this.item.item}),this.$emit(`item-click`,{originalEvent:e,item:this.item,id:this.id})},onItemMouseMove:function(e){this.$emit(`item-mousemove`,{originalEvent:e,item:this.item,id:this.id})},visible:function(){return typeof this.item.visible==`function`?this.item.visible():this.item.visible!==!1},disabled:function(){return typeof this.item.disabled==`function`?this.item.disabled():this.item.disabled},label:function(){return typeof this.item.label==`function`?this.item.label():this.item.label},getMenuItemProps:function(e){return{action:he({class:this.cx(`itemLink`),tabindex:`-1`},this.getPTOptions(`itemLink`)),icon:he({class:[this.cx(`itemIcon`),e.icon]},this.getPTOptions(`itemIcon`)),label:he({class:this.cx(`itemLabel`)},this.getPTOptions(`itemLabel`))}}},computed:{dataP:function(){return g({focus:this.isItemFocused(),disabled:this.disabled()})}},directives:{ripple:re}},Xe=[`id`,`aria-label`,`aria-disabled`,`data-p-focused`,`data-p-disabled`,`data-p`],Ze=[`data-p`],Qe=[`href`,`target`],$e=[`data-p`],et=[`data-p`];function tt(e,t,n,r,i,o){var c=ce(`ripple`);return o.visible()?(ge(),v(`li`,he({key:0,id:n.id,class:[e.cx(`item`),n.item.class],role:`menuitem`,style:n.item.style,"aria-label":o.label(),"aria-disabled":o.disabled(),"data-p-focused":o.isItemFocused(),"data-p-disabled":o.disabled()||!1,"data-p":o.dataP},o.getPTOptions(`item`)),[me(`div`,he({class:e.cx(`itemContent`),onClick:t[0]||=function(e){return o.onItemClick(e)},onMousemove:t[1]||=function(e){return o.onItemMouseMove(e)},"data-p":o.dataP},o.getPTOptions(`itemContent`)),[n.templates.item?n.templates.item?(ge(),d(pe(n.templates.item),{key:1,item:n.item,label:o.label(),props:o.getMenuItemProps(n.item)},null,8,[`item`,`label`,`props`])):ee(``,!0):ie((ge(),v(`a`,he({key:0,href:n.item.url,class:e.cx(`itemLink`),target:n.item.target,tabindex:`-1`},o.getPTOptions(`itemLink`)),[n.templates.itemicon?(ge(),d(pe(n.templates.itemicon),{key:0,item:n.item,class:a(e.cx(`itemIcon`))},null,8,[`item`,`class`])):n.item.icon?(ge(),v(`span`,he({key:1,class:[e.cx(`itemIcon`),n.item.icon],"data-p":o.dataP},o.getPTOptions(`itemIcon`)),null,16,$e)):ee(``,!0),me(`span`,he({class:e.cx(`itemLabel`),"data-p":o.dataP},o.getPTOptions(`itemLabel`)),s(o.label()),17,et)],16,Qe)),[[c]])],16,Ze)],16,Xe)):ee(``,!0)}Ye.render=tt;function nt(e){return ot(e)||at(e)||it(e)||rt()}function rt(){throw TypeError(`Invalid attempt to spread non-iterable instance.
247
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function it(e,t){if(e){if(typeof e==`string`)return st(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}function at(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ot(e){if(Array.isArray(e))return st(e)}function st(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct={name:`Menu`,extends:Je,inheritAttrs:!1,emits:[`show`,`hide`,`focus`,`blur`],data:function(){return{overlayVisible:!1,focused:!1,focusedOptionIndex:-1,selectedOptionIndex:-1}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,list:null,mounted:function(){this.popup||(this.bindResizeListener(),this.bindOutsideClickListener())},beforeUnmount:function(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.scrollHandler&&=(this.scrollHandler.destroy(),null),this.target=null,this.container&&this.autoZIndex&&xe.clear(this.container),this.container=null},methods:{itemClick:function(e){var t=e.item;this.disabled(t)||(t.command&&t.command(e),this.overlayVisible&&this.hide(),!this.popup&&this.focusedOptionIndex!==e.id&&(this.focusedOptionIndex=e.id))},itemMouseMove:function(e){this.focused&&(this.focusedOptionIndex=e.id)},onListFocus:function(e){this.focused=!0,!this.popup&&this.changeFocusedOptionIndex(0),this.$emit(`focus`,e)},onListBlur:function(e){this.focused=!1,this.focusedOptionIndex=-1,this.$emit(`blur`,e)},onListKeyDown:function(e){switch(e.code){case`ArrowDown`:this.onArrowDownKey(e);break;case`ArrowUp`:this.onArrowUpKey(e);break;case`Home`:this.onHomeKey(e);break;case`End`:this.onEndKey(e);break;case`Enter`:case`NumpadEnter`:this.onEnterKey(e);break;case`Space`:this.onSpaceKey(e);break;case`Escape`:this.popup&&(fe(this.target),this.hide());case`Tab`:this.overlayVisible&&this.hide();break}},onArrowDownKey:function(e){var t=this.findNextOptionIndex(this.focusedOptionIndex);this.changeFocusedOptionIndex(t),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&this.popup)fe(this.target),this.hide(),e.preventDefault();else{var t=this.findPrevOptionIndex(this.focusedOptionIndex);this.changeFocusedOptionIndex(t),e.preventDefault()}},onHomeKey:function(e){this.changeFocusedOptionIndex(0),e.preventDefault()},onEndKey:function(e){this.changeFocusedOptionIndex(ue(this.container,`li[data-pc-section="item"][data-p-disabled="false"]`).length-1),e.preventDefault()},onEnterKey:function(e){var t=ye(this.list,`li[id="${`${this.focusedOptionIndex}`}"]`),n=t&&ye(t,`a[data-pc-section="itemlink"]`);this.popup&&fe(this.target),n?n.click():t&&t.click(),e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},findNextOptionIndex:function(e){var t=nt(ue(this.container,`li[data-pc-section="item"][data-p-disabled="false"]`)).findIndex(function(t){return t.id===e});return t>-1?t+1:0},findPrevOptionIndex:function(e){var t=nt(ue(this.container,`li[data-pc-section="item"][data-p-disabled="false"]`)).findIndex(function(t){return t.id===e});return t>-1?t-1:0},changeFocusedOptionIndex:function(e){var t=ue(this.container,`li[data-pc-section="item"][data-p-disabled="false"]`),n=e>=t.length?t.length-1:e<0?0:e;n>-1&&(this.focusedOptionIndex=t[n].getAttribute(`id`))},toggle:function(e,t){this.overlayVisible?this.hide():this.show(e,t)},show:function(e,t){this.overlayVisible=!0,this.target=t??e.currentTarget},hide:function(){this.overlayVisible=!1,this.target=null},onEnter:function(e){te(e,{position:`absolute`,top:`0`}),this.alignOverlay(),this.bindOutsideClickListener(),this.bindResizeListener(),this.bindScrollListener(),this.autoZIndex&&xe.set(`menu`,e,this.baseZIndex+this.$primevue.config.zIndex.menu),this.popup&&fe(this.list),this.$emit(`show`)},onLeave:function(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindScrollListener(),this.$emit(`hide`)},onAfterLeave:function(e){this.autoZIndex&&xe.clear(e)},alignOverlay:function(){l(this.container,this.target),be(this.target)>be(this.container)&&(this.container.style.minWidth=be(this.target)+`px`)},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var n=e.container&&!e.container.contains(t.target),r=!(e.target&&(e.target===t.target||e.target.contains(t.target)));e.overlayVisible&&n&&r?e.hide():!e.popup&&n&&r&&(e.focusedOptionIndex=-1)},document.addEventListener(`click`,this.outsideClickListener,!0))},unbindOutsideClickListener:function(){this.outsideClickListener&&=(document.removeEventListener(`click`,this.outsideClickListener,!0),null)},bindScrollListener:function(){var e=this;this.scrollHandler||=new Se(this.target,function(){e.overlayVisible&&e.hide()}),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!ae()&&e.hide()},window.addEventListener(`resize`,this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&=(window.removeEventListener(`resize`,this.resizeListener),null)},visible:function(e){return typeof e.visible==`function`?e.visible():e.visible!==!1},disabled:function(e){return typeof e.disabled==`function`?e.disabled():e.disabled},label:function(e){return typeof e.label==`function`?e.label():e.label},onOverlayClick:function(e){Ce.emit(`overlay-click`,{originalEvent:e,target:this.target})},containerRef:function(e){this.container=e},listRef:function(e){this.list=e}},computed:{focusedOptionId:function(){return this.focusedOptionIndex===-1?null:this.focusedOptionIndex},dataP:function(){return g({popup:this.popup})}},components:{PVMenuitem:Ye,Portal:we}},lt=[`id`,`data-p`],ut=[`id`,`tabindex`,`aria-activedescendant`,`aria-label`,`aria-labelledby`],dt=[`id`];function ft(e,t,n,r,a,o){var c=se(`PVMenuitem`),l=se(`Portal`);return ge(),d(l,{appendTo:e.appendTo,disabled:!e.popup},{default:le(function(){return[i(h,he({name:`p-anchored-overlay`,onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},e.ptm(`transition`)),{default:le(function(){return[!e.popup||a.overlayVisible?(ge(),v(`div`,he({key:0,ref:o.containerRef,id:e.$id,class:e.cx(`root`),onClick:t[3]||=function(){return o.onOverlayClick&&o.onOverlayClick.apply(o,arguments)},"data-p":o.dataP},e.ptmi(`root`)),[e.$slots.start?(ge(),v(`div`,he({key:0,class:e.cx(`start`)},e.ptm(`start`)),[_e(e.$slots,`start`)],16)):ee(``,!0),me(`ul`,he({ref:o.listRef,id:e.$id+`_list`,class:e.cx(`list`),role:`menu`,tabindex:e.tabindex,"aria-activedescendant":a.focused?o.focusedOptionId:void 0,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,onFocus:t[0]||=function(){return o.onListFocus&&o.onListFocus.apply(o,arguments)},onBlur:t[1]||=function(){return o.onListBlur&&o.onListBlur.apply(o,arguments)},onKeydown:t[2]||=function(){return o.onListKeyDown&&o.onListKeyDown.apply(o,arguments)}},e.ptm(`list`)),[(ge(!0),v(_,null,de(e.model,function(t,n){return ge(),v(_,{key:o.label(t)+n.toString()},[t.items&&o.visible(t)&&!t.separator?(ge(),v(_,{key:0},[t.items?(ge(),v(`li`,he({key:0,id:e.$id+`_`+n,class:[e.cx(`submenuLabel`),t.class],role:`none`},{ref_for:!0},e.ptm(`submenuLabel`)),[_e(e.$slots,e.$slots.submenulabel?`submenulabel`:`submenuheader`,{item:t},function(){return[m(s(o.label(t)),1)]})],16,dt)):ee(``,!0),(ge(!0),v(_,null,de(t.items,function(r,i){return ge(),v(_,{key:r.label+n+`_`+i},[o.visible(r)&&!r.separator?(ge(),d(c,{key:0,id:e.$id+`_`+n+`_`+i,item:r,templates:e.$slots,focusedOptionId:o.focusedOptionId,unstyled:e.unstyled,onItemClick:o.itemClick,onItemMousemove:o.itemMouseMove,pt:e.pt},null,8,[`id`,`item`,`templates`,`focusedOptionId`,`unstyled`,`onItemClick`,`onItemMousemove`,`pt`])):o.visible(r)&&r.separator?(ge(),v(`li`,he({key:`separator`+n+i,class:[e.cx(`separator`),t.class],style:r.style,role:`separator`},{ref_for:!0},e.ptm(`separator`)),null,16)):ee(``,!0)],64)}),128))],64)):o.visible(t)&&t.separator?(ge(),v(`li`,he({key:`separator`+n.toString(),class:[e.cx(`separator`),t.class],style:t.style,role:`separator`},{ref_for:!0},e.ptm(`separator`)),null,16)):(ge(),d(c,{key:o.label(t)+n.toString(),id:e.$id+`_`+n,item:t,index:n,templates:e.$slots,focusedOptionId:o.focusedOptionId,unstyled:e.unstyled,onItemClick:o.itemClick,onItemMousemove:o.itemMouseMove,pt:e.pt},null,8,[`id`,`item`,`index`,`templates`,`focusedOptionId`,`unstyled`,`onItemClick`,`onItemMousemove`,`pt`]))],64)}),128))],16,ut),e.$slots.end?(ge(),v(`div`,he({key:1,class:e.cx(`end`)},e.ptm(`end`)),[_e(e.$slots,`end`)],16)):ee(``,!0)],16,lt)):ee(``,!0)]}),_:3},16,[`onEnter`,`onLeave`,`onAfterLeave`])]}),_:3},8,[`appendTo`,`disabled`])}ct.render=ft;function pt(e){if(!e.includes(`/repos/`))return null;let[t,n]=e.split(`/repos/`,2),r=n.split(`/`);if(r.length<3)return null;let i=`${r[0]}~${r[1]}~${r[2]}`,a=r.length>3?r[3]:null;return{toolshedUrl:t.startsWith(`http`)?t:`https://${t}`,trsToolId:i,toolVersion:a}}function mt(e,t){let n=t.split(`~`);return`${e.replace(`https://`,``).replace(`http://`,``)}/repos/${n.join(`/`)}`}async function ht(e,t,n){let r=`${e}/${t}/${n}`,i=new TextEncoder().encode(r),a=await globalThis.crypto.subtle.digest(`SHA-256`,i);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var gt=`__index__`,_t=class{storage;entries={};loaded=!1;constructor(e){this.storage=e}async load(){this.entries=(await this.storage.load(gt))?.entries??{},this.loaded=!0}async ensureLoaded(){this.loaded||await this.load()}async save(){let e={entries:this.entries};await this.storage.save(gt,e)}async add(e,t,n,r,i=``){await this.ensureLoaded(),this.entries[e]={tool_id:t,tool_version:n,source:r,source_url:i,cached_at:new Date().toISOString()},await this.save()}async remove(e){await this.ensureLoaded(),e in this.entries&&(delete this.entries[e],await this.save())}async has(e){return await this.ensureLoaded(),e in this.entries}async listAll(){return await this.ensureLoaded(),Object.entries(this.entries).map(([e,t])=>({cache_key:e,...t}))}async clear(){this.entries={},this.loaded=!0,await this.save()}},vt=e=>typeof e==`function`,y=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};case 4:return function(e,n,r,i){return arguments.length>=4?t(e,n,r,i):function(i){return t(i,e,n,r)}};case 5:return function(e,n,r,i,a){return arguments.length>=5?t(e,n,r,i,a):function(a){return t(a,e,n,r,i)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},b=e=>e,yt=e=>()=>e,bt=yt(!0),xt=yt(!1),St=yt(void 0),Ct=St;function x(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return t(e);case 3:return n(t(e));case 4:return r(n(t(e)));case 5:return i(r(n(t(e))));case 6:return a(i(r(n(t(e)))));case 7:return o(a(i(r(n(t(e))))));case 8:return s(o(a(i(r(n(t(e)))))));case 9:return c(s(o(a(i(r(n(t(e))))))));default:{let e=arguments[0];for(let t=1;t<arguments.length;t++)e=arguments[t](e);return e}}}var wt=e=>(t,n)=>t===n||e(t,n),Tt=(e,t)=>e===t,Et=y(2,(e,t)=>wt((n,r)=>e(t(n),t(r)))),Dt=Et(Tt,e=>e.getTime()),Ot=e=>wt((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}),kt=`effect/GlobalValue`,At,S=(e,t)=>(At||=(globalThis[kt]??=new Map,globalThis[kt]),At.has(e)||At.set(e,t()),At.get(e)),jt=e=>!!e,Mt=e=>e instanceof Set,Nt=e=>typeof e==`string`,Pt=e=>typeof e==`number`,Ft=e=>typeof e==`boolean`,It=e=>typeof e==`bigint`,Lt=e=>typeof e==`symbol`,Rt=vt,zt=e=>e===void 0,Bt=e=>!1,Vt=e=>typeof e==`object`&&!!e,Ht=e=>Vt(e)||Rt(e),C=y(2,(e,t)=>Ht(e)&&t in e),Ut=y(2,(e,t)=>C(e,`_tag`)&&e._tag===t),Wt=e=>e==null,Gt=e=>e!=null,Kt=e=>e instanceof Uint8Array,qt=e=>e instanceof Date,Jt=e=>typeof e==`string`||C(e,Symbol.iterator),Yt=e=>Vt(e)&&!Array.isArray(e),Xt=e=>C(e,`then`)&&Rt(e.then),Zt=e=>`BUG: ${e} - please report an issue at https://github.com/Effect-TS/effect/issues`,Qt=class e{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new e(this.self)}},$t=335903614,en=4150755663,tn=1481765933,nn=1284865837,rn=9007199254740992,an=134217728,on=class{_state;constructor(e,t,n,r){return Wt(t)&&Wt(e)?(t=Math.random()*4294967295>>>0,e=0):Wt(t)&&(t=e,e=0),Wt(r)&&Wt(n)?(r=this._state?this._state[3]:en,n=this._state?this._state[2]:$t):Wt(r)&&(r=n,n=0),this._state=new Int32Array([0,0,n>>>0,((r||0)|1)>>>0]),this._next(),cn(this._state,this._state[0],this._state[1],e>>>0,t>>>0),this._next(),this}getState(){return[this._state[0],this._state[1],this._state[2],this._state[3]]}setState(e){this._state[0]=e[0],this._state[1]=e[1],this._state[2]=e[2],this._state[3]=e[3]|1}integer(e){return Math.round(this.number()*(2**53-1))%e}number(){let e=(this._next()&67108863)*1,t=(this._next()&134217727)*1;return(e*an+t)/rn}_next(){let e=this._state[0]>>>0,t=this._state[1]>>>0;sn(this._state,e,t,tn,nn),cn(this._state,this._state[0],this._state[1],this._state[2],this._state[3]);let n=e>>>18,r=(t>>>18|e<<14)>>>0;n=(n^e)>>>0,r=(r^t)>>>0;let i=(r>>>27|n<<5)>>>0,a=e>>>27,o=(-a>>>0&31)>>>0;return(i>>>a|i<<o)>>>0}};function sn(e,t,n,r,i){let a=(n>>>16)*(i&65535)>>>0,o=(n&65535)*(i>>>16)>>>0,s=(n&65535)*(i&65535)>>>0,c=(n>>>16)*(i>>>16)+((o>>>16)+(a>>>16))>>>0;o=o<<16>>>0,s=s+o>>>0,s>>>0<o>>>0&&(c=c+1>>>0),a=a<<16>>>0,s=s+a>>>0,s>>>0<a>>>0&&(c=c+1>>>0),c=c+Math.imul(n,r)>>>0,c=c+Math.imul(t,i)>>>0,e[0]=c,e[1]=s}function cn(e,t,n,r,i){let a=t+r>>>0,o=n+i>>>0;o>>>0<n>>>0&&(a=a+1|0),e[0]=a,e[1]=o}var ln=Symbol.for(`effect/Utils/YieldWrap`),un=class{#e;constructor(e){this.#e=e}[ln](){return this.#e}};function dn(e){if(typeof e==`object`&&e&&ln in e)return e[ln]();throw Error(Zt(`yieldWrapGet`))}var fn=S(`effect/Utils/isStructuralRegion`,()=>({enabled:!1,tester:void 0})),pn={effect_internal_function:e=>e()},mn=pn.effect_internal_function(()=>Error().stack)?.includes(`effect_internal_function`)===!0?pn.effect_internal_function:{effect_internal_function:e=>{try{return e()}finally{}}}.effect_internal_function;(function*(){}).constructor;var hn=S(Symbol.for(`effect/Hash/randomHashCache`),()=>new WeakMap),w=Symbol.for(`effect/Hash`),T=e=>{if(fn.enabled===!0)return 0;switch(typeof e){case`number`:return yn(e);case`bigint`:return bn(e.toString(10));case`boolean`:return bn(String(e));case`symbol`:return bn(String(e));case`string`:return bn(e);case`undefined`:return bn(`undefined`);case`function`:case`object`:return e===null?bn(`null`):e instanceof Date?Number.isNaN(e.getTime())?bn(`Invalid Date`):T(e.toISOString()):e instanceof URL?T(e.href):vn(e)?e[w]():gn(e);default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},gn=e=>(hn.has(e)||hn.set(e,yn(Math.floor(Math.random()*(2**53-1)))),hn.get(e)),E=e=>t=>t*53^e,_n=e=>e&3221225471|e>>>1&1073741824,vn=e=>C(e,w),yn=e=>{if(e!==e||e===1/0)return 0;let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return _n(t)},bn=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return _n(t)},xn=(e,t)=>{let n=12289;for(let r=0;r<t.length;r++)n^=x(bn(t[r]),E(T(e[t[r]])));return _n(n)},Sn=e=>xn(e,Object.keys(e)),Cn=e=>{let t=6151;for(let n=0;n<e.length;n++)t=x(t,E(T(e[n])));return _n(t)},D=function(){if(arguments.length===1){let e=arguments[0];return function(t){return Object.defineProperty(e,w,{value(){return t},enumerable:!1}),t}}let e=arguments[0],t=arguments[1];return Object.defineProperty(e,w,{value(){return t},enumerable:!1}),t},O=Symbol.for(`effect/Equal`);function k(){return arguments.length===1?e=>wn(e,arguments[0]):wn(arguments[0],arguments[1])}function wn(e,t){if(e===t)return!0;let n=typeof e;if(n!==typeof t)return!1;if(n===`object`||n===`function`){if(e!==null&&t!==null){if(Tn(e)&&Tn(t))return T(e)===T(t)&&e[O](t)?!0:fn.enabled&&fn.tester?fn.tester(e,t):!1;if(e instanceof Date&&t instanceof Date){let n=e.getTime(),r=t.getTime();return n===r||Number.isNaN(n)&&Number.isNaN(r)}else if(e instanceof URL&&t instanceof URL)return e.href===t.href}if(fn.enabled){if(e===null||t===null)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>wn(e,t[n]));if(Object.getPrototypeOf(e)===Object.prototype&&Object.getPrototypeOf(t)===Object.prototype){let n=Object.keys(e),r=Object.keys(t);if(n.length===r.length){for(let r of n)if(!(r in t&&wn(e[r],t[r])))return fn.tester?fn.tester(e,t):!1;return!0}}return fn.tester?fn.tester(e,t):!1}}return fn.enabled&&fn.tester?fn.tester(e,t):!1}var Tn=e=>C(e,O),En=()=>k,A=Symbol.for(`nodejs.util.inspect.custom`),Dn=e=>{try{if(C(e,`toJSON`)&&Rt(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Dn)}catch{return{}}return Bn(e)},On=`[Circular]`;function kn(e){try{return e.toISOString()}catch{return`Invalid Date`}}function An(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function jn(e){return Nt(e)?JSON.stringify(e):String(e)}function Mn(e,t){let n=t?.space??0,r=new WeakSet,i=n?Pt(n)?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return On;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
248
- `+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(qt(e))return kn(e);if(!t?.ignoreToString&&C(e,`toString`)&&Rt(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=An(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(Nt(e))return JSON.stringify(e);if(Pt(e)||e==null||Ft(e)||Lt(e))return String(e);if(It(e))return String(e)+`n`;if(e instanceof Set||e instanceof Map)return r.has(e)?On:(r.add(e),`${e.constructor.name}(${c(Array.from(e),n)})`);if(Ht(e)){if(r.has(e))return On;r.add(e);let t=s(e);return!i||t.length<=1?o(e,`{${t.map(t=>`${jn(t)}:${c(e[t],n)}`).join(`,`)}}`):o(e,`{\n${t.map(t=>`${a(n+1)}${jn(t)}: ${c(e[t],n+1)}`).join(`,
249
- `)}\n${a(n)}}`)}return String(e)}return c(e,0)}var Nn=e=>JSON.stringify(e,null,2),Pn=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Fn(e,t):String(e)}catch{return String(e)}},Fn=(e,t)=>{let n=[],r=JSON.stringify(e,(e,t)=>typeof t==`object`&&t?n.includes(t)?void 0:n.push(t)&&(Rn.fiberRefs!==void 0&&Ln(t)?t[In](Rn.fiberRefs):t):t,t);return n=void 0,r},In=Symbol.for(`effect/Inspectable/Redactable`),Ln=e=>typeof e==`object`&&!!e&&In in e,Rn=S(`effect/Inspectable/redactableState`,()=>({fiberRefs:void 0})),zn=(e,t)=>{let n=Rn.fiberRefs;Rn.fiberRefs=e;try{return t()}finally{Rn.fiberRefs=n}},Bn=e=>Ln(e)&&Rn.fiberRefs!==void 0?e[In](Rn.fiberRefs):e,j=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},Vn=`Async`,Hn=`Commit`,Un=`Failure`,Wn=`OnFailure`,Gn=`OnSuccess`,Kn=`OnSuccessAndFailure`,qn=`Success`,Jn=`Sync`,Yn=`UpdateRuntimeFlags`,Xn=`While`,Zn=`Iterator`,Qn=`WithRuntime`,$n=`Yield`,er=`RevertFlags`,tr=`3.21.0`,nr=()=>tr,rr=Symbol.for(`effect/Effect`),ir=Symbol.for(`effect/Stream`),ar=Symbol.for(`effect/Sink`),or=Symbol.for(`effect/Channel`),sr={_R:e=>e,_E:e=>e,_A:e=>e,_V:nr()},cr={_A:e=>e,_In:e=>e,_L:e=>e,_E:e=>e,_R:e=>e},lr={_Env:e=>e,_InErr:e=>e,_InElem:e=>e,_InDone:e=>e,_OutErr:e=>e,_OutElem:e=>e,_OutDone:e=>e},ur={[rr]:sr,[ir]:sr,[ar]:cr,[or]:lr,[O](e){return this===e},[w](){return D(this,gn(this))},[Symbol.iterator](){return new Qt(new un(this))},pipe(){return j(this,arguments)}},dr={[w](){return D(this,Sn(this))},[O](e){let t=Object.keys(this),n=Object.keys(e);if(t.length!==n.length)return!1;for(let n of t)if(!(n in e&&k(this[n],e[n])))return!1;return!0}},fr={...ur,_op:Hn},pr={...fr,...dr},mr=function(){function e(){}return e.prototype=fr,e}(),hr=Symbol.for(`effect/Option`),gr={...ur,[hr]:{_A:e=>e},[A](){return this.toJSON()},toString(){return Nn(this.toJSON())}},_r=Object.assign(Object.create(gr),{_tag:`Some`,_op:`Some`,[O](e){return br(e)&&Sr(e)&&k(this.value,e.value)},[w](){return D(this,E(T(this._tag))(T(this.value)))},toJSON(){return{_id:`Option`,_tag:this._tag,value:Dn(this.value)}}}),vr=T(`None`),yr=Object.assign(Object.create(gr),{_tag:`None`,_op:`None`,[O](e){return br(e)&&xr(e)},[w](){return vr},toJSON(){return{_id:`Option`,_tag:this._tag}}}),br=e=>C(e,hr),xr=e=>e._tag===`None`,Sr=e=>e._tag===`Some`,Cr=Object.create(yr),wr=e=>{let t=Object.create(_r);return t.value=e,t},Tr=Symbol.for(`effect/Either`),Er={...ur,[Tr]:{_R:e=>e},[A](){return this.toJSON()},toString(){return Nn(this.toJSON())}},Dr=Object.assign(Object.create(Er),{_tag:`Right`,_op:`Right`,[O](e){return kr(e)&&jr(e)&&k(this.right,e.right)},[w](){return E(T(this._tag))(T(this.right))},toJSON(){return{_id:`Either`,_tag:this._tag,right:Dn(this.right)}}}),Or=Object.assign(Object.create(Er),{_tag:`Left`,_op:`Left`,[O](e){return kr(e)&&Ar(e)&&k(this.left,e.left)},[w](){return E(T(this._tag))(T(this.left))},toJSON(){return{_id:`Either`,_tag:this._tag,left:Dn(this.left)}}}),kr=e=>C(e,Tr),Ar=e=>e._tag===`Left`,jr=e=>e._tag===`Right`,Mr=e=>{let t=Object.create(Or);return t.left=e,t},Nr=e=>{let t=Object.create(Dr);return t.right=e,t},Pr=e=>Ar(e)?Cr:wr(e.right),Fr=y(2,(e,t)=>xr(e)?Mr(t()):Nr(e.value)),M=Nr,N=Mr,Ir=Fr,Lr=e=>{if(Rt(e))try{return M(e())}catch(e){return N(e)}else try{return M(e.try())}catch(t){return N(e.catch(t))}},Rr=kr,zr=Ar,Br=jr,Vr=y(2,(e,{onLeft:t,onRight:n})=>zr(e)?N(t(e.left)):M(n(e.right))),Hr=y(2,(e,t)=>zr(e)?N(t(e.left)):M(e.right)),Ur=y(2,(e,t)=>Br(e)?M(t(e.right)):N(e.left)),Wr=y(2,(e,{onLeft:t,onRight:n})=>zr(e)?t(e.left):n(e.right)),Gr=Wr({onLeft:b,onRight:b}),Kr=y(2,(e,t)=>{if(Br(e))return e.right;throw t(e.left)}),qr=Kr(()=>Error(`getOrThrow called on a Left`)),Jr=e=>e.length>0,Yr=e=>(t,n)=>t===n?0:e(t,n),Xr=Yr((e,t)=>e<t?-1:1),Zr=y(2,(e,t)=>Yr((n,r)=>e(t(n),t(r)))),Qr=e=>y(2,(t,n)=>e(t,n)===1),P=()=>Cr,F=wr,$r=br,ei=xr,ti=Sr,ni=y(2,(e,{onNone:t,onSome:n})=>ei(e)?t():n(e.value)),ri=Pr,ii=y(2,(e,t)=>ei(e)?t():e.value),ai=y(2,(e,t)=>ei(e)?t():e),oi=y(2,(e,t)=>ei(e)?F(t()):e),si=e=>e==null?P():F(e),ci=ii(St),li=e=>(...t)=>{try{return F(e(...t))}catch{return P()}},ui=y(2,(e,t)=>{if(ti(e))return e.value;throw t()}),di=ui(()=>Error(`getOrThrow called on a None`)),fi=y(2,(e,t)=>ei(e)?P():F(t(e.value))),pi=y(2,(e,t)=>ei(e)?P():t(e.value)),mi=y(2,(e,t)=>ei(e)?P():si(t(e.value))),hi=pi,gi=y(2,(e,t)=>hi(e,e=>t(e)?wr(e):Cr)),_i=e=>wt((t,n)=>ei(t)?ei(n):ei(n)?!1:e(t.value,n.value)),vi=(e=>y(2,(t,n)=>ei(t)?!1:e(t.value,n)))(En()),yi=y(2,(e,t)=>ei(e)?!1:t(e.value)),bi=e=>(t,n)=>ei(t)?n:ei(n)?t:F(e(t.value,n.value)),xi=(...e)=>e,Si=e=>wi(e).length===0,Ci=y(2,(e,t)=>Object.prototype.hasOwnProperty.call(e,t)),wi=e=>Object.keys(e),Ti=e=>Array(e),Ei=y(2,(e,t)=>{let n=Math.max(1,Math.floor(e)),r=Array(n);for(let e=0;e<n;e++)r[e]=t(e);return r}),Di=e=>Array.isArray(e)?e:Array.from(e),Oi=e=>Array.isArray(e)?e:[e],ki=y(2,(e,{onEmpty:t,onNonEmpty:n})=>Ii(e)?n(Hi(e),Gi(e)):t()),Ai=y(2,(e,t)=>[t,...e]),ji=y(2,(e,t)=>[...e,t]),Mi=y(2,(e,t)=>Di(e).concat(Di(t))),Ni=Array.isArray,Pi=e=>e.length===0,Fi=Jr,Ii=Jr,Li=(e,t)=>e<0||e>=t.length,Ri=(e,t)=>Math.floor(Math.min(Math.max(0,e),t.length)),zi=y(2,(e,t)=>{let n=Math.floor(t);return Li(n,e)?P():F(e[n])}),Bi=y(2,(e,t)=>{let n=Math.floor(t);if(Li(n,e))throw Error(`Index ${n} out of bounds`);return e[n]}),Vi=zi(0),Hi=Bi(0),Ui=e=>Ii(e)?F(Wi(e)):P(),Wi=e=>e[e.length-1],Gi=e=>e.slice(1),Ki=(e,t)=>{let n=0;for(let r of e){if(!t(r,n))break;n++}return n},qi=y(2,(e,t)=>ea(e,Ki(e,t))),Ji=y(2,(e,t)=>{let n=Di(e);return n.slice(Ri(t,n),n.length)}),Yi=e=>Array.from(e).reverse(),Xi=y(2,(e,t)=>{let n=Array.from(e);return n.sort(t),n}),Zi=y(2,(e,t)=>Qi(e,t,xi)),Qi=y(3,(e,t,n)=>{let r=Di(e),i=Di(t);if(Ii(r)&&Ii(i)){let e=[n(Hi(r),Hi(i))],t=Math.min(r.length,i.length);for(let a=1;a<t;a++)e[a]=n(r[a],i[a]);return e}return[]}),$i=En(),ea=y(2,(e,t)=>{let n=Array.from(e),r=Math.floor(t);return Ii(n)?r>=1?ta(n,r):[[],n]:[n,[]]}),ta=y(2,(e,t)=>{let n=Math.max(1,Math.floor(t));return n>=e.length?[na(e),[]]:[Ai(e.slice(1,n),Hi(e)),e.slice(n)]}),na=e=>e.slice(),ra=y(3,(e,t,n)=>{let r=Di(e),i=Di(t);return Ii(r)?Ii(i)?ma(n)(Mi(r,i)):r:i}),ia=y(2,(e,t)=>ra(e,t,$i)),aa=()=>[],oa=e=>[e],sa=y(2,(e,t)=>e.map(t)),ca=y(2,(e,t)=>{if(Pi(e))return[];let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r);for(let e=0;e<i.length;e++)n.push(i[e])}return n}),la=ca(b),ua=y(2,(e,t)=>{let n=Di(e),r=[];for(let e=0;e<n.length;e++){let i=t(n[e],e);ti(i)&&r.push(i.value)}return r}),da=y(3,(e,t,n)=>Di(e).reduce((e,t,r)=>n(e,t,r),t)),fa=(e,t)=>{let n=[],r=e,i;for(;ti(i=t(r));){let[e,t]=i.value;n.push(e),r=t}return n},pa=Ot,ma=y(2,(e,t)=>{let n=Di(e);if(Ii(n)){let e=[Hi(n)],r=Gi(n);for(let n of r)e.every(e=>!t(n,e))&&e.push(n);return e}return[]}),ha=e=>ma(e,En()),ga=y(2,(e,t)=>Di(e).join(t)),_a=/^[+-]?\d+$/,va=Symbol.for(`effect/BigDecimal`),ya={[va]:va,[w](){let e=Ea(this);return x(T(e.value),E(yn(e.scale)),D(this))},[O](e){return ba(e)&&Aa(this,e)},toString(){return`BigDecimal(${Pa(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},ba=e=>C(e,va),xa=(e,t)=>{let n=Object.create(ya);return n.value=e,n.scale=t,n},Sa=(e,t)=>{if(e!==Ca&&e%wa===Ca)throw RangeError(`Value must be normalized`);let n=xa(e,t);return n.normalized=n,n},Ca=BigInt(0),wa=BigInt(10),Ta=Sa(Ca,0),Ea=e=>{if(e.normalized===void 0)if(e.value===Ca)e.normalized=Ta;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=Sa(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},Da=y(2,(e,t)=>t>e.scale?xa(e.value*wa**BigInt(t-e.scale),t):t<e.scale?xa(e.value/wa**BigInt(e.scale-t),t):e),Oa=e=>e.value<Ca?xa(-e.value,e.scale):e,ka=wt((e,t)=>e.scale>t.scale?Da(t,e.scale).value===e.value:e.scale<t.scale?Da(e,t.scale).value===t.value:e.value===t.value),Aa=y(2,(e,t)=>ka(e,t)),ja=e=>ui(Ma(e),()=>RangeError(`Number must be finite, got ${e}`)),Ma=e=>{if(!Number.isFinite(e))return P();let t=`${e}`;if(t.includes(`e`))return Na(t);let[n,r=``]=t.split(`.`);return F(xa(BigInt(`${n}${r}`),r.length))},Na=e=>{if(e===``)return F(Ta);let t,n,r=e.search(/[eE]/);if(r!==-1){let i=e.slice(r+1);if(t=e.slice(0,r),n=Number(i),t===``||!Number.isSafeInteger(n)||!_a.test(i))return P()}else t=e,n=0;let i,a,o=t.search(/\./);if(o!==-1){let e=t.slice(0,o),n=t.slice(o+1);i=`${e}${n}`,a=n.length}else i=t,a=0;if(!_a.test(i))return P();let s=a-n;return Number.isSafeInteger(s)?F(xa(BigInt(i),s)):P()},Pa=e=>{let t=Ea(e);if(Math.abs(t.scale)>=16)return Fa(t);let n=t.value<Ca,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},Fa=e=>{if(La(e))return`0e+0`;let t=Ea(e),n=`${Oa(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${Ra(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},Ia=e=>Number(Pa(e)),La=e=>e.value===Ca,Ra=e=>e.value<Ca,za=e=>e>BigInt(2**53-1)||e<BigInt(-(2**53-1))?P():F(Number(e)),Ba=e=>{try{return e.trim()===``?P():F(BigInt(e))}catch{return P()}},Va=e=>{if(e>2**53-1||e<-(2**53-1))return P();try{return F(BigInt(e))}catch{return P()}},Ha=e=>!e,Ua=Symbol.for(`effect/Chunk`);function Wa(e,t,n,r,i){for(let a=t;a<Math.min(e.length,t+i);a++)n[r+a-t]=e[a];return n}var Ga=[],Ka=(e=>wt((t,n)=>t.length===n.length&&no(t).every((t,r)=>e(t,so(n,r)))))(k),qa={[Ua]:{_A:e=>e},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`Chunk`,values:no(this).map(Dn)}},[A](){return this.toJSON()},[O](e){return Ya(e)&&Ka(this,e)},[w](){return D(this,Cn(no(this)))},[Symbol.iterator](){switch(this.backing._tag){case`IArray`:return this.backing.array[Symbol.iterator]();case`IEmpty`:return Ga[Symbol.iterator]();default:return no(this)[Symbol.iterator]()}},pipe(){return j(this,arguments)}},Ja=e=>{let t=Object.create(qa);switch(t.backing=e,e._tag){case`IEmpty`:t.length=0,t.depth=0,t.left=t,t.right=t;break;case`IConcat`:t.length=e.left.length+e.right.length,t.depth=1+Math.max(e.left.depth,e.right.depth),t.left=e.left,t.right=e.right;break;case`IArray`:t.length=e.array.length,t.depth=0,t.left=Xa,t.right=Xa;break;case`ISingleton`:t.length=1,t.depth=0,t.left=Xa,t.right=Xa;break;case`ISlice`:t.length=e.length,t.depth=e.chunk.depth+1,t.left=Xa,t.right=Xa;break}return t},Ya=e=>C(e,Ua),Xa=Ja({_tag:`IEmpty`}),Za=()=>Xa,Qa=(...e)=>oo(e),$a=e=>Ja({_tag:`ISingleton`,a:e}),eo=e=>Ya(e)?e:ao(Di(e)),to=(e,t,n)=>{switch(e.backing._tag){case`IArray`:Wa(e.backing.array,0,t,n,e.length);break;case`IConcat`:to(e.left,t,n),to(e.right,t,n+e.left.length);break;case`ISingleton`:t[n]=e.backing.a;break;case`ISlice`:{let r=0,i=n;for(;r<e.length;)t[i]=so(e,r),r+=1,i+=1;break}}},no=e=>{switch(e.backing._tag){case`IEmpty`:return Ga;case`IArray`:return e.backing.array;default:{let t=Array(e.length);return to(e,t,0),e.backing={_tag:`IArray`,array:t},e.left=Xa,e.right=Xa,e.depth=0,t}}},ro=e=>{switch(e.backing._tag){case`IEmpty`:case`ISingleton`:return e;case`IArray`:return Ja({_tag:`IArray`,array:Yi(e.backing.array)});case`IConcat`:return Ja({_tag:`IConcat`,left:ro(e.backing.right),right:ro(e.backing.left)});case`ISlice`:return ao(Yi(no(e)))}},io=y(2,(e,t)=>t<0||t>=e.length?P():F(so(e,t))),ao=e=>e.length===0?Za():e.length===1?$a(e[0]):Ja({_tag:`IArray`,array:e}),oo=e=>ao(e),so=y(2,(e,t)=>{switch(e.backing._tag){case`IEmpty`:throw Error(`Index out of bounds`);case`ISingleton`:if(t!==0)throw Error(`Index out of bounds`);return e.backing.a;case`IArray`:if(t>=e.length||t<0)throw Error(`Index out of bounds`);return e.backing.array[t];case`IConcat`:return t<e.left.length?so(e.left,t):so(e.right,t-e.left.length);case`ISlice`:return so(e.backing.chunk,t+e.backing.offset)}}),co=y(2,(e,t)=>fo(e,$a(t))),lo=y(2,(e,t)=>fo($a(t),e)),uo=y(2,(e,t)=>{if(t<=0)return e;if(t>=e.length)return Xa;switch(e.backing._tag){case`ISlice`:return Ja({_tag:`ISlice`,chunk:e.backing.chunk,offset:e.backing.offset+t,length:e.backing.length-t});case`IConcat`:return t>e.left.length?uo(e.right,t-e.left.length):Ja({_tag:`IConcat`,left:uo(e.left,t),right:e.right});default:return Ja({_tag:`ISlice`,chunk:e,offset:t,length:e.length-t})}}),fo=y(2,(e,t)=>{if(e.backing._tag===`IEmpty`)return t;if(t.backing._tag===`IEmpty`)return e;let n=t.depth-e.depth;if(Math.abs(n)<=1)return Ja({_tag:`IConcat`,left:e,right:t});if(n<-1)if(e.left.depth>=e.right.depth){let n=fo(e.right,t);return Ja({_tag:`IConcat`,left:e.left,right:n})}else{let n=fo(e.right.right,t);if(n.depth===e.depth-3){let t=Ja({_tag:`IConcat`,left:e.right.left,right:n});return Ja({_tag:`IConcat`,left:e.left,right:t})}else return Ja({_tag:`IConcat`,left:Ja({_tag:`IConcat`,left:e.left,right:e.right.left}),right:n})}else if(t.right.depth>=t.left.depth)return Ja({_tag:`IConcat`,left:fo(e,t.left),right:t.right});else{let n=fo(e,t.left.left);return n.depth===t.depth-3?Ja({_tag:`IConcat`,left:Ja({_tag:`IConcat`,left:n,right:t.left.right}),right:t.right}):Ja({_tag:`IConcat`,left:n,right:Ja({_tag:`IConcat`,left:t.left.right,right:t.right})})}}),po=e=>e.length===0,mo=e=>e.length>0,ho=io(0),go=e=>so(e,0),_o=go,vo=e=>uo(e,1),yo=2**5,bo=yo-1,xo=yo/2,So=yo/4;function Co(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,e+=e>>16,e&127}function wo(e,t){return t>>>e&bo}function To(e){return 1<<e}function Eo(e,t){return Co(e&t-1)}var Do=(e,t)=>({value:e,previous:t});function Oo(e,t,n,r){let i=r;if(!e){let e=r.length;i=Array(e);for(let t=0;t<e;++t)i[t]=r[t]}return i[t]=n,i}function ko(e,t,n){let r=n.length-1,i=0,a=0,o=n;if(e)i=a=t;else for(o=Array(r);i<t;)o[a++]=n[i++];for(++i;i<=r;)o[a++]=n[i++];return e&&(o.length=r),o}function Ao(e,t,n,r){let i=r.length;if(e){let e=i;for(;e>=t;)r[e--]=r[e];return r[t]=n,r}let a=0,o=0,s=Array(i+1);for(;a<t;)s[o++]=r[a++];for(s[t]=n;a<i;)s[++o]=r[a++];return s}var jo=class e{_tag=`EmptyNode`;modify(t,n,r,i,a,o){let s=r(P());return ei(s)?new e:(++o.value,new Fo(t,i,a,s))}};function Mo(e){return Ut(e,`EmptyNode`)}function No(e){return Mo(e)||e._tag===`LeafNode`||e._tag===`CollisionNode`}function Po(e,t){return Mo(e)?!1:t===e.edit}var Fo=class e{edit;hash;key;value;_tag=`LeafNode`;constructor(e,t,n,r){this.edit=e,this.hash=t,this.key=n,this.value=r}modify(t,n,r,i,a,o){if(k(a,this.key)){let n=r(this.value);return n===this.value?this:ei(n)?(--o.value,new jo):Po(this,t)?(this.value=n,this):new e(t,i,a,n)}let s=r(P());return ei(s)?this:(++o.value,Ho(t,n,this.hash,this,i,new e(t,i,a,s)))}},Io=class e{edit;hash;children;_tag=`CollisionNode`;constructor(e,t,n){this.edit=e,this.hash=t,this.children=n}modify(t,n,r,i,a,o){if(i===this.hash){let n=Po(this,t),i=this.updateCollisionList(n,t,this.hash,this.children,r,a,o);return i===this.children?this:i.length>1?new e(t,this.hash,i):i[0]}let s=r(P());return ei(s)?this:(++o.value,Ho(t,n,this.hash,this,i,new Fo(t,i,a,s)))}updateCollisionList(e,t,n,r,i,a,o){let s=r.length;for(let c=0;c<s;++c){let s=r[c];if(`key`in s&&k(a,s.key)){let l=s.value,u=i(l);return u===l?r:ei(u)?(--o.value,ko(e,c,r)):Oo(e,c,new Fo(t,n,a,u),r)}}let c=i(P());return ei(c)?r:(++o.value,Oo(e,s,new Fo(t,n,a,c),r))}},Lo=class e{edit;mask;children;_tag=`IndexedNode`;constructor(e,t,n){this.edit=e,this.mask=t,this.children=n}modify(t,n,r,i,a,o){let s=this.mask,c=this.children,l=wo(n,i),u=To(l),d=Eo(s,u),f=s&u,p=Po(this,t);if(!f){let f=new jo().modify(t,n+5,r,i,a,o);return f?c.length>=xo?Bo(t,l,f,s,c):new e(t,s|u,Ao(p,d,f,c)):this}let m=c[d],h=m.modify(t,n+5,r,i,a,o);if(m===h)return this;let g=s,_;if(Mo(h)){if(g&=~u,!g)return new jo;if(c.length<=2&&No(c[d^1]))return c[d^1];_=ko(p,d,c)}else _=Oo(p,d,h,c);return p?(this.mask=g,this.children=_,this):new e(t,g,_)}},Ro=class e{edit;size;children;_tag=`ArrayNode`;constructor(e,t,n){this.edit=e,this.size=t,this.children=n}modify(t,n,r,i,a,o){let s=this.size,c=this.children,l=wo(n,i),u=c[l],d=(u||new jo).modify(t,n+5,r,i,a,o);if(u===d)return this;let f=Po(this,t),p;if(Mo(u)&&!Mo(d))++s,p=Oo(f,l,d,c);else if(!Mo(u)&&Mo(d)){if(--s,s<=So)return zo(t,s,l,c);p=Oo(f,l,new jo,c)}else p=Oo(f,l,d,c);return f?(this.size=s,this.children=p,this):new e(t,s,p)}};function zo(e,t,n,r){let i=Array(t-1),a=0,o=0;for(let e=0,t=r.length;e<t;++e)if(e!==n){let t=r[e];t&&!Mo(t)&&(i[a++]=t,o|=1<<e)}return new Lo(e,o,i)}function Bo(e,t,n,r,i){let a=[],o=r,s=0;for(let e=0;o;++e)o&1&&(a[e]=i[s++]),o>>>=1;return a[t]=n,new Ro(e,s+1,a)}function Vo(e,t,n,r,i,a){if(n===i)return new Io(e,n,[a,r]);let o=wo(t,n),s=wo(t,i);if(o===s)return t=>new Lo(e,To(o)|To(s),[t]);{let t=o<s?[r,a]:[a,r];return new Lo(e,To(o)|To(s),t)}}function Ho(e,t,n,r,i,a){let o,s=t;for(;;){let t=Vo(e,s,n,r,i,a);if(typeof t==`function`)o=Do(t,o),s+=5;else{let e=t;for(;o!=null;)e=o.value(e),o=o.previous;return e}}}var Uo=`effect/HashMap`,Wo=Symbol.for(Uo),Go={[Wo]:Wo,[Symbol.iterator](){return new qo(this,(e,t)=>[e,t])},[w](){let e=T(Uo);for(let t of this)e^=x(T(t[0]),E(T(t[1])));return D(this,e)},[O](e){if(es(e)){if(e._size!==this._size)return!1;for(let t of this){let n=x(e,rs(t[0],T(t[0])));if(ei(n)||!k(t[1],n.value))return!1}return!0}return!1},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`HashMap`,values:Array.from(this).map(Dn)}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},Ko=(e,t,n,r)=>{let i=Object.create(Go);return i._editable=e,i._edit=t,i._root=n,i._size=r,i},qo=class e{map;f;v;constructor(e,t){this.map=e,this.f=t,this.v=Yo(this.map._root,this.f,void 0)}next(){if(ei(this.v))return{done:!0,value:void 0};let e=this.v.value;return this.v=Jo(e.cont),{done:!1,value:e.value}}[Symbol.iterator](){return new e(this.map,this.f)}},Jo=e=>e?Xo(e[0],e[1],e[2],e[3],e[4]):P(),Yo=(e,t,n=void 0)=>{switch(e._tag){case`LeafNode`:return ti(e.value)?F({value:t(e.key,e.value.value),cont:n}):Jo(n);case`CollisionNode`:case`ArrayNode`:case`IndexedNode`:{let r=e.children;return Xo(r.length,r,0,t,n)}default:return Jo(n)}},Xo=(e,t,n,r,i)=>{for(;n<e;){let a=t[n++];if(a&&!Mo(a))return Yo(a,r,[e,t,n,r,i])}return Jo(i)},Zo=Ko(!1,0,new jo,0),Qo=()=>Zo,$o=e=>{let t=ls(Qo());for(let n of e)as(t,n[0],n[1]);return us(t)},es=e=>C(e,Wo),ts=e=>e&&Mo(e._root),ns=y(2,(e,t)=>rs(e,t,T(t))),rs=y(3,(e,t,n)=>{let r=e._root,i=0;for(;;)switch(r._tag){case`LeafNode`:return k(t,r.key)?r.value:P();case`CollisionNode`:if(n===r.hash){let e=r.children;for(let n=0,r=e.length;n<r;++n){let r=e[n];if(`key`in r&&k(t,r.key))return r.value}}return P();case`IndexedNode`:{let e=To(wo(i,n));if(r.mask&e){r=r.children[Eo(r.mask,e)],i+=5;break}return P()}case`ArrayNode`:if(r=r.children[wo(i,n)],r){i+=5;break}return P();default:return P()}}),is=y(2,(e,t)=>ti(rs(e,t,T(t)))),as=y(3,(e,t,n)=>ds(e,t,()=>F(n))),os=y(3,(e,t,n)=>e._editable?(e._root=t,e._size=n,e):t===e._root?e:Ko(e._editable,e._edit,t,n)),ss=e=>new qo(e,e=>e),cs=e=>e._size,ls=e=>Ko(!0,e._edit+1,e._root,e._size),us=e=>(e._editable=!1,e),ds=y(3,(e,t,n)=>fs(e,t,T(t),n)),fs=y(4,(e,t,n,r)=>{let i={value:e._size};return x(e,os(e._root.modify(e._editable?e._edit:NaN,0,r,n,t,i),i.value))}),ps=y(2,(e,t)=>ds(e,t,P)),ms=y(2,(e,t)=>gs(e,Qo(),(e,n,r)=>as(e,r,t(n,r)))),hs=y(2,(e,t)=>gs(e,void 0,(e,n,r)=>t(n,r))),gs=y(3,(e,t,n)=>{let r=e._root;if(r._tag===`LeafNode`)return ti(r.value)?n(t,r.value.value,r.key):t;if(r._tag===`EmptyNode`)return t;let i=[r.children],a;for(;a=i.pop();)for(let e=0,r=a.length;e<r;){let r=a[e++];r&&!Mo(r)&&(r._tag===`LeafNode`?ti(r.value)&&(t=n(t,r.value.value,r.key)):i.push(r.children))}return t}),_s=`effect/HashSet`,vs=Symbol.for(_s),ys={[vs]:vs,[Symbol.iterator](){return ss(this._keyMap)},[w](){return D(this,E(T(this._keyMap))(T(_s)))},[O](e){return xs(e)?cs(this._keyMap)===cs(e._keyMap)&&k(this._keyMap,e._keyMap):!1},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`HashSet`,values:Array.from(this).map(Dn)}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},bs=e=>{let t=Object.create(ys);return t._keyMap=e,t},xs=e=>C(e,vs),Ss=bs(Qo()),Cs=()=>Ss,ws=e=>{let t=As(Cs());for(let n of e)Ns(t,n);return js(t)},Ts=(...e)=>{let t=As(Cs());for(let n of e)Ns(t,n);return js(t)},Es=y(2,(e,t)=>is(e._keyMap,t)),Ds=y(2,(e,t)=>{let n=!1;for(let r of e)if(n=t(r),n)break;return n}),Os=y(2,(e,t)=>!Ds(e,e=>!t(e))),ks=e=>cs(e._keyMap),As=e=>bs(ls(e._keyMap)),js=e=>(e._keyMap._editable=!1,e),Ms=y(2,(e,t)=>{let n=As(e);return t(n),js(n)}),Ns=y(2,(e,t)=>e._keyMap._editable?(as(t,!0)(e._keyMap),e):bs(as(t,!0)(e._keyMap))),Ps=y(2,(e,t)=>e._keyMap._editable?(ps(t)(e._keyMap),e):bs(ps(t)(e._keyMap))),Fs=y(2,(e,t)=>Ms(e,e=>{for(let n of t)Ps(e,n)})),Is=y(2,(e,t)=>Ms(Cs(),n=>{Ls(e,e=>Ns(n,e));for(let e of t)Ns(n,e)})),Ls=y(2,(e,t)=>hs(e._keyMap,(e,n)=>t(n))),Rs=y(3,(e,t,n)=>gs(e._keyMap,t,(e,t,r)=>n(e,r))),zs=Cs,Bs=ws,Vs=Ts,Hs=Es,Us=Os,Ws=ks,Gs=Ns,Ks=Ps,qs=Fs,Js=Is,Ys=Rs,Xs=`Empty`,Zs=`Fail`,Qs=`Interrupt`,$s=`Parallel`,ec=`Sequential`,tc=`effect/Cause`,nc=Symbol.for(tc),rc={_E:e=>e},ic={[nc]:rc,[w](){return x(T(tc),E(T(Dc(this))),D(this))},[O](e){return dc(e)&&Ec(this,e)},pipe(){return j(this,arguments)},toJSON(){switch(this._tag){case`Empty`:return{_id:`Cause`,_tag:this._tag};case`Die`:return{_id:`Cause`,_tag:this._tag,defect:Dn(this.defect)};case`Interrupt`:return{_id:`Cause`,_tag:this._tag,fiberId:this.fiberId.toJSON()};case`Fail`:return{_id:`Cause`,_tag:this._tag,failure:Dn(this.error)};case`Sequential`:case`Parallel`:return{_id:`Cause`,_tag:this._tag,left:Dn(this.left),right:Dn(this.right)}}},toString(){return Lc(this)},[A](){return this.toJSON()}},ac=(()=>{let e=Object.create(ic);return e._tag=Xs,e})(),oc=e=>{let t=Object.create(ic);return t._tag=Zs,t.error=e,t},sc=e=>{let t=Object.create(ic);return t._tag=`Die`,t.defect=e,t},cc=e=>{let t=Object.create(ic);return t._tag=Qs,t.fiberId=e,t},lc=(e,t)=>{let n=Object.create(ic);return n._tag=$s,n.left=e,n.right=t,n},uc=(e,t)=>{let n=Object.create(ic);return n._tag=ec,n.left=e,n.right=t,n},dc=e=>C(e,nc),fc=e=>e._tag===Xs,pc=e=>e._tag===Zs,mc=e=>e._tag===`Empty`?!0:Fc(e,!0,(e,t)=>{switch(t._tag){case Xs:return F(e);case`Die`:case Zs:case Qs:return F(!1);default:return P()}}),hc=e=>ti(Sc(e)),gc=e=>Ic(void 0,jc)(e),_c=e=>ro(Fc(e,Za(),(e,t)=>t._tag===`Fail`?F(x(e,lo(t.error))):P())),vc=e=>ro(Fc(e,Za(),(e,t)=>t._tag===`Die`?F(x(e,lo(t.defect))):P())),yc=e=>Fc(e,zs(),(e,t)=>t._tag===`Interrupt`?F(x(e,Gs(t.fiberId))):P()),bc=e=>kc(e,e=>e._tag===`Fail`?F(e.error):P()),xc=e=>{let t=bc(e);switch(t._tag){case`None`:return M(e);case`Some`:return N(t.value)}},Sc=e=>kc(e,e=>e._tag===`Interrupt`?F(e.fiberId):P()),Cc=e=>Pc(e,{onEmpty:P(),onFail:e=>F(sc(e)),onDie:e=>F(sc(e)),onInterrupt:()=>P(),onSequential:bi(uc),onParallel:bi(lc)}),wc=e=>Pc(e,{onEmpty:ac,onFail:()=>ac,onDie:sc,onInterrupt:cc,onSequential:uc,onParallel:lc}),Tc=e=>Pc(e,{onEmpty:ac,onFail:sc,onDie:sc,onInterrupt:cc,onSequential:uc,onParallel:lc}),Ec=(e,t)=>{let n=$a(e),r=$a(t);for(;mo(n)&&mo(r);){let[e,t]=x(_o(n),Fc([zs(),Za()],([e,t],n)=>{let[r,i]=Ac(n);return F([x(e,Js(r)),x(t,fo(i))])})),[i,a]=x(_o(r),Fc([zs(),Za()],([e,t],n)=>{let[r,i]=Ac(n);return F([x(e,Js(r)),x(t,fo(i))])}));if(!k(e,i))return!1;n=t,r=a}return!0},Dc=e=>Oc($a(e),Za()),Oc=(e,t)=>{for(;;){let[n,r]=x(e,da([zs(),Za()],([e,t],n)=>{let[r,i]=Ac(n);return[x(e,Js(r)),x(t,fo(i))]})),i=Ws(n)>0?x(t,lo(n)):t;if(po(r))return ro(i);e=r,t=i}throw Error(Zt(`Cause.flattenCauseLoop`))},kc=y(2,(e,t)=>{let n=[e];for(;n.length>0;){let e=n.pop(),r=t(e);switch(r._tag){case`None`:switch(e._tag){case ec:case $s:n.push(e.right),n.push(e.left);break}break;case`Some`:return r}}return P()}),Ac=e=>{let t=e,n=[],r=zs(),i=Za();for(;t!==void 0;)switch(t._tag){case Xs:if(n.length===0)return[r,i];t=n.pop();break;case Zs:if(r=Gs(r,Qa(t._tag,t.error)),n.length===0)return[r,i];t=n.pop();break;case`Die`:if(r=Gs(r,Qa(t._tag,t.defect)),n.length===0)return[r,i];t=n.pop();break;case Qs:if(r=Gs(r,Qa(t._tag,t.fiberId)),n.length===0)return[r,i];t=n.pop();break;case ec:switch(t.left._tag){case Xs:t=t.right;break;case ec:t=uc(t.left.left,uc(t.left.right,t.right));break;case $s:t=lc(uc(t.left.left,t.right),uc(t.left.right,t.right));break;default:i=lo(i,t.right),t=t.left;break}break;case $s:n.push(t.right),t=t.left;break}throw Error(Zt(`Cause.evaluateCauseLoop`))},jc={emptyCase:bt,failCase:xt,dieCase:xt,interruptCase:bt,sequentialCase:(e,t,n)=>t&&n,parallelCase:(e,t,n)=>t&&n},Mc=`SequentialCase`,Nc=`ParallelCase`,Pc=y(2,(e,{onDie:t,onEmpty:n,onFail:r,onInterrupt:i,onParallel:a,onSequential:o})=>Ic(e,void 0,{emptyCase:()=>n,failCase:(e,t)=>r(t),dieCase:(e,n)=>t(n),interruptCase:(e,t)=>i(t),sequentialCase:(e,t,n)=>o(t,n),parallelCase:(e,t,n)=>a(t,n)})),Fc=y(3,(e,t,n)=>{let r=t,i=e,a=[];for(;i!==void 0;){let e=n(r,i);switch(r=ti(e)?e.value:r,i._tag){case ec:a.push(i.right),i=i.left;break;case $s:a.push(i.right),i=i.left;break;default:i=void 0;break}i===void 0&&a.length>0&&(i=a.pop())}return r}),Ic=y(3,(e,t,n)=>{let r=[e],i=[];for(;r.length>0;){let e=r.pop();switch(e._tag){case Xs:i.push(M(n.emptyCase(t)));break;case Zs:i.push(M(n.failCase(t,e.error)));break;case`Die`:i.push(M(n.dieCase(t,e.defect)));break;case Qs:i.push(M(n.interruptCase(t,e.fiberId)));break;case ec:r.push(e.right),r.push(e.left),i.push(N({_tag:Mc}));break;case $s:r.push(e.right),r.push(e.left),i.push(N({_tag:Nc}));break}}let a=[];for(;i.length>0;){let e=i.pop();switch(e._tag){case`Left`:switch(e.left._tag){case Mc:{let e=a.pop(),r=a.pop(),i=n.sequentialCase(t,e,r);a.push(i);break}case Nc:{let e=a.pop(),r=a.pop(),i=n.parallelCase(t,e,r);a.push(i);break}}break;case`Right`:a.push(e.right);break}}if(a.length===0)throw Error(`BUG: Cause.reduceWithContext - please report an issue at https://github.com/Effect-TS/effect/issues`);return a.pop()}),Lc=(e,t)=>gc(e)?`All fibers interrupted without errors.`:Gc(e).map(function(e){return t?.renderErrorCause!==!0||e.cause===void 0?e.stack:`${e.stack} {\n${Rc(e.cause,` `)}\n}`}).join(`
250
- `),Rc=(e,t)=>{let n=e.stack.split(`
251
- `),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${Rc(e.cause,`${t} `)}\n${t}}`),r},zc=e=>{let t=typeof e==`object`&&!!e,n=Error.stackTraceLimit;Error.stackTraceLimit=1;let r=Error(Bc(e),t&&`cause`in e&&e.cause!==void 0?{cause:zc(e.cause)}:void 0);return Error.stackTraceLimit=n,r.message===``&&(r.message=`An error has occurred`),Error.stackTraceLimit=n,r.name=e instanceof Error?e.name:`Error`,t&&(Wc in e&&(r.span=e[Wc]),Object.keys(e).forEach(t=>{t in r||(r[t]=e[t])})),r.stack=Uc(`${r.name}: ${r.message}`,e instanceof Error&&e.stack?e.stack:``,r.span),r},Bc=e=>{if(typeof e==`string`)return e;if(typeof e==`object`&&e&&e instanceof Error)return e.message;try{if(C(e,`toString`)&&Rt(e.toString)&&e.toString!==Object.prototype.toString&&e.toString!==globalThis.Array.prototype.toString)return e.toString()}catch{}return Fn(e)},Vc=/\((.*)\)/g,Hc=S(`effect/Tracer/spanToTrace`,()=>new WeakMap),Uc=(e,t,n)=>{let r=[e],i=t.startsWith(e)?t.slice(e.length).split(`
252
- `):t.split(`
253
- `);for(let e=1;e<i.length;e++){if(i[e].includes(` at new BaseEffectError`)||i[e].includes(` at new YieldableError`)){e++;continue}if(i[e].includes(`Generator.next`)||i[e].includes(`effect_internal_function`))break;r.push(i[e].replace(/at .*effect_instruction_i.*\((.*)\)/,`at $1`).replace(/EffectPrimitive\.\w+/,`<anonymous>`))}if(n){let e=n,t=0;for(;e&&e._tag===`Span`&&t<10;){let n=Hc.get(e);if(typeof n==`function`){let t=n();if(typeof t==`string`){let n=t.matchAll(Vc),i=!1;for(let[,t]of n)i=!0,r.push(` at ${e.name} (${t})`);i||r.push(` at ${e.name} (${t.replace(/^at /,``)})`)}else r.push(` at ${e.name}`)}else r.push(` at ${e.name}`);e=ci(e.parent),t++}}return r.join(`
254
- `)},Wc=Symbol.for(`effect/SpanAnnotation`),Gc=e=>Ic(e,void 0,{emptyCase:()=>[],dieCase:(e,t)=>[zc(t)],failCase:(e,t)=>[zc(t)],interruptCase:()=>[],parallelCase:(e,t,n)=>[...t,...n],sequentialCase:(e,t,n)=>[...t,...n]}),Kc=Symbol.for(`effect/Context/Tag`),qc=Symbol.for(`effect/Context/Reference`),Jc=Symbol.for(`effect/STM`),Yc={...ur,_op:`Tag`,[Jc]:sr,[Kc]:{_Service:e=>e,_Identifier:e=>e},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`Tag`,key:this.key,stack:this.stack}},[A](){return this.toJSON()},of(e){return e},context(e){return cl(this,e)}},Xc={...Yc,[qc]:qc},Zc=e=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=t;let r=Object.create(Yc);return Object.defineProperty(r,`stack`,{get(){return n.stack}}),r.key=e,r},Qc=e=>()=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=2;let n=Error();Error.stackTraceLimit=t;function r(){}return Object.setPrototypeOf(r,Yc),r.key=e,Object.defineProperty(r,`stack`,{get(){return n.stack}}),r},$c=()=>(e,t)=>{let n=Error.stackTraceLimit;Error.stackTraceLimit=2;let r=Error();Error.stackTraceLimit=n;function i(){}return Object.setPrototypeOf(i,Xc),i.key=e,i.defaultValue=t.defaultValue,Object.defineProperty(i,`stack`,{get(){return r.stack}}),i},el=Symbol.for(`effect/Context`),tl={[el]:{_Services:e=>e},[O](e){if(il(e)&&this.unsafeMap.size===e.unsafeMap.size){for(let t of this.unsafeMap.keys())if(!e.unsafeMap.has(t)||!k(this.unsafeMap.get(t),e.unsafeMap.get(t)))return!1;return!0}return!1},[w](){return D(this,yn(this.unsafeMap.size))},pipe(){return j(this,arguments)},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`Context`,services:Array.from(this.unsafeMap).map(Dn)}},[A](){return this.toJSON()}},nl=e=>{let t=Object.create(tl);return t.unsafeMap=e,t},rl=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
255
- `);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
256
- `);e.splice(1,3),t.stack=e.join(`
257
- `)}return t},il=e=>C(e,el),al=e=>C(e,qc),ol=nl(new Map),sl=()=>ol,cl=(e,t)=>nl(new Map([[e.key,t]])),ll=y(3,(e,t,n)=>{let r=new Map(e.unsafeMap);return r.set(t.key,n),nl(r)}),ul=S(`effect/Context/defaultValueCache`,()=>new Map),dl=e=>{if(ul.has(e.key))return ul.get(e.key);let t=e.defaultValue();return ul.set(e.key,t),t},fl=(e,t)=>e.unsafeMap.has(t.key)?e.unsafeMap.get(t.key):dl(t),pl=y(2,(e,t)=>{if(!e.unsafeMap.has(t.key)){if(qc in t)return dl(t);throw rl(t)}return e.unsafeMap.get(t.key)}),ml=pl,hl=y(2,(e,t)=>e.unsafeMap.has(t.key)?wr(e.unsafeMap.get(t.key)):al(t)?wr(dl(t)):Cr),gl=y(2,(e,t)=>{let n=new Map(e.unsafeMap);for(let[e,r]of t.unsafeMap)n.set(e,r);return nl(n)}),_l=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].unsafeMap.forEach((e,n)=>{t.set(n,e)});return nl(t)},vl=Zc,yl=sl,bl=cl,xl=ll,Sl=ml,Cl=pl,wl=hl,Tl=gl,El=_l,Dl=Qc,Ol=$c,kl=Symbol.for(`effect/Duration`),Al=BigInt(0),jl=BigInt(24),Ml=BigInt(60),Nl=BigInt(1e3),Pl=BigInt(1e6),Fl=BigInt(1e9),Il=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,Ll=e=>{if(Hl(e))return e;if(Pt(e))return Yl(e);if(It(e))return ql(e);if(Array.isArray(e)&&e.length===2&&e.every(Pt))return e[0]===-1/0||e[1]===-1/0||Number.isNaN(e[0])||Number.isNaN(e[1])?Gl:e[0]===1/0||e[1]===1/0?Kl:ql(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));if(Nt(e)){let t=Il.exec(e);if(t){let[e,n,r]=t,i=Number(n);switch(r){case`nano`:case`nanos`:return ql(BigInt(n));case`micro`:case`micros`:return Jl(BigInt(n));case`milli`:case`millis`:return Yl(i);case`second`:case`seconds`:return Xl(i);case`minute`:case`minutes`:return Zl(i);case`hour`:case`hours`:return Ql(i);case`day`:case`days`:return $l(i);case`week`:case`weeks`:return eu(i)}}}throw Error(`Invalid DurationInput`)},Rl={_tag:`Millis`,millis:0},zl={_tag:`Infinity`},Bl={[kl]:kl,[w](){return D(this,Sn(this.value))},[O](e){return Hl(e)&&uu(this,e)},toString(){return`Duration(${fu(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:iu(this)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`}}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},Vl=e=>{let t=Object.create(Bl);return Pt(e)?isNaN(e)||e<=0?t.value=Rl:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:BigInt(Math.round(e*1e6))}:t.value=zl:e<=Al?t.value=Rl:t.value={_tag:`Nanos`,nanos:e},t},Hl=e=>C(e,kl),Ul=e=>e.value._tag!==`Infinity`,Wl=e=>{switch(e.value._tag){case`Millis`:return e.value.millis===0;case`Nanos`:return e.value.nanos===Al;case`Infinity`:return!1}},Gl=Vl(0),Kl=Vl(1/0),ql=e=>Vl(e),Jl=e=>Vl(e*Nl),Yl=e=>Vl(e),Xl=e=>Vl(e*1e3),Zl=e=>Vl(e*6e4),Ql=e=>Vl(e*36e5),$l=e=>Vl(e*864e5),eu=e=>Vl(e*6048e5),tu=e=>au(e,{onMillis:e=>e,onNanos:e=>Number(e)/1e6}),nu=e=>{let t=Ll(e);switch(t.value._tag){case`Infinity`:return P();case`Nanos`:return F(t.value.nanos);case`Millis`:return F(BigInt(Math.round(t.value.millis*1e6)))}},ru=e=>{let t=Ll(e);switch(t.value._tag){case`Infinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return BigInt(Math.round(t.value.millis*1e6))}},iu=e=>{let t=Ll(e);switch(t.value._tag){case`Infinity`:return[1/0,0];case`Nanos`:return[Number(t.value.nanos/Fl),Number(t.value.nanos%Fl)];case`Millis`:return[Math.floor(t.value.millis/1e3),Math.round(t.value.millis%1e3*1e6)]}},au=y(2,(e,t)=>{let n=Ll(e);switch(n.value._tag){case`Nanos`:return t.onNanos(n.value.nanos);case`Infinity`:return t.onMillis(1/0);case`Millis`:return t.onMillis(n.value.millis)}}),ou=y(3,(e,t,n)=>{let r=Ll(e),i=Ll(t);if(r.value._tag===`Infinity`||i.value._tag===`Infinity`)return n.onMillis(tu(r),tu(i));if(r.value._tag===`Nanos`||i.value._tag===`Nanos`){let e=r.value._tag===`Nanos`?r.value.nanos:BigInt(Math.round(r.value.millis*1e6)),t=i.value._tag===`Nanos`?i.value.nanos:BigInt(Math.round(i.value.millis*1e6));return n.onNanos(e,t)}return n.onMillis(r.value.millis,i.value.millis)}),su=(e,t)=>ou(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t}),cu=y(2,(e,t)=>ou(e,t,{onMillis:(e,t)=>e<=t,onNanos:(e,t)=>e<=t})),lu=y(2,(e,t)=>ou(e,t,{onMillis:(e,t)=>e>=t,onNanos:(e,t)=>e>=t})),uu=y(2,(e,t)=>su(Ll(e),Ll(t))),du=e=>{let t=Ll(e);if(t.value._tag===`Infinity`)return{days:1/0,hours:1/0,minutes:1/0,seconds:1/0,millis:1/0,nanos:1/0};let n=ru(t),r=n/Pl,i=r/Nl,a=i/Ml,o=a/Ml,s=o/jl;return{days:Number(s),hours:Number(o%jl),minutes:Number(a%Ml),seconds:Number(i%Ml),millis:Number(r%Nl),nanos:Number(n%Pl)}},fu=e=>{let t=Ll(e);if(t.value._tag===`Infinity`)return`Infinity`;if(Wl(t))return`0`;let n=du(t),r=[];return n.days!==0&&r.push(`${n.days}d`),n.hours!==0&&r.push(`${n.hours}h`),n.minutes!==0&&r.push(`${n.minutes}m`),n.seconds!==0&&r.push(`${n.seconds}s`),n.millis!==0&&r.push(`${n.millis}ms`),n.nanos!==0&&r.push(`${n.nanos}ns`),r.join(` `)},pu=Symbol.for(`effect/MutableRef`),mu={[pu]:pu,toString(){return Nn(this.toJSON())},toJSON(){return{_id:`MutableRef`,current:Dn(this.current)}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},hu=e=>{let t=Object.create(mu);return t.current=e,t},gu=e=>e.current,_u=y(2,(e,t)=>(e.current=t,e)),vu=`effect/FiberId`,yu=Symbol.for(vu),bu=`None`,xu=`Runtime`,Su=`Composite`,Cu=bn(`${vu}-${bu}`),wu=class{[yu]=yu;_tag=bu;id=-1;startTimeMillis=-1;[w](){return Cu}[O](e){return Au(e)&&e._tag===bu}toString(){return Nn(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag}}[A](){return this.toJSON()}},Tu=class{id;startTimeMillis;[yu]=yu;_tag=xu;constructor(e,t){this.id=e,this.startTimeMillis=t}[w](){return D(this,bn(`${vu}-${this._tag}-${this.id}-${this.startTimeMillis}`))}[O](e){return Au(e)&&e._tag===xu&&this.id===e.id&&this.startTimeMillis===e.startTimeMillis}toString(){return Nn(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag,id:this.id,startTimeMillis:this.startTimeMillis}}[A](){return this.toJSON()}},Eu=class{left;right;[yu]=yu;_tag=Su;constructor(e,t){this.left=e,this.right=t}_hash;[w](){return x(bn(`${vu}-${this._tag}`),E(T(this.left)),E(T(this.right)),D(this))}[O](e){return Au(e)&&e._tag===Su&&k(this.left,e.left)&&k(this.right,e.right)}toString(){return Nn(this.toJSON())}toJSON(){return{_id:`FiberId`,_tag:this._tag,left:Dn(this.left),right:Dn(this.right)}}[A](){return this.toJSON()}},Du=new wu,Ou=(e,t)=>new Tu(e,t),ku=(e,t)=>new Eu(e,t),Au=e=>C(e,yu),ju=e=>e._tag===bu||x(Fu(e),Us(e=>ju(e))),Mu=e=>{switch(e._tag){case bu:return zs();case xu:return Vs(e.id);case Su:return x(Mu(e.left),Js(Mu(e.right)))}},Nu=S(Symbol.for(`effect/Fiber/Id/_fiberCounter`),()=>hu(0)),Pu=e=>Array.from(Mu(e)).map(e=>`#${e}`).join(`,`),Fu=e=>{switch(e._tag){case bu:return zs();case xu:return Vs(e);case Su:return x(Fu(e.left),Js(Fu(e.right)))}},Iu=()=>{let e=gu(Nu);return x(Nu,_u(e+1)),new Tu(e,Date.now())},Lu=Du,Ru=Ou,zu=ku,Bu=Au,Vu=Pu,Hu=Iu,Uu=Qo,Wu=$o,Gu=ts,Ku=ns,qu=as,Ju=ss,Yu=ds,Xu=ms,Zu=gs,Qu=Symbol.for(`effect/List`),$u=e=>Di(e),ed=(e=>Et(pa(e),$u))(k),td={[Qu]:Qu,_tag:`Cons`,toString(){return Nn(this.toJSON())},toJSON(){return{_id:`List`,_tag:`Cons`,values:$u(this).map(Dn)}},[A](){return this.toJSON()},[O](e){return ad(e)&&this._tag===e._tag&&ed(this,e)},[w](){return D(this,Cn($u(this)))},[Symbol.iterator](){let e=!1,t=this;return{next(){if(e)return this.return();if(t._tag===`Nil`)return e=!0,this.return();let n=t.head;return t=t.tail,{done:e,value:n}},return(t){return e||=!0,{done:!0,value:t}}}},pipe(){return j(this,arguments)}},nd=(e,t)=>{let n=Object.create(td);return n.head=e,n.tail=t,n},rd=bn(`Nil`),id=Object.create({[Qu]:Qu,_tag:`Nil`,toString(){return Nn(this.toJSON())},toJSON(){return{_id:`List`,_tag:`Nil`}},[A](){return this.toJSON()},[w](){return rd},[O](e){return ad(e)&&this._tag===e._tag},[Symbol.iterator](){return{next(){return{done:!0,value:void 0}}}},pipe(){return j(this,arguments)}}),ad=e=>C(e,Qu),od=e=>e._tag===`Nil`,sd=e=>e._tag===`Cons`,cd=()=>id,ld=(e,t)=>nd(e,t),ud=cd,dd=e=>nd(e,id),fd=y(2,(e,t)=>md(t,e)),pd=y(2,(e,t)=>ld(t,e)),md=y(2,(e,t)=>{if(od(e))return t;if(od(t))return e;{let n=nd(t.head,e),r=n,i=t.tail;for(;!od(i);){let t=nd(i.head,e);r.tail=t,r=t,i=i.tail}return n}}),hd=y(3,(e,t,n)=>{let r=t,i=e;for(;!od(i);)r=n(r,i.head),i=i.tail;return r}),gd=e=>{let t=ud(),n=e;for(;!od(n);)t=pd(t,n.head),n=n.tail;return t};Array.prototype;var _d=function(){function e(e){e&&Object.assign(this,e)}return e.prototype=dr,e}();({..._d.prototype});var vd=Symbol.for(`effect/DifferContextPatch`);function yd(e){return e}var bd={..._d.prototype,[vd]:{_Value:yd,_Patch:yd}},xd=Object.create(Object.assign(Object.create(bd),{_tag:`Empty`})),Sd=()=>xd,Cd=Object.assign(Object.create(bd),{_tag:`AndThen`}),wd=(e,t)=>{let n=Object.create(Cd);return n.first=e,n.second=t,n},Td=Object.assign(Object.create(bd),{_tag:`AddService`}),Ed=(e,t)=>{let n=Object.create(Td);return n.key=e,n.service=t,n},Dd=Object.assign(Object.create(bd),{_tag:`RemoveService`}),Od=e=>{let t=Object.create(Dd);return t.key=e,t},kd=Object.assign(Object.create(bd),{_tag:`UpdateService`}),Ad=(e,t)=>{let n=Object.create(kd);return n.key=e,n.update=t,n},jd=(e,t)=>{let n=new Map(e.unsafeMap),r=Sd();for(let[e,i]of t.unsafeMap.entries())if(n.has(e)){let t=n.get(e);n.delete(e),k(t,i)||(r=Md(Ad(e,()=>i))(r))}else n.delete(e),r=Md(Ed(e,i))(r);for(let[e]of n.entries())r=Md(Od(e))(r);return r},Md=y(2,(e,t)=>wd(e,t)),Nd=y(2,(e,t)=>{if(e._tag===`Empty`)return t;let n=!1,r=$a(e),i=new Map(t.unsafeMap);for(;mo(r);){let e=_o(r),t=vo(r);switch(e._tag){case`Empty`:r=t;break;case`AddService`:i.set(e.key,e.service),r=t;break;case`AndThen`:r=lo(lo(t,e.second),e.first);break;case`RemoveService`:i.delete(e.key),r=t;break;case`UpdateService`:i.set(e.key,e.update(i.get(e.key))),n=!0,r=t;break}}if(!n)return nl(i);let a=new Map;for(let[e]of t.unsafeMap)i.has(e)&&(a.set(e,i.get(e)),i.delete(e));for(let[e,t]of i)a.set(e,t);return nl(a)});({..._d.prototype});var Pd=Symbol.for(`effect/DifferHashSetPatch`);function Fd(e){return e}var Id={..._d.prototype,[Pd]:{_Value:Fd,_Key:Fd,_Patch:Fd}},Ld=Object.create(Object.assign(Object.create(Id),{_tag:`Empty`})),Rd=()=>Ld,zd=Object.assign(Object.create(Id),{_tag:`AndThen`}),Bd=(e,t)=>{let n=Object.create(zd);return n.first=e,n.second=t,n},Vd=Object.assign(Object.create(Id),{_tag:`Add`}),Hd=e=>{let t=Object.create(Vd);return t.value=e,t},Ud=Object.assign(Object.create(Id),{_tag:`Remove`}),Wd=e=>{let t=Object.create(Ud);return t.value=e,t},Gd=(e,t)=>{let[n,r]=Ys([e,Rd()],([e,t],n)=>Hs(n)(e)?[Ks(n)(e),t]:[e,Kd(Hd(n))(t)])(t);return Ys(r,(e,t)=>Kd(Wd(t))(e))(n)},Kd=y(2,(e,t)=>Bd(e,t)),qd=y(2,(e,t)=>{if(e._tag===`Empty`)return t;let n=t,r=$a(e);for(;mo(r);){let e=_o(r),t=vo(r);switch(e._tag){case`Empty`:r=t;break;case`AndThen`:r=lo(e.first)(lo(e.second)(t));break;case`Add`:n=Gs(e.value)(n),r=t;break;case`Remove`:n=Ks(e.value)(n),r=t}}return n});({..._d.prototype});var Jd=Symbol.for(`effect/DifferReadonlyArrayPatch`);function Yd(e){return e}var Xd={..._d.prototype,[Jd]:{_Value:Yd,_Patch:Yd}},Zd=Object.create(Object.assign(Object.create(Xd),{_tag:`Empty`})),Qd=()=>Zd,$d=Object.assign(Object.create(Xd),{_tag:`AndThen`}),ef=(e,t)=>{let n=Object.create($d);return n.first=e,n.second=t,n},tf=Object.assign(Object.create(Xd),{_tag:`Append`}),nf=e=>{let t=Object.create(tf);return t.values=e,t},rf=Object.assign(Object.create(Xd),{_tag:`Slice`}),af=(e,t)=>{let n=Object.create(rf);return n.from=e,n.until=t,n},of=Object.assign(Object.create(Xd),{_tag:`Update`}),sf=(e,t)=>{let n=Object.create(of);return n.index=e,n.patch=t,n},cf=e=>{let t=0,n=Qd();for(;t<e.oldValue.length&&t<e.newValue.length;){let r=e.oldValue[t],i=e.newValue[t],a=e.differ.diff(r,i);k(a,e.differ.empty)||(n=lf(n,sf(t,a))),t+=1}return t<e.oldValue.length&&(n=lf(n,af(0,t))),t<e.newValue.length&&(n=lf(n,nf(Ji(t)(e.newValue)))),n},lf=y(2,(e,t)=>ef(e,t)),uf=y(3,(e,t,n)=>{if(e._tag===`Empty`)return t;let r=t.slice(),i=oa(e);for(;Fi(i);){let e=Hi(i),t=Gi(i);switch(e._tag){case`Empty`:i=t;break;case`AndThen`:t.unshift(e.first,e.second),i=t;break;case`Append`:for(let t of e.values)r.push(t);i=t;break;case`Slice`:r=r.slice(e.from,e.until),i=t;break;case`Update`:r[e.index]=n.patch(e.patch,r[e.index]),i=t;break}}return r}),df={[Symbol.for(`effect/Differ`)]:{_P:b,_V:b},pipe(){return j(this,arguments)}},ff=e=>{let t=Object.create(df);return t.empty=e.empty,t.diff=e.diff,t.combine=e.combine,t.patch=e.patch,t},pf=()=>ff({empty:Sd(),combine:(e,t)=>Md(t)(e),diff:(e,t)=>jd(e,t),patch:(e,t)=>Nd(t)(e)}),mf=()=>ff({empty:Rd(),combine:(e,t)=>Kd(t)(e),diff:(e,t)=>Gd(e,t),patch:(e,t)=>qd(t)(e)}),hf=e=>ff({empty:Qd(),combine:(e,t)=>lf(e,t),diff:(t,n)=>cf({oldValue:t,newValue:n,differ:e}),patch:(t,n)=>uf(t,n,e)}),gf=()=>_f((e,t)=>t),_f=e=>ff({empty:b,combine:(e,t)=>e===b?t:t===b?e:n=>t(e(n)),diff:(e,t)=>k(e,t)?b:yt(t),patch:(t,n)=>e(n,t(n))}),vf=255,yf=8,bf=e=>e&vf,xf=e=>e>>yf&vf,Sf=(e,t)=>(e&vf)+((t&e&vf)<<yf),Cf=Sf(0,0),wf=e=>Sf(e,e),Tf=e=>Sf(e,0),Ef=y(2,(e,t)=>Sf(bf(e)&~t,xf(e))),Df=y(2,(e,t)=>e|t),Of=e=>~e>>>0&vf,kf=e=>Nf(e,32),Af=y(2,(e,t)=>e|t),jf=e=>Mf(e)&&!Lf(e),Mf=e=>Nf(e,1),Nf=y(2,(e,t)=>(e&t)!==0),Pf=(...e)=>e.reduce((e,t)=>e|t,0),Ff=Pf(0),If=e=>Nf(e,4),Lf=e=>Nf(e,16),Rf=y(2,(e,t)=>Sf(e^t,t)),zf=y(2,(e,t)=>e&(Of(bf(t))|xf(t))|bf(t)&xf(t)),Bf=ff({empty:Cf,diff:(e,t)=>Rf(e,t),combine:(e,t)=>Df(t)(e),patch:(e,t)=>zf(t,e)}),Vf=wf,Hf=Tf,Uf=Ef,Wf=(e,t)=>({_tag:`Par`,left:e,right:t}),Gf=(e,t)=>({_tag:`Seq`,left:e,right:t}),Kf=e=>{let t=dd(e),n=ud();for(;;){let[e,r]=hd(t,[Qf(),ud()],([e,t],n)=>{let[r,i]=qf(n);return[ep(e,r),fd(t,i)]});if(n=Jf(n,e),od(r))return gd(n);t=r}throw Error(`BUG: BlockedRequests.flatten - please report an issue at https://github.com/Effect-TS/effect/issues`)},qf=e=>{let t=e,n=Qf(),r=ud(),i=ud();for(;;)switch(t._tag){case`Empty`:if(od(r))return[n,i];t=r.head,r=r.tail;break;case`Par`:r=ld(t.right,r),t=t.left;break;case`Seq`:{let e=t.left,n=t.right;switch(e._tag){case`Empty`:t=n;break;case`Par`:{let r=e.left,i=e.right;t=Wf(Gf(r,n),Gf(i,n));break}case`Seq`:{let r=e.left,i=e.right;t=Gf(r,Gf(i,n));break}case`Single`:t=e,i=ld(n,i);break}break}case`Single`:if(n=$f(n,t),od(r))return[n,i];t=r.head,r=r.tail;break}throw Error(`BUG: BlockedRequests.step - please report an issue at https://github.com/Effect-TS/effect/issues`)},Jf=(e,t)=>{if(od(e))return dd(rp(t));if(tp(t))return e;let n=lp(e.head),r=np(t);return n.length===1&&r.length===1&&k(n[0],r[0])?ld(cp(e.head,rp(t)),e.tail):ld(rp(t),e)},Yf=Symbol.for(`effect/RequestBlock/RequestBlockParallel`),Xf={_R:e=>e},Zf=class{map;[Yf]=Xf;constructor(e){this.map=e}},Qf=()=>new Zf(Uu()),$f=(e,t)=>new Zf(Yu(e.map,t.dataSource,e=>oi(fi(e,co(t.blockedRequest)),()=>$a(t.blockedRequest)))),ep=(e,t)=>new Zf(Zu(e.map,t.map,(e,t,n)=>qu(e,n,ni(Ku(e,n),{onNone:()=>t,onSome:e=>fo(t,e)})))),tp=e=>Gu(e.map),np=e=>Array.from(Ju(e.map)),rp=e=>sp(Xu(e.map,e=>$a(e))),ip=Symbol.for(`effect/RequestBlock/RequestBlockSequential`),ap={_R:e=>e},op=class{map;[ip]=ap;constructor(e){this.map=e}},sp=e=>new op(e),cp=(e,t)=>new op(Zu(t.map,e.map,(e,t,n)=>qu(e,n,ni(Ku(e,n),{onNone:()=>Za(),onSome:e=>fo(e,t)})))),lp=e=>Array.from(Ju(e.map)),up=e=>Array.from(e.map),dp=`Pending`,fp=`Done`,pp=Symbol.for(`effect/Deferred`),mp={_E:e=>e,_A:e=>e},hp=e=>({_tag:dp,joiners:e}),gp=e=>({_tag:fp,effect:e}),_p=class e{self;called=!1;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}return(e){return{value:e,done:!0}}throw(e){throw e}[Symbol.iterator](){return new e(this.self)}},vp=(e,t)=>{let n=new Sp(`Blocked`);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n},yp=e=>{let t=new Sp(`RunBlocked`);return t.effect_instruction_i0=e,t},bp=Symbol.for(`effect/Effect`),xp=class{patch;op;_op=er;constructor(e,t){this.patch=e,this.op=t}},Sp=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[bp]=sr;constructor(e){this._op=e}[O](e){return this===e}[w](){return D(this,gn(this))}pipe(){return j(this,arguments)}toJSON(){return{_id:`Effect`,_op:this._op,effect_instruction_i0:Dn(this.effect_instruction_i0),effect_instruction_i1:Dn(this.effect_instruction_i1),effect_instruction_i2:Dn(this.effect_instruction_i2)}}toString(){return Nn(this.toJSON())}[A](){return this.toJSON()}[Symbol.iterator](){return new _p(new un(this))}},Cp=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[bp]=sr;constructor(e){this._op=e,this._tag=e}[O](e){return Dh(e)&&e._op===`Failure`&&k(this.effect_instruction_i0,e.effect_instruction_i0)}[w](){return x(bn(this._tag),E(T(this.effect_instruction_i0)),D(this))}get cause(){return this.effect_instruction_i0}pipe(){return j(this,arguments)}toJSON(){return{_id:`Exit`,_tag:this._op,cause:this.cause.toJSON()}}toString(){return Nn(this.toJSON())}[A](){return this.toJSON()}[Symbol.iterator](){return new _p(new un(this))}},wp=class{_op;effect_instruction_i0=void 0;effect_instruction_i1=void 0;effect_instruction_i2=void 0;trace=void 0;[bp]=sr;constructor(e){this._op=e,this._tag=e}[O](e){return Dh(e)&&e._op===`Success`&&k(this.effect_instruction_i0,e.effect_instruction_i0)}[w](){return x(bn(this._tag),E(T(this.effect_instruction_i0)),D(this))}get value(){return this.effect_instruction_i0}pipe(){return j(this,arguments)}toJSON(){return{_id:`Exit`,_tag:this._op,value:Dn(this.value)}}toString(){return Nn(this.toJSON())}[A](){return this.toJSON()}[Symbol.iterator](){return new _p(new un(this))}},Tp=e=>C(e,bp),Ep=e=>{let t=new Sp(Qn);return t.effect_instruction_i0=e,t},Dp=y(3,(e,t,n)=>pm(r=>I(e,e=>I(Bp(R(()=>r(t(e)))),t=>R(()=>n(e,t)).pipe(Xp({onFailure:e=>{switch(t._tag){case Un:return Up(uc(t.effect_instruction_i0,e));case qn:return Up(e)}},onSuccess:()=>t})))))),Op=y(2,(e,t)=>I(e,()=>L(t))),kp=e=>Op(e,void 0),Ap=function(){let e=new Sp(Hn);switch(arguments.length){case 2:e.effect_instruction_i0=arguments[0],e.commit=arguments[1];break;case 3:e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.commit=arguments[2];break;case 4:e.effect_instruction_i0=arguments[0],e.effect_instruction_i1=arguments[1],e.effect_instruction_i2=arguments[2],e.commit=arguments[3];break;default:throw Error(Zt(`you're not supposed to end up here`))}return e},jp=(e,t=Lu)=>{let n=new Sp(Vn),r;return n.effect_instruction_i0=t=>{r=e(t)},n.effect_instruction_i1=t,am(n,e=>Tp(r)?r:mm)},Mp=(e,t=Lu)=>R(()=>jp(e,t)),Np=(e,t=Lu)=>Ap(e,function(){let e,n;function r(t){e?e(t):n===void 0&&(n=t)}let i=new Sp(Vn);i.effect_instruction_i0=t=>{e=t,n&&t(n)},i.effect_instruction_i1=t;let a,o;return this.effect_instruction_i0.length===1?a=mn(()=>this.effect_instruction_i0(r)):(o=new AbortController,a=mn(()=>this.effect_instruction_i0(r,o.signal))),a||o?am(i,e=>(o&&o.abort(),a??mm)):i}),Pp=y(2,(e,t)=>Zp(e,{onFailure:t,onSuccess:L})),Fp=Symbol.for(`effect/OriginalAnnotation`),Ip=(e,t)=>ti(t)?new Proxy(e,{has(e,t){return t===Wc||t===Fp||t in e},get(n,r){return r===Wc?t.value:r===Fp?e:n[r]}}):e,Lp=e=>Ht(e)&&!(Wc in e)?Ep(t=>Up(sc(Ip(e,ag(t))))):Up(sc(e)),Rp=e=>Wp(()=>sc(new vh(e))),zp=e=>Zp(e,{onFailure:e=>L(N(e)),onSuccess:e=>L(M(e))}),Bp=e=>Yp(e,{onFailure:Ph,onSuccess:Vh}),Vp=e=>Ht(e)&&!(Wc in e)?Ep(t=>Up(oc(Ip(e,ag(t))))):Up(oc(e)),Hp=e=>I(z(e),Vp),Up=e=>{let t=new Cp(Un);return t.effect_instruction_i0=e,t},Wp=e=>I(z(e),Up),Gp=Ep(e=>L(e.id())),Kp=e=>Ep(t=>e(t.id())),I=y(2,(e,t)=>{let n=new Sp(Gn);return n.effect_instruction_i0=e,n.effect_instruction_i1=t,n}),qp=e=>{let t=new Sp(`OnStep`);return t.effect_instruction_i0=e,t},Jp=e=>I(e,b),Yp=y(2,(e,t)=>Xp(e,{onFailure:e=>L(t.onFailure(e)),onSuccess:e=>L(t.onSuccess(e))})),Xp=y(2,(e,t)=>{let n=new Sp(Kn);return n.effect_instruction_i0=e,n.effect_instruction_i1=t.onFailure,n.effect_instruction_i2=t.onSuccess,n}),Zp=y(2,(e,t)=>Xp(e,{onFailure:e=>{if(vc(e).length>0)return Up(Tc(e));let n=_c(e);return n.length>0?t.onFailure(go(n)):Up(e)},onSuccess:t.onSuccess})),Qp=y(2,(e,t)=>R(()=>{let n=Di(e),r=Ti(n.length),i=0;return Op(_m({while:()=>i<n.length,body:()=>t(n[i],i),step:e=>{r[i++]=e}}),r)})),$p=y(2,(e,t)=>R(()=>{let n=Di(e),r=0;return _m({while:()=>r<n.length,body:()=>t(n[r],r),step:()=>{r++}})})),em=e=>{let t=new Sp(Yn);return t.effect_instruction_i0=Vf(1),t.effect_instruction_i1=()=>e,t},tm=y(2,(e,t)=>I(e,e=>z(()=>t(e)))),nm=y(2,(e,t)=>Zp(e,{onFailure:e=>Hp(()=>t.onFailure(e)),onSuccess:e=>z(()=>t.onSuccess(e))})),rm=y(2,(e,t)=>Xp(e,{onFailure:e=>{let n=xc(e);switch(n._tag){case`Left`:return Hp(()=>t(n.left));case`Right`:return Up(n.right)}},onSuccess:L})),im=y(2,(e,t)=>pm(n=>Xp(n(e),{onFailure:e=>{let n=Ph(e);return Xp(t(n),{onFailure:t=>Ph(uc(e,t)),onSuccess:()=>n})},onSuccess:e=>{let n=Vh(e);return wm(t(n),n)}}))),am=y(2,(e,t)=>im(e,zh({onFailure:e=>gc(e)?kp(t(yc(e))):mm,onSuccess:()=>mm}))),om=y(2,(e,t)=>dm(e,t,L)),sm=e=>cm(e,b),cm=y(2,(e,t)=>Zp(e,{onFailure:e=>Lp(t(e)),onSuccess:L})),L=e=>{let t=new wp(qn);return t.effect_instruction_i0=e,t},R=e=>{let t=new Sp(Hn);return t.commit=e,t},z=e=>{let t=new Sp(Jn);return t.effect_instruction_i0=e,t},lm=y(e=>e.length===3||e.length===2&&!(Ht(e[1])&&`onlyEffect`in e[1]),(e,t)=>I(e,e=>{let n=typeof t==`function`?t(e):t;return Tp(n)?Op(n,e):Xt(n)?jp(t=>{n.then(n=>t(L(e)),e=>t(Vp(new Eh(e,`An unknown error occurred in Effect.tap`))))}):L(e)})),um=e=>Ep(t=>e(Hm(sh,F(x(t.getFiberRef(sh),ii(()=>t.scope())))))),dm=y(3,(e,t,n)=>Xp(e,{onFailure:e=>vc(e).length>0?Up(di(Cc(e))):t(),onSuccess:n})),fm=e=>{let t=new Sp(Yn);return t.effect_instruction_i0=Hf(1),t.effect_instruction_i1=()=>e,t},pm=e=>Ap(e,function(){let e=new Sp(Yn);return e.effect_instruction_i0=Hf(1),e.effect_instruction_i1=e=>Mf(e)?mn(()=>this.effect_instruction_i0(em)):mn(()=>this.effect_instruction_i0(fm)),e}),mm=L(void 0),hm=e=>{let t=new Sp(Yn);return t.effect_instruction_i0=e,t.effect_instruction_i1=void 0,t},gm=y(2,(e,t)=>I(t,t=>t?x(e,tm(F)):L(P()))),_m=e=>{let t=new Sp(Xn);return t.effect_instruction_i0=e.while,t.effect_instruction_i1=e.body,t.effect_instruction_i2=e.step,t},vm=e=>R(()=>{let t=new Sp(Zn);return t.effect_instruction_i0=e(),t}),ym=function(){let e=arguments.length===1?arguments[0]:arguments[1].bind(arguments[0]);return vm(()=>e(x))},bm=(e,...t)=>Object.defineProperty(t.length===0?function(...t){return vm(()=>e.apply(this,t))}:function(...n){let r=vm(()=>e.apply(this,n));for(let e of t)r=e(r,...n);return r},`length`,{value:e.length,configurable:!0}),xm=e=>{let t=new Sp($n);return e?.priority===void 0?t:th(t,e.priority)},Sm=y(2,(e,t)=>I(e,e=>tm(t,t=>[e,t]))),Cm=y(2,(e,t)=>I(e,e=>Op(t,e))),wm=y(2,(e,t)=>I(e,()=>t)),Tm=y(3,(e,t,n)=>I(e,e=>tm(t,t=>n(e,t)))),Em=e=>I(Gp,t=>x(e,Dm(t))),Dm=y(2,(e,t)=>I(e.interruptAsFork(t),()=>e.await)),Om={_tag:`All`,syslog:0,label:`ALL`,ordinal:-(2**53-1),pipe(){return j(this,arguments)}},km={_tag:`Fatal`,syslog:2,label:`FATAL`,ordinal:5e4,pipe(){return j(this,arguments)}},Am={_tag:`Error`,syslog:3,label:`ERROR`,ordinal:4e4,pipe(){return j(this,arguments)}},jm={_tag:`Warning`,syslog:4,label:`WARN`,ordinal:3e4,pipe(){return j(this,arguments)}},Mm={_tag:`Info`,syslog:6,label:`INFO`,ordinal:2e4,pipe(){return j(this,arguments)}},Nm={_tag:`Debug`,syslog:7,label:`DEBUG`,ordinal:1e4,pipe(){return j(this,arguments)}},Pm={_tag:`Trace`,syslog:7,label:`TRACE`,ordinal:0,pipe(){return j(this,arguments)}},Fm={_tag:`None`,syslog:7,label:`OFF`,ordinal:2**53-1,pipe(){return j(this,arguments)}},Im=Symbol.for(`effect/FiberRef`),Lm={_A:e=>e},Rm=e=>Ep(t=>Vh(t.getFiberRef(e))),zm=y(2,(e,t)=>I(Rm(e),t)),Bm=y(2,(e,t)=>Vm(e,()=>[void 0,t])),Vm=y(2,(e,t)=>Ep(n=>{let[r,i]=t(n.getFiberRef(e));return n.setFiberRef(e,i),L(r)})),Hm=y(3,(e,t,n)=>Dp(Cm(Rm(t),Bm(t,n)),()=>e,e=>Bm(t,e))),Um=(e,t)=>qm(e,{differ:gf(),fork:t?.fork??b,join:t?.join}),Wm=e=>{let t=mf();return qm(e,{differ:t,fork:t.empty})},Gm=e=>{let t=hf(gf());return qm(e,{differ:t,fork:t.empty})},Km=e=>{let t=pf();return qm(e,{differ:t,fork:t.empty})},qm=(e,t)=>({...fr,[Im]:Lm,initial:e,commit(){return Rm(this)},diff:(e,n)=>t.differ.diff(e,n),combine:(e,n)=>t.differ.combine(e,n),patch:e=>n=>t.differ.patch(e,n),fork:t.fork,join:t.join??((e,t)=>t)}),Jm=e=>qm(e,{differ:Bf,fork:Bf.empty}),Ym=S(Symbol.for(`effect/FiberRef/currentContext`),()=>Km(yl())),Xm=S(Symbol.for(`effect/FiberRef/currentSchedulingPriority`),()=>Um(0)),Zm=S(Symbol.for(`effect/FiberRef/currentMaxOpsBeforeYield`),()=>Um(2048)),Qm=S(Symbol.for(`effect/FiberRef/currentLogAnnotation`),()=>Um(Uu())),$m=S(Symbol.for(`effect/FiberRef/currentLogLevel`),()=>Um(Mm)),eh=S(Symbol.for(`effect/FiberRef/currentLogSpan`),()=>Um(ud())),th=y(2,(e,t)=>Hm(e,Xm,t)),nh=S(Symbol.for(`effect/FiberRef/currentConcurrency`),()=>Um(`unbounded`)),rh=S(Symbol.for(`effect/FiberRef/currentRequestBatching`),()=>Um(!0)),ih=S(Symbol.for(`effect/FiberRef/currentUnhandledErrorLogLevel`),()=>Um(F(Nm))),ah=S(Symbol.for(`effect/FiberRef/versionMismatchErrorLogLevel`),()=>Um(F(jm))),oh=S(Symbol.for(`effect/FiberRef/currentMetricLabels`),()=>Gm(aa())),sh=S(Symbol.for(`effect/FiberRef/currentForkScopeOverride`),()=>Um(P(),{fork:()=>P(),join:(e,t)=>e})),ch=S(Symbol.for(`effect/FiberRef/currentInterruptedCause`),()=>Um(ac,{fork:()=>ac,join:(e,t)=>e})),lh=Symbol.for(`effect/Scope`),uh=Symbol.for(`effect/CloseableScope`),dh=(e,t)=>e.addFinalizer(()=>kp(t)),fh=(e,t)=>e.addFinalizer(t),ph=(e,t)=>e.close(t),mh=(e,t)=>e.fork(t),hh=function(){class e extends globalThis.Error{commit(){return Vp(this)}toJSON(){let e={...this};return this.message&&(e.message=this.message),this.cause&&(e.cause=this.cause),e}[A](){return this.toString===globalThis.Error.prototype.toString?`Bun`in globalThis?Lc(oc(this),{renderErrorCause:!0}):this:this.stack?`${this.toString()}\n${this.stack.split(`
258
- `).slice(1).join(`
259
- `)}`:this.toString()}}return Object.assign(e.prototype,pr),e}(),gh=(e,t)=>{class n extends hh{_tag=t}return Object.assign(n.prototype,e),n.prototype.name=t,n},_h=Symbol.for(`effect/Cause/errors/RuntimeException`),vh=gh({[_h]:_h},`RuntimeException`),yh=Symbol.for(`effect/Cause/errors/InterruptedException`),bh=e=>C(e,yh),xh=Symbol.for(`effect/Cause/errors/IllegalArgument`),Sh=gh({[xh]:xh},`IllegalArgumentException`),Ch=Symbol.for(`effect/Cause/errors/NoSuchElement`),wh=gh({[Ch]:Ch},`NoSuchElementException`),Th=Symbol.for(`effect/Cause/errors/UnknownException`),Eh=function(){class e extends hh{_tag=`UnknownException`;error;constructor(e,t){super(t??`An unknown error occurred`,{cause:e}),this.error=e}}return Object.assign(e.prototype,{[Th]:Th,name:`UnknownException`}),e}(),Dh=e=>Tp(e)&&`_tag`in e&&(e._tag===`Success`||e._tag===`Failure`),Oh=e=>e._tag===`Success`,kh=y(2,(e,t)=>{switch(e._tag){case Un:return Ph(e.effect_instruction_i0);case qn:return Vh(t)}}),Ah=e=>kh(e,void 0),jh=(e,t)=>Wh(e,t?.parallel?lc:uc),Mh=e=>Ph(sc(e)),Nh=e=>Ph(oc(e)),Ph=e=>{let t=new Cp(Un);return t.effect_instruction_i0=e,t},Fh=y(2,(e,t)=>{switch(e._tag){case Un:return Ph(e.effect_instruction_i0);case qn:return t(e.effect_instruction_i0)}}),Ih=e=>x(e,Fh(b)),Lh=e=>Ph(cc(e)),Rh=y(2,(e,t)=>{switch(e._tag){case Un:return Ph(e.effect_instruction_i0);case qn:return Vh(t(e.effect_instruction_i0))}}),zh=y(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case Un:return t(e.effect_instruction_i0);case qn:return n(e.effect_instruction_i0)}}),Bh=y(2,(e,{onFailure:t,onSuccess:n})=>{switch(e._tag){case Un:return t(e.effect_instruction_i0);case qn:return n(e.effect_instruction_i0)}}),Vh=e=>{let t=new wp(qn);return t.effect_instruction_i0=e,t},Hh=Vh(void 0),Uh=y(3,(e,t,{onFailure:n,onSuccess:r})=>{switch(e._tag){case Un:switch(t._tag){case qn:return Ph(e.effect_instruction_i0);case Un:return Ph(n(e.effect_instruction_i0,t.effect_instruction_i0))}case qn:switch(t._tag){case qn:return Vh(r(e.effect_instruction_i0,t.effect_instruction_i0));case Un:return Ph(t.effect_instruction_i0)}}}),Wh=(e,t)=>{let n=eo(e);return mo(n)?x(vo(n),da(x(_o(n),Rh($a)),(e,n)=>x(e,Uh(n,{onSuccess:(e,t)=>x(e,lo(t)),onFailure:t}))),Rh(ro),Rh(e=>no(e)),F):P()},Gh=e=>({...fr,[pp]:mp,state:hu(hp([])),commit(){return Jh(this)},blockingOn:e}),Kh=()=>I(Gp,e=>qh(e)),qh=e=>z(()=>Gh(e)),Jh=e=>Mp(t=>{let n=gu(e.state);switch(n._tag){case fp:return t(n.effect);case dp:return n.joiners.push(t),$h(e,t)}},e.blockingOn),Yh=y(2,(e,t)=>z(()=>{let n=gu(e.state);switch(n._tag){case fp:return!1;case dp:_u(e.state,gp(t));for(let e=0,r=n.joiners.length;e<r;e++)n.joiners[e](t);return!0}})),Xh=y(2,(e,t)=>Yh(e,Up(t))),Zh=y(2,(e,t)=>Yh(e,L(t))),Qh=(e,t)=>{let n=gu(e.state);if(n._tag===`Pending`){_u(e.state,gp(t));for(let e=0,r=n.joiners.length;e<r;e++)n.joiners[e](t)}},$h=(e,t)=>z(()=>{let n=gu(e.state);if(n._tag===`Pending`){let e=n.joiners.indexOf(t);e>=0&&n.joiners.splice(e,1)}}),eg=Ep(e=>Vh(e.currentContext)),tg=()=>eg,ng=e=>I(tg(),e),rg=y(2,(e,t)=>Hm(Ym,t)(e)),ig=y(2,(e,t)=>ng(n=>rg(e,t(n)))),ag=e=>{let t=e.currentSpan;return t!==void 0&&t._tag===`Span`?F(t):P()},og=pc,sg=Sh,cg=Lc,lg=`InvalidData`,ug=`MissingData`,dg=`SourceUnavailable`,fg=`Unsupported`,pg=Symbol.for(`effect/ConfigError`),mg={_tag:`ConfigError`,[pg]:pg},hg=(e,t)=>{let n=Object.create(mg);return n._op=`And`,n.left=e,n.right=t,Object.defineProperty(n,`toString`,{enumerable:!1,value(){return`${this.left} and ${this.right}`}}),Object.defineProperty(n,`message`,{enumerable:!1,get(){return this.toString()}}),n},gg=(e,t)=>{let n=Object.create(mg);return n._op=`Or`,n.left=e,n.right=t,Object.defineProperty(n,`toString`,{enumerable:!1,value(){return`${this.left} or ${this.right}`}}),Object.defineProperty(n,`message`,{enumerable:!1,get(){return this.toString()}}),n},_g=(e,t,n={pathDelim:`.`})=>{let r=Object.create(mg);return r._op=lg,r.path=e,r.message=t,Object.defineProperty(r,`toString`,{enumerable:!1,value(){return`(Invalid data at ${x(this.path,ga(n.pathDelim))}: "${this.message}")`}}),r},vg=(e,t,n={pathDelim:`.`})=>{let r=Object.create(mg);return r._op=ug,r.path=e,r.message=t,Object.defineProperty(r,`toString`,{enumerable:!1,value(){return`(Missing data at ${x(this.path,ga(n.pathDelim))}: "${this.message}")`}}),r},yg=(e,t,n,r={pathDelim:`.`})=>{let i=Object.create(mg);return i._op=dg,i.path=e,i.message=t,i.cause=n,Object.defineProperty(i,`toString`,{enumerable:!1,value(){return`(Source unavailable at ${x(this.path,ga(r.pathDelim))}: "${this.message}")`}}),i},bg=(e,t,n={pathDelim:`.`})=>{let r=Object.create(mg);return r._op=fg,r.path=e,r.message=t,Object.defineProperty(r,`toString`,{enumerable:!1,value(){return`(Unsupported operation at ${x(this.path,ga(n.pathDelim))}: "${this.message}")`}}),r},xg=y(2,(e,t)=>{switch(e._op){case`And`:return hg(xg(e.left,t),xg(e.right,t));case`Or`:return gg(xg(e.left,t),xg(e.right,t));case lg:return _g([...t,...e.path],e.message);case ug:return vg([...t,...e.path],e.message);case dg:return yg([...t,...e.path],e.message,e.cause);case fg:return bg([...t,...e.path],e.message)}}),Sg=Symbol.for(`effect/Clock`),Cg=vl(`effect/Clock`),wg=2**31-1,Tg={unsafeSchedule(e,t){let n=tu(t);if(n>wg)return xt;let r=!1,i=setTimeout(()=>{r=!0,e()},n);return()=>(clearTimeout(i),!r)}},Eg=function(){let e=BigInt(1e6);if(typeof performance>`u`||typeof performance.now!=`function`)return()=>BigInt(Date.now())*e;let t;return()=>(t===void 0&&(t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6))),t+BigInt(Math.round(performance.now()*1e6)))}(),Dg=function(){let e=typeof process==`object`&&`hrtime`in process&&typeof process.hrtime.bigint==`function`?process.hrtime:void 0;if(!e)return Eg;let t=Eg()-e.bigint();return()=>t+e.bigint()}(),Og=class{[Sg]=Sg;unsafeCurrentTimeMillis(){return Date.now()}unsafeCurrentTimeNanos(){return Dg()}currentTimeMillis=z(()=>this.unsafeCurrentTimeMillis());currentTimeNanos=z(()=>this.unsafeCurrentTimeNanos());scheduler(){return L(Tg)}sleep(e){return Np(t=>kp(z(Tg.unsafeSchedule(()=>t(mm),e))))}},kg=()=>new Og,Ag=Xr,jg=e=>{if(e===`NaN`)return wr(NaN);if(e===`Infinity`)return wr(1/0);if(e===`-Infinity`)return wr(-1/0);if(e.trim()===``)return Cr;let t=Number(e);return Number.isNaN(t)?Cr:wr(t)},Mg=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,`\\$&`),Ng={_tag:`Empty`},Pg=y(2,(e,t)=>{let n=dd(t),r=e;for(;sd(n);){let e=n.head;switch(e._tag){case`Empty`:n=n.tail;break;case`AndThen`:n=ld(e.first,ld(e.second,n.tail));break;case`MapName`:r=sa(r,e.f),n=n.tail;break;case`Nested`:r=Ai(r,e.name),n=n.tail;break;case`Unnested`:if(x(Vi(r),vi(e.name)))r=Gi(r),n=n.tail;else return N(vg(r,`Expected ${e.name} to be in path in ConfigProvider#unnested`));break}}return M(r)}),Fg=`Constant`,Ig=`Fail`,Lg=`Fallback`,Rg=`Described`,zg=`Lazy`,Bg=`MapOrFail`,Vg=`Nested`,Hg=`Primitive`,Ug=`Sequence`,Wg=`HashMap`,Gg=`ZipWith`,Kg=(e,t)=>[...e,...t],qg=Symbol.for(`effect/ConfigProvider`),Jg=vl(`effect/ConfigProvider`),Yg=Symbol.for(`effect/ConfigProviderFlat`),Xg=e=>({[qg]:qg,pipe(){return j(this,arguments)},...e}),Zg=e=>({[Yg]:Yg,patch:e.patch,load:(t,n,r=!0)=>e.load(t,n,r),enumerateChildren:e.enumerateChildren}),Qg=e=>Xg({load:t=>I(n_(e,aa(),t,!1),e=>ni(Vi(e),{onNone:()=>Vp(vg(aa(),`Expected a single value having structure: ${t}`)),onSome:L})),flattened:e}),$g=e=>{let{pathDelim:t,seqDelim:n}=Object.assign({},{pathDelim:`_`,seqDelim:`,`},e),r=e=>x(e,ga(t)),i=e=>e.split(t),a=()=>(typeof process<`u`&&`env`in process,{});return Qg(Zg({load:(e,t,i=!0)=>{let o=r(e),s=a();return x(o in s?F(s[o]):P(),rm(()=>vg(e,`Expected ${o} to exist in the process context`)),I(r=>a_(r,e,t,n,i)))},enumerateChildren:e=>z(()=>{let t=a();return Bs(Object.keys(t).map(e=>i(e.toUpperCase())).filter(t=>{for(let n=0;n<e.length;n++){let r=x(e,Bi(n)),i=t[n];if(i===void 0||r!==i)return!1}return!0}).flatMap(t=>t.slice(e.length,e.length+1)))}),patch:Ng}))},e_=(e,t,n,r)=>{let i=fa(n.length,t=>t>=r.length?P():F([e(t),t+1])),a=fa(r.length,e=>e>=n.length?P():F([t(e),e+1]));return[Kg(n,i),Kg(r,a)]},t_=(e,t)=>{let n=t;if(n._tag===`Nested`){let t=e.slice();for(;n._tag===`Nested`;)t.push(n.name),n=n.config;return t}return e},n_=(e,t,n,r)=>{let i=n;switch(i._tag){case Fg:return L(oa(i.value));case Rg:return R(()=>n_(e,t,i.config,r));case Ig:return Vp(vg(t,i.message));case Lg:return x(R(()=>n_(e,t,i.first,r)),Pp(n=>i.condition(n)?x(n_(e,t,i.second,r),Pp(e=>Vp(gg(n,e)))):Vp(n)));case zg:return R(()=>n_(e,t,i.config(),r));case Bg:return R(()=>x(n_(e,t,i.original,r),I(Qp(e=>x(i.mapOrFail(e),rm(xg(t_(t,i.original))))))));case Vg:return R(()=>n_(e,Kg(t,oa(i.name)),i.config,r));case Hg:return x(Pg(t,e.patch),I(t=>x(e.load(t,i,r),I(e=>{if(e.length===0){let e=x(Ui(t),ii(()=>`<n/a>`));return Vp(vg([],`Expected ${i.description} with name ${e}`))}return L(e)}))));case Ug:return x(Pg(t,e.patch),I(n=>x(e.enumerateChildren(n),I(s_),I(n=>n.length===0?R(()=>tm(n_(e,t,i.config,!0),oa)):x(Qp(n,n=>n_(e,ji(t,`[${n}]`),i.config,!0)),tm(e=>{let t=la(e);return t.length===0?oa(aa()):oa(t)}))))));case Wg:return R(()=>x(Pg(t,e.patch),I(t=>x(e.enumerateChildren(t),I(n=>x(n,Qp(n=>n_(e,Kg(t,oa(n)),i.valueConfig,r)),tm(e=>e.length===0?oa(Uu()):x(o_(e),sa(e=>Wu(Zi(Di(n),e)))))))))));case Gg:return R(()=>x(n_(e,t,i.left,r),zp,I(n=>x(n_(e,t,i.right,r),zp,I(e=>{if(zr(n)&&zr(e))return Vp(hg(n.left,e.left));if(zr(n)&&Br(e))return Vp(n.left);if(Br(n)&&zr(e))return Vp(e.left);if(Br(n)&&Br(e)){let r=r_(t,x(t,ga(`.`))),[a,o]=e_(r,r,x(n.right,sa(M)),x(e.right,sa(M)));return x(a,Zi(o),Qp(([e,t])=>x(Sm(e,t),tm(([e,t])=>i.zip(e,t)))))}throw Error(`BUG: ConfigProvider.fromFlatLoop - please report an issue at https://github.com/Effect-TS/effect/issues`)})))))}},r_=(e,t)=>n=>N(vg(e,`The element at index ${n} in a sequence at path "${t}" was missing`)),i_=(e,t)=>e.split(RegExp(`\\s*${Mg(t)}\\s*`)),a_=(e,t,n,r,i)=>i?x(i_(e,r),Qp(e=>n.parse(e.trim())),rm(xg(t))):x(n.parse(e),nm({onFailure:xg(t),onSuccess:oa})),o_=e=>Object.keys(e[0]).map(t=>e.map(e=>e[t])),s_=e=>x(Qp(e,l_),nm({onFailure:()=>aa(),onSuccess:Xi(Ag)}),zp,tm(Gr)),c_=/^(\[(\d+)\])$/,l_=e=>{let t=e.match(c_);if(t!==null){let e=t[2];return x(e!==void 0&&e.length>0?F(e):P(),pi(u_))}return P()},u_=e=>{let t=Number.parseInt(e);return Number.isNaN(t)?P():F(t)},d_=Symbol.for(`effect/Console`),f_=vl(`effect/Console`),p_={[d_]:d_,assert(e,...t){return z(()=>{console.assert(e,...t)})},clear:z(()=>{console.clear()}),count(e){return z(()=>{console.count(e)})},countReset(e){return z(()=>{console.countReset(e)})},debug(...e){return z(()=>{console.debug(...e)})},dir(e,t){return z(()=>{console.dir(e,t)})},dirxml(...e){return z(()=>{console.dirxml(...e)})},error(...e){return z(()=>{console.error(...e)})},group(e){return e?.collapsed?z(()=>console.groupCollapsed(e?.label)):z(()=>console.group(e?.label))},groupEnd:z(()=>{console.groupEnd()}),info(...e){return z(()=>{console.info(...e)})},log(...e){return z(()=>{console.log(...e)})},table(e,t){return z(()=>{console.table(e,t)})},time(e){return z(()=>console.time(e))},timeEnd(e){return z(()=>console.timeEnd(e))},timeLog(e,...t){return z(()=>{console.timeLog(e,...t)})},trace(...e){return z(()=>{console.trace(...e)})},warn(...e){return z(()=>{console.warn(...e)})},unsafe:console},m_=Symbol.for(`effect/Random`),h_=vl(`effect/Random`),g_=class{seed;[m_]=m_;PRNG;constructor(e){this.seed=e,this.PRNG=new on(e)}get next(){return z(()=>this.PRNG.number())}get nextBoolean(){return tm(this.next,e=>e>.5)}get nextInt(){return z(()=>this.PRNG.integer(2**53-1))}nextRange(e,t){return tm(this.next,n=>(t-e)*n+e)}nextIntBetween(e,t){return z(()=>this.PRNG.integer(t-e)+e)}shuffle(e){return __(e,e=>this.nextIntBetween(0,e))}},__=(e,t)=>R(()=>x(z(()=>Array.from(e)),I(e=>{let n=[];for(let t=e.length;t>=2;--t)n.push(t);return x(n,$p(n=>x(t(n),tm(t=>v_(e,n-1,t)))),Op(eo(e)))}))),v_=(e,t,n)=>{let r=e[t];return e[t]=e[n],e[n]=r,e},y_=e=>new g_(T(e)),b_=Symbol.for(`effect/Tracer`),x_=e=>({[b_]:b_,...e}),S_=vl(`effect/Tracer`),C_=vl(`effect/ParentSpan`),w_=function(){return function(e){let t=``;for(let n=0;n<e;n++)t+=`abcdef0123456789`.charAt(Math.floor(Math.random()*16));return t}}(),T_=class{name;parent;context;startTime;kind;_tag=`Span`;spanId;traceId=`native`;sampled=!0;status;attributes;events=[];links;constructor(e,t,n,r,i,a){this.name=e,this.parent=t,this.context=n,this.startTime=i,this.kind=a,this.status={_tag:`Started`,startTime:i},this.attributes=new Map,this.traceId=t._tag===`Some`?t.value.traceId:w_(32),this.spanId=w_(16),this.links=Array.from(r)}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}},E_=x_({span:(e,t,n,r,i,a)=>new T_(e,t,n,r,i,a),context:e=>e()}),D_=Ol()(`effect/Tracer/DisablePropagation`,{defaultValue:xt}),O_=x(yl(),xl(Cg,kg()),xl(f_,p_),xl(h_,y_(Math.random())),xl(Jg,$g()),xl(S_,E_)),k_=S(Symbol.for(`effect/DefaultServices/currentServices`),()=>Km(O_)),A_=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return{BaseEffectError:class extends hh{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&(Object.assign(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}.BaseEffectError}(),j_=e=>{let t={BaseEffectError:class extends A_{_tag=e}};return t.BaseEffectError.prototype.name=e,t.BaseEffectError},M_=ur,N_=mr,P_=class extends N_{},F_=`Sequential`,I_=`Parallel`,L_=`ParallelN`,R_={_tag:F_},z_={_tag:I_},B_=e=>({_tag:L_,parallelism:e}),V_=e=>e._tag===F_,H_=e=>e._tag===I_,U_=R_,W_=z_,G_=B_;function K_(e){return new Y_(e)}function q_(){return K_(new Map)}var J_=Symbol.for(`effect/FiberRefs`),Y_=class{locals;[J_]=J_;constructor(e){this.locals=e}pipe(){return j(this,arguments)}},X_=(e,t,n,r=!1)=>{let i=e,a=t,o=n,s=r,c;for(;c===void 0;)if(Ii(a)&&Ii(o)){let e=Hi(a)[0],t=Gi(a),n=Hi(o)[0],r=Hi(o)[1],i=Gi(o);e.startTimeMillis<n.startTimeMillis?(o=i,s=!0):e.startTimeMillis>n.startTimeMillis?a=t:e.id<n.id?(o=i,s=!0):e.id>n.id?a=t:c=[r,s]}else c=[i.initial,!0];return c},Z_=y(3,(e,t,n)=>{let r=new Map(e.locals);return n.locals.forEach((e,n)=>{let i=e[0][1];if(!e[0][0][O](t)){if(!r.has(n)){if(k(i,n.initial))return;r.set(n,[[t,n.join(n.initial,i)]]);return}let a=r.get(n),[o,s]=X_(n,a,e);if(s){let e=n.diff(o,i),s=a[0][1],c=n.join(s,n.patch(e)(s));if(!k(s,c)){let e,i=a[0][0];e=i[O](t)?[[i,c],...a.slice(1)]:[[t,c],...a],r.set(n,e)}}}}),new Y_(r)}),Q_=y(2,(e,t)=>{let n=new Map;return $_(e,n,t),new Y_(n)}),$_=(e,t,n)=>{e.locals.forEach((e,r)=>{let i=e[0][1],a=r.patch(r.fork)(i);k(i,a)?t.set(r,e):t.set(r,[[n,a],...e])})},ev=y(2,(e,t)=>{let n=new Map(e.locals);return n.delete(t),new Y_(n)}),tv=y(2,(e,t)=>e.locals.has(t)?F(Hi(e.locals.get(t))[1]):P()),nv=y(2,(e,t)=>x(tv(e,t),ii(()=>t.initial))),rv=y(2,(e,{fiberId:t,fiberRef:n,value:r})=>{if(e.locals.size===0)return new Y_(new Map([[n,[[t,r]]]]));let i=new Map(e.locals);return iv(i,t,n,r),new Y_(i)}),iv=(e,t,n,r)=>{let i=e.get(n)??[],a;if(Ii(i)){let[e,n]=Hi(i);if(e[O](t)){if(k(n,r))return;a=[[t,r],...i.slice(1)]}else a=[[t,r],...i]}else a=[[t,r]];e.set(n,a)},av=y(2,(e,{entries:t,forkAs:n})=>{if(e.locals.size===0)return new Y_(new Map(t));let r=new Map(e.locals);return n!==void 0&&$_(e,r,n),t.forEach(([e,t])=>{t.length===1?iv(r,t[0][0],e,t[0][1]):t.forEach(([t,n])=>{iv(r,t,e,n)})}),new Y_(r)}),ov=nv,sv=av,cv=q_,lv=`Empty`,uv=`Remove`,dv=`Update`,fv=`AndThen`,pv={_tag:lv},mv=(e,t)=>{let n=new Map(e.locals),r=pv;for(let[e,i]of t.locals.entries()){let t=Hi(i)[1],a=n.get(e);if(a!==void 0){let n=Hi(a)[1];k(n,t)||(r=hv({_tag:dv,fiberRef:e,patch:e.diff(n,t)})(r))}else r=hv({_tag:`Add`,fiberRef:e,value:t})(r);n.delete(e)}for(let[e]of n.entries())r=hv({_tag:uv,fiberRef:e})(r);return r},hv=y(2,(e,t)=>({_tag:fv,first:e,second:t})),gv=y(3,(e,t,n)=>{let r=n,i=oa(e);for(;Ii(i);){let e=Hi(i),n=Gi(i);switch(e._tag){case lv:i=n;break;case`Add`:r=rv(r,{fiberId:t,fiberRef:e.fiberRef,value:e.value}),i=n;break;case uv:r=ev(r,e.fiberRef),i=n;break;case dv:{let a=nv(r,e.fiberRef);r=rv(r,{fiberId:t,fiberRef:e.fiberRef,value:e.fiberRef.patch(e.patch)(a)}),i=n;break}case fv:i=Ai(e.first)(Ai(e.second)(n));break}}return r}),_v=mv,vv=gv,yv=`effect/FiberStatus`,bv=Symbol.for(yv),xv=`Done`,Sv=`Running`,Cv=`Suspended`,wv=bn(`${yv}-${xv}`),Tv=class{[bv]=bv;_tag=xv;[w](){return wv}[O](e){return jv(e)&&e._tag===`Done`}},Ev=class{runtimeFlags;[bv]=bv;_tag=Sv;constructor(e){this.runtimeFlags=e}[w](){return x(T(yv),E(T(this._tag)),E(T(this.runtimeFlags)),D(this))}[O](e){return jv(e)&&e._tag===`Running`&&this.runtimeFlags===e.runtimeFlags}},Dv=class{runtimeFlags;blockingOn;[bv]=bv;_tag=Cv;constructor(e,t){this.runtimeFlags=e,this.blockingOn=t}[w](){return x(T(yv),E(T(this._tag)),E(T(this.runtimeFlags)),E(T(this.blockingOn)),D(this))}[O](e){return jv(e)&&e._tag===`Suspended`&&this.runtimeFlags===e.runtimeFlags&&k(this.blockingOn,e.blockingOn)}},Ov=new Tv,kv=e=>new Ev(e),Av=(e,t)=>new Dv(e,t),jv=e=>C(e,bv),Mv=e=>e._tag===xv,Nv=Ov,Pv=kv,Fv=Av,Iv=Mv,Lv=Om,Rv=km,zv=Am,Bv=jm,Vv=Mm,Hv=Nm,Uv=Pm,Wv=Fm,Gv=Qr(x(Ag,Zr(e=>e.ordinal))),Kv=e=>{switch(e){case`All`:return Lv;case`Debug`:return Hv;case`Error`:return zv;case`Fatal`:return Rv;case`Info`:return Vv;case`Trace`:return Uv;case`None`:return Wv;case`Warning`:return Bv}},qv=Symbol.for(`effect/Micro`),Jv=Symbol.for(`effect/Micro/MicroExit`),Yv=Symbol.for(`effect/Micro/MicroCause`),Xv={_E:b},Zv=class extends globalThis.Error{_tag;traces;[Yv];constructor(e,t,n){let r=`MicroCause.${e}`,i,a,o;if(t instanceof globalThis.Error){i=`(${r}) ${t.name}`,a=t.message;let e=a.split(`
260
- `).length;o=t.stack?`(${r}) ${t.stack.split(`
261
- `).slice(0,e+3).join(`
262
- `)}`:`${i}: ${a}`}else i=r,a=Pn(t,0),o=`${i}: ${a}`;n.length>0&&(o+=`\n ${n.join(`
263
- `)}`),super(a),this._tag=e,this.traces=n,this[Yv]=Xv,this.name=i,this.stack=o}pipe(){return j(this,arguments)}toString(){return this.stack}[A](){return this.stack}},Qv=class extends Zv{error;constructor(e,t=[]){super(`Fail`,e,t),this.error=e}},$v=(e,t=[])=>new Qv(e,t),ey=class extends Zv{defect;constructor(e,t=[]){super(`Die`,e,t),this.defect=e}},ty=(e,t=[])=>new ey(e,t),ny=class extends Zv{constructor(e=[]){super(`Interrupt`,`interrupted`,e)}},ry=(e=[])=>new ny(e),iy=e=>e._tag===`Interrupt`,ay=Symbol.for(`effect/Micro/MicroFiber`),oy={_A:b,_E:b},sy=class{context;interruptible;[ay];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(e,t=!0){this.context=e,this.interruptible=t,this[ay]=oy}getRef(e){return fl(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Ct):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Ny))}unsafePoll(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===hy)return;let n=cy.interruptChildren&&cy.interruptChildren(this);if(n!==void 0)return this.evaluate(Oy(n,()=>t));this._exit=t;for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0}runLoop(e){let t=!1,n=e;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!t&&this.getRef(Vy).shouldYield(this)){t=!0;let e=n;n=Oy(Ty,()=>e)}if(n=n[dy](this),n===hy){let e=this._yielded;return Jv in e?(this._yielded=void 0,e):hy}}}catch(e){return C(n,dy)?Py(e):Py(`MicroFiber.runLoop: Not a valid effect: ${String(n)}`)}}getCont(e){for(;;){let t=this._stack.pop();if(!t)return;let n=t[my]&&t[my](this);if(n)return{[e]:n};if(t[e])return t}}_yielded=void 0;yieldWith(e){return this._yielded=e,hy}children(){return this._children??=new Set}},cy=S(`effect/Micro/fiberMiddleware`,()=>({interruptChildren:void 0})),ly=Symbol.for(`effect/Micro/identifier`),uy=Symbol.for(`effect/Micro/args`),dy=Symbol.for(`effect/Micro/evaluate`),fy=Symbol.for(`effect/Micro/successCont`),py=Symbol.for(`effect/Micro/failureCont`),my=Symbol.for(`effect/Micro/ensureCont`),hy=Symbol.for(`effect/Micro/Yield`),gy={_A:b,_E:b,_R:b},_y={...M_,_op:`Micro`,[qv]:gy,pipe(){return j(this,arguments)},[Symbol.iterator](){return new Qt(new un(this))},toJSON(){return{_id:`Micro`,op:this[ly],...uy in this?{args:this[uy]}:void 0}},toString(){return Nn(this)},[A](){return Nn(this)}};function vy(e){return Py(`Micro.evaluate: Not implemented`)}var yy=e=>({..._y,[ly]:e.op,[dy]:e.eval??vy,[fy]:e.contA,[py]:e.contE,[my]:e.ensure}),by=e=>{let t=yy(e);return function(){let n=Object.create(t);return n[uy]=e.single===!1?arguments:arguments[0],n}},xy=e=>{let t={...yy(e),[Jv]:Jv,_tag:e.op,get[e.prop](){return this[uy]},toJSON(){return{_id:`MicroExit`,_tag:e.op,[e.prop]:this[uy]}},[O](t){return Ay(t)&&t._tag===e.op&&k(this[uy],t[uy])},[w](){return D(this,E(bn(e.op))(T(this[uy])))}};return function(e){let n=Object.create(t);return n[uy]=e,n[fy]=void 0,n[py]=void 0,n[my]=void 0,n}},Sy=xy({op:`Success`,prop:`value`,eval(e){let t=e.getCont(fy);return t?t[fy](this[uy],e):e.yieldWith(this)}}),Cy=xy({op:`Failure`,prop:`cause`,eval(e){let t=e.getCont(py);for(;iy(this[uy])&&t&&e.interruptible;)t=e.getCont(py);return t?t[py](this[uy],e):e.yieldWith(this)}}),wy=e=>Cy($v(e)),Ty=by({op:`Yield`,eval(e){let t=!1;return e.getRef(Vy).scheduleTask(()=>{t||e.evaluate(Fy)},this[uy]??0),e.yieldWith(()=>{t=!0})}})(0),Ey=Sy(void 0),Dy=by({op:`WithMicroFiber`,eval(e){return this[uy](e)}}),Oy=y(2,(e,t)=>{let n=Object.create(ky);return n[uy]=e,n[fy]=t,n}),ky=yy({op:`OnSuccess`,eval(e){return e._stack.push(this),this[uy]}}),Ay=e=>C(e,Jv),jy=Sy,My=Cy,Ny=My(ry()),Py=e=>My(ty(e)),Fy=jy(void 0),Iy=`setImmediate`in globalThis?globalThis.setImmediate:e=>setTimeout(e,0),Ly=class{tasks=[];running=!1;scheduleTask(e,t){this.tasks.push(e),this.running||(this.running=!0,Iy(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){let e=this.tasks;this.tasks=[];for(let t=0,n=e.length;t<n;t++)e[t]()}shouldYield(e){return e.currentOpCount>=e.getRef(By)}flush(){for(;this.tasks.length>0;)this.runTasks()}},Ry=y(2,(e,t)=>Dy(n=>{let r=n.context;return n.context=t(r),Wy(e,()=>(n.context=r,Ey))})),zy=y(2,(e,t)=>Ry(e,Tl(t))),By=class extends Ol()(`effect/Micro/currentMaxOpsBeforeYield`,{defaultValue:()=>2048}){};Ol()(`effect/Micro/currentConcurrency`,{defaultValue:()=>`unbounded`});var Vy=class extends Ol()(`effect/Micro/currentScheduler`,{defaultValue:()=>new Ly}){},Hy=y(2,(e,t)=>{let n=Object.create(Uy);return n[uy]=e,n[fy]=t.onSuccess,n[py]=t.onFailure,n}),Uy=yy({op:`OnSuccessAndFailure`,eval(e){return e._stack.push(this),this[uy]}}),Wy=y(2,(e,t)=>qy(n=>Hy(n(e),{onFailure:e=>Oy(t(My(e)),()=>Cy(e)),onSuccess:e=>Oy(t(jy(e)),()=>Sy(e))}))),Gy=by({op:`SetInterruptible`,ensure(e){if(e.interruptible=this[uy],e._interrupted&&e.interruptible)return()=>Ny}}),Ky=e=>Dy(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(Gy(!1)),t._interrupted?Ny:e)),qy=e=>Dy(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Gy(!0)),e(Ky)):e(b)),Jy=(e,t)=>{let n=new sy(Vy.context(t?.scheduler??new Ly));if(n.evaluate(e),t?.signal)if(t.signal.aborted)n.unsafeInterrupt();else{let e=()=>n.unsafeInterrupt();t.signal.addEventListener(`abort`,e,{once:!0}),n.addObserver(()=>t.signal.removeEventListener(`abort`,e))}return n},Yy=function(){class e extends globalThis.Error{}return Object.assign(e.prototype,_y,dr,{[ly]:`Failure`,[dy](){return wy(this)},toString(){return this.message?`${this.name}: ${this.message}`:this.name},toJSON(){return{...this}},[A](){let e=this.stack;return e?`${this.toString()}\n${e.split(`
264
- `).slice(1).join(`
265
- `)}`:this.toString()}}),e}(),Xy=function(){return class extends Yy{constructor(e){super(),e&&Object.assign(this,e)}}}(),Zy=e=>{class t extends Xy{_tag=e}return t.prototype.name=e,t};Zy(`NoSuchElementException`),Zy(`TimeoutException`);var Qy=Symbol.for(`effect/Readable`),$y=Symbol.for(`effect/Ref`),eb={_A:e=>e},tb=class extends P_{ref;commit(){return this.get}[$y]=eb;[Qy]=Qy;constructor(e){super(),this.ref=e,this.get=z(()=>gu(this.ref))}get;modify(e){return z(()=>{let t=gu(this.ref),[n,r]=e(t);return t!==r&&_u(r)(this.ref),n})}},nb=e=>new tb(hu(e)),rb=e=>z(()=>nb(e)),ib=e=>e.get,ab=y(2,(e,t)=>e.modify(()=>[void 0,t])),ob=y(2,(e,t)=>e.modify(t)),sb=y(2,(e,t)=>e.modify(e=>[void 0,t(e)])),cb=class e{scheduleDrain;running=!1;tasks=new lb;constructor(e){this.scheduleDrain=e}starveInternal=e=>{let t=this.tasks.buckets;this.tasks.buckets=[];for(let[e,n]of t)for(let e=0;e<n.length;e++)n[e]();this.tasks.buckets.length===0?this.running=!1:this.starve(e)};starve(e=0){this.scheduleDrain(e,this.starveInternal)}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running||(this.running=!0,this.starve())}static cached(t){let n=new e(t),r=new WeakMap;return i=>{if(i===void 0)return n;let a=r.get(i);return a===void 0&&(a=new e(t),r.set(i,a)),a}}},lb=class{buckets=[];scheduleTask(e,t){let n=this.buckets.length,r,i=0;for(;i<n&&this.buckets[i][0]<=t;i++)r=this.buckets[i];r&&r[0]===t?r[1].push(e):i===n?this.buckets.push([t,[e]]):this.buckets.splice(i,0,[t,[e]])}},ub=class{maxNextTickBeforeTimer;getRunner=cb.cached((e,t)=>{e>=this.maxNextTickBeforeTimer?setTimeout(()=>t(0),0):Promise.resolve(void 0).then(()=>t(e+1))});constructor(e){this.maxNextTickBeforeTimer=e}shouldYield(e){return e.currentOpCount>e.getFiberRef(Zm)?e.getFiberRef(Xm):!1}scheduleTask(e,t,n){this.getRunner(n).scheduleTask(e,t)}},db=S(Symbol.for(`effect/Scheduler/defaultScheduler`),()=>new ub(2048)),fb=class{tasks=new lb;deferred=!1;scheduleTask(e,t,n){this.deferred?db.scheduleTask(e,t,n):this.tasks.scheduleTask(e,t)}shouldYield(e){return e.currentOpCount>e.getFiberRef(Zm)?e.getFiberRef(Xm):!1}flush(){for(;this.tasks.buckets.length>0;){let e=this.tasks.buckets;this.tasks.buckets=[];for(let[t,n]of e)for(let e=0;e<n.length;e++)n[e]()}this.deferred=!0}},pb=S(Symbol.for(`effect/FiberRef/currentScheduler`),()=>Um(db)),mb=S(Symbol.for(`effect/FiberRef/currentRequestMap`),()=>Um(new Map)),hb=(e,t,n,r)=>{switch(e){case void 0:return t();case`unbounded`:return n();case`inherit`:return zm(nh,e=>e===`unbounded`?n():e>1?r(e):t());default:return e>1?r(e):t()}},gb=e=>e.replace(/[\s="]/g,`_`),_b=e=>t=>`${gb(t.label)}=${e-t.startTime}ms`,vb=`effect/MetricLabel`,yb=Symbol.for(vb),bb=class{key;value;[yb]=yb;_hash;constructor(e,t){this.key=e,this.value=t,this._hash=bn(vb+this.key+this.value)}[w](){return this._hash}[O](e){return Sb(e)&&this.key===e.key&&this.value===e.value}pipe(){return j(this,arguments)}},xb=(e,t)=>new bb(e,t),Sb=e=>C(e,yb),Cb=e=>tm(e,F),wb=e=>Lb(e,Ob,mv),Tb=e=>om(e,()=>I(xm(),()=>Tb(e))),Eb=(e,t,n,r)=>I(n(r,t),i=>{if(i)return L(F(r));let a=e.next();return a.done?L(P()):Eb(e,t+1,n,a.value)}),Db=(e,t,n)=>{let r=e.next();return r.done?L(!0):I(n(r.value,t),r=>r?Db(e,t+1,n):L(r))},Ob=Ep(e=>L(e.getFiberRefs())),kb=(e,t)=>R(()=>t.while(e)?I(t.body(e),e=>kb(e,t)):L(e)),Ab=(e,t,n,r)=>R(()=>t(e)?I(r(e),i=>tm(Ab(n(e),t,n,r),pd(i))):z(()=>ud())),jb=(e,t,n,r)=>R(()=>t(e)?I(r(e),()=>jb(n(e),t,n,r)):mm),Mb=e=>Rb((t,n)=>x(e,gv(t,n))),Nb=y(3,(e,t,n)=>ng(r=>rg(e,xl(r,t,n)))),Pb=(e,t,n,r,i)=>{let a=e.next();return!a.done&&r(n)?I(i(n,a.value,t),n=>Pb(e,t+1,n,r,i)):L(n)},Fb=(e,t)=>I(e,n=>t<=0?L(n):wm(xm(),Fb(e,t-1))),Ib=L(P()),Lb=y(3,(e,t,n)=>I(t,r=>I(e,e=>tm(t,t=>[n(r,t),e])))),Rb=e=>Ep(t=>(t.setFiberRefs(e(t.id(),t.getFiberRefs())),mm)),zb=pi(e=>Sl(e.context,D_)?e._tag===`Span`?zb(e.parent):P():F(e)),Bb=Oh,Vb=Ih,Hb=`InterruptSignal`,Ub=`Stateful`,Wb=`Resume`,Gb=`YieldNow`,Kb=e=>({_tag:Hb,cause:e}),qb=e=>({_tag:Ub,onFiber:e}),Jb=e=>({_tag:Wb,effect:e}),Yb=()=>({_tag:Gb}),Xb=Symbol.for(`effect/FiberScope`),Zb=class{[Xb]=Xb;fiberId=Lu;roots=new Set;add(e,t){this.roots.add(t),t.addObserver(()=>{this.roots.delete(t)})}},Qb=class{fiberId;parent;[Xb]=Xb;constructor(e,t){this.fiberId=e,this.parent=t}add(e,t){this.parent.tell(qb(e=>{e.addChild(t),t.addObserver(()=>{e.removeChild(t)})}))}},$b=e=>new Qb(e.id(),e),ex=S(Symbol.for(`effect/FiberScope/Global`),()=>new Zb),tx=Symbol.for(`effect/Fiber`),nx={_E:e=>e,_A:e=>e},rx={[tx]:nx,pipe(){return j(this,arguments)}},ix=Symbol.for(`effect/Fiber`),ax=e=>Cm(Jp(e.await),e.inheritAll);({...fr}),{...rx};var ox=`effect/FiberCurrent`,sx=Symbol.for(`effect/Logger`),cx={_Message:e=>e,_Output:e=>e},lx=e=>({[sx]:cx,log:e,pipe(){return j(this,arguments)}}),ux=/^[^\s"=]*$/,dx=lx(((e,t)=>({annotations:n,cause:r,date:i,fiberId:a,logLevel:o,message:s,spans:c})=>{let l=t=>t.match(ux)?t:e(t),u=(e,t)=>`${gb(e)}=${l(t)}`,d=(e,t)=>` `+u(e,t),f=u(`timestamp`,i.toISOString());f+=d(`level`,o.label),f+=d(`fiber`,Pu(a));let p=Oi(s);for(let e=0;e<p.length;e++)f+=d(`message`,Pn(p[e],t));fc(r)||(f+=d(`cause`,Lc(r,{renderErrorCause:!0})));for(let e of c)f+=` `+_b(i.getTime())(e);for(let[e,r]of n)f+=d(e,Pn(r,t));return f})(e=>`"${e.replace(/\\([\s\S])|(")/g,`\\$1$2`)}"`)),fx={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};fx.gray,fx.blue,fx.green,fx.yellow,fx.red,fx.bgBrightRed,fx.black;var px=typeof process==`object`&&process!==null&&typeof process.stdout==`object`&&process.stdout!==null;px&&process.stdout.isTTY,px||`Deno`in globalThis;var mx=`effect/MetricBoundaries`,hx=Symbol.for(mx),gx=class{values;[hx]=hx;constructor(e){this.values=e,this._hash=x(bn(mx),E(Cn(this.values)))}_hash;[w](){return this._hash}[O](e){return _x(e)&&k(this.values,e.values)}pipe(){return j(this,arguments)}},_x=e=>C(e,hx),vx=e=>new gx(x(e,Mi($a(1/0)),ha)),yx=e=>x(Ei(e.count-1,t=>e.start*e.factor**+t),ao,vx),bx=Symbol.for(`effect/MetricKeyType`),xx=`effect/MetricKeyType/Counter`,Sx=Symbol.for(xx),Cx=Symbol.for(`effect/MetricKeyType/Frequency`),wx=Symbol.for(`effect/MetricKeyType/Gauge`),Tx=`effect/MetricKeyType/Histogram`,Ex=Symbol.for(Tx),Dx=Symbol.for(`effect/MetricKeyType/Summary`),Ox={_In:e=>e,_Out:e=>e},kx=class{incremental;bigint;[bx]=Ox;[Sx]=Sx;constructor(e,t){this.incremental=e,this.bigint=t,this._hash=bn(xx)}_hash;[w](){return this._hash}[O](e){return Nx(e)}pipe(){return j(this,arguments)}},Ax=class{boundaries;[bx]=Ox;[Ex]=Ex;constructor(e){this.boundaries=e,this._hash=x(bn(Tx),E(T(this.boundaries)))}_hash;[w](){return this._hash}[O](e){return Ix(e)&&k(this.boundaries,e.boundaries)}pipe(){return j(this,arguments)}},jx=e=>new kx(e?.incremental??!1,e?.bigint??!1),Mx=e=>new Ax(e),Nx=e=>C(e,Sx),Px=e=>C(e,Cx),Fx=e=>C(e,wx),Ix=e=>C(e,Ex),Lx=e=>C(e,Dx),Rx=Symbol.for(`effect/MetricKey`),zx={_Type:e=>e},Bx=pa(k),Vx=class{name;keyType;description;tags;[Rx]=zx;constructor(e,t,n,r=[]){this.name=e,this.keyType=t,this.description=n,this.tags=r,this._hash=x(bn(this.name+this.description),E(T(this.keyType)),E(Cn(this.tags)))}_hash;[w](){return this._hash}[O](e){return Hx(e)&&this.name===e.name&&k(this.keyType,e.keyType)&&k(this.description,e.description)&&Bx(this.tags,e.tags)}pipe(){return j(this,arguments)}},Hx=e=>C(e,Rx),Ux=(e,t)=>new Vx(e,jx(t),si(t?.description)),Wx=(e,t,n)=>new Vx(e,Mx(t),si(n)),Gx=y(2,(e,t)=>t.length===0?e:new Vx(e.name,e.keyType,e.description,ia(e.tags,t))),Kx=Symbol.for(`effect/MutableHashMap`),qx={[Kx]:Kx,[Symbol.iterator](){return new Jx(this)},toString(){return Nn(this.toJSON())},toJSON(){return{_id:`MutableHashMap`,values:Array.from(this).map(Dn)}},[A](){return this.toJSON()},pipe(){return j(this,arguments)}},Jx=class e{self;referentialIterator;bucketIterator;constructor(e){this.self=e,this.referentialIterator=e.referential[Symbol.iterator]()}next(){if(this.bucketIterator!==void 0)return this.bucketIterator.next();let e=this.referentialIterator.next();return e.done?(this.bucketIterator=new Yx(this.self.buckets.values()),this.next()):e}[Symbol.iterator](){return new e(this.self)}},Yx=class{backing;constructor(e){this.backing=e}currentBucket;next(){if(this.currentBucket===void 0){let e=this.backing.next();if(e.done)return e;this.currentBucket=e.value[Symbol.iterator]()}let e=this.currentBucket.next();return e.done?(this.currentBucket=void 0,this.next()):e}},Xx=()=>{let e=Object.create(qx);return e.referential=new Map,e.buckets=new Map,e.bucketsSize=0,e},Zx=y(2,(e,t)=>{if(Tn(t)===!1)return e.referential.has(t)?F(e.referential.get(t)):P();let n=t[w](),r=e.buckets.get(n);return r===void 0?P():Qx(e,r,t)}),Qx=(e,t,n,r=!1)=>{for(let i=0,a=t.length;i<a;i++)if(n[O](t[i][0])){let n=t[i][1];return r&&(t.splice(i,1),e.bucketsSize--),F(n)}return P()},$x=y(2,(e,t)=>ti(Zx(e,t))),eS=y(3,(e,t,n)=>{if(Tn(t)===!1)return e.referential.set(t,n),e;let r=t[w](),i=e.buckets.get(r);return i===void 0?(e.buckets.set(r,[[t,n]]),e.bucketsSize++,e):(tS(e,i,t),i.push([t,n]),e.bucketsSize++,e)}),tS=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(n[O](t[r][0])){t.splice(r,1),e.bucketsSize--;return}},nS=Symbol.for(`effect/MetricState`),rS=`effect/MetricState/Counter`,iS=Symbol.for(rS),aS=`effect/MetricState/Frequency`,oS=Symbol.for(aS),sS=`effect/MetricState/Gauge`,cS=Symbol.for(sS),lS=`effect/MetricState/Histogram`,uS=Symbol.for(lS),dS=`effect/MetricState/Summary`,fS=Symbol.for(dS),pS={_A:e=>e},mS=class{count;[nS]=pS;[iS]=iS;constructor(e){this.count=e}[w](){return x(T(rS),E(T(this.count)),D(this))}[O](e){return TS(e)&&this.count===e.count}pipe(){return j(this,arguments)}},hS=pa(k),gS=class{occurrences;[nS]=pS;[oS]=oS;constructor(e){this.occurrences=e}_hash;[w](){return x(bn(aS),E(Cn(Di(this.occurrences.entries()))),D(this))}[O](e){return ES(e)&&hS(Di(this.occurrences.entries()),Di(e.occurrences.entries()))}pipe(){return j(this,arguments)}},_S=class{value;[nS]=pS;[cS]=cS;constructor(e){this.value=e}[w](){return x(T(sS),E(T(this.value)),D(this))}[O](e){return DS(e)&&this.value===e.value}pipe(){return j(this,arguments)}},vS=class{buckets;count;min;max;sum;[nS]=pS;[uS]=uS;constructor(e,t,n,r,i){this.buckets=e,this.count=t,this.min=n,this.max=r,this.sum=i}[w](){return x(T(lS),E(T(this.buckets)),E(T(this.count)),E(T(this.min)),E(T(this.max)),E(T(this.sum)),D(this))}[O](e){return OS(e)&&k(this.buckets,e.buckets)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return j(this,arguments)}},yS=class{error;quantiles;count;min;max;sum;[nS]=pS;[fS]=fS;constructor(e,t,n,r,i,a){this.error=e,this.quantiles=t,this.count=n,this.min=r,this.max=i,this.sum=a}[w](){return x(T(dS),E(T(this.error)),E(T(this.quantiles)),E(T(this.count)),E(T(this.min)),E(T(this.max)),E(T(this.sum)),D(this))}[O](e){return kS(e)&&this.error===e.error&&k(this.quantiles,e.quantiles)&&this.count===e.count&&this.min===e.min&&this.max===e.max&&this.sum===e.sum}pipe(){return j(this,arguments)}},bS=e=>new mS(e),xS=e=>new gS(e),SS=e=>new _S(e),CS=e=>new vS(e.buckets,e.count,e.min,e.max,e.sum),wS=e=>new yS(e.error,e.quantiles,e.count,e.min,e.max,e.sum),TS=e=>C(e,iS),ES=e=>C(e,oS),DS=e=>C(e,cS),OS=e=>C(e,uS),kS=e=>C(e,fS),AS=Symbol.for(`effect/MetricHook`),jS={_In:e=>e,_Out:e=>e},MS=e=>({[AS]:jS,pipe(){return j(this,arguments)},...e}),NS=BigInt(0),PS=e=>{let t=e.keyType.bigint?NS:0,n=e.keyType.incremental?e.keyType.bigint?e=>e>=NS:e=>e>=0:e=>!0,r=e=>{n(e)&&(t+=e)};return MS({get:()=>bS(t),update:r,modify:r})},FS=e=>{let t=new Map;for(let n of e.keyType.preregisteredWords)t.set(n,0);let n=e=>{let n=t.get(e)??0;t.set(e,n+1)};return MS({get:()=>xS(t),update:n,modify:n})},IS=(e,t)=>{let n=t;return MS({get:()=>SS(n),update:e=>{n=e},modify:e=>{n+=e}})},LS=e=>{let t=e.keyType.boundaries.values,n=t.length,r=new Uint32Array(n+1),i=new Float64Array(n),a=0,o=0,s=Number.MAX_VALUE,c=Number.MIN_VALUE;x(t,Xi(Ag),sa((e,t)=>{i[t]=e}));let l=e=>{let t=0,l=n;for(;t!==l;){let n=Math.floor(t+(l-t)/2);e<=i[n]?l=n:t=n,l===t+1&&(e<=i[t]?l=t:t=l)}r[t]=r[t]+1,a+=1,o+=e,e<s&&(s=e),e>c&&(c=e)},u=()=>{let e=Ti(n),t=0;for(let a=0;a<n;a++){let n=i[a],o=r[a];t+=o,e[a]=[n,t]}return e};return MS({get:()=>CS({buckets:u(),count:a,min:s,max:c,sum:o}),update:l,modify:l})},RS=e=>{let{error:t,maxAge:n,maxSize:r,quantiles:i}=e.keyType,a=x(i,Xi(Ag)),o=Ti(r),s=0,c=0,l=0,u=0,d=0,f=e=>{let i=[],s=0;for(;s!==r-1;){let t=o[s];if(t!=null){let[r,a]=t,o=Yl(e-r);lu(o,Gl)&&cu(o,n)&&i.push(a)}s+=1}return zS(t,a,Xi(i,Ag))},p=(e,t)=>{if(r>0){s+=1;let n=s%r;o[n]=[t,e]}u=c===0?e:Math.min(u,e),d=c===0?e:Math.max(d,e),c+=1,l+=e};return MS({get:()=>wS({error:t,quantiles:f(Date.now()),count:c,min:u,max:d,sum:l}),update:([e,t])=>p(e,t),modify:([e,t])=>p(e,t)})},zS=(e,t,n)=>{let r=n.length;if(!Ii(t))return aa();let i=t[0],a=t.slice(1),o=BS(e,r,P(),0,i,n),s=oa(o);return a.forEach(t=>{s.push(BS(e,r,o.value,o.consumed,t,o.rest))}),sa(s,e=>[e.quantile,e.value])},BS=(e,t,n,r,i,a)=>{let o=e,s=t,c=n,l=r,u=i,d=a,f=e,p=t,m=n,h=r,g=i,_=a;for(;;){if(!Ii(d))return{quantile:u,value:P(),consumed:l,rest:[]};if(u===1)return{quantile:u,value:F(Wi(d)),consumed:l+d.length,rest:[]};let e=Hi(d),t=qi(d,t=>t===e),n=u*s,r=o/2*n,i=l+t[0].length,a=Math.abs(i-n);if(i<n-r){f=o,p=s,m=Vi(d),h=i,g=u,_=t[1],o=f,s=p,c=m,l=h,u=g,d=_;continue}if(i>n+r){let t=ei(c)?F(e):c;return{quantile:u,value:t,consumed:l,rest:d}}switch(c._tag){case`None`:f=o,p=s,m=Vi(d),h=i,g=u,_=t[1],o=f,s=p,c=m,l=h,u=g,d=_;continue;case`Some`:if(a<Math.abs(n-c.value)){f=o,p=s,m=Vi(d),h=i,g=u,_=t[1],o=f,s=p,c=m,l=h,u=g,d=_;continue}return{quantile:u,value:F(c.value),consumed:l,rest:d}}}throw Error(`BUG: MetricHook.resolveQuantiles - please report an issue at https://github.com/Effect-TS/effect/issues`)},VS=Symbol.for(`effect/MetricPair`),HS={_Type:e=>e},US=(e,t)=>({[VS]:HS,metricKey:e,metricState:t,pipe(){return j(this,arguments)}}),WS=Symbol.for(`effect/MetricRegistry`),GS=class{[WS]=WS;map=Xx();snapshot(){let e=[];for(let[t,n]of this.map)e.push(US(t,n.get()));return e}get(e){let t=x(this.map,Zx(e),ci);if(t==null){if(Nx(e.keyType))return this.getCounter(e);if(Fx(e.keyType))return this.getGauge(e);if(Px(e.keyType))return this.getFrequency(e);if(Ix(e.keyType))return this.getHistogram(e);if(Lx(e.keyType))return this.getSummary(e);throw Error(`BUG: MetricRegistry.get - unknown MetricKeyType - please report an issue at https://github.com/Effect-TS/effect/issues`)}else return t}getCounter(e){let t=x(this.map,Zx(e),ci);if(t==null){let n=PS(e);x(this.map,$x(e))||x(this.map,eS(e,n)),t=n}return t}getFrequency(e){let t=x(this.map,Zx(e),ci);if(t==null){let n=FS(e);x(this.map,$x(e))||x(this.map,eS(e,n)),t=n}return t}getGauge(e){let t=x(this.map,Zx(e),ci);if(t==null){let n=IS(e,e.keyType.bigint?BigInt(0):0);x(this.map,$x(e))||x(this.map,eS(e,n)),t=n}return t}getHistogram(e){let t=x(this.map,Zx(e),ci);if(t==null){let n=LS(e);x(this.map,$x(e))||x(this.map,eS(e,n)),t=n}return t}getSummary(e){let t=x(this.map,Zx(e),ci);if(t==null){let n=RS(e);x(this.map,$x(e))||x(this.map,eS(e,n)),t=n}return t}},KS=()=>new GS,qS=Symbol.for(`effect/Metric`),JS={_Type:e=>e,_In:e=>e,_Out:e=>e},YS=S(Symbol.for(`effect/Metric/globalMetricRegistry`),()=>KS()),XS=function(e,t,n,r){let i=Object.assign(e=>lm(e,e=>nC(i,e)),{[qS]:JS,keyType:e,unsafeUpdate:t,unsafeValue:n,unsafeModify:r,register(){return this.unsafeValue([]),this},pipe(){return j(this,arguments)}});return i},ZS=(e,t)=>QS(Ux(e,t)),QS=e=>{let t,n=new WeakMap,r=r=>{if(r.length===0)return t===void 0&&(t=YS.get(e)),t;let i=n.get(r);return i===void 0?(i=YS.get(Gx(e,r)),n.set(r,i),i):i};return XS(e.keyType,(e,t)=>r(t).update(e),e=>r(e).get(),(e,t)=>r(t).modify(e))},$S=(e,t,n)=>QS(Wx(e,t,n)),eC=y(3,(e,t,n)=>tC(e,[xb(t,n)])),tC=y(2,(e,t)=>XS(e.keyType,(n,r)=>e.unsafeUpdate(n,ia(t,r)),n=>e.unsafeValue(ia(t,n)),(n,r)=>e.unsafeModify(n,ia(t,r)))),nC=y(2,(e,t)=>zm(oh,n=>z(()=>e.unsafeUpdate(t,n))));({...dr});var rC=y(2,(e,t)=>zm(mb,n=>z(()=>{if(n.has(e)){let r=n.get(e);r.state.completed||(r.state.completed=!0,Qh(r.result,t))}}))),iC=Symbol.for(`effect/Supervisor`),aC={_T:e=>e},oC=class e{underlying;value0;[iC]=aC;constructor(e,t){this.underlying=e,this.value0=t}get value(){return this.value0}onStart(e,t,n,r){this.underlying.onStart(e,t,n,r)}onEnd(e,t){this.underlying.onEnd(e,t)}onEffect(e,t){this.underlying.onEffect(e,t)}onSuspend(e){this.underlying.onSuspend(e)}onResume(e){this.underlying.onResume(e)}map(t){return new e(this,x(this.value,tm(t)))}zip(e){return new sC(this,e)}},sC=class e{left;right;_tag=`Zip`;[iC]=aC;constructor(e,t){this.left=e,this.right=t}get value(){return Sm(this.left.value,this.right.value)}onStart(e,t,n,r){this.left.onStart(e,t,n,r),this.right.onStart(e,t,n,r)}onEnd(e,t){this.left.onEnd(e,t),this.right.onEnd(e,t)}onEffect(e,t){this.left.onEffect(e,t),this.right.onEffect(e,t)}onSuspend(e){this.left.onSuspend(e),this.right.onSuspend(e)}onResume(e){this.left.onResume(e),this.right.onResume(e)}map(e){return new oC(this,x(this.value,tm(e)))}zip(t){return new e(this,t)}},cC=e=>C(e,iC)&&Ut(e,`Zip`),lC=class{effect;[iC]=aC;constructor(e){this.effect=e}get value(){return this.effect}onStart(e,t,n,r){}onEnd(e,t){}onEffect(e,t){}onSuspend(e){}onResume(e){}map(e){return new oC(this,x(this.value,tm(e)))}zip(e){return new sC(this,e)}onRun(e,t){return e()}},uC=e=>new lC(e),dC=S(`effect/Supervisor/none`,()=>uC(mm)),fC=ff,pC=`Empty`,mC=`AddSupervisor`,hC=`RemoveSupervisor`,gC=`AndThen`,_C={_tag:pC},vC=(e,t)=>({_tag:gC,first:e,second:t}),yC=(e,t)=>bC(t,$a(e)),bC=(e,t)=>{let n=e,r=t;for(;mo(r);){let e=_o(r);switch(e._tag){case pC:r=vo(r);break;case mC:n=n.zip(e.supervisor),r=vo(r);break;case hC:n=xC(n,e.supervisor),r=vo(r);break;case gC:r=lo(e.first)(lo(e.second)(vo(r)));break}}return n},xC=(e,t)=>k(e,t)?dC:cC(e)?xC(e.left,t).zip(xC(e.right,t)):e,SC=e=>k(e,dC)?zs():cC(e)?x(SC(e.left),Js(SC(e.right))):Vs(e),CC=fC({empty:_C,patch:yC,combine:vC,diff:(e,t)=>{if(k(e,t))return _C;let n=SC(e),r=SC(t);return vC(x(r,qs(n),Ys(_C,(e,t)=>vC(e,{_tag:mC,supervisor:t}))),x(n,qs(r),Ys(_C,(e,t)=>vC(e,{_tag:hC,supervisor:t}))))}}),wC=ZS(`effect_fiber_started`,{incremental:!0}),TC=ZS(`effect_fiber_active`),EC=ZS(`effect_fiber_successes`,{incremental:!0}),DC=ZS(`effect_fiber_failures`,{incremental:!0}),OC=eC($S(`effect_fiber_lifetimes`,yx({start:.5,factor:2,count:35})),`time_unit`,`milliseconds`),kC=`Continue`,AC=`Done`,jC=`Yield`,MC={_E:e=>e,_A:e=>e},NC=e=>{throw Error(`BUG: FiberRuntime - ${Pn(e)} - please report an issue at https://github.com/Effect-TS/effect/issues`)},PC=Symbol.for(`effect/internal/fiberRuntime/YieldedOp`),FC=S(`effect/internal/fiberRuntime/yieldedOpChannel`,()=>({currentOp:null})),IC={[Gn]:(e,t,n)=>mn(()=>t.effect_instruction_i1(n)),OnStep:(e,t,n)=>Vh(Vh(n)),[Kn]:(e,t,n)=>mn(()=>t.effect_instruction_i2(n)),[er]:(e,t,n)=>(e.patchRuntimeFlags(e.currentRuntimeFlags,t.patch),jf(e.currentRuntimeFlags)&&e.isInterrupted()?Ph(e.getInterruptedCause()):Vh(n)),[Xn]:(e,t,n)=>(mn(()=>t.effect_instruction_i2(n)),mn(()=>t.effect_instruction_i0())?(e.pushStack(t),mn(()=>t.effect_instruction_i1())):mm),[Zn]:(e,t,n)=>{for(;;){let r=mn(()=>t.effect_instruction_i0.next(n));if(r.done)return Vh(r.value);let i=dn(r.value);if(!Dh(i))return e.pushStack(t),i;if(i._tag===`Failure`)return i;n=i.value}}},LC={[Hb]:(e,t,n,r)=>(e.processNewInterruptSignal(r.cause),jf(t)?Ph(r.cause):n),[Wb]:(e,t,n,r)=>{throw Error(`It is illegal to have multiple concurrent run loops in a single fiber`)},[Ub]:(e,t,n,r)=>(r.onFiber(e,Pv(t)),n),[Gb]:(e,t,n,r)=>I(xm(),()=>n)},RC=e=>$p(Kf(e),e=>$C(up(e),([e,t])=>{let n=new Map,r=[];for(let e of t){r.push(no(e));for(let t of e)n.set(t.request,t)}let i=r.flat();return Hm(Sw(e.runAll(r),i,()=>i.forEach(e=>{e.listeners.interrupted=!0})),mb,n)},!1,!1)),zC=nr(),BC=class extends P_{[tx]=nx;[ix]=MC;_fiberRefs;_fiberId;_queue=[];_children=null;_observers=[];_running=!1;_stack=[];_asyncInterruptor=null;_asyncBlockingOn=null;_exitValue=null;_steps=[];_isYielding=!1;currentRuntimeFlags;currentOpCount=0;currentSupervisor;currentScheduler;currentTracer;currentSpan;currentContext;currentDefaultServices;constructor(e,t,n){if(super(),this.currentRuntimeFlags=n,this._fiberId=e,this._fiberRefs=t,If(n)){let e=this.getFiberRef(oh);wC.unsafeUpdate(1,e),TC.unsafeUpdate(1,e)}this.refreshRefCache()}commit(){return ax(this)}id(){return this._fiberId}resume(e){this.tell(Jb(e))}get status(){return this.ask((e,t)=>t)}get runtimeFlags(){return this.ask((e,t)=>Iv(t)?e.currentRuntimeFlags:t.runtimeFlags)}scope(){return $b(this)}get children(){return this.ask(e=>Array.from(e.getChildren()))}getChildren(){return this._children===null&&(this._children=new Set),this._children}getInterruptedCause(){return this.getFiberRef(ch)}fiberRefs(){return this.ask(e=>e.getFiberRefs())}ask(e){return R(()=>{let t=Gh(this._fiberId);return this.tell(qb((n,r)=>{Qh(t,z(()=>e(n,r)))})),Jh(t)})}tell(e){this._queue.push(e),this._running||(this._running=!0,this.drainQueueLaterOnExecutor())}get await(){return Np(e=>{let t=t=>e(L(t));if(this._exitValue!==null){t(this._exitValue);return}return this.tell(qb((e,n)=>{e._exitValue===null?e.addObserver(t):t(this._exitValue)})),z(()=>this.tell(qb((e,n)=>{e.removeObserver(t)})))},this.id())}get inheritAll(){return Ep((e,t)=>{let n=e.id(),r=e.getFiberRefs(),i=t.runtimeFlags,a=Z_(r,n,this.getFiberRefs());return e.setFiberRefs(a),hm(x(Rf(i,e.getFiberRef(yw)),Uf(1),Uf(16)))})}get poll(){return z(()=>si(this._exitValue))}unsafePoll(){return this._exitValue}interruptAsFork(e){return z(()=>this.tell(Kb(cc(e))))}unsafeInterruptAsFork(e){this.tell(Kb(cc(e)))}addObserver(e){this._exitValue===null?this._observers.push(e):e(this._exitValue)}removeObserver(e){this._observers=this._observers.filter(t=>t!==e)}getFiberRefs(){return this.setFiberRef(yw,this.currentRuntimeFlags),this._fiberRefs}unsafeDeleteFiberRef(e){this._fiberRefs=ev(this._fiberRefs,e)}getFiberRef(e){return this._fiberRefs.locals.has(e)?this._fiberRefs.locals.get(e)[0][1]:e.initial}setFiberRef(e,t){this._fiberRefs=rv(this._fiberRefs,{fiberId:this._fiberId,fiberRef:e,value:t}),this.refreshRefCache()}refreshRefCache(){this.currentDefaultServices=this.getFiberRef(k_),this.currentTracer=this.currentDefaultServices.unsafeMap.get(S_.key),this.currentSupervisor=this.getFiberRef(bw),this.currentScheduler=this.getFiberRef(pb),this.currentContext=this.getFiberRef(Ym),this.currentSpan=this.currentContext.unsafeMap.get(C_.key)}setFiberRefs(e){this._fiberRefs=e,this.refreshRefCache()}addChild(e){this.getChildren().add(e)}removeChild(e){this.getChildren().delete(e)}transferChildren(e){let t=this._children;if(this._children=null,t!==null&&t.size>0)for(let n of t)n._exitValue===null&&e.add(this.currentRuntimeFlags,n)}drainQueueOnCurrentThread(){let e=!0;for(;e;){let t=kC,n=globalThis[ox];globalThis[ox]=this;try{for(;t===kC;)t=this._queue.length===0?AC:this.evaluateMessageWhileSuspended(this._queue.splice(0,1)[0])}finally{this._running=!1,globalThis[ox]=n}this._queue.length>0&&!this._running?(this._running=!0,t===jC?(this.drainQueueLaterOnExecutor(),e=!1):e=!0):e=!1}}drainQueueLaterOnExecutor(){this.currentScheduler.scheduleTask(this.run,this.getFiberRef(Xm),this)}drainQueueWhileRunning(e,t){let n=t;for(;this._queue.length>0;){let t=this._queue.splice(0,1)[0];n=LC[t._tag](this,e,n,t)}return n}isInterrupted(){return!mc(this.getFiberRef(ch))}addInterruptedCause(e){let t=this.getFiberRef(ch);this.setFiberRef(ch,uc(t,e))}processNewInterruptSignal(e){this.addInterruptedCause(e),this.sendInterruptSignalToAllChildren()}sendInterruptSignalToAllChildren(){if(this._children===null||this._children.size===0)return!1;let e=!1;for(let t of this._children)t.tell(Kb(cc(this.id()))),e=!0;return e}interruptAllChildren(){if(this.sendInterruptSignalToAllChildren()){let e=this._children.values();this._children=null;let t=!1;return _m({while:()=>!t,body:()=>{let n=e.next();return n.done?z(()=>{t=!0}):kp(n.value.await)},step:()=>{}})}return null}reportExitValue(e){if(If(this.currentRuntimeFlags)){let t=this.getFiberRef(oh),n=this.id().startTimeMillis,r=Date.now();switch(OC.unsafeUpdate(r-n,t),TC.unsafeUpdate(-1,t),e._tag){case qn:EC.unsafeUpdate(1,t);break;case Un:DC.unsafeUpdate(1,t);break}}if(e._tag===`Failure`){let t=this.getFiberRef(ih);!gc(e.cause)&&t._tag===`Some`&&this.log(`Fiber terminated with an unhandled error`,e.cause,t)}}setExitValue(e){this._exitValue=e,this.reportExitValue(e);for(let t=this._observers.length-1;t>=0;t--)this._observers[t](e);this._observers=[]}getLoggers(){return this.getFiberRef(GC)}log(e,t,n){let r=ti(n)?n.value:this.getFiberRef($m);if(Gv(this.getFiberRef(VC),r))return;let i=this.getFiberRef(eh),a=this.getFiberRef(Qm),o=this.getLoggers(),s=this.getFiberRefs();if(Ws(o)>0){let n=Sl(this.getFiberRef(k_),Cg),c=new Date(n.unsafeCurrentTimeMillis());zn(s,()=>{for(let n of o)n.log({fiberId:this.id(),logLevel:r,message:e,cause:t,context:s,spans:i,annotations:a,date:c})})}}evaluateMessageWhileSuspended(e){switch(e._tag){case Gb:return jC;case Hb:return this.processNewInterruptSignal(e.cause),this._asyncInterruptor!==null&&(this._asyncInterruptor(Ph(e.cause)),this._asyncInterruptor=null),kC;case Wb:return this._asyncInterruptor=null,this._asyncBlockingOn=null,this.evaluateEffect(e.effect),kC;case Ub:return e.onFiber(this,this._exitValue===null?Fv(this.currentRuntimeFlags,this._asyncBlockingOn):Nv),kC;default:return NC(e)}}evaluateEffect(e){this.currentSupervisor.onResume(this);try{let t=jf(this.currentRuntimeFlags)&&this.isInterrupted()?Ph(this.getInterruptedCause()):e;for(;t!==null;){let e=t,n=this.runLoop(e);if(n===PC){let e=FC.currentOp;FC.currentOp=null,e._op===`Yield`?kf(this.currentRuntimeFlags)?(this.tell(Yb()),this.tell(Jb(Hh)),t=null):t=Hh:e._op===`Async`&&(t=null)}else{this.currentRuntimeFlags=x(this.currentRuntimeFlags,Af(16));let e=this.interruptAllChildren();e===null?(this._queue.length===0?this.setExitValue(n):this.tell(Jb(n)),t=null):t=I(e,()=>n)}}}finally{this.currentSupervisor.onSuspend(this)}}start(e){if(this._running)this.tell(Jb(e));else{this._running=!0;let t=globalThis[ox];globalThis[ox]=this;try{this.evaluateEffect(e)}finally{this._running=!1,globalThis[ox]=t,this._queue.length>0&&this.drainQueueLaterOnExecutor()}}}startFork(e){this.tell(Jb(e))}patchRuntimeFlags(e,t){let n=zf(e,t);return globalThis[ox]=this,this.currentRuntimeFlags=n,n}initiateAsync(e,t){let n=!1,r=e=>{n||(n=!0,this.tell(Jb(e)))};jf(e)&&(this._asyncInterruptor=r);try{t(r)}catch(e){r(Up(sc(e)))}}pushStack(e){this._stack.push(e),e._op===`OnStep`&&this._steps.push({refs:this.getFiberRefs(),flags:this.currentRuntimeFlags})}popStack(){let e=this._stack.pop();if(e)return e._op===`OnStep`&&this._steps.pop(),e}getNextSuccessCont(){let e=this.popStack();for(;e;){if(e._op!==`OnFailure`)return e;e=this.popStack()}}getNextFailCont(){let e=this.popStack();for(;e;){if(e._op!==`OnSuccess`&&e._op!==`While`&&e._op!==`Iterator`)return e;e=this.popStack()}}Tag(e){return z(()=>Cl(this.currentContext,e))}Left(e){return Vp(e.left)}None(e){return Vp(new wh)}Right(e){return Vh(e.right)}Some(e){return Vh(e.value)}Micro(e){return jp(t=>{let n=t,r=Jy(zy(e,this.currentContext));return r.addObserver(e=>{if(e._tag===`Success`)return n(Vh(e.value));switch(e.cause._tag){case`Interrupt`:return n(Ph(cc(Lu)));case`Fail`:return n(Vp(e.cause.error));case`Die`:return n(Lp(e.cause.defect))}}),jp(e=>{n=t=>{e(mm)},r.unsafeInterrupt()})})}[Jn](e){let t=mn(()=>e.effect_instruction_i0()),n=this.getNextSuccessCont();return n===void 0?(FC.currentOp=Vh(t),PC):(n._op in IC||NC(n),IC[n._op](this,n,t))}[qn](e){let t=e,n=this.getNextSuccessCont();return n===void 0?(FC.currentOp=t,PC):(n._op in IC||NC(n),IC[n._op](this,n,t.effect_instruction_i0))}[Un](e){let t=e.effect_instruction_i0,n=this.getNextFailCont();if(n!==void 0)switch(n._op){case Wn:case Kn:return jf(this.currentRuntimeFlags)&&this.isInterrupted()?Ph(wc(t)):mn(()=>n.effect_instruction_i1(t));case`OnStep`:return jf(this.currentRuntimeFlags)&&this.isInterrupted()?Ph(wc(t)):Vh(Ph(t));case er:return this.patchRuntimeFlags(this.currentRuntimeFlags,n.patch),jf(this.currentRuntimeFlags)&&this.isInterrupted()?Ph(uc(t,this.getInterruptedCause())):Ph(t);default:NC(n)}else return FC.currentOp=Ph(t),PC}[Qn](e){return mn(()=>e.effect_instruction_i0(this,Pv(this.currentRuntimeFlags)))}Blocked(e){let t=this.getFiberRefs(),n=this.currentRuntimeFlags;if(this._steps.length>0){let r=[],i=this._steps[this._steps.length-1],a=this.popStack();for(;a&&a._op!==`OnStep`;)r.push(a),a=this.popStack();this.setFiberRefs(i.refs),this.currentRuntimeFlags=i.flags;let o=_v(i.refs,t),s=Rf(i.flags,n);return Vh(vp(e.effect_instruction_i0,Ep(t=>{for(;r.length>0;)t.pushStack(r.pop());return t.setFiberRefs(vv(t.id(),t.getFiberRefs())(o)),t.currentRuntimeFlags=zf(s)(t.currentRuntimeFlags),e.effect_instruction_i1})))}return pm(t=>I(tw(yp(e.effect_instruction_i0)),()=>t(e.effect_instruction_i1)))}RunBlocked(e){return RC(e.effect_instruction_i0)}[Yn](e){let t=e.effect_instruction_i0,n=this.currentRuntimeFlags,r=zf(n,t);if(jf(r)&&this.isInterrupted())return Ph(this.getInterruptedCause());if(this.patchRuntimeFlags(this.currentRuntimeFlags,t),e.effect_instruction_i1){let t=Rf(r,n);return this.pushStack(new xp(t,e)),mn(()=>e.effect_instruction_i1(n))}else return Hh}[Gn](e){return this.pushStack(e),e.effect_instruction_i0}OnStep(e){return this.pushStack(e),e.effect_instruction_i0}[Wn](e){return this.pushStack(e),e.effect_instruction_i0}[Kn](e){return this.pushStack(e),e.effect_instruction_i0}[Vn](e){return this._asyncBlockingOn=e.effect_instruction_i1,this.initiateAsync(this.currentRuntimeFlags,e.effect_instruction_i0),FC.currentOp=e,PC}[$n](e){return this._isYielding=!1,FC.currentOp=e,PC}[Xn](e){let t=e.effect_instruction_i0,n=e.effect_instruction_i1;return t()?(this.pushStack(e),n()):Hh}[Zn](e){return IC[Zn](this,e,void 0)}[Hn](e){return mn(()=>e.commit())}runLoop(e){let t=e;for(this.currentOpCount=0;;){if(this.currentRuntimeFlags&2&&this.currentSupervisor.onEffect(this,t),this._queue.length>0&&(t=this.drainQueueWhileRunning(this.currentRuntimeFlags,t)),!this._isYielding){this.currentOpCount+=1;let e=this.currentScheduler.shouldYield(this);if(e!==!1){this._isYielding=!0,this.currentOpCount=0;let n=t;t=I(xm({priority:e}),()=>n)}}try{if(t=this.currentTracer.context(()=>{if(zC!==t[bp]._V){let e=this.getFiberRef(ah);if(e._tag===`Some`){let n=t[bp]._V;this.log(`Executing an Effect versioned ${n} with a Runtime of version ${nr()}, 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`,ac,e)}}return this[t._op](t)},this),t===PC){let e=FC.currentOp;return e._op===`Yield`||e._op===`Async`?PC:(FC.currentOp=null,e._op===`Success`||e._op===`Failure`?e:Ph(sc(e)))}}catch(e){t=t!==PC&&!C(t,`_op`)||!(t._op in this)?Rp(`Not a valid effect: ${Pn(t)}`):bh(e)?Ph(uc(sc(e),cc(Lu))):Lp(e)}}}run=()=>{this.drainQueueOnCurrentThread()}},VC=S(`effect/FiberRef/currentMinimumLogLevel`,()=>Um(Kv(`Info`))),HC=e=>lx(t=>{Sl(ov(t.context,k_),f_).unsafe.log(e.log(t))}),UC=S(Symbol.for(`effect/Logger/defaultLogger`),()=>HC(dx)),WC=S(Symbol.for(`effect/Logger/tracerLogger`),()=>lx(({annotations:e,cause:t,context:n,fiberId:r,logLevel:i,message:a})=>{let o=zb(wl(nv(n,Ym),C_));if(o._tag===`None`||o.value._tag===`ExternalSpan`)return;let s=Cl(nv(n,k_),Cg),c={};for(let[t,n]of e)c[t]=n;c[`effect.fiberId`]=Vu(r),c[`effect.logLevel`]=i.label,t!==null&&t._tag!==`Empty`&&(c[`effect.cause`]=Lc(t,{renderErrorCause:!0})),o.value.event(Pn(Array.isArray(a)&&a.length===1?a[0]:a),s.unsafeCurrentTimeNanos(),c)})),GC=S(Symbol.for(`effect/FiberRef/currentLoggers`),()=>Wm(Vs(UC,WC))),KC=(e,t,n)=>{let r=e.next();return r.done?L(!1):I(n(r.value,t),r=>r?L(r):KC(e,t+1,n))},qC=e=>{if(Array.isArray(e)||Jt(e))return[e,P()];let t=Object.keys(e),n=t.length;return[t.map(t=>e[t]),F(e=>{let r={};for(let i=0;i<n;i++)r[t[i]]=e[i];return r})]},JC=(e,t,n)=>{let r=[];for(let t of e)r.push(zp(t));return I(ZC(r,b,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),e=>{let r=P(),i=e.length,a=Array(i),o=Array(i),s=!1;for(let t=0;t<i;t++){let n=e[t];n._tag===`Left`?(a[t]=F(n.left),s=!0):(o[t]=n.right,a[t]=r)}return s?t._tag===`Some`?Vp(t.value(a)):Vp(a):n?.discard?mm:t._tag===`Some`?L(t.value(o)):L(o)})},YC=(e,t,n)=>{let r=[];for(let t of e)r.push(zp(t));return n?.discard?ZC(r,b,{concurrency:n?.concurrency,batching:n?.batching,discard:!0,concurrentFinalizers:n?.concurrentFinalizers}):tm(ZC(r,b,{concurrency:n?.concurrency,batching:n?.batching,concurrentFinalizers:n?.concurrentFinalizers}),e=>t._tag===`Some`?t.value(e):e)},XC=(e,t)=>{let[n,r]=qC(e);return t?.mode===`validate`?JC(n,r,t):t?.mode===`either`?YC(n,r,t):t?.discard!==!0&&r._tag===`Some`?tm(ZC(n,b,t),r.value):ZC(n,b,t)},ZC=y(e=>Jt(e[0]),(e,t,n)=>Ep(r=>{let i=n?.batching===!0||n?.batching===`inherit`&&r.getFiberRef(rh);return n?.discard?hb(n.concurrency,()=>cw(U_,n?.concurrentFinalizers)(n=>i?$C(e,(e,r)=>n(t(e,r)),!0,!1,1):$p(e,(e,r)=>n(t(e,r)))),()=>cw(W_,n?.concurrentFinalizers)(n=>$C(e,(e,r)=>n(t(e,r)),i,!1)),r=>cw(G_(r),n?.concurrentFinalizers)(n=>$C(e,(e,r)=>n(t(e,r)),i,!1,r))):hb(n?.concurrency,()=>cw(U_,n?.concurrentFinalizers)(n=>i?ew(e,1,(e,r)=>n(t(e,r)),!0):Qp(e,(e,r)=>n(t(e,r)))),()=>cw(W_,n?.concurrentFinalizers)(n=>QC(e,(e,r)=>n(t(e,r)),i)),r=>cw(G_(r),n?.concurrentFinalizers)(n=>ew(e,r,(e,r)=>n(t(e,r)),i)))})),QC=(e,t,n)=>R(()=>{let r=Di(e),i=Array(r.length);return wm($C(r,(e,n)=>I(t(e,n),e=>z(()=>i[n]=e)),n,!1),L(i))}),$C=(e,t,n,r,i)=>pm(a=>um(o=>Ep(s=>{let c=Array.from(e).reverse(),l=c.length;if(l===0)return mm;let u=0,d=!1,f=i?Math.min(c.length,i):c.length,p=new Set,m=[],h=()=>p.forEach(e=>{e.currentScheduler.scheduleTask(()=>{e.unsafeInterruptAsFork(s.id())},0,e)}),g=[],_=[],v=[],ee=()=>{let e=m.filter(({exit:e})=>e._tag===`Failure`).sort((e,t)=>e.index<t.index?-1:e.index===t.index?0:1).map(({exit:e})=>e);return e.length===0&&e.push(Hh),e},te=(e,t=!1)=>{let n=fm(o(e)),r=rw(n,s,s.currentRuntimeFlags,ex);return s.currentScheduler.scheduleTask(()=>{t&&r.unsafeInterruptAsFork(s.id()),r.resume(n)},0,r),r},ne=()=>{r||(l-=c.length,c=[]),d=!0,h()},re=n?qp:Bp,ie=te(Np(e=>{let r=(e,t)=>{e._op===`Blocked`?v.push(e):(m.push({index:t,exit:e}),e._op===`Failure`&&!d&&ne())},o=()=>{if(c.length>0){let f=c.pop(),h=u++,ne=()=>{let e=c.pop();return h=u++,I(xm(),()=>I(re(a(t(e,h))),ie))},ie=e=>c.length>0&&(r(e,h),c.length>0)?ne():L(e),ae=te(I(re(a(t(f,h))),ie));g.push(ae),p.add(ae),d&&ae.currentScheduler.scheduleTask(()=>{ae.unsafeInterruptAsFork(s.id())},0,ae),ae.addObserver(t=>{let a;if(a=t._op===`Failure`?t:t.effect_instruction_i0,_.push(ae),p.delete(ae),r(a,h),m.length===l)e(L(ii(jh(ee(),{parallel:!0}),()=>Hh)));else if(v.length+m.length===l){let t=ee();e(L(vp(v.map(e=>e.effect_instruction_i0).reduce(Wf),$C([ii(jh(t,{parallel:!0}),()=>Hh),...v.map(e=>e.effect_instruction_i1)],e=>e,n,!0,i))))}else o()})}};for(let e=0;e<f;e++)o()}));return kp(im(Jp(a(ax(ie))),zh({onFailure:e=>{ne();let t=v.length+1,n=Math.min(typeof i==`number`?i:v.length,v.length),r=Array.from(v);return Np(i=>{let a=[],o=0,s=0,c=(n,s)=>c=>{a[n]=c,o++,o===t&&i(Vh(Ph(e))),r.length>0&&s&&l()},l=()=>{te(r.pop(),!0).addObserver(c(s,!0)),s++};ie.addObserver(c(s,!1)),s++;for(let e=0;e<n;e++)l()})},onSuccess:()=>Qp(_,e=>e.inheritAll)})))}))),ew=(e,t,n,r)=>R(()=>{let i=Di(e),a=Array(i.length);return wm($C(i,(e,t)=>tm(n(e,t),e=>a[t]=e),r,!1,t),L(a))}),tw=e=>aw(e,ex),nw=(e,t,n,r=null)=>{let i=iw(e,t,n,r);return i.resume(e),i},rw=(e,t,n,r=null)=>iw(e,t,n,r),iw=(e,t,n,r=null)=>{let i=Hu(),a=Q_(t.getFiberRefs(),i),o=new BC(i,a,n),s=nv(a,Ym),c=o.currentSupervisor;return c.onStart(s,e,F(t),o),o.addObserver(e=>c.onEnd(e,o)),(r===null?x(t.getFiberRef(sh),ii(()=>t.scope())):r).add(n,o),o},aw=(e,t)=>Ep((n,r)=>L(nw(e,n,r.runtimeFlags,t))),ow=e=>ng(t=>ni(wl(t,fw),{onNone:()=>e,onSome:t=>{switch(t.strategy._tag){case`Parallel`:return e;case`Sequential`:case`ParallelN`:return I(mh(t,W_),t=>_w(e,t))}}})),sw=e=>t=>ng(n=>ni(wl(n,fw),{onNone:()=>t,onSome:n=>n.strategy._tag===`ParallelN`&&n.strategy.parallelism===e?t:I(mh(n,G_(e)),e=>_w(t,e))})),cw=(e,t)=>n=>ng(r=>ni(wl(r,fw),{onNone:()=>n(b),onSome:r=>{if(t===!0){let t=e._tag===`Parallel`?ow:e._tag===`Sequential`?uw:sw(e.parallelism);switch(r.strategy._tag){case`Parallel`:return t(n(ow));case`Sequential`:return t(n(uw));case`ParallelN`:return t(n(sw(r.strategy.parallelism)))}}else return n(b)}})),lw=e=>I(fw,e),uw=e=>ng(t=>ni(wl(t,fw),{onNone:()=>e,onSome:t=>{switch(t.strategy._tag){case`Sequential`:return e;case`Parallel`:case`ParallelN`:return I(mh(t,U_),t=>_w(e,t))}}})),dw=y(e=>Tp(e[1]),(e,t,n,r)=>tm(XC([e,t],{concurrency:r?.concurrent?2:1,batching:r?.batching,concurrentFinalizers:r?.concurrentFinalizers}),([e,t])=>n(e,t))),fw=vl(`effect/Scope`),pw=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.set({},t)},mw={[lh]:lh,[uh]:uh,pipe(){return j(this,arguments)},fork(e){return z(()=>{let t=hw(e);if(this.state._tag===`Closed`)return t.state=this.state,t;let n={};return this.state.finalizers.set(n,e=>t.close(e)),pw(t,e=>z(()=>{this.state._tag===`Open`&&this.state.finalizers.delete(n)})),t})},close(e){return R(()=>{if(this.state._tag===`Closed`)return mm;let t=Array.from(this.state.finalizers.values()).reverse();return this.state={_tag:`Closed`,exit:e},t.length===0?mm:V_(this.strategy)?x(Qp(t,t=>Bp(t(e))),I(e=>x(jh(e),fi(Ah),ii(()=>Hh)))):H_(this.strategy)?x(QC(t,t=>Bp(t(e)),!1),I(e=>x(jh(e,{parallel:!0}),fi(Ah),ii(()=>Hh)))):x(ew(t,this.strategy.parallelism,t=>Bp(t(e)),!1),I(e=>x(jh(e,{parallel:!0}),fi(Ah),ii(()=>Hh))))})},addFinalizer(e){return R(()=>this.state._tag===`Closed`?e(this.state.exit):(this.state.finalizers.set({},e),mm))}},hw=(e=R_)=>{let t=Object.create(mw);return t.strategy=e,t.state={_tag:`Open`,finalizers:new Map},t},gw=(e=R_)=>z(()=>hw(e)),_w=y(2,(e,t)=>ig(e,Tl(bl(fw,t)))),vw=e=>qm(e,{differ:CC,fork:_C}),yw=Jm(Ff),bw=vw(dC),xw=y(2,(e,t)=>pm(n=>Xp(n(e),{onFailure:e=>Xp(t,{onFailure:t=>Up(uc(e,t)),onSuccess:()=>Up(e)}),onSuccess:e=>Op(t,e)}))),Sw=(e,t,n)=>Kp(r=>I(I(tw(em(e)),e=>Np(r=>{let i=t.map(e=>e.listeners.count),a=()=>{i.every(e=>e===0)&&t.every(e=>e.result.state.current._tag===`Pending`?!0:!!(e.result.state.current._tag===`Done`&&Dh(e.result.state.current.effect)&&e.result.state.current.effect._tag===`Failure`&&hc(e.result.state.current.effect.cause)))&&(o.forEach(e=>e()),n?.(),r(Em(e)))};e.addObserver(e=>{o.forEach(e=>e()),r(e)});let o=t.map((e,t)=>{let n=e=>{i[t]=e,a()};return e.listeners.addObserver(n),()=>e.listeners.removeObserver(n)});return a(),z(()=>{o.forEach(e=>e())})})),()=>R(()=>$p(t.flatMap(e=>e.state.completed?[]:[e]),e=>rC(e.request,Lh(r)))))),Cw=Symbol.for(`effect/ScheduleInterval`),ww={[Cw]:Cw,startMillis:0,endMillis:0},Tw=e=>x(e.intervals,ho,ii(()=>ww)).startMillis,Ew=e=>x(e.intervals,ho,ii(()=>ww)).endMillis,Dw=y(2,(e,t)=>Tw(e)<Tw(t)),Ow=e=>mo(e.intervals),kw=Ew,Aw=Dw,jw=Ow,Mw=`Continue`,Nw=`Done`,Pw=e=>({_tag:Mw,intervals:e}),Fw={_tag:Nw},Iw=e=>e._tag===Nw,Lw=Pw,Rw=Fw,zw=Iw,Bw=ph,Vw=mh,Hw=class{permits;waiters=new Set;taken=0;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take=e=>Mp(t=>{if(this.free<e){let n=()=>{this.free<e||(this.waiters.delete(n),t(R(()=>this.free<e?this.take(e):(this.taken+=e,L(e)))))};return this.waiters.add(n),z(()=>{this.waiters.delete(n)})}t(R(()=>this.free<e?this.take(e):(this.taken+=e,L(e))))});updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.getFiberRef(pb).scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},e.getFiberRef(Xm),e),L(this.free)}updateTaken(e){return Ep(t=>this.updateTakenUnsafe(t,e))}resize=e=>kp(Ep(t=>(this.permits=e,this.free<0?mm:this.updateTakenUnsafe(t,e=>e))));release=e=>this.updateTaken(t=>t-e);releaseAll=this.updateTaken(e=>0);withPermits=e=>t=>pm(n=>I(n(this.take(e)),e=>xw(n(t),this.release(e))));withPermitsIfAvailable=e=>t=>pm(n=>R(()=>this.free<e?Ib:(this.taken+=e,xw(n(Cb(t)),this.release(e)))))},Uw=e=>new Hw(e),Ww=Symbol.for(`effect/Ref/SynchronizedRef`),Gw={_A:e=>e},Kw=class extends P_{ref;withLock;[Ww]=Gw;[$y]=eb;[Qy]=Qy;constructor(e,t){super(),this.ref=e,this.withLock=t,this.get=ib(this.ref)}get;commit(){return this.get}modify(e){return this.modifyEffect(t=>L(e(t)))}modifyEffect(e){return this.withLock(x(I(ib(this.ref),e),I(([e,t])=>Op(ab(this.ref,t),e))))}},qw=e=>z(()=>Jw(e)),Jw=e=>new Kw(nb(e),Uw(1).withPermits(1)),Yw=`Fresh`,Xw=Dm,Zw=e=>function(){if(arguments.length===1){let t=arguments[0];return(n,...r)=>e(t,n,...r)}return e.apply(this,arguments)},Qw=Zw((e,t,n)=>{let r=Hu(),i=[[Ym,[[r,e.context]]]];n?.scheduler&&i.push([pb,[[r,n.scheduler]]]);let a=sv(e.fiberRefs,{entries:i,forkAs:r});n?.updateRefs&&(a=n.updateRefs(a,r));let o=new BC(r,a,e.runtimeFlags),s=t;n?.scope&&(s=I(Vw(n.scope,R_),e=>wm(dh(e,Kp(e=>k(e,o.id())?mm:Dm(o,e))),im(t,t=>Bw(e,t)))));let c=o.currentSupervisor;return c!==dC&&(c.onStart(e.context,s,P(),o),o.addObserver(e=>c.onEnd(e,o))),ex.add(e.runtimeFlags,o),n?.immediate===!1?o.resume(s):o.start(s),o}),$w=Zw((e,t,n={})=>{let r=Qw(e,t,n);return n.onExit&&r.addObserver(e=>{n.onExit(e)}),(t,n)=>$w(e)(x(r,Xw(t??Lu)),{...n,onExit:n?.onExit?e=>n.onExit(Vb(e)):void 0})}),eT=Zw((e,t)=>{let n=cT(e)(t);if(n._tag===`Failure`)throw oT(n.effect_instruction_i0);return n.effect_instruction_i0}),tT=class extends Error{fiber;_tag=`AsyncFiberException`;constructor(e){super(`Fiber #${e.id().id} cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work`),this.fiber=e,this.name=this._tag,this.stack=this.message}},nT=e=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=0;let n=new tT(e);return Error.stackTraceLimit=t,n},rT=Symbol.for(`effect/Runtime/FiberFailure`),iT=Symbol.for(`effect/Runtime/FiberFailure/Cause`),aT=class extends Error{[rT];[iT];constructor(e){let t=Gc(e)[0];super(t?.message||`An error has occurred`),this[rT]=rT,this[iT]=e,this.name=t?`(FiberFailure) ${t.name}`:`FiberFailure`,t?.stack&&(this.stack=t.stack)}toJSON(){return{_id:`FiberFailure`,cause:this[iT].toJSON()}}toString(){return`(FiberFailure) `+Lc(this[iT],{renderErrorCause:!0})}[A](){return this.toString()}},oT=e=>{let t=Error.stackTraceLimit;Error.stackTraceLimit=0;let n=new aT(e);return Error.stackTraceLimit=t,n},sT=e=>{let t=e;switch(t._op){case`Failure`:case`Success`:return t;case`Left`:return Nh(t.left);case`Right`:return Vh(t.right);case`Some`:return Vh(t.value);case`None`:return Nh(new wh)}},cT=Zw((e,t)=>{let n=sT(t);if(n)return n;let r=new fb,i=Qw(e)(t,{scheduler:r});return r.flush(),i.unsafePoll()||Mh(Ip(nT(i),ag(i)))}),lT=class{context;runtimeFlags;fiberRefs;constructor(e,t,n){this.context=e,this.runtimeFlags=t,this.fiberRefs=n}pipe(){return j(this,arguments)}},uT=(e=>new lT(e.context,e.runtimeFlags,e.fiberRefs))({context:yl(),runtimeFlags:Pf(1,32,4),fiberRefs:cv()}),dT=Qw(uT),fT=eT(uT),pT=y(2,(e,t)=>e.modifyEffect(t)),mT=Symbol.for(`effect/Layer/MemoMap`),hT=Ol()(`effect/Layer/CurrentMemoMap`,{defaultValue:()=>yT()}),gT=e=>e._op_layer===Yw,_T=class{ref;[mT];constructor(e){this.ref=e,this[mT]=mT}getOrElseMemoize(e,t){return x(pT(this.ref,n=>{let r=n.get(e);if(r!==void 0){let[e,i]=r;return L([x(e,I(([e,t])=>x(Mb(e),Op(t))),im(zh({onFailure:()=>mm,onSuccess:()=>fh(t,i)}))),n])}return x(rb(0),I(r=>x(Kh(),I(i=>x(rb(()=>mm),tm(a=>{let o=pm(o=>x(gw(),I(s=>x(o(I(ST(e,s,!0),e=>wb(e(this)))),Bp,I(o=>{switch(o._tag){case Un:return x(Xh(i,o.effect_instruction_i0),wm(ph(s,o)),wm(Up(o.effect_instruction_i0)));case qn:return x(ab(a,e=>x(ph(s,e),gm(ob(r,e=>[e===1,e-1])),kp)),wm(sb(r,e=>e+1)),wm(fh(t,t=>x(z(()=>n.delete(e)),wm(ib(a)),I(e=>e(t))))),wm(Zh(i,o.effect_instruction_i0)),Op(o.effect_instruction_i0[1]))}}))))),s=[x(Jh(i),im(Bh({onFailure:()=>mm,onSuccess:()=>sb(r,e=>e+1)}))),e=>x(ib(a),I(t=>t(e)))];return[o,gT(e)?n:n.set(e,s)]}))))))}),Jp)}},vT=R(()=>tm(qw(new Map),e=>new _T(e))),yT=()=>new _T(Jw(new Map)),bT=y(2,(e,t)=>I(vT,n=>xT(e,n,t))),xT=y(3,(e,t,n)=>I(ST(e,n),e=>Nb(e(t),hT,t))),ST=(e,t,n=!1)=>{let r=e;switch(r._op_layer){case`Locally`:return z(()=>e=>r.f(e.getOrElseMemoize(r.self,t)));case`ExtendScope`:return z(()=>e=>lw(t=>e.getOrElseMemoize(r.layer,t)));case`Fold`:return z(()=>e=>x(e.getOrElseMemoize(r.layer,t),Xp({onFailure:n=>e.getOrElseMemoize(r.failureK(n),t),onSuccess:n=>e.getOrElseMemoize(r.successK(n),t)})));case`Fresh`:return z(()=>e=>x(r.layer,bT(t)));case`FromEffect`:return z(n?()=>e=>r.effect:()=>n=>n.getOrElseMemoize(e,t));case`Provide`:return z(()=>e=>x(e.getOrElseMemoize(r.first,t),I(n=>x(e.getOrElseMemoize(r.second,t),rg(n)))));case`Scoped`:return z(n?()=>e=>_w(r.effect,t):()=>n=>n.getOrElseMemoize(e,t));case`Suspend`:return z(()=>e=>e.getOrElseMemoize(r.evaluate(),t));case`ProvideMerge`:return z(()=>e=>x(e.getOrElseMemoize(r.first,t),Tm(e.getOrElseMemoize(r.second,t),r.zipK)));case`ZipWith`:return ym(function*(){let e=yield*mh(t,z_),n=yield*mh(e,R_),i=yield*mh(e,R_);return e=>x(e.getOrElseMemoize(r.first,n),dw(e.getOrElseMemoize(r.second,i),r.zipK,{concurrent:!0}))});case`MergeAll`:{let e=r.layers;return tm(mh(t,z_),t=>n=>{let r=Array(e.length);return tm($C(e,bm(function*(e,i){let a=yield*mh(t,R_);r[i]=yield*n.getOrElseMemoize(e,a)}),!1,!1),()=>El(...r))})}}},CT=Symbol.for(`effect/DateTime`),wT=Symbol.for(`effect/DateTime/TimeZone`),TT={[CT]:CT,pipe(){return j(this,arguments)},[A](){return this.toString()},toJSON(){return iE(this).toJSON()}},ET={...TT,_tag:`Utc`,[w](){return D(this,yn(this.epochMillis))},[O](e){return MT(e)&&e._tag===`Utc`&&this.epochMillis===e.epochMillis},toString(){return`DateTime.Utc(${iE(this).toJSON()})`}},DT={...TT,_tag:`Zoned`,[w](){return x(yn(this.epochMillis),E(T(this.zone)),D(this))},[O](e){return MT(e)&&e._tag===`Zoned`&&this.epochMillis===e.epochMillis&&k(this.zone,e.zone)},toString(){return`DateTime.Zoned(${vE(this)})`}},OT={[wT]:wT,[A](){return this.toString()}},kT={...OT,_tag:`Named`,[w](){return D(this,bn(`Named:${this.id}`))},[O](e){return NT(e)&&e._tag===`Named`&&this.id===e.id},toString(){return`TimeZone.Named(${this.id})`},toJSON(){return{_id:`TimeZone`,_tag:`Named`,id:this.id}}},AT={...OT,_tag:`Offset`,[w](){return D(this,bn(`Offset:${this.offset}`))},[O](e){return NT(e)&&e._tag===`Offset`&&this.offset===e.offset},toString(){return`TimeZone.Offset(${sE(this.offset)})`},toJSON(){return{_id:`TimeZone`,_tag:`Offset`,offset:this.offset}}},jT=(e,t,n)=>{let r=Object.create(DT);return r.epochMillis=e,r.zone=t,Object.defineProperty(r,`partsUtc`,{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,`adjustedEpochMillis`,{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,`partsAdjusted`,{value:void 0,enumerable:!1,writable:!0}),r},MT=e=>C(e,CT),NT=e=>C(e,wT),PT=e=>NT(e)&&e._tag===`Offset`,FT=e=>NT(e)&&e._tag===`Named`,IT=e=>e._tag===`Utc`,LT=e=>e._tag===`Zoned`,RT=wt((e,t)=>e.epochMillis===t.epochMillis),zT=e=>{let t=Object.create(ET);return t.epochMillis=e,Object.defineProperty(t,`partsUtc`,{value:void 0,enumerable:!1,writable:!0}),t},BT=e=>{let t=e.getTime();if(Number.isNaN(t))throw new sg(`Invalid date`);return zT(t)},VT=e=>{if(MT(e))return e;if(e instanceof Date)return BT(e);if(typeof e==`object`){let t=new Date(0);return uE(t,e),BT(t)}else if(typeof e==`string`&&!HT(e))return BT(new Date(e+`Z`));return BT(new Date(e))},HT=e=>/Z|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),UT=-86399999568e5,WT=864e13-840*60*1e3,GT=(e,t)=>{if(t?.timeZone===void 0&&MT(e)&&LT(e))return e;let n=VT(e);if(n.epochMillis<UT||n.epochMillis>WT)throw RangeError(`Epoch millis out of range: ${n.epochMillis}`);let r;if(t?.timeZone===void 0)r=$T(new Date(n.epochMillis).getTimezoneOffset()*-60*1e3);else if(NT(t?.timeZone))r=t.timeZone;else if(typeof t?.timeZone==`number`)r=$T(t.timeZone);else{let e=nE(t.timeZone);if(ei(e))throw new sg(`Invalid time zone: ${t.timeZone}`);r=e.value}return t?.adjustForTimeZone===!0?fE(n.epochMillis,r,t?.disambiguation??`compatible`):jT(n.epochMillis,r,n.partsUtc)},KT=li(GT),qT=/^(.{17,35})\[(.+)\]$/,JT=e=>{let t=qT.exec(e);if(t===null){let t=mE(e);return t===null?P():KT(e,{timeZone:t})}let[,n,r]=t;return KT(n,{timeZone:r})},YT=S(`effect/DateTime/validZoneCache`,()=>new Map),XT={day:`numeric`,month:`numeric`,year:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,timeZoneName:`longOffset`,fractionalSecondDigits:3,hourCycle:`h23`},ZT=e=>{let t=e.resolvedOptions().timeZone;if(YT.has(t))return YT.get(t);let n=Object.create(kT);return n.id=t,n.format=e,YT.set(t,n),n},QT=e=>{if(YT.has(e))return YT.get(e);try{return ZT(new Intl.DateTimeFormat(`en-US`,{...XT,timeZone:e}))}catch{throw new sg(`Invalid time zone: ${e}`)}},$T=e=>{let t=Object.create(AT);return t.offset=e,t},eE=li(QT),tE=/^(?:GMT|[+-])/,nE=e=>{if(tE.test(e)){let t=mE(e);return t===null?P():F($T(t))}return eE(e)},rE=e=>e._tag===`Offset`?sE(e.offset):e.id,iE=e=>new Date(e.epochMillis),aE=e=>{if(e._tag===`Utc`)return new Date(e.epochMillis);if(e.zone._tag===`Offset`)return new Date(e.epochMillis+e.zone.offset);if(e.adjustedEpochMillis!==void 0)return new Date(e.adjustedEpochMillis);let t=e.zone.format.formatToParts(e.epochMillis).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMillis=n.getTime(),n},oE=e=>aE(e).getTime()-lE(e),sE=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},cE=e=>sE(oE(e)),lE=e=>e.epochMillis,uE=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hours!==void 0&&e.setUTCHours(t.hours),t.minutes!==void 0&&e.setUTCMinutes(t.minutes),t.seconds!==void 0&&e.setUTCSeconds(t.seconds),t.millis!==void 0&&e.setUTCMilliseconds(t.millis)},dE=1440*60*1e3,fE=(e,t,n)=>{if(t._tag===`Offset`)return jT(e-t.offset,t);let r=hE(e-dE,e,t),i=hE(e+dE,e,t);if(r===i)return jT(e-r,t);let a=r<i,o=r-i;if(a){if(hE(e-i,e,t)===i)return jT(e-i,t);let a=jT(e-r,t);if(e!==aE(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return jT(e-i,t);case`compatible`:case`later`:return a}return a}if(hE(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||hE(e-r+o,e+o,t)===r)return jT(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return jT(e-i,t)},pE=/([+-])(\d{2}):(\d{2})$/,mE=e=>{let t=pE.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},hE=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=mE(r);return i===null?oE(jT(t,n)):i},gE=e=>iE(e).toISOString(),_E=e=>{let t=aE(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${cE(e)}`},vE=e=>e.zone._tag===`Offset`?_E(e):`${_E(e)}[${e.zone.id}]`,yE=e=>e.toUpperCase(),bE=e=>e.toLowerCase(),xE=e=>e.length===0?e:yE(e[0])+e.slice(1),SE=e=>e.length===0?e:bE(e[0])+e.slice(1),CE=e=>e.length>0,wE=(e,t,n,r,i,a,o,s,c,l)=>{let u=l(a,c);return jw(u)?L([[r,o],[i,s],Lw(u)]):x(a,Aw(c))?I(e.step(kw(a),n,r),([r,i,a])=>zw(a)?L([[r,o],[i,s],Rw]):wE(e,t,n,r,i,a.intervals,o,s,c,l)):I(t.step(kw(c),n,o),([o,s,c])=>zw(c)?L([[r,o],[i,s],Rw]):wE(e,t,n,r,i,a,o,s,c.intervals,l))},TE=(e,t,n,r)=>Zp(t.next(r),{onFailure:()=>sm(t.last),onSuccess:r=>Zp(e,{onFailure:e=>n(e,F(r)),onSuccess:r=>TE(e,t,n,r)})}),EE=(e,t,n)=>Pp(e,r=>Zp(t.next(r),{onFailure:()=>x(t.last,sm,I(e=>n(r,e))),onSuccess:()=>EE(e,t,n)})),DE=(e,t,n)=>Zp(n.next(t),{onFailure:()=>sm(n.last),onSuccess:()=>I(e,t=>DE(e,t,n))}),OE=Tp,kE=ZC,AE=R,jE=mm,ME=Pp,NE=tm,PE=nm,FE=rm,IE=zp,LE=I,RE=dT,zE=fT,BE=MT,VE=PT,HE=FT,UE=IT,WE=LT,GE=RT,KE=BT,qE=VT,JE=GT,YE=JT,XE=QT,ZE=$T,QE=nE,$E=rE,eD=iE,tD=lE;Dl(`effect/DateTime/CurrentTimeZone`)();var nD=gE,rD=vE,iD=(e,t)=>{switch(t._tag){case`StringKeyword`:case`TemplateLiteral`:return Object.keys(e);case`SymbolKeyword`:return Object.getOwnPropertySymbols(e);case`Refinement`:return iD(e,t.from)}},aD=e=>{let t=!1,n;return()=>t?n:(n=e(),t=!0,n)},oD=e=>Array.isArray(e),sD=e=>!Array.isArray(e),cD=e=>`[${jn(e)}]`,lD=e=>oD(e)?e.map(cD).join(``):cD(e),uD=(e,t,n,r)=>{let i=e;return n&&Ii(n)&&(i+=`\nat path: ${lD(n)}`),t!==void 0&&(i+=`\ndetails: ${t}`),r&&(i+=`\nschema (${r._tag}): ${r}`),i},dD=e=>uD(`Invalid Argument`,e),fD=(e,t,n)=>uD(`Missing annotation`,e,t,n),pD=(e,t)=>fD(`Generating a JSON Schema for this schema requires a "jsonSchema" annotation`,e,t),mD=(e,t)=>fD(`Generating a JSON Schema for this schema requires an "identifier" annotation`,e,t),hD=e=>uD(`Generating a JSON Schema for post-rest elements is not currently supported. You're welcome to contribute by submitting a Pull Request`,void 0,e),gD=(e,t)=>uD(`Unsupported key`,`Cannot encode ${jn(e)} key to JSON Schema`,t),_D=e=>uD(`Unsupported key schema`,void 0,void 0,e),vD=e=>uD(`Unsupported literal`,`literal value: ${Mn(e)}`),yD=e=>uD(`Duplicate index signature`,`${e} index signature`),bD=uD(`Unsupported index signature parameter`,"An index signature parameter type must be `string`, `symbol`, a template literal type or a refinement of the previous types"),xD=uD(`Invalid element`,`A required element cannot follow an optional element. ts(1257)`),SD=e=>uD(`Duplicate property signature transformation`,`Duplicate key ${Mn(e)}`),CD=e=>uD(`Duplicate property signature`,`Duplicate key ${Mn(e)}`),wD=Symbol.for(`effect/SchemaId/DateFromSelf`),TD=Symbol.for(`effect/SchemaId/GreaterThan`),ED=Symbol.for(`effect/SchemaId/GreaterThanOrEqualTo`),DD=Symbol.for(`effect/SchemaId/LessThan`),OD=Symbol.for(`effect/SchemaId/LessThanOrEqualTo`),kD=Symbol.for(`effect/SchemaId/Int`),AD=Symbol.for(`effect/SchemaId/NonNaN`),jD=Symbol.for(`effect/SchemaId/Finite`),MD=Symbol.for(`effect/SchemaId/JsonNumber`),ND=Symbol.for(`effect/SchemaId/Between`),PD=Symbol.for(`effect/SchemaId/GreaterThanOrEqualToBigint`),FD=Symbol.for(`effect/SchemaId/BetweenBigint`),ID=Symbol.for(`effect/SchemaId/MinLength`),LD=Symbol.for(`effect/SchemaId/MaxLength`),RD=Symbol.for(`effect/SchemaId/Length`),zD=Symbol.for(`effect/SchemaId/MinItems`),BD=Symbol.for(`effect/SchemaId/MaxItems`),VD=Symbol.for(`effect/annotation/TypeConstructor`),HD=Symbol.for(`effect/annotation/Brand`),UD=Symbol.for(`effect/annotation/SchemaId`),WD=Symbol.for(`effect/annotation/Message`),GD=Symbol.for(`effect/annotation/MissingMessage`),KD=Symbol.for(`effect/annotation/Identifier`),qD=Symbol.for(`effect/annotation/Title`),JD=Symbol.for(`effect/annotation/AutoTitle`),YD=Symbol.for(`effect/annotation/Description`),XD=Symbol.for(`effect/annotation/Examples`),ZD=Symbol.for(`effect/annotation/Default`),QD=Symbol.for(`effect/annotation/JSONSchema`),$D=Symbol.for(`effect/annotation/Arbitrary`),eO=Symbol.for(`effect/annotation/Pretty`),tO=Symbol.for(`effect/annotation/Equivalence`),nO=Symbol.for(`effect/annotation/Documentation`),rO=Symbol.for(`effect/annotation/Concurrency`),iO=Symbol.for(`effect/annotation/Batching`),aO=Symbol.for(`effect/annotation/ParseIssueTitle`),oO=Symbol.for(`effect/annotation/ParseOptions`),sO=Symbol.for(`effect/annotation/DecodingFallback`),cO=Symbol.for(`effect/annotation/Surrogate`),lO=Symbol.for(`effect/annotation/StableFilter`),uO=y(2,(e,t)=>Object.prototype.hasOwnProperty.call(e.annotations,t)?F(e.annotations[t]):P()),dO=uO(HD),fO=uO(WD),pO=uO(GD),mO=uO(qD),hO=uO(JD),gO=uO(KD),_O=uO(YD),vO=uO(XD),yO=uO(ZD),bO=uO(QD),xO=uO(rO),SO=uO(iO),CO=uO(aO),wO=uO(oO),TO=uO(sO),EO=uO(cO),DO=uO(lO),OO=e=>yi(DO(e),e=>e===!0),kO=Symbol.for(`effect/annotation/JSONIdentifier`),AO=uO(kO),jO=e=>ai(AO(e),()=>gO(e)),MO=Symbol.for(`effect/schema/ParseJson`),NO=class{typeParameters;decodeUnknown;encodeUnknown;annotations;_tag=`Declaration`;constructor(e,t,n,r={}){this.typeParameters=e,this.decodeUnknown=t,this.encodeUnknown=n,this.annotations=r}toString(){return ii(Xk(this),()=>`<declaration schema>`)}toJSON(){return{_tag:this._tag,typeParameters:this.typeParameters.map(e=>e.toJSON()),annotations:Gk(this.annotations)}}},PO=e=>t=>t._tag===e,FO=PO(`Declaration`),IO=class{literal;annotations;_tag=`Literal`;constructor(e,t={}){this.literal=e,this.annotations=t}toString(){return ii(Xk(this),()=>Mn(this.literal))}toJSON(){return{_tag:this._tag,literal:It(this.literal)?String(this.literal):this.literal,annotations:Gk(this.annotations)}}},LO=PO(`Literal`),RO=new IO(null),zO=class{symbol;annotations;_tag=`UniqueSymbol`;constructor(e,t={}){this.symbol=e,this.annotations=t}toString(){return ii(Xk(this),()=>Mn(this.symbol))}toJSON(){return{_tag:this._tag,symbol:String(this.symbol),annotations:Gk(this.annotations)}}},BO=new class{annotations;_tag=`UndefinedKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`undefined`}),VO=new class{annotations;_tag=`NeverKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`never`}),HO=PO(`NeverKeyword`),UO=new class{annotations;_tag=`UnknownKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`unknown`}),WO=new class{annotations;_tag=`AnyKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`any`}),GO=new class{annotations;_tag=`StringKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`string`,[YD]:`a string`}),KO=PO(`StringKeyword`),qO=new class{annotations;_tag=`NumberKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`number`,[YD]:`a number`}),JO=new class{annotations;_tag=`BooleanKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`boolean`,[YD]:`a boolean`}),YO=new class{annotations;_tag=`BigIntKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`bigint`,[YD]:`a bigint`}),XO=new class{annotations;_tag=`SymbolKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`symbol`,[YD]:`a symbol`}),ZO=PO(`SymbolKeyword`),QO=new class{annotations;_tag=`ObjectKeyword`;constructor(e={}){this.annotations=e}toString(){return qk(this)}toJSON(){return{_tag:this._tag,annotations:Gk(this.annotations)}}}({[qD]:`object`,[YD]:"an object in the TypeScript meaning, i.e. the `object` type"}),$O=class{type;annotations;constructor(e,t={}){this.type=e,this.annotations=t}toJSON(){return{type:this.type.toJSON(),annotations:Gk(this.annotations)}}toString(){return String(this.type)}},ek=class extends $O{isOptional;constructor(e,t,n={}){super(e,n),this.isOptional=t}toJSON(){return{type:this.type.toJSON(),isOptional:this.isOptional,annotations:Gk(this.annotations)}}toString(){return String(this.type)+(this.isOptional?`?`:``)}},tk=e=>e.map(e=>e.type),nk=class{elements;rest;isReadonly;annotations;_tag=`TupleType`;constructor(e,t,n,r={}){this.elements=e,this.rest=t,this.isReadonly=n,this.annotations=r;let i=!1,a=!1;for(let t of e)if(t.isOptional)i=!0;else if(i){a=!0;break}if(a||i&&t.length>1)throw Error(xD)}toString(){return ii(Xk(this),()=>rk(this))}toJSON(){return{_tag:this._tag,elements:this.elements.map(e=>e.toJSON()),rest:this.rest.map(e=>e.toJSON()),isReadonly:this.isReadonly,annotations:Gk(this.annotations)}}},rk=e=>{let t=e.elements.map(String).join(`, `);return ki(e.rest,{onEmpty:()=>`readonly [${t}]`,onNonEmpty:(n,r)=>{let i=String(n),a=i.includes(` | `)?`(${i})`:i;if(r.length>0){let n=r.map(String).join(`, `);return e.elements.length>0?`readonly [${t}, ...${a}[], ${n}]`:`readonly [...${a}[], ${n}]`}else if(e.elements.length>0)return`readonly [${t}, ...${a}[]]`;else return`ReadonlyArray<${i}>`}})},ik=class extends ek{name;isReadonly;constructor(e,t,n,r,i){super(t,n,i),this.name=e,this.isReadonly=r}toString(){return(this.isReadonly?`readonly `:``)+String(this.name)+(this.isOptional?`?`:``)+`: `+this.type}toJSON(){return{name:String(this.name),type:this.type.toJSON(),isOptional:this.isOptional,isReadonly:this.isReadonly,annotations:Gk(this.annotations)}}},ak=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return!0;case`Refinement`:return ak(e.from)}return!1},ok=class{type;isReadonly;parameter;constructor(e,t,n){if(this.type=t,this.isReadonly=n,ak(e))this.parameter=e;else throw Error(bD)}toString(){return(this.isReadonly?`readonly `:``)+`[x: ${this.parameter}]: ${this.type}`}toJSON(){return{parameter:this.parameter.toJSON(),type:this.type.toJSON(),isReadonly:this.isReadonly}}},sk=class{annotations;_tag=`TypeLiteral`;propertySignatures;indexSignatures;constructor(e,t,n={}){this.annotations=n;let r={};for(let t=0;t<e.length;t++){let n=e[t].name;if(Object.prototype.hasOwnProperty.call(r,n))throw Error(CD(n));r[n]=null}let i={string:!1,symbol:!1};for(let e=0;e<t.length;e++){let n=Kk(t[e].parameter);if(KO(n)){if(i.string)throw Error(yD(`string`));i.string=!0}else if(ZO(n)){if(i.symbol)throw Error(yD(`symbol`));i.symbol=!0}}this.propertySignatures=e,this.indexSignatures=t}toString(){return ii(Xk(this),()=>lk(this))}toJSON(){return{_tag:this._tag,propertySignatures:this.propertySignatures.map(e=>e.toJSON()),indexSignatures:this.indexSignatures.map(e=>e.toJSON()),annotations:Gk(this.annotations)}}},ck=e=>e.map(String).join(`; `),lk=e=>{if(e.propertySignatures.length>0){let t=e.propertySignatures.map(String).join(`; `);return e.indexSignatures.length>0?`{ ${t}; ${ck(e.indexSignatures)} }`:`{ ${t} }`}else if(e.indexSignatures.length>0)return`{ ${ck(e.indexSignatures)} }`;else return`{}`},uk=PO(`TypeLiteral`),dk=Xi(Zr(Ag,e=>{switch(e._tag){case`AnyKeyword`:return 0;case`UnknownKeyword`:return 1;case`ObjectKeyword`:return 2;case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:return 3}return 4})),fk={string:`StringKeyword`,number:`NumberKeyword`,boolean:`BooleanKeyword`,bigint:`BigIntKeyword`},pk=e=>ca(e,e=>vk(e)?pk(e.types):[e]),mk=e=>{let t=dk(e),n=[],r={},i=[];for(let e of t)switch(e._tag){case`NeverKeyword`:break;case`AnyKeyword`:return[WO];case`UnknownKeyword`:return[UO];case`ObjectKeyword`:case`UndefinedKeyword`:case`VoidKeyword`:case`StringKeyword`:case`NumberKeyword`:case`BooleanKeyword`:case`BigIntKeyword`:case`SymbolKeyword`:r[e._tag]||(r[e._tag]=e,n.push(e));break;case`Literal`:{let t=typeof e.literal;switch(t){case`string`:case`number`:case`bigint`:case`boolean`:!r[fk[t]]&&!i.includes(e.literal)&&(i.push(e.literal),n.push(e));break;case`object`:i.includes(e.literal)||(i.push(e.literal),n.push(e));break}break}case`UniqueSymbol`:!r.SymbolKeyword&&!i.includes(e.symbol)&&(i.push(e.symbol),n.push(e));break;case`TupleType`:r.ObjectKeyword||n.push(e);break;case`TypeLiteral`:e.propertySignatures.length===0&&e.indexSignatures.length===0?r[`{}`]||(r[`{}`]=e,n.push(e)):r.ObjectKeyword||n.push(e);break;default:n.push(e)}return n},hk=class e{types;annotations;static make=(t,n)=>_k(t)?new e(t,n):t.length===1?t[0]:VO;static unify=(t,n)=>e.make(mk(pk(t)),n);_tag=`Union`;constructor(e,t={}){this.types=e,this.annotations=t}toString(){return ii(Xk(this),()=>this.types.map(String).join(` | `))}toJSON(){return{_tag:this._tag,types:this.types.map(e=>e.toJSON()),annotations:Gk(this.annotations)}}},gk=(e,t)=>e.map(t),_k=e=>e.length>1,vk=PO(`Union`),yk=S(Symbol.for(`effect/Schema/AST/toJSONMemoMap`),()=>new WeakMap),bk=class{f;annotations;_tag=`Suspend`;constructor(e,t={}){this.f=e,this.annotations=t,this.f=aD(e)}toString(){return Xk(this).pipe(ai(()=>pi(li(this.f)(),e=>Xk(e))),ii(()=>`<suspended schema>`))}toJSON(){let e=this.f(),t=yk.get(e);return t||(yk.set(e,{_tag:this._tag}),t={_tag:this._tag,ast:e.toJSON(),annotations:Gk(this.annotations)},yk.set(e,t),t)}},xk=PO(`Suspend`),Sk=class{from;filter;annotations;_tag=`Refinement`;constructor(e,t,n={}){this.from=e,this.filter=t,this.annotations=n}toString(){return gO(this).pipe(ii(()=>ni(Yk(this),{onNone:()=>`{ ${this.from} | filter }`,onSome:e=>Ck(this.from)?String(this.from)+` & `+e:e})))}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),annotations:Gk(this.annotations)}}},Ck=PO(`Refinement`),wk={},Tk=class{from;to;transformation;annotations;_tag=`Transformation`;constructor(e,t,n,r={}){this.from=e,this.to=t,this.transformation=n,this.annotations=r}toString(){return ii(Xk(this),()=>`(${String(this.from)} <-> ${String(this.to)})`)}toJSON(){return{_tag:this._tag,from:this.from.toJSON(),to:this.to.toJSON(),annotations:Gk(this.annotations)}}},Ek=PO(`Transformation`),Dk=class{decode;encode;_tag=`FinalTransformation`;constructor(e,t){this.decode=e,this.encode=t}},Ok=class{from;to;decode;encode;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}},kk=class{propertySignatureTransformations;_tag=`TypeLiteralTransformation`;constructor(e){this.propertySignatureTransformations=e;let t={},n={};for(let r of e){let e=r.from;if(t[e])throw Error(SD(e));t[e]=!0;let i=r.to;if(n[i])throw Error(SD(i));n[i]=!0}}},Ak=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={...e.annotations};delete r[KD];let i={...r,...t},a=EO(e);return ti(a)&&(i[cO]=Ak(a.value,t)),n.annotations.value=i,Object.create(Object.getPrototypeOf(e),n)},jk=`[\\s\\S]*?`,Mk=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`,Nk=(e,t)=>{switch(e._tag){case`Literal`:return Mg(String(e.literal));case`StringKeyword`:return jk;case`NumberKeyword`:return Mk;case`TemplateLiteral`:return Fk(e,t,!1);case`Union`:return e.types.map(e=>Nk(e,t)).join(`|`)}},Pk=(e,t,n,r)=>{if(vk(e)){if(n&&!r)return`(?:${t})`}else if(!n||!r)return t;return`(${t})`},Fk=(e,t,n)=>{let r=``;if(e.head!==``){let i=Mg(e.head);r+=t&&n?`(${i})`:i}for(let i of e.spans){let e=Nk(i.type,t);if(r+=Pk(i.type,e,t,n),i.literal!==``){let e=Mg(i.literal);r+=t&&n?`(${e})`:e}}return r},Ik=e=>RegExp(`^${Fk(e,!1,!0)}$`),Lk=(e,t)=>{let n=[],r=[],i=e=>{switch(e._tag){case`NeverKeyword`:break;case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:case`Refinement`:r.push(new ok(e,t,!0));break;case`Literal`:if(Nt(e.literal)||Pt(e.literal))n.push(new ik(e.literal,t,!1,!0));else throw Error(vD(e.literal));break;case`Enums`:for(let[r,i]of e.enums)n.push(new ik(i,t,!1,!0));break;case`UniqueSymbol`:n.push(new ik(e.symbol,t,!1,!0));break;case`Union`:e.types.forEach(i);break;default:throw Error(_D(e))}};return i(e),{propertySignatures:n,indexSignatures:r}},Rk=e=>t=>{let n;for(let r of e)Object.prototype.hasOwnProperty.call(t.annotations,r)&&(n===void 0&&(n={}),n[r]=t.annotations[r]);return n},zk=Rk([XD,ZD,QD,$D,eO,tO]),Bk=e=>{switch(e._tag){case`Declaration`:{let t=Vk(e.typeParameters,Bk);return t===e.typeParameters?e:new NO(t,e.decodeUnknown,e.encodeUnknown,e.annotations)}case`TupleType`:{let t=Vk(e.elements,e=>{let t=Bk(e.type);return t===e.type?e:new ek(t,e.isOptional)}),n=tk(e.rest),r=Vk(n,Bk);return t===e.elements&&r===n?e:new nk(t,r.map(e=>new $O(e)),e.isReadonly,e.annotations)}case`TypeLiteral`:{let t=Vk(e.propertySignatures,e=>{let t=Bk(e.type);return t===e.type?e:new ik(e.name,t,e.isOptional,e.isReadonly)}),n=Vk(e.indexSignatures,e=>{let t=Bk(e.type);return t===e.type?e:new ok(e.parameter,t,e.isReadonly)});return t===e.propertySignatures&&n===e.indexSignatures?e:new sk(t,n,e.annotations)}case`Union`:{let t=Vk(e.types,Bk);return t===e.types?e:hk.make(t,e.annotations)}case`Suspend`:return new bk(()=>Bk(e.f()),e.annotations);case`Refinement`:{let t=Bk(e.from);return t===e.from?e:new Sk(t,e.filter,e.annotations)}case`Transformation`:{let t=zk(e);return Bk(t===void 0?e.to:Ak(e.to,t))}}return e};function Vk(e,t){let n=!1,r=Ti(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}var Hk=e=>{switch(e._tag){case`Transformation`:return e.from;case`Refinement`:return Hk(e.from);case`Suspend`:return Hk(e.f())}},Uk=(e,t)=>{switch(e._tag){case`Declaration`:{let n=Vk(e.typeParameters,e=>Uk(e,t));return n===e.typeParameters?e:new NO(n,e.decodeUnknown,e.encodeUnknown)}case`TupleType`:{let n=Vk(e.elements,e=>{let n=Uk(e.type,t);return n===e.type?e:new ek(n,e.isOptional)}),r=tk(e.rest),i=Vk(r,e=>Uk(e,t));return n===e.elements&&i===r?e:new nk(n,i.map(e=>new $O(e)),e.isReadonly)}case`TypeLiteral`:{let n=Vk(e.propertySignatures,e=>{let n=Uk(e.type,t);return n===e.type?e:new ik(e.name,n,e.isOptional,e.isReadonly)}),r=Vk(e.indexSignatures,e=>{let n=Uk(e.type,t);return n===e.type?e:new ok(e.parameter,n,e.isReadonly)});return n===e.propertySignatures&&r===e.indexSignatures?e:new sk(n,r)}case`Union`:{let n=Vk(e.types,e=>Uk(e,t));return n===e.types?e:hk.make(n)}case`Suspend`:{let n,r=jO(e);if(ti(r)){let e=t?`Bound`:``;n={[kO]:`${r.value}Encoded${e}`}}return new bk(()=>Uk(e.f(),t),n)}case`Refinement`:{let n=Uk(e.from,t);return t?n===e.from?e:Hk(e.from)===void 0&&OO(e)?new Sk(n,e.filter,e.annotations):n:n}case`Transformation`:return Uk(e.from,t)}return e},Wk=e=>Uk(e,!1),Gk=e=>{let t={};for(let n of Object.getOwnPropertySymbols(e))t[String(n)]=e[n];return t},Kk=e=>{switch(e._tag){case`StringKeyword`:case`SymbolKeyword`:case`TemplateLiteral`:return e;case`Refinement`:return Kk(e.from)}},qk=e=>ii(Xk(e),()=>e._tag);function Jk(e){return ni(dO(e),{onNone:()=>``,onSome:e=>e.map(e=>` & Brand<${Mn(e)}>`).join(``)})}var Yk=e=>mO(e).pipe(ai(()=>_O(e)),ai(()=>hO(e)),fi(t=>t+Jk(e))),Xk=e=>ai(gO(e),()=>Yk(e)),Zk=(e,t,n)=>{switch(e._tag){case`UndefinedKeyword`:return VO;case`Union`:{let n=[],r=!1;for(let i of e.types){let e=t(i);e?(r=!0,HO(e)||n.push(e)):n.push(i)}if(r)return hk.make(n);break}case`Suspend`:return t(e.f());case`Transformation`:return n(e)}},Qk=class{path;actual;issue;_tag=`Pointer`;constructor(e,t,n){this.path=e,this.actual=t,this.issue=n}},$k=class{actual;message;_tag=`Unexpected`;constructor(e,t){this.actual=e,this.message=t}},eA=class{ast;message;_tag=`Missing`;actual=void 0;constructor(e,t){this.ast=e,this.message=t}},tA=class{ast;actual;issues;output;_tag=`Composite`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.issues=n,this.output=r}},nA=class{ast;actual;kind;issue;_tag=`Refinement`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},rA=class{ast;actual;kind;issue;_tag=`Transformation`;constructor(e,t,n,r){this.ast=e,this.actual=t,this.kind=n,this.issue=r}},iA=class{ast;actual;message;_tag=`Type`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},aA=class{ast;actual;message;_tag=`Forbidden`;constructor(e,t,n){this.ast=e,this.actual=t,this.message=n}},oA=Symbol.for(`effect/Schema/ParseErrorTypeId`),sA=class extends j_(`ParseError`){[oA]=oA;get message(){return this.toString()}toString(){return UA.formatIssueSync(this.issue)}toJSON(){return{_id:`ParseError`,message:this.toString()}}[A](){return this.toJSON()}},cA=e=>new sA({issue:e}),lA=M,uA=N,dA=Lr,fA=Ir,pA=Rr,mA=y(2,(e,t)=>pA(e)?Wr(e,{onLeft:N,onRight:t}):LE(e,t)),hA=y(2,(e,t)=>pA(e)?Ur(e,t):NE(e,t)),gA=y(2,(e,t)=>pA(e)?Hr(e,t):FE(e,t)),_A=y(2,(e,t)=>pA(e)?Vr(e,{onLeft:t.onFailure,onRight:t.onSuccess}):PE(e,t)),vA=y(2,(e,t)=>pA(e)?Wr(e,{onLeft:t,onRight:M}):ME(e,t)),yA=(e,t)=>t===void 0||Pt(t)?e:e===void 0?t:{...e,...t},bA=(e,t,n)=>{let r=AA(e,t);return(e,t)=>r(e,yA(n,t))},xA=(e,t,n)=>{let r=bA(e,t,n);return(e,t)=>Kr(r(e,t),cA)},SA=(e,t,n)=>{let r=bA(e,t,n);return(e,t)=>ri(r(e,t))},CA=(e,t,n)=>{let r=AA(e,t);return(e,t)=>r(e,{...yA(n,t),isEffectAllowed:!0})},wA=(e,t)=>xA(e.ast,!0,t),TA=(e,t)=>CA(e.ast,!0,t),EA=(e,t)=>CA(e.ast,!1,t),DA=(e,t)=>xA(Bk(e.ast),!0,t),OA=S(Symbol.for(`effect/ParseResult/decodeMemoMap`),()=>new WeakMap),kA=S(Symbol.for(`effect/ParseResult/encodeMemoMap`),()=>new WeakMap),AA=(e,t)=>{let n=t?OA:kA,r=n.get(e);if(r)return r;let i=NA(e,t),a=wO(e),o=ti(a)?(e,t)=>i(e,yA(t,a.value)):i,s=TO(e),c=t&&ti(s)?(t,n)=>RA(vA(o(t,n),s.value),e,t,n):o;return n.set(e,c),c},jA=e=>ci(xO(e)),MA=e=>ci(SO(e)),NA=(e,t)=>{switch(e._tag){case`Refinement`:if(t){let t=AA(e.from,!0);return(n,r)=>{r??=wk;let i=r?.errors===`all`;return RA(mA(vA(t(n,r),t=>{let a=new nA(e,n,`From`,t);return i&&OO(e)&&QA(t)?ni(e.filter(n,r,e),{onNone:()=>N(a),onSome:t=>N(new tA(e,n,[a,new nA(e,n,`Predicate`,t)]))}):N(a)}),t=>ni(e.filter(t,r,e),{onNone:()=>M(t),onSome:t=>N(new nA(e,n,`Predicate`,t))})),e,n,r)}}else{let t=AA(Bk(e),!0),n=AA(LA(e.from),!1);return(r,i)=>RA(mA(t(r,i),e=>n(e,i)),e,r,i)}case`Transformation`:{let n=VA(e.transformation,t),r=t?AA(e.from,!0):AA(e.to,!1),i=t?AA(e.to,!0):AA(e.from,!1);return(a,o)=>RA(mA(gA(r(a,o),n=>new rA(e,a,t?`Encoded`:`Type`,n)),r=>mA(gA(n(r,o??wk,e,a),t=>new rA(e,a,`Transformation`,t)),n=>gA(i(n,o),n=>new rA(e,a,t?`Type`:`Encoded`,n)))),e,a,o)}case`Declaration`:{let n=t?e.decodeUnknown(...e.typeParameters):e.encodeUnknown(...e.typeParameters);return(t,r)=>RA(n(t,r??wk,e),e,t,r)}case`Literal`:return PA(e,t=>t===e.literal);case`UniqueSymbol`:return PA(e,t=>t===e.symbol);case`UndefinedKeyword`:return PA(e,zt);case`NeverKeyword`:return PA(e,Bt);case`UnknownKeyword`:case`AnyKeyword`:case`VoidKeyword`:return M;case`StringKeyword`:return PA(e,Nt);case`NumberKeyword`:return PA(e,Pt);case`BooleanKeyword`:return PA(e,Ft);case`BigIntKeyword`:return PA(e,It);case`SymbolKeyword`:return PA(e,Lt);case`ObjectKeyword`:return PA(e,Ht);case`Enums`:return PA(e,t=>e.enums.some(([e,n])=>n===t));case`TemplateLiteral`:{let t=Ik(e);return PA(e,e=>Nt(e)&&t.test(e))}case`TupleType`:{let n=e.elements.map(e=>AA(e.type,t)),r=e.rest.map(e=>AA(e.type,t)),i=e.elements.filter(e=>!e.isOptional);e.rest.length>0&&(i=i.concat(e.rest.slice(1)));let a=i.length,o=e.elements.length>0?e.elements.map((e,t)=>t).join(` | `):`never`,s=jA(e),c=MA(e);return(t,l)=>{if(!Ni(t))return N(new iA(e,t));let u=l?.errors===`all`,d=[],f=0,p=[],m=t.length;for(let n=m;n<=a-1;n++){let r=new Qk(n,t,new eA(i[n-m]));if(u){d.push([f++,r]);continue}else return N(new tA(e,t,r,p))}if(e.rest.length===0)for(let n=e.elements.length;n<=m-1;n++){let r=new Qk(n,t,new $k(t[n],`is unexpected, expected: ${o}`));if(u){d.push([f++,r]);continue}else return N(new tA(e,t,r,p))}let h=0,g;for(;h<n.length;h++)if(m<h+1){if(e.elements[h].isOptional)continue}else{let r=n[h],i=r(t[h],l);if(pA(i)){if(zr(i)){let n=new Qk(h,t,i.left);if(u){d.push([f++,n]);continue}else return N(new tA(e,t,n,BA(p)))}p.push([f++,i.right])}else{let n=f++,r=h;g||=[],g.push(({es:a,output:o})=>LE(IE(i),i=>{if(zr(i)){let s=new Qk(r,t,i.left);return u?(a.push([n,s]),jE):N(new tA(e,t,s,BA(o)))}return o.push([n,i.right]),jE}))}}if(Ii(r)){let[n,...i]=r;for(;h<m-i.length;h++){let r=n(t[h],l);if(pA(r))if(zr(r)){let n=new Qk(h,t,r.left);if(u){d.push([f++,n]);continue}else return N(new tA(e,t,n,BA(p)))}else p.push([f++,r.right]);else{let n=f++,i=h;g||=[],g.push(({es:a,output:o})=>LE(IE(r),r=>{if(zr(r)){let s=new Qk(i,t,r.left);return u?(a.push([n,s]),jE):N(new tA(e,t,s,BA(o)))}else return o.push([n,r.right]),jE}))}}for(let n=0;n<i.length;n++){let r=h+n;if(!(m<r+1)){let a=i[n](t[r],l);if(pA(a)){if(zr(a)){let n=new Qk(r,t,a.left);if(u){d.push([f++,n]);continue}else return N(new tA(e,t,n,BA(p)))}p.push([f++,a.right])}else{let n=f++;g||=[],g.push(({es:i,output:o})=>LE(IE(a),a=>{if(zr(a)){let s=new Qk(r,t,a.left);return u?(i.push([n,s]),jE):N(new tA(e,t,s,BA(o)))}return o.push([n,a.right]),jE}))}}}}let _=({es:n,output:r})=>Fi(n)?N(new tA(e,t,BA(n),BA(r))):M(BA(r));if(g&&g.length>0){let e=g;return AE(()=>{let t={es:na(d),output:na(p)};return LE(kE(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>_(t))})}return _({output:p,es:d})}}case`TypeLiteral`:{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return PA(e,Gt);let n=[],r={},i=[];for(let a of e.propertySignatures)n.push([AA(a.type,t),a]),r[a.name]=null,i.push(a.name);let a=e.indexSignatures.map(e=>[AA(e.parameter,t),AA(e.type,t),e.parameter]),o=hk.make(e.indexSignatures.map(e=>e.parameter).concat(i.map(e=>Lt(e)?new zO(e):new IO(e)))),s=AA(o,t),c=jA(e),l=MA(e);return(t,u)=>{if(!Yt(t))return N(new iA(e,t));let d=u?.errors===`all`,f=[],p=0,m=u?.onExcessProperty===`error`,h=u?.onExcessProperty===`preserve`,g={},_;if(m||h){_=Reflect.ownKeys(t);for(let n of _){let r=s(n,u);if(pA(r)&&zr(r))if(m){let r=new Qk(n,t,new $k(t[n],`is unexpected, expected: ${String(o)}`));if(d){f.push([p++,r]);continue}else return N(new tA(e,t,r,g))}else g[n]=t[n]}}let v,ee=u?.exact===!0;for(let r=0;r<n.length;r++){let i=n[r][1],a=i.name,o=Object.prototype.hasOwnProperty.call(t,a);if(!o){if(i.isOptional)continue;if(ee){let n=new Qk(a,t,new eA(i));if(d){f.push([p++,n]);continue}else return N(new tA(e,t,n,g))}}let s=n[r][0],c=s(t[a],u);if(pA(c)){if(zr(c)){let n=new Qk(a,t,o?c.left:new eA(i));if(d){f.push([p++,n]);continue}else return N(new tA(e,t,n,g))}g[a]=c.right}else{let n=p++,r=a;v||=[],v.push(({es:a,output:s})=>LE(IE(c),c=>{if(zr(c)){let l=new Qk(r,t,o?c.left:new eA(i));return d?(a.push([n,l]),jE):N(new tA(e,t,l,s))}return s[r]=c.right,jE}))}}for(let n=0;n<a.length;n++){let i=a[n],o=i[0],s=i[1],c=iD(t,i[2]);for(let n of c){let i=o(n,u);if(pA(i)&&Br(i)){let i=s(t[n],u);if(pA(i))if(zr(i)){let r=new Qk(n,t,i.left);if(d){f.push([p++,r]);continue}else return N(new tA(e,t,r,g))}else Object.prototype.hasOwnProperty.call(r,n)||(g[n]=i.right);else{let a=p++,o=n;v||=[],v.push(({es:s,output:c})=>LE(IE(i),i=>{if(zr(i)){let n=new Qk(o,t,i.left);return d?(s.push([a,n]),jE):N(new tA(e,t,n,c))}else return Object.prototype.hasOwnProperty.call(r,n)||(c[n]=i.right),jE}))}}}}let te=({es:n,output:r})=>{if(Fi(n))return N(new tA(e,t,BA(n),r));if(u?.propertyOrder===`original`){let e=_||Reflect.ownKeys(t);for(let t of i)e.indexOf(t)===-1&&e.push(t);let n={};for(let t of e)Object.prototype.hasOwnProperty.call(r,t)&&(n[t]=r[t]);return M(n)}return M(r)};if(v&&v.length>0){let e=v;return AE(()=>{let t={es:na(f),output:Object.assign({},g)};return LE(kE(e,e=>e(t),{concurrency:c,batching:l,discard:!0}),()=>te(t))})}return te({es:f,output:g})}}case`Union`:{let n=IA(e.types,t),r=Reflect.ownKeys(n.keys),i=r.length,a=e.types.length,o=new Map;for(let n=0;n<a;n++)o.set(e.types[n],AA(e.types[n],t));let s=jA(e)??1,c=MA(e);return(t,l)=>{let u=[],d=0,f=[];if(i>0)if(Vt(t))for(let e=0;e<i;e++){let i=r[e],o=n.keys[i].buckets;if(Object.prototype.hasOwnProperty.call(t,i)){let e=String(t[i]);if(Object.prototype.hasOwnProperty.call(o,e))f=f.concat(o[e]);else{let{candidates:e,literals:r}=n.keys[i],o=hk.make(r),s=e.length===a?new sk([new ik(i,o,!1,!0)],[]):hk.make(e);u.push([d++,new tA(s,t,new Qk(i,t,new iA(o,t[i])))])}}else{let{candidates:e,literals:r}=n.keys[i],o=new ik(i,hk.make(r),!1,!0),s=e.length===a?new sk([o],[]):hk.make(e);u.push([d++,new tA(s,t,new Qk(i,t,new eA(o)))])}}else{let r=n.candidates.length===a?e:hk.make(n.candidates);u.push([d++,new iA(r,t)])}n.otherwise.length>0&&(f=f.concat(n.otherwise));let p;for(let e=0;e<f.length;e++){let n=f[e],r=o.get(n)(t,l);if(pA(r)&&(!p||p.length===0)){if(Br(r))return r;u.push([d++,r.left])}else{let e=d++;p||=[],p.push(t=>AE(()=>`finalResult`in t?jE:LE(IE(r),n=>(Br(n)?t.finalResult=n:t.es.push([e,n.left]),jE))))}}let m=n=>Fi(n)?n.length===1&&n[0][1]._tag===`Type`?N(n[0][1]):N(new tA(e,t,BA(n))):N(new iA(e,t));if(p&&p.length>0){let e=p;return AE(()=>{let t={es:na(u)};return LE(kE(e,e=>e(t),{concurrency:s,batching:c,discard:!0}),()=>`finalResult`in t?t.finalResult:m(t.es))})}return m(u)}}case`Suspend`:{let n=aD(()=>AA(e.f(),t));return(e,t)=>n()(e,t)}}},PA=(e,t)=>n=>t(n)?M(n):N(new iA(e,n)),FA=(e,t)=>{switch(e._tag){case`Declaration`:{let n=EO(e);if(ti(n))return FA(n.value,t);break}case`TypeLiteral`:{let n=[];for(let r=0;r<e.propertySignatures.length;r++){let i=e.propertySignatures[r],a=t?Wk(i.type):Bk(i.type);LO(a)&&!i.isOptional&&n.push([i.name,a])}return n}case`TupleType`:{let n=[];for(let r=0;r<e.elements.length;r++){let i=e.elements[r],a=t?Wk(i.type):Bk(i.type);LO(a)&&!i.isOptional&&n.push([r,a])}return n}case`Refinement`:return FA(e.from,t);case`Suspend`:return FA(e.f(),t);case`Transformation`:return FA(t?e.from:e.to,t)}return[]},IA=(e,t)=>{let n={},r=[],i=[];for(let a=0;a<e.length;a++){let o=e[a],s=FA(o,t);if(s.length>0){i.push(o);for(let e=0;e<s.length;e++){let[t,r]=s[e],i=String(r.literal);n[t]=n[t]||{buckets:{},literals:[],candidates:[]};let a=n[t].buckets;if(Object.prototype.hasOwnProperty.call(a,i)){if(e<s.length-1)continue;a[i].push(o),n[t].literals.push(r),n[t].candidates.push(o)}else{a[i]=[o],n[t].literals.push(r),n[t].candidates.push(o);break}}}else r.push(o)}return{keys:n,otherwise:r,candidates:i}},LA=e=>Ck(e)?LA(e.from):e,RA=(e,t,n,r)=>{if(r?.isEffectAllowed===!0||pA(e))return e;let i=new fb,a=RE(e,{scheduler:i});i.flush();let o=a.unsafePoll();if(o){if(Bb(o))return M(o.value);let e=o.cause;return og(e)?N(e.error):N(new aA(t,n,cg(e)))}return N(new aA(t,n,`cannot be be resolved synchronously, this is caused by using runSync on an effect that performs async work`))},zA=([e],[t])=>e>t?1:e<t?-1:0;function BA(e){return e.sort(zA).map(e=>e[1])}var VA=(e,t)=>{switch(e._tag){case`FinalTransformation`:return t?e.decode:e.encode;case`ComposeTransformation`:return M;case`TypeLiteralTransformation`:return n=>{let r=M(n);for(let n of e.propertySignatureTransformations){let[e,i]=t?[n.from,n.to]:[n.to,n.from],a=t?n.decode:n.encode;r=hA(r,t=>{let n=a(Object.prototype.hasOwnProperty.call(t,e)?F(t[e]):P());return delete t[e],ti(n)&&(t[i]=n.value),t})}return r}}},HA=(e,t=[])=>({value:e,forest:t}),UA={formatIssue:e=>hA(uj(e),WA),formatIssueSync:e=>{let t=UA.formatIssue(e);return pA(t)?qr(t):zE(t)},formatError:e=>UA.formatIssue(e.issue),formatErrorSync:e=>UA.formatIssueSync(e.issue)},WA=e=>e.value+GA(`
266
- `,e.forest),GA=(e,t)=>{let n=``,r=t.length,i;for(let a=0;a<r;a++){i=t[a];let o=a===r-1;n+=e+(o?`└`:`├`)+`─ `+i.value,n+=GA(e+(r>1&&!o?`│ `:` `),i.forest)}return n},KA=e=>{switch(e){case`Encoded`:return`Encoded side transformation failure`;case`Transformation`:return`Transformation process failure`;case`Type`:return`Type side transformation failure`}},qA=e=>{switch(e){case`From`:return`From side refinement failure`;case`Predicate`:return`Predicate refinement failure`}},JA=e=>`ast`in e?F(e.ast):P(),YA=M(void 0),XA=e=>JA(e).pipe(pi(fO),ni({onNone:()=>YA,onSome:t=>{let n=t(e);return Nt(n)?M({message:n,override:!1}):OE(n)?NE(n,e=>({message:e,override:!1})):Nt(n.message)?M({message:n.message,override:n.override}):NE(n.message,e=>({message:e,override:n.override}))}})),ZA=e=>t=>t._tag===e,QA=ZA(`Composite`),$A=ZA(`Refinement`),ej=ZA(`Transformation`),tj=e=>mA(XA(e),t=>t===void 0?YA:!t.override&&(QA(e)||$A(e)&&e.kind===`From`||ej(e)&&e.kind!==`Transformation`)?ej(e)||$A(e)?tj(e.issue):YA:M(t.message)),nj=e=>JA(e).pipe(pi(CO),mi(t=>t(e)),ci);function rj(e){return _O(e).pipe(ai(()=>mO(e)),ai(()=>hO(e)),ai(()=>gO(e)),ii(()=>`{ ${e.from} | filter }`))}function ij(e){return e.message===void 0?`Expected ${Ck(e.ast)?rj(e.ast):String(e.ast)}, actual ${Mn(e.actual)}`:e.message}var aj=e=>hA(tj(e),t=>t??nj(e)??ij(e)),oj=e=>nj(e)??String(e.ast),sj=e=>e.message??`is forbidden`,cj=e=>e.message??`is unexpected`,lj=e=>{let t=pO(e.ast);if(ti(t)){let e=t.value();return Nt(e)?M(e):e}return M(e.message??`is missing`)},uj=e=>{switch(e._tag){case`Type`:return hA(aj(e),HA);case`Forbidden`:return M(HA(oj(e),[HA(sj(e))]));case`Unexpected`:return M(HA(cj(e)));case`Missing`:return hA(lj(e),HA);case`Transformation`:return mA(tj(e),t=>t===void 0?hA(uj(e.issue),t=>HA(oj(e),[HA(KA(e.kind),[t])])):M(HA(t)));case`Refinement`:return mA(tj(e),t=>t===void 0?hA(uj(e.issue),t=>HA(oj(e),[HA(qA(e.kind),[t])])):M(HA(t)));case`Pointer`:return hA(uj(e.issue),t=>HA(lD(e.path),[t]));case`Composite`:return mA(tj(e),t=>{if(t!==void 0)return M(HA(t));let n=oj(e);return oD(e.issues)?hA(kE(e.issues,uj),e=>HA(n,e)):hA(uj(e.issues),e=>HA(n,[e]))})}},dj=y(e=>Ht(e[0]),(e,...t)=>{let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}),fj=y(e=>Ht(e[0]),(e,...t)=>{let n={...e};for(let e of t)delete n[e];return n}),pj=Symbol.for(`effect/Schema`);function mj(e){return class{[pj]=hj;static ast=e;static annotations(e){return mj(vj(this.ast,e))}static pipe(){return j(this,arguments)}static toString(){return String(e)}static Type;static Encoded;static Context;static[pj]=hj}}var hj={_A:e=>e,_I:e=>e,_R:e=>e},gj={typeConstructor:VD,schemaId:UD,message:WD,missingMessage:GD,identifier:KD,title:qD,description:YD,examples:XD,default:ZD,documentation:nO,jsonSchema:QD,arbitrary:$D,pretty:eO,equivalence:tO,concurrency:rO,batching:iO,parseIssueTitle:aO,parseOptions:oO,decodingFallback:sO},_j=e=>{if(!e)return{};let t={...e};for(let n in gj)if(n in e){let r=gj[n];t[r]=e[n],delete t[n]}return t},vj=(e,t)=>Ak(e,_j(t));function yj(e){return e}var bj=e=>String(e.ast),xj=e=>mj(Bk(e.ast)),Sj=e=>C(e,pj)&&Ht(e[pj]);function Cj(e){return _k(e)?hk.make(gk(e,e=>new IO(e))):new IO(e[0])}function wj(e,t=Cj(e)){return class extends mj(t){static annotations(e){return wj(this.literals,vj(this.ast,e))}static literals=[...e]}}function B(...e){return Ii(e)?wj(e):Mj}var Tj=(e,t,n)=>Dj(e,new NO(e.map(e=>e.ast),(...e)=>t.decode(...e.map(mj)),(...e)=>t.encode(...e.map(mj)),_j(n))),Ej=(e,t)=>{let n=()=>(t,n,r)=>e(t)?lA(t):uA(new iA(r,t));return Dj([],new NO([],n,n,_j(t)))};function Dj(e,t){return class extends mj(t){static annotations(e){return Dj(this.typeParameters,vj(this.ast,e))}static typeParameters=[...e]}}var Oj=function(){if(Array.isArray(arguments[0])){let e=arguments[0],t=arguments[1],n=arguments[2];return Tj(e,t,n)}let e=arguments[0],t=arguments[1];return Ej(e,t)},kj=Symbol.for(`effect/SchemaId/InstanceOf`),Aj=(e,t)=>Oj(t=>t instanceof e,{title:e.name,description:`an instance of ${e.name}`,pretty:()=>String,schemaId:kj,[kj]:{constructor:e},...t}),jj=class extends mj(BO){},V=class extends mj(RO){},Mj=class extends mj(VO){},H=class extends mj(UO){},Nj=class extends mj(YO){},Pj=class extends mj(XO){},U=class extends mj(GO){},W=class extends mj(qO){},Fj=class extends mj(JO){},Ij=class extends mj(QO){},Lj=e=>hk.make(e.map(e=>e.ast));function Rj(e,t=Lj(e)){return class extends mj(t){static annotations(e){return Rj(this.members,vj(this.ast,e))}static members=[...e]}}function G(...e){return _k(e)?Rj(e):Ii(e)?e[0]:Mj}var K=e=>G(e,V),zj=e=>G(e,jj),Bj=e=>new Vj(new ek(e.ast,!1),e),Vj=class e{ast;from;[pj];_Token;constructor(e,t){this.ast=e,this.from=t}annotations(t){return new e(new ek(this.ast.type,this.ast.isOptional,{...this.ast.annotations,..._j(t)}),this.from)}toString(){return`${this.ast.type}${this.ast.isOptional?`?`:``}`}},Hj=(e,t)=>new nk(e.map(e=>Sj(e)?new ek(e.ast,!1):e.ast),t.map(e=>Sj(e)?new $O(e.ast):e.ast),!0);function Uj(e,t,n=Hj(e,t)){return class extends mj(n){static annotations(e){return Uj(this.elements,this.rest,vj(this.ast,e))}static elements=[...e];static rest=[...t]}}function Wj(...e){return Array.isArray(e[0])?Uj(e[0],e.slice(1)):Uj(e,[])}function Gj(e,t){return class extends Uj([],[e],t){static annotations(e){return Gj(this.value,vj(this.ast,e))}static value=e}}var q=e=>Gj(e),Kj=e=>e?`"?:"`:`":"`,qj=class extends ek{isReadonly;defaultValue;_tag=`PropertySignatureDeclaration`;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}toString(){let e=Kj(this.isOptional),t=String(this.type);return`PropertySignature<${e}, ${t}, never, ${e}, ${t}>`}},Jj=class extends ek{isReadonly;defaultValue;constructor(e,t,n,r,i){super(e,t,r),this.isReadonly=n,this.defaultValue=i}},Yj=e=>e===void 0?`never`:Nt(e)?JSON.stringify(e):String(e),Xj=class{from;to;decode;encode;_tag=`PropertySignatureTransformation`;constructor(e,t,n,r){this.from=e,this.to=t,this.decode=n,this.encode=r}toString(){return`PropertySignature<${Kj(this.to.isOptional)}, ${this.to.type}, ${Yj(this.from.fromKey)}, ${Kj(this.from.isOptional)}, ${this.from.type}>`}},Zj=(e,t)=>{switch(e._tag){case`PropertySignatureDeclaration`:return new qj(e.type,e.isOptional,e.isReadonly,{...e.annotations,...t},e.defaultValue);case`PropertySignatureTransformation`:return new Xj(e.from,new Jj(e.to.type,e.to.isOptional,e.to.isReadonly,{...e.to.annotations,...t},e.to.defaultValue),e.decode,e.encode)}},Qj=Symbol.for(`effect/PropertySignature`),$j=e=>C(e,Qj),eM=class e{ast;[pj];[Qj]=null;_TypeToken;_Key;_EncodedToken;_HasDefault;constructor(e){this.ast=e}pipe(){return j(this,arguments)}annotations(t){return new e(Zj(this.ast,_j(t)))}toString(){return String(this.ast)}},tM=e=>new eM(e),nM=class e extends eM{from;constructor(e,t){super(e),this.from=t}annotations(t){return new e(Zj(this.ast,_j(t)),this.from)}},rM=e=>new nM(new qj(e.ast,!1,!0,{},void 0),e),iM=y(2,(e,t)=>{let n=e.ast;switch(n._tag){case`PropertySignatureDeclaration`:return tM(new qj(n.type,n.isOptional,n.isReadonly,n.annotations,t));case`PropertySignatureTransformation`:return tM(new Xj(n.from,new Jj(n.to.type,n.to.isOptional,n.to.isReadonly,n.to.annotations,t),n.decode,n.encode))}}),J=e=>new nM(new qj(e.ast===BO||e.ast===VO?BO:zj(e).ast,!0,!0,{},void 0),e),aM=Rk([GD]),oM=(e,t)=>{let n=Reflect.ownKeys(e),r=[];if(n.length>0){let i=[],a=[],o=[];for(let t=0;t<n.length;t++){let s=n[t],c=e[s];if($j(c)){let e=c.ast;switch(e._tag){case`PropertySignatureDeclaration`:{let t=e.type,n=e.isOptional,o=e.annotations;i.push(new ik(s,t,n,!0,aM(e))),a.push(new ik(s,Bk(t),n,!0,o)),r.push(new ik(s,t,n,!0,o));break}case`PropertySignatureTransformation`:{let t=e.from.fromKey??s;i.push(new ik(t,e.from.type,e.from.isOptional,!0,e.from.annotations)),a.push(new ik(s,e.to.type,e.to.isOptional,!0,e.to.annotations)),o.push(new Ok(t,s,e.decode,e.encode));break}}}else i.push(new ik(s,c.ast,!1,!0)),a.push(new ik(s,Bk(c.ast),!1,!0)),r.push(new ik(s,c.ast,!1,!0))}if(Ii(o)){let e=[],n=[];for(let r of t){let{indexSignatures:t,propertySignatures:o}=Lk(r.key.ast,r.value.ast);o.forEach(e=>{i.push(e),a.push(new ik(e.name,Bk(e.type),e.isOptional,e.isReadonly,e.annotations))}),t.forEach(t=>{e.push(t),n.push(new ok(t.parameter,Bk(t.type),t.isReadonly))})}return new Tk(new sk(i,e,{[JD]:`Struct (Encoded side)`}),new sk(a,n,{[JD]:`Struct (Type side)`}),new kk(o))}}let i=[];for(let e of t){let{indexSignatures:t,propertySignatures:n}=Lk(e.key.ast,e.value.ast);n.forEach(e=>r.push(e)),t.forEach(e=>i.push(e))}return new sk(r,i)},sM=(e,t)=>{let n=Reflect.ownKeys(e);for(let r of n){let n=e[r];if(t[r]===void 0&&$j(n)){let e=n.ast,i=e._tag===`PropertySignatureDeclaration`?e.defaultValue:e.to.defaultValue;i!==void 0&&(t[r]=i())}}return t};function cM(e,t,n=oM(e,t)){return class extends mj(n){static annotations(e){return cM(this.fields,this.records,vj(this.ast,e))}static fields={...e};static records=[...t];static make=(t,n)=>{let r=sM(e,{...t});return vP(n)?r:DA(this)(r)};static pick(...t){return Y(dj(e,...t))}static omit(...t){return Y(fj(e,...t))}}}function Y(e,...t){return cM(e,t)}var lM=e=>B(e).pipe(rM,iM(()=>e)),uM=(e,t)=>Y({_tag:lM(e),...t});function dM(e,t,n){return class extends cM({},[{key:e,value:t}],n){static annotations(n){return dM(e,t,vj(this.ast,n))}static key=e;static value=t}}var X=e=>dM(e.key,e.value),fM=e=>mj(new bk(()=>e().ast)),pM=Symbol.for(`effect/SchemaId/Refine`);function mM(e,t,n){return class extends mj(n){static annotations(e){return mM(this.from,this.filter,vj(this.ast,e))}static[pM]=e;static from=e;static filter=t;static make=(e,t)=>vP(t)?e:DA(this)(e)}}var hM=(e,t,n)=>{if(Ft(e))return e?P():F(new iA(t,n));if(Nt(e))return F(new iA(t,n,e));if(e!==void 0){if(`_tag`in e)return F(e);let r=new iA(t,n,e.message);return F(Ii(e.path)?new Qk(e.path,n,r):r)}return P()},gM=(e,t,n)=>{if(sD(e))return hM(e,t,n);if(Ii(e)){let r=ua(e,e=>hM(e,t,n));if(Ii(r))return F(r.length===1?r[0]:new tA(t,n,r))}return P()};function Z(e,t){return n=>{function r(t,n,r){return gM(e(t,n,r),r,t)}return mM(n,r,new Sk(n.ast,r,_j(t)))}}function _M(e,t,n){return class extends mj(n){static annotations(e){return _M(this.from,this.to,vj(this.ast,e))}static from=e;static to=t}}var vM=y(e=>Sj(e[0])&&Sj(e[1]),(e,t,n)=>_M(e,t,new Tk(e.ast,t.ast,new Dk(n.decode,n.encode)))),yM=y(e=>Sj(e[0])&&Sj(e[1]),(e,t,n)=>vM(e,t,{strict:!0,decode:(e,t,r,i)=>lA(n.decode(e,i)),encode:(e,t,r,i)=>lA(n.encode(e,i))})),bM=Symbol.for(`effect/SchemaId/Trimmed`),xM=e=>t=>t.pipe(Z(e=>e===e.trim(),{schemaId:bM,title:`trimmed`,description:`a string with no leading or trailing whitespace`,jsonSchema:{pattern:`^\\S[\\s\\S]*\\S$|^\\S$|^$`},...e})),SM=LD,CM=(e,t)=>n=>n.pipe(Z(t=>t.length<=e,{schemaId:SM,title:`maxLength(${e})`,description:`a string at most ${e} character(s) long`,jsonSchema:{maxLength:e},...t})),wM=ID,TM=(e,t)=>n=>n.pipe(Z(t=>t.length>=e,{schemaId:wM,title:`minLength(${e})`,description:`a string at least ${e} character(s) long`,jsonSchema:{minLength:e},...t})),EM=RD,DM=(e,t)=>n=>{let r=Ht(e)?Math.max(0,Math.floor(e.min)):Math.max(0,Math.floor(e)),i=Ht(e)?Math.max(r,Math.floor(e.max)):r;return r===i?n.pipe(Z(e=>e.length===r,{schemaId:EM,title:`length(${r})`,description:r===1?`a single character`:`a string ${r} character(s) long`,jsonSchema:{minLength:r,maxLength:r},...t})):n.pipe(Z(e=>e.length>=r&&e.length<=i,{schemaId:EM,title:`length({ min: ${r}, max: ${i})`,description:`a string at least ${r} character(s) and at most ${i} character(s) long`,jsonSchema:{minLength:r,maxLength:i},...t}))},OM=Symbol.for(`effect/SchemaId/Pattern`),kM=(e,t)=>n=>{let r=e.source;return n.pipe(Z(t=>(e.lastIndex=0,e.test(t)),{schemaId:OM,[OM]:{regex:e},description:`a string matching the pattern ${r}`,jsonSchema:{pattern:r},...t}))},AM=Symbol.for(`effect/SchemaId/Lowercased`),jM=e=>t=>t.pipe(Z(e=>e===e.toLowerCase(),{schemaId:AM,title:`lowercased`,description:`a lowercase string`,jsonSchema:{pattern:`^[^A-Z]*$`},...e})),MM=class extends U.pipe(jM({identifier:`Lowercased`})){},NM=Symbol.for(`effect/SchemaId/Uppercased`),PM=e=>t=>t.pipe(Z(e=>e===e.toUpperCase(),{schemaId:NM,title:`uppercased`,description:`an uppercase string`,jsonSchema:{pattern:`^[^a-z]*$`},...e})),FM=class extends U.pipe(PM({identifier:`Uppercased`})){},IM=Symbol.for(`effect/SchemaId/Capitalized`),LM=e=>t=>t.pipe(Z(e=>e[0]?.toUpperCase()===e[0],{schemaId:IM,title:`capitalized`,description:`a capitalized string`,jsonSchema:{pattern:`^[^a-z]?.*$`},...e})),RM=class extends U.pipe(LM({identifier:`Capitalized`})){},zM=Symbol.for(`effect/SchemaId/Uncapitalized`),BM=e=>t=>t.pipe(Z(e=>e[0]?.toLowerCase()===e[0],{schemaId:zM,title:`uncapitalized`,description:`a uncapitalized string`,jsonSchema:{pattern:`^[^A-Z]?.*$`},...e})),VM=class extends U.pipe(BM({identifier:`Uncapitalized`})){};U.pipe(DM(1,{identifier:`Char`}));var HM=e=>TM(1,{title:`nonEmptyString`,description:`a non empty string`,...e});yM(U.annotations({description:`a string that will be converted to lowercase`}),MM,{strict:!0,decode:e=>e.toLowerCase(),encode:b}).annotations({identifier:`Lowercase`}),yM(U.annotations({description:`a string that will be converted to uppercase`}),FM,{strict:!0,decode:e=>e.toUpperCase(),encode:b}).annotations({identifier:`Uppercase`}),yM(U.annotations({description:`a string that will be converted to a capitalized format`}),RM,{strict:!0,decode:e=>xE(e),encode:b}).annotations({identifier:`Capitalize`}),yM(U.annotations({description:`a string that will be converted to an uncapitalized format`}),VM,{strict:!0,decode:e=>SE(e),encode:b}).annotations({identifier:`Uncapitalize`});var UM=class extends U.pipe(xM({identifier:`Trimmed`})){},WM=class extends UM.pipe(HM({identifier:`NonEmptyTrimmedString`})){};yM(U.annotations({description:`a string that will be trimmed`}),UM,{strict:!0,decode:e=>e.trim(),encode:b}).annotations({identifier:`Trim`});var GM=e=>e instanceof Error?e.message:String(e);U.pipe(HM({identifier:`NonEmptyString`}));var KM=Symbol.for(`effect/SchemaId/UUID`),qM=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;U.pipe(kM(qM,{schemaId:KM,identifier:`UUID`,jsonSchema:{format:`uuid`,pattern:qM.source},description:`a Universally Unique Identifier`,arbitrary:()=>e=>e.uuid()}));var JM=Symbol.for(`effect/SchemaId/ULID`);U.pipe(kM(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i,{schemaId:JM,identifier:`ULID`,description:`a Universally Unique Lexicographically Sortable Identifier`,arbitrary:()=>e=>e.ulid()}));var YM=class extends Aj(URL,{typeConstructor:{_tag:`URL`},identifier:`URLFromSelf`,arbitrary:()=>e=>e.webUrl().map(e=>new URL(e)),pretty:()=>e=>e.toString()}){};vM(U.annotations({description:`a string to be decoded into a URL`}),YM,{strict:!0,decode:(e,t,n)=>dA({try:()=>new URL(e),catch:t=>new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a URL. ${GM(t)}`)}),encode:e=>lA(e.toString())}).annotations({identifier:`URL`,pretty:()=>e=>e.toString()});var XM=jD,ZM=e=>t=>t.pipe(Z(Number.isFinite,{schemaId:XM,title:`finite`,description:`a finite number`,jsonSchema:{},...e})),QM=TD,$M=(e,t)=>n=>n.pipe(Z(t=>t>e,{schemaId:QM,title:`greaterThan(${e})`,description:e===0?`a positive number`:`a number greater than ${e}`,jsonSchema:{exclusiveMinimum:e},...t})),eN=ED,tN=(e,t)=>n=>n.pipe(Z(t=>t>=e,{schemaId:eN,title:`greaterThanOrEqualTo(${e})`,description:e===0?`a non-negative number`:`a number greater than or equal to ${e}`,jsonSchema:{minimum:e},...t})),nN=kD,rN=e=>t=>t.pipe(Z(e=>Number.isSafeInteger(e),{schemaId:nN,title:`int`,description:`an integer`,jsonSchema:{type:`integer`},...e})),iN=DD,aN=(e,t)=>n=>n.pipe(Z(t=>t<e,{schemaId:iN,title:`lessThan(${e})`,description:e===0?`a negative number`:`a number less than ${e}`,jsonSchema:{exclusiveMaximum:e},...t})),oN=OD,sN=(e,t)=>n=>n.pipe(Z(t=>t<=e,{schemaId:oN,title:`lessThanOrEqualTo(${e})`,description:e===0?`a non-positive number`:`a number less than or equal to ${e}`,jsonSchema:{maximum:e},...t})),cN=ND,lN=(e,t,n)=>r=>r.pipe(Z(n=>n>=e&&n<=t,{schemaId:cN,title:`between(${e}, ${t})`,description:`a number between ${e} and ${t}`,jsonSchema:{minimum:e,maximum:t},...n})),uN=AD,dN=e=>t=>t.pipe(Z(e=>!Number.isNaN(e),{schemaId:uN,title:`nonNaN`,description:`a number excluding NaN`,...e})),fN=e=>$M(0,{title:`positive`,...e}),pN=e=>aN(0,{title:`negative`,...e}),mN=e=>sN(0,{title:`nonPositive`,...e}),hN=e=>tN(0,{title:`nonNegative`,...e});function gN(e){return vM(e,W,{strict:!1,decode:(e,t,n)=>fA(jg(e),()=>new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a number`)),encode:e=>lA(String(e))})}gN(U.annotations({description:`a string to be decoded into a number`})).annotations({identifier:`NumberFromString`}),W.pipe(ZM({identifier:`Finite`}));var _N=class extends W.pipe(rN({identifier:`Int`})){};W.pipe(dN({identifier:`NonNaN`})),W.pipe(fN({identifier:`Positive`})),W.pipe(pN({identifier:`Negative`})),W.pipe(mN({identifier:`NonPositive`}));var vN=class extends W.pipe(hN({identifier:`NonNegative`})){},yN=MD;W.pipe(ZM({schemaId:yN,identifier:`JsonNumber`})),yM(Fj.annotations({description:`a boolean that will be negated`}),Fj,{strict:!0,decode:e=>Ha(e),encode:e=>Ha(e)});var bN=(e,t)=>{let n=Symbol.keyFor(e);return n===void 0?uA(new iA(t,e,`Unable to encode a unique symbol ${String(e)} into a string`)):lA(n)},xN=e=>lA(Symbol.for(e));vM(U.annotations({description:`a string to be decoded into a globally shared symbol`}),Pj,{strict:!1,decode:e=>xN(e),encode:(e,t,n)=>bN(e,n)}).annotations({identifier:`Symbol`});var SN=PD,CN=(e,t)=>n=>n.pipe(Z(t=>t>=e,{schemaId:SN,[SN]:{min:e},title:`greaterThanOrEqualToBigInt(${e})`,description:e===0n?`a non-negative bigint`:`a bigint greater than or equal to ${e}n`,...t})),wN=FD,TN=(e,t,n)=>r=>r.pipe(Z(n=>n>=e&&n<=t,{schemaId:wN,[wN]:{min:e,max:t},title:`betweenBigInt(${e}, ${t})`,description:`a bigint between ${e}n and ${t}n`,...n})),EN=e=>CN(0n,{title:`nonNegativeBigInt`,...e}),DN=class extends vM(U.annotations({description:`a string to be decoded into a bigint`}),Nj,{strict:!0,decode:(e,t,n)=>fA(Ba(e),()=>new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a bigint`)),encode:e=>lA(String(e))}).annotations({identifier:`BigInt`}){},ON=Nj.pipe(EN({identifier:`NonNegativeBigintFromSelf`}));vM(W.annotations({description:`a number to be decoded into a bigint`}),Nj.pipe(TN(BigInt(-(2**53-1)),BigInt(2**53-1))),{strict:!0,decode:(e,t,n)=>fA(Va(e),()=>new iA(n,e,`Unable to decode ${e} into a bigint`)),encode:(e,t,n)=>fA(za(e),()=>new iA(n,e,`Unable to encode ${e}n into a number`))}).annotations({identifier:`BigIntFromNumber`});var kN=(e,t,n,r)=>_A(e,{onFailure:e=>new tA(n,r,e),onSuccess:t}),AN=class extends Oj(Hl,{typeConstructor:{_tag:`effect/Duration`},identifier:`DurationFromSelf`,pretty:()=>String,arbitrary:()=>e=>e.oneof(e.constant(Kl),e.bigInt({min:0n}).map(e=>ql(e)),e.maxSafeNat().map(e=>Yl(e))),equivalence:()=>su}){};vM(ON.annotations({description:`a bigint to be decoded into a Duration`}),AN.pipe(Z(e=>Ul(e),{description:`a finite duration`})),{strict:!0,decode:e=>lA(ql(e)),encode:(e,t,n)=>ni(nu(e),{onNone:()=>uA(new iA(n,e,`Unable to encode ${e} into a bigint`)),onSome:e=>lA(e)})}).annotations({identifier:`DurationFromNanos`});var jN=vN.pipe(rN()).annotations({identifier:`NonNegativeInt`});yM(vN.annotations({description:`a non-negative number to be decoded into a Duration`}),AN,{strict:!0,decode:e=>Yl(e),encode:e=>tu(e)}).annotations({identifier:`DurationFromMillis`});var MN=uM(`Millis`,{millis:jN}),NN=uM(`Nanos`,{nanos:DN}),PN=uM(`Infinity`,{}),FN=PN.make({}),IN=G(MN,NN,PN).annotations({identifier:`DurationValue`,description:`an JSON-compatible tagged union to be decoded into a Duration`}),LN=G(Wj(Bj(jN).annotations({title:`seconds`}),Bj(jN).annotations({title:`nanos`})).annotations({identifier:`FiniteHRTime`}),Wj(B(-1),B(0)).annotations({identifier:`InfiniteHRTime`})).annotations({identifier:`HRTime`,description:`a tuple of seconds and nanos to be decoded into a Duration`}),RN=e=>typeof e==`object`;yM(G(IN,LN),AN,{strict:!0,decode:e=>{if(RN(e))switch(e._tag){case`Millis`:return Yl(e.millis);case`Nanos`:return ql(e.nanos);case`Infinity`:return Kl}let[t,n]=e;return t===-1?Kl:ql(BigInt(t)*BigInt(1e9)+BigInt(n))},encode:e=>{switch(e.value._tag){case`Millis`:return MN.make({millis:e.value.millis});case`Nanos`:return NN.make({nanos:e.value.nanos});case`Infinity`:return FN}}}).annotations({identifier:`Duration`});var zN=class extends Oj(Kt,{typeConstructor:{_tag:`Uint8Array`},identifier:`Uint8ArrayFromSelf`,pretty:()=>e=>`new Uint8Array(${JSON.stringify(Array.from(e))})`,arbitrary:()=>e=>e.uint8Array(),equivalence:()=>pa(k)}){};yM(q(class extends W.pipe(lN(0,255,{identifier:`Uint8`,description:`a 8-bit unsigned integer`})){}).annotations({description:`an array of 8-bit unsigned integers to be decoded into a Uint8Array`}),zN,{strict:!0,decode:e=>Uint8Array.from(e),encode:e=>Array.from(e)}).annotations({identifier:`Uint8Array`});var BN=zD,VN=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(dD(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Z(e=>e.length>=r,{schemaId:BN,title:`minItems(${r})`,description:`an array of at least ${r} item(s)`,jsonSchema:{minItems:r},[lO]:!0,...t}))},HN=BD,UN=(e,t)=>n=>{let r=Math.floor(e);if(r<1)throw Error(dD(`Expected an integer greater than or equal to 1, actual ${e}`));return n.pipe(Z(e=>e.length<=r,{schemaId:HN,title:`maxItems(${r})`,description:`an array of at most ${r} item(s)`,jsonSchema:{maxItems:r},[lO]:!0,...t}))},WN=Symbol.for(`effect/SchemaId/ValidDate`),GN=e=>t=>t.pipe(Z(e=>!Number.isNaN(e.getTime()),{schemaId:WN,[WN]:{noInvalidDate:!0},title:`validDate`,description:`a valid Date`,...e})),KN=wD,qN=class extends Oj(qt,{typeConstructor:{_tag:`Date`},identifier:`DateFromSelf`,schemaId:KN,[KN]:{noInvalidDate:!1},description:`a potentially invalid Date instance`,pretty:()=>e=>`new Date(${JSON.stringify(e)})`,arbitrary:()=>e=>e.date({noInvalidDate:!1}),equivalence:()=>Dt}){};qN.pipe(GN({identifier:`ValidDateFromSelf`,description:`a valid Date instance`})),class extends yM(U.annotations({description:`a string to be decoded into a Date`}),qN,{strict:!0,decode:e=>new Date(e),encode:e=>kn(e)}).annotations({identifier:`DateFromString`}){}.pipe(GN({identifier:`Date`})),yM(W.annotations({description:`a number to be decoded into a Date`}),qN,{strict:!0,decode:e=>new Date(e),encode:e=>e.getTime()}).annotations({identifier:`DateFromNumber`});var JN=class extends Oj(e=>BE(e)&&UE(e),{typeConstructor:{_tag:`effect/DateTime.Utc`},identifier:`DateTimeUtcFromSelf`,description:`a DateTime.Utc instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.date({noInvalidDate:!0}).map(e=>KE(e)),equivalence:()=>GE}){},YN=(e,t)=>dA({try:()=>qE(e),catch:()=>new iA(t,e,`Unable to decode ${Mn(e)} into a DateTime.Utc`)});vM(W.annotations({description:`a number to be decoded into a DateTime.Utc`}),JN,{strict:!0,decode:(e,t,n)=>YN(e,n),encode:e=>lA(tD(e))}).annotations({identifier:`DateTimeUtcFromNumber`}),vM(qN.annotations({description:`a Date to be decoded into a DateTime.Utc`}),JN,{strict:!0,decode:(e,t,n)=>YN(e,n),encode:e=>lA(eD(e))}).annotations({identifier:`DateTimeUtcFromDate`}),vM(U.annotations({description:`a string to be decoded into a DateTime.Utc`}),JN,{strict:!0,decode:(e,t,n)=>YN(e,n),encode:e=>lA(nD(e))}).annotations({identifier:`DateTimeUtc`});var XN=()=>e=>e.integer({min:-720*60*1e3,max:840*60*1e3}).map(ZE),ZN=class extends Oj(VE,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Offset`},identifier:`TimeZoneOffsetFromSelf`,description:`a TimeZone.Offset instance`,pretty:()=>e=>e.toString(),arbitrary:XN}){};yM(W.annotations({description:`a number to be decoded into a TimeZone.Offset`}),ZN,{strict:!0,decode:e=>ZE(e),encode:e=>e.offset}).annotations({identifier:`TimeZoneOffset`});var QN=()=>e=>e.constantFrom(...Intl.supportedValuesOf(`timeZone`)).map(XE),$N=class extends Oj(HE,{typeConstructor:{_tag:`effect/DateTime.TimeZone.Named`},identifier:`TimeZoneNamedFromSelf`,description:`a TimeZone.Named instance`,pretty:()=>e=>e.toString(),arbitrary:QN}){};vM(U.annotations({description:`a string to be decoded into a TimeZone.Named`}),$N,{strict:!0,decode:(e,t,n)=>dA({try:()=>XE(e),catch:()=>new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone.Named`)}),encode:e=>lA(e.id)}).annotations({identifier:`TimeZoneNamed`});var eP=class extends G(ZN,$N){};vM(U.annotations({description:`a string to be decoded into a TimeZone`}),eP,{strict:!0,decode:(e,t,n)=>ni(QE(e),{onNone:()=>uA(new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a TimeZone`)),onSome:lA}),encode:e=>lA($E(e))}).annotations({identifier:`TimeZone`});var tP=e=>e.oneof(XN()(e),QN()(e)),nP=class extends Oj(e=>BE(e)&&WE(e),{typeConstructor:{_tag:`effect/DateTime.Zoned`},identifier:`DateTimeZonedFromSelf`,description:`a DateTime.Zoned instance`,pretty:()=>e=>e.toString(),arbitrary:()=>e=>e.tuple(e.integer({min:-31536e9,max:31536e9}),tP(e)).map(([e,t])=>JE(e,{timeZone:t})),equivalence:()=>GE}){};vM(U.annotations({description:`a string to be decoded into a DateTime.Zoned`}),nP,{strict:!0,decode:(e,t,n)=>ni(YE(e),{onNone:()=>uA(new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a DateTime.Zoned`)),onSome:lA}),encode:e=>lA(rD(e))}).annotations({identifier:`DateTimeZoned`});var rP=e=>e._tag===`None`?P():F(e.value),iP=(e,t)=>n=>n.oneof(t,n.record({_tag:n.constant(`None`)}),n.record({_tag:n.constant(`Some`),value:e(n)})).map(rP),aP=e=>ni({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`}),oP=e=>(t,n,r)=>$r(t)?ei(t)?lA(P()):kN(e(t.value,n),F,r,t):uA(new iA(r,t)),sP=e=>Oj([e],{decode:e=>oP(TA(e)),encode:e=>oP(EA(e))},{typeConstructor:{_tag:`effect/Option`},pretty:aP,arbitrary:iP,equivalence:_i});yM(U,(e=>sP(e).annotations({description:`Option<${bj(e)}>`}))(WM),{strict:!0,decode:e=>gi(F(e.trim()),CE),encode:e=>ii(e,()=>``)});var cP=(e,t)=>n=>{let r=n.array(e(n));return(t.depthIdentifier===void 0?r:n.oneof(t,n.constant([]),r)).map(e=>new Set(e))},lP=e=>t=>`new Set([${Array.from(t.values()).map(t=>e(t)).join(`, `)}])`,uP=e=>{let t=pa(e);return wt((e,n)=>t(Array.from(e.values()),Array.from(n.values())))},dP=e=>(t,n,r)=>Mt(t)?kN(e(Array.from(t.values()),n),e=>new Set(e),r,t):uA(new iA(r,t)),fP=(e,t)=>Oj([e],{decode:e=>dP(TA(q(e))),encode:e=>dP(EA(q(e)))},{typeConstructor:{_tag:`ReadonlySet`},description:t,pretty:lP,arbitrary:cP,equivalence:uP}),pP=e=>fP(e,`Set<${bj(e)}>`);function mP(e){return yM(q(e),pP(xj(yj(e))),{strict:!0,decode:e=>new Set(e),encode:e=>Array.from(e)})}var hP=()=>e=>`BigDecimal(${Pa(Ea(e))})`,gP=()=>e=>e.tuple(e.bigInt(),e.integer({min:-18,max:18})).map(([e,t])=>xa(e,t)),_P=class extends Oj(ba,{typeConstructor:{_tag:`effect/BigDecimal`},identifier:`BigDecimalFromSelf`,pretty:hP,arbitrary:gP,equivalence:()=>ka}){};vM(U.annotations({description:`a string to be decoded into a BigDecimal`}),_P,{strict:!0,decode:(e,t,n)=>Na(e).pipe(ni({onNone:()=>uA(new iA(n,e,`Unable to decode ${JSON.stringify(e)} into a BigDecimal`)),onSome:e=>lA(Ea(e))})),encode:e=>lA(Pa(Ea(e)))}).annotations({identifier:`BigDecimal`}),yM(W.annotations({description:`a number to be decoded into a BigDecimal`}),_P,{strict:!0,decode:e=>ja(e),encode:e=>Ia(e)}).annotations({identifier:`BigDecimalFromNumber`});function vP(e){return Ft(e)?e:e?.disableValidation??!1}var yP=G(Y({_tag:B(`None`)}).annotations({identifier:`FiberIdNoneEncoded`}),Y({_tag:B(`Runtime`),id:_N,startTimeMillis:_N}).annotations({identifier:`FiberIdRuntimeEncoded`}),Y({_tag:B(`Composite`),left:fM(()=>yP),right:fM(()=>yP)}).annotations({identifier:`FiberIdCompositeEncoded`})).annotations({identifier:`FiberIdEncoded`}),bP=e=>e.letrec(t=>({None:e.record({_tag:e.constant(`None`)}),Runtime:e.record({_tag:e.constant(`Runtime`),id:e.integer(),startTimeMillis:e.integer()}),Composite:e.record({_tag:e.constant(`Composite`),left:t(`FiberId`),right:t(`FiberId`)}),FiberId:e.oneof(t(`None`),t(`Runtime`),t(`Composite`))})).FiberId.map(CP),xP=e=>{switch(e._tag){case`None`:return`FiberId.none`;case`Runtime`:return`FiberId.runtime(${e.id}, ${e.startTimeMillis})`;case`Composite`:return`FiberId.composite(${xP(e.right)}, ${xP(e.left)})`}},SP=class extends Oj(Bu,{typeConstructor:{_tag:`effect/FiberId`},identifier:`FiberIdFromSelf`,pretty:()=>xP,arbitrary:()=>bP}){},CP=e=>{switch(e._tag){case`None`:return Lu;case`Runtime`:return Ru(e.id,e.startTimeMillis);case`Composite`:return zu(CP(e.left),CP(e.right))}},wP=e=>{switch(e._tag){case`None`:return{_tag:`None`};case`Runtime`:return{_tag:`Runtime`,id:e.id,startTimeMillis:e.startTimeMillis};case`Composite`:return{_tag:`Composite`,left:wP(e.left),right:wP(e.right)}}};yM(yP,SP,{strict:!0,decode:e=>CP(e),encode:e=>wP(e)}).annotations({identifier:`FiberId`}),yM(H,H,{strict:!0,decode:e=>{if(Ht(e)&&`message`in e&&typeof e.message==`string`){let t=Error(e.message,{cause:e});return`name`in e&&typeof e.name==`string`&&(t.name=e.name),t.stack=`stack`in e&&typeof e.stack==`string`?e.stack:``,t}return Bc(e)},encode:e=>e instanceof Error?{name:e.name,message:e.message}:Bc(e)}).annotations({identifier:`Defect`}),yM(H,Fj,{strict:!0,decode:e=>jt(e),encode:b}).annotations({identifier:`BooleanFromUnknown`}),yM(B(`true`,`false`).annotations({description:`a string to be decoded into a boolean`}),Fj,{strict:!0,decode:e=>e===`true`,encode:e=>e?`true`:`false`}).annotations({identifier:`BooleanFromString`});var TP=uM(`symbol`,{key:U}).annotations({description:`an object to be decoded into a globally shared symbol`}),EP=vM(TP,Pj,{strict:!0,decode:e=>xN(e.key),encode:(e,t,n)=>hA(bN(e,n),e=>TP.make({key:e}))}),DP=class extends G(U,W,EP).annotations({identifier:`PropertyKey`}){};Y({_tag:rM(B(`Pointer`,`Unexpected`,`Missing`,`Composite`,`Refinement`,`Transformation`,`Type`,`Forbidden`)).annotations({description:`The tag identifying the type of parse issue`}),path:rM(q(DP)).annotations({description:`The path to the property where the issue occurred`}),message:rM(U).annotations({description:`A descriptive message explaining the issue`})}).annotations({identifier:`ArrayFormatterIssue`,description:`Represents an issue returned by the ArrayFormatter formatter`});function OP(e){return e===`job_internal`||e===`job_runtime`}function kP(e){return e===`request`||e===`relaxed_request`||e===`request_internal`||e===`request_internal_dereferenced`||e===`landing_request`||e===`landing_request_internal`}function AP(e){return e===`request`||e===`relaxed_request`||e===`landing_request`}function jP(e){return e===`workflow_step_linked`}function MP(e){return e===`workflow_step_native`}function NP(e){return e===`landing_request`||e===`landing_request_internal`}function PP(e){return e===`workflow_step`||e===`workflow_step_linked`||e===`workflow_step_native`}function FP(e){return e===`test_case_xml`||e===`test_case_json`}function IP(e){return e===`request`||e===`relaxed_request`||e===`request_internal`||e===`landing_request`||e===`landing_request_internal`}var LP=new Map;function RP(e,t){LP.set(e,t)}var zP=G(Y({__class__:B(`ConnectedValue`)}),Y({__class__:B(`RuntimeValue`)})),BP=G(_N,U.pipe(Z(e=>{if(!/^-?\d+$/.test(e))return`String '${e}' is not a valid integer`}))),VP=G(W.pipe(ZM()),U.pipe(Z(e=>{if(isNaN(Number(e))||e.trim()===``)return`String '${e}' is not a valid number`})));function HP(e){return e.startsWith(`_`)?{name:`X${e}`,alias:e}:{name:e}}function UP(e,t){return OP(e)?!1:NP(e)?!0:!t}var WP=new Map;function GP(e,t){WP.set(e,t)}function KP(e,t){let n=e;for(let e of t){let t=WP.get(e.type);t&&(n=t(n,e))}return n}function qP(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t))o=BP,r.optional&&(o=K(o)),o=G(o,zP),s=!0;else{o=_N;let e=[...r.validators];(r.min!==null||r.max!==null)&&e.push({type:`in_range`,min:r.min,max:r.max,exclude_min:!1,exclude_max:!1,negate:!1}),o=KP(o,e),r.optional&&(o=K(o))}let c=UP(t,!r.optional&&r.value===null);return{name:i,alias:a,schema:o,isOptional:c,connectedValueHandled:s}}RP(`gx_integer`,qP);function JP(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t))o=VP,r.optional&&(o=K(o)),o=G(o,zP),s=!0;else{o=W.pipe(ZM());let e=[...r.validators];(r.min!==null||r.max!==null)&&e.push({type:`in_range`,min:r.min,max:r.max,exclude_min:!1,exclude_max:!1,negate:!1}),o=KP(o,e),r.optional&&(o=K(o))}let c=UP(t,!r.optional&&r.value===null);return{name:i,alias:a,schema:o,isOptional:c,connectedValueHandled:s}}RP(`gx_float`,JP);function YP(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t)){let e=G(Fj,B(`true`,`false`,`True`,`False`));r.optional&&(e=K(e)),o=G(e,zP),s=!0}else o=Fj;let c=UP(t,!1);return{name:i,alias:a,schema:o,isOptional:c,connectedValueHandled:s}}RP(`gx_boolean`,YP);function XP(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=U;o=KP(o,r.validators),(r.optional||t===`relaxed_request`)&&(o=K(o));let s=UP(t,!r.optional&&r.value===null);return{name:i,alias:a,schema:o,isOptional:s}}RP(`gx_text`,XP);function ZP(e,t,n){let{name:r,alias:i}=HP(e.name),a,o=!1;MP(t)?(a=G(U.pipe(kM(/^#[0-9a-fA-F]{6}$/)),zP),o=!0):a=U.pipe(kM(/^#[0-9a-fA-F]{6}$/));let s=UP(t,!1);return{name:r,alias:i,schema:a,isOptional:s,connectedValueHandled:o}}RP(`gx_color`,ZP);function QP(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=U;o=KP(o,r.validators);let s=!1;MP(t)?(o=G(o,zP),s=!0,r.optional||(o=K(o))):r.optional&&(o=K(o));let c=!r.optional&&r.value===null;MP(t)&&!r.optional&&(c=!1);let l=UP(t,c);return{name:i,alias:a,schema:o,isOptional:l,connectedValueHandled:s}}RP(`gx_hidden`,QP);function $P(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o;o=r.options&&r.options.length>0?G(...r.options.map(e=>B(e.value))):U;let s,c=!1;if(MP(t))s=r.multiple?G(q(o),U):o,(r.optional||r.multiple)&&(s=K(s)),s=G(s,zP),c=!0;else if(r.multiple){let e=o;if(jP(t)){let t=Y({__class__:B(`ConnectedValue`)});e=G(o,t),c=!0}s=t===`test_case_xml`?G(K(q(o)),U):K(q(e))}else s=r.optional?K(o):o;let l=UP(t,!1);return{name:i,alias:a,schema:s,isOptional:l,connectedValueHandled:c}}RP(`gx_select`,$P);function eF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=U.pipe(kM(/^gx[a-z]+:\/\//));o=KP(o,r.validators),r.optional&&(o=K(o));let s=UP(t,!r.optional&&r.value===null);return{name:i,alias:a,schema:o,isOptional:s}}RP(`gx_directory_uri`,eF);function tF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=U,s;s=r.multiple?K(q(o)):r.optional?K(o):o;let c=UP(t,!1);return{name:i,alias:a,schema:s,isOptional:c}}RP(`gx_genomebuild`,tF);function nF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=U;r.optional&&(o=K(o));let s=UP(t,!r.optional&&r.value===null);return{name:i,alias:a,schema:o,isOptional:s}}RP(`gx_baseurl`,nF);function rF(e){return e.test_parameter.parameter_type===`gx_boolean`}function iF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=HP(r.test_parameter.name),s=rF(r),c=MP(t),l=[],u=new Set(r.whens.map(e=>e.discriminator)),d=r.whens;if(s&&r.whens.length===1){let e=!u.has(!0);d=[...r.whens,{discriminator:e,parameters:[],is_default_when:!1}]}for(let e of d){let r=n.buildChildSchemaInfos(e.parameters,t);if(!r)throw Error(`Failed to build child schemas for conditional branch ${e.discriminator}`);let i=!OP(t)&&e.is_default_when,a;if(s&&c){let t=String(e.discriminator).toLowerCase();a=G(B(e.discriminator),B(t))}else a=B(e.discriminator);let u={name:o.name,alias:o.alias,schema:a,isOptional:i},d=n.assembleStruct([u,...r]);l.push(d)}return{name:i,alias:a,schema:l.length===1?l[0]:G(...l),isOptional:UP(t,!1)}}RP(`gx_conditional`,iF);function aF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=n.buildChildSchemaInfos(r.parameters,t);if(!o)throw Error(`Failed to build child schemas for section '${r.name}'`);return{name:i,alias:a,schema:n.assembleStruct(o),isOptional:UP(t,o.some(e=>!e.isOptional))}}RP(`gx_section`,aF);function oF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=n.buildChildSchemaInfos(r.parameters,t);if(!o)throw Error(`Failed to build child schemas for repeat '${r.name}'`);let s=q(n.assembleStruct(o));NP(t)||(r.min!==null&&r.min>0&&(s=s.pipe(VN(r.min))),r.max!==null&&(s=s.pipe(UN(r.max))));let c=UP(t,o.some(e=>!e.isOptional)&&r.min!==null&&r.min>0);return{name:i,alias:a,schema:s,isOptional:c}}RP(`gx_repeat`,oF);function sF(e,t){let n=[];for(let r of e){let e=r.options.length===0;(!t||e)&&n.push(r.value),n.push(...sF(r.options,t))}return n}function cF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o=r.hierarchy===`recurse`&&!r.multiple,s=sF(r.options,o),c;c=s.length>0?G(...s.map(e=>B(e))):U;let l;l=r.multiple?q(c):c;let u=UP(t,!0);return{name:i,alias:a,schema:l,isOptional:u}}RP(`gx_drill_down`,cF);function lF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t))o=zP,r.optional&&(o=K(o)),s=!0;else if(PP(t))o=Mj.annotations({jsonSchema:{not:{}}});else if(FP(t))o=G(Y({class:B(`File`),path:U}),Y({class:B(`File`),location:U}));else if(t===`job_runtime`){let e=Y({class:B(`File`),basename:U,location:U,path:U,nameroot:U,nameext:U,format:U,size:W,element_identifier:J(U)});o=r.multiple?q(e):e}else{let e=AP(t)?U:_N,n=Y({src:B(`hda`),id:e}),i=Y({src:B(`dce`),id:e}),a=Y({src:B(`url`),url:U,ext:U}),s=Y({src:B(`hdca`),id:e,map_over_type:J(K(U))}),c=Y({src:B(`dce`),id:e,map_over_type:J(K(U))}),l=Y({__class__:B(`Batch`),values:q(G(s,c))});if(r.multiple){let r=[n,Y({src:B(`hdca`),id:e})];IP(t)&&r.push(a);let i=G(...r),s=[i,q(i)];kP(t)&&s.push(l),o=G(...s)}else{let e=[n,i];IP(t)&&e.push(a),kP(t)&&e.push(l),o=G(...e)}}r.optional&&!PP(t)&&!s&&(o=K(o));let c;return c=t===`workflow_step`?!0:UP(t,!r.optional),{name:i,alias:a,schema:o,isOptional:c,connectedValueHandled:s}}RP(`gx_data`,lF);function uF(e){return e===`list`||e.startsWith(`list:`)||e===`sample_sheet`}function dF(e,t){return Y({class:B(`Collection`),name:U,collection_type:e,tags:q(H),elements:t,column_definitions:J(q(H)),has_single_item:J(Fj)})}function fF(e){let t=e.indexOf(`:`);if(t===-1)return e===`paired`?Y({forward:Ij,reverse:Ij}):uF(e)?q(H):X({key:U,value:H});let n=e.slice(t+1);return q(dF(B(n),fF(n)))}function pF(){let e=G(Y({class:B(`File`),identifier:U,path:U}),fM(()=>Y({class:B(`Collection`),collection_type:U,identifier:J(U),elements:q(e)})));return Y({class:B(`Collection`),collection_type:U,name:J(U),elements:q(e)})}function mF(e){if(e===null)return dF(U,G(q(H),X({key:U,value:H})));let t=e.split(`,`).map(e=>e.trim()).map(e=>dF(B(e),fF(e)));return t.length===1?t[0]:G(...t)}function hF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t))o=zP,r.optional&&(o=K(o)),s=!0;else if(PP(t))o=Mj.annotations({jsonSchema:{not:{}}});else if(FP(t))o=pF();else if(t===`job_runtime`)o=mF(r.collection_type);else{let e=AP(t)?U:_N,n=Y({src:B(`hdca`),id:e}),r=Y({class:B(`Collection`),collection_type:U,elements:q(H)}),i=[n];if(t===`job_internal`){let t=Y({src:B(`dce`),id:e});i.push(t)}t!==`request_internal_dereferenced`&&t!==`job_internal`&&i.push(r),o=i.length===1?i[0]:G(...i)}r.optional&&!PP(t)&&!s&&(o=K(o));let c;return c=t===`workflow_step`?!0:UP(t,!r.optional),{name:i,alias:a,schema:o,isOptional:c,connectedValueHandled:s}}RP(`gx_data_collection`,hF);function gF(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o,s=!1;if(MP(t))return o=r.multiple?G(q(BP),U):BP,r.optional&&(o=K(o)),o=G(o,zP),s=!0,{name:i,alias:a,schema:o,isOptional:!0,connectedValueHandled:s};o=r.multiple?t===`test_case_xml`?U:q(_N):_N,r.optional&&(o=K(o));let c=r.value!==null,l=UP(t,!r.optional&&!c);return{name:i,alias:a,schema:o,isOptional:l,connectedValueHandled:s}}RP(`gx_data_column`,gF);function _F(e,t,n){let r=e,{name:i,alias:a}=HP(r.name),o;o=r.multiple?q(U):U,r.optional&&(o=K(o));let s=UP(t,!r.optional);return{name:i,alias:a,schema:o,isOptional:s}}RP(`gx_group_tag`,_F),X({key:U,value:H}).pipe(Z(e=>{let t=e;if(typeof t.type!=`string`)return`type must be a string`;if(!Array.isArray(t.columns)||!t.columns.every(e=>Number.isInteger(e)))return`columns must be an integer array`},{jsonSchema:{type:`object`,required:[`type`,`columns`],properties:{type:{type:`string`},columns:{type:`array`,items:{type:`integer`}}}}}));var vF=X({key:U,value:H}).pipe(Z(e=>{let t=e;if(!Array.isArray(t.rules))return`rules must be an array`;if(!Array.isArray(t.mapping))return`mapping must be an array`;for(let e of t.mapping){if(!e||typeof e!=`object`)return`each mapping must be an object`;let t=e;if(typeof t.type!=`string`)return`each mapping must have type:string`;if(!Array.isArray(t.columns)||!t.columns.every(e=>Number.isInteger(e)))return`each mapping must have columns:int[]`}},{jsonSchema:{type:`object`,required:[`rules`,`mapping`],properties:{rules:{type:`array`,items:{type:`object`}},mapping:{type:`array`,items:{type:`object`,required:[`type`,`columns`],properties:{type:{type:`string`},columns:{type:`array`,items:{type:`integer`}}}}}}}}));function yF(e,t,n){let{name:r,alias:i}=HP(e.name),a=vF,o=!1;MP(t)&&(a=G(a,zP),o=!0);let s=UP(t,!0);return{name:r,alias:i,schema:a,isOptional:s,connectedValueHandled:o}}RP(`gx_rules`,yF);function bF(e,t){let n=t;if(n.negate){let t={};return n.min!=null&&(t[n.exclude_min?`exclusiveMinimum`:`minimum`]=n.min),n.max!=null&&(t[n.exclude_max?`exclusiveMaximum`:`maximum`]=n.max),e.pipe(Z(e=>{let t=!0;return n.min!=null&&(t&&=n.exclude_min?e>n.min:e>=n.min),n.max!=null&&(t&&=n.exclude_max?e<n.max:e<=n.max),!t},{jsonSchema:{not:t}}))}let r=e;return n.min!=null&&(r=n.exclude_min?r.pipe($M(n.min)):r.pipe(tN(n.min))),n.max!=null&&(r=n.exclude_max?r.pipe(aN(n.max)):r.pipe(sN(n.max))),r}GP(`in_range`,bF);function xF(e){let t=e.match(/^(\^?)\(\?([aiLmsux]+)\)/);if(!t)return{pattern:e,flags:``};let n=t[1],r=t[2],i=``;return r.includes(`i`)&&(i+=`i`),r.includes(`m`)&&(i+=`m`),r.includes(`s`)&&(i+=`s`),{pattern:n+e.slice(t[0].length),flags:i}}function SF(e){return e.replace(/\\\\|\\([^\\^$.*+?()[\]{}|dDwWsSnrtfv0cxupPkbB])/g,(e,t)=>t===void 0?e:t)}function CF(e){return e.replace(/\[\]\]/g,`[\\]]`)}function wF(e){let t=SF(e);t=CF(t);try{return new RegExp(t,`u`),t}catch{return null}}function TF(e){let{pattern:t,flags:n}=xF(e);try{return new RegExp(t,n)}catch{return null}}function EF(e,t){let n=t;if(n.negate){let t=TF(n.expression);return t?e.pipe(Z(e=>e===``||!t.test(e),{jsonSchema:{}})):e}let{pattern:r,flags:i}=xF(n.expression),a=r;a.startsWith(`^`)||(a=`^`+a);try{let t=new RegExp(a,i),n;if(i)n={jsonSchema:{}};else{let e=wF(a);n=e?{jsonSchema:{pattern:`(^$|${e})`}}:{jsonSchema:{}}}return e.pipe(Z(e=>e===``||t.test(e),n))}catch{return e}}GP(`regex`,EF);function DF(e,t){let n=t;if(n.negate){let t={};return n.min!=null&&(t.minLength=n.min),n.max!=null&&(t.maxLength=n.max),e.pipe(Z(e=>{let t=!0;return n.min!=null&&(t&&=e.length>=n.min),n.max!=null&&(t&&=e.length<=n.max),!t},{jsonSchema:{not:t}}))}let r=e;return n.min!=null&&(r=r.pipe(TM(n.min))),n.max!=null&&(r=r.pipe(CM(n.max))),r}GP(`length`,DF);function OF(e,t){let n=e.match(/^'([^']*)'\s+in\s+value$/);if(n)return t.includes(n[1]);let r=e.match(/^"([^"]*)"\s+in\s+value$/);if(r)return t.includes(r[1]);let i=e.match(/^value\s*==\s*['"]([^'"]*)['"]\s*$/);if(i)return t===i[1]}function kF(e,t){let n=t;return e.pipe(Z(e=>{let t=OF(n.expression,e);return t===void 0?!0:n.negate?!t:t},{jsonSchema:{}}))}GP(`expression`,kF);function AF(e,t){let n=t;return e.pipe(Z(e=>{let t=e.length===0;return n.negate?t:!t},{jsonSchema:{}}))}GP(`empty_field`,AF);function jF(e,t){return e}GP(`no_options`,jF);var MF=(e,t)=>{let n={},r=t?.target??`jsonSchema7`,i=PF(Ek(e.ast)&&eI(e.ast.from)?e.ast.to:e.ast,{definitions:n,target:r}),a={$schema:NF(r),$defs:{},...i};return Si(n)?delete a.$defs:a.$defs=n,a};function NF(e){switch(e){case`jsonSchema7`:return`http://json-schema.org/draft-07/schema#`;case`jsonSchema2019-09`:return`https://json-schema.org/draft/2019-09/schema`;case`jsonSchema2020-12`:case`openApi3.1`:return`https://json-schema.org/draft/2020-12/schema`}}var PF=(e,t)=>{let n=t.definitionPath??`#/$defs/`,r=e=>n+e,i=t.target??`jsonSchema7`,a=t.topLevelReferenceStrategy??`keep`,o=t.additionalPropertiesStrategy??`strict`;return cI(e,t.definitions,`handle-identifier`,[],{getRef:r,target:i,topLevelReferenceStrategy:a,additionalPropertiesStrategy:o},`handle-annotation`,`handle-errors`)},FF={$id:`/schemas/never`,not:{}},IF={$id:`/schemas/any`},LF={$id:`/schemas/unknown`},RF={$id:`/schemas/void`},zF={$id:`/schemas/object`,anyOf:[{type:`object`},{type:`array`}]},BF={$id:`/schemas/%7B%7D`,anyOf:[{type:`object`},{type:`array`}]};function VF(e){if(e!==void 0)return ci(_O(e))}function HF(e){if(e!==void 0)return ci(mO(e))}function UF(e){return e===void 0?P():yO(e)}function WF(e,t){return SA(e,!1)(t)}function GF(e){if(e!==void 0)return ci(vO(e))}function KF(e,t){let n=SA(e,!1),r=ua(t,e=>n(e).pipe(gi(JF)));return r.length>0?r:void 0}function qF(e,t,n){if(t!==void 0)switch(e._tag){case`StringKeyword`:return t===GO.annotations[n]?void 0:t;case`NumberKeyword`:return t===qO.annotations[n]?void 0:t;case`BooleanKeyword`:return t===JO.annotations[n]?void 0:t}return t}function JF(e,t=new Set){if(e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return!0;if(Array.isArray(e)||typeof e==`object`){if(t.has(e))return!1;t.add(e);try{if(Array.isArray(e))return e.every(e=>JF(e,t));let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype||Object.getOwnPropertySymbols(e).length>0?!1:Object.values(e).every(e=>JF(e,t))}finally{t.delete(e)}}return!1}function YF(e,t,n,r,i){let a={};if(t!==void 0&&(a.description=t),n!==void 0&&(a.title=n),ti(r)){let t=WF(e,r.value);ti(t)&&JF(t.value)&&(a.default=t.value)}if(i!==void 0){let t=KF(e,i);t!==void 0&&(a.examples=t)}if(Object.keys(a).length!==0)return a}function XF(e,t){return YF(e,VF(t),HF(t),UF(t),GF(t))}function ZF(e){return YF(e,qF(e,VF(e),YD),qF(e,HF(e),qD),UF(e),GF(e))}function QF(e,t){return t?`$ref`in e?{allOf:[e],...t}:{...e,...t}:e}var $F=e=>{if(ei(bO(e)))return Zk(e,$F,e=>$F(e.from))},eI=e=>e.annotations[UD]===MO,tI=(e,t)=>Ck(e)&&e.annotations[UD]===kD?`type`in t&&t.type!==`integer`:`type`in t||`oneOf`in t||`anyOf`in t||`$ref`in t,nI=(e,t,n)=>{let r={...e,...ZF(n),...t};r.allOf??=[];let i=(n,i)=>{n in t&&n in e&&(r.allOf.unshift({[n]:e[n]}),r.allOf=r.allOf.filter(i))};return i(`minLength`,e=>e.minLength>t.minLength),i(`maxLength`,e=>e.maxLength<t.maxLength),i(`pattern`,e=>e.pattern!==t.pattern),i(`minItems`,e=>e.minItems>t.minItems),i(`maxItems`,e=>e.maxItems<t.maxItems),i(`minimum`,e=>e.minimum>t.minimum),i(`maximum`,e=>e.maximum<t.maximum),i(`exclusiveMinimum`,e=>e.exclusiveMinimum>t.exclusiveMinimum),i(`exclusiveMaximum`,e=>e.exclusiveMaximum<t.exclusiveMaximum),i(`multipleOf`,e=>e.multipleOf!==t.multipleOf),r.allOf.length===0&&delete r.allOf,r};function rI(e){switch(e.target){case`jsonSchema7`:return!1;case`jsonSchema2019-09`:case`jsonSchema2020-12`:case`openApi3.1`:return!0}}function iI(e){switch(e.additionalPropertiesStrategy){case`allow`:return!0;case`strict`:return!1}}function aI(e,t){return oI(e,ZF(t))}function oI(e,t){return t===void 0||Object.keys(t).length===0?e:`$ref`in e?{allOf:[e],...t}:{...e,...t}}function sI(e){let t=ci(jO(e));if(t===void 0){if(xk(e))return sI(e.f());if(Ek(e)&&uk(e.from)&&FO(e.to)){let t=e.to;if(ti(EO(t)))return sI(t)}}return t}function cI(e,t,n,r,i,a,o){if(n===`handle-identifier`&&(i.topLevelReferenceStrategy!==`skip`||xk(e))){let n=sI(e);if(n!==void 0){let a=n.replace(/~/gi,`~0`).replace(/\//gi,`~1`),s={$ref:i.getRef(a)};return Ci(t,n)||(t[n]=s,t[n]=cI(e,t,`ignore-identifier`,r,i,`handle-annotation`,o)),s}}if(a===`handle-annotation`){let a=bO(e);if(ti(a)){let s=a.value;if(tI(e,s))switch(e._tag){case`Declaration`:return aI(s,e);default:return s}else switch(e._tag){case`Refinement`:{let a=Hk(e);return a===void 0?nI(cI(e.from,t,n,r,i,`handle-annotation`,o),s,e):cI(a,t,n,r,i,`handle-annotation`,o)}default:return{...cI(e,t,n,r,i,`ignore-annotation`,o),...s}}}}let s=EO(e);if(ti(s))return cI(s.value,t,n,r,i,`handle-annotation`,o);switch(e._tag){case`Declaration`:case`UndefinedKeyword`:case`BigIntKeyword`:case`UniqueSymbol`:case`SymbolKeyword`:if(o===`ignore-errors`)return aI(IF,e);throw Error(pD(r,e));case`Suspend`:if(n===`handle-identifier`){if(o===`ignore-errors`)return aI(IF,e);throw Error(mD(r,e))}return cI(e.f(),t,`ignore-identifier`,r,i,`handle-annotation`,o);case`NeverKeyword`:return aI(FF,e);case`VoidKeyword`:return aI(RF,e);case`UnknownKeyword`:return aI(LF,e);case`AnyKeyword`:return aI(IF,e);case`ObjectKeyword`:return aI(zF,e);case`StringKeyword`:return aI({type:`string`},e);case`NumberKeyword`:return aI({type:`number`},e);case`BooleanKeyword`:return aI({type:`boolean`},e);case`Literal`:{let t=e.literal;if(t===null)return aI({type:`null`},e);if(Nt(t))return aI({type:`string`,enum:[t]},e);if(Pt(t))return aI({type:`number`,enum:[t]},e);if(Ft(t))return aI({type:`boolean`,enum:[t]},e);if(o===`ignore-errors`)return aI(IF,e);throw Error(pD(r,e))}case`Enums`:{let t=e.enums.map(e=>({type:Pt(e[1])?`number`:`string`,title:e[0],enum:[e[1]]}));return t.length>=1?aI({$comment:`/schemas/enums`,anyOf:t},e):aI(FF,e)}case`TupleType`:{let n=e.elements.map((e,n)=>QF(cI(e.type,t,`handle-identifier`,r.concat(n),i,`handle-annotation`,o),XF(e.type,e))),a=e.rest.map(e=>QF(cI(e.type,t,`handle-identifier`,r,i,`handle-annotation`,o),XF(e.type,e))),s={type:`array`},c=e.elements.length;c>0&&(s.minItems=c-e.elements.filter(e=>e.isOptional).length,i.target===`jsonSchema7`?s.items=n:s.prefixItems=n);let l=a.length;if(l>0){let t=a[0];if(l===1&&e.elements.every(t=>t.type===e.rest[0].type)?i.target===`jsonSchema7`?s.items=t:(s.items=t,delete s.prefixItems):i.target===`jsonSchema7`?s.additionalItems=t:s.items=t,l>1){if(o===`ignore-errors`)return aI(IF,e);throw Error(hD(r))}}else c>0?i.target===`jsonSchema7`?s.additionalItems=!1:s.items=!1:s.maxItems=0;return aI(s,e)}case`TypeLiteral`:{if(e.propertySignatures.length===0&&e.indexSignatures.length===0)return aI(BF,e);let n={type:`object`,required:[],properties:{},additionalProperties:iI(i)},a,s;for(let c of e.indexSignatures){let e=$F(c.type)??c.type,l=c.parameter;switch(l._tag){case`StringKeyword`:n.additionalProperties=cI(e,t,`handle-identifier`,r,i,`handle-annotation`,o);break;case`TemplateLiteral`:a=cI(e,t,`handle-identifier`,r,i,`handle-annotation`,o),s={type:`string`,pattern:Ik(l).source};break;case`Refinement`:a=cI(e,t,`handle-identifier`,r,i,`handle-annotation`,o),s=cI(l,t,`handle-identifier`,r,i,`handle-annotation`,o);break;case`SymbolKeyword`:{let a=r.concat(`[symbol]`);n.additionalProperties=cI(e,t,`handle-identifier`,a,i,`handle-annotation`,o),s=cI(l,t,`handle-identifier`,a,i,`handle-annotation`,o);break}}}for(let a=0;a<e.propertySignatures.length;a++){let s=e.propertySignatures[a],c=s.name;if(Nt(c)){let e=$F(s.type),a=e??s.type;n.properties[c]=QF(cI(a,t,`handle-identifier`,r.concat(s.name),i,`handle-annotation`,o),XF(a,s)),!s.isOptional&&e===void 0&&n.required.push(c)}else{if(o===`ignore-errors`)return aI(IF,e);throw Error(gD(c,r))}}return a!==void 0&&(delete n.additionalProperties,n.patternProperties={"":a}),s!==void 0&&(n.propertyNames=s),aI(n,e)}case`Union`:{let n=hI(e.types.map(e=>cI(e,t,`handle-identifier`,r,i,`handle-annotation`,o)));switch(n.length){case 0:return FF;case 1:return aI(n[0],e);default:return aI({anyOf:n},e)}}case`Refinement`:return cI(e.from,t,n,r,i,`handle-annotation`,o);case`TemplateLiteral`:{let t=Ik(e);return aI({type:`string`,title:String(e),description:`a template literal`,pattern:t.source},e)}case`Transformation`:{if(eI(e.from)){let a={type:`string`,contentMediaType:`application/json`};return rI(i)&&(a.contentSchema=cI(e.to,t,n,r,i,`handle-annotation`,o)),a}let a=cI(e.from,t,n,r,i,`handle-annotation`,o);if(e.transformation._tag===`TypeLiteralTransformation`&&lI(a)){let t=cI(e.to,{},`ignore-identifier`,r,i,`handle-annotation`,`ignore-errors`);if(lI(t))for(let n of e.transformation.propertySignatureTransformations){let e=n.to,r=n.from;if(Nt(e)&&Nt(r)){let n=t.properties[e];if(Yt(n)){let e=a.properties[r];if(Yt(e)){let t={};Nt(n.title)&&(t.title=n.title),Nt(n.description)&&(t.description=n.description),Array.isArray(n.examples)&&(t.examples=n.examples),Object.hasOwn(n,`default`)&&n.default!==void 0&&(t.default=n.default),a.properties[r]=oI(e,t)}}}}}return aI(a,e)}}}function lI(e){return Yt(e)&&e.type===`object`&&Yt(e.properties)}function uI(e){return e===FF||C(e,`$id`)&&e.$id===FF.$id&&Object.keys(e).length===3&&e.title===VO.annotations[qD]}function dI(e){return`$id`in e&&e.$id===IF.$id}function fI(e){return`$id`in e&&e.$id===LF.$id}function pI(e){return`$id`in e&&e.$id===RF.$id}function mI(e){return C(e,`enum`)&&`type`in e&&Object.keys(e).length===2}function hI(e){let t=[];for(let n of e)if(!uI(n)){if(dI(n)||fI(n)||pI(n))return[n];if(mI(n)&&t.length>0){let e=t[t.length-1];if(mI(e)&&e.type===n.type){t[t.length-1]={type:e.type,enum:[...e.enum,...n.enum]};continue}}t.push(n)}return t}var gI=Y({format:U,content:U}),_I=Y({value:U,type:U}),vI=Y({type:U,content:U}),yI=B(`pattern`,`tool_provided_metadata`),bI=B(`filename`,`name`,`designation`,`dbkey`),xI=B(`lexical`,`numeric`),SI=Y({discover_via:yI,format:K(U),visible:Fj,assign_primary_output:Fj,directory:K(U),recurse:Fj,match_relative_path:Fj}),CI=Y({...SI.fields,discover_via:B(`tool_provided_metadata`)}),wI=G(Y({...SI.fields,discover_via:B(`pattern`),sort_key:bI,sort_comp:xI,sort_reverse:Fj,pattern:U}),CI),TI=Y({name:U,label:K(U),hidden:Fj}),EI=Y({...TI.fields,type:B(`data`),format:U,format_source:K(U),metadata_source:K(U),discover_datasets:K(q(wI)),from_work_dir:K(U),precreate_directory:Fj}),DI=Y({collection_type:K(U),collection_type_source:K(U),collection_type_from_rules:K(U),structured_like:K(U),discover_datasets:K(q(wI))}),OI=G(EI,Y({...TI.fields,type:B(`collection`),structure:DI}),Y({...TI.fields,type:B(`text`)}),Y({...TI.fields,type:B(`integer`)}),Y({...TI.fields,type:B(`float`)}),Y({...TI.fields,type:B(`boolean`)})),kI=yM(K(U),K(U),{decode:e=>e===``?null:e,encode:e=>e}),AI=Oj(e=>typeof e==`object`&&!!e&&!Array.isArray(e)).annotations({jsonSchema:{type:`object`}}),jI=Y({id:U,version:K(U),name:U,description:kI,inputs:q(AI),outputs:q(OI),citations:q(vI),license:K(U),profile:K(U),edam_operations:q(U),edam_topics:q(U),xrefs:q(_I),help:J(G(gI,V))});MF(jI,{target:`jsonSchema2020-12`});var MI=B(`null`,`boolean`,`int`,`long`,`float`,`double`,`string`),NI=B(`null`,`boolean`,`int`,`long`,`float`,`double`,`string`,`integer`,`text`,`File`,`data`,`collection`),PI=B(`tool`,`subworkflow`,`pause`,`pick_value`),FI=Y({doc:J(G(V,U,q(U)))}),II=Y({fields:J(G(V,q(fM(()=>zI).annotations({identifier:`RecordFieldSchema`})))),type:B(`record`)}),LI=Y({symbols:q(U),type:B(`enum`)}),RI=Y({items:G(MI,II,LI,fM(()=>RI).annotations({identifier:`ArraySchemaSchema`}),U,q(G(MI,II,LI,fM(()=>RI).annotations({identifier:`ArraySchemaSchema`}),U))),type:B(`array`)}),zI=Y({...FI.fields,name:U,type:G(MI,II,LI,RI,U,q(G(MI,II,LI,RI,U)))}),BI=Y({label:J(G(V,U))}),VI=Y({id:J(G(V,U))}),HI=Y({...BI.fields,...FI.fields,...VI.fields}),UI=Y({...HI.fields,id:J(G(V,U)),label:J(G(V,U)),doc:J(G(V,U,q(U))),default:J(G(V,H))}),WI=Y({...HI.fields,id:J(G(V,U)),label:J(G(V,U)),doc:J(G(V,U,q(U)))}),GI=Y({position:J(G(V,Y({top:W,left:W})))}),KI=Y({...UI.fields,...GI.fields,id:J(G(V,U)),label:J(G(V,U)),doc:J(G(V,U,q(U))),type:J(G(NI,V,q(NI))),optional:J(G(Fj,V)),format:J(G(V,q(U))),collection_type:J(G(V,U))}),qI=Y({...WI.fields,id:J(G(V,U)),label:J(G(V,U)),doc:J(G(V,U,q(U))),outputSource:J(G(V,U)),type:J(G(V,NI))}),JI=Y({...VI.fields,...BI.fields,...FI.fields,inputs:G(q(KI),X({key:U,value:G(KI,U)}),X({key:U,value:H})),outputs:G(q(qI),X({key:U,value:G(qI,U)}),X({key:U,value:H}))}),YI=Y({uuid:J(G(V,U))}),XI=Y({errors:J(G(V,U))}),ZI=Y({name:U,changeset_revision:U,owner:U,tool_shed:U}),QI=Y({tool_id:J(G(V,U)),tool_shed_repository:J(G(V,ZI)),tool_version:J(G(V,U))}),$I=Y({markdown:U}),eL=Y({position:J(G(q(W),V)),size:J(G(q(W),V)),color:J(G(V,U)),label:J(G(V,U))}),tL=Y({...eL.fields,type:B(`freehand`),thickness:J(G(V,W)),line:J(G(q(q(W)),V))}),nL=Y({name:J(G(V,U)),identifier:J(G(V,U)),url:J(G(V,U)),email:J(G(V,U)),image:J(G(V,U)),address:J(G(V,U)),alternateName:J(G(V,U)),telephone:J(G(V,U)),faxNumber:J(G(V,U))}),rL=Y({...nL.fields,class:B(`Person`),givenName:J(G(V,U)),familyName:J(G(V,U)),honorificPrefix:J(G(V,U)),honorificSuffix:J(G(V,U)),jobTitle:J(G(V,U))}),iL=Y({...eL.fields,type:B(`text`),text:J(G(V,U)),bold:J(G(V,Fj)),italic:J(G(V,Fj)),text_size:J(G(V,W))}),aL=Y({...eL.fields,type:B(`frame`),title:J(G(V,U)),contains_steps:J(G(V,q(G(U,W)))),contains_comments:J(G(V,q(G(U,W))))}),oL=Y({...eL.fields,type:B(`markdown`),text:J(G(V,U))}),sL=Y({...nL.fields,class:B(`Organization`)}),cL=Y({...JI.fields,...YI.fields,id:J(G(V,U)),class:B(`GalaxyWorkflow`),label:J(G(V,U)),doc:J(G(V,U,q(U))),steps:G(q(fM(()=>fL).annotations({identifier:`WorkflowStepSchema`})),X({key:U,value:fM(()=>fL).annotations({identifier:`WorkflowStepSchema`})})),report:J(G(V,$I)),tags:J(G(q(U),V)),comments:J(G(q(G(iL,oL,aL,tL)),X({key:U,value:G(iL,oL,aL,tL)}),V)),creator:J(G(q(G(rL,sL)),V)),license:J(G(V,U)),release:J(G(V,U))}),lL=Y({...VI.fields,add_tags:J(G(V,q(U))),change_datatype:J(G(V,U)),delete_intermediate_datasets:J(G(V,Fj)),hide:J(G(V,Fj)),remove_tags:J(G(V,q(U))),rename:J(G(V,U)),set_columns:J(G(X({key:U,value:H}),V))}),uL=Y({source:J(G(V,U,q(U)))}),dL=Y({...VI.fields,...uL.fields,...BI.fields,default:J(G(V,H))}),fL=Y({...VI.fields,...BI.fields,...FI.fields,...GI.fields,...QI.fields,...XI.fields,...YI.fields,in:J(G(q(dL),X({key:U,value:G(dL,U)}),V)),out:J(G(q(G(lL,U)),X({key:U,value:G(lL,U)}),V)),state:J(G(X({key:U,value:H}),V)),tool_state:J(G(U,X({key:U,value:H}),V)),type:J(G(V,PI)),run:J(G(cL,U,X({key:U,value:H}),V)),runtime_inputs:J(G(V,q(U))),when:J(G(V,U))}),pL=B(`null`,`boolean`,`int`,`long`,`float`,`double`,`string`),mL=B(`data_input`,`data_collection_input`,`parameter_input`,`tool`,`subworkflow`,`pause`,`pick_value`),hL=Y({doc:J(G(V,U,q(U)))}),gL=Y({symbols:q(U),type:B(`enum`)}),_L=Y({fields:J(G(V,q(fM(()=>yL).annotations({identifier:`RecordFieldSchema`})))),type:B(`record`)}),vL=Y({items:G(pL,_L,gL,fM(()=>vL).annotations({identifier:`ArraySchemaSchema`}),U,q(G(pL,_L,gL,fM(()=>vL).annotations({identifier:`ArraySchemaSchema`}),U))),type:B(`array`)}),yL=Y({...hL.fields,name:U,type:G(pL,_L,gL,vL,U,q(G(pL,_L,gL,vL,U)))}),bL=Y({uuid:J(G(V,U))}),xL=Y({errors:J(G(V,U))}),SL=Y({top:W,left:W}),CL=Y({position:J(G(V,SL))}),wL=Y({name:U,changeset_revision:U,owner:U,tool_shed:U}),TL=Y({tool_id:J(G(V,U)),tool_shed_repository:J(G(V,wL)),tool_version:J(G(V,U))}),EL=Y({name:U,description:J(G(V,U))}),DL=Y({name:U,type:J(G(V,U))}),OL=Y({label:J(G(V,U)),output_name:U,uuid:J(G(V,U))}),kL=Y({id:W,output_name:U,input_subworkflow_step_id:J(G(V,W))}),AL=Y({action_type:U,output_name:U,action_arguments:J(G(X({key:U,value:H}),V))}),jL=Y({text:J(G(V,U)),bold:J(G(V,Fj)),italic:J(G(V,Fj)),size:J(G(V,W))}),ML=Y({text:J(G(V,U))}),NL=Y({title:J(G(V,U))}),PL=Y({line:J(G(q(q(W)),V)),thickness:J(G(V,W))}),FL=Y({id:W,position:J(G(q(W),V)),size:J(G(q(W),V)),color:J(G(V,U))}),IL=Y({...FL.fields,type:B(`text`),data:J(G(V,jL))}),LL=Y({...FL.fields,type:B(`markdown`),data:J(G(V,ML))}),RL=Y({...FL.fields,type:B(`frame`),data:J(G(V,NL)),child_steps:J(G(V,q(W))),child_comments:J(G(V,q(W)))}),zL=Y({...FL.fields,type:B(`freehand`),data:J(G(V,PL))}),BL=Y({markdown:U}),VL=Y({name:J(G(V,U)),identifier:J(G(V,U)),url:J(G(V,U)),email:J(G(V,U)),image:J(G(V,U)),address:J(G(V,U)),alternateName:J(G(V,U)),telephone:J(G(V,U)),faxNumber:J(G(V,U))}),HL=Y({...VL.fields,class:B(`Person`),givenName:J(G(V,U)),familyName:J(G(V,U)),honorificPrefix:J(G(V,U)),honorificSuffix:J(G(V,U)),jobTitle:J(G(V,U))}),UL=Y({url:J(G(V,U)),trs_tool_id:J(G(V,U)),trs_version_id:J(G(V,U)),trs_server:J(G(V,U)),trs_url:J(G(V,U))}),WL=Y({...VL.fields,class:B(`Organization`)}),GL=Y({...bL.fields,name:J(G(V,U)),class:B(`NativeGalaxyWorkflow`),a_galaxy_workflow:B(`true`),"format-version":B(`0.1`),annotation:J(G(V,U)),tags:J(G(V,q(U))),version:J(G(V,W)),license:J(G(V,U)),release:J(G(V,U)),creator:J(G(q(G(HL,WL)),V)),report:J(G(V,BL)),readme:J(G(V,U)),help:J(G(V,U)),logo_url:J(G(V,U)),doi:J(G(V,q(U))),source_metadata:J(G(V,UL)),comments:J(G(q(G(IL,LL,RL,zL)),V)),steps:J(G(X({key:U,value:fM(()=>KL).annotations({identifier:`NativeStepSchema`})}),V)),subworkflows:J(G(X({key:U,value:fM(()=>GL).annotations({identifier:`NativeGalaxyWorkflowSchema`})}),V))}),KL=Y({...xL.fields,...CL.fields,...bL.fields,...TL.fields,name:J(G(V,U)),id:J(G(V,W)),type:J(G(V,mL)),label:J(G(V,U)),annotation:J(G(V,U)),when:J(G(V,U)),content_id:J(G(V,U)),tool_state:J(G(U,X({key:U,value:H}),V)),tool_uuid:J(G(V,U)),input_connections:J(G(X({key:U,value:G(kL,q(kL))}),V)),inputs:J(G(V,q(EL))),outputs:J(G(V,q(DL))),workflow_outputs:J(G(V,q(OL))),post_job_actions:J(G(X({key:U,value:AL}),V)),subworkflow:J(G(GL,V)),tool_representation:J(G(X({key:U,value:H}),V)),in:J(G(X({key:U,value:H}),V))}),qL=Y({tool_id:U,tool_version:K(U)}),JL=Y({name:J(K(U)),a_galaxy_workflow:U,"format-version":U,annotation:J(K(U)),tags:q(U),version:J(K(W)),license:J(K(U)),release:J(K(U)),uuid:J(K(U)),steps:X({key:U,value:fM(()=>YL)}),unique_tools:mP(qL)}),YL=Y({id:W,name:J(K(U)),type:J(K(mL)),label:J(K(U)),annotation:J(K(U)),when:J(K(U)),content_id:J(K(U)),tool_state:X({key:U,value:H}),tool_id:J(K(U)),tool_version:J(K(U)),tool_shed_repository:J(K(wL)),uuid:J(K(U)),errors:J(K(U)),position:J(K(SL)),input_connections:X({key:U,value:q(H)}),inputs:q(EL),outputs:q(DL),workflow_outputs:q(OL),post_job_actions:X({key:U,value:AL}),subworkflow:J(K(JL)),tool_uuid:J(K(U)),tool_representation:J(K(X({key:U,value:H}))),in:J(K(X({key:U,value:H}))),connected_paths:mP(U)});function XL(e){let t=e,n=ZL(t.steps),r=nR(t.tags),i=rR(n),a={name:t.name,a_galaxy_workflow:t.a_galaxy_workflow??`true`,"format-version":t[`format-version`]??`0.1`,annotation:t.annotation,tags:r,version:t.version,license:t.license,release:t.release,uuid:t.uuid,steps:n,unique_tools:i};return t.comments!=null&&(a.comments=t.comments),a}function ZL(e){let t={};if(!e)return t;for(let[n,r]of Object.entries(e))t[n]=QL(r);return t}function QL(e){let t=eR(e.tool_state),n=tR(e.input_connections),r=new Set(Object.keys(n)),i=null;return e.subworkflow!=null&&(i=XL(e.subworkflow)),{id:e.id??0,name:e.name,type:e.type,label:e.label,annotation:e.annotation,when:e.when,content_id:e.content_id,tool_state:t,tool_id:e.tool_id,tool_version:e.tool_version,tool_shed_repository:e.tool_shed_repository,uuid:e.uuid,errors:e.errors,position:$L(e.position),input_connections:n,inputs:e.inputs??[],outputs:e.outputs??[],workflow_outputs:e.workflow_outputs??[],post_job_actions:e.post_job_actions??{},subworkflow:i,tool_uuid:e.tool_uuid,tool_representation:e.tool_representation,in:e.in,connected_paths:r}}function $L(e){return e==null?e:{top:e.top,left:e.left}}function eR(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return{}}return typeof e==`object`&&e?e:{}}function tR(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))t[n]=Array.isArray(r)?r:[r];return t}function nR(e){return Array.isArray(e)?e:typeof e==`string`&&e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function rR(e){let t=new Set;return iR(e,t),t}function iR(e,t){for(let n of Object.values(e))n.tool_id!=null&&t.add({tool_id:n.tool_id,tool_version:n.tool_version??null}),n.subworkflow&&iR(n.subworkflow.steps,t)}var aR={File:`data`,data_input:`data`,data_collection:`collection`};function oR(e){return aR[e]??e}var sR=Y({id:U,source:J(K(G(U,q(U)))),label:J(K(U)),default:J(K(H))}),cR=Y({id:J(K(U)),add_tags:J(K(q(U))),change_datatype:J(K(U)),delete_intermediate_datasets:J(K(Fj)),hide:J(K(Fj)),remove_tags:J(K(q(U))),rename:J(K(U)),set_columns:J(K(X({key:U,value:H})))}),lR=Y({id:U,label:J(K(U)),doc:J(K(U)),type:J(K(G(U,q(U)))),optional:J(K(Fj)),default:J(K(H)),format:J(K(q(U))),collection_type:J(K(U)),position:J(K(X({key:U,value:H})))}),uR=Y({id:U,label:J(K(U)),doc:J(K(U)),outputSource:J(K(U)),type:J(K(U))}),dR=Y({class:B(`GalaxyWorkflow`),label:J(K(U)),doc:J(K(U)),inputs:q(lR),outputs:q(uR),steps:q(fM(()=>fR)),tags:J(K(q(U))),uuid:J(K(U)),report:J(K(X({key:U,value:H}))),license:J(K(U)),release:J(K(U)),unique_tools:mP(qL)}),fR=Y({id:U,label:J(K(U)),doc:J(K(U)),tool_id:J(K(U)),tool_version:J(K(U)),tool_shed_repository:J(K(X({key:U,value:H}))),type:J(K(U)),run:J(K(G(dR,U))),in:q(sR),out:q(cR),state:J(K(X({key:U,value:H}))),tool_state:J(K(X({key:U,value:H}))),when:J(K(U)),position:J(K(X({key:U,value:H}))),errors:J(K(U)),uuid:J(K(U)),runtime_inputs:J(K(q(U)))});function pR(e){let t=e;if(t.$graph){let e=t.$graph,n=new Map,r;for(let t of e)t.id===`main`?r=t:n.set(t.id,t);if(!r)throw Error(`$graph workflow missing 'main' entry`);return mR(r,n)}return mR(t,new Map)}function mR(e,t){let n=hR(e.inputs),r=gR(e.outputs),i=_R(e.steps,t),a=ER(i),o={class:`GalaxyWorkflow`,label:e.label??null,doc:TR(e.doc),inputs:n,outputs:r,steps:i,tags:e.tags,uuid:e.uuid,report:e.report,license:e.license,release:e.release,unique_tools:a};return e.comments!=null&&(o.comments=e.comments),e.creator!=null&&(o.creator=e.creator),o}function hR(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>{let t=e;return{...t,id:t.id,doc:TR(t.doc)}});let t=[];for(let[n,r]of Object.entries(e))if(typeof r==`string`)t.push({id:n,type:oR(r)});else if(r&&typeof r==`object`){let e=r,i=typeof e.type==`string`?oR(e.type):e.type;t.push({...e,id:n,type:i,doc:TR(e.doc)})}else t.push({id:n});return t}function gR(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>{let t=e;return{...t,id:t.id,doc:TR(t.doc)}});let t=[];for(let[n,r]of Object.entries(e))if(r&&typeof r==`object`){let e=r;t.push({...e,id:n,doc:TR(e.doc)})}else t.push({id:n});return t}function _R(e,t){if(!e)return[];if(Array.isArray(e))return e.map((e,n)=>{let r=e;return vR(r,r.id??String(n),t)});let n=[];for(let[r,i]of Object.entries(e))if(i&&typeof i==`object`){let e=i;`label`in e||(e={...e,label:r}),n.push(vR(e,r,t))}return n}function vR(e,t,n){let r=yR(e.in),i=bR(e.out),a=xR(e.run,n),o=new Map,s=e.state==null?e.state:CR(e.state,``,o),c=[];for(let[e,t]of o)c.push({id:e,source:t.length===1?t[0]:t});let l=new Set(r.map(e=>e.id));for(let e of c)l.has(e.id)||r.push(e);return{id:t,label:e.label,doc:TR(e.doc),tool_id:e.tool_id,tool_version:e.tool_version,tool_shed_repository:e.tool_shed_repository,type:e.type,run:a,in:r,out:i,state:s,tool_state:wR(e.tool_state),when:e.when,position:e.position,errors:e.errors,uuid:e.uuid,runtime_inputs:e.runtime_inputs}}function yR(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return{id:e};let t=e;return{...t,id:t.id}});let t=[];for(let[n,r]of Object.entries(e))if(typeof r==`string`)t.push({id:n,source:r});else if(r&&typeof r==`object`){let e=r;t.push({...e,id:n})}else t.push({id:n});return t}function bR(e){if(!e)return[];if(Array.isArray(e))return e.map(e=>typeof e==`string`?{id:e}:e);let t=[];for(let[n,r]of Object.entries(e))r&&typeof r==`object`?t.push({...r,id:n}):t.push({id:n});return t}function xR(e,t){if(e==null)return e;if(typeof e==`string`){if(e.startsWith(`#`)){let n=e.slice(1),r=t.get(n);if(!r)throw Error(`Subworkflow reference not found: ${e}`);return mR(r,t)}return e}if(typeof e==`object`){let n=e;return`@import`in n&&typeof n[`@import`]==`string`?n[`@import`]:n.class===`GalaxyUserTool`?n:mR(n,t)}return null}var SR={__class__:`ConnectedValue`};function CR(e,t,n){if(e&&typeof e==`object`&&!Array.isArray(e)){let r=e;if(`$link`in r){let e=n.get(t)??[];return e.push(r.$link),n.set(t,e),{...SR}}let i={};for(let[e,a]of Object.entries(r))i[e]=CR(a,t?`${t}|${e}`:e,n);return i}return Array.isArray(e)?e.map((e,r)=>{if(e&&typeof e==`object`&&!Array.isArray(e)&&`$link`in e){let r=n.get(t)??[];return r.push(e.$link),n.set(t,r),null}return CR(e,`${t}_${r}`,n)}):e}function wR(e){if(e==null)return e;if(typeof e==`string`)try{return JSON.parse(e)}catch{return{}}return typeof e==`object`?e:null}function TR(e){return Array.isArray(e)?e.join(`
267
- `):e}function ER(e){let t=new Set;return DR(e,t),t}function DR(e,t){for(let n of e)if(n.tool_id!=null&&t.add({tool_id:n.tool_id,tool_version:n.tool_version??null}),n.run&&typeof n.run==`object`&&n.run.class===`GalaxyWorkflow`){let e=n.run;DR(e.steps,t)}}var OR={text:{text:`text`,bold:`bold`,italic:`italic`,size:`text_size`},markdown:{text:`text`},frame:{title:`title`},freehand:{thickness:`thickness`,line:`line`}},kR=[`type`,`position`,`size`,`color`];function AR(e){let t=e.type,n={};for(let t of kR)t in e&&(n[t]=e[t]);`label`in e&&(n.label=e.label);let r=e.data??{},i=OR[t]??{};for(let[e,t]of Object.entries(i))e in r&&(n[t]=r[e]);return`child_steps`in e&&(n.contains_steps=e.child_steps),`child_comments`in e&&(n.contains_comments=e.child_comments),n}function jR(e){let t=e.type,n={};for(let t of kR)t in e&&(n[t]=e[t]);`label`in e&&(n.label=e.label);let r={},i=OR[t]??{};for(let[t,n]of Object.entries(i))n in e&&(r[t]=e[n]);return n.data=r,`contains_steps`in e&&(n.child_steps=e.contains_steps),`contains_comments`in e&&(n.child_comments=e.contains_comments),n}var MR=`_unlabeled_input_`,NR=`_unlabeled_step_`;function PR(e){return e.startsWith(MR)}function FR(e){return e.startsWith(NR)}function IR(e){return PR(e)||FR(e)}var LR=class{seenLabels=new Set;anonymousLabels=0;ensureNewOutputLabel(e){return e??=(this.anonymousLabels+=1,`_anonymous_output_${this.anonymousLabels}`),this.seenLabels.add(e),e}};function RR(e,t){let n=t instanceof Map?[...t.keys()]:[...t];n.sort((e,t)=>t.length-e.length);for(let t of n){if(e===t)return[t,`output`];if(e.startsWith(t+`/`))return[t,e.slice(t.length+1)]}if(e.includes(`/`)){let t=e.indexOf(`/`);return[e.slice(0,t),e.slice(t+1)]}return[e,`output`]}var zR=new Set([`data_input`,`data_collection_input`,`parameter_input`]);function BR(e,t){return VR(XL(e),t)}function VR(e,t){let n=new Map;for(let[t,r]of Object.entries(e.steps))r.label==null?zR.has(r.type)?n.set(String(t),`${MR}${r.id}`):n.set(String(t),`${NR}${r.id}`):n.set(String(t),r.label);let r=new LR,i=[];for(let t of Object.values(e.steps))for(let e of t.workflow_outputs){let a=ez(e.output_name,n,t.id),o=r.ensureNewOutputLabel(e.label);i.push({id:o,outputSource:a})}let a=[],o=[];for(let r of Object.values(e.steps))zR.has(r.type)?a.push(UR(r)):o.push(GR(r,n,t));tz(i,o);let s=nz(e,n),c=e,l={class:`GalaxyWorkflow`,label:e.name??null,doc:e.annotation||null,inputs:a,outputs:i,steps:o,tags:e.tags,uuid:e.uuid,license:e.license??void 0,release:e.release??void 0,unique_tools:e.unique_tools};return s&&(l.comments=s),c.report&&(l.report={markdown:c.report.markdown}),c.creator&&(l.creator=c.creator),l}function HR(e,t){if(e===`data_collection_input`)return`collection`;if(e===`data_input`)return`data`;if(e===`parameter_input`){let e=t.parameter_type??``,n=e;return e===`integer`?n=`int`:e===`text`&&(n=`string`),t.multiple?[n]:n}return`data`}function UR(e){let t={id:e.label??`_unlabeled_input_${e.id}`,type:HR(e.type,e.tool_state)},n=e.tool_state;for(let e of[`collection_type`,`optional`,`format`,`default`,`restrictions`,`suggestions`,`restrictOnConnections`,`fields`,`column_definitions`])if(e in n)if(e===`format`){let r=n[e];t[e]=typeof r==`string`?[r]:r}else t[e]=n[e];return e.annotation&&(t.doc=e.annotation),e.position&&(t.position=e.position),t}function WR(e,t){let n=e.label??t.get(String(e.id));return{stepId:n??String(e.id),displayLabel:n&&IR(n)?void 0:n}}function GR(e,t,n){let r=e.type;return r===`subworkflow`?JR(e,t,n):r===`pause`?YR(e,t):r===`pick_value`?XR(e,t):KR(e,t,n)}function KR(e,t,n){let r=e.tool_representation;if(r&&r.class===`GalaxyUserTool`)return qR(e,t);let i=ZR(e,t),a=$R(e),o=n?.stateEncodeToFormat2?.(e),s=null;if(o!=null)s=Object.keys(o.state).length>0?o.state:null,o.in&&QR(i,o.in);else{let t={...e.tool_state};delete t.__page__,delete t.__rerun_remap_job_id__,Object.keys(t).length>0&&(s=t)}let{stepId:c,displayLabel:l}=WR(e,t);return{id:c,label:l??void 0,doc:e.annotation||void 0,tool_id:e.tool_id??void 0,tool_version:e.tool_version??void 0,tool_shed_repository:e.tool_shed_repository,in:i,out:a,tool_state:s,position:e.position,when:e.when??void 0,uuid:e.uuid??void 0,errors:e.errors??void 0}}function qR(e,t){let n=ZR(e,t),r=$R(e),{stepId:i,displayLabel:a}=WR(e,t);return{id:i,label:a??void 0,doc:e.annotation||void 0,run:e.tool_representation,in:n,out:r,position:e.position}}function JR(e,t,n){let r=ZR(e,t),i=$R(e),a=null,o=e.content_source;(o===`url`||o===`trs_url`)&&e.content_id?a=e.content_id:e.subworkflow==null?e.content_id&&(a=e.content_id):a=VR(e.subworkflow,n);let{stepId:s,displayLabel:c}=WR(e,t);return{id:s,label:c??void 0,doc:e.annotation||void 0,run:a,in:r,out:i,position:e.position,when:e.when??void 0,uuid:e.uuid??void 0}}function YR(e,t){let n=ZR(e,t),{stepId:r,displayLabel:i}=WR(e,t);return{id:r,label:i??void 0,doc:e.annotation||void 0,type:`pause`,in:n,out:[],position:e.position}}function XR(e,t){let n=ZR(e,t),r=$R(e),{stepId:i,displayLabel:a}=WR(e,t),o;return`mode`in e.tool_state&&(o={mode:e.tool_state.mode}),{id:i,label:a??void 0,doc:e.annotation||void 0,type:`pick_value`,state:o,in:n,out:r,position:e.position}}function ZR(e,t){let n=[],r=new Map;if(e.in!=null)for(let[t,n]of Object.entries(e.in))n&&typeof n==`object`&&`default`in n&&r.set(t,n.default);for(let[i,a]of Object.entries(e.input_connections)){let e=Array.isArray(a)?a:[a],o=[];for(let n of e){let e=n,r=ez(e.output_name,t,e.id);o.push(r)}let s=i,c=o;i===`__NO_INPUT_OUTPUT_NAME__`&&(s=`$step`,c=o.map(e=>e.includes(`/__NO_INPUT_OUTPUT_NAME__`)?e.split(`/__NO_INPUT_OUTPUT_NAME__`)[0]:e));let l=c.length===1?c[0]:c,u=r.get(s);r.delete(s);let d={id:s,source:l};u!==void 0&&(d.default=u),n.push(d)}for(let[e,t]of r)n.push({id:e,default:t});return n}function QR(e,t){let n=new Set;for(let t of e)t.id&&n.add(t.id);for(let[r,i]of Object.entries(t))n.has(r)||e.push({id:r,source:i})}function $R(e){if(!e.post_job_actions||Object.keys(e.post_job_actions).length===0)return[];let t=new Map;for(let n of Object.values(e.post_job_actions)){let e=n.action_type,r=n.output_name,i=n.action_arguments??{};t.has(r)||t.set(r,{});let a=t.get(r);e===`RenameDatasetAction`?a.rename=i.newname:e===`HideDatasetAction`?a.hide=!0:e===`DeleteIntermediatesAction`?a.delete_intermediate_datasets=!0:e===`ChangeDatatypeAction`?a.change_datatype=i.newtype:e===`TagDatasetAction`?a.add_tags=i.tags.split(`,`):e===`RemoveTagDatasetAction`?a.remove_tags=i.tags.split(`,`):e===`ColumnSetAction`&&i&&Object.keys(i).length>0&&(a.set_columns=i)}let n=[];for(let[e,r]of t)n.push({id:e,...r});return n}function ez(e,t,n){let r=t.get(String(n))??String(n);return e===`output`?r:`${r}/${e}`}function tz(e,t){let n=new Map;for(let e of t){let t=e.label??e.id;e.run&&typeof e.run==`object`&&n.set(String(t),e.run)}for(let t of e){let e=t.outputSource;if(!e||!e.includes(`/`))continue;let[r,i]=e.split(`/`,2);if(!i.includes(`:`))continue;let[a,o]=i.split(`:`,2),s=n.get(r);if(!s)continue;let c=`/${o}`;for(let e of s.outputs){let n=e.outputSource;if(n&&n.endsWith(c)){let i=n.slice(0,-c.length);if(i===a||i.endsWith(a)){t.outputSource=`${r}/${e.id}`;break}}}}}function nz(e,t){let n=e.comments;if(!n||!Array.isArray(n)||n.length===0)return;let r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t.label&&r.set(e,t.label)}let i=[];for(let e of n){let n=AR(e);n.type===`frame`&&(n.contains_steps&&Array.isArray(n.contains_steps)&&(n.contains_steps=n.contains_steps.map(e=>t.get(String(e))??e)),n.contains_comments&&Array.isArray(n.contains_comments)&&(n.contains_comments=n.contains_comments.map(e=>r.get(e)??e))),i.push(n)}return i}function rz(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}var iz={input:`data_input`,input_collection:`data_collection_input`,parameter:`parameter_input`},az=class e{options;labels=new Map;constructor(e={}){this.options=e}stepId(e){let t=String(e);return this.labels.has(t)?this.labels.get(t):parseInt(t,10)}stepOutput(e){let[t,n]=RR(e,this.labels);return[this.stepId(t),n]}childContext(){return new e(this.options)}},oz={hide:{actionClass:`HideDatasetAction`,defaultVal:!1,arguments:()=>({})},rename:{actionClass:`RenameDatasetAction`,defaultVal:{},arguments:e=>({newname:e})},delete_intermediate_datasets:{actionClass:`DeleteIntermediatesAction`,defaultVal:!1,arguments:()=>({})},change_datatype:{actionClass:`ChangeDatatypeAction`,defaultVal:{},arguments:e=>({newtype:e})},set_columns:{actionClass:`ColumnSetAction`,defaultVal:{},arguments:e=>e},add_tags:{actionClass:`TagDatasetAction`,defaultVal:[],arguments:e=>({tags:e.join(`,`)})},remove_tags:{actionClass:`RemoveTagDatasetAction`,defaultVal:[],arguments:e=>({tags:e.join(`,`)})}};function sz(e,t){let n;n=cz(e)?e:pR(e);let r=new az(t);return lz(n,r),uz(n,r)}function cz(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.class===`GalaxyWorkflow`&&Array.isArray(t.inputs)&&Array.isArray(t.steps)}function lz(e,t){for(let n=0;n<e.inputs.length;n++){let r=e.inputs[n];r.id&&t.labels.set(r.id,n)}for(let n=0;n<e.steps.length;n++){let r=e.inputs.length+n,i=e.steps[n].label??e.steps[n].id;i&&t.labels.set(i,r)}}function uz(e,t){let n={};for(let t=0;t<e.inputs.length;t++)n[String(t)]=dz(e.inputs[t],t);let r=e.inputs.length;for(let i=0;i<e.steps.length;i++){let a=r+i;n[String(a)]=fz(e.steps[i],a,t)}Sz(e.outputs,n,t);let i=Cz(e,t),a=e,o={a_galaxy_workflow:`true`,"format-version":`0.1`,name:e.label??`Workflow`,annotation:e.doc??``,tags:e.tags??[],uuid:e.uuid||rz(),license:e.license??void 0,release:e.release??void 0,steps:n,unique_tools:e.unique_tools};return i&&i.length>0&&(o.comments=i),a.report&&(o.report={markdown:a.report.markdown}),a.creator&&(o.creator=a.creator),o}function dz(e,t){let n=e.id||`Input ${t}`,r=IR(n)?void 0:n,i=e.type,a=!1;if(Array.isArray(i)){if(i.length!==1)throw Error(`Only simple arrays of workflow inputs are currently supported`);i=i[0],a=!0}let o=i??`data`,s;if([`File`,`data`,`data_input`].includes(o))s=`data_input`;else if([`collection`,`data_collection`,`data_collection_input`].includes(o))s=`data_collection_input`;else if([`text`,`string`,`integer`,`int`,`float`,`color`,`boolean`].includes(o))s=`parameter_input`;else throw Error(`Unknown input type [${o}] encountered.`);let c={name:n};if(s===`parameter_input`){let e=o;e===`int`?e=`integer`:e===`string`&&(e=`text`),c.parameter_type=e}a&&(c.multiple=!0),e.optional!=null&&(c.optional=e.optional),e.format&&(c.format=e.format),e.collection_type&&(c.collection_type=e.collection_type),e.default!=null&&(c.default=e.default);for(let t of[`restrictions`,`suggestions`,`restrictOnConnections`,`fields`,`column_definitions`])t in e&&(c[t]=e[t]);let l,u=e.default;return u&&typeof u==`object`&&u.class===`File`&&(l={default:{default:u}},delete c.default),{id:t,type:s,label:r??null,name:n,annotation:Ez(e.doc)??``,tool_state:c,position:Tz(e.position,t),input_connections:{},inputs:[{name:n,description:``}],outputs:[],workflow_outputs:[],post_job_actions:{},in:l,connected_paths:new Set}}function fz(e,t,n){let r=pz(e);if(r===`tool`)return mz(e,t,n);if(r===`subworkflow`)return hz(e,t,n);if(r===`pause`)return gz(e,t,n);if(r===`pick_value`)return _z(e,t,n);throw Error(`Unhandled step type: ${r}`)}function pz(e){if(e.run!=null){if(typeof e.run==`object`)return e.run.class===`GalaxyUserTool`?`tool`:`subworkflow`;if(typeof e.run==`string`)return`subworkflow`}let t=e.type??`tool`;return iz[t]??t}function mz(e,t,n){let r;if(e.run&&typeof e.run==`object`){let t=e.run;t.class===`GalaxyUserTool`&&(r=t)}let i={__page__:0},a=vz(e),o=e.runtime_inputs??[],s;if(e.state!=null||o.length>0){s=e.state?{...e.state}:{};for(let e of o)s[e]={__class__:`RuntimeValue`}}else s=e.tool_state==null?{}:{...e.tool_state};let c=n.options.stateEncodeToNative?.(e,s)??s;Object.keys(c).length>0&&Object.assign(i,c);let l=yz(a,n),u=bz(e.out),d=new Set(Object.keys(l)),f=r!=null,p=f?null:e.tool_id??void 0;return{id:t,type:`tool`,label:wz(e),name:p??r?.name??`User Defined Tool`,annotation:e.doc??``,tool_id:p,tool_version:e.tool_version??void 0,tool_shed_repository:e.tool_shed_repository,tool_state:i,tool_representation:r,tool_uuid:f?null:e.uuid??void 0,input_connections:l,post_job_actions:u,position:Tz(e.position,t),when:e.when??void 0,uuid:e.uuid??void 0,errors:e.errors??void 0,inputs:[],outputs:[],workflow_outputs:[],connected_paths:d}}function hz(e,t,n){let r=null,i=null,a;if(typeof e.run==`object`&&e.run!=null){a=n.childContext();let t=e.run;lz(t,a),r=uz(t,a)}else typeof e.run==`string`&&(i=e.run);let o=yz(vz(e),n,r!=null,a),s=bz(e.out),c=new Set(Object.keys(o));return{id:t,type:`subworkflow`,label:wz(e),annotation:e.doc??``,tool_state:{},subworkflow:r,content_id:i,input_connections:o,post_job_actions:s,position:Tz(e.position,t),when:e.when??void 0,uuid:e.uuid??void 0,inputs:[],outputs:[],workflow_outputs:[],connected_paths:c}}function gz(e,t,n){let r=e.label??e.id??`Pause for dataset review`,i=yz(vz(e),n),a=new Set(Object.keys(i));return{id:t,type:`pause`,label:wz(e),name:r,annotation:e.doc??``,tool_state:{name:r},input_connections:i,inputs:[{name:r,description:``}],outputs:[],workflow_outputs:[],post_job_actions:{},position:Tz(e.position,t),uuid:e.uuid??void 0,connected_paths:a}}function _z(e,t,n){let r=e.label??e.id??`Pick Value`,i=e.state?{...e.state}:{};i.name=r;let a=yz(vz(e),n),o=new Set(Object.keys(a)),s=Object.keys(a).length;s>0&&(i.num_inputs=Math.max(2,s));let c=bz([...e.out]);return{id:t,type:`pick_value`,label:wz(e),name:r,annotation:e.doc??``,tool_state:i,input_connections:a,post_job_actions:c,inputs:[{name:r,description:``}],outputs:[],workflow_outputs:[],position:Tz(e.position,t),uuid:e.uuid??void 0,connected_paths:o}}function vz(e){let t={};for(let n of e.in){let e=n.id;if(!e)continue;let r=n.source;r!=null&&(Array.isArray(r)?t[e]=[...r]:t[e]=[r])}return t}function yz(e,t,n=!1,r){let i={};for(let[a,o]of Object.entries(e)){let e=[];for(let i of o){let o=i;a===`$step`&&(o=i+`/__NO_INPUT_OUTPUT_NAME__`);let[s,c]=t.stepOutput(o),l={id:s,output_name:c};n&&r&&r.labels.has(a)&&(l.input_subworkflow_step_id=r.stepId(a)),e.push(l)}let s=a===`$step`?`__NO_INPUT_OUTPUT_NAME__`:a;e.length>0&&(i[s]=e)}return i}function bz(e){let t={};for(let n of e){let e=n.id;if(e)for(let[r,i]of Object.entries(oz)){let a=n[r]??void 0;if(a??=i.defaultVal,xz(a)){let n=i.actionClass+e;t[n]={action_type:i.actionClass,output_name:e,action_arguments:i.arguments(a)}}}}return t}function xz(e){return e===!1||e==null?!1:Array.isArray(e)?e.length>0:typeof e==`object`?Object.keys(e).length>0:!!e}function Sz(e,t,n){for(let r of e){let e=r.outputSource;if(!e)continue;let[i,a]=n.stepOutput(e),o=String(i);if(!(o in t))continue;let s=r.label??r.id,c={output_name:a,label:(s&&s.startsWith(`_anonymous_output_`)?null:s)??void 0};t[o].workflow_outputs.push(c)}}function Cz(e,t){let n=e.comments;if(!n)return;let r;if(Array.isArray(n)){if(n.length===0)return;r=n}else if(typeof n==`object`){if(r=Object.entries(n).map(([e,t])=>({...t,label:e})),r.length===0)return}else return;let i=new Map;for(let e=0;e<r.length;e++){let t=r[e];t.label&&i.set(t.label,e)}let a=[];for(let e=0;e<r.length;e++){let n=jR(r[e]);n.id=e,n.child_steps&&Array.isArray(n.child_steps)&&(n.child_steps=n.child_steps.map(e=>typeof e==`string`?t.stepId(e):e)),n.child_comments&&Array.isArray(n.child_comments)&&(n.child_comments=n.child_comments.map(e=>{if(typeof e==`string`){if(!i.has(e))throw Error(`contains_comments references unknown comment label '${e}'`);return i.get(e)}return e})),a.push(n)}return a}function wz(e){return e.label==null?e.id&&!/^\d+$/.test(e.id)?IR(e.id)?null:e.id:null:IR(e.label)?null:e.label}function Tz(e,t){return e??{left:10*t,top:10*t}}function Ez(e){return e==null?e:Array.isArray(e)?e.length>0?e.join(`
268
- `):null:e}function Dz(e){return e.a_galaxy_workflow===`true`?BR(e):pR(e)}var Oz=new Set([`__page__`,`__rerun_remap_job_id__`]),kz=new Set([`chromInfo`,`__input_ext`]),Az=new Set([`__current_case__`,`__index__`]);new Set([...Oz,...kz,...Az]);function jz(e,t,n,r){return`${e}|${t}->${n}|${r}`}var Mz=[`>`,`]`],Nz=[`{{`,`}}`],Pz=[`[`,`]`],Fz={data:Mz,collection:Mz,integer:Nz,float:Nz,text:Nz,boolean:Nz,color:Nz,input:Mz,tool:Pz,subworkflow:[`[[`,`]]`]},Iz=`toolshed.g2.bx.psu.edu/repos/`;function Lz(e){let t=e.replace(/"/g,`#quot;`);for(let e of`()[]{}<>`)t=t.replaceAll(e,`#${e.charCodeAt(0)};`);return t}function Rz(e){return e==null?`input`:Array.isArray(e)?e.length>0?e[0]:`input`:e}function zz(e,t,n){return`${e}${n[0]}"${t}"${n[1]}`}function Bz(e){if(e==null)return[];let t=Array.isArray(e)?e:typeof e==`object`?Object.values(e):[],n=[];for(let e of t){if(!e||typeof e!=`object`)continue;let t=e;if(t.type!==`frame`)continue;let r=t.contains_steps;!Array.isArray(r)||r.length===0||n.push({title:typeof t.title==`string`?t.title:null,containsSteps:r.map(e=>String(e))})}return n}function Vz(e,t={}){let n=typeof e==`object`&&e&&e.class===`GalaxyWorkflow`&&Array.isArray(e.inputs)&&`unique_tools`in e?e:Dz(e),r=[`graph LR`],i=new Map,a=new Map;n.inputs.forEach((e,t)=>{let n=`input_${t}`,r=e.id||String(t);i.set(r,n);let o=Lz(r),s=Rz(e.type),c=Fz[s]??Mz;a.set(r,zz(n,`${o}<br/><i>${s}</i>`,c))});let o=new Map,s=new Map;n.steps.forEach((e,t)=>{let n=`step_${t}`,r=e.label||e.id;o.set(r,n);let i=e.tool_id??null;i&&i.startsWith(Iz)&&(i=i.slice(29));let a=e.id&&!FR(e.id)?e.id:null,c=Lz(e.label||a||(i?`tool:${i}`:String(t))),l=Fz[e.type||(e.run==null?`tool`:`subworkflow`)]??Pz;s.set(r,zz(n,c,l))});let c=new Set,l=[];if(t.comments){let e=n.comments;for(let t of Bz(e)){l.push(t);for(let e of t.containsSteps)c.add(e)}}for(let[e,t]of a)c.has(e)||r.push(` ${t}`);for(let[e,t]of s)c.has(e)||r.push(` ${t}`);l.forEach((e,t)=>{let n=Lz(e.title||`Group ${t}`);r.push(` subgraph sub_${t} ["${n}"]`);for(let t of e.containsSteps)a.has(t)?r.push(` ${a.get(t)}`):s.has(t)&&r.push(` ${s.get(t)}`);r.push(` end`)});let u=new Set([...i.keys(),...o.keys()]),d=new Set,f=[],p=0;n.steps.forEach((e,n)=>{let a=`step_${n}`,s=e.label||e.id;for(let n of e.in){if(n.source==null)continue;let e=n.id||``,c=Array.isArray(n.source)?n.source:[n.source];for(let n of c){let[c,l]=RR(n,u),m=i.get(c)??o.get(c);if(!m)continue;let h=`${m}->${a}`;if(d.has(h))continue;d.add(h);let g=t.edgeAnnotations?.get(jz(c,l,s,e)),{line:_,linkStyle:v}=Hz(m,a,g,p);r.push(` ${_}`),v&&f.push(v),p++}}});for(let e of f)r.push(` ${e}`);return r.join(`
269
- `)}function Hz(e,t,n,r){if(!n||n.mapDepth===0&&!n.reduction)return{line:`${e} --> ${t}`,linkStyle:null};if(n.reduction)return{line:`${e} -. "${n.mapping?Lz(`reduce ${n.mapping}`):`reduce`}" .-> ${t}`,linkStyle:`linkStyle ${r} stroke:#a55,stroke-dasharray:6 4`};let i=Lz(n.mapping??`map`),a=2+n.mapDepth;return{line:`${e} ==>|"${i}"| ${t}`,linkStyle:`linkStyle ${r} stroke:#5a8,stroke-width:${a}px`}}function Uz(e){return e===`preset`||e===`topological`}function Wz(e){let t=e.nodes.map(e=>e.data.id),n=new Map;t.forEach((e,t)=>n.set(e,t));let r=new Map;for(let e of t)r.set(e,[]);for(let t of e.edges){let{source:e,target:i}=t.data;!n.has(e)||!n.has(i)||r.get(i).push(e)}let i=new Map;for(let[e,t]of r)i.set(e,t.length);let a=new Map,o=[...t.filter(e=>i.get(e)===0)];o.sort((e,t)=>n.get(e)-n.get(t));let s=new Set,c=new Map;for(let e of t)c.set(e,[]);for(let[e,t]of r)for(let n of t)c.get(n).push(e);for(;o.length>0;){let e=0;for(let t=1;t<o.length;t++)n.get(o[t])<n.get(o[e])&&(e=t);let t=o.splice(e,1)[0];s.add(t);let l=r.get(t);if(l.length===0)a.set(t,0);else{let e=0;for(let t of l){let n=a.get(t);n!==void 0&&n+1>e&&(e=n+1)}a.set(t,e)}for(let e of c.get(t)){let t=i.get(e)-1;i.set(e,t),t===0&&o.push(e)}}for(let e of t)s.has(e)||a.set(e,n.get(e));let l=new Map;for(let e of t){let t=a.get(e);l.has(t)||l.set(t,[]),l.get(t).push(e)}let u=new Map;for(let[e,t]of l)t.forEach((t,n)=>{u.set(t,{x:e*220,y:n*100})});return u}var Gz=`toolshed.g2.bx.psu.edu/repos/`;function Kz(e,t={}){let n=typeof e==`object`&&e&&e.class===`GalaxyWorkflow`&&Array.isArray(e.inputs)&&`unique_tools`in e?e:Dz(e),r=t.layout??`preset`,i=[],a=[];n.inputs.forEach((e,t)=>{i.push(Xz(e,t))});let o=n.inputs.length,s=new Set;for(let e of n.inputs)s.add(e.id);for(let e of n.steps)s.add(e.label||e.id);n.steps.forEach((e,n)=>{i.push(Zz(e,n+o)),a.push(...Qz(e,s,t.edgeAnnotations))});let c={nodes:i,edges:a};if(r===`preset`)return c;if(Uz(r)){let e=Wz(c);for(let t of i){let n=e.get(t.data.id);n&&(t.position=n)}}else for(let e of i)delete e.position;return c.layout={name:r},c}function qz(e){return{x:10*e,y:10*e}}function Jz(e,t){if(e==null)return qz(t);let n=e.left,r=e.top,i=typeof n==`number`?Math.trunc(n):Number.parseInt(String(n??0),10),a=typeof r==`number`?Math.trunc(r):Number.parseInt(String(r??0),10);return{x:Number.isFinite(i)?i:0,y:Number.isFinite(a)?a:0}}function Yz(e){return e==null?`input`:typeof e==`string`?e:e.length>0?`${e[0]}[]`:`input`}function Xz(e,t){let n=e.id||String(t),r=Yz(e.type);return{group:`nodes`,data:{id:n,label:n,doc:typeof e.doc==`string`?e.doc:null,tool_id:null,step_type:r,repo_link:null},classes:[`type_${r}`,`input`],position:Jz(e.position,t)}}function Zz(e,t){let n=e.label||e.id,r=e.type||(e.run==null?`tool`:`subworkflow`),i=e.tool_id??null;i&&i.startsWith(Gz)&&(i=i.slice(29));let a=e.id&&!FR(e.id)?e.id:null,o=e.label||a||(i?`tool:${i}`:String(t)),s=null,c=e.tool_shed_repository;return c&&(s=`https://${c.tool_shed}/view/${c.owner}/${c.name}/${c.changeset_revision}`),{group:`nodes`,data:{id:n,label:o,doc:typeof e.doc==`string`?e.doc:null,tool_id:e.tool_id??null,step_type:r,repo_link:s},classes:[`type_${r}`,`runnable`],position:Jz(e.position,t)}}function Qz(e,t,n){let r=e.label||e.id,i=[];for(let a of e.in){if(a.source==null)continue;let e=a.id||`unknown`,o=Array.isArray(a.source)?a.source:[a.source];for(let a of o){let[o,s]=RR(a,t),c=s===`output`?null:s,l={group:`edges`,data:{id:`${r}__${e}__from__${o}`,source:o,target:r,input:e,output:c}},u=n?.get(jz(o,s,r,e));if(u){l.data.map_depth=u.mapDepth,l.data.reduction=u.reduction,l.data.mapping=u.mapping??null;let e=[];u.mapDepth>0&&e.push(`mapover_${u.mapDepth}`),u.reduction&&e.push(`reduction`),e.length>0&&(l.classes=e)}i.push(l)}}return i}function $z(e){return[...e.nodes,...e.edges]}var eB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),tB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=eB(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=eB(),n=tB(),r=eB();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=tB();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ue(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ue(this.rhs,e,n),this}get names(){return le(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ue(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(de(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ce(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(fe(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ue(this.condition,e,t),this}get names(){let e=super.names;return le(e,this.condition),this.else&&ce(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var ee=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ue(this.iteration,e,t),this}get names(){return ce(super.names,this.iteration.names)}},te=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return le(le(super.names,this.from),this.to)}},ne=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ue(this.iterable,e,t),this}get names(){return ce(super.names,this.iterable.names)}},re=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};re.kind=`func`;var ie=class extends p{render(e){return`return `+super.render(e)}};ie.kind=`return`;var ae=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&ce(e,this.catch.names),this.finally&&ce(e,this.finally.names),e}},oe=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};oe.kind=`catch`;var se=class extends m{render(e){return`finally`+super.render(e)}};se.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
270
- `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new ee(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new te(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new ne(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new ne(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new ie;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(ie)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new ae;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new oe(e),t(e)}return n&&(this._currNode=r.finally=new se,this.code(n)),this._endBlockNode(oe,se)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new re(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(re)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function ce(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function le(e,n){return n instanceof t._CodeOrName?ce(e,n.names):e}function ue(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function de(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function fe(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${ve(e)}`}e.not=fe;var pe=_e(e.operators.AND);function me(...e){return e.reduce(pe)}e.and=me;var he=_e(e.operators.OR);function ge(...e){return e.reduce(he)}e.or=ge;function _e(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${ve(n)} ${e} ${ve(r)}`}function ve(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Q(),n=eB();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||ne(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var ee;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(ee||(e.Type=ee={}));function te(e,n,r){if(e instanceof t.Name){let i=n===ee.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=te;function ne(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=ne})),nB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),rB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Q(),n=$(),r=nB();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),iB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=rB(),n=Q(),r=nB(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),aB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),oB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),sB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=aB(),n=oB(),r=rB(),i=Q(),a=$(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
271
- || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
272
- || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
273
- || ${s} === "boolean" || ${a} === null`).assign(c,(0,i._)`[${a}]`)}}}function p({gen:e,parentData:t,parentDataProperty:n},r){e.if((0,i._)`${t} !== undefined`,()=>e.assign((0,i._)`${t}[${n}]`,r))}function m(e,t,n,r=o.Correct){let a=r===o.Correct?i.operators.EQ:i.operators.NEQ,s;switch(e){case`null`:return(0,i._)`${t} ${a} null`;case`array`:s=(0,i._)`Array.isArray(${t})`;break;case`object`:s=(0,i._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case`integer`:s=c((0,i._)`!(${t} % 1) && !isNaN(${t})`);break;case`number`:s=c();break;default:return(0,i._)`typeof ${t} ${a} ${e}`}return r===o.Correct?s:(0,i.not)(s);function c(e=i.nil){return(0,i.and)((0,i._)`typeof ${t} == "number"`,e,n?(0,i._)`isFinite(${t})`:i.nil)}}e.checkDataType=m;function h(e,t,n,r){if(e.length===1)return m(e[0],t,n,r);let o,s=(0,a.toHash)(e);if(s.array&&s.object){let e=(0,i._)`typeof ${t} != "object"`;o=s.null?e:(0,i._)`!${t} || ${e}`,delete s.null,delete s.array,delete s.object}else o=i.nil;s.number&&delete s.integer;for(let e in s)o=(0,i.and)(o,m(e,t,n,r));return o}e.checkDataTypes=h;var g={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e==`string`?(0,i._)`{type: ${e}}`:(0,i._)`{type: ${t}}`};function _(e){let t=v(e);(0,r.reportError)(t,g)}e.reportTypeError=_;function v(e){let{gen:t,data:n,schema:r}=e,i=(0,a.schemaRefOrVal)(e,r,`type`);return{gen:t,keyword:`type`,data:n,schema:r.type,schemaCode:i,schemaValue:i,parentSchema:r,params:{},it:e}}})),cB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assignDefaults=void 0;var t=Q(),n=$();function r(e,t){let{properties:n,items:r}=e.schema;if(t===`object`&&n)for(let t in n)i(e,t,n[t].default);else t===`array`&&Array.isArray(r)&&r.forEach((t,n)=>i(e,n,t.default))}e.assignDefaults=r;function i(e,r,i){let{gen:a,compositeRule:o,data:s,opts:c}=e;if(i===void 0)return;let l=(0,t._)`${s}${(0,t.getProperty)(r)}`;if(o){(0,n.checkStrictMode)(e,`default is ignored for: ${l}`);return}let u=(0,t._)`${l} === undefined`;c.useDefaults===`empty`&&(u=(0,t._)`${u} || ${l} === null || ${l} === ""`),a.if(u,(0,t._)`${l} = ${(0,t.stringify)(i)}`)}})),lB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;var t=Q(),n=$(),r=nB(),i=$();function a(e,n){let{gen:r,data:i,it:a}=e;r.if(d(r,i,n,a.opts.ownProperties),()=>{e.setParams({missingProperty:(0,t._)`${n}`},!0),e.error()})}e.checkReportMissingProp=a;function o({gen:e,data:n,it:{opts:r}},i,a){return(0,t.or)(...i.map(i=>(0,t.and)(d(e,n,i,r.ownProperties),(0,t._)`${a} = ${i}`)))}e.checkMissingProp=o;function s(e,t){e.setParams({missingProperty:t},!0),e.error()}e.reportMissingProp=s;function c(e){return e.scopeValue(`func`,{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=c;function l(e,n,r){return(0,t._)`${c(e)}.call(${n}, ${r})`}e.isOwnProperty=l;function u(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} !== undefined`;return i?(0,t._)`${a} && ${l(e,n,r)}`:a}e.propertyInData=u;function d(e,n,r,i){let a=(0,t._)`${n}${(0,t.getProperty)(r)} === undefined`;return i?(0,t.or)(a,(0,t.not)(l(e,n,r))):a}e.noPropertyInData=d;function f(e){return e?Object.keys(e).filter(e=>e!==`__proto__`):[]}e.allSchemaProperties=f;function p(e,t){return f(t).filter(r=>!(0,n.alwaysValidSchema)(e,t[r]))}e.schemaProperties=p;function m({schemaCode:e,data:n,it:{gen:i,topSchemaRef:a,schemaPath:o,errorPath:s},it:c},l,u,d){let f=d?(0,t._)`${e}, ${n}, ${a}${o}`:n,p=[[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,s)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&p.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);let m=(0,t._)`${f}, ${i.object(...p)}`;return u===t.nil?(0,t._)`${l}(${m})`:(0,t._)`${l}.call(${u}, ${m})`}e.callValidateCode=m;var h=(0,t._)`new RegExp`;function g({gen:e,it:{opts:n}},r){let a=n.unicodeRegExp?`u`:``,{regExp:o}=n.code,s=o(r,a);return e.scopeValue(`pattern`,{key:s.toString(),ref:s,code:(0,t._)`${o.code===`new RegExp`?h:(0,i.useFunc)(e,o)}(${r}, ${a})`})}e.usePattern=g;function _(e){let{gen:r,data:i,keyword:a,it:o}=e,s=r.name(`valid`);if(o.allErrors){let e=r.let(`valid`,!0);return c(()=>r.assign(e,!1)),e}return r.var(s,!0),c(()=>r.break()),s;function c(o){let c=r.const(`len`,(0,t._)`${i}.length`);r.forRange(`i`,0,c,i=>{e.subschema({keyword:a,dataProp:i,dataPropType:n.Type.Num},s),r.if((0,t.not)(s),o)})}}e.validateArray=_;function v(e){let{gen:r,schema:i,keyword:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(i.some(e=>(0,n.alwaysValidSchema)(o,e))&&!o.opts.unevaluated)return;let s=r.let(`valid`,!1),c=r.name(`_valid`);r.block(()=>i.forEach((n,i)=>{let o=e.subschema({keyword:a,schemaProp:i,compositeRule:!0},c);r.assign(s,(0,t._)`${s} || ${c}`),e.mergeValidEvaluated(o,c)||r.if((0,t.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}e.validateUnion=v})),uB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;var t=Q(),n=nB(),r=lB(),i=rB();function a(e,n){let{gen:r,keyword:i,schema:a,parentSchema:o,it:s}=e,c=n.macro.call(s.self,a,o,s),l=u(r,i,c);s.opts.validateSchema!==!1&&s.self.validateSchema(c,!0);let d=r.name(`valid`);e.subschema({schema:c,schemaPath:t.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:l,compositeRule:!0},d),e.pass(d,()=>e.error(!0))}e.macroKeywordCode=a;function o(e,i){let{gen:a,keyword:o,schema:d,parentSchema:f,$data:p,it:m}=e;l(m,i);let h=u(a,o,!p&&i.compile?i.compile.call(m.self,d,f,m):i.validate),g=a.let(`valid`);e.block$data(g,_),e.ok(i.valid??g);function _(){if(i.errors===!1)te(),i.modifying&&s(e),ne(()=>e.error());else{let t=i.async?v():ee();i.modifying&&s(e),ne(()=>c(e,t))}}function v(){let e=a.let(`ruleErrs`,null);return a.try(()=>te((0,t._)`await `),n=>a.assign(g,!1).if((0,t._)`${n} instanceof ${m.ValidationError}`,()=>a.assign(e,(0,t._)`${n}.errors`),()=>a.throw(n))),e}function ee(){let e=(0,t._)`${h}.errors`;return a.assign(e,null),te(t.nil),e}function te(o=i.async?(0,t._)`await `:t.nil){let s=m.opts.passContext?n.default.this:n.default.self,c=!(`compile`in i&&!p||i.schema===!1);a.assign(g,(0,t._)`${o}${(0,r.callValidateCode)(e,h,s,c)}`,i.modifying)}function ne(e){a.if((0,t.not)(i.valid??g),e)}}e.funcKeywordCode=o;function s(e){let{gen:n,data:r,it:i}=e;n.if(i.parentData,()=>n.assign(r,(0,t._)`${i.parentData}[${i.parentDataProperty}]`))}function c(e,r){let{gen:a}=e;a.if((0,t._)`Array.isArray(${r})`,()=>{a.assign(n.default.vErrors,(0,t._)`${n.default.vErrors} === null ? ${r} : ${n.default.vErrors}.concat(${r})`).assign(n.default.errors,(0,t._)`${n.default.vErrors}.length`),(0,i.extendErrors)(e)},()=>e.error())}function l({schemaEnv:e},t){if(t.async&&!e.$async)throw Error(`async keyword in sync schema`)}function u(e,n,r){if(r===void 0)throw Error(`keyword "${n}" failed to compile`);return e.scopeValue(`keyword`,typeof r==`function`?{ref:r}:{ref:r,code:(0,t.stringify)(r)})}function d(e,t,n=!1){return!t.length||t.some(t=>t===`array`?Array.isArray(e):t===`object`?e&&typeof e==`object`&&!Array.isArray(e):typeof e==t||n&&e===void 0)}e.validSchemaType=d;function f({schema:e,opts:t,self:n,errSchemaPath:r},i,a){if(Array.isArray(i.keyword)?!i.keyword.includes(a):i.keyword!==a)throw Error(`ajv implementation error`);let o=i.dependencies;if(o?.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${a}: ${o.join(`,`)}`);if(i.validateSchema&&!i.validateSchema(e[a])){let e=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(i.validateSchema.errors);if(t.validateSchema===`log`)n.logger.error(e);else throw Error(e)}}e.validateKeywordUsage=f})),dB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;var t=Q(),n=$();function r(e,{keyword:r,schemaProp:i,schema:a,schemaPath:o,errSchemaPath:s,topSchemaRef:c}){if(r!==void 0&&a!==void 0)throw Error(`both "keyword" and "schema" passed, only one allowed`);if(r!==void 0){let a=e.schema[r];return i===void 0?{schema:a,schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${r}`}:{schema:a[i],schemaPath:(0,t._)`${e.schemaPath}${(0,t.getProperty)(r)}${(0,t.getProperty)(i)}`,errSchemaPath:`${e.errSchemaPath}/${r}/${(0,n.escapeFragment)(i)}`}}if(a!==void 0){if(o===void 0||s===void 0||c===void 0)throw Error(`"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"`);return{schema:a,schemaPath:o,topSchemaRef:c,errSchemaPath:s}}throw Error(`either "keyword" or "schema" must be passed`)}e.getSubschema=r;function i(e,r,{dataProp:i,dataPropType:a,data:o,dataTypes:s,propertyName:c}){if(o!==void 0&&i!==void 0)throw Error(`both "data" and "dataProp" passed, only one allowed`);let{gen:l}=r;if(i!==void 0){let{errorPath:o,dataPathArr:s,opts:c}=r;u(l.let(`data`,(0,t._)`${r.data}${(0,t.getProperty)(i)}`,!0)),e.errorPath=(0,t.str)`${o}${(0,n.getErrorPath)(i,a,c.jsPropertySyntax)}`,e.parentDataProperty=(0,t._)`${i}`,e.dataPathArr=[...s,e.parentDataProperty]}o!==void 0&&(u(o instanceof t.Name?o:l.let(`data`,o,!0)),c!==void 0&&(e.propertyName=c)),s&&(e.dataTypes=s);function u(t){e.data=t,e.dataLevel=r.dataLevel+1,e.dataTypes=[],r.definedProperties=new Set,e.parentData=r.data,e.dataNames=[...r.dataNames,t]}}e.extendSubschemaData=i;function a(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:i,allErrors:a}){r!==void 0&&(e.compositeRule=r),i!==void 0&&(e.createErrors=i),a!==void 0&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=n}e.extendSubschemaMode=a})),fB=r(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),pB=r(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),mB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;var t=$(),n=fB(),r=pB(),i=new Set([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`,`const`]);function a(e,t=!0){return typeof e==`boolean`?!0:t===!0?!s(e):t?c(e)<=t:!1}e.inlineRef=a;var o=new Set([`$ref`,`$recursiveRef`,`$recursiveAnchor`,`$dynamicRef`,`$dynamicAnchor`]);function s(e){for(let t in e){if(o.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(s)||typeof n==`object`&&s(n))return!0}return!1}function c(e){let n=0;for(let r in e)if(r===`$ref`||(n++,!i.has(r)&&(typeof e[r]==`object`&&(0,t.eachItem)(e[r],e=>n+=c(e)),n===1/0)))return 1/0;return n}function l(e,t=``,n){return n!==!1&&(t=f(t)),u(e,e.parse(t))}e.getFullPath=l;function u(e,t){return e.serialize(t).split(`#`)[0]+`#`}e._getFullPath=u;var d=/#\/?$/;function f(e){return e?e.replace(d,``):``}e.normalizeId=f;function p(e,t,n){return n=f(n),e.resolve(t,n)}e.resolveUrl=p;var m=/^[a-z_][-a-z0-9._]*$/i;function h(e,t){if(typeof e==`boolean`)return{};let{schemaId:i,uriResolver:a}=this.opts,o=f(e[i]||t),s={"":o},c=l(a,o,!1),u={},d=new Set;return r(e,{allKeys:!0},(e,t,n,r)=>{if(r===void 0)return;let a=c+t,o=s[r];typeof e[i]==`string`&&(o=l.call(this,e[i])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),s[t]=o;function l(t){let n=this.opts.uriResolver.resolve;if(t=f(o?n(o,t):t),d.has(t))throw h(t);d.add(t);let r=this.refs[t];return typeof r==`string`&&(r=this.refs[r]),typeof r==`object`?p(e,r.schema,t):t!==f(a)&&(t[0]===`#`?(p(e,u[t],t),u[t]=e):this.refs[t]=a),t}function g(e){if(typeof e==`string`){if(!m.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}}),u;function p(e,t,r){if(t!==void 0&&!n(e,t))throw h(r)}function h(e){return Error(`reference "${e}" resolves to more than one schema`)}}e.getSchemaRefs=h})),hB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;var t=iB(),n=sB(),r=oB(),i=sB(),a=cB(),o=uB(),s=dB(),c=Q(),l=nB(),u=mB(),d=$(),f=rB();function p(e){if(re(e)&&(ae(e),ne(e))){_(e);return}m(e,()=>(0,t.topBoolOrEmptySchema)(e))}e.validateFunctionCode=p;function m({gen:e,validateName:t,schema:n,schemaEnv:r,opts:i},a){i.code.es5?e.func(t,(0,c._)`${l.default.data}, ${l.default.valCxt}`,r.$async,()=>{e.code((0,c._)`"use strict"; ${ee(n,i)}`),g(e,i),e.code(a)}):e.func(t,(0,c._)`${l.default.data}, ${h(i)}`,r.$async,()=>e.code(ee(n,i)).code(a))}function h(e){return(0,c._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${e.dynamicRef?(0,c._)`, ${l.default.dynamicAnchors}={}`:c.nil}}={}`}function g(e,t){e.if(l.default.valCxt,()=>{e.var(l.default.instancePath,(0,c._)`${l.default.valCxt}.${l.default.instancePath}`),e.var(l.default.parentData,(0,c._)`${l.default.valCxt}.${l.default.parentData}`),e.var(l.default.parentDataProperty,(0,c._)`${l.default.valCxt}.${l.default.parentDataProperty}`),e.var(l.default.rootData,(0,c._)`${l.default.valCxt}.${l.default.rootData}`),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{e.var(l.default.instancePath,(0,c._)`""`),e.var(l.default.parentData,(0,c._)`undefined`),e.var(l.default.parentDataProperty,(0,c._)`undefined`),e.var(l.default.rootData,l.default.data),t.dynamicRef&&e.var(l.default.dynamicAnchors,(0,c._)`{}`)})}function _(e){let{schema:t,opts:n,gen:r}=e;m(e,()=>{n.$comment&&t.$comment&&de(e),ce(e),r.let(l.default.vErrors,null),r.let(l.default.errors,0),n.unevaluated&&v(e),oe(e),fe(e)})}function v(e){let{gen:t,validateName:n}=e;e.evaluated=t.const(`evaluated`,(0,c._)`${n}.evaluated`),t.if((0,c._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,c._)`${e.evaluated}.props`,(0,c._)`undefined`)),t.if((0,c._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,c._)`${e.evaluated}.items`,(0,c._)`undefined`))}function ee(e,t){let n=typeof e==`object`&&e[t.schemaId];return n&&(t.code.source||t.code.process)?(0,c._)`/*# sourceURL=${n} */`:c.nil}function te(e,n){if(re(e)&&(ae(e),ne(e))){ie(e,n);return}(0,t.boolOrEmptySchema)(e,n)}function ne({schema:e,self:t}){if(typeof e==`boolean`)return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function re(e){return typeof e.schema!=`boolean`}function ie(e,t){let{schema:n,gen:r,opts:i}=e;i.$comment&&n.$comment&&de(e),le(e),ue(e);let a=r.const(`_errs`,l.default.errors);oe(e,a),r.var(t,(0,c._)`${a} === ${l.default.errors}`)}function ae(e){(0,d.checkUnknownRules)(e),se(e)}function oe(e,t){if(e.opts.jtd)return me(e,[],!1,t);let r=(0,n.getSchemaTypes)(e.schema);me(e,r,!(0,n.coerceAndCheckDataType)(e,r),t)}function se(e){let{schema:t,errSchemaPath:n,opts:r,self:i}=e;t.$ref&&r.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function ce(e){let{schema:t,opts:n}=e;t.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,d.checkStrictMode)(e,`default is ignored in the schema root`)}function le(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function ue(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error(`async schema in sync schema`)}function de({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:i}){let a=n.$comment;if(i.$comment===!0)e.code((0,c._)`${l.default.self}.logger.log(${a})`);else if(typeof i.$comment==`function`){let n=(0,c.str)`${r}/$comment`,i=e.scopeValue(`root`,{ref:t.root});e.code((0,c._)`${l.default.self}.opts.$comment(${a}, ${n}, ${i}.schema)`)}}function fe(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:i,opts:a}=e;n.$async?t.if((0,c._)`${l.default.errors} === 0`,()=>t.return(l.default.data),()=>t.throw((0,c._)`new ${i}(${l.default.vErrors})`)):(t.assign((0,c._)`${r}.errors`,l.default.vErrors),a.unevaluated&&pe(e),t.return((0,c._)`${l.default.errors} === 0`))}function pe({gen:e,evaluated:t,props:n,items:r}){n instanceof c.Name&&e.assign((0,c._)`${t}.props`,n),r instanceof c.Name&&e.assign((0,c._)`${t}.items`,r)}function me(e,t,n,a){let{gen:o,schema:s,data:u,allErrors:f,opts:p,self:m}=e,{RULES:h}=m;if(s.$ref&&(p.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(s,h))){o.block(()=>Te(e,`$ref`,h.all.$ref.definition));return}p.jtd||ge(e,t),o.block(()=>{for(let e of h.rules)g(e);g(h.post)});function g(d){(0,r.shouldUseGroup)(s,d)&&(d.type?(o.if((0,i.checkDataType)(d.type,u,p.strictNumbers)),he(e,d),t.length===1&&t[0]===d.type&&n&&(o.else(),(0,i.reportTypeError)(e)),o.endIf()):he(e,d),f||o.if((0,c._)`${l.default.errors} === ${a||0}`))}}function he(e,t){let{gen:n,schema:i,opts:{useDefaults:o}}=e;o&&(0,a.assignDefaults)(e,t.type),n.block(()=>{for(let n of t.rules)(0,r.shouldUseRule)(i,n)&&Te(e,n.keyword,n.definition,t.type)})}function ge(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(_e(e,t),e.opts.allowUnionTypes||ve(e,t),ye(e,e.dataTypes))}function _e(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{xe(e.dataTypes,t)||Ce(e,`type "${t}" not allowed by context "${e.dataTypes.join(`,`)}"`)}),Se(e,t)}}function ve(e,t){t.length>1&&!(t.length===2&&t.includes(`null`))&&Ce(e,`use allowUnionTypes to allow union type keyword`)}function ye(e,t){let n=e.self.RULES.all;for(let i in n){let a=n[i];if(typeof a==`object`&&(0,r.shouldUseRule)(e.schema,a)){let{type:n}=a.definition;n.length&&!n.some(e=>be(t,e))&&Ce(e,`missing type "${n.join(`,`)}" for keyword "${i}"`)}}}function be(e,t){return e.includes(t)||t===`number`&&e.includes(`integer`)}function xe(e,t){return e.includes(t)||t===`integer`&&e.includes(`number`)}function Se(e,t){let n=[];for(let r of e.dataTypes)xe(t,r)?n.push(r):t.includes(`integer`)&&r===`number`&&n.push(`integer`);e.dataTypes=n}function Ce(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}var we=class{constructor(e,t,n){if((0,o.validateKeywordUsage)(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const(`vSchema`,Oe(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,o.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);(`code`in t?t.trackErrors:t.errors!==!1)&&(this.errsCount=e.gen.const(`_errs`,l.default.errors))}result(e,t,n){this.failResult((0,c.not)(e),t,n)}failResult(e,t,n){this.gen.if(e),n?n():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,c.not)(e),void 0,t)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail((0,c._)`${t} !== undefined && (${(0,c.or)(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?f.reportExtraError:f.reportError)(this,this.def.error,t)}$dataError(){(0,f.reportError)(this,this.def.$dataError||f.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error(`add "trackErrors" to keyword definition`);(0,f.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,n=c.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=c.nil,t=c.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:i,def:a}=this;n.if((0,c.or)((0,c._)`${r} === undefined`,t)),e!==c.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==c.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:a}=this;return(0,c.or)(o(),s());function o(){if(n.length){if(!(t instanceof c.Name))throw Error(`ajv implementation error`);let e=Array.isArray(n)?n:[n];return(0,c._)`${(0,i.checkDataTypes)(e,t,a.opts.strictNumbers,i.DataType.Wrong)}`}return c.nil}function s(){if(r.validateSchema){let n=e.scopeValue(`validate$data`,{ref:r.validateSchema});return(0,c._)`!${n}(${t})`}return c.nil}}subschema(e,t){let n=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(n,this.it,e),(0,s.extendSubschemaMode)(n,e);let r={...this.it,...n,items:void 0,props:void 0};return te(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=d.mergeEvaluated.props(r,e.props,n.props,t)),n.items!==!0&&e.items!==void 0&&(n.items=d.mergeEvaluated.items(r,e.items,n.items,t)))}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,c.Name)),!0}};e.KeywordCxt=we;function Te(e,t,n,r){let i=new we(e,n,t);`code`in n?n.code(i,r):i.$data&&n.validate?(0,o.funcKeywordCode)(i,n):`macro`in n?(0,o.macroKeywordCode)(i,n):(n.compile||n.validate)&&(0,o.funcKeywordCode)(i,n)}var Ee=/^\/(?:[^~]|~0|~1)*$/,De=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Oe(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let i,a;if(e===``)return l.default.rootData;if(e[0]===`/`){if(!Ee.test(e))throw Error(`Invalid JSON-pointer: ${e}`);i=e,a=l.default.rootData}else{let o=De.exec(e);if(!o)throw Error(`Invalid JSON-pointer: ${e}`);let s=+o[1];if(i=o[2],i===`#`){if(s>=t)throw Error(u(`property/index`,s));return r[t-s]}if(s>t)throw Error(u(`data`,s));if(a=n[t-s],!i)return a}let o=a,s=i.split(`/`);for(let e of s)e&&(a=(0,c._)`${a}${(0,c.getProperty)((0,d.unescapeJsonPointer)(e))}`,o=(0,c._)`${o} && ${a}`);return o;function u(e,n){return`Cannot access ${e} ${n} levels up, current level is ${t}`}}e.getData=Oe})),gB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=class extends Error{constructor(e){super(`validation failed`),this.errors=e,this.ajv=this.validation=!0}}})),_B=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=mB();e.default=class extends Error{constructor(e,n,r,i){super(i||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,t.resolveUrl)(e,n,r),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(e,this.missingRef))}}})),vB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;var t=Q(),n=gB(),r=nB(),i=mB(),a=$(),o=hB(),s=class{constructor(e){this.refs={},this.dynamicAnchors={};let t;typeof e.schema==`object`&&(t=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=e.baseId??(0,i.normalizeId)(t?.[e.schemaId||`$id`]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=t?.$async,this.refs={}}};e.SchemaEnv=s;function c(e){let a=d.call(this,e);if(a)return a;let s=(0,i.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,f=new t.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u}),p;e.$async&&(p=f.scopeValue(`Error`,{ref:n.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let m=f.scopeName(`validate`);e.validateName=m;let h={gen:f,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue(`schema`,this.opts.code.source===!0?{ref:e.schema,code:(0,t.stringify)(e.schema)}:{ref:e.schema}),validateName:m,ValidationError:p,schema:e.schema,schemaEnv:e,rootId:s,baseId:e.baseId||s,schemaPath:t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?``:`#`),errorPath:(0,t._)`""`,opts:this.opts,self:this},g;try{this._compilations.add(e),(0,o.validateFunctionCode)(h),f.optimize(this.opts.code.optimize);let n=f.toString();g=`${f.scopeRefs(r.default.scope)}return ${n}`,this.opts.code.process&&(g=this.opts.code.process(g,e));let i=Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:i}),i.errors=null,i.schema=e.schema,i.schemaEnv=e,e.$async&&(i.$async=!0),this.opts.code.source===!0&&(i.source={validateName:m,validateCode:n,scopeValues:f._values}),this.opts.unevaluated){let{props:e,items:n}=h;i.evaluated={props:e instanceof t.Name?void 0:e,items:n instanceof t.Name?void 0:n,dynamicProps:e instanceof t.Name,dynamicItems:n instanceof t.Name},i.source&&(i.source.evaluated=(0,t.stringify)(i.evaluated))}return e.validate=i,e}catch(t){throw delete e.validate,delete e.validateName,g&&this.logger.error(`Error compiling schema, function code:`,g),t}finally{this._compilations.delete(e)}}e.compileSchema=c;function l(e,t,n){n=(0,i.resolveUrl)(this.opts.uriResolver,t,n);let r=e.refs[n];if(r)return r;let a=p.call(this,e,n);if(a===void 0){let r=e.localRefs?.[n],{schemaId:i}=this.opts;r&&(a=new s({schema:r,schemaId:i,root:e,baseId:t}))}if(a!==void 0)return e.refs[n]=u.call(this,a)}e.resolveRef=l;function u(e){return(0,i.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:c.call(this,e)}function d(e){for(let t of this._compilations)if(f(t,e))return t}e.getCompilingSchema=d;function f(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p(e,t){let n;for(;typeof(n=this.refs[t])==`string`;)t=n;return n||this.schemas[t]||m.call(this,e,t)}function m(e,t){let n=this.opts.uriResolver.parse(t),r=(0,i._getFullPath)(this.opts.uriResolver,n),a=(0,i.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===a)return g.call(this,n,e);let o=(0,i.normalizeId)(r),l=this.refs[o]||this.schemas[o];if(typeof l==`string`){let t=m.call(this,e,l);return typeof t?.schema==`object`?g.call(this,n,t):void 0}if(typeof l?.schema==`object`){if(l.validate||c.call(this,l),o===(0,i.normalizeId)(t)){let{schema:t}=l,{schemaId:n}=this.opts,r=t[n];return r&&(a=(0,i.resolveUrl)(this.opts.uriResolver,a,r)),new s({schema:t,schemaId:n,root:e,baseId:a})}return g.call(this,n,l)}}e.resolveSchema=m;var h=new Set([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function g(e,{baseId:t,schema:n,root:r}){if(e.fragment?.[0]!==`/`)return;for(let r of e.fragment.slice(1).split(`/`)){if(typeof n==`boolean`)return;let e=n[(0,a.unescapeFragment)(r)];if(e===void 0)return;n=e;let o=typeof n==`object`&&n[this.opts.schemaId];!h.has(r)&&o&&(t=(0,i.resolveUrl)(this.opts.uriResolver,t,o))}let o;if(typeof n!=`boolean`&&n.$ref&&!(0,a.schemaHasRulesButRef)(n,this.RULES)){let e=(0,i.resolveUrl)(this.opts.uriResolver,t,n.$ref);o=m.call(this,r,e)}let{schemaId:c}=this.opts;if(o||=new s({schema:n,schemaId:c,root:r,baseId:t}),o.schema!==o.root.schema)return o}})),yB=n({$id:()=>bB,additionalProperties:()=>!1,default:()=>TB,description:()=>xB,properties:()=>wB,required:()=>CB,type:()=>SB}),bB,xB,SB,CB,wB,TB,EB=e((()=>{bB=`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`,xB=`Meta-schema for $data reference (JSON AnySchema extension proposal)`,SB=`object`,CB=[`$data`],wB={$data:{type:`string`,anyOf:[{format:`relative-json-pointer`},{format:`json-pointer`}]}},TB={$id:bB,description:xB,type:SB,required:CB,properties:wB,additionalProperties:!1}})),DB=r(((e,t)=>{var n=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function i(e){let t=``,n=0,r=0;for(r=0;r<e.length;r++)if(n=e[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return``;t+=e[r]}return t}var a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function s(e,t,n){if(e.length){let r=i(e);if(r!==``)t.push(r);else return n.error=!0,!1;e.length=0}return!0}function c(e){let t=0,n={error:!1,address:``,zone:``},r=[],a=[],c=!1,l=!1,u=s;for(let i=0;i<e.length;i++){let s=e[i];if(!(s===`[`||s===`]`))if(s===`:`){if(c===!0&&(l=!0),!u(a,r,n))break;if(++t>7){n.error=!0;break}i>0&&e[i-1]===`:`&&(c=!0),r.push(`:`);continue}else if(s===`%`){if(!u(a,r,n))break;u=o}else{a.push(s);continue}}return a.length&&(u===o?n.zone=a.join(``):l?r.push(a.join(``)):r.push(i(a))),n.address=r.join(``),n}function l(e){if(u(e,`:`)<2)return{host:e,isIPV6:!1};let t=c(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,n=t.address;return t.zone&&(e+=`%`+t.zone,n+=`%25`+t.zone),{host:e,isIPV6:!0,escapedHost:n}}}function u(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&n++;return n}function d(e){let t=e,n=[],r=-1,i=0;for(;i=t.length;){if(i===1){if(t===`.`)break;if(t===`/`){n.push(`/`);break}else{n.push(t);break}}else if(i===2){if(t[0]===`.`){if(t[1]===`.`)break;if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&(t[1]===`.`||t[1]===`/`)){n.push(`/`);break}}else if(i===3&&t===`/..`){n.length!==0&&n.pop(),n.push(`/`);break}if(t[0]===`.`){if(t[1]===`.`){if(t[2]===`/`){t=t.slice(3);continue}}else if(t[1]===`/`){t=t.slice(2);continue}}else if(t[0]===`/`&&t[1]===`.`){if(t[2]===`/`){t=t.slice(2);continue}else if(t[2]===`.`&&t[3]===`/`){t=t.slice(3),n.length!==0&&n.pop();continue}}if((r=t.indexOf(`/`,1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join(``)}function f(e,t){let n=t===!0?unescape:escape;return e.scheme!==void 0&&(e.scheme=n(e.scheme)),e.userinfo!==void 0&&(e.userinfo=n(e.userinfo)),e.host!==void 0&&(e.host=n(e.host)),e.path!==void 0&&(e.path=n(e.path)),e.query!==void 0&&(e.query=n(e.query)),e.fragment!==void 0&&(e.fragment=n(e.fragment)),e}function p(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push(`@`)),e.host!==void 0){let n=unescape(e.host);if(!r(n)){let t=l(n);n=t.isIPV6===!0?`[${t.escapedHost}]`:e.host}t.push(n)}return(typeof e.port==`number`||typeof e.port==`string`)&&(t.push(`:`),t.push(String(e.port))),t.length?t.join(``):void 0}t.exports={nonSimpleDomain:a,recomposeAuthority:p,normalizeComponentEncoding:f,removeDotSegments:d,isIPv4:r,isUUID:n,normalizeIPv6:l,stringArrayToHexStripped:i}})),OB=r(((e,t)=>{var{isUUID:n}=DB(),r=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=[`http`,`https`,`ws`,`wss`,`urn`,`urn:uuid`];function a(e){return i.indexOf(e)!==-1}function o(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]===`w`||e.scheme[0]===`W`)&&(e.scheme[1]===`s`||e.scheme[1]===`S`)&&(e.scheme[2]===`s`||e.scheme[2]===`S`):!1}function s(e){return e.host||(e.error=e.error||`HTTP URIs must have a host.`),e}function c(e){let t=String(e.scheme).toLowerCase()===`https`;return(e.port===(t?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}function l(e){return e.secure=o(e),e.resourceName=(e.path||`/`)+(e.query?`?`+e.query:``),e.path=void 0,e.query=void 0,e}function u(e){if((e.port===(o(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){let[t,n]=e.resourceName.split(`?`);e.path=t&&t!==`/`?t:void 0,e.query=n,e.resourceName=void 0}return e.fragment=void 0,e}function d(e,t){if(!e.path)return e.error=`URN can not be parsed`,e;let n=e.path.match(r);if(n){let r=t.scheme||e.scheme||`urn`;e.nid=n[1].toLowerCase(),e.nss=n[2];let i=re(`${r}:${t.nid||e.nid}`);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||`URN can not be parsed.`;return e}function f(e,t){if(e.nid===void 0)throw Error(`URN without nid cannot be serialized`);let n=t.scheme||e.scheme||`urn`,r=e.nid.toLowerCase(),i=re(`${n}:${t.nid||r}`);i&&(e=i.serialize(e,t));let a=e,o=e.nss;return a.path=`${r||t.nid}:${o}`,t.skipEscape=!0,a}function p(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!n(r.uuid))&&(r.error=r.error||`UUID is not valid.`),r}function m(e){let t=e;return t.nss=(e.uuid||``).toLowerCase(),t}var h={scheme:`http`,domainHost:!0,parse:s,serialize:c},g={scheme:`https`,domainHost:h.domainHost,parse:s,serialize:c},_={scheme:`ws`,domainHost:!0,parse:l,serialize:u},v={scheme:`wss`,domainHost:_.domainHost,parse:_.parse,serialize:_.serialize},ee={scheme:`urn`,parse:d,serialize:f,skipNormalize:!0},te={scheme:`urn:uuid`,parse:p,serialize:m,skipNormalize:!0},ne={http:h,https:g,ws:_,wss:v,urn:ee,"urn:uuid":te};Object.setPrototypeOf(ne,null);function re(e){return e&&(ne[e]||ne[e.toLowerCase()])||void 0}t.exports={wsIsSecure:o,SCHEMES:ne,isValidSchemeName:a,getSchemeHandler:re}})),kB=r(((e,t)=>{var{normalizeIPv6:n,removeDotSegments:r,recomposeAuthority:i,normalizeComponentEncoding:a,isIPv4:o,nonSimpleDomain:s}=DB(),{SCHEMES:c,getSchemeHandler:l}=OB();function u(e,t){return typeof e==`string`?e=m(g(e,t),t):typeof e==`object`&&(e=g(m(e,t),t)),e}function d(e,t,n){let r=n?Object.assign({scheme:`null`},n):{scheme:`null`},i=f(g(e,r),g(t,r),r,!0);return r.skipEscape=!0,m(i,r)}function f(e,t,n,i){let a={};return i||(e=g(m(e,n),n),t=g(m(t,n),n)),n||={},!n.tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||``),a.query=t.query):(t.path?(t.path[0]===`/`?a.path=r(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?a.path=`/`+t.path:e.path?a.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:a.path=t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,t.query===void 0?a.query=e.query:a.query=t.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function p(e,t,n){return typeof e==`string`?(e=unescape(e),e=m(a(g(e,n),!0),{...n,skipEscape:!0})):typeof e==`object`&&(e=m(a(e,!0),{...n,skipEscape:!0})),typeof t==`string`?(t=unescape(t),t=m(a(g(t,n),!0),{...n,skipEscape:!0})):typeof t==`object`&&(t=m(a(t,!0),{...n,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function m(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:``},a=Object.assign({},t),o=[],s=l(a.scheme||n.scheme);s&&s.serialize&&s.serialize(n,a),n.path!==void 0&&(a.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),n.scheme!==void 0&&(n.path=n.path.split(`%3A`).join(`:`)))),a.reference!==`suffix`&&n.scheme&&o.push(n.scheme,`:`);let c=i(n);if(c!==void 0&&(a.reference!==`suffix`&&o.push(`//`),o.push(c),n.path&&n.path[0]!==`/`&&o.push(`/`)),n.path!==void 0){let e=n.path;!a.absolutePath&&(!s||!s.absolutePath)&&(e=r(e)),c===void 0&&e[0]===`/`&&e[1]===`/`&&(e=`/%2F`+e.slice(2)),o.push(e)}return n.query!==void 0&&o.push(`?`,n.query),n.fragment!==void 0&&o.push(`#`,n.fragment),o.join(``)}var h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(e,t){let r=Object.assign({},t),i={scheme:void 0,userinfo:void 0,host:``,port:void 0,path:``,query:void 0,fragment:void 0},a=!1;r.reference===`suffix`&&(e=r.scheme?r.scheme+`:`+e:`//`+e);let c=e.match(h);if(c){if(i.scheme=c[1],i.userinfo=c[3],i.host=c[4],i.port=parseInt(c[5],10),i.path=c[6]||``,i.query=c[7],i.fragment=c[8],isNaN(i.port)&&(i.port=c[5]),i.host)if(o(i.host)===!1){let e=n(i.host);i.host=e.host.toLowerCase(),a=e.isIPV6}else a=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference=`same-document`:i.scheme===void 0?i.reference=`relative`:i.fragment===void 0?i.reference=`absolute`:i.reference=`uri`,r.reference&&r.reference!==`suffix`&&r.reference!==i.reference&&(i.error=i.error||`URI is not a `+r.reference+` reference.`);let t=l(r.scheme||i.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&i.host&&(r.domainHost||t&&t.domainHost)&&a===!1&&s(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(e){i.error=i.error||`Host's domain name can not be converted to ASCII: `+e}(!t||t&&!t.skipNormalize)&&(e.indexOf(`%`)!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&=escape(unescape(i.path)),i.fragment&&=encodeURI(decodeURIComponent(i.fragment))),t&&t.parse&&t.parse(i,r)}else i.error=i.error||`URI can not be parsed.`;return i}var _={SCHEMES:c,normalize:u,resolve:d,resolveComponent:f,equal:p,serialize:m,parse:g};t.exports=_,t.exports.default=_,t.exports.fastUri=_})),AB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=kB();t.code=`require("ajv/dist/runtime/uri").default`,e.default=t})),jB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var n=hB();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return n.KeywordCxt}});var r=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return r.CodeGen}});var i=gB(),a=_B(),o=aB(),s=vB(),c=Q(),l=mB(),u=sB(),d=$(),f=(EB(),t(yB).default),p=AB(),m=(e,t)=>new RegExp(e,t);m.code=`new RegExp`;var h=[`removeAdditional`,`useDefaults`,`coerceTypes`],g=new Set([`validate`,`serialize`,`parse`,`wrapper`,`root`,`schema`,`keyword`,`pattern`,`formats`,`validate$data`,`func`,`obj`,`Error`]),_={errorDataPath:``,format:"`validateFormats: false` can be used instead.",nullable:`"nullable" keyword is supported by default.`,jsonPointers:`Deprecated jsPropertySyntax can be used instead.`,extendRefs:`Deprecated ignoreKeywordsWithRef can be used instead.`,missingRefs:`Pass empty schema with $id that should be ignored to ajv.addSchema.`,processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:`"uniqueItems" keyword is always validated.`,unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:`Map is used as cache, schema object as key.`,serialize:`Map is used as cache, schema object as key.`,ajvErrors:`It is default now.`},v={ignoreKeywordsWithRef:``,jsPropertySyntax:``,unicode:`"minLength"/"maxLength" account for unicode characters by default.`},ee=200;function te(e){let t=e.strict,n=e.code?.optimize,r=n===!0||n===void 0?1:n||0,i=e.code?.regExp??m,a=e.uriResolver??p.default;return{strictSchema:e.strictSchema??t??!0,strictNumbers:e.strictNumbers??t??!0,strictTypes:e.strictTypes??t??`log`,strictTuples:e.strictTuples??t??`log`,strictRequired:e.strictRequired??t??!1,code:e.code?{...e.code,optimize:r,regExp:i}:{optimize:r,regExp:i},loopRequired:e.loopRequired??ee,loopEnum:e.loopEnum??ee,meta:e.meta??!0,messages:e.messages??!0,inlineRefs:e.inlineRefs??!0,schemaId:e.schemaId??`$id`,addUsedSchema:e.addUsedSchema??!0,validateSchema:e.validateSchema??!0,validateFormats:e.validateFormats??!0,unicodeRegExp:e.unicodeRegExp??!0,int32range:e.int32range??!0,uriResolver:a}}var ne=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...te(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:g,es5:t,lines:n}),this.logger=ue(e.logger);let r=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),re.call(this,_,e,`NOT SUPPORTED`),re.call(this,v,e,`DEPRECATED`,`warn`),this._metaOpts=ce.call(this),e.formats&&oe.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&se.call(this,e.keywords),typeof e.meta==`object`&&this.addMetaSchema(e.meta),ae.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword(`$async`)}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=f;n===`id`&&(r={...f},r.id=r.$id,delete r.$id),t&&e&&this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e==`object`?e[t]||e:void 0}validate(e,t){let n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);return`$async`in n||(this.errors=n.errors),r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(e,t){await i.call(this,e.$schema);let n=this._addSchema(e,t);return n.validate||o.call(this,n)}async function i(e){e&&!this.getSchema(e)&&await r.call(this,{$ref:e},!0)}async function o(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof a.default))throw t;return s.call(this,t),await c.call(this,t.missingSchema),o.call(this,e)}}function s({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){let n=await l.call(this,e);this.refs[e]||await i.call(this,n.$schema),this.refs[e]||this.addSchema(n,e,t)}async function l(e){let t=this._loading[e];if(t)return t;try{return await(this._loading[e]=n(e))}finally{delete this._loading[e]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,n,r);return this}let i;if(typeof e==`object`){let{schemaId:t}=this.opts;if(i=e[t],i!==void 0&&typeof i!=`string`)throw Error(`schema ${t} must be string`)}return t=(0,l.normalizeId)(t||i),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e==`boolean`)return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let e=`schema is invalid: `+this.errorsText();if(this.opts.validateSchema===`log`)this.logger.error(e);else throw Error(e)}return r}getSchema(e){let t;for(;typeof(t=ie.call(this,e))==`string`;)e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new s.SchemaEnv({schema:{},schemaId:n});if(t=s.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case`undefined`:return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case`string`:{let t=ie.call(this,e);return typeof t==`object`&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case`object`:{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];return n&&(n=(0,l.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw Error(`ajv.removeSchema: invalid parameter`)}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e==`string`)n=e,typeof t==`object`&&(this.logger.warn(`these parameters are deprecated, see docs for addKeyword`),t.keyword=n);else if(typeof e==`object`&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error(`addKeywords: keyword must be string or non-empty array`)}else throw Error(`invalid addKeywords parameters`);if(fe.call(this,n,t),!t)return(0,d.eachItem)(n,e=>pe.call(this,e)),this;he.call(this,t);let r={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(n,r.type.length===0?e=>pe.call(this,e,r):e=>r.type.forEach(t=>pe.call(this,e,r,t))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t==`object`?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let t=n.rules.findIndex(t=>t.keyword===e);t>=0&&n.rules.splice(t,1)}return this}addFormat(e,t){return typeof t==`string`&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=`, `,dataVar:n=`data`}={}){return!e||e.length===0?`No errors`:e.map(e=>`${n}${e.instancePath} ${e.message}`).reduce((e,n)=>e+t+n)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let t=r.split(`/`).slice(1),i=e;for(let e of t)i=i[e];for(let e in n){let t=n[e];if(typeof t!=`object`)continue;let{$data:r}=t.definition,a=i[e];r&&a&&(i[e]=_e(a))}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];(!t||t.test(n))&&(typeof r==`string`?delete e[n]:r&&!r.meta&&(this._cache.delete(r.schema),delete e[n]))}}_addSchema(e,t,n,r=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:o}=this.opts;if(typeof e==`object`)a=e[o];else if(this.opts.jtd)throw Error(`schema must be object`);else if(typeof e!=`boolean`)throw Error(`schema must be object or boolean`);let c=this._cache.get(e);if(c!==void 0)return c;n=(0,l.normalizeId)(a||n);let u=l.getSchemaRefs.call(this,e,n);return c=new s.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith(`#`)&&(n&&this._checkUnique(n),this.refs[n]=c),r&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw Error(`ajv implementation error`);return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}};ne.ValidationError=i.default,ne.MissingRefError=a.default,e.default=ne;function re(e,t,n,r=`error`){for(let i in e){let a=i;a in t&&this.logger[r](`${n}: option ${i}. ${e[a]}`)}}function ie(e){return e=(0,l.normalizeId)(e),this.schemas[e]||this.refs[e]}function ae(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function oe(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function se(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn(`keywords option as map is deprecated, pass array`);for(let t in e){let n=e[t];n.keyword||=t,this.addKeyword(n)}}function ce(){let e={...this.opts};for(let t of h)delete e[t];return e}var le={log(){},warn(){},error(){}};function ue(e){if(e===!1)return le;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error(`logger must implement log, warn and error methods`)}var de=/^[a-z_$][a-z0-9_$:-]*$/i;function fe(e,t){let{RULES:n}=this;if((0,d.eachItem)(e,e=>{if(n.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!de.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!(`code`in t||`validate`in t))throw Error(`$data keyword must have "code" or "validate" function`)}function pe(e,t,n){var r;let i=t?.post;if(n&&i)throw Error(`keyword with "post" flag cannot have "type"`);let{RULES:a}=this,o=i?a.post:a.rules.find(({type:e})=>e===n);if(o||(o={type:n,rules:[]},a.rules.push(o)),a.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?me.call(this,o,s,t.before):o.rules.push(s),a.all[e]=s,(r=t.implements)==null||r.forEach(e=>this.addKeyword(e))}function me(e,t,n){let r=e.rules.findIndex(e=>e.keyword===n);r>=0?e.rules.splice(r,0,t):(e.rules.push(t),this.logger.warn(`rule ${n} is not defined`))}function he(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=_e(t)),e.validateSchema=this.compile(t,!0))}var ge={$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`};function _e(e){return{anyOf:[e,ge]}}})),MB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`id`,code(){throw Error(`NOT SUPPORTED: keyword "id", use "$id" for schema ID`)}}})),NB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.callRef=e.getValidate=void 0;var t=_B(),n=lB(),r=Q(),i=nB(),a=vB(),o=$(),s={keyword:`$ref`,schemaType:`string`,code(e){let{gen:n,schema:i,it:o}=e,{baseId:s,schemaEnv:u,validateName:d,opts:f,self:p}=o,{root:m}=u;if((i===`#`||i===`#/`)&&s===m.baseId)return g();let h=a.resolveRef.call(p,m,s,i);if(h===void 0)throw new t.default(o.opts.uriResolver,s,i);if(h instanceof a.SchemaEnv)return _(h);return v(h);function g(){if(u===m)return l(e,d,u,u.$async);let t=n.scopeValue(`root`,{ref:m});return l(e,(0,r._)`${t}.validate`,m,m.$async)}function _(t){l(e,c(e,t),t,t.$async)}function v(t){let a=n.scopeValue(`schema`,f.code.source===!0?{ref:t,code:(0,r.stringify)(t)}:{ref:t}),o=n.name(`valid`),s=e.subschema({schema:t,dataTypes:[],schemaPath:r.nil,topSchemaRef:a,errSchemaPath:i},o);e.mergeEvaluated(s),e.ok(o)}}};function c(e,t){let{gen:n}=e;return t.validate?n.scopeValue(`validate`,{ref:t.validate}):(0,r._)`${n.scopeValue(`wrapper`,{ref:t})}.validate`}e.getValidate=c;function l(e,t,a,s){let{gen:c,it:l}=e,{allErrors:u,schemaEnv:d,opts:f}=l,p=f.passContext?i.default.this:r.nil;s?m():h();function m(){if(!d.$async)throw Error(`async schema referenced by sync schema`);let i=c.let(`valid`);c.try(()=>{c.code((0,r._)`await ${(0,n.callValidateCode)(e,t,p)}`),_(t),u||c.assign(i,!0)},e=>{c.if((0,r._)`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),g(e),u||c.assign(i,!1)}),e.ok(i)}function h(){e.result((0,n.callValidateCode)(e,t,p),()=>_(t),()=>g(t))}function g(e){let t=(0,r._)`${e}.errors`;c.assign(i.default.vErrors,(0,r._)`${i.default.vErrors} === null ? ${t} : ${i.default.vErrors}.concat(${t})`),c.assign(i.default.errors,(0,r._)`${i.default.vErrors}.length`)}function _(e){if(!l.opts.unevaluated)return;let t=a?.validate?.evaluated;if(l.props!==!0)if(t&&!t.dynamicProps)t.props!==void 0&&(l.props=o.mergeEvaluated.props(c,t.props,l.props));else{let t=c.var(`props`,(0,r._)`${e}.evaluated.props`);l.props=o.mergeEvaluated.props(c,t,l.props,r.Name)}if(l.items!==!0)if(t&&!t.dynamicItems)t.items!==void 0&&(l.items=o.mergeEvaluated.items(c,t.items,l.items));else{let t=c.var(`items`,(0,r._)`${e}.evaluated.items`);l.items=o.mergeEvaluated.items(c,t,l.items,r.Name)}}}e.callRef=l,e.default=s})),PB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=MB(),n=NB();e.default=[`$schema`,`$id`,`$defs`,`$vocabulary`,{keyword:`$comment`},`definitions`,t.default,n.default]})),FB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=t.operators,r={maximum:{okStr:`<=`,ok:n.LTE,fail:n.GT},minimum:{okStr:`>=`,ok:n.GTE,fail:n.LT},exclusiveMaximum:{okStr:`<`,ok:n.LT,fail:n.GTE},exclusiveMinimum:{okStr:`>`,ok:n.GT,fail:n.LTE}};e.default={keyword:Object.keys(r),type:`number`,schemaType:`number`,$data:!0,error:{message:({keyword:e,schemaCode:n})=>(0,t.str)`must be ${r[e].okStr} ${n}`,params:({keyword:e,schemaCode:n})=>(0,t._)`{comparison: ${r[e].okStr}, limit: ${n}}`},code(e){let{keyword:n,data:i,schemaCode:a}=e;e.fail$data((0,t._)`${i} ${r[n].fail} ${a} || isNaN(${i})`)}}})),IB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={keyword:`multipleOf`,type:`number`,schemaType:`number`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,t._)`{multipleOf: ${e}}`},code(e){let{gen:n,data:r,schemaCode:i,it:a}=e,o=a.opts.multipleOfPrecision,s=n.let(`res`),c=o?(0,t._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,t._)`${s} !== parseInt(${s})`;e.fail$data((0,t._)`(${i} === 0 || (${s} = ${r}/${i}, ${c}))`)}}})),LB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function t(e){let t=e.length,n=0,r=0,i;for(;r<t;)n++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<t&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return n}e.default=t,t.code=`require("ajv/dist/runtime/ucs2length").default`})),RB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$(),r=LB();e.default={keyword:[`maxLength`,`minLength`],type:`string`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxLength`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} characters`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:i,data:a,schemaCode:o,it:s}=e,c=i===`maxLength`?t.operators.GT:t.operators.LT,l=s.opts.unicode===!1?(0,t._)`${a}.length`:(0,t._)`${(0,n.useFunc)(e.gen,r.default)}(${a})`;e.fail$data((0,t._)`${l} ${c} ${o}`)}}})),zB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=lB(),n=$(),r=Q();e.default={keyword:`pattern`,type:`string`,schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,r.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,r._)`{pattern: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e,u=l.opts.unicodeRegExp?`u`:``;if(o){let{regExp:t}=l.opts.code,o=t.code===`new RegExp`?(0,r._)`new RegExp`:(0,n.useFunc)(i,t),s=i.let(`valid`);i.try(()=>i.assign(s,(0,r._)`${o}(${c}, ${u}).test(${a})`),()=>i.assign(s,!1)),e.fail$data((0,r._)`!${s}`)}else{let n=(0,t.usePattern)(e,s);e.fail$data((0,r._)`!${n}.test(${a})`)}}}})),BB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={keyword:[`maxProperties`,`minProperties`],type:`object`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxProperties`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} properties`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxProperties`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`Object.keys(${r}).length ${a} ${i}`)}}})),VB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=lB(),n=Q(),r=$();e.default={keyword:`required`,type:`object`,schemaType:`array`,$data:!0,error:{message:({params:{missingProperty:e}})=>(0,n.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,n._)`{missingProperty: ${e}}`},code(e){let{gen:i,schema:a,schemaCode:o,data:s,$data:c,it:l}=e,{opts:u}=l;if(!c&&a.length===0)return;let d=a.length>=u.loopRequired;if(l.allErrors?f():p(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:n}=e.it;for(let e of a)if(t?.[e]===void 0&&!n.has(e)){let t=`required property "${e}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,t,l.opts.strictRequired)}}function f(){if(d||c)e.block$data(n.nil,m);else for(let n of a)(0,t.checkReportMissingProp)(e,n)}function p(){let n=i.let(`missing`);if(d||c){let t=i.let(`valid`,!0);e.block$data(t,()=>h(n,t)),e.ok(t)}else i.if((0,t.checkMissingProp)(e,a,n)),(0,t.reportMissingProp)(e,n),i.else()}function m(){i.forOf(`prop`,o,n=>{e.setParams({missingProperty:n}),i.if((0,t.noPropertyInData)(i,s,n,u.ownProperties),()=>e.error())})}function h(r,a){e.setParams({missingProperty:r}),i.forOf(r,o,()=>{i.assign(a,(0,t.propertyInData)(i,s,r,u.ownProperties)),i.if((0,n.not)(a),()=>{e.error(),i.break()})},n.nil)}}}})),HB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={keyword:[`maxItems`,`minItems`],type:`array`,schemaType:`number`,$data:!0,error:{message({keyword:e,schemaCode:n}){let r=e===`maxItems`?`more`:`fewer`;return(0,t.str)`must NOT have ${r} than ${n} items`},params:({schemaCode:e})=>(0,t._)`{limit: ${e}}`},code(e){let{keyword:n,data:r,schemaCode:i}=e,a=n===`maxItems`?t.operators.GT:t.operators.LT;e.fail$data((0,t._)`${r}.length ${a} ${i}`)}}})),UB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=fB();t.code=`require("ajv/dist/runtime/equal").default`,e.default=t})),WB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=sB(),n=Q(),r=$(),i=UB();e.default={keyword:`uniqueItems`,type:`array`,schemaType:`boolean`,$data:!0,error:{message:({params:{i:e,j:t}})=>(0,n.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,n._)`{i: ${e}, j: ${t}}`},code(e){let{gen:a,data:o,$data:s,schema:c,parentSchema:l,schemaCode:u,it:d}=e;if(!s&&!c)return;let f=a.let(`valid`),p=l.items?(0,t.getSchemaTypes)(l.items):[];e.block$data(f,m,(0,n._)`${u} === false`),e.ok(f);function m(){let t=a.let(`i`,(0,n._)`${o}.length`),r=a.let(`j`);e.setParams({i:t,j:r}),a.assign(f,!0),a.if((0,n._)`${t} > 1`,()=>(h()?g:_)(t,r))}function h(){return p.length>0&&!p.some(e=>e===`object`||e===`array`)}function g(r,i){let s=a.name(`item`),c=(0,t.checkDataTypes)(p,s,d.opts.strictNumbers,t.DataType.Wrong),l=a.const(`indices`,(0,n._)`{}`);a.for((0,n._)`;${r}--;`,()=>{a.let(s,(0,n._)`${o}[${r}]`),a.if(c,(0,n._)`continue`),p.length>1&&a.if((0,n._)`typeof ${s} == "string"`,(0,n._)`${s} += "_"`),a.if((0,n._)`typeof ${l}[${s}] == "number"`,()=>{a.assign(i,(0,n._)`${l}[${s}]`),e.error(),a.assign(f,!1).break()}).code((0,n._)`${l}[${s}] = ${r}`)})}function _(t,s){let c=(0,r.useFunc)(a,i.default),l=a.name(`outer`);a.label(l).for((0,n._)`;${t}--;`,()=>a.for((0,n._)`${s} = ${t}; ${s}--;`,()=>a.if((0,n._)`${c}(${o}[${t}], ${o}[${s}])`,()=>{e.error(),a.assign(f,!1).break(l)})))}}}})),GB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$(),r=UB();e.default={keyword:`const`,$data:!0,error:{message:`must be equal to constant`,params:({schemaCode:e})=>(0,t._)`{allowedValue: ${e}}`},code(e){let{gen:i,data:a,$data:o,schemaCode:s,schema:c}=e;o||c&&typeof c==`object`?e.fail$data((0,t._)`!${(0,n.useFunc)(i,r.default)}(${a}, ${s})`):e.fail((0,t._)`${c} !== ${a}`)}}})),KB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$(),r=UB();e.default={keyword:`enum`,schemaType:`array`,$data:!0,error:{message:`must be equal to one of the allowed values`,params:({schemaCode:e})=>(0,t._)`{allowedValues: ${e}}`},code(e){let{gen:i,data:a,$data:o,schema:s,schemaCode:c,it:l}=e;if(!o&&s.length===0)throw Error(`enum must have non-empty array`);let u=s.length>=l.opts.loopEnum,d,f=()=>d??=(0,n.useFunc)(i,r.default),p;if(u||o)p=i.let(`valid`),e.block$data(p,m);else{if(!Array.isArray(s))throw Error(`ajv implementation error`);let e=i.const(`vSchema`,c);p=(0,t.or)(...s.map((t,n)=>h(e,n)))}e.pass(p);function m(){i.assign(p,!1),i.forOf(`v`,c,e=>i.if((0,t._)`${f()}(${a}, ${e})`,()=>i.assign(p,!0).break()))}function h(e,n){let r=s[n];return typeof r==`object`&&r?(0,t._)`${f()}(${a}, ${e}[${n}])`:(0,t._)`${a} === ${r}`}}}})),qB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=FB(),n=IB(),r=RB(),i=zB(),a=BB(),o=VB(),s=HB(),c=WB(),l=GB(),u=KB();e.default=[t.default,n.default,r.default,i.default,a.default,o.default,s.default,c.default,{keyword:`type`,schemaType:[`string`,`array`]},{keyword:`nullable`,schemaType:`boolean`},l.default,u.default]})),JB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateAdditionalItems=void 0;var t=Q(),n=$(),r={keyword:`additionalItems`,type:`array`,schemaType:[`boolean`,`object`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,n.checkStrictMode)(r,`"additionalItems" is ignored when "items" is not an array of schemas`);return}i(e,a)}};function i(e,r){let{gen:i,schema:a,data:o,keyword:s,it:c}=e;c.items=!0;let l=i.const(`len`,(0,t._)`${o}.length`);if(a===!1)e.setParams({len:r.length}),e.pass((0,t._)`${l} <= ${r.length}`);else if(typeof a==`object`&&!(0,n.alwaysValidSchema)(c,a)){let n=i.var(`valid`,(0,t._)`${l} <= ${r.length}`);i.if((0,t.not)(n),()=>u(n)),e.ok(n)}function u(a){i.forRange(`i`,r.length,l,r=>{e.subschema({keyword:s,dataProp:r,dataPropType:n.Type.Num},a),c.allErrors||i.if((0,t.not)(a),()=>i.break())})}}e.validateAdditionalItems=i,e.default=r})),YB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateTuple=void 0;var t=Q(),n=$(),r=lB(),i={keyword:`items`,type:`array`,schemaType:[`object`,`array`,`boolean`],before:`uniqueItems`,code(e){let{schema:t,it:i}=e;if(Array.isArray(t))return a(e,`additionalItems`,t);i.items=!0,!(0,n.alwaysValidSchema)(i,t)&&e.ok((0,r.validateArray)(e))}};function a(e,r,i=e.schema){let{gen:a,parentSchema:o,data:s,keyword:c,it:l}=e;f(o),l.opts.unevaluated&&i.length&&l.items!==!0&&(l.items=n.mergeEvaluated.items(a,i.length,l.items));let u=a.name(`valid`),d=a.const(`len`,(0,t._)`${s}.length`);i.forEach((r,i)=>{(0,n.alwaysValidSchema)(l,r)||(a.if((0,t._)`${d} > ${i}`,()=>e.subschema({keyword:c,schemaProp:i,dataProp:i},u)),e.ok(u))});function f(e){let{opts:t,errSchemaPath:a}=l,o=i.length,s=o===e.minItems&&(o===e.maxItems||e[r]===!1);if(t.strictTuples&&!s){let e=`"${c}" is ${o}-tuple, but minItems or maxItems/${r} are not specified or different at path "${a}"`;(0,n.checkStrictMode)(l,e,t.strictTuples)}}}e.validateTuple=a,e.default=i})),XB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=YB();e.default={keyword:`prefixItems`,type:`array`,schemaType:[`array`],before:`uniqueItems`,code:e=>(0,t.validateTuple)(e,`items`)}})),ZB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$(),r=lB(),i=JB();e.default={keyword:`items`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,error:{message:({params:{len:e}})=>(0,t.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,t._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:a,it:o}=e,{prefixItems:s}=a;o.items=!0,!(0,n.alwaysValidSchema)(o,t)&&(s?(0,i.validateAdditionalItems)(e,s):e.ok((0,r.validateArray)(e)))}}})),QB=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$();e.default={keyword:`contains`,type:`array`,schemaType:[`object`,`boolean`],before:`uniqueItems`,trackErrors:!0,error:{message:({params:{min:e,max:n}})=>n===void 0?(0,t.str)`must contain at least ${e} valid item(s)`:(0,t.str)`must contain at least ${e} and no more than ${n} valid item(s)`,params:({params:{min:e,max:n}})=>n===void 0?(0,t._)`{minContains: ${e}}`:(0,t._)`{minContains: ${e}, maxContains: ${n}}`},code(e){let{gen:r,schema:i,parentSchema:a,data:o,it:s}=e,c,l,{minContains:u,maxContains:d}=a;s.opts.next?(c=u===void 0?1:u,l=d):c=1;let f=r.const(`len`,(0,t._)`${o}.length`);if(e.setParams({min:c,max:l}),l===void 0&&c===0){(0,n.checkStrictMode)(s,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(l!==void 0&&c>l){(0,n.checkStrictMode)(s,`"minContains" > "maxContains" is always invalid`),e.fail();return}if((0,n.alwaysValidSchema)(s,i)){let n=(0,t._)`${f} >= ${c}`;l!==void 0&&(n=(0,t._)`${n} && ${f} <= ${l}`),e.pass(n);return}s.items=!0;let p=r.name(`valid`);l===void 0&&c===1?h(p,()=>r.if(p,()=>r.break())):c===0?(r.let(p,!0),l!==void 0&&r.if((0,t._)`${o}.length > 0`,m)):(r.let(p,!1),m()),e.result(p,()=>e.reset());function m(){let e=r.name(`_valid`),t=r.let(`count`,0);h(e,()=>r.if(e,()=>g(t)))}function h(t,i){r.forRange(`i`,0,f,r=>{e.subschema({keyword:`contains`,dataProp:r,dataPropType:n.Type.Num,compositeRule:!0},t),i()})}function g(e){r.code((0,t._)`${e}++`),l===void 0?r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0).break()):(r.if((0,t._)`${e} > ${l}`,()=>r.assign(p,!1).break()),c===1?r.assign(p,!0):r.if((0,t._)`${e} >= ${c}`,()=>r.assign(p,!0)))}}}})),$B=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;var t=Q(),n=$(),r=lB();e.error={message:({params:{property:e,depsCount:n,deps:r}})=>{let i=n===1?`property`:`properties`;return(0,t.str)`must have ${i} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:n,deps:r,missingProperty:i}})=>(0,t._)`{property: ${e},
274
- missingProperty: ${i},
275
- depsCount: ${n},
276
- deps: ${r}}`};var i={keyword:`dependencies`,type:`object`,schemaType:`object`,error:e.error,code(e){let[t,n]=a(e);o(e,t),s(e,n)}};function a({schema:e}){let t={},n={};for(let r in e){if(r===`__proto__`)continue;let i=Array.isArray(e[r])?t:n;i[r]=e[r]}return[t,n]}function o(e,n=e.schema){let{gen:i,data:a,it:o}=e;if(Object.keys(n).length===0)return;let s=i.let(`missing`);for(let c in n){let l=n[c];if(l.length===0)continue;let u=(0,r.propertyInData)(i,a,c,o.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(`, `)}),o.allErrors?i.if(u,()=>{for(let t of l)(0,r.checkReportMissingProp)(e,t)}):(i.if((0,t._)`${u} && (${(0,r.checkMissingProp)(e,l,s)})`),(0,r.reportMissingProp)(e,s),i.else())}}e.validatePropertyDeps=o;function s(e,t=e.schema){let{gen:i,data:a,keyword:o,it:s}=e,c=i.name(`valid`);for(let l in t)(0,n.alwaysValidSchema)(s,t[l])||(i.if((0,r.propertyInData)(i,a,l,s.opts.ownProperties),()=>{let t=e.subschema({keyword:o,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>i.var(c,!0)),e.ok(c))}e.validateSchemaDeps=s,e.default=i})),eV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$();e.default={keyword:`propertyNames`,type:`object`,schemaType:[`object`,`boolean`],error:{message:`property name must be valid`,params:({params:e})=>(0,t._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:r,schema:i,data:a,it:o}=e;if((0,n.alwaysValidSchema)(o,i))return;let s=r.name(`valid`);r.forIn(`key`,a,n=>{e.setParams({propertyName:n}),e.subschema({keyword:`propertyNames`,data:n,dataTypes:[`string`],propertyName:n,compositeRule:!0},s),r.if((0,t.not)(s),()=>{e.error(!0),o.allErrors||r.break()})}),e.ok(s)}}})),tV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=lB(),n=Q(),r=nB(),i=$();e.default={keyword:`additionalProperties`,type:[`object`],schemaType:[`boolean`,`object`],allowUndefined:!0,trackErrors:!0,error:{message:`must NOT have additional properties`,params:({params:e})=>(0,n._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:a,schema:o,parentSchema:s,data:c,errsCount:l,it:u}=e;if(!l)throw Error(`ajv implementation error`);let{allErrors:d,opts:f}=u;if(u.props=!0,f.removeAdditional!==`all`&&(0,i.alwaysValidSchema)(u,o))return;let p=(0,t.allSchemaProperties)(s.properties),m=(0,t.allSchemaProperties)(s.patternProperties);h(),e.ok((0,n._)`${l} === ${r.default.errors}`);function h(){a.forIn(`key`,c,e=>{!p.length&&!m.length?v(e):a.if(g(e),()=>v(e))})}function g(r){let o;if(p.length>8){let e=(0,i.schemaRefOrVal)(u,s.properties,`properties`);o=(0,t.isOwnProperty)(a,e,r)}else o=p.length?(0,n.or)(...p.map(e=>(0,n._)`${r} === ${e}`)):n.nil;return m.length&&(o=(0,n.or)(o,...m.map(i=>(0,n._)`${(0,t.usePattern)(e,i)}.test(${r})`))),(0,n.not)(o)}function _(e){a.code((0,n._)`delete ${c}[${e}]`)}function v(t){if(f.removeAdditional===`all`||f.removeAdditional&&o===!1){_(t);return}if(o===!1){e.setParams({additionalProperty:t}),e.error(),d||a.break();return}if(typeof o==`object`&&!(0,i.alwaysValidSchema)(u,o)){let r=a.name(`valid`);f.removeAdditional===`failing`?(ee(t,r,!1),a.if((0,n.not)(r),()=>{e.reset(),_(t)})):(ee(t,r),d||a.if((0,n.not)(r),()=>a.break()))}}function ee(t,n,r){let a={keyword:`additionalProperties`,dataProp:t,dataPropType:i.Type.Str};r===!1&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(a,n)}}}})),nV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=hB(),n=lB(),r=$(),i=tV();e.default={keyword:`properties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,parentSchema:s,data:c,it:l}=e;l.opts.removeAdditional===`all`&&s.additionalProperties===void 0&&i.default.code(new t.KeywordCxt(l,i.default,`additionalProperties`));let u=(0,n.allSchemaProperties)(o);for(let e of u)l.definedProperties.add(e);l.opts.unevaluated&&u.length&&l.props!==!0&&(l.props=r.mergeEvaluated.props(a,(0,r.toHash)(u),l.props));let d=u.filter(e=>!(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0)return;let f=a.name(`valid`);for(let t of d)p(t)?m(t):(a.if((0,n.propertyInData)(a,c,t,l.opts.ownProperties)),m(t),l.allErrors||a.else().var(f,!0),a.endIf()),e.it.definedProperties.add(t),e.ok(f);function p(e){return l.opts.useDefaults&&!l.compositeRule&&o[e].default!==void 0}function m(t){e.subschema({keyword:`properties`,schemaProp:t,dataProp:t},f)}}}})),rV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=lB(),n=Q(),r=$(),i=$();e.default={keyword:`patternProperties`,type:`object`,schemaType:`object`,code(e){let{gen:a,schema:o,data:s,parentSchema:c,it:l}=e,{opts:u}=l,d=(0,t.allSchemaProperties)(o),f=d.filter(e=>(0,r.alwaysValidSchema)(l,o[e]));if(d.length===0||f.length===d.length&&(!l.opts.unevaluated||l.props===!0))return;let p=u.strictSchema&&!u.allowMatchingProperties&&c.properties,m=a.name(`valid`);l.props!==!0&&!(l.props instanceof n.Name)&&(l.props=(0,i.evaluatedPropsToName)(a,l.props));let{props:h}=l;g();function g(){for(let e of d)p&&_(e),l.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}function _(e){for(let t in p)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn(`key`,s,o=>{a.if((0,n._)`${(0,t.usePattern)(e,r)}.test(${o})`,()=>{let t=f.includes(r);t||e.subschema({keyword:`patternProperties`,schemaProp:r,dataProp:o,dataPropType:i.Type.Str},m),l.opts.unevaluated&&h!==!0?a.assign((0,n._)`${h}[${o}]`,!0):!t&&!l.allErrors&&a.if((0,n.not)(m),()=>a.break())})})}}}})),iV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=$();e.default={keyword:`not`,schemaType:[`object`,`boolean`],trackErrors:!0,code(e){let{gen:n,schema:r,it:i}=e;if((0,t.alwaysValidSchema)(i,r)){e.fail();return}let a=n.name(`valid`);e.subschema({keyword:`not`,compositeRule:!0,createErrors:!1,allErrors:!1},a),e.failResult(a,()=>e.reset(),()=>e.error())},error:{message:`must NOT be valid`}}})),aV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default={keyword:`anyOf`,schemaType:`array`,trackErrors:!0,code:lB().validateUnion,error:{message:`must match a schema in anyOf`}}})),oV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$();e.default={keyword:`oneOf`,schemaType:`array`,trackErrors:!0,error:{message:`must match exactly one schema in oneOf`,params:({params:e})=>(0,t._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:r,schema:i,parentSchema:a,it:o}=e;if(!Array.isArray(i))throw Error(`ajv implementation error`);if(o.opts.discriminator&&a.discriminator)return;let s=i,c=r.let(`valid`,!1),l=r.let(`passing`,null),u=r.name(`_valid`);e.setParams({passing:l}),r.block(d),e.result(c,()=>e.reset(),()=>e.error(!0));function d(){s.forEach((i,a)=>{let s;(0,n.alwaysValidSchema)(o,i)?r.var(u,!0):s=e.subschema({keyword:`oneOf`,schemaProp:a,compositeRule:!0},u),a>0&&r.if((0,t._)`${u} && ${c}`).assign(c,!1).assign(l,(0,t._)`[${l}, ${a}]`).else(),r.if(u,()=>{r.assign(c,!0),r.assign(l,a),s&&e.mergeEvaluated(s,t.Name)})})}}}})),sV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=$();e.default={keyword:`allOf`,schemaType:`array`,code(e){let{gen:n,schema:r,it:i}=e;if(!Array.isArray(r))throw Error(`ajv implementation error`);let a=n.name(`valid`);r.forEach((n,r)=>{if((0,t.alwaysValidSchema)(i,n))return;let o=e.subschema({keyword:`allOf`,schemaProp:r},a);e.ok(a),e.mergeEvaluated(o)})}}})),cV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=$(),r={keyword:`if`,schemaType:[`object`,`boolean`],trackErrors:!0,error:{message:({params:e})=>(0,t.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,t._)`{failingKeyword: ${e.ifClause}}`},code(e){let{gen:r,parentSchema:a,it:o}=e;a.then===void 0&&a.else===void 0&&(0,n.checkStrictMode)(o,`"if" without "then" and "else" is ignored`);let s=i(o,`then`),c=i(o,`else`);if(!s&&!c)return;let l=r.let(`valid`,!0),u=r.name(`_valid`);if(d(),e.reset(),s&&c){let t=r.let(`ifClause`);e.setParams({ifClause:t}),r.if(u,f(`then`,t),f(`else`,t))}else s?r.if(u,f(`then`)):r.if((0,t.not)(u),f(`else`));e.pass(l,()=>e.error(!0));function d(){let t=e.subschema({keyword:`if`,compositeRule:!0,createErrors:!1,allErrors:!1},u);e.mergeEvaluated(t)}function f(n,i){return()=>{let a=e.subschema({keyword:n},u);r.assign(l,u),e.mergeValidEvaluated(a,l),i?r.assign(i,(0,t._)`${n}`):e.setParams({ifClause:n})}}}};function i(e,t){let r=e.schema[t];return r!==void 0&&!(0,n.alwaysValidSchema)(e,r)}e.default=r})),lV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=$();e.default={keyword:[`then`,`else`],schemaType:[`object`,`boolean`],code({keyword:e,parentSchema:n,it:r}){n.if===void 0&&(0,t.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}})),uV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=JB(),n=XB(),r=YB(),i=ZB(),a=QB(),o=$B(),s=eV(),c=tV(),l=nV(),u=rV(),d=iV(),f=aV(),p=oV(),m=sV(),h=cV(),g=lV();function _(e=!1){let _=[d.default,f.default,p.default,m.default,h.default,g.default,s.default,c.default,o.default,l.default,u.default];return e?_.push(n.default,i.default):_.push(t.default,r.default),_.push(a.default),_}e.default=_})),dV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={keyword:`format`,type:[`number`,`string`],schemaType:`string`,$data:!0,error:{message:({schemaCode:e})=>(0,t.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,t._)`{format: ${e}}`},code(e,n){let{gen:r,data:i,$data:a,schema:o,schemaCode:s,it:c}=e,{opts:l,errSchemaPath:u,schemaEnv:d,self:f}=c;if(!l.validateFormats)return;a?p():m();function p(){let a=r.scopeValue(`formats`,{ref:f.formats,code:l.code.formats}),o=r.const(`fDef`,(0,t._)`${a}[${s}]`),c=r.let(`fType`),u=r.let(`format`);r.if((0,t._)`typeof ${o} == "object" && !(${o} instanceof RegExp)`,()=>r.assign(c,(0,t._)`${o}.type || "string"`).assign(u,(0,t._)`${o}.validate`),()=>r.assign(c,(0,t._)`"string"`).assign(u,o)),e.fail$data((0,t.or)(p(),m()));function p(){return l.strictSchema===!1?t.nil:(0,t._)`${s} && !${u}`}function m(){let e=d.$async?(0,t._)`(${o}.async ? await ${u}(${i}) : ${u}(${i}))`:(0,t._)`${u}(${i})`,r=(0,t._)`(typeof ${u} == "function" ? ${e} : ${u}.test(${i}))`;return(0,t._)`${u} && ${u} !== true && ${c} === ${n} && !${r}`}}function m(){let a=f.formats[o];if(!a){m();return}if(a===!0)return;let[s,c,p]=h(a);s===n&&e.pass(g());function m(){if(l.strictSchema===!1){f.logger.warn(e());return}throw Error(e());function e(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function h(e){let n=e instanceof RegExp?(0,t.regexpCode)(e):l.code.formats?(0,t._)`${l.code.formats}${(0,t.getProperty)(o)}`:void 0,i=r.scopeValue(`formats`,{key:o,ref:e,code:n});return typeof e==`object`&&!(e instanceof RegExp)?[e.type||`string`,e.validate,(0,t._)`${i}.validate`]:[`string`,e,i]}function g(){if(typeof a==`object`&&!(a instanceof RegExp)&&a.async){if(!d.$async)throw Error(`async format in sync schema`);return(0,t._)`await ${p}(${i})`}return typeof c==`function`?(0,t._)`${p}(${i})`:(0,t._)`${p}.test(${i})`}}}}})),fV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=[dV().default]})),pV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=[`title`,`description`,`default`,`deprecated`,`readOnly`,`writeOnly`,`examples`],e.contentVocabulary=[`contentMediaType`,`contentEncoding`,`contentSchema`]})),mV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiscrError=void 0;var t;(function(e){e.Tag=`tag`,e.Mapping=`mapping`})(t||(e.DiscrError=t={}))})),hV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q(),n=mV(),r=vB(),i=_B(),a=$();e.default={keyword:`discriminator`,type:`object`,schemaType:`object`,error:{message:({params:{discrError:e,tagName:t}})=>e===n.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:n,tagName:r}})=>(0,t._)`{error: ${e}, tag: ${r}, tagValue: ${n}}`},code(e){let{gen:o,data:s,schema:c,parentSchema:l,it:u}=e,{oneOf:d}=l;if(!u.opts.discriminator)throw Error(`discriminator: requires discriminator option`);let f=c.propertyName;if(typeof f!=`string`)throw Error(`discriminator: requires propertyName`);if(c.mapping)throw Error(`discriminator: mapping is not supported`);if(!d)throw Error(`discriminator: requires oneOf keyword`);let p=o.let(`valid`,!1),m=o.const(`tag`,(0,t._)`${s}${(0,t.getProperty)(f)}`);o.if((0,t._)`typeof ${m} == "string"`,()=>h(),()=>e.error(!1,{discrError:n.DiscrError.Tag,tag:m,tagName:f})),e.ok(p);function h(){let r=_();o.if(!1);for(let e in r)o.elseIf((0,t._)`${m} === ${e}`),o.assign(p,g(r[e]));o.else(),e.error(!1,{discrError:n.DiscrError.Mapping,tag:m,tagName:f}),o.endIf()}function g(n){let r=o.name(`valid`),i=e.subschema({keyword:`oneOf`,schemaProp:n},r);return e.mergeEvaluated(i,t.Name),r}function _(){let e={},t=o(l),n=!0;for(let e=0;e<d.length;e++){let c=d[e];if(c?.$ref&&!(0,a.schemaHasRulesButRef)(c,u.self.RULES)){let e=c.$ref;if(c=r.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e),c instanceof r.SchemaEnv&&(c=c.schema),c===void 0)throw new i.default(u.opts.uriResolver,u.baseId,e)}let l=c?.properties?.[f];if(typeof l!=`object`)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${f}"`);n&&=t||o(c),s(l,e)}if(!n)throw Error(`discriminator: "${f}" must be required`);return e;function o({required:e}){return Array.isArray(e)&&e.includes(f)}function s(e,t){if(e.const)c(e.const,t);else if(e.enum)for(let n of e.enum)c(n,t);else throw Error(`discriminator: "properties/${f}" must have "const" or "enum"`)}function c(t,n){if(typeof t!=`string`||t in e)throw Error(`discriminator: "${f}" values must be unique strings`);e[t]=n}}}}})),gV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c(!0),l),"date-time":t(f(!0),p),"iso-time":t(c(),u),"iso-date-time":t(f(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:_,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:se,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:ee,int32:{type:`number`,validate:re},int64:{type:`number`,validate:ie},float:{type:`number`,validate:ae},double:{type:`number`,validate:ae},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function c(e){return function(t){let n=s.exec(t);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[4],c=n[5]===`-`?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||e&&!o)return!1;if(r<=23&&i<=59&&a<60)return!0;let d=i-u*c,f=r-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function l(e,t){if(!(e&&t))return;let n=new Date(`2020-01-01T`+e).valueOf(),r=new Date(`2020-01-01T`+t).valueOf();if(n&&r)return n-r}function u(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t?1:e<t?-1:0}var d=/t|\s/i;function f(e){let t=c(e);return function(e){let n=e.split(d);return n.length===2&&a(n[0])&&t(n[1])}}function p(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(n&&r)return n-r}function m(e,t){if(!(e&&t))return;let[n,r]=e.split(d),[i,a]=t.split(d),s=o(n,i);if(s!==void 0)return s||l(r,a)}var h=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function _(e){return h.test(e)&&g.test(e)}var v=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function ee(e){return v.lastIndex=0,v.test(e)}var te=-(2**31),ne=2**31-1;function re(e){return Number.isInteger(e)&&e<=ne&&e>=te}function ie(e){return Number.isInteger(e)}function ae(){return!0}var oe=/[^\\]\\Z/;function se(e){if(oe.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),_V=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=PB(),n=qB(),r=uV(),i=fV(),a=pV();e.default=[t.default,n.default,(0,r.default)(),i.default,a.metadataVocabulary,a.contentVocabulary]})),vV=n({$id:()=>bV,$schema:()=>yV,default:()=>TV,definitions:()=>SV,properties:()=>wV,title:()=>xV,type:()=>CV}),yV,bV,xV,SV,CV,wV,TV,EV=e((()=>{yV=`http://json-schema.org/draft-07/schema#`,bV=`http://json-schema.org/draft-07/schema#`,xV=`Core schema meta-schema`,SV={schemaArray:{type:`array`,minItems:1,items:{$ref:`#`}},nonNegativeInteger:{type:`integer`,minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:`#/definitions/nonNegativeInteger`},{default:0}]},simpleTypes:{enum:[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`]},stringArray:{type:`array`,items:{type:`string`},uniqueItems:!0,default:[]}},CV=[`object`,`boolean`],wV={$id:{type:`string`,format:`uri-reference`},$schema:{type:`string`,format:`uri`},$ref:{type:`string`,format:`uri-reference`},$comment:{type:`string`},title:{type:`string`},description:{type:`string`},default:!0,readOnly:{type:`boolean`,default:!1},examples:{type:`array`,items:!0},multipleOf:{type:`number`,exclusiveMinimum:0},maximum:{type:`number`},exclusiveMaximum:{type:`number`},minimum:{type:`number`},exclusiveMinimum:{type:`number`},maxLength:{$ref:`#/definitions/nonNegativeInteger`},minLength:{$ref:`#/definitions/nonNegativeIntegerDefault0`},pattern:{type:`string`,format:`regex`},additionalItems:{$ref:`#`},items:{anyOf:[{$ref:`#`},{$ref:`#/definitions/schemaArray`}],default:!0},maxItems:{$ref:`#/definitions/nonNegativeInteger`},minItems:{$ref:`#/definitions/nonNegativeIntegerDefault0`},uniqueItems:{type:`boolean`,default:!1},contains:{$ref:`#`},maxProperties:{$ref:`#/definitions/nonNegativeInteger`},minProperties:{$ref:`#/definitions/nonNegativeIntegerDefault0`},required:{$ref:`#/definitions/stringArray`},additionalProperties:{$ref:`#`},definitions:{type:`object`,additionalProperties:{$ref:`#`},default:{}},properties:{type:`object`,additionalProperties:{$ref:`#`},default:{}},patternProperties:{type:`object`,additionalProperties:{$ref:`#`},propertyNames:{format:`regex`},default:{}},dependencies:{type:`object`,additionalProperties:{anyOf:[{$ref:`#`},{$ref:`#/definitions/stringArray`}]}},propertyNames:{$ref:`#`},const:!0,enum:{type:`array`,items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:`#/definitions/simpleTypes`},{type:`array`,items:{$ref:`#/definitions/simpleTypes`},minItems:1,uniqueItems:!0}]},format:{type:`string`},contentMediaType:{type:`string`},contentEncoding:{type:`string`},if:{$ref:`#`},then:{$ref:`#`},else:{$ref:`#`},allOf:{$ref:`#/definitions/schemaArray`},anyOf:{$ref:`#/definitions/schemaArray`},oneOf:{$ref:`#/definitions/schemaArray`},not:{$ref:`#`}},TV={$schema:yV,$id:bV,title:xV,definitions:SV,type:CV,properties:wV,default:!0}})),DV=r(((e,n)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;var r=jB(),i=_V(),a=hV(),o=(EV(),t(vV).default),s=[`/properties`],c=`http://json-schema.org/draft-07/schema`,l=class extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(a.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(e,c,!1),this.refs[`http://json-schema.org/schema`]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=l,n.exports=e=l,n.exports.Ajv=l,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=l;var u=hB();Object.defineProperty(e,`KeywordCxt`,{enumerable:!0,get:function(){return u.KeywordCxt}});var d=Q();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,`CodeGen`,{enumerable:!0,get:function(){return d.CodeGen}});var f=gB();Object.defineProperty(e,`ValidationError`,{enumerable:!0,get:function(){return f.default}});var p=_B();Object.defineProperty(e,`MissingRefError`,{enumerable:!0,get:function(){return p.default}})})),OV=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatLimitDefinition=void 0;var t=DV(),n=Q(),r=n.operators,i={formatMaximum:{okStr:`<=`,ok:r.LTE,fail:r.GT},formatMinimum:{okStr:`>=`,ok:r.GTE,fail:r.LT},formatExclusiveMaximum:{okStr:`<`,ok:r.LT,fail:r.GTE},formatExclusiveMinimum:{okStr:`>`,ok:r.GT,fail:r.LTE}};e.formatLimitDefinition={keyword:Object.keys(i),type:`string`,schemaType:`string`,$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,n.str)`should be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,n._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{gen:r,data:a,schemaCode:o,keyword:s,it:c}=e,{opts:l,self:u}=c;if(!l.validateFormats)return;let d=new t.KeywordCxt(c,u.RULES.all.format.definition,`format`);d.$data?f():p();function f(){let t=r.scopeValue(`formats`,{ref:u.formats,code:l.code.formats}),i=r.const(`fmt`,(0,n._)`${t}[${d.schemaCode}]`);e.fail$data((0,n.or)((0,n._)`typeof ${i} != "object"`,(0,n._)`${i} instanceof RegExp`,(0,n._)`typeof ${i}.compare != "function"`,m(i)))}function p(){let t=d.schema,i=u.formats[t];if(!i||i===!0)return;if(typeof i!=`object`||i instanceof RegExp||typeof i.compare!=`function`)throw Error(`"${s}": format "${t}" does not define "compare" function`);let a=r.scopeValue(`formats`,{key:t,ref:i,code:l.code.formats?(0,n._)`${l.code.formats}${(0,n.getProperty)(t)}`:void 0});e.fail$data(m(a))}function m(e){return(0,n._)`${e}.compare(${a}, ${o}) ${i[s].fail} 0`}},dependencies:[`format`]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}));r(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=gV(),r=OV(),i=Q(),a=new i.Name(`fullFormats`),o=new i.Name(`fastFormats`),s=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,n.fullFormats,a),e;let[i,s]=t.mode===`fast`?[n.fastFormats,o]:[n.fullFormats,a];return c(e,t.formats||n.formatNames,i,s),t.keywords&&(0,r.default)(e),e};s.get=(e,t=`full`)=>{let r=(t===`fast`?n.fastFormats:n.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function c(e,t,n,r){var a;(a=e.opts.code).formats??(a.formats=(0,i._)`require("ajv-formats/dist/formats").${r}`);for(let r of t)e.addFormat(r,n[r])}t.exports=e=s,Object.defineProperty(e,`__esModule`,{value:!0}),e.default=s}))();var kV=`GALAXY_TOOLSHED_URL`;function AV(){if(typeof process<`u`)return{}[kV]}var jV=class{defaultToolshedUrl;index;storage;memoryCache=new Map;constructor(e){this.defaultToolshedUrl=e.defaultToolshedUrl??AV()??`https://toolshed.g2.bx.psu.edu`,this.storage=e.storage,this.index=new _t(this.storage)}resolveToolCoordinates(e,t){let n=pt(e);return n===null?{toolshedUrl:this.defaultToolshedUrl,trsToolId:e,version:t??null,readableId:mt(this.defaultToolshedUrl,e)}:{toolshedUrl:n.toolshedUrl,trsToolId:n.trsToolId,version:t??n.toolVersion,readableId:mt(n.toolshedUrl,n.trsToolId)}}async hasCached(e,t){let n=this.resolveToolCoordinates(e,t);if(n.version===null)return!1;let r=await ht(n.toolshedUrl,n.trsToolId,n.version);return this.memoryCache.has(r)||await this.storage.load(r)!==null}async loadCached(e){if(this.memoryCache.has(e))return this.memoryCache.get(e);try{let t=await this.storage.load(e);if(t===null)return null;let n=wA(jI)(t);if(!await this.index.has(e)){let r=t;await this.index.add(e,r.id??n.id??`unknown`,n.version??`unknown`,`orphan`)}return this.memoryCache.set(e,n),n}catch(t){return console.debug(`Failed to load cached tool ${e}: ${t}`),null}}async loadCachedRaw(e){return this.storage.load(e)}async statCached(e){return typeof this.storage.stat==`function`?this.storage.stat(e):null}async removeCached(e){let t=await this.index.has(e),n=t?!1:(await this.storage.list()).includes(e),r=t||n;return await this.storage.delete(e),await this.index.remove(e),this.memoryCache.delete(e),r}async saveTool(e,t,n,r,i,a=``){await this.storage.save(e,t),await this.index.add(e,n,r,i,a),this.memoryCache.set(e,t)}async listCached(){return this.index.listAll()}async getCacheStats(){let e=await this.index.listAll(),t={},n,r;for(let i of e)t[i.source]=(t[i.source]??0)+1,(n===void 0||i.cached_at<n)&&(n=i.cached_at),(r===void 0||i.cached_at>r)&&(r=i.cached_at);let i={count:e.length,bySource:t};if(n!==void 0&&(i.oldest=n),r!==void 0&&(i.newest=r),typeof this.storage.stat==`function`){let t=0;for(let n of e){let e=await this.storage.stat(n.cache_key);e!==null&&(t+=e.sizeBytes)}i.totalBytes=t}return i}async clearCache(e){if(e===void 0){let e=await this.storage.list();for(let t of e)await this.storage.delete(t);return await this.index.clear(),this.memoryCache.clear(),e.length}let t=e.replace(/\*$/,``),n=(await this.index.listAll()).filter(e=>e.tool_id.startsWith(t));for(let e of n)await this.storage.delete(e.cache_key),await this.index.remove(e.cache_key),this.memoryCache.delete(e.cache_key);return n.length}},MV=`galaxy-tool-cache-v1`,NV=`data`,PV=`__index__`,FV=class{dbName;db=null;constructor(e=MV){this.dbName=e}getDb(){return this.db===null?new Promise((e,t)=>{let n=indexedDB.open(this.dbName,1);n.onupgradeneeded=e=>{let t=e.target.result;t.objectStoreNames.contains(NV)||t.createObjectStore(NV)},n.onsuccess=t=>{this.db=t.target.result,e(this.db)},n.onerror=()=>t(n.error)}):Promise.resolve(this.db)}async load(e){let t=await this.getDb();return new Promise((n,r)=>{let i=t.transaction(NV,`readonly`).objectStore(NV).get(e);i.onsuccess=()=>n(i.result??null),i.onerror=()=>r(i.error)})}async save(e,t){let n=await this.getDb();return new Promise((r,i)=>{let a=n.transaction(NV,`readwrite`);a.objectStore(NV).put(t,e),a.oncomplete=()=>r(),a.onerror=()=>i(a.error)})}async delete(e){let t=await this.getDb();return new Promise((n,r)=>{let i=t.transaction(NV,`readwrite`);i.objectStore(NV).delete(e),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async list(){let e=await this.getDb();return new Promise((t,n)=>{let r=e.transaction(NV,`readonly`).objectStore(NV).getAllKeys();r.onsuccess=()=>t(r.result.filter(e=>e!==PV)),r.onerror=()=>n(r.error)})}async stat(e){let t=await this.load(e);if(t===null)return null;let n;return n=t instanceof Blob?t.size:JSON.stringify(t).length,{sizeBytes:n}}async saveAll(e){let t=await this.getDb();return new Promise((n,r)=>{let i=t.transaction(NV,`readwrite`),a=i.objectStore(NV);for(let[t,n]of e)a.put(n,t);i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}},IV=class extends Error{url;statusCode;_tag=`ToolFetchError`;constructor(e,t,n){super(e),this.url=t,this.statusCode=n}};async function LV(e,t,n,r=globalThis.fetch){let i=`${e}/api/tools/${t}/versions/${n}`,a=await r(i,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(3e4)});if(!a.ok){let e=await a.text().catch(()=>``);throw new IV(`Failed to fetch from ${i}: ${a.status} ${e.slice(0,200)}`,i,a.status)}let o=await a.json();return wA(jI)(o)}async function RV(e,t,n,r=globalThis.fetch){let i=`${e}/api/tools/${encodeURIComponent(t)}/parsed${n?`?tool_version=${encodeURIComponent(n)}`:``}`,a=await r(i,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(3e4)});if(!a.ok){let e=await a.text().catch(()=>``);throw new IV(`Failed to fetch from Galaxy ${i}: ${a.status} ${e.slice(0,200)}`,i,a.status)}let o=await a.json();return wA(jI)(o)}var zV=3e4;function BV(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`TRS versions response: entries[${t}] must be an object`);let n=e;if(typeof n.id!=`string`)throw Error(`TRS versions response: entries[${t}].id must be a string`);if(n.name!==null&&typeof n.name!=`string`)throw Error(`TRS versions response: entries[${t}].name must be a string or null`);if(typeof n.url!=`string`)throw Error(`TRS versions response: entries[${t}].url must be a string`);if(!Array.isArray(n.descriptor_type)||n.descriptor_type.some(e=>typeof e!=`string`))throw Error(`TRS versions response: entries[${t}].descriptor_type must be a string array`);if(!Array.isArray(n.author)||n.author.some(e=>typeof e!=`string`))throw Error(`TRS versions response: entries[${t}].author must be a string array`);return n}async function VV(e,t,n=globalThis.fetch){let r=`${e}/api/ga4gh/trs/v2/tools/${encodeURIComponent(t)}/versions`,i;try{i=await n(r,{headers:{Accept:`application/json`},signal:AbortSignal.timeout(zV)})}catch(e){throw new IV(`TRS versions request to ${r} failed: ${e.message}`,r)}if(!i.ok){let e=await i.text().catch(()=>``);throw new IV(`TRS versions request to ${r} failed: ${i.status} ${e.slice(0,200)}`,r,i.status)}let a=await i.json();if(!Array.isArray(a))throw new IV(`TRS versions response from ${r} was not an array`,r,i.status);try{return a.map(BV)}catch(e){throw new IV(`TRS versions response from ${r} was malformed: ${e.message}`,r,i.status)}}async function HV(e,t,n=globalThis.fetch){let r=await VV(e,t,n);return r.length>0?r[r.length-1].id:null}var UV=class{cache;sources;fetcher;constructor(e){this.cache=new jV({storage:e.storage,defaultToolshedUrl:e.defaultToolshedUrl}),this.fetcher=e.fetcher??globalThis.fetch,e.sources?this.sources=e.sources:(this.sources=[{type:`toolshed`,url:e.defaultToolshedUrl??this.cache.defaultToolshedUrl}],e.galaxyUrl&&this.sources.push({type:`galaxy`,url:e.galaxyUrl}))}async getToolInfo(e,t){let n=this.cache.resolveToolCoordinates(e,t),r=n.version;if(r===null&&(r=await this.resolveLatestVersion(n.toolshedUrl,n.trsToolId),r===null))throw Error(`No version available for tool: ${e}`);let i=await ht(n.toolshedUrl,n.trsToolId,r),a=await this.cache.loadCached(i);if(a!==null)return a;for(let t of this.sources)try{let a,o,s;return t.type===`toolshed`?(a=await LV(t.url,n.trsToolId,r,this.fetcher),o=`api`,s=`${t.url}/api/tools/${n.trsToolId}/versions/${r}`):(a=await RV(t.url,e,r,this.fetcher),o=`galaxy`,s=`${t.url}/api/tools/${encodeURIComponent(e)}/parsed`),await this.cache.saveTool(i,a,n.readableId,r,o,s),a}catch(e){let r=e instanceof Error?e.message:String(e);console.debug(`${t.type} fetch failed (${t.url}) for ${n.trsToolId}: ${r}`)}return null}async resolveLatestVersion(e,t){try{return await HV(e,t,this.fetcher)}catch(n){let r=n instanceof Error?n.message:String(n);return console.debug(`TRS latest-version lookup failed for ${t} on ${e}: ${r}`),null}}async refetch(e,t,n){let r=this.cache.resolveToolCoordinates(e,t??null),i=r.version,a=!1;if(i!==null&&(a=await this.cache.hasCached(e,i)),a&&!n?.force)return{cacheKey:await ht(r.toolshedUrl,r.trsToolId,i),fetched:!1,alreadyCached:!0};if(a&&n?.force&&i!==null){let e=await ht(r.toolshedUrl,r.trsToolId,i);await this.cache.removeCached(e)}let o=await this.getToolInfo(e,t??null);if(o===null)throw Error(`Failed to fetch tool: ${e}`);return i=o.version??i??`unknown`,{cacheKey:await ht(r.toolshedUrl,r.trsToolId,i),fetched:!0,alreadyCached:a}}async addTool(e,t,n,r=`local`,i=``){let a=this.cache.resolveToolCoordinates(e,t),o=a.version??t,s=await ht(a.toolshedUrl,a.trsToolId,o);return await this.cache.saveTool(s,n,a.readableId,o,r,i),s}},WV=null,GV=`https://toolshed.g2.bx.psu.edu`,KV=`gxwf-ui:tool-cache`;function qV(e={}){if(WV)return WV;let t={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1},n=e.toolshedUrl??t.VITE_GXWF_TOOLSHED_URL??GV,r=e.toolCacheProxyUrl??t.VITE_GXWF_TOOL_CACHE_PROXY_URL,i=e.cacheDbName??t.VITE_GXWF_CACHE_DB_NAME??KV,a=[];r&&a.push({type:`galaxy`,url:r}),a.push({type:`toolshed`,url:n});let o=new FV(i);return n!==GV&&console.info(`[gxwf-ui] VITE_GXWF_TOOLSHED_URL=${n} — ensure the page CSP connect-src includes this origin (gxwf-web: --csp-connect-src).`),WV=new UV({storage:o,sources:a,defaultToolshedUrl:n}),WV}export{sz as a,ct as c,Vz as i,We as l,$z as n,XL as o,Kz as r,pt as s,qV as t,je as u};